annotate ffmpeg/libavcodec/mdct_fixed.c @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 /*
yading@10 2 * This file is part of FFmpeg.
yading@10 3 *
yading@10 4 * FFmpeg is free software; you can redistribute it and/or
yading@10 5 * modify it under the terms of the GNU Lesser General Public
yading@10 6 * License as published by the Free Software Foundation; either
yading@10 7 * version 2.1 of the License, or (at your option) any later version.
yading@10 8 *
yading@10 9 * FFmpeg is distributed in the hope that it will be useful,
yading@10 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@10 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@10 12 * Lesser General Public License for more details.
yading@10 13 *
yading@10 14 * You should have received a copy of the GNU Lesser General Public
yading@10 15 * License along with FFmpeg; if not, write to the Free Software
yading@10 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@10 17 */
yading@10 18
yading@10 19 #define CONFIG_FFT_FLOAT 0
yading@10 20 #include "mdct.c"
yading@10 21
yading@10 22 /* same as ff_mdct_calcw_c with double-width unscaled output */
yading@10 23 void ff_mdct_calcw_c(FFTContext *s, FFTDouble *out, const FFTSample *input)
yading@10 24 {
yading@10 25 int i, j, n, n8, n4, n2, n3;
yading@10 26 FFTDouble re, im;
yading@10 27 const uint16_t *revtab = s->revtab;
yading@10 28 const FFTSample *tcos = s->tcos;
yading@10 29 const FFTSample *tsin = s->tsin;
yading@10 30 FFTComplex *x = s->tmp_buf;
yading@10 31 FFTDComplex *o = (FFTDComplex *)out;
yading@10 32
yading@10 33 n = 1 << s->mdct_bits;
yading@10 34 n2 = n >> 1;
yading@10 35 n4 = n >> 2;
yading@10 36 n8 = n >> 3;
yading@10 37 n3 = 3 * n4;
yading@10 38
yading@10 39 /* pre rotation */
yading@10 40 for(i=0;i<n8;i++) {
yading@10 41 re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
yading@10 42 im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
yading@10 43 j = revtab[i];
yading@10 44 CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
yading@10 45
yading@10 46 re = RSCALE( input[2*i] - input[n2-1-2*i]);
yading@10 47 im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
yading@10 48 j = revtab[n8 + i];
yading@10 49 CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
yading@10 50 }
yading@10 51
yading@10 52 s->fft_calc(s, x);
yading@10 53
yading@10 54 /* post rotation */
yading@10 55 for(i=0;i<n8;i++) {
yading@10 56 FFTDouble r0, i0, r1, i1;
yading@10 57 CMULL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]);
yading@10 58 CMULL(i0, r1, x[n8+i ].re, x[n8+i ].im, -tsin[n8+i ], -tcos[n8+i ]);
yading@10 59 o[n8-i-1].re = r0;
yading@10 60 o[n8-i-1].im = i0;
yading@10 61 o[n8+i ].re = r1;
yading@10 62 o[n8+i ].im = i1;
yading@10 63 }
yading@10 64 }