summaryrefslogtreecommitdiff
path: root/libavcodec/mdct_fixed.c
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-03-21 17:52:34 +0000
committerMans Rullgard <mans@mansr.com>2011-04-02 21:06:07 +0100
commitbc154882e11f4a218cc8cfb10ae0b4cbc83b5f9f (patch)
tree906260b2356f1c6bad4740ed21d8330806e195fb /libavcodec/mdct_fixed.c
parented5fcd60b2d1d4993e2094c9836dedb8ef9b2ed3 (diff)
Fixed-point MDCT with 32-bit unscaled output
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/mdct_fixed.c')
-rw-r--r--libavcodec/mdct_fixed.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/libavcodec/mdct_fixed.c b/libavcodec/mdct_fixed.c
index 19c8039e04..94527f9e85 100644
--- a/libavcodec/mdct_fixed.c
+++ b/libavcodec/mdct_fixed.c
@@ -18,3 +18,47 @@
#define CONFIG_FFT_FLOAT 0
#include "mdct.c"
+
+/* same as ff_mdct_calcw_c with double-width unscaled output */
+void ff_mdct_calcw_c(FFTContext *s, FFTDouble *out, const FFTSample *input)
+{
+ int i, j, n, n8, n4, n2, n3;
+ FFTDouble re, im;
+ const uint16_t *revtab = s->revtab;
+ const FFTSample *tcos = s->tcos;
+ const FFTSample *tsin = s->tsin;
+ FFTComplex *x = s->tmp_buf;
+ FFTDComplex *o = (FFTDComplex *)out;
+
+ n = 1 << s->mdct_bits;
+ n2 = n >> 1;
+ n4 = n >> 2;
+ n8 = n >> 3;
+ n3 = 3 * n4;
+
+ /* pre rotation */
+ for(i=0;i<n8;i++) {
+ re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
+ im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
+ j = revtab[i];
+ CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
+
+ re = RSCALE( input[2*i] - input[n2-1-2*i]);
+ im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
+ j = revtab[n8 + i];
+ CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
+ }
+
+ s->fft_calc(s, x);
+
+ /* post rotation */
+ for(i=0;i<n8;i++) {
+ FFTDouble r0, i0, r1, i1;
+ CMULL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]);
+ CMULL(i0, r1, x[n8+i ].re, x[n8+i ].im, -tsin[n8+i ], -tcos[n8+i ]);
+ o[n8-i-1].re = r0;
+ o[n8-i-1].im = i0;
+ o[n8+i ].re = r1;
+ o[n8+i ].im = i1;
+ }
+}