dsImage_cpu
下采样downsampling接口。
接口定义
C interface:
void dsImage_cpu(float* out, const float* in, float *tmp, const float* filter, int filter_width, int n, int m);
参数
参数名 |
类型 |
描述 |
输入/输出 |
|---|---|---|---|
out |
float类型 |
下采样最终结果输出 |
输出 |
in |
float类型 |
输入数据 |
输入 |
tmp |
float类型 |
下采样中间结果输出 |
输出 |
filter |
float类型 |
滤波器 |
输入 |
filter_width |
int类型 |
滤波器的长度 |
输入 |
n |
int类型 |
输入数据的宽度 |
输入 |
m |
int类型 |
输入数据的高度 |
输入 |
依赖
#include "conv.h"
示例
C interface:
int n = 12;
int m = 12;
float in[144] = {1.0, 8.0, 2.0, 14.0, 3.0, 20.0, 4.0, 26.0, 5.0, 32.0, 6.0, 17.0,
23.0, 130.0, 28.0, 178.0, 33.0, 208.0, 38.0, 238.0, 43.0, 268.0, 48.0, 139.0,
7.0, 38.0, 8.0, 50.0, 9.0, 56.0, 10.0, 62.0, 11.0, 68.0, 12.0, 35.0,
54.0, 288.0, 60.0, 372.0, 66.0, 408.0, 72.0, 444.0, 78.0, 480.0, 84.0, 246.0,
13.0, 68.0, 14.0, 86.0, 15.0, 92.0, 16.0, 98.0, 17.0, 104.0, 18.0, 53.0,
90.0, 468.0, 96.0, 588.0, 102.0, 624.0, 108.0, 660.0, 114.0, 696.0, 120.0, 354.0,
19.0, 98.0, 20.0, 122.0, 21.0, 128.0, 22.0, 134.0, 23.0, 140.0, 24.0, 71.0,
126.0, 648.0, 132.0, 804.0, 138.0, 840.0, 144.0, 876.0, 150.0, 912.0, 156.0, 462.0,
25.0, 128.0, 26.0, 158.0, 27.0, 164.0, 28.0, 170.0, 29.0, 176.0, 30.0, 89.0,
162.0, 828.0, 168.0, 1020.0, 174.0, 1056.0, 180.0, 1092.0, 186.0, 1128.0, 192.0, 570.0,
31.0, 158.0, 32.0, 194.0, 33.0, 200.0, 34.0, 206.0, 35.0, 212.0, 36.0, 107.0,
87.0, 444.0, 90.0, 546.0, 93.0, 564.0, 96.0, 582.0, 99.0, 600.0, 102.0, 303.0, };
int filter_width = 3;
float filter[3] = {0.0, 1.0, 0.0};
float tmp[72] = {0.0};
/*
* tmp size is m x [n/2]
*/
float out[36] = {0.0};
/*
* output size is [m/2] x [n/2]
*/
dsImage_cpu(out, in, tmp, filter, filter_width, n, m);
/*
* tmp = [1.0 2.0 3.0 4.0 5.0 6.0
* 23.0 28.0 33.0 38.0 43.0 48.0
* 7.0 8.0 9.0 10.0 11.0 12.0
* 54.0 60.0 66.0 72.0 78.0 84.0
* 13.0 14.0 15.0 16.0 17.0 18.0
* 90.0 96.0 102.0 108.0 114.0 120.0
* 19.0 20.0 21.0 22.0 23.0 24.0
* 126.0 132.0 138.0 144.0 150.0 156.0
* 25.0 26.0 27.0 28.0 29.0 30.0
* 162.0 168.0 174.0 180.0 186.0 192.0]
*
* out = [1.0 2.0 3.0 4.0 5.0 6.0
* 7.0 8.0 9.0 10.0 11.0 12.0
* 13.0 14.0 15.0 16.0 17.0 18.0
* 19.0 20.0 21.0 22.0 23.0 24.0
* 25.0 26.0 27.0 28.0 29.0 30.0]
*/
父主题: 上下采样接口