52 uchar16 top = vload16(0,
offset(&src, -1, -1));
53 uchar16 middle = vload16(0,
offset(&src, -1, 0));
54 uchar16 bottom = vload16(0,
offset(&src, -1, 1));
58 uchar16 tmp = min(top, min(middle, bottom));
61 uchar16 tmp = max(top, max(middle, bottom));
64 uchar8 p0 = top.s01234567;
65 uchar8 p1 = top.s12345678;
66 uchar8 p2 = top.s23456789;
67 uchar8 p3 = middle.s01234567;
68 uchar8 p4 = middle.s12345678;
69 uchar8 p5 = middle.s23456789;
70 uchar8 p6 = bottom.s01234567;
71 uchar8 p7 = bottom.s12345678;
72 uchar8 p8 = bottom.s23456789;
73 uchar8 out =
sort9(p0, p1, p2, p3, p4, p5, p6, p7, p8);
75 #error "Unsupported filter function" 79 vstore8(out, 0, dst.
ptr);
107 uchar8 top = vload8(0,
offset(&src, 0, -1));
108 uchar16 middle = vload16(0,
offset(&src, -1, 0));
109 uchar8 bottom = vload8(0,
offset(&src, 0, 1));
114 uchar8 out = min(tmp_middle, min(top, bottom));
117 uchar8 out = max(tmp_middle, max(top, bottom));
118 #elif defined(MEDIAN) 119 uchar8 p0 = top.s01234567;
120 uchar8 p1 = middle.s01234567;
121 uchar8 p2 = middle.s12345678;
122 uchar8 p3 = middle.s23456789;
123 uchar8 p4 = bottom.s01234567;
124 uchar8 out =
sort5(p0, p1, p2, p3, p4);
126 #error "Unsupported filter function" 130 vstore8(out, 0, dst.
ptr);
158 uchar16 top = vload16(0,
offset(&src, -1, -1));
159 uchar16 middle = vload16(0,
offset(&src, -1, 0));
160 uchar16 bottom = vload16(0,
offset(&src, -1, 1));
164 uchar16 tmp = min(top, min(middle, bottom));
167 uchar16 tmp = max(top, max(middle, bottom));
169 #elif defined(MEDIAN) 170 uchar8 p0 = top.s01234567;
171 uchar8 p1 = top.s12345678;
172 uchar8 p2 = top.s23456789;
173 uchar8 p3 = middle.s01234567;
174 uchar8 p4 = middle.s12345678;
175 uchar8 p5 = middle.s23456789;
176 uchar8 p6 = bottom.s01234567;
177 uchar8 p7 = bottom.s12345678;
178 uchar8 p8 = bottom.s23456789;
179 uchar8 out =
sort9(p0, p1, p2, p3, p4, p5, p6, p7, p8);
181 #error "Unsupported filter function" 185 vstore8(out, 0, dst.
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)
uchar8 sort5(uchar8 p0, uchar8 p1, uchar8 p2, uchar8 p3, uchar8 p4)
Sorting network to sort 5 vectors of 8 elements and return their median.
SimpleTensor< float > src
__kernel void non_linear_filter_disk3x3(__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_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes)
This function applies a non linear filter on a 3x3 disk basis on an input image.
uchar8 row_reduce_max_3(uchar16 val)
Calculate the maximum of a sliding window of size 3.
Structure to hold Image information.
__global uchar * ptr
Pointer to the starting postion of the buffer.
__kernel void non_linear_filter_box3x3(__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_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes)
This function applies a non linear filter on a 3x3 box basis on an input image.
uchar8 sort9(uchar8 p0, uchar8 p1, uchar8 p2, uchar8 p3, uchar8 p4, uchar8 p5, uchar8 p6, uchar8 p7, uchar8 p8)
Sorting network to sort 9 vectors of 8 elements and return their median.
__kernel void non_linear_filter_cross3x3(__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_ptr, uint dst_stride_x, uint dst_step_x, uint dst_stride_y, uint dst_step_y, uint dst_offset_first_element_in_bytes)
This function applies a non linear filter on a 3x3 cross basis on an input image. ...
uchar8 row_reduce_min_3(uchar16 val)
Calculate the minimum of a sliding window of size 3.