From 4e3f8ccb9d24f2f0940e93d1a8582e562265dede Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 5 Mar 2015 12:49:18 +0100 Subject: 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. --- video/out/vo_vaapi.c | 7 +++++-- 1 file 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); -- cgit v1.2.3