summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-05 12:49:18 +0100
committerwm4 <wm4@nowhere>2015-03-05 12:49:18 +0100
commit4e3f8ccb9d24f2f0940e93d1a8582e562265dede (patch)
tree8abf95ace90c15bb0e3bc40d5b3307a69654d8e3
parent963c92eea298ff4c83011634097fc25bef202ce9 (diff)
downloadmpv-4e3f8ccb9d24f2f0940e93d1a8582e562265dede.tar.bz2
mpv-4e3f8ccb9d24f2f0940e93d1a8582e562265dede.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.
-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);