Add color correction to the gles shader

This commit is contained in:
Martijn Braam
2023-07-26 23:40:51 +02:00
parent 10103a2834
commit d13cdd5dcb
7 changed files with 143 additions and 86 deletions

View File

@@ -473,6 +473,11 @@ process_image_for_preview(const uint8_t *image)
center);
libmegapixels_aaa_software_statistics(
center, width, height, &state_proc.stats);
state_proc.red += (state_proc.stats.whitebalance * -0.02f) + (state_proc.stats.tint * 0.01f);
state_proc.blue += (state_proc.stats.whitebalance * +0.02f) + (state_proc.stats.tint * 0.01f);
state_proc.blacklevel += state_proc.stats.blacklevel * 0.01f;
gles2_debayer_set_shading(gles2_debayer, state_proc.red, state_proc.blue, state_proc.blacklevel);
}
// Create a thumbnail from the preview for the last capture
@@ -933,6 +938,9 @@ on_output_changed(bool format_changed)
gles2_debayer_use(gles2_debayer);
}
state_proc.blacklevel = 0.0f;
state_proc.red = 1.0f;
state_proc.blue = 1.0f;
gles2_debayer_configure(gles2_debayer,
output_buffer_width,
output_buffer_height,