diff options
author | cantabile <cantabile.desu@gmail.com> | 2012-08-21 00:03:59 +0300 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-08-21 18:17:41 +0200 |
commit | a1380f394597e06e04195b1812300550f3c2df40 (patch) | |
tree | db2303737c451586f1f427e0f3b562f1c7f0dade /libvo/csputils.c | |
parent | 27262dec1be623618a2e55ab1dbc35371e0ec758 (diff) | |
download | mpv-a1380f394597e06e04195b1812300550f3c2df40.tar.bz2 mpv-a1380f394597e06e04195b1812300550f3c2df40.tar.xz |
video: honor the video's colormatrix and color range flags
If either of them is not defined, the old behavior is used:
- the colormatrix is guessed based on resolution.
- the color range is assumed to be tv aka limited range.
Diffstat (limited to 'libvo/csputils.c')
-rw-r--r-- | libvo/csputils.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libvo/csputils.c b/libvo/csputils.c index 3bd6e48f67..d6aed97864 100644 --- a/libvo/csputils.c +++ b/libvo/csputils.c @@ -47,6 +47,37 @@ char * const mp_csp_equalizer_names[MP_CSP_EQ_COUNT] = { "gamma", }; +enum mp_csp avcol_spc_to_mp_csp(enum AVColorSpace colorspace) +{ + switch (colorspace) { + case AVCOL_SPC_BT709: + return MP_CSP_BT_709; + break; + case AVCOL_SPC_BT470BG: + case AVCOL_SPC_SMPTE170M: + return MP_CSP_BT_601; + break; + case AVCOL_SPC_SMPTE240M: + return MP_CSP_SMPTE_240M; + break; + default: + return MP_CSP_AUTO; + } +} + +enum mp_csp_levels avcol_range_to_mp_csp_levels(enum AVColorRange range) +{ + switch (range) { + case AVCOL_RANGE_MPEG: + return MP_CSP_LEVELS_TV; + break; + case AVCOL_RANGE_JPEG: + return MP_CSP_LEVELS_PC; + break; + default: + return MP_CSP_LEVELS_AUTO; + } +} enum mp_csp mp_csp_guess_colorspace(int width, int height) { |