From: Andre Noll Date: Wed, 14 Oct 2009 19:10:27 +0000 (+0200) Subject: trivial mdct cleanups X-Git-Tag: v0.4.1~104 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=44aa9a29ecc951d74a28bd79462cb0f9b628523e;p=paraslash.git trivial mdct cleanups --- diff --git a/imdct.c b/imdct.c index e3021b45..e2cfe034 100644 --- a/imdct.c +++ b/imdct.c @@ -219,6 +219,7 @@ static void fft16(struct fft_complex *z) TRANSFORM(z[1], z[5], z[9], z[13], ff_cos_16[1], ff_cos_16[3]); TRANSFORM(z[3], z[7], z[11], z[15], ff_cos_16[3], ff_cos_16[1]); } + DECL_FFT(32, 16, 8) DECL_FFT(64, 32, 16) DECL_FFT(128, 64, 32) @@ -233,8 +234,7 @@ DECL_FFT(16384, 8192, 4096) DECL_FFT(32768, 16384, 8192) DECL_FFT(65536, 32768, 16384) -static void (*fft_dispatch[]) (struct fft_complex *) = -{ +static void (*fft_dispatch[]) (struct fft_complex *) = { fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024, fft2048, fft4096, fft8192, fft16384, fft32768, fft65536, }; @@ -247,12 +247,12 @@ static void fft(struct fft_context *s, struct fft_complex *z) /* complex multiplication: p = a * b */ #define CMUL(pre, pim, are, aim, bre, bim) \ {\ - fftsample_t _are = (are);\ - fftsample_t _aim = (aim);\ - fftsample_t _bre = (bre);\ - fftsample_t _bim = (bim);\ - (pre) = _are * _bre - _aim * _bim;\ - (pim) = _are * _bim + _aim * _bre;\ + fftsample_t _are = (are);\ + fftsample_t _aim = (aim);\ + fftsample_t _bre = (bre);\ + fftsample_t _bim = (bim);\ + (pre) = _are * _bre - _aim * _bim;\ + (pim) = _are * _bim + _aim * _bre;\ } /** @@ -391,13 +391,11 @@ static int fft_init(struct fft_context *s, int nbits, int inverse) nblocks = nblocks >> 1; } while (nblocks != 0); freep(&s->exptab); - /* compute bit reverse table */ for (i = 0; i < n; i++) { m = 0; - for (j = 0; j < nbits; j++) { + for (j = 0; j < nbits; j++) m |= ((i >> j) & 1) << (nbits - j - 1); - } s->revtab[i] = m; } } @@ -442,8 +440,7 @@ int imdct_init(int nbits, int inverse, struct mdct_context **result) double alpha; struct mdct_context *s; - s = para_malloc(sizeof(*s)); - memset(s, 0, sizeof(*s)); + s = para_calloc(sizeof(*s)); n = 1 << nbits; s->nbits = nbits; s->n = n;