From 623d217ed1ba168355b1887ef9ca02402b40eead Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 3 Jun 2017 14:01:46 -0300 Subject: [PATCH] avcodec/aacps: move checks for valid length outside the stereo_interpolate dsp function Signed-off-by: James Almer --- libavcodec/aacps.c | 7 ++++--- libavcodec/x86/aacpsdsp.asm | 6 ------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c index 29de8a5ea7..473da7bd43 100644 --- a/libavcodec/aacps.c +++ b/libavcodec/aacps.c @@ -979,9 +979,10 @@ static void stereo_processing(PSContext *ps, INTFLOAT (*l)[32][2], INTFLOAT (*r) h_step[1][2] = AAC_MSUB31_V3(H21[1][e+1][b], h[1][2], width); h_step[1][3] = AAC_MSUB31_V3(H22[1][e+1][b], h[1][3], width); } - ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd]( - l[k] + 1 + start, r[k] + 1 + start, - h, h_step, stop - start); + if (stop - start) + ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd]( + l[k] + 1 + start, r[k] + 1 + start, + h, h_step, stop - start); } } } diff --git a/libavcodec/x86/aacpsdsp.asm b/libavcodec/x86/aacpsdsp.asm index f7f22f274c..67d3bd4e07 100644 --- a/libavcodec/x86/aacpsdsp.asm +++ b/libavcodec/x86/aacpsdsp.asm @@ -94,8 +94,6 @@ INIT_XMM sse3 cglobal ps_stereo_interpolate, 5, 5, 6, l, r, h, h_step, n movaps m0, [hq] movaps m1, [h_stepq] - cmp nd, 0 - jle .ret unpcklps m4, m0, m0 unpckhps m0, m0 unpcklps m5, m1, m1 @@ -118,7 +116,6 @@ align 16 movhps [rq+nq], m2 add nq, 8 jl .loop -.ret: REP_RET ;*************************************************************************** @@ -128,8 +125,6 @@ align 16 ;*************************************************************************** INIT_XMM sse3 cglobal ps_stereo_interpolate_ipdopd, 5, 5, 10, l, r, h, h_step, n - cmp nd, 0 - jle .ret movaps m0, [hq] movaps m1, [hq+mmsize] %if ARCH_X86_64 @@ -169,7 +164,6 @@ align 16 movhps [rq+nq], m2 add nq, 8 jl .loop -.ret: REP_RET ;*******************************************************************