* adjust gamma

* trust that light

* trust that chart

* unsrgb

Co-authored-by: Comma Device <device@comma.ai>
albatross
ZwX1616 2021-03-01 16:35:43 -08:00 committed by GitHub
parent 78808961c5
commit dd2bba0b42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -1054,8 +1054,8 @@ static void set_camera_exposure(CameraState *s, float grey_frac) {
struct i2c_random_wr_payload exp_reg_array[] = {
{0x3366, AG}, // analog gain
{0x3362, (uint16_t)(s->dc_gain_enabled?0x1:0x0)}, // DC_GAIN
{0x305A, 0x0108}, // red gain
{0x3058, 0x00FB}, // blue gain
{0x305A, 0x00F8}, // red gain
{0x3058, 0x0122}, // blue gain
{0x3056, 0x009A}, // g1 gain
{0x305C, 0x009A}, // g2 gain
{0x3012, (uint16_t)s->exposure_time}, // integ time

View File

@ -4,19 +4,19 @@ const half black_level = 42.0;
const __constant half3 color_correction[3] = {
// post wb CCM
(half3)(1.25985206, -0.378923, -0.21356857),
(half3)(-0.11117607, 1.3962182, -0.46342976),
(half3)(-0.21523926, -0.13449348, 1.47665819),
(half3)(1.82717181, -0.31231438, 0.07307673),
(half3)(-0.5743977, 1.36858544, -0.53183455),
(half3)(-0.25277411, -0.05627105, 1.45875782),
};
// tone mapping params
const half cpk = 0.75;
const half cpb = 0.125;
const half cpxk = 0.01;
const half cpxk = 0.0025;
const half cpxb = 0.01;
half mf(half x, half cp) {
half rk = 8.6 - 66*cp;
half rk = 9 - 100*cp;
if (x > cp) {
return (rk * (x-cp) * (1-(cpk*cp+cpb)) * (1+1/(rk*(1-cp))) / (1+rk*(x-cp))) + cpk*cp + cpb;
} else if (x < cp) {
@ -28,7 +28,7 @@ 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));
half cpx = clamp(0.01h, 0.05h, cpxb + cpxk * min(10, ggain));
ret += (half)rgb.x * color_correction[0];
ret += (half)rgb.y * color_correction[1];
ret += (half)rgb.z * color_correction[2];