usImage2X_cpu

上采样upsampling接口。

接口定义

C interface:

void usImage2X_cpu(float* outbuf, const float* inimg, const float* filter, int filter_width, int n, int m);

参数

参数名

类型

描述

输入/输出

outbuf

float类型

上采样最终结果输出

输出

inimg

float类型

输入数据

输入

filter

float类型

滤波器

输入

filter_width

int类型

滤波器的长度

输入

n

int类型

输入数据的宽度

输入

m

int类型

输入数据的高度

输入

依赖

#include "conv.h"

示例

C interface:
    int n = 6;
    int m = 6;
    float inimg[36] = {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,
                       31.0, 32.0, 33.0, 34.0, 35.0, 36.0};
    int filter_width = 3;
    float filter[3] = {1.0, 2.0, 3.0};
    float outbuf[144] = {0.0};
    /*
     * output size is 2m x 2n
     */

    usImage2X_cpu(outbuf, inimg, filter, filter_width, n, m);
    /*
     *  outbuf = [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]
     */