mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 23:32:26 +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:
parent
5b01ef4572
commit
5f0fc0e914
@ -453,6 +453,15 @@ void mp_image_params_guess_csp(struct mp_image_params *params)
|
|||||||
if (!fmt.id)
|
if (!fmt.id)
|
||||||
return;
|
return;
|
||||||
if (fmt.flags & MP_IMGFLAG_YUV) {
|
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)
|
if (params->colorspace == MP_CSP_AUTO)
|
||||||
params->colorspace = mp_csp_guess_colorspace(params->w, params->h);
|
params->colorspace = mp_csp_guess_colorspace(params->w, params->h);
|
||||||
if (params->colorlevels == MP_CSP_LEVELS_AUTO)
|
if (params->colorlevels == MP_CSP_LEVELS_AUTO)
|
||||||
|
Loading…
Reference in New Issue
Block a user