From aa3a599caa2aa2e4f3036eb0e3b848bf3946821e Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Mon, 3 Dec 2012 15:40:01 -0500 Subject: [PATCH] Fixes forward MDCT for overlaps that aren't a multiple of 4 Adds more sizes to test_unit_mdct.c --- celt/mdct.c | 4 ++-- celt/tests/test_unit_mdct.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/celt/mdct.c b/celt/mdct.c index bfdeff38..432f331a 100644 --- a/celt/mdct.c +++ b/celt/mdct.c @@ -133,7 +133,7 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar kiss_fft_scalar * OPUS_RESTRICT yp = f; const opus_val16 * OPUS_RESTRICT wp1 = window+(overlap>>1); const opus_val16 * OPUS_RESTRICT wp2 = window+(overlap>>1)-1; - for(i=0;i<(overlap>>2);i++) + for(i=0;i<((overlap+3)>>2);i++) { /* Real part arranged as -d-cR, Imag part arranged as -b+aR*/ *yp++ = MULT16_32_Q15(*wp2, xp1[N2]) + MULT16_32_Q15(*wp1,*xp2); @@ -145,7 +145,7 @@ void clt_mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar } wp1 = window; wp2 = window+overlap-1; - for(;i>2);i++) + for(;i>2);i++) { /* Real part arranged as a-bR, Imag part arranged as -c-dR */ *yp++ = *xp2; diff --git a/celt/tests/test_unit_mdct.c b/celt/tests/test_unit_mdct.c index 42962e11..ac8957fd 100644 --- a/celt/tests/test_unit_mdct.c +++ b/celt/tests/test_unit_mdct.c @@ -183,15 +183,27 @@ int main(int argc,char ** argv) test1d(256,1); test1d(512,0); test1d(512,1); + test1d(1024,0); + test1d(1024,1); + test1d(2048,0); + test1d(2048,1); #ifndef RADIX_TWO_ONLY + test1d(36,0); + test1d(36,1); test1d(40,0); test1d(40,1); + test1d(60,0); + test1d(60,1); test1d(120,0); test1d(120,1); test1d(240,0); test1d(240,1); test1d(480,0); test1d(480,1); + test1d(960,0); + test1d(960,1); + test1d(1920,0); + test1d(1920,1); #endif } return ret;