Libav 0.7.1
|
00001 /* 00002 * This file is part of Libav. 00003 * 00004 * Libav is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * Libav is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with Libav; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 */ 00018 00019 #define CONFIG_FFT_FLOAT 0 00020 #include "mdct.c" 00021 00022 /* same as ff_mdct_calcw_c with double-width unscaled output */ 00023 void ff_mdct_calcw_c(FFTContext *s, FFTDouble *out, const FFTSample *input) 00024 { 00025 int i, j, n, n8, n4, n2, n3; 00026 FFTDouble re, im; 00027 const uint16_t *revtab = s->revtab; 00028 const FFTSample *tcos = s->tcos; 00029 const FFTSample *tsin = s->tsin; 00030 FFTComplex *x = s->tmp_buf; 00031 FFTDComplex *o = (FFTDComplex *)out; 00032 00033 n = 1 << s->mdct_bits; 00034 n2 = n >> 1; 00035 n4 = n >> 2; 00036 n8 = n >> 3; 00037 n3 = 3 * n4; 00038 00039 /* pre rotation */ 00040 for(i=0;i<n8;i++) { 00041 re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]); 00042 im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]); 00043 j = revtab[i]; 00044 CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]); 00045 00046 re = RSCALE( input[2*i] - input[n2-1-2*i]); 00047 im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]); 00048 j = revtab[n8 + i]; 00049 CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]); 00050 } 00051 00052 s->fft_calc(s, x); 00053 00054 /* post rotation */ 00055 for(i=0;i<n8;i++) { 00056 FFTDouble r0, i0, r1, i1; 00057 CMULL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]); 00058 CMULL(i0, r1, x[n8+i ].re, x[n8+i ].im, -tsin[n8+i ], -tcos[n8+i ]); 00059 o[n8-i-1].re = r0; 00060 o[n8-i-1].im = i0; 00061 o[n8+i ].re = r1; 00062 o[n8+i ].im = i1; 00063 } 00064 }