From 01b2214758ce2bc664bb4468f11ac0f041a337c1 Mon Sep 17 00:00:00 2001 From: Måns Rullgård Date: Sun, 20 Sep 2009 17:30:20 +0000 Subject: Merge FFTContext and MDCTContext Originally committed as revision 19931 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mdct.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'libavcodec/mdct.c') diff --git a/libavcodec/mdct.c b/libavcodec/mdct.c index cb024aceda..4e5609c0c0 100644 --- a/libavcodec/mdct.c +++ b/libavcodec/mdct.c @@ -72,15 +72,15 @@ av_cold void ff_sine_window_init(float *window, int n) { /** * init MDCT or IMDCT computation. */ -av_cold int ff_mdct_init(MDCTContext *s, int nbits, int inverse, double scale) +av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale) { int n, n4, i; double alpha, theta; memset(s, 0, sizeof(*s)); n = 1 << nbits; - s->nbits = nbits; - s->n = n; + s->mdct_bits = nbits; + s->mdct_size = n; n4 = n >> 2; s->tcos = av_malloc(n4 * sizeof(FFTSample)); if (!s->tcos) @@ -96,7 +96,7 @@ av_cold int ff_mdct_init(MDCTContext *s, int nbits, int inverse, double scale) s->tcos[i] = -cos(alpha) * scale; s->tsin[i] = -sin(alpha) * scale; } - if (ff_fft_init(&s->fft, s->nbits - 2, inverse) < 0) + if (ff_fft_init(s, s->mdct_bits - 2, inverse) < 0) goto fail; return 0; fail: @@ -122,16 +122,16 @@ av_cold int ff_mdct_init(MDCTContext *s, int nbits, int inverse, double scale) * @param output N/2 samples * @param input N/2 samples */ -void ff_imdct_half_c(MDCTContext *s, FFTSample *output, const FFTSample *input) +void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input) { int k, n8, n4, n2, n, j; - const uint16_t *revtab = s->fft.revtab; + const uint16_t *revtab = s->revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; const FFTSample *in1, *in2; FFTComplex *z = (FFTComplex *)output; - n = 1 << s->nbits; + n = 1 << s->mdct_bits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; @@ -145,7 +145,7 @@ void ff_imdct_half_c(MDCTContext *s, FFTSample *output, const FFTSample *input) in1 += 2; in2 -= 2; } - ff_fft_calc(&s->fft, z); + ff_fft_calc(s, z); /* post rotation + reordering */ for(k = 0; k < n8; k++) { @@ -164,10 +164,10 @@ void ff_imdct_half_c(MDCTContext *s, FFTSample *output, const FFTSample *input) * @param output N samples * @param input N/2 samples */ -void ff_imdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input) +void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input) { int k; - int n = 1 << s->nbits; + int n = 1 << s->mdct_bits; int n2 = n >> 1; int n4 = n >> 2; @@ -184,16 +184,16 @@ void ff_imdct_calc_c(MDCTContext *s, FFTSample *output, const FFTSample *input) * @param input N samples * @param out N/2 samples */ -void ff_mdct_calc_c(MDCTContext *s, FFTSample *out, const FFTSample *input) +void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input) { int i, j, n, n8, n4, n2, n3; FFTSample re, im; - const uint16_t *revtab = s->fft.revtab; + const uint16_t *revtab = s->revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; FFTComplex *x = (FFTComplex *)out; - n = 1 << s->nbits; + n = 1 << s->mdct_bits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; @@ -212,7 +212,7 @@ void ff_mdct_calc_c(MDCTContext *s, FFTSample *out, const FFTSample *input) CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]); } - ff_fft_calc(&s->fft, x); + ff_fft_calc(s, x); /* post rotation */ for(i=0;itcos); av_freep(&s->tsin); - ff_fft_end(&s->fft); + ff_fft_end(s); } -- cgit v1.2.3