diff --git a/common/util.h b/common/util.h index 3bf5a690a6..0e8bcd56bf 100644 --- a/common/util.h +++ b/common/util.h @@ -179,3 +179,10 @@ void update_max_atomic(std::atomic& max, T const& value) { T prev = max; while (prev < value && !max.compare_exchange_weak(prev, value)) {} } + +typedef struct Rect { + int x; + int y; + int w; + int h; +} Rect; diff --git a/system/camerad/cameras/camera_common.cc b/system/camerad/cameras/camera_common.cc index ab6aac01f5..6044e0dca3 100644 --- a/system/camerad/cameras/camera_common.cc +++ b/system/camerad/cameras/camera_common.cc @@ -8,7 +8,6 @@ #include "common/clutil.h" #include "common/swaglog.h" -#include "common/util.h" #include "third_party/linux/include/msm_media_info.h" #include "system/camerad/cameras/camera_qcom2.h" @@ -261,7 +260,7 @@ static void publish_thumbnail(PubMaster *pm, const CameraBuf *b) { pm->send("thumbnail", msg); } -float set_exposure_target(const CameraBuf *b, AutoExposureRect ae_xywh, int x_skip, int y_skip) { +float set_exposure_target(const CameraBuf *b, Rect 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; diff --git a/system/camerad/cameras/camera_common.h b/system/camerad/cameras/camera_common.h index 9aafc0b987..587968fccb 100644 --- a/system/camerad/cameras/camera_common.h +++ b/system/camerad/cameras/camera_common.h @@ -7,6 +7,7 @@ #include "cereal/messaging/messaging.h" #include "cereal/visionipc/visionipc_server.h" #include "common/queue.h" +#include "common/util.h" const int YUV_BUFFER_COUNT = 20; @@ -24,13 +25,6 @@ const bool env_debug_frames = getenv("DEBUG_FRAMES") != NULL; const bool env_log_raw_frames = getenv("LOG_RAW_FRAMES") != NULL; const bool env_ctrl_exp_from_params = getenv("CTRL_EXP_FROM_PARAMS") != NULL; -typedef struct AutoExposureRect { - int x; - int y; - int w; - int h; -} AutoExposureRect; - typedef struct FrameMetadata { uint32_t frame_id; uint32_t request_id; @@ -82,7 +76,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 get_raw_frame_image(const CameraBuf *b); -float set_exposure_target(const CameraBuf *b, AutoExposureRect ae_xywh, int x_skip, int y_skip); +float set_exposure_target(const CameraBuf *b, Rect 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); diff --git a/system/camerad/cameras/camera_qcom2.h b/system/camerad/cameras/camera_qcom2.h index c3317909f8..1d8c1e05ff 100644 --- a/system/camerad/cameras/camera_qcom2.h +++ b/system/camerad/cameras/camera_qcom2.h @@ -30,7 +30,7 @@ public: int new_exp_g; int new_exp_t; - AutoExposureRect ae_xywh; + Rect ae_xywh; float measured_grey_fraction; float target_grey_fraction; diff --git a/system/camerad/sensors/sensor.h b/system/camerad/sensors/sensor.h index 39b76fa0cc..391ead4702 100644 --- a/system/camerad/sensors/sensor.h +++ b/system/camerad/sensors/sensor.h @@ -48,7 +48,7 @@ public: float target_grey_factor; float min_ev; float max_ev; - std::vector ae_areas; + std::vector ae_areas; bool data_word; uint32_t probe_reg_addr; diff --git a/system/camerad/test/test_ae_gray.cc b/system/camerad/test/test_ae_gray.cc index f952364852..be9a0cc59f 100644 --- a/system/camerad/test/test_ae_gray.cc +++ b/system/camerad/test/test_ae_gray.cc @@ -36,7 +36,7 @@ TEST_CASE("camera.test_set_exposure_target") { cb.cur_yuv_buf = &vb; cb.rgb_width = W; cb.rgb_height = H; - AutoExposureRect rect = {0, 0, W-1, H-1}; + Rect rect = {0, 0, W-1, H-1}; printf("AE test patterns %dx%d\n", cb.rgb_width, cb.rgb_height);