summaryrefslogtreecommitdiffstats
path: root/video/csputils.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-05-13 17:20:28 +0200
committerwm4 <wm4@nowhere>2017-05-13 17:25:24 +0200
commit5aea98551b950de8ea96d9acb08ed1e65a003f80 (patch)
treecb60df3a0e7329bfd670b102e13dd10c5772f45f /video/csputils.c
parente6a667763079c8665affb352f209aa2f0572b0e4 (diff)
downloadmpv-5aea98551b950de8ea96d9acb08ed1e65a003f80.tar.bz2
mpv-5aea98551b950de8ea96d9acb08ed1e65a003f80.tar.xz
csputils: code clarity
`cmax` is more intuitive than `cmin` especially for full-range YUV, and this also explains the behavior of `anyfull` better.
Diffstat (limited to 'video/csputils.c')
-rw-r--r--video/csputils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/video/csputils.c b/video/csputils.c
index 6835aeed20..a41d9cf8c4 100644
--- a/video/csputils.c
+++ b/video/csputils.c
@@ -737,10 +737,10 @@ void mp_get_csp_matrix(struct mp_csp_params *params, struct mp_cmat *m)
// and conflict with at least the full-range YCbCr/ICtCp values as defined
// by ITU-R BT.2100. If somebody ever complains about full-range YUV looking
// different from their reference display, this comment is probably why.
- struct yuvlevels { double ymin, ymax, cmin, cmid; }
- yuvlim = { 16*s, 235*s, 16*s, 128*s },
- yuvfull = { 0*s, 255*s, 1*s, 128*s }, // '1' for symmetry around 128
- anyfull = { 0*s, 255*s, -255*s/2, 0 },
+ struct yuvlevels { double ymin, ymax, cmax, cmid; }
+ yuvlim = { 16*s, 235*s, 240*s, 128*s },
+ yuvfull = { 0*s, 255*s, 255*s, 128*s },
+ anyfull = { 0*s, 255*s, 255*s/2, 0 }, // cmax picked to make cmul=ymul
yuvlev;
switch (levels_in) {
case MP_CSP_LEVELS_TV: yuvlev = yuvlim; break;
@@ -765,7 +765,7 @@ void mp_get_csp_matrix(struct mp_csp_params *params, struct mp_cmat *m)
}
double ymul = (rgblev.max - rgblev.min) / (yuvlev.ymax - yuvlev.ymin);
- double cmul = (rgblev.max - rgblev.min) / (yuvlev.cmid - yuvlev.cmin) / 2;
+ double cmul = (rgblev.max - rgblev.min) / (yuvlev.cmax - yuvlev.cmid) / 2;
// Contrast scales the output value range (gain)
ymul *= params->contrast;