col-shape 和raw-shape指的是什么 进一步解释 void load_image_chunk_norm( ap_uint<8> img_buf[16][34][66], ap_uint<8> * image_in_raw_pad_burst,// int raw, int col, int raw_shape, int col_shape) { ap_uint<8> * image_pad_in_pad_burst_ptr; for (int co = 0; co < 16; co++) { image_pad_in_pad_burst_ptr = image_in_raw_pad_burst + co * raw_shape * col_shape + raw * 32 * col_shape + col * 64; for (int h = 0; h < 34; h++) { for (int w = 0; w < 66; w++) { img_buf[co][h][w] = image_pad_in_pad_burst_ptr[w]; } image_pad_in_pad_burst_ptr += col_shape; } } } void Special_test1( ap_uint<8> static image_in_raw_pad[16 * 512 * 1024], ap_uint<8> static ddr_dw0_out_PL_burst[16 * 130 * 258], ap_uint<8> static ddr_dw1_out_PL_burst[16 * 130 * 258], ap_uint<8> static out_feature[16 * 128 * 256]) { ap_uint<8> static FeatureMapBuf0[16][34][66]; ap_uint<8> static FeatureMapBuf1[16][34][66]; for (int raw = 0; raw < 16; raw++) { for (int col = 0; col < 16; col++) { load_image_1x1(FeatureMapBuf0, image_in_raw_pad, raw, col, 512, 1024); conv1x1(FeatureMapBuf0, FeatureMapBuf1, weight_conv1,bias_conv1_int, q_dq_1); store_4x4_AvgPooling_debug(FeatureMapBuf1, ddr_dw0_out_PL_burst, raw, col, 130, 258); } } std::cout << "over!!!!"; for (int raw = 0; raw < 8; raw++) { for (int col = 0; col < 8; col++) { load_image_chunk_norm(FeatureMapBuf0, ddr_dw0_out_PL_burst, raw, col, 130, 258); DW_CONV_3x3(FeatureMapBuf0, FeatureMapBuf1, weight_conv3,bias_conv3_int, q_dq_3); store_3x3conv(FeatureMapBuf1, ddr_dw1_out_PL_burst, raw, col, 130, 258); } }
时间: 2024-04-24 21:21:40 浏览: 10
在这段代码中,`raw_shape`和`col_shape`是指原始图像的行数和列数。
在函数`load_image_chunk_norm`中,通过将偏移量乘以`raw_shape`和`col_shape`来计算图像数据的位置。具体来说,在以下代码中:
```cpp
image_pad_in_pad_burst_ptr = image_in_raw_pad_burst + co * raw_shape * col_shape + raw * 32 * col_shape + col * 64;
```
- `co * raw_shape * col_shape`是通道索引的偏移量。
- `raw * 32 * col_shape`是行索引的偏移量。
- `col * 64`是列索引的偏移量。
这些偏移量用于将指针`image_pad_in_pad_burst_ptr`定位到正确的位置,以便从该位置开始读取数据并存储到`img_buf[co][h][w]`中。
在`Special_test1`函数中的循环中,调用了`load_image_chunk_norm`函数来加载图像块数据到`FeatureMapBuf0`中。传递给函数的参数为:`FeatureMapBuf0`(表示存储加载后图像块数据的目标数组)、`ddr_dw0_out_PL_burst`(表示图像块数据的源数组)、`raw`(表示当前图像块所在的行索引)、`col`(表示当前图像块所在的列索引)、`130`(表示原始行数)、`258`(表示原始列数)。
通过这些参数,可以计算出正确的偏移量,并将图像块数据加载到`FeatureMapBuf0`中。
总结来说,`raw_shape`和`col_shape`是原始图像的行数和列数,用于计算图像数据的位置偏移量。这些偏移量用于在`load_image_chunk_norm`函数中定位图像数据的位置。