0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

vf_convert: default to limited range when converting RGB to YUV

Full range YUV causes problems everywhere. For example it's usually the
wrong choice when using encoding mode, and libswscale sometimes messes
up when converting to full range too. (In this partricular case, we
found that converting rgba->yuv420p16 full range actually seems to
output limited range.)

This actually restores a similar heueristic from the late vf_scale.c.
This commit is contained in:
wm4 2017-12-11 17:38:30 +01:00 committed by Jan Ekström
parent 5e38e03980
commit 308b3cd71b

View File

@ -71,6 +71,11 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
*out = *in;
out->imgfmt = best;
// If we convert from RGB to YUV, default to limited range.
if (mp_imgfmt_get_forced_csp(in->imgfmt) == MP_CSP_RGB &&
mp_imgfmt_get_forced_csp(out->imgfmt) == MP_CSP_AUTO)
out->color.levels = MP_CSP_LEVELS_TV;
mp_image_params_guess_csp(out);
mp_sws_set_from_cmdline(vf->priv->sws, vf->chain->opts->vo->sws_opts);