path: root/video/csputils.h
diff options
authorNiklas Haas <>2014-06-22 08:33:43 +0200
committerwm4 <wm4@nowhere>2014-06-22 19:02:06 +0200
commit17762a1919947db0e66e025bd2084de896eaa3fa (patch)
tree86aaf7c3c7bf37c9bf7a3c7f19eac9bacf7cd07e /video/csputils.h
parent204fed4d5b4aa20b5a6b5824f5d4e71ccbaf87fb (diff)
video: Generate an accurate CMS matrix instead of hard-coding
This also avoids an extra matrix multiplication when using :srgb, making that path both more efficient and also eliminating more hard-coded values. In addition, the previously hard-coded XYZ to RGB matrix will be dynamically generated.
Diffstat (limited to 'video/csputils.h')
1 files changed, 12 insertions, 1 deletions
diff --git a/video/csputils.h b/video/csputils.h
index 796dfd7422..8a17c23110 100644
--- a/video/csputils.h
+++ b/video/csputils.h
@@ -140,6 +140,13 @@ struct mp_csp_equalizer {
int values[MP_CSP_EQ_COUNT];
+struct mp_csp_col_xy {
+ float x, y;
+struct mp_csp_primaries {
+ struct mp_csp_col_xy red, green, blue, white;
void mp_csp_copy_equalizer_values(struct mp_csp_params *params,
const struct mp_csp_equalizer *eq);
@@ -177,11 +184,15 @@ void mp_gen_gamma_map(unsigned char *map, int size, float gamma);
#define COL_U 1
#define COL_V 2
#define COL_C 3
-void mp_get_cms_matrix(enum mp_csp_prim source, float m[3][3]);
+struct mp_csp_primaries mp_get_csp_primaries(enum mp_csp_prim csp);
+void mp_get_cms_matrix(struct mp_csp_primaries src, struct mp_csp_primaries dest, float cms_matrix[3][3]);
+void mp_get_rgb2xyz_matrix(struct mp_csp_primaries space, float m[3][3]);
void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]);
void mp_gen_yuv2rgb_map(struct mp_csp_params *params, uint8_t *map, int size);
+void mp_mul_matrix3x3(float a[3][3], float b[3][3]);
+void mp_invert_matrix3x3(float m[3][3]);
void mp_invert_yuv2rgb(float out[3][4], float in[3][4]);
void mp_map_int_color(float matrix[3][4], int clip_bits, int c[3]);