diff options
author | 2013-05-03 01:37:13 +0200 | |
---|---|---|
committer | 2013-05-04 01:34:29 +0200 | |
commit | 2cb147a2f40bcde48f5db321840f4dbd36ca796b (patch) | |
tree | 6b9f86619157c2c482a4fb579b34a5ff2c067860 | |
parent | 872aefaa1521a8cf70c6e14f3356e9d00ed7efa3 (diff) |
video: support YCgCo colorspace
YCgCo can be manually selected, but will also be used if the decoder
reports YCgCo. To make things more fun, files are sometimes marked
incorrectly, which will display such broken files incorrectly starting
with this commit.
-rw-r--r-- | core/cfg-mplayer.h | 3 | ||||
-rw-r--r-- | video/csputils.c | 12 | ||||
-rw-r--r-- | video/csputils.h | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h index 65b95de7c0..7414d561bd 100644 --- a/core/cfg-mplayer.h +++ b/core/cfg-mplayer.h @@ -581,7 +581,8 @@ const m_option_t mplayer_opts[]={ ({"auto", MP_CSP_AUTO}, {"BT.601", MP_CSP_BT_601}, {"BT.709", MP_CSP_BT_709}, - {"SMPTE-240M", MP_CSP_SMPTE_240M})), + {"SMPTE-240M", MP_CSP_SMPTE_240M}, + {"YCgCo", MP_CSP_YCGCO})), OPT_CHOICE("colormatrix-input-range", requested_input_range, 0, ({"auto", MP_CSP_LEVELS_AUTO}, {"limited", MP_CSP_LEVELS_TV}, diff --git a/video/csputils.c b/video/csputils.c index e7ea5a388b..d2793532df 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -41,6 +41,7 @@ char * const mp_csp_names[MP_CSP_COUNT] = { "SMPTE-240M", "RGB", "XYZ", + "YCgCo", }; char * const mp_csp_equalizer_names[MP_CSP_EQ_COUNT] = { @@ -59,6 +60,7 @@ enum mp_csp avcol_spc_to_mp_csp(enum AVColorSpace colorspace) case AVCOL_SPC_SMPTE170M: return MP_CSP_BT_601; case AVCOL_SPC_SMPTE240M: return MP_CSP_SMPTE_240M; case AVCOL_SPC_RGB: return MP_CSP_RGB; + case AVCOL_SPC_YCGCO: return MP_CSP_YCGCO; default: return MP_CSP_AUTO; } } @@ -79,6 +81,7 @@ enum AVColorSpace mp_csp_to_avcol_spc(enum mp_csp colorspace) case MP_CSP_BT_601: return AVCOL_SPC_BT470BG; case MP_CSP_SMPTE_240M: return AVCOL_SPC_SMPTE240M; case MP_CSP_RGB: return AVCOL_SPC_RGB; + case MP_CSP_YCGCO: return AVCOL_SPC_YCGCO; default: return AVCOL_SPC_UNSPECIFIED; } } @@ -190,6 +193,15 @@ void mp_get_yuv2rgb_coeffs(struct mp_csp_params *params, float m[3][4]) levels_in = -1; break; } + case MP_CSP_YCGCO: { + static const float ycgco_to_rgb[3][4] = { + {1, -1, 1}, + {1, 1, 0}, + {1, -1, -1}, + }; + memcpy(m, ycgco_to_rgb, sizeof(ycgco_to_rgb)); + break; + } default: abort(); }; diff --git a/video/csputils.h b/video/csputils.h index 184e1ee76a..d11e85e38b 100644 --- a/video/csputils.h +++ b/video/csputils.h @@ -41,6 +41,7 @@ enum mp_csp { MP_CSP_SMPTE_240M, MP_CSP_RGB, MP_CSP_XYZ, + MP_CSP_YCGCO, MP_CSP_COUNT }; |