From: Andre Noll Date: Fri, 16 Oct 2009 20:02:01 +0000 (+0200) Subject: we always compute the inverse mdct, so get rid of the inverse bit. X-Git-Tag: v0.4.1~95 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=509972da450f90a330fe290b62cd3e3d02de6e67;p=paraslash.git we always compute the inverse mdct, so get rid of the inverse bit. --- diff --git a/imdct.c b/imdct.c index a981eeb9..73600cbe 100644 --- a/imdct.c +++ b/imdct.c @@ -35,7 +35,6 @@ struct fft_complex { struct fft_context { int nbits; - int inverse; uint16_t *revtab; struct fft_complex *exptab; }; @@ -72,19 +71,19 @@ static fftsample_t *ff_cos_tabs[] = { ff_cos_16384, ff_cos_32768, ff_cos_65536, }; -static int split_radix_permutation(int i, int n, int inverse) +static int split_radix_permutation(int i, int n) { int m; if (n <= 2) return i & 1; m = n >> 1; - if (!(i & m)) - return split_radix_permutation(i, m, inverse) * 2; + if ((i & m) == 0) + return split_radix_permutation(i, m) * 2; m >>= 1; - if (inverse == !(i & m)) - return split_radix_permutation(i, m, inverse) * 4 + 1; + if ((i & m) == 0) + return split_radix_permutation(i, m) * 4 + 1; else - return split_radix_permutation(i, m, inverse) * 4 - 1; + return split_radix_permutation(i, m) * 4 - 1; } #define SQRTHALF (float)0.70710678118654752440 /* 1/sqrt(2) */ @@ -319,7 +318,7 @@ void imdct(struct mdct_context *s, float *output, const float *input) } } -static int fft_init(struct fft_context *s, int nbits, int inverse) +static int fft_init(struct fft_context *s, int nbits) { int i, j, n; @@ -330,7 +329,6 @@ static int fft_init(struct fft_context *s, int nbits, int inverse) s->exptab = para_malloc((n / 2) * sizeof(struct fft_complex)); s->revtab = para_malloc(n * sizeof(uint16_t)); - s->inverse = inverse; for (j = 4; j <= nbits; j++) { int k = 1 << j; double freq = 2 * M_PI / k; @@ -341,8 +339,7 @@ static int fft_init(struct fft_context *s, int nbits, int inverse) tab[k / 2 - i] = tab[i]; } for (i = 0; i < n; i++) - s->revtab[-split_radix_permutation( - i, n, s->inverse) & (n - 1)] = i; + s->revtab[-split_radix_permutation(i, n) & (n - 1)] = i; return 0; } @@ -353,9 +350,9 @@ static void fft_end(struct fft_context *ctx) } /** - * Init MDCT or IMDCT computation. + * Initialize the inverse modified cosine transform. */ -int imdct_init(int nbits, int inverse, struct mdct_context **result) +int imdct_init(int nbits, struct mdct_context **result) { int ret, n, n4, i; double alpha; @@ -374,7 +371,7 @@ int imdct_init(int nbits, int inverse, struct mdct_context **result) s->tcos[i] = -cos(alpha); s->tsin[i] = -sin(alpha); } - ret = fft_init(&s->fft, s->nbits - 2, inverse); + ret = fft_init(&s->fft, s->nbits - 2); if (ret < 0) goto fail; *result = s; diff --git a/imdct.h b/imdct.h index ab66bab0..6a71a5ad 100644 --- a/imdct.h +++ b/imdct.h @@ -2,6 +2,6 @@ struct mdct_context; -int imdct_init(int nbits, int inverse, struct mdct_context **result); +int imdct_init(int nbits, struct mdct_context **result); void imdct(struct mdct_context *s, float *output, const float *input); void imdct_end(struct mdct_context *s); diff --git a/wmadec_filter.c b/wmadec_filter.c index b26ab3b5..fdf312b9 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -482,7 +482,7 @@ static int wma_decode_init(char *initial_buf, int len, struct private_wmadec_dat return ret; /* init MDCT */ for (i = 0; i < s->nb_block_sizes; i++) { - ret = imdct_init(s->frame_len_bits - i + 1, 1, &s->mdct_ctx[i]); + ret = imdct_init(s->frame_len_bits - i + 1, &s->mdct_ctx[i]); if (ret < 0) return ret; }