From 59ebf4ed9f8b529af09036ae05508d8503582430 Mon Sep 17 00:00:00 2001 From: yao Date: Mon, 25 Feb 2013 15:19:39 +0800 Subject: [PATCH] Fix the ocl::cvtColor mismatch on some devices --- modules/ocl/src/kernels/cvt_color.cl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ocl/src/kernels/cvt_color.cl b/modules/ocl/src/kernels/cvt_color.cl index 952193931..410f8fc8d 100644 --- a/modules/ocl/src/kernels/cvt_color.cl +++ b/modules/ocl/src/kernels/cvt_color.cl @@ -203,8 +203,8 @@ __kernel void YUV2RGB(int cols,int rows,int src_step,int dst_step,int channels, __constant int ITUR_BT_601_CY = 1220542; __constant int ITUR_BT_601_CUB = 2116026; -__constant int ITUR_BT_601_CUG = -409993; -__constant int ITUR_BT_601_CVG = -852492; +__constant int ITUR_BT_601_CUG = 409993; +__constant int ITUR_BT_601_CVG = 852492; __constant int ITUR_BT_601_CVR = 1673527; __constant int ITUR_BT_601_SHIFT = 20; @@ -229,7 +229,7 @@ __kernel void YUV2RGBA_NV12(int cols,int rows,int src_step,int dst_step, int V = usrc[1] - 128; int ruv = (1 << (ITUR_BT_601_SHIFT - 1)) + ITUR_BT_601_CVR * V; - int guv = (1 << (ITUR_BT_601_SHIFT - 1)) + ITUR_BT_601_CVG * V + ITUR_BT_601_CUG * U; + int guv = (1 << (ITUR_BT_601_SHIFT - 1)) - ITUR_BT_601_CVG * V - ITUR_BT_601_CUG * U; int buv = (1 << (ITUR_BT_601_SHIFT - 1)) + ITUR_BT_601_CUB * U; Y1 = max(0, Y1 - 16) * ITUR_BT_601_CY;