summaryrefslogtreecommitdiff
path: root/libavcodec/mdct.c
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2009-09-20 17:30:20 +0000
committerMåns Rullgård <mans@mansr.com>2009-09-20 17:30:20 +0000
commit01b2214758ce2bc664bb4468f11ac0f041a337c1 (patch)
tree521c649aa1fb7c812e6db5191737cdb7ac413e7b /libavcodec/mdct.c
parentec129499b85e3d33a750d49862a73c2d19f61490 (diff)
downloadffmpeg-01b2214758ce2bc664bb4468f11ac0f041a337c1.tar.gz
Merge FFTContext and MDCTContext
Originally committed as revision 19931 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mdct.c')
-rw-r--r--libavcodec/mdct.c32
1 files changed, 16 insertions, 16 deletions
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;i<n8;i++) {
@@ -226,9 +226,9 @@ void ff_mdct_calc_c(MDCTContext *s, FFTSample *out, const FFTSample *input)
}
}
-av_cold void ff_mdct_end(MDCTContext *s)
+av_cold void ff_mdct_end(FFTContext *s)
{
av_freep(&s->tcos);
av_freep(&s->tsin);
- ff_fft_end(&s->fft);
+ ff_fft_end(s);
}