From 3ccc63deec85f454521d465c4e0e3438e76cb547 Mon Sep 17 00:00:00 2001 From: ZwX1616 Date: Wed, 31 Jul 2024 19:10:44 -0700 Subject: [PATCH] camerad: use os binning (#33161) * all * right sz * what is this * Revert "what is this" This reverts commit 3ff771926f109452a055dfb61cee06b34e498164. * ok * big * update intrs * fl * more specifuc * fish * revert * revert --------- Co-authored-by: Comma Device --- common/transformations/camera.py | 4 +-- system/camerad/cameras/camera_common.cc | 2 +- system/camerad/sensors/os04c10.cc | 6 ++-- system/camerad/sensors/os04c10_registers.h | 42 +++++++++++----------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/common/transformations/camera.py b/common/transformations/camera.py index dc3ca5f388..2e68b5e37c 100644 --- a/common/transformations/camera.py +++ b/common/transformations/camera.py @@ -47,9 +47,9 @@ class DeviceCameraConfig: yield cam, getattr(self, cam) _ar_ox_fisheye = CameraConfig(1928, 1208, 567.0) # focal length probably wrong? magnification is not consistent across frame -_os_fisheye = CameraConfig(2688, 1520, 567.0 / 2 * 3) +_os_fisheye = CameraConfig(2688 // 2, 1520 // 2, 567.0 / 4 * 3) _ar_ox_config = DeviceCameraConfig(CameraConfig(1928, 1208, 2648.0), _ar_ox_fisheye, _ar_ox_fisheye) -_os_config = DeviceCameraConfig(CameraConfig(2688, 1520, 2648.0 * 2 / 3), _os_fisheye, _os_fisheye) +_os_config = DeviceCameraConfig(CameraConfig(2688 // 2, 1520 // 2, 1522.0 * 3 / 4), _os_fisheye, _os_fisheye) _neo_config = DeviceCameraConfig(CameraConfig(1164, 874, 910.0), CameraConfig(816, 612, 650.0), _NoneCameraConfig()) DEVICE_CAMERAS = { diff --git a/system/camerad/cameras/camera_common.cc b/system/camerad/cameras/camera_common.cc index 542be29d80..06ef2bd378 100644 --- a/system/camerad/cameras/camera_common.cc +++ b/system/camerad/cameras/camera_common.cc @@ -84,7 +84,7 @@ void CameraBuf::init(cl_device_id device_id, cl_context context, CameraState *s, // the encoder HW tells us the size it wants after setting it up. // TODO: VENUS_BUFFER_SIZE should give the size, but it's too small. dependent on encoder settings? - size_t nv12_size = (rgb_width >= 2688 ? 2900 : 2346)*nv12_width; + size_t nv12_size = (rgb_width <= 1344 ? 2900 : 2346)*nv12_width; vipc_server->create_buffers_with_sizes(stream_type, YUV_BUFFER_COUNT, false, rgb_width, rgb_height, nv12_size, nv12_width, nv12_uv_offset); LOGD("created %d YUV vipc buffers with size %dx%d", YUV_BUFFER_COUNT, nv12_width, nv12_height); diff --git a/system/camerad/sensors/os04c10.cc b/system/camerad/sensors/os04c10.cc index 97a317407a..e651d6ff7a 100644 --- a/system/camerad/sensors/os04c10.cc +++ b/system/camerad/sensors/os04c10.cc @@ -20,12 +20,12 @@ const uint32_t os04c10_analog_gains_reg[] = { OS04C10::OS04C10() { image_sensor = cereal::FrameData::ImageSensor::OS04C10; - pixel_size_mm = 0.002; + pixel_size_mm = 0.004; data_word = false; hdr_offset = 64 * 2 + 8; // stagger - frame_width = 2688; - frame_height = 1520 * 2 + hdr_offset; + frame_width = 1344; + frame_height = 760 * 2 + hdr_offset; frame_stride = (frame_width * 10 / 8); // no alignment extra_height = 0; diff --git a/system/camerad/sensors/os04c10_registers.h b/system/camerad/sensors/os04c10_registers.h index 91eb48b24f..d698b1311f 100644 --- a/system/camerad/sensors/os04c10_registers.h +++ b/system/camerad/sensors/os04c10_registers.h @@ -95,7 +95,7 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x388b, 0x00}, {0x3c80, 0x10}, {0x3c86, 0x00}, - // {0x3c8c, 0x20}, + {0x3c8c, 0x20}, {0x3c9f, 0x01}, {0x3d85, 0x1b}, {0x3d8c, 0x71}, @@ -199,7 +199,7 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x370b, 0xa2}, {0x370c, 0x01}, {0x370f, 0x00}, - {0x3714, 0x24}, + {0x3714, 0x28}, {0x3716, 0x04}, {0x3719, 0x11}, {0x371a, 0x1e}, @@ -231,24 +231,24 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x37bd, 0x01}, {0x37bf, 0x26}, {0x37c0, 0x11}, - {0x37c2, 0x04}, + {0x37c2, 0x14}, {0x37cd, 0x19}, - // {0x37e0, 0x08}, - // {0x37e6, 0x04}, + {0x37e0, 0x08}, + {0x37e6, 0x04}, {0x37e5, 0x02}, - // {0x37e1, 0x0c}, - // {0x3737, 0x04}, + {0x37e1, 0x0c}, + {0x3737, 0x04}, {0x37d8, 0x02}, - // {0x37e2, 0x10}, + {0x37e2, 0x10}, {0x3739, 0x10}, - {0x3662, 0x10}, - // {0x37e4, 0x20}, - // {0x37e3, 0x08}, - {0x37d9, 0x08}, + {0x3662, 0x08}, + {0x37e4, 0x20}, + {0x37e3, 0x08}, + {0x37d9, 0x04}, {0x4040, 0x00}, - {0x4041, 0x07}, - {0x4008, 0x02}, - {0x4009, 0x0d}, + {0x4041, 0x03}, + {0x4008, 0x01}, + {0x4009, 0x06}, // FSIN {0x3002, 0x22}, @@ -269,20 +269,20 @@ const struct i2c_random_wr_payload init_array_os04c10[] = { {0x3802, 0x00}, {0x3803, 0x00}, {0x3804, 0x0a}, {0x3805, 0x8f}, {0x3806, 0x05}, {0x3807, 0xff}, - {0x3808, 0x0a}, {0x3809, 0x80}, - {0x380a, 0x05}, {0x380b, 0xf0}, + {0x3808, 0x05}, {0x3809, 0x40}, + {0x380a, 0x02}, {0x380b, 0xf8}, {0x3811, 0x08}, {0x3813, 0x08}, - {0x3814, 0x01}, + {0x3814, 0x03}, {0x3815, 0x01}, - {0x3816, 0x01}, + {0x3816, 0x03}, {0x3817, 0x01}, {0x380c, 0x04}, {0x380d, 0x2e}, // HTS {0x380e, 0x09}, {0x380f, 0xdb}, // VTS - {0x3820, 0xb0}, - {0x3821, 0x04}, + {0x3820, 0xb3}, + {0x3821, 0x05}, {0x3880, 0x00}, {0x3882, 0x20}, {0x3c91, 0x0b},