Skip to content

Commit

Permalink
use stride instead of image width
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed Feb 21, 2025
1 parent 9d9ea76 commit 7ff7c03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion system/camerad/cameras/camera_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ float calculate_exposure_value(const CameraBuf *b, Rect ae_xywh, int x_skip, int
int lum_med;
uint32_t lum_binning[256] = {0};
const uint8_t *pix_ptr = b->cur_yuv_buf->y;
const size_t stride = b->cur_yuv_buf->stride;
const int bottom = ae_xywh.y + ae_xywh.h;
const int right = ae_xywh.x + ae_xywh.w;
unsigned int lum_total = 0;

for (int y = ae_xywh.y; y < bottom; y += y_skip) {
const uint8_t *row_ptr = &pix_ptr[y * b->out_img_width];
const uint8_t *row_ptr = &pix_ptr[y * stride];
for (int x = ae_xywh.x; x < right; x += x_skip) {
uint8_t lum = row_ptr[x];
lum_binning[lum]++;
Expand Down

0 comments on commit 7ff7c03

Please sign in to comment.