gamma last and only one ccm

old-commit-hash: e3afd72265
commatwo_master
Comma Device 4 years ago
parent 7a639b692d
commit 98395e1909
  1. 20
      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;
}

Loading…
Cancel
Save