1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 15:22:09 +00:00

mp_image: explicitly forbid using RGB colorspace with YUV formats

This probably has more potential for breakage than it would be of use.
This commit is contained in:
wm4 2013-07-15 00:50:01 +02:00
parent 5b01ef4572
commit 5f0fc0e914

View File

@ -453,6 +453,15 @@ void mp_image_params_guess_csp(struct mp_image_params *params)
if (!fmt.id)
return;
if (fmt.flags & MP_IMGFLAG_YUV) {
if (params->colorspace != MP_CSP_BT_601 &&
params->colorspace != MP_CSP_BT_709 &&
params->colorspace != MP_CSP_SMPTE_240M &&
params->colorspace != MP_CSP_YCGCO)
{
// Makes no sense, so guess instead
// YCGCO should be separate, but libavcodec disagrees
params->colorspace = MP_CSP_AUTO;
}
if (params->colorspace == MP_CSP_AUTO)
params->colorspace = mp_csp_guess_colorspace(params->w, params->h);
if (params->colorlevels == MP_CSP_LEVELS_AUTO)