Commit 5b3c1aec authored by Loren Merritt's avatar Loren Merritt Committed by Anton Khirnov

hqdn3d: Fix out of array read in LOWPASS

CC:libav-stable@libav.org
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 0fe4b485
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
#include "vf_hqdn3d.h" #include "vf_hqdn3d.h"
#define LUT_BITS (depth==16 ? 8 : 4) #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 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] = RIGHTSHIFT(val, 16-depth)\ #define STORE(x,val) (depth == 8 ? dst[x] = (val) >> (16 - depth) : \
: AV_WN16A(dst+(x)*2, RIGHTSHIFT(val, 16-depth))) AV_WN16A(dst + (x) * 2, (val) >> (16 - depth)))
av_always_inline av_always_inline
static uint32_t lowpass(int prev, int cur, int16_t *coef, int depth) static uint32_t lowpass(int prev, int cur, int16_t *coef, int depth)
......
...@@ -39,6 +39,7 @@ SECTION .text ...@@ -39,6 +39,7 @@ SECTION .text
%endif %endif
%if %3 != 16 %if %3 != 16
shl %1, 16-%3 shl %1, 16-%3
add %1, (1<<(15-%3))-1
%endif %endif
%endmacro %endmacro
...@@ -86,7 +87,6 @@ ALIGN 16 ...@@ -86,7 +87,6 @@ ALIGN 16
mov [frameantq+xq*2], t0w mov [frameantq+xq*2], t0w
movifnidn dstq, dstmp movifnidn dstq, dstmp
%if %1 != 16 %if %1 != 16
add t0d, (1<<(15-%1))-1
shr t0d, 16-%1 ; could eliminate this by storing from t0h, but only with some contraints on register allocation shr t0d, 16-%1 ; could eliminate this by storing from t0h, but only with some contraints on register allocation
%endif %endif
%if %1 == 8 %if %1 == 8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment