Fixes forward MDCT for overlaps that aren't a multiple of 4

Adds more sizes to test_unit_mdct.c
This commit is contained in:
Jean-Marc Valin 2012-12-03 15:40:01 -05:00
parent 259e166648
commit aa3a599caa
2 changed files with 14 additions and 2 deletions

View file

@ -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<N4-(overlap>>2);i++)
for(;i<N4-((overlap+3)>>2);i++)
{
/* Real part arranged as a-bR, Imag part arranged as -c-dR */
*yp++ = *xp2;

View file

@ -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;