|
|
|
@ -283,21 +283,14 @@ void create_thumbnail(MultiCameraState *s, CameraState *c, uint8_t *bgr_ptr) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void set_exposure_target(CameraState *c, const uint8_t *pix_ptr, bool front, int x_start, int x_end, int x_skip, int y_start, int y_end, int y_skip) { |
|
|
|
|
void set_exposure_target(CameraState *c, const uint8_t *pix_ptr, int x_start, int x_end, int x_skip, int y_start, int y_end, int y_skip) { |
|
|
|
|
const CameraBuf *b = &c->buf; |
|
|
|
|
|
|
|
|
|
uint32_t lum_binning[256] = {0}; |
|
|
|
|
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 * b->yuv_width) + x]; |
|
|
|
|
lum_binning[lum]++; |
|
|
|
|
} else { |
|
|
|
|
// TODO: should get rid of RGB here
|
|
|
|
|
const uint8_t *pix = &pix_ptr[y * b->rgb_stride + x * 3]; |
|
|
|
|
unsigned int lum = (unsigned int)(pix[0] + pix[1] + pix[2]); |
|
|
|
|
lum_binning[std::min(lum / 3, 255u)]++; |
|
|
|
|
} |
|
|
|
|
uint8_t lum = pix_ptr[(y * b->yuv_width) + x]; |
|
|
|
|
lum_binning[lum]++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -403,7 +396,7 @@ void common_camera_process_front(SubMaster *sm, PubMaster *pm, CameraState *c, i |
|
|
|
|
y_end = 1148; |
|
|
|
|
skip = 4; |
|
|
|
|
#endif |
|
|
|
|
set_exposure_target(c, (const uint8_t *)b->cur_rgb_buf->addr, 1, x_start, x_end, 2, y_start, y_end, skip); |
|
|
|
|
set_exposure_target(c, (const uint8_t *)b->yuv_bufs[b->cur_yuv_idx].y, x_start, x_end, 2, y_start, y_end, skip); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MessageBuilder msg; |
|
|
|
|