mirror of
https://github.com/opencv/opencv.git
synced 2025-08-04 21:36:35 +08:00
Merge pull request #8313 from alalek:ocl_fix_cvtcolor
This commit is contained in:
commit
6b1d9971f4
@ -160,6 +160,7 @@ enum
|
|||||||
#define CAT(x, y) __CAT(x, y)
|
#define CAT(x, y) __CAT(x, y)
|
||||||
|
|
||||||
#define DATA_TYPE_4 CAT(DATA_TYPE, 4)
|
#define DATA_TYPE_4 CAT(DATA_TYPE, 4)
|
||||||
|
#define DATA_TYPE_3 CAT(DATA_TYPE, 3)
|
||||||
|
|
||||||
///////////////////////////////////// RGB <-> GRAY //////////////////////////////////////
|
///////////////////////////////////// RGB <-> GRAY //////////////////////////////////////
|
||||||
|
|
||||||
@ -182,7 +183,7 @@ __kernel void RGB2Gray(__global const uchar * srcptr, int src_step, int src_offs
|
|||||||
{
|
{
|
||||||
__global const DATA_TYPE* src = (__global const DATA_TYPE*)(srcptr + src_index);
|
__global const DATA_TYPE* src = (__global const DATA_TYPE*)(srcptr + src_index);
|
||||||
__global DATA_TYPE* dst = (__global DATA_TYPE*)(dstptr + dst_index);
|
__global DATA_TYPE* dst = (__global DATA_TYPE*)(dstptr + dst_index);
|
||||||
DATA_TYPE_4 src_pix = vload4(0, src);
|
DATA_TYPE_3 src_pix = vload3(0, src);
|
||||||
#ifdef DEPTH_5
|
#ifdef DEPTH_5
|
||||||
dst[0] = fma(src_pix.B_COMP, B2YF, fma(src_pix.G_COMP, G2YF, src_pix.R_COMP * R2YF));
|
dst[0] = fma(src_pix.B_COMP, B2YF, fma(src_pix.G_COMP, G2YF, src_pix.R_COMP * R2YF));
|
||||||
#else
|
#else
|
||||||
@ -256,7 +257,7 @@ __kernel void RGB2YUV(__global const uchar* srcptr, int src_step, int src_offset
|
|||||||
{
|
{
|
||||||
__global const DATA_TYPE* src = (__global const DATA_TYPE*)(srcptr + src_index);
|
__global const DATA_TYPE* src = (__global const DATA_TYPE*)(srcptr + src_index);
|
||||||
__global DATA_TYPE* dst = (__global DATA_TYPE*)(dstptr + dst_index);
|
__global DATA_TYPE* dst = (__global DATA_TYPE*)(dstptr + dst_index);
|
||||||
DATA_TYPE_4 src_pix = vload4(0, src);
|
DATA_TYPE_3 src_pix = vload3(0, src);
|
||||||
DATA_TYPE b = src_pix.B_COMP, g = src_pix.G_COMP, r = src_pix.R_COMP;
|
DATA_TYPE b = src_pix.B_COMP, g = src_pix.G_COMP, r = src_pix.R_COMP;
|
||||||
|
|
||||||
#ifdef DEPTH_5
|
#ifdef DEPTH_5
|
||||||
|
Loading…
Reference in New Issue
Block a user