• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 Google LLC
2 //
3 // This source code is licensed under the BSD-style license found in the
4 // LICENSE file in the root directory of this source tree.
5 
6 #include <assert.h>
7 
8 #include <xnnpack/depthtospace.h>
9 
10 
xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar(size_t output_channels,size_t input_height,size_t input_width,size_t block_size,const uint32_t * restrict input,uint32_t * restrict output,size_t output_channel_stride)11 void xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar(
12     size_t output_channels,
13     size_t input_height,
14     size_t input_width,
15     size_t block_size,
16     const uint32_t*restrict input,
17     uint32_t*restrict output,
18     size_t output_channel_stride)
19 {
20   assert(output_channels != 0);
21   assert(input_height != 0);
22   assert(input_width != 0);
23   assert(block_size != 0);
24 
25   for (size_t iy = 0; iy < input_height; iy++) {
26     for (size_t by = 0; by < block_size; by++) {
27       for (size_t ix = 0; ix < input_width; ix++) {
28         for (size_t bx = 0; bx < block_size; bx++) {
29           for (size_t oc = 0; oc < output_channels; oc++) {
30             output[(((iy * block_size + by) * input_width + ix) * block_size + bx) * output_channel_stride + oc] =
31               input[(((by * block_size + bx) * output_channels + oc) * input_height + iy) * input_width + ix];
32           }
33         }
34       }
35     }
36   }
37 }
38