annotate libfaad2/mdct.c @ 13150:a7542243d695

some more segfault fixes
author faust3
date Thu, 26 Aug 2004 10:34:20 +0000
parents d81145997036
children 6d50ef45a058
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
1 /*
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
4 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
5 ** This program is free software; you can redistribute it and/or modify
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
6 ** it under the terms of the GNU General Public License as published by
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
7 ** the Free Software Foundation; either version 2 of the License, or
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
8 ** (at your option) any later version.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
9 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
10 ** This program is distributed in the hope that it will be useful,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
13 ** GNU General Public License for more details.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
14 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
15 ** You should have received a copy of the GNU General Public License
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
16 ** along with this program; if not, write to the Free Software
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
18 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
19 ** Any non-GPL usage of this software or parts of this software is strictly
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
20 ** forbidden.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
21 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
22 ** Commercial non-GPL licensing of this software is possible.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
24 **
12625
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
25 ** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
26 ** $Id: mdct.c,v 1.3 2004/06/02 22:59:03 diego Exp $
d81145997036 More information about modifications to comply more closely with GPL 2a.
diego
parents: 12527
diff changeset
27 ** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
28 **/
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30 /*
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31 * Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32 * and consists of three steps: pre-(I)FFT complex multiplication, complex
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
33 * (I)FFT, post-(I)FFT complex multiplication,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 * As described in:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
36 * P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37 * Implementation of Filter Banks Based on 'Time Domain Aliasing
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38 * Cancellation’," IEEE Proc. on ICASSP‘91, 1991, pp. 2209-2212.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
39 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
40 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
41 * As of April 6th 2002 completely rewritten.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
42 * This (I)MDCT can now be used for any data size n, where n is divisible by 8.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
43 *
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
44 */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
45
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
46 #include "common.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
47 #include "structs.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
48
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
49 #include <stdlib.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
50 #ifdef _WIN32_WCE
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
51 #define assert(x)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
52 #else
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
53 #include <assert.h>
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
54 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
55
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
56 #include "cfft.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
57 #include "mdct.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
58
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
59 /* const_tab[]:
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
60 0: sqrt(2 / N)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
61 1: cos(2 * PI / N)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62 2: sin(2 * PI / N)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 3: cos(2 * PI * (1/8) / N)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
64 4: sin(2 * PI * (1/8) / N)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
65 */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
66 #ifdef FIXED_POINT
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
67 real_t const_tab[][5] =
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
68 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
69 { /* 2048 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
70 COEF_CONST(1),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
71 FRAC_CONST(0.99999529380957619),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
72 FRAC_CONST(0.0030679567629659761),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
73 FRAC_CONST(0.99999992646571789),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
74 FRAC_CONST(0.00038349518757139556)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
75 }, { /* 1920 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
76 COEF_CONST(/* sqrt(1024/960) */ 1.0327955589886444),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
77 FRAC_CONST(0.99999464540169647),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
78 FRAC_CONST(0.0032724865065266251),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
79 FRAC_CONST(0.99999991633432805),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
80 FRAC_CONST(0.00040906153202803459)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
81 }, { /* 1024 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
82 COEF_CONST(1),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
83 FRAC_CONST(0.99998117528260111),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
84 FRAC_CONST(0.0061358846491544753),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
85 FRAC_CONST(0.99999970586288223),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
86 FRAC_CONST(0.00076699031874270449)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
87 }, { /* 960 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
88 COEF_CONST(/* sqrt(512/480) */ 1.0327955589886444),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
89 FRAC_CONST(0.99997858166412923),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
90 FRAC_CONST(0.0065449379673518581),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
91 FRAC_CONST(0.99999966533732598),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
92 FRAC_CONST(0.00081812299560725323)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
93 }, { /* 256 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
94 COEF_CONST(1),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
95 FRAC_CONST(0.99969881869620425),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
96 FRAC_CONST(0.024541228522912288),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
97 FRAC_CONST(0.99999529380957619),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
98 FRAC_CONST(0.0030679567629659761)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
99 }, { /* 240 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
100 COEF_CONST(/* sqrt(256/240) */ 1.0327955589886444),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
101 FRAC_CONST(0.99965732497555726),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
102 FRAC_CONST(0.026176948307873149),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
103 FRAC_CONST(0.99999464540169647),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
104 FRAC_CONST(0.0032724865065266251)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
105 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
106 #ifdef SSR_DEC
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
107 ,{ /* 512 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
108 COEF_CONST(1),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
109 FRAC_CONST(0.9999247018391445),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
110 FRAC_CONST(0.012271538285719925),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
111 FRAC_CONST(0.99999882345170188),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
112 FRAC_CONST(0.0015339801862847655)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
113 }, { /* 64 */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
114 COEF_CONST(1),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
115 FRAC_CONST(0.99518472667219693),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
116 FRAC_CONST(0.098017140329560604),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
117 FRAC_CONST(0.9999247018391445),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
118 FRAC_CONST(0.012271538285719925)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
119 }
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
122 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
123
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
124 #ifdef FIXED_POINT
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
125 static uint8_t map_N_to_idx(uint16_t N)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
126 {
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
127 /* gives an index into const_tab above */
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
128 /* for normal AAC deocding (eg. no scalable profile) only */
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
129 /* index 0 and 4 will be used */
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
130 switch(N)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
131 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
132 case 2048: return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 case 1920: return 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134 case 1024: return 2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 case 960: return 3;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136 case 256: return 4;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
137 case 240: return 5;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
138 #ifdef SSR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
139 case 512: return 6;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
140 case 64: return 7;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
141 #endif
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
142 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
143 return 0;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
145 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
146
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
147 mdct_info *faad_mdct_init(uint16_t N)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
148 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
149 uint16_t k;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
150 #ifdef FIXED_POINT
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
151 uint16_t N_idx;
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
152 real_t cangle, sangle, c, s, cold;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
153 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
154 real_t scale;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
155
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
156 mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info));
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
157
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
158 assert(N % 8 == 0);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160 mdct->N = N;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
161 mdct->sincos = (complex_t*)faad_malloc(N/4*sizeof(complex_t));
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
163 #ifdef FIXED_POINT
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
164 N_idx = map_N_to_idx(N);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
165
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
166 scale = const_tab[N_idx][0];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167 cangle = const_tab[N_idx][1];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
168 sangle = const_tab[N_idx][2];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
169 c = const_tab[N_idx][3];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170 s = const_tab[N_idx][4];
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
171 #else
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
172 scale = (real_t)sqrt(2.0 / (real_t)N);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
173 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
175 /* (co)sine table build using recurrence relations */
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
176 /* this can also be done using static table lookup or */
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
177 /* some form of interpolation */
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178 for (k = 0; k < N/4; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
180 #ifdef FIXED_POINT
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
181 RE(mdct->sincos[k]) = c; //MUL_C_C(c,scale);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
182 IM(mdct->sincos[k]) = s; //MUL_C_C(s,scale);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
184 cold = c;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
185 c = MUL_F(c,cangle) - MUL_F(s,sangle);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
186 s = MUL_F(s,cangle) + MUL_F(cold,sangle);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
187 #else
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
188 /* no recurrence, just sines */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
189 RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
190 IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N));
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
191 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
193
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 /* initialise fft */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 mdct->cfft = cffti(N/4);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
197 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
198 mdct->cycles = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
199 mdct->fft_cycles = 0;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
200 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
201
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 return mdct;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 void faad_mdct_end(mdct_info *mdct)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207 if (mdct != NULL)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
209 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
210 printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
211 printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
212 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
213
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 cfftu(mdct->cfft);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
216 if (mdct->sincos) faad_free(mdct->sincos);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
218 faad_free(mdct);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
221
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
222 void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
223 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
224 uint16_t k;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
225
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
226 complex_t x;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
227 ALIGN complex_t Z1[512];
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
228 complex_t *sincos = mdct->sincos;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
229
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
230 uint16_t N = mdct->N;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
231 uint16_t N2 = N >> 1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
232 uint16_t N4 = N >> 2;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
233 uint16_t N8 = N >> 3;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
234
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
235 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
236 int64_t count1, count2 = faad_get_ts();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
237 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
238
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
239 /* pre-IFFT complex multiplication */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
240 for (k = 0; k < N4; k++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
241 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
242 ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
243 X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
244 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
245
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
246 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
247 count1 = faad_get_ts();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
248 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
249
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
250 /* complex IFFT, any non-scaling FFT can be used here */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
251 cfftb(mdct->cfft, Z1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
252
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
253 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
254 count1 = faad_get_ts() - count1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
255 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
256
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
257 /* post-IFFT complex multiplication */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
258 for (k = 0; k < N4; k++)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
259 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
260 RE(x) = RE(Z1[k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
261 IM(x) = IM(Z1[k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
262 ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
263 IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
264 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
265
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
266 /* reordering */
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
267 for (k = 0; k < N8; k+=2)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
268 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
269 X_out[ 2*k] = IM(Z1[N8 + k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
270 X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
271
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
272 X_out[ 1 + 2*k] = -RE(Z1[N8 - 1 - k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
273 X_out[ 3 + 2*k] = -RE(Z1[N8 - 2 - k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
274
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
275 X_out[N4 + 2*k] = RE(Z1[ k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
276 X_out[N4 + + 2 + 2*k] = RE(Z1[ 1 + k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
277
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
278 X_out[N4 + 1 + 2*k] = -IM(Z1[N4 - 1 - k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
279 X_out[N4 + 3 + 2*k] = -IM(Z1[N4 - 2 - k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
280
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
281 X_out[N2 + 2*k] = RE(Z1[N8 + k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
282 X_out[N2 + + 2 + 2*k] = RE(Z1[N8 + 1 + k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
283
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
284 X_out[N2 + 1 + 2*k] = -IM(Z1[N8 - 1 - k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
285 X_out[N2 + 3 + 2*k] = -IM(Z1[N8 - 2 - k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
286
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
287 X_out[N2 + N4 + 2*k] = -IM(Z1[ k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
288 X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[ 1 + k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
289
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
290 X_out[N2 + N4 + 1 + 2*k] = RE(Z1[N4 - 1 - k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
291 X_out[N2 + N4 + 3 + 2*k] = RE(Z1[N4 - 2 - k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
292 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
293
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
294 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
295 count2 = faad_get_ts() - count2;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
296 mdct->fft_cycles += count1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
297 mdct->cycles += (count2 - count1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
298 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
299 }
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
300
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
301 #ifdef USE_SSE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
302 void faad_imdct_sse(mdct_info *mdct, real_t *X_in, real_t *X_out)
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
303 {
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
304 uint16_t k;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
305
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
306 ALIGN complex_t Z1[512];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
307 complex_t *sincos = mdct->sincos;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
308
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
309 uint16_t N = mdct->N;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
310 uint16_t N2 = N >> 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
311 uint16_t N4 = N >> 2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
312 uint16_t N8 = N >> 3;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
313
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
314 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
315 int64_t count1, count2 = faad_get_ts();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
316 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
317
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
318 /* pre-IFFT complex multiplication */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
319 for (k = 0; k < N4; k+=4)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
320 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
321 __m128 m12, m13, m14, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
322 __m128 n12, n13, n14, n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
323 n12 = _mm_load_ps(&X_in[N2 - 2*k - 8]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
324 m12 = _mm_load_ps(&X_in[N2 - 2*k - 4]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
325 m13 = _mm_load_ps(&X_in[2*k]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
326 n13 = _mm_load_ps(&X_in[2*k + 4]);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
327 m1 = _mm_load_ps(&RE(sincos[k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
328 n1 = _mm_load_ps(&RE(sincos[k+2]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
329
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
330 m0 = _mm_shuffle_ps(m12, m13, _MM_SHUFFLE(2,0,1,3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
331 m2 = _mm_shuffle_ps(m1, m1, _MM_SHUFFLE(2,3,0,1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
332 m14 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(3,1,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
333 n0 = _mm_shuffle_ps(n12, n13, _MM_SHUFFLE(2,0,1,3));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
334 n2 = _mm_shuffle_ps(n1, n1, _MM_SHUFFLE(2,3,0,1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
335 n14 = _mm_shuffle_ps(n0, n0, _MM_SHUFFLE(3,1,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
336
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
337 m3 = _mm_mul_ps(m14, m1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
338 n3 = _mm_mul_ps(n14, n1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
339 m4 = _mm_mul_ps(m14, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
340 n4 = _mm_mul_ps(n14, n2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
341
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
342 m5 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(2,0,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
343 n5 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(2,0,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
344 m6 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(3,1,3,1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
345 n6 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(3,1,3,1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
346
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
347 m7 = _mm_add_ps(m5, m6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
348 n7 = _mm_add_ps(n5, n6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
349 m8 = _mm_sub_ps(m5, m6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
350 n8 = _mm_sub_ps(n5, n6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
351
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
352 m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(3,2,3,2));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
353 n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(3,2,3,2));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
354 m10 = _mm_shuffle_ps(m8, m8, _MM_SHUFFLE(1,0,1,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
355 n10 = _mm_shuffle_ps(n8, n8, _MM_SHUFFLE(1,0,1,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
356
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
357 m11 = _mm_unpacklo_ps(m10, m9);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
358 n11 = _mm_unpacklo_ps(n10, n9);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
359
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
360 _mm_store_ps(&RE(Z1[k]), m11);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
361 _mm_store_ps(&RE(Z1[k+2]), n11);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
362 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
363
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
364 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
365 count1 = faad_get_ts();
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
366 #endif
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
367
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
368 /* complex IFFT, any non-scaling FFT can be used here */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
369 cfftb_sse(mdct->cfft, Z1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
370
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
371 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
372 count1 = faad_get_ts() - count1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
373 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
374
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
375 /* post-IFFT complex multiplication */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
376 for (k = 0; k < N4; k+=4)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
377 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
378 __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
379 __m128 n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
380 m0 = _mm_load_ps(&RE(Z1[k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
381 n0 = _mm_load_ps(&RE(Z1[k+2]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
382 m1 = _mm_load_ps(&RE(sincos[k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
383 n1 = _mm_load_ps(&RE(sincos[k+2]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
384
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
385 m2 = _mm_shuffle_ps(m1, m1, _MM_SHUFFLE(2,3,0,1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
386 n2 = _mm_shuffle_ps(n1, n1, _MM_SHUFFLE(2,3,0,1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
387
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
388 m3 = _mm_mul_ps(m0, m1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
389 n3 = _mm_mul_ps(n0, n1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
390 m4 = _mm_mul_ps(m0, m2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
391 n4 = _mm_mul_ps(n0, n2);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
392
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
393 m5 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(2,0,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
394 n5 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(2,0,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
395 m6 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(3,1,3,1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
396 n6 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(3,1,3,1));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
397
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
398 m7 = _mm_add_ps(m5, m6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
399 n7 = _mm_add_ps(n5, n6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
400 m8 = _mm_sub_ps(m5, m6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
401 n8 = _mm_sub_ps(n5, n6);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
402
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
403 m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(3,2,3,2));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
404 n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(3,2,3,2));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
405 m10 = _mm_shuffle_ps(m8, m8, _MM_SHUFFLE(1,0,1,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
406 n10 = _mm_shuffle_ps(n8, n8, _MM_SHUFFLE(1,0,1,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
407
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
408 m11 = _mm_unpacklo_ps(m10, m9);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
409 n11 = _mm_unpacklo_ps(n10, n9);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
410
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
411 _mm_store_ps(&RE(Z1[k]), m11);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
412 _mm_store_ps(&RE(Z1[k+2]), n11);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
413 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
414
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
415 /* reordering */
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
416 for (k = 0; k < N8; k+=2)
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
417 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
418 __m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m13;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
419 __m128 n4, n5, n6, n7, n8, n9;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
420 __m128 neg1 = _mm_set_ps(-1.0, 1.0, -1.0, 1.0);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
421 __m128 neg2 = _mm_set_ps(-1.0, -1.0, -1.0, -1.0);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
422
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
423 m0 = _mm_load_ps(&RE(Z1[k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
424 m1 = _mm_load_ps(&RE(Z1[N8 - 2 - k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
425 m2 = _mm_load_ps(&RE(Z1[N8 + k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
426 m3 = _mm_load_ps(&RE(Z1[N4 - 2 - k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
427
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
428 m10 = _mm_mul_ps(m0, neg1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
429 m11 = _mm_mul_ps(m1, neg2);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
430 m13 = _mm_mul_ps(m3, neg1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
431
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
432 m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(3,1,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
433 n4 = _mm_shuffle_ps(m10, m10, _MM_SHUFFLE(3,1,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
434 m4 = _mm_shuffle_ps(m11, m11, _MM_SHUFFLE(3,1,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
435 n5 = _mm_shuffle_ps(m13, m13, _MM_SHUFFLE(3,1,2,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
436
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
437 m6 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(3,2,1,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
438 n6 = _mm_shuffle_ps(n4, n5, _MM_SHUFFLE(3,2,1,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
439 m7 = _mm_shuffle_ps(m5, m4, _MM_SHUFFLE(3,2,1,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
440 n7 = _mm_shuffle_ps(n5, n4, _MM_SHUFFLE(3,2,1,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
441
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
442 m8 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0,3,1,2));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
443 n8 = _mm_shuffle_ps(n6, n6, _MM_SHUFFLE(2,1,3,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
444 m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(2,1,3,0));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
445 n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(0,3,1,2));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
446
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
447 _mm_store_ps(&X_out[2*k], m8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
448 _mm_store_ps(&X_out[N4 + 2*k], n8);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
449 _mm_store_ps(&X_out[N2 + 2*k], m9);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
450 _mm_store_ps(&X_out[N2 + N4 + 2*k], n9);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
451 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
452
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
453 #ifdef PROFILE
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
454 count2 = faad_get_ts() - count2;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
455 mdct->fft_cycles += count1;
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
456 mdct->cycles += (count2 - count1);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
457 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
458 }
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
459 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
460
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
461 #ifdef LTP_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
462 void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
463 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
464 uint16_t k;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
465
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
466 complex_t x;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
467 ALIGN complex_t Z1[512];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
468 complex_t *sincos = mdct->sincos;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
469
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
470 uint16_t N = mdct->N;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
471 uint16_t N2 = N >> 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
472 uint16_t N4 = N >> 2;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
473 uint16_t N8 = N >> 3;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
474
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
475 #ifndef FIXED_POINT
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
476 real_t scale = REAL_CONST(N);
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
477 #else
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
478 real_t scale = REAL_CONST(4.0/N);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
479 #endif
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
480
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
481 /* pre-FFT complex multiplication */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
482 for (k = 0; k < N8; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
483 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
484 uint16_t n = k << 1;
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
485 RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
486 IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
487
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
488 ComplexMult(&RE(Z1[k]), &IM(Z1[k]),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
489 RE(x), IM(x), RE(sincos[k]), IM(sincos[k]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
490
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
491 RE(Z1[k]) = MUL_R(RE(Z1[k]), scale);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
492 IM(Z1[k]) = MUL_R(IM(Z1[k]), scale);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
493
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
494 RE(x) = X_in[N2 - 1 - n] - X_in[ n];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
495 IM(x) = X_in[N2 + n] + X_in[N - 1 - n];
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
496
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
497 ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
498 RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8]));
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
499
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
500 RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
501 IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
502 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
503
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
504 /* complex FFT, any non-scaling FFT can be used here */
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
505 cfftf(mdct->cfft, Z1);
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
506
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
507 /* post-FFT complex multiplication */
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
508 for (k = 0; k < N4; k++)
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
509 {
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
510 uint16_t n = k << 1;
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
511 ComplexMult(&RE(x), &IM(x),
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
512 RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k]));
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
513
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
514 X_out[ n] = -RE(x);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
515 X_out[N2 - 1 - n] = IM(x);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
516 X_out[N2 + n] = -IM(x);
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
517 X_out[N - 1 - n] = RE(x);
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
518 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
519 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
520 #endif