30 #define MAT_INDEX(i) MAT##i 33 #define DATA_TYPE short 37 #define COMPUTE_TYPE int 41 #define DATA_TYPE_OUT uchar 44 #ifndef DYNAMIC_MATRIX_CONVOLUTION 71 short matrix_coeff[81] =
73 MAT0, MAT1, MAT2, MAT3, MAT4, MAT5, MAT6, MAT7, MAT8,
74 MAT9, MAT10, MAT11, MAT12, MAT13, MAT14, MAT15, MAT16, MAT17,
75 MAT18, MAT19, MAT20, MAT21, MAT22, MAT23, MAT24, MAT25, MAT26,
76 MAT27, MAT28, MAT29, MAT30, MAT31, MAT32, MAT33, MAT34, MAT35,
77 MAT36, MAT37, MAT38, MAT39, MAT40, MAT41, MAT42, MAT43, MAT44,
78 MAT45, MAT46, MAT47, MAT48, MAT49, MAT50, MAT51, MAT52, MAT53,
79 MAT54, MAT55, MAT56, MAT57, MAT58, MAT59, MAT60, MAT61, MAT62,
80 MAT63, MAT64, MAT65, MAT66, MAT67, MAT68, MAT69, MAT70, MAT71,
81 MAT72, MAT73, MAT74, MAT75, MAT76, MAT77, MAT78, MAT79, MAT80
87 for(
int i = 0; i < MATRIX_HEIGHT; i++)
90 pixels +=
convolution1x3(
offset(&src, -1, -(MATRIX_HEIGHT / 2) + i), matrix_coeff[0 + i * 3], matrix_coeff[1 + i * 3],
91 matrix_coeff[2 + i * 3]);
95 pixels +=
convolution1x5(
offset(&src, -2, -(MATRIX_HEIGHT / 2) + i), matrix_coeff[0 + i * 5], matrix_coeff[1 + i * 5],
96 matrix_coeff[2 + i * 5], matrix_coeff[3 + i * 5], matrix_coeff[4 + i * 5]);
100 pixels +=
convolution1x7(
offset(&src, -3, -(MATRIX_HEIGHT / 2) + i), matrix_coeff[0 + i * 7], matrix_coeff[1 + i * 7],
101 matrix_coeff[2 + i * 7], matrix_coeff[3 + i * 7], matrix_coeff[4 + i * 7],
102 matrix_coeff[5 + i * 7], matrix_coeff[6 + i * 7]);
105 #if MATRIX_WIDTH == 9 106 pixels +=
convolution1x9(
offset(&src, -4, -(MATRIX_HEIGHT / 2) + i), matrix_coeff[0 + i * 9], matrix_coeff[1 + i * 9],
107 matrix_coeff[2 + i * 9], matrix_coeff[3 + i * 9], matrix_coeff[4 + i * 9],
108 matrix_coeff[5 + i * 9], matrix_coeff[6 + i * 9], matrix_coeff[7 + i * 9], matrix_coeff[8 + i * 9]);
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
#define CONVERT_TO_IMAGE_STRUCT(name)
__kernel void convolution_rectangle(__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)
Apply a rectangle matrix to a single channel U8 input image and output a single channel image includi...
#define IMAGE_DECLARATION(name)
short8 convolution1x9(__global const uchar *left_pixel, const short left1_coeff, const short left2_coeff, const short left3_coeff, const short left4_coeff, const short middle_coeff, const short right1_coeff, const short right2_coeff, const short right3_coeff, const short right4_coeff)
Compute a 1D horizontal convolution of size 9 for 8 bytes assuming the input is made of 1 channel of ...
#define CONVERT_SAT(a, b)
SimpleTensor< float > src
short8 convolution1x5(__global const uchar *left_pixel, const short left1_coeff, const short left2_coeff, const short middle_coeff, const short right1_coeff, const short right2_coeff)
Compute a 1D horizontal convolution of size 5 for 8 bytes assuming the input is made of 1 channel of ...
Structure to hold Image information.
__global uchar * ptr
Pointer to the starting postion of the buffer.
short8 convolution1x7(__global const uchar *left_pixel, const short left1_coeff, const short left2_coeff, const short left3_coeff, const short middle_coeff, const short right1_coeff, const short right2_coeff, const short right3_coeff)
Compute a 1D horizontal convolution of size 7 for 8 bytes assuming the input is made of 1 channel of ...
short8 convolution1x3(__global const uchar *left_pixel, const short left_coeff, const short middle_coeff, const short right_coeff)
Compute a 1D horizontal convolution of size 3 for 8 bytes assuming the input is made of 1 channel of ...
#define VEC_DATA_TYPE(type, size)