diff options
author | Niklas Haas <git@haasn.xyz> | 2017-06-14 20:45:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-06-18 20:54:44 +0200 |
commit | 6a4ce39648a7d93d9f06ec4f39254bd54ef7d408 (patch) | |
tree | cee7e61c099c8fc56179e0489f4ff7e2ae9d260b /video/filter/vf_format.c | |
parent | 1f3000b03c5ca8208858634ba57833d7dbb009cc (diff) | |
download | mpv-6a4ce39648a7d93d9f06ec4f39254bd54ef7d408.tar.bz2 mpv-6a4ce39648a7d93d9f06ec4f39254bd54ef7d408.tar.xz |
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.
Diffstat (limited to 'video/filter/vf_format.c')
-rw-r--r-- | video/filter/vf_format.c | 10 |
1 files changed, 9 insertions, 1 deletions
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) |