From c804059641d16dbb4d41b36afae1ba3ccc8a2dcc Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Fri, 15 Jan 2021 19:05:31 +0800 Subject: [PATCH] camera_qcom2: simplify camera_process_frame (#19763) * simplify camera_process_frame * Trigger Build * Update selfdrive/camerad/cameras/camera_qcom2.cc Co-authored-by: Willem Melching --- selfdrive/camerad/cameras/camera_qcom2.cc | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/selfdrive/camerad/cameras/camera_qcom2.cc b/selfdrive/camerad/cameras/camera_qcom2.cc index a1460b6c66..d5e633097d 100644 --- a/selfdrive/camerad/cameras/camera_qcom2.cc +++ b/selfdrive/camerad/cameras/camera_qcom2.cc @@ -1111,23 +1111,9 @@ void camera_process_frame(MultiCameraState *s, CameraState *c, int cnt) { s->pm->send(c == &s->rear ? "frame" : "wideFrame", msg); if (cnt % 3 == 0) { - int exposure_x; - int exposure_y; - int exposure_width; - int exposure_height; - if (c == &s->rear) { - exposure_x = 96; - exposure_y = 160; - exposure_width = 1734; - exposure_height = 986; - } else { // c == &s->wide - exposure_x = 96; - exposure_y = 250; - exposure_width = 1734; - exposure_height = 524; - } - int skip = 2; - set_exposure_target(c, (const uint8_t *)b->cur_yuv_buf->y, exposure_x, exposure_x + exposure_width, skip, exposure_y, exposure_y + exposure_height, skip); + const auto [x, y, w, h] = (c == &s->wide) ? std::tuple(96, 250, 1734, 524) : std::tuple(96, 160, 1734, 986); + const int skip = 2; + set_exposure_target(c, (const uint8_t *)b->cur_yuv_buf->y, x, x + w, skip, y, y + h, skip); } }