From 6a4ce39648a7d93d9f06ec4f39254bd54ef7d408 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Wed, 14 Jun 2017 20:45:55 +0200 Subject: vf_format: also reset gamma-related attributes when changing gamma This prevents nasty surprises like the sig-peak still being left at 1.0 when reinterpreting SDR as HDR, or the OOTF for HLG being left as display-referred. --- video/filter/vf_format.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'video') diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c index ed9e4214ee..1953b61ab6 100644 --- a/video/filter/vf_format.c +++ b/video/filter/vf_format.c @@ -94,8 +94,16 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in, out->color.levels = p->colorlevels; if (p->primaries) out->color.primaries = p->primaries; - if (p->gamma) + if (p->gamma) { out->color.gamma = p->gamma; + if (in->color.gamma != out->color.gamma) { + // When changing the gamma function explicitly, also reset stuff + // related to the gamma function since that information will almost + // surely be false now and have to be re-inferred + out->color.sig_peak = 0.0; + out->color.light = MP_CSP_LIGHT_AUTO; + } + } if (p->sig_peak) out->color.sig_peak = p->sig_peak; if (p->light) -- cgit v1.2.3