39 inline uchar8
median_disk5x5(uchar16 top2, uchar16 top, uchar16 middle, uchar16 bottom, uchar16 bottom2)
41 uchar8 p0 = top2.s01234567;
42 uchar8 p1 = top2.s12345678;
43 uchar8 p2 = top2.s23456789;
44 uchar8 p3 = top.s01234567;
45 uchar8 p4 = top.s12345678;
46 uchar8 p5 = top.s23456789;
47 uchar8 p6 = top.s3456789A;
48 uchar8 p7 = top.s456789AB;
49 uchar8 p8 = middle.s01234567;
50 uchar8 p9 = middle.s12345678;
51 uchar8 p10 = middle.s23456789;
52 uchar8 p11 = middle.s3456789A;
53 uchar8 p12 = middle.s456789AB;
54 uchar8 p13 = bottom.s01234567;
55 uchar8 p14 = bottom.s12345678;
56 uchar8 p15 = bottom.s23456789;
57 uchar8 p16 = bottom.s3456789A;
58 uchar8 p17 = bottom.s456789AB;
59 uchar8 p18 = bottom2.s01234567;
60 uchar8 p19 = bottom2.s12345678;
61 uchar8 p20 = bottom2.s23456789;
178 inline uchar8
median_box5x5(uchar16 top2, uchar16 top, uchar16 middle, uchar16 bottom, uchar16 bottom2)
180 uchar8 p0 = top2.s01234567;
181 uchar8 p1 = top2.s12345678;
182 uchar8 p2 = top2.s23456789;
183 uchar8 p3 = top2.s3456789A;
184 uchar8 p4 = top2.s456789AB;
185 uchar8 p5 = top.s01234567;
186 uchar8 p6 = top.s12345678;
187 uchar8 p7 = top.s23456789;
188 uchar8 p8 = top.s3456789A;
189 uchar8 p9 = top.s456789AB;
190 uchar8 p10 = middle.s01234567;
191 uchar8 p11 = middle.s12345678;
192 uchar8 p12 = middle.s23456789;
193 uchar8 p13 = middle.s3456789A;
194 uchar8 p14 = middle.s456789AB;
195 uchar8 p15 = bottom.s01234567;
196 uchar8 p16 = bottom.s12345678;
197 uchar8 p17 = bottom.s23456789;
198 uchar8 p18 = bottom.s3456789A;
199 uchar8 p19 = bottom.s456789AB;
200 uchar8 p20 = bottom2.s01234567;
201 uchar8 p21 = bottom2.s12345678;
202 uchar8 p22 = bottom2.s23456789;
203 uchar8 p23 = bottom2.s3456789A;
204 uchar8 p24 = bottom2.s456789AB;
347 uchar16 top2 = vload16(0,
offset(&src, -2, -2));
348 uchar16 top = vload16(0,
offset(&src, -2, -1));
349 uchar16 middle = vload16(0,
offset(&src, -2, 0));
350 uchar16 bottom = vload16(0,
offset(&src, -2, 1));
351 uchar16 bottom2 = vload16(0,
offset(&src, -2, 2));
355 uchar16 tmp =
min(middle,
min(
min(top2, top),
min(bottom, bottom2)));
358 uchar16 tmp =
max(middle,
max(
max(top2, top),
max(bottom, bottom2)));
360 #elif defined(MEDIAN) 361 uchar8 out =
median_box5x5(top2, top, middle, bottom, bottom2);
363 #error "Unsupported filter function" 367 vstore8(out, 0, dst.
ptr);
395 uchar8 top2 = vload8(0,
offset(&src, 0, -2));
396 uchar8 top = vload8(0,
offset(&src, 0, -1));
397 uchar16 middle = vload16(0,
offset(&src, -2, 0));
398 uchar8 bottom = vload8(0,
offset(&src, 0, 1));
399 uchar8 bottom2 = vload8(0,
offset(&src, 0, 2));
404 uchar8 out =
min(tmp_middle,
min(
min(top2, top),
min(bottom, bottom2)));
407 uchar8 out =
max(tmp_middle,
max(
max(top2, top.s01234567),
max(bottom, bottom2)));
408 #elif defined(MEDIAN) 411 uchar8 p2 = middle.s01234567;
412 uchar8 p3 = middle.s12345678;
413 uchar8 p4 = middle.s23456789;
414 uchar8 p5 = middle.s3456789A;
415 uchar8 p6 = middle.s456789AB;
418 uchar8 out =
sort9(p0, p1, p2, p3, p4, p5, p6, p7, p8);
420 #error "Unsupported filter function" 424 vstore8(out, 0, dst.
ptr);
452 uchar16 top2 = vload16(0,
offset(&src, -2, -2));
453 uchar16 top = vload16(0,
offset(&src, -2, -1));
454 uchar16 middle = vload16(0,
offset(&src, -2, 0));
455 uchar16 bottom = vload16(0,
offset(&src, -2, 1));
456 uchar16 bottom2 = vload16(0,
offset(&src, -2, 2));
459 top2 = top2.s123456789ABCDEFF;
460 bottom2 = bottom2.s123456789ABCDEFF;
464 uchar16 tmp_3 =
min(top2, bottom2);
465 uchar16 tmp_5 =
min(middle,
min(top, bottom));
468 uchar8 out =
min(tmp_3_red, tmp_5_red);
470 uchar16 tmp_3 =
max(top2, bottom2);
471 uchar16 tmp_5 =
max(middle,
max(top, bottom));
474 uchar8 out =
max(tmp_3_red, tmp_5_red);
475 #elif defined(MEDIAN) 478 #error "Unsupported filter function" 482 vstore8(out, 0, dst.
ptr);
uchar8 row_reduce_min_5(uchar16 val)
Calculate the minimum of a sliding window of size 5.
fixed_point< T > min(fixed_point< T > x, fixed_point< T > y)
#define SORT(a, b)
Sorts element-wise two vectors.
#define IMAGE_DECLARATION(name)
__kernel void non_linear_filter_cross5x5(__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 5x5 cross basis on an input image. ...
uchar8 row_reduce_max_5(uchar16 val)
Calculate the maximum of a sliding window of size 5.
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
#define CONVERT_TO_IMAGE_STRUCT(name)
uchar8 median_box5x5(uchar16 top2, uchar16 top, uchar16 middle, uchar16 bottom, uchar16 bottom2)
Sorting network to sort 8 boxes of size 5 and return their median.
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_disk5x5(__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 5x5 disk 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.
fixed_point< T > max(fixed_point< T > x, fixed_point< T > y)
__kernel void non_linear_filter_box5x5(__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 5x5 box basis on an input image.
convolution configure & src
uchar8 row_reduce_min_3(uchar16 val)
Calculate the minimum of a sliding window of size 3.
uchar8 median_disk5x5(uchar16 top2, uchar16 top, uchar16 middle, uchar16 bottom, uchar16 bottom2)
Sorting network to sort 8 disks of diameter 5 and return their median.