Skip to content

Commit ba8a6e3

Browse files
committed
ocl: don't use vload4 for 3 channel images
1 parent 6f39f9a commit ba8a6e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/imgproc/src/opencl/cvtcolor.cl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ enum
160160
#define CAT(x, y) __CAT(x, y)
161161

162162
#define DATA_TYPE_4 CAT(DATA_TYPE, 4)
163+
#define DATA_TYPE_3 CAT(DATA_TYPE, 3)
163164

164165
///////////////////////////////////// RGB <-> GRAY //////////////////////////////////////
165166

@@ -182,7 +183,7 @@ __kernel void RGB2Gray(__global const uchar * srcptr, int src_step, int src_offs
182183
{
183184
__global const DATA_TYPE* src = (__global const DATA_TYPE*)(srcptr + src_index);
184185
__global DATA_TYPE* dst = (__global DATA_TYPE*)(dstptr + dst_index);
185-
DATA_TYPE_4 src_pix = vload4(0, src);
186+
DATA_TYPE_3 src_pix = vload3(0, src);
186187
#ifdef DEPTH_5
187188
dst[0] = fma(src_pix.B_COMP, B2YF, fma(src_pix.G_COMP, G2YF, src_pix.R_COMP * R2YF));
188189
#else
@@ -256,7 +257,7 @@ __kernel void RGB2YUV(__global const uchar* srcptr, int src_step, int src_offset
256257
{
257258
__global const DATA_TYPE* src = (__global const DATA_TYPE*)(srcptr + src_index);
258259
__global DATA_TYPE* dst = (__global DATA_TYPE*)(dstptr + dst_index);
259-
DATA_TYPE_4 src_pix = vload4(0, src);
260+
DATA_TYPE_3 src_pix = vload3(0, src);
260261
DATA_TYPE b = src_pix.B_COMP, g = src_pix.G_COMP, r = src_pix.R_COMP;
261262

262263
#ifdef DEPTH_5

0 commit comments

Comments
 (0)