Use more colorscience from millipixels
This commit is contained in:
29
src/matrix.h
29
src/matrix.h
@@ -1 +1,30 @@
|
||||
static float xyz_to_srgb[] = { 3.2404542f, -1.5371385f, -0.4985314f,
|
||||
-0.9692660f, 1.8760108f, 0.0415560f,
|
||||
0.0556434f, -0.2040259f, 1.0572252f };
|
||||
|
||||
void multiply_matrices(float a[9], float b[9], float out[9]);
|
||||
|
||||
void
|
||||
invert_matrix(const float in[9], float out[9])
|
||||
{
|
||||
float det = in[0] * (in[4] * in[8] - in[5] * in[7]) -
|
||||
in[1] * (in[3] * in[8] - in[5] * in[6]) +
|
||||
in[2] * (in[3] * in[7] - in[4] * in[7]);
|
||||
out[0] = (in[4] * in[8] - in[7] * in[5]) / det;
|
||||
out[1] = (in[7] * in[2] - in[1] * in[8]) / det;
|
||||
out[2] = (in[1] * in[5] - in[4] * in[2]) / det;
|
||||
out[3] = (in[6] * in[5] - in[3] * in[8]) / det;
|
||||
out[4] = (in[0] * in[8] - in[6] * in[5]) / det;
|
||||
out[5] = (in[3] * in[2] - in[0] * in[5]) / det;
|
||||
out[6] = (in[3] * in[7] - in[6] * in[4]) / det;
|
||||
out[7] = (in[6] * in[1] - in[0] * in[7]) / det;
|
||||
out[8] = (in[0] * in[4] - in[3] * in[1]) / det;
|
||||
}
|
||||
|
||||
void
|
||||
transpose_matrix(const float in[9], float out[9])
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int j = 0; j < 3; ++j)
|
||||
out[i + j * 3] = in[j + i * 3];
|
||||
}
|
Reference in New Issue
Block a user