feed_kernel.cl 532 字节
Newer Older
Y
yangfei 已提交
1 2
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
__kernel void feed(__global float *in, __write_only image2d_t outputImage,int h,int w)
Y
yangfei 已提交
3
 {
Y
yangfei 已提交
4 5 6 7 8 9 10 11 12 13
        int j = get_global_id(0);
        int i = get_global_id(1);
        half4 pixel;
        pixel.x = convert_half(in[(i * w + j)]);
        pixel.y = convert_half(in[h * w + (i * w + j)]);
        pixel.z = convert_half(in[2 * h * w + (i * w + j)]);
        pixel.w = 0.0;
        int2 coords;
        coords.x = j;
        coords.y = i;
Y
yangfei 已提交
14

Y
yangfei 已提交
15
        write_imageh(outputImage,coords,pixel);
Y
yangfei 已提交
16
 }