From 7c29a5541fd4b6777c682d450768cecf443e4f47 Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Tue, 23 Feb 2021 14:05:09 -0800 Subject: [PATCH] tici camerart 3.1 (#20143) Co-authored-by: Comma Device old-commit-hash: 28b80844c9c1f12f6f969019bd3d051793917bba --- selfdrive/camerad/cameras/real_debayer.cl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/selfdrive/camerad/cameras/real_debayer.cl b/selfdrive/camerad/cameras/real_debayer.cl index 7a3a94e468..4fc787adc1 100644 --- a/selfdrive/camerad/cameras/real_debayer.cl +++ b/selfdrive/camerad/cameras/real_debayer.cl @@ -9,10 +9,10 @@ const __constant half3 color_correction[3] = { (half3)(-0.21523926, -0.13449348, 1.47665819), }; -const __constant half3 base_ccm[3] = { - (half3)(1,0,0), - (half3)(0,1,0), - (half3)(0,0,1), +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), }; @@ -39,9 +39,10 @@ half3 color_correct(half3 rgb, int ggain) { rgb.x = mf(rgb.x, cpx); rgb.y = mf(rgb.y, cpx); rgb.z = mf(rgb.z, cpx); - ret += (half)rgb.x * (color_correction[0]); - ret += (half)rgb.y * (color_correction[1]); - ret += (half)rgb.z * (color_correction[2]); + 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 = clamp(0.0h, 255.0h, ret*255.0h); return ret; }