path: root/video/csputils.h
diff options
authorNiklas Haas <>2014-03-26 01:46:38 +0100
committerwm4 <wm4@nowhere>2014-06-22 19:00:38 +0200
commit70f50ddc5e97020d64ea0702748a00eddebc2473 (patch)
treef115668aa97cf11770459a169cc777ffca113840 /video/csputils.h
parent86d3d11a68510764504a2a3c5987ab8e059d6df5 (diff)
video: Add support for non-BT.709 primaries
This add support for reading primary information from lavc, categorized into BT.601-525, BT.601-625, BT.709 and BT.2020; and passes it on to the vo. In vo_opengl, we always generate the 3dlut against the wider BT.2020 and transform our source into this colorspace in the shader.
Diffstat (limited to 'video/csputils.h')
1 files changed, 18 insertions, 0 deletions
diff --git a/video/csputils.h b/video/csputils.h
index 57e10b3c27..d7d052a753 100644
--- a/video/csputils.h
+++ b/video/csputils.h
@@ -57,6 +57,18 @@ enum mp_csp_levels {
// Any enum mp_csp_levels value is a valid index (except MP_CSP_LEVELS_COUNT)
extern const char *const mp_csp_levels_names[MP_CSP_LEVELS_COUNT];
+enum mp_csp_prim {
+ MP_CSP_PRIM_BT_601_525,
+ MP_CSP_PRIM_BT_601_625,
+ MP_CSP_PRIM_BT_2020,
+// Any enum mp_csp_prim value is a valid index (except MP_CSP_PRIM_COUNT)
+extern const char *const mp_csp_prim_names[MP_CSP_PRIM_COUNT];
struct mp_csp_details {
enum mp_csp format;
enum mp_csp_levels levels_in; // encoded video
@@ -141,10 +153,14 @@ enum mp_csp avcol_spc_to_mp_csp(int avcolorspace);
enum mp_csp_levels avcol_range_to_mp_csp_levels(int avrange);
+enum mp_csp_prim avcol_pri_to_mp_csp_prim(int avpri);
int mp_csp_to_avcol_spc(enum mp_csp colorspace);
int mp_csp_levels_to_avcol_range(enum mp_csp_levels range);
+int mp_csp_prim_to_avcol_pri(enum mp_csp_prim prim);
enum mp_csp mp_csp_guess_colorspace(int width, int height);
enum mp_chroma_location avchroma_location_to_mp(int avloc);
@@ -160,6 +176,8 @@ 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]);
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);