diff options
| author | Mohamed Tarek <mt@rockbox.org> | 2010-07-05 22:33:37 +0000 |
|---|---|---|
| committer | Mohamed Tarek <mt@rockbox.org> | 2010-07-05 22:33:37 +0000 |
| commit | d884af2b9992f12e98a3e8548aff76b232b5bfb3 (patch) | |
| tree | d3aefbc2195382025105b252c16b00087778beed /apps/codecs/libwmapro/wmapro_mdct.c | |
| parent | 6a04479d63dd4d7dfc54849e4c925d360d55fa9c (diff) | |
| download | rockbox-d884af2b9992f12e98a3e8548aff76b232b5bfb3.zip rockbox-d884af2b9992f12e98a3e8548aff76b232b5bfb3.tar.gz rockbox-d884af2b9992f12e98a3e8548aff76b232b5bfb3.tar.bz2 rockbox-d884af2b9992f12e98a3e8548aff76b232b5bfb3.tar.xz | |
Partial conversion of the wmapro decoder to fixed point arithmetic. Currently inverse quantization & rescaling,
imdct and windowing are all in fixed point.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27302 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libwmapro/wmapro_mdct.c')
| -rw-r--r-- | apps/codecs/libwmapro/wmapro_mdct.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/apps/codecs/libwmapro/wmapro_mdct.c b/apps/codecs/libwmapro/wmapro_mdct.c new file mode 100644 index 0000000..12cd8ce --- /dev/null +++ b/apps/codecs/libwmapro/wmapro_mdct.c @@ -0,0 +1,51 @@ +#include <inttypes.h> +#include "wmapro_mdct.h" +#include "mdct_tables.h" /* for sincos_lookup_wmap */ +#include "../lib/mdct_lookup.h" /* for revtab */ +#include "../lib/fft.h" /* for FFT data structures */ +#include "codeclib.h" +#include "../lib/codeclib_misc.h" /* for XNPROD31 */ + +void imdct_half(unsigned int nbits, int32_t *output, const int32_t *input){ + int k, n8, n4, n2, n, j; + //const uint16_t *revtab = s->revtab; + const int32_t *in1, *in2; + FFTComplex *z = (FFTComplex *)output; + + n = 1 << nbits; + n2 = n >> 1; + n4 = n >> 2; + n8 = n >> 3; + + const int32_t *T = sincos_lookup_wmap + ((n2) - (1<<7)); + + /* pre rotation */ + const int revtab_shift = (14- nbits); + in1 = input; + in2 = input + n2 - 1; + int step = 2<<(12-nbits); + for(k = 0; k < n4; k++) { + j=revtab[k]>>revtab_shift; + XNPROD31(*in2, *in1, T[1]<<16, T[0]<<16, &z[j].re, &z[j].im ); + in1 += 2; + in2 -= 2; + T += 2; + } + + ff_fft_calc_c(nbits-2, z); + + /* post rotation + reordering */ + T = sincos_lookup_wmap + ((n2) - (1<<7)) + n4; + const int32_t *V = T; + for(k = 0; k < n8; k++) { + int32_t r0, i0, r1, i1; + XNPROD31(z[n8-k-1].im, z[n8-k-1].re, T[0]<<16, T[1]<<16, &r0, &i1 ); + XNPROD31(z[n8+k ].im, z[n8+k ].re, V[0]<<16, V[1]<<16, &r1, &i0 ); + z[n8-k-1].re = r0; + z[n8-k-1].im = i0; + z[n8+k ].re = r1; + z[n8+k ].im = i1; + T-=2; + V+=2; + } +} |