From 0d036de20558d2a33611fe1f61fc6c0a34ea2d95 Mon Sep 17 00:00:00 2001 From: Comma Device Date: Thu, 4 Mar 2021 11:08:52 -0800 Subject: [PATCH] better transition --- selfdrive/camerad/cameras/camera_common.cc | 6 +++--- selfdrive/camerad/cameras/camera_qcom2.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/selfdrive/camerad/cameras/camera_common.cc b/selfdrive/camerad/cameras/camera_common.cc index 0948e83c0b..2aab416aad 100644 --- a/selfdrive/camerad/cameras/camera_common.cc +++ b/selfdrive/camerad/cameras/camera_common.cc @@ -315,9 +315,9 @@ void set_exposure_target(CameraState *c, int x_start, int x_end, int x_skip, int lum_cur += lum_binning[lum_med]; #ifdef QCOM2 int lum_med_tmp = 0; - int hb = HLC_THRESH; + int hb = HLC_THRESH + (10 - c->analog_gain); if (lum_cur > 0 && lum_med > hb) { - lum_med_tmp = 4 * (lum_med - hb) + 100; + lum_med_tmp = (lum_med - hb) + 100; } lum_med_alt = lum_med_alt>lum_med_tmp?lum_med_alt:lum_med_tmp; #endif @@ -325,7 +325,7 @@ void set_exposure_target(CameraState *c, int x_start, int x_end, int x_skip, int break; } } - lum_med = lum_med_alt>0 ? lum_med + lum_med/32*lum_cur*(lum_med_alt - lum_med)/lum_total/2:lum_med; + lum_med = lum_med_alt>0 ? lum_med + lum_med*lum_cur*(lum_med_alt - lum_med)/lum_total/32:lum_med; camera_autoexposure(c, lum_med / 256.0); } diff --git a/selfdrive/camerad/cameras/camera_qcom2.cc b/selfdrive/camerad/cameras/camera_qcom2.cc index 703cecf293..136646456a 100644 --- a/selfdrive/camerad/cameras/camera_qcom2.cc +++ b/selfdrive/camerad/cameras/camera_qcom2.cc @@ -1003,7 +1003,7 @@ static void set_camera_exposure(CameraState *s, float grey_frac) { // TODO: get stats from sensor? float target_grey = 0.4 - ((float)(s->analog_gain + 4*s->dc_gain_enabled) / 48.0f); float exposure_factor = 1 + 30 * pow((target_grey - grey_frac), 3); - exposure_factor = std::max(exposure_factor, 0.4f); + exposure_factor = std::max(exposure_factor, 0.56f); if (s->camera_num != 1) { s->ef_filtered = (1 - EF_LOWPASS_K) * s->ef_filtered + EF_LOWPASS_K * exposure_factor;