summaryrefslogtreecommitdiff
path: root/libavfilter/vf_hqdn3d.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2012-09-22 01:43:16 +0200
committerAnton Khirnov <anton@khirnov.net>2013-03-13 09:14:59 +0100
commit5b3c1aecb253828d09fa9825c5a4aed97badf086 (patch)
tree0393c942f9e6f4593bb69a3698a6969314fb9cc8 /libavfilter/vf_hqdn3d.c
parent0fe4b48540613127f7eed13769e989662cb74eef (diff)
hqdn3d: Fix out of array read in LOWPASS
CC:libav-stable@libav.org Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavfilter/vf_hqdn3d.c')
-rw-r--r--libavfilter/vf_hqdn3d.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c
index 50e904b940..eb0ea6519a 100644
--- a/libavfilter/vf_hqdn3d.c
+++ b/libavfilter/vf_hqdn3d.c
@@ -37,10 +37,10 @@
#include "vf_hqdn3d.h"
#define LUT_BITS (depth==16 ? 8 : 4)
-#define RIGHTSHIFT(a,b) (((a)+(((1<<(b))-1)>>1))>>(b))
-#define LOAD(x) ((depth==8 ? src[x] : AV_RN16A(src+(x)*2)) << (16-depth))
-#define STORE(x,val) (depth==8 ? dst[x] = RIGHTSHIFT(val, 16-depth)\
- : AV_WN16A(dst+(x)*2, RIGHTSHIFT(val, 16-depth)))
+#define LOAD(x) (((depth == 8 ? src[x] : AV_RN16A(src + (x) * 2)) << (16 - depth))\
+ + (((1 << (16 - depth)) - 1) >> 1))
+#define STORE(x,val) (depth == 8 ? dst[x] = (val) >> (16 - depth) : \
+ AV_WN16A(dst + (x) * 2, (val) >> (16 - depth)))
av_always_inline
static uint32_t lowpass(int prev, int cur, int16_t *coef, int depth)