From efa9180258c18efbd2b009de931a518502cf0259 Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Tue, 20 Oct 2020 17:26:05 -0700 Subject: [PATCH] camerad AE hotfix (#2371) * duplicate offset * use widthx3 instead of stride --- selfdrive/camerad/cameras/camera_common.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/camerad/cameras/camera_common.cc b/selfdrive/camerad/cameras/camera_common.cc index 121be22f15..ac44903f51 100644 --- a/selfdrive/camerad/cameras/camera_common.cc +++ b/selfdrive/camerad/cameras/camera_common.cc @@ -290,10 +290,10 @@ void set_exposure_target(CameraState *c, const uint8_t *pix_ptr, bool front, int for (int y = y_start; y < y_end; y += y_skip) { for (int x = x_start; x < x_end; x += x_skip) { if (!front) { - uint8_t lum = pix_ptr[((y_start + y) * b->yuv_width) + x_start + x]; + uint8_t lum = pix_ptr[(y * b->yuv_width) + x]; lum_binning[lum]++; } else { - const uint8_t *pix = &pix_ptr[y * b->rgb_stride + x * 3]; + const uint8_t *pix = &pix_ptr[y * b->rgb_width * 3 + x * 3]; unsigned int lum = (unsigned int)(pix[0] + pix[1] + pix[2]); lum_binning[std::min(lum / 3, 255u)]++; }