summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-12-11 17:38:30 +0100
committerJan Ekström <jeebjp@gmail.com>2017-12-11 21:27:11 +0200
commit308b3cd71bf252ef3e543f6689468641a7fe2cc4 (patch)
treed4b3204df09d11d7a5eabe6124dcd17b34c81ed8 /video
parent5e38e039806c758bb97ee2d99a2e3e9423dce4df (diff)
downloadmpv-308b3cd71bf252ef3e543f6689468641a7fe2cc4.tar.bz2
mpv-308b3cd71bf252ef3e543f6689468641a7fe2cc4.tar.xz
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.
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_convert.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/video/filter/vf_convert.c b/video/filter/vf_convert.c
index d7b4c21e56..0714a532d0 100644
--- a/video/filter/vf_convert.c
+++ b/video/filter/vf_convert.c
@@ -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);