summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-05 12:49:18 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-03-11 12:30:50 +0900
commitcced4bf4d61cfb726186b275bb1c8674f418dd21 (patch)
treefe6eb1962edc1756f65b72c6971d580b24e75855
parent5734cd7063923eaf5d767b15a4ebd8e998c18e75 (diff)
downloadmpv-cced4bf4d61cfb726186b275bb1c8674f418dd21.tar.bz2
mpv-cced4bf4d61cfb726186b275bb1c8674f418dd21.tar.xz
vo_vaapi: round equalizer values
Probably fixes #1647 (if it's correct at all). I couldn't reproduce with the vdpau libva driver, but a driver can use different ranges. (cherry picked from commit 4e3f8ccb9d24f2f0940e93d1a8582e562265dede)
-rw-r--r--video/out/vo_vaapi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c
index de2c975823..51f1f4ec03 100644
--- a/video/out/vo_vaapi.c
+++ b/video/out/vo_vaapi.c
@@ -469,7 +469,7 @@ static int get_equalizer(struct priv *p, const char *name, int *value)
int r = attr->max_value - attr->min_value;
if (r == 0)
return VO_NOTIMPL;
- *value = ((attr->value - attr->min_value) * 200) / r - 100;
+ *value = ((attr->value - attr->min_value) * 200 + r / 2) / r - 100;
return VO_TRUE;
}
@@ -485,7 +485,10 @@ static int set_equalizer(struct priv *p, const char *name, int value)
int r = attr->max_value - attr->min_value;
if (r == 0)
return VO_NOTIMPL;
- attr->value = ((value + 100) * r) / 200 + attr->min_value;
+ attr->value = ((value + 100) * r + 100) / 200 + attr->min_value;
+
+ MP_VERBOSE(p, "Changing '%s' (range [%d, %d]) to %d\n", name,
+ attr->max_value, attr->min_value, attr->value);
va_lock(p->mpvaapi);
status = vaSetDisplayAttributes(p->display, attr, 1);