From 0ca726ed29eb3e44f85c12035a7c899ec939cd1b Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Thu, 23 Jan 2025 14:13:35 -0800 Subject: [PATCH] camerad: increase dcam ae min (#34455) * never dip below 0.125 * clamp is double --- system/camerad/cameras/camera_qcom2.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/camerad/cameras/camera_qcom2.cc b/system/camerad/cameras/camera_qcom2.cc index b3aa373e9154f6..dc388f1e3633f7 100644 --- a/system/camerad/cameras/camera_qcom2.cc +++ b/system/camerad/cameras/camera_qcom2.cc @@ -127,6 +127,8 @@ void CameraState::update_exposure_score(float desired_ev, int exp_t, int exp_g_i void CameraState::set_camera_exposure(float grey_frac) { if (!camera.enabled) return; + std::vector target_grey_minimums = {0.1, 0.1, 0.125}; // wide, road, driver + const float dt = 0.05; const float ts_grey = 10.0; @@ -143,8 +145,8 @@ void CameraState::set_camera_exposure(float grey_frac) { const auto &sensor = camera.sensor; const float cur_ev_ = cur_ev[camera.buf.cur_frame_data.frame_id % 3] * sensor->ev_scale; - // Scale target grey between 0.1 and 0.4 depending on lighting conditions - float new_target_grey = std::clamp(0.4 - 0.3 * log2(1.0 + sensor->target_grey_factor*cur_ev_) / log2(6000.0), 0.1, 0.4); + // Scale target grey between min and 0.4 depending on lighting conditions + float new_target_grey = std::clamp(0.4 - 0.3 * log2(1.0 + sensor->target_grey_factor*cur_ev_) / log2(6000.0), target_grey_minimums[camera.cc.camera_num], 0.4); float target_grey = (1.0 - k_grey) * target_grey_fraction + k_grey * new_target_grey; float desired_ev = std::clamp(cur_ev_ / sensor->ev_scale * target_grey / grey_frac, sensor->min_ev, sensor->max_ev);