diff options
author | Mattias Andrée <maandree@kth.se> | 2023-01-22 11:44:36 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-01-22 11:44:36 +0100 |
commit | 589d39180e14531ba77508b91051edda94a8896d (patch) | |
tree | afca4c40e49a9ad47fd1598c7924d0b53389fd19 /libglitter_colour_space_convert_rasters_double.c | |
parent | m + add libglitter_colour_space_convert_rasters_{double,float} (diff) | |
download | libglitter-589d39180e14531ba77508b91051edda94a8896d.tar.gz libglitter-589d39180e14531ba77508b91051edda94a8896d.tar.bz2 libglitter-589d39180e14531ba77508b91051edda94a8896d.tar.xz |
Use column-major conversion matrices
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libglitter_colour_space_convert_rasters_double.c')
-rw-r--r-- | libglitter_colour_space_convert_rasters_double.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libglitter_colour_space_convert_rasters_double.c b/libglitter_colour_space_convert_rasters_double.c index 7128998..3923911 100644 --- a/libglitter_colour_space_convert_rasters_double.c +++ b/libglitter_colour_space_convert_rasters_double.c @@ -6,9 +6,9 @@ static void multiply_33(double **outputs, size_t opos, const double **inputs, size_t ipos, const double matrix[3][3]) { double i0 = inputs[0][ipos], i1 = inputs[1][ipos], i2 = inputs[2][ipos]; - outputs[0][opos] = i0 * matrix[0][0] + i1 * matrix[1][0] + i2 * matrix[2][0]; - outputs[1][opos] = i0 * matrix[0][1] + i1 * matrix[1][1] + i2 * matrix[2][1]; - outputs[2][opos] = i0 * matrix[0][2] + i1 * matrix[1][2] + i2 * matrix[2][2]; + outputs[0][opos] = i0 * matrix[0][0] + i1 * matrix[0][1] + i2 * matrix[0][2]; + outputs[1][opos] = i0 * matrix[1][0] + i1 * matrix[1][1] + i2 * matrix[1][2]; + outputs[2][opos] = i0 * matrix[2][0] + i1 * matrix[2][1] + i2 * matrix[2][2]; } @@ -20,9 +20,9 @@ multiply_nn(size_t n, double **outputs, size_t opos, const double **inputs, size for (j = 0; j < n; j++) buffer[j] = inputs[j][ipos]; for (i = 0; i < n; i++) { - outputs[i][opos] = buffer[0] * matrix[0][i]; + outputs[i][opos] = buffer[0] * matrix[i][0]; for (j = 1; j < n; j++) - outputs[i][opos] += buffer[j] * matrix[j][i]; + outputs[i][opos] += buffer[j] * matrix[i][j]; } } @@ -35,9 +35,9 @@ multiply_nm(size_t n, size_t m, double **outputs /* m */, size_t opos, const dou for (j = 0; j < n; j++) buffer[j] = inputs[j][ipos]; for (i = 0; i < m; i++) { - outputs[i][opos] = buffer[0] * matrix[0][i]; + outputs[i][opos] = buffer[0] * matrix[i][0]; for (j = 1; j < n; j++) - outputs[i][opos] += buffer[j] * matrix[j][i]; + outputs[i][opos] += buffer[j] * matrix[i][j]; } } |