pull/32112/head
ZwX1616 1 year ago
parent 18cd498b13
commit b28f09eadc
  1. 7
      system/camerad/cameras/camera_common.h
  2. 7
      system/camerad/cameras/camera_qcom2.cc
  3. 1
      system/camerad/cameras/camera_qcom2.h
  4. 12
      system/camerad/sensors/ar0231.cc
  5. 12
      system/camerad/sensors/os04c10.cc
  6. 12
      system/camerad/sensors/ox03c10.cc
  7. 4
      system/camerad/sensors/sensor.h

@ -24,6 +24,13 @@ 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;

@ -398,6 +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];}
dc_gain_enabled = false;
dc_gain_weight = ci->dc_gain_min_weight;
@ -902,8 +903,7 @@ void CameraState::set_camera_exposure(float grey_frac) {
}
static void process_driver_camera(MultiCameraState *s, CameraState *c, int cnt) {
const auto ae_xywh = c->ci->driver_ae_xywh;
c->set_camera_exposure(set_exposure_target(&c->buf, ae_xywh[0], ae_xywh[2], 2, ae_xywh[1], ae_xywh[3], 4));
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));
MessageBuilder msg;
auto framed = msg.initEvent().initDriverCameraState();
@ -928,9 +928,8 @@ void process_road_camera(MultiCameraState *s, CameraState *c, int cnt) {
c->ci->processRegisters(c, framed);
s->pm->send(c == &s->road_cam ? "roadCameraState" : "wideRoadCameraState", msg);
const auto ae_xywh = (c == &s->wide_road_cam) ? c->ci->wide_ae_xywh : c->ci->road_ae_xywh;
const int skip = 2;
c->set_camera_exposure(set_exposure_target(b, ae_xywh[0], ae_xywh[2], skip, ae_xywh[1], ae_xywh[3], skip));
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));
}
void cameras_run(MultiCameraState *s) {

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

@ -17,10 +17,6 @@ const float sensor_analog_gains_AR0231[] = {
5.0 / 4.0, 6.0 / 4.0, 6.0 / 3.0, 7.0 / 3.0, // 8, 9, 10, 11
7.0 / 2.0, 8.0 / 2.0, 8.0 / 1.0}; // 12, 13, 14, 15 = bypass
const int ar0231_road_ae_xywh[] = {96, 160, 1734, 986};
const int ar0231_wide_ae_xywh[] = {96, 250, 1734, 524};
const int ar0231_driver_ae_xywh[] = {96, 242, 1736, 906};
std::map<uint16_t, std::pair<int, int>> ar0231_build_register_lut(CameraState *c, uint8_t *data) {
// This function builds a lookup table from register address, to a pair of indices in the
// buffer where to read this address. The buffer contains padding bytes,
@ -120,11 +116,9 @@ AR0231::AR0231() {
min_ev = exposure_time_min * sensor_analog_gains[analog_gain_min_idx];
max_ev = exposure_time_max * dc_gain_factor * sensor_analog_gains[analog_gain_max_idx];
target_grey_factor = 1.0;
for (int i = 0; i < 4; i++) {
road_ae_xywh[i] = ar0231_road_ae_xywh[i];
wide_ae_xywh[i] = ar0231_wide_ae_xywh[i];
driver_ae_xywh[i] = ar0231_driver_ae_xywh[i];
}
ae_areas.push_back({96, 250, 1734, 524}); // wide
ae_areas.push_back({96, 160, 1734, 986}); // road
ae_areas.push_back({96, 242, 1736, 906}); // driver
}
void AR0231::processRegisters(CameraState *c, cereal::FrameData::Builder &framed) const {

@ -16,10 +16,6 @@ const uint32_t os04c10_analog_gains_reg[] = {
0x2E0, 0x300, 0x320, 0x340, 0x380, 0x3C0, 0x400, 0x440, 0x480, 0x4C0, 0x500,
0x540, 0x580, 0x5C0, 0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0};
const int os04c10_road_ae_xywh[] = {44, 50, 2600, 1420};
const int os04c10_wide_ae_xywh[] = {44, 194, 2600, 838};
const int os04c10_driver_ae_xywh[] = {44, 180, 2600, 1340};
} // namespace
OS04C10::OS04C10() {
@ -61,11 +57,9 @@ OS04C10::OS04C10() {
min_ev = (exposure_time_min) * sensor_analog_gains[analog_gain_min_idx];
max_ev = exposure_time_max * dc_gain_factor * sensor_analog_gains[analog_gain_max_idx];
target_grey_factor = 0.01;
for (int i = 0; i < 4; i++) {
road_ae_xywh[i] = os04c10_road_ae_xywh[i];
wide_ae_xywh[i] = os04c10_wide_ae_xywh[i];
driver_ae_xywh[i] = os04c10_driver_ae_xywh[i];
}
ae_areas.push_back({44, 194, 2600, 838}); // wide
ae_areas.push_back({44, 50, 2600, 1420}); // road
ae_areas.push_back({44, 180, 2600, 1340}); // driver
}
std::vector<i2c_random_wr_payload> OS04C10::getExposureRegisters(int exposure_time, int new_exp_g, bool dc_gain_enabled) const {

@ -16,10 +16,6 @@ const uint32_t ox03c10_analog_gains_reg[] = {
0x5C0, 0x600, 0x640, 0x680, 0x700, 0x780, 0x800, 0x880, 0x900, 0x980, 0xA00,
0xA80, 0xB00, 0xB80, 0xC00, 0xC80, 0xD00, 0xD80, 0xE00, 0xE80, 0xF00, 0xF80};
const int ox03c10_road_ae_xywh[] = {96, 160, 1734, 986};
const int ox03c10_wide_ae_xywh[] = {96, 250, 1734, 524};
const int ox03c10_driver_ae_xywh[] = {96, 242, 1736, 906};
const uint32_t VS_TIME_MIN_OX03C10 = 1;
const uint32_t VS_TIME_MAX_OX03C10 = 34; // vs < 35
@ -61,11 +57,9 @@ OX03C10::OX03C10() {
min_ev = (exposure_time_min + VS_TIME_MIN_OX03C10) * sensor_analog_gains[analog_gain_min_idx];
max_ev = exposure_time_max * dc_gain_factor * sensor_analog_gains[analog_gain_max_idx];
target_grey_factor = 0.01;
for (int i = 0; i < 4; i++) {
road_ae_xywh[i] = ox03c10_road_ae_xywh[i];
wide_ae_xywh[i] = ox03c10_wide_ae_xywh[i];
driver_ae_xywh[i] = ox03c10_driver_ae_xywh[i];
}
ae_areas.push_back({96, 250, 1734, 524}); // wide
ae_areas.push_back({96, 160, 1734, 986}); // road
ae_areas.push_back({96, 242, 1736, 906}); // driver
}
std::vector<i2c_random_wr_payload> OX03C10::getExposureRegisters(int exposure_time, int new_exp_g, bool dc_gain_enabled) const {

@ -49,9 +49,7 @@ public:
float target_grey_factor;
float min_ev;
float max_ev;
int road_ae_xywh[4];
int wide_ae_xywh[4];
int driver_ae_xywh[4];
std::vector<AutoExposureRect> ae_areas;
bool data_word;
uint32_t probe_reg_addr;

Loading…
Cancel
Save