just set staruc

pull/32112/head
ZwX1616 1 year ago
parent b28f09eadc
commit d8e89c8ce3
  1. 6
      system/camerad/cameras/camera_common.cc
  2. 2
      system/camerad/cameras/camera_common.h
  3. 6
      system/camerad/cameras/camera_qcom2.cc
  4. 2
      system/camerad/cameras/camera_qcom2.h

@ -262,14 +262,14 @@ static void publish_thumbnail(PubMaster *pm, const CameraBuf *b) {
pm->send("thumbnail", msg);
}
float set_exposure_target(const CameraBuf *b, int x_start, int x_len, int x_skip, int y_start, int y_len, int y_skip) {
float set_exposure_target(const CameraBuf *b, AutoExposureRect ae_xywh, int x_skip, int y_skip) {
int lum_med;
uint32_t lum_binning[256] = {0};
const uint8_t *pix_ptr = b->cur_yuv_buf->y;
unsigned int lum_total = 0;
for (int y = y_start; y < y_start + y_len; y += y_skip) {
for (int x = x_start; x < x_start + x_len; x += x_skip) {
for (int y = ae_xywh.y; y < ae_xywh.y + ae_xywh.h; y += y_skip) {
for (int x = ae_xywh.x; x < ae_xywh.x + ae_xywh.w; x += x_skip) {
uint8_t lum = pix_ptr[(y * b->rgb_width) + x];
lum_binning[lum]++;
lum_total += 1;

@ -82,7 +82,7 @@ typedef void (*process_thread_cb)(MultiCameraState *s, CameraState *c, int cnt);
void fill_frame_data(cereal::FrameData::Builder &framed, const FrameMetadata &frame_data, CameraState *c);
kj::Array<uint8_t> get_raw_frame_image(const CameraBuf *b);
float set_exposure_target(const CameraBuf *b, int x_start, int x_len, int x_skip, int y_start, int y_len, int y_skip);
float set_exposure_target(const CameraBuf *b, AutoExposureRect ae_xywh, int x_skip, int y_skip);
std::thread start_process_thread(MultiCameraState *cameras, CameraState *cs, process_thread_cb callback);
void cameras_init(VisionIpcServer *v, MultiCameraState *s, cl_device_id device_id, cl_context ctx);

@ -398,7 +398,7 @@ void CameraState::enqueue_req_multi(int start, int n, bool dp) {
void CameraState::sensor_set_parameters() {
target_grey_fraction = 0.3;
for (int i = 0; i < 4; i++) {ae_xywh[i] = ci->ae_areas[camera_num][i];}
ae_xywh = ci->ae_areas[camera_num];
dc_gain_enabled = false;
dc_gain_weight = ci->dc_gain_min_weight;
@ -903,7 +903,7 @@ void CameraState::set_camera_exposure(float grey_frac) {
}
static void process_driver_camera(MultiCameraState *s, CameraState *c, int cnt) {
c->set_camera_exposure(set_exposure_target(&c->buf, c->ae_xywh[0], c->ae_xywh[2], 2, c->ae_xywh[1], c->ae_xywh[3], 4));
c->set_camera_exposure(set_exposure_target(&c->buf, c->ae_xywh, 2, 4));
MessageBuilder msg;
auto framed = msg.initEvent().initDriverCameraState();
@ -929,7 +929,7 @@ void process_road_camera(MultiCameraState *s, CameraState *c, int cnt) {
s->pm->send(c == &s->road_cam ? "roadCameraState" : "wideRoadCameraState", msg);
const int skip = 2;
c->set_camera_exposure(set_exposure_target(b, c->ae_xywh[0], c->ae_xywh[2], skip, c->ae_xywh[1], c->ae_xywh[3], skip));
c->set_camera_exposure(set_exposure_target(b, c->ae_xywh, skip, skip));
}
void cameras_run(MultiCameraState *s) {

@ -30,7 +30,7 @@ public:
int new_exp_g;
int new_exp_t;
int ae_xywh[4];
AutoExposureRect ae_xywh;
float measured_grey_fraction;
float target_grey_fraction;

Loading…
Cancel
Save