diff --git a/src/process_pipeline.c b/src/process_pipeline.c index fc40845..68e91dc 100644 --- a/src/process_pipeline.c +++ b/src/process_pipeline.c @@ -5,6 +5,7 @@ #include "main.h" #include "pipeline.h" #include "state.h" +#include "matrix.h" #include "zbar_pipeline.h" #include #include @@ -1317,22 +1318,27 @@ update_state(MPPipeline *pipeline, const mp_state_proc *new_state) state_proc.flash_enabled = new_state->flash_enabled; - if (output_changed) { - state_proc.camera_rotation = mod( - state_proc.mode->rotation - state_proc.device_rotation, 360); - - on_output_changed(format_changed); - } - if (camera_changed) { char cf[PATH_MAX]; if (find_calibration(cf, state_proc.camera->name)) { state_proc.calibration = parse_calibration_file(cf); } else { - printf("No calibration for %s\n", state_proc.camera->name); + fprintf(stderr, "No calibration for %s\n", state_proc.camera->name); + memcpy(state_proc.calibration.forward_matrix_1, sRGB_to_XYZD65, 9 * sizeof(float)); + // The below is the same as calling libmegapixels' libmegapixels_aaa_init, but as we call + // libmegapixels_aaa_set_matrix, we need it to be in the calibration + memcpy(state_proc.calibration.color_matrix_1, IDENTITY, 9 * sizeof(float)); + memcpy(state_proc.calibration.color_matrix_2, IDENTITY, 9 * sizeof(float)); } } + if (output_changed) { + state_proc.camera_rotation = mod( + state_proc.mode->rotation - state_proc.device_rotation, 360); + + on_output_changed(format_changed); + } + mp_state_main new_main = { .camera = pr_camera, .has_auto_focus_continuous = false,