From 98395e1909de4b077d4ed0d7b87e057e7ee135d5 Mon Sep 17 00:00:00 2001 From: Comma Device Date: Thu, 25 Feb 2021 16:37:28 -0800 Subject: [PATCH] gamma last and only one ccm old-commit-hash: e3afd72265c825c862d719b7ab91661a8a305982 --- selfdrive/camerad/cameras/real_debayer.cl | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/selfdrive/camerad/cameras/real_debayer.cl b/selfdrive/camerad/cameras/real_debayer.cl index 4fc787adc1..982d3d06a2 100644 --- a/selfdrive/camerad/cameras/real_debayer.cl +++ b/selfdrive/camerad/cameras/real_debayer.cl @@ -9,13 +9,6 @@ const __constant half3 color_correction[3] = { (half3)(-0.21523926, -0.13449348, 1.47665819), }; -const __constant half3 alt_ccm[3] = { - (half3)(0.84166382, -0.25025687, 0.1593848), - (half3)(0.25124881, 1.13196952, 0.16597516), - (half3)(-0.09291263, 0.11828735, 0.67464003), -}; - - // tone mapping params const half cpk = 0.75; const half cpb = 0.125; @@ -36,13 +29,12 @@ half mf(half x, half cp) { half3 color_correct(half3 rgb, int ggain) { half3 ret = (0,0,0); half cpx = clamp(0.03h, 0.1h, cpxb + cpxk * min(10, ggain)); - rgb.x = mf(rgb.x, cpx); - rgb.y = mf(rgb.y, cpx); - rgb.z = mf(rgb.z, cpx); - half alp = 1.0 - 0.07*ggain; - ret += (half)rgb.x * (alp*color_correction[0]+(1-alp)*alt_ccm[0]); - ret += (half)rgb.y * (alp*color_correction[1]+(1-alp)*alt_ccm[1]); - ret += (half)rgb.z * (alp*color_correction[2]+(1-alp)*alt_ccm[2]); + ret += (half)rgb.x * color_correction[0]; + ret += (half)rgb.y * color_correction[1]; + ret += (half)rgb.z * color_correction[2]; + ret.x = mf(ret.x, cpx); + ret.y = mf(ret.y, cpx); + ret.z = mf(ret.z, cpx); ret = clamp(0.0h, 255.0h, ret*255.0h); return ret; }