cameras: use common transform (#19552)

pull/19562/head
Dean Lee 2020-12-21 09:21:46 +08:00 committed by GitHub
parent d5deaf2e6b
commit 9890f958d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 6 additions and 56 deletions

View File

@ -72,12 +72,12 @@ void CameraBuf::init(cl_device_id device_id, cl_context context, CameraState *s,
#else
float db_s = 1.0;
#endif
if (ci->bayer) {
yuv_transform = transform_scale_buffer(s->transform, db_s);
} else {
yuv_transform = s->transform;
}
const mat3 transform = (mat3){{
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
}};
yuv_transform = ci->bayer ? transform_scale_buffer(transform, db_s) : transform;
for (int i = 0; i < UI_BUF_COUNT; i++) {
VisionImg img = visionimg_alloc_rgb24(device_id, context, rgb_width, rgb_height, &rgb_bufs[i]);

View File

@ -89,18 +89,7 @@ CameraInfo cameras_supported[CAMERA_ID_MAX] = {
void cameras_init(MultiCameraState *s, cl_device_id device_id, cl_context ctx) {
camera_init(&s->rear, CAMERA_ID_IMX298, 20, device_id, ctx);
s->rear.transform = (mat3){{
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
}};
camera_init(&s->front, CAMERA_ID_OV8865, 10, device_id, ctx);
s->front.transform = (mat3){{
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
}};
}
void camera_autoexposure(CameraState *s, float grey_frac) {}

View File

@ -21,8 +21,6 @@ typedef struct CameraState {
float digital_gain;
float cur_gain_frac;
mat3 transform;
CameraBuf buf;
} CameraState;

View File

@ -315,20 +315,6 @@ void cameras_init(MultiCameraState *s, cl_device_id device_id, cl_context ctx) {
s->front.apply_exposure = imx179_s5k3p8sp_apply_exposure;
}
// assume the device is upside-down (not anymore)
s->rear.transform = (mat3){{
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
}};
// probably wrong
s->front.transform = (mat3){{
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
}};
s->rear.device = s->device;
s->front.device = s->device;

View File

@ -109,8 +109,6 @@ typedef struct CameraState {
int fps;
mat3 transform;
CameraBuf buf;
} CameraState;

View File

@ -562,12 +562,6 @@ static void camera_init(CameraState *s, int camera_id, int camera_num, unsigned
s->camera_num = camera_num;
s->transform = (mat3){{
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
}};
s->dc_gain_enabled = false;
s->analog_gain = 0x5;
s->analog_gain_frac = sensor_analog_gains[s->analog_gain];

View File

@ -31,8 +31,6 @@ typedef struct CameraState {
int exposure_time_max;
float ef_filtered;
mat3 transform;
int device_iommu;
int cdm_iommu;

View File

@ -220,19 +220,7 @@ CameraInfo cameras_supported[CAMERA_ID_MAX] = {
void cameras_init(MultiCameraState *s, cl_device_id device_id, cl_context ctx) {
camera_init(&s->rear, CAMERA_ID_LGC920, 20, device_id, ctx);
s->rear.transform = (mat3){{
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
}};
camera_init(&s->front, CAMERA_ID_LGC615, 10, device_id, ctx);
s->front.transform = (mat3){{
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0,
}};
s->pm = new PubMaster({"frame", "frontFrame"});
}

View File

@ -16,7 +16,6 @@ typedef struct CameraState {
CameraInfo ci;
int fps;
float digital_gain;
mat3 transform;
CameraBuf buf;
} CameraState;