Better color pipeline
This commit is contained in:
@@ -154,15 +154,13 @@ gles2_debayer_configure(GLES2Debayer *self,
|
|||||||
}
|
}
|
||||||
glUniform1f(self->uniform_inv_gamma, 1.0f / gamma);
|
glUniform1f(self->uniform_inv_gamma, 1.0f / gamma);
|
||||||
|
|
||||||
if (calibration.color_matrix_1[0]) {
|
if (calibration.forward_matrix_1[0]) {
|
||||||
GLfloat transposed[9];
|
|
||||||
float colormat_inv[9];
|
|
||||||
float colormat[9];
|
float colormat[9];
|
||||||
invert_matrix(calibration.color_matrix_1, colormat_inv);
|
float xyz[9];
|
||||||
multiply_matrices(xyz_to_srgb, colormat_inv, colormat);
|
multiply_matrices(calibration.forward_matrix_1, XYZD50_to_D65, xyz);
|
||||||
transpose_matrix(colormat, transposed);
|
multiply_matrices(xyz, XYZD65_to_sRGB, colormat);
|
||||||
glUniformMatrix3fv(
|
glUniformMatrix3fv(
|
||||||
self->uniform_color_matrix, 1, GL_FALSE, transposed);
|
self->uniform_color_matrix, 1, GL_FALSE, colormat);
|
||||||
} else {
|
} else {
|
||||||
static const GLfloat identity[9] = {
|
static const GLfloat identity[9] = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
10
src/matrix.h
10
src/matrix.h
@@ -1,6 +1,10 @@
|
|||||||
static float xyz_to_srgb[] = { 3.2404542f, -1.5371385f, -0.4985314f,
|
static float XYZD50_to_D65[] = { 0.9555766f, -0.0230393f, 0.0631636f,
|
||||||
-0.9692660f, 1.8760108f, 0.0415560f,
|
-0.0282895f, 1.0099416f, 0.0210077f,
|
||||||
0.0556434f, -0.2040259f, 1.0572252f };
|
0.0122982f, -0.0204830f, 1.3299098f };
|
||||||
|
|
||||||
|
static float XYZD65_to_sRGB[] = { 3.2406f, -1.5372f, -0.4986f,
|
||||||
|
-0.9689f, 1.8758f, 0.0415f,
|
||||||
|
0.0557f, -0.2040f, 1.0570f };
|
||||||
|
|
||||||
void multiply_matrices(float a[9], float b[9], float out[9]);
|
void multiply_matrices(float a[9], float b[9], float out[9]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user