72 short8 gx = (short8)0;
75 short8 gy = (short8)0;
79 uchar16 temp = vload16(0,
offset(&src, -1, -1));
80 short8 left = convert_short8(temp.s01234567);
81 short8 middle = convert_short8(temp.s12345678);
82 short8 right = convert_short8(temp.s23456789);
84 gx += left * (short8)(-3);
85 gx += right * (short8)(+3);
88 gy += left * (short8)(-3);
89 gy += middle * (short8)(-10);
90 gy += right * (short8)(-3);
94 temp = vload16(0,
offset(&src, -1, 0));
95 left = convert_short8(temp.s01234567);
96 right = convert_short8(temp.s23456789);
98 gx += left * (short8)(-10);
99 gx += right * (short8)(+10);
103 temp = vload16(0,
offset(&src, -1, 1));
104 left = convert_short8(temp.s01234567);
105 middle = convert_short8(temp.s12345678);
106 right = convert_short8(temp.s23456789);
108 gx += left * (short8)(-3);
109 gx += right * (short8)(+3);
112 gy += left * (short8)(+3);
113 gy += middle * (short8)(+10);
114 gy += right * (short8)(+3);
119 vstore8(gx, 0, ((__global
short *)dst_gx.
ptr));
122 vstore8(gy, 0, ((__global
short *)dst_gy.
ptr));
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
#define CONVERT_TO_IMAGE_STRUCT(name)
#define IMAGE_DECLARATION(name)
SimpleTensor< float > src
Structure to hold Image information.
__global uchar * ptr
Pointer to the starting postion of the buffer.
__kernel void scharr3x3(__global uchar *src_ptr, uint src_stride_x, uint src_step_x, uint src_stride_y, uint src_step_y, uint src_offset_first_element_in_bytes, __global uchar *dst_gx_ptr, uint dst_gx_stride_x, uint dst_gx_step_x, uint dst_gx_stride_y, uint dst_gx_step_y, uint dst_gx_offset_first_element_in_bytes, __global uchar *dst_gy_ptr, uint dst_gy_stride_x, uint dst_gy_step_x, uint dst_gy_stride_y, uint dst_gy_step_y, uint dst_gy_offset_first_element_in_bytes)
This OpenCL kernel computes Scharr3x3.