Mercurial > mplayer.hg
annotate liba52/imdct.c @ 18351:a58f92914b71
fixes suggested by Reimar
author | gpoirier |
---|---|
date | Sun, 30 Apr 2006 07:24:40 +0000 |
parents | 7b408d60de9e |
children | 4bad7f00556e |
rev | line source |
---|---|
3394 | 1 /* |
2 * imdct.c | |
3 * Copyright (C) 2000-2001 Michel Lespinasse <walken@zoy.org> | |
4 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> | |
5 * | |
6 * This file is part of a52dec, a free ATSC A-52 stream decoder. | |
7 * See http://liba52.sourceforge.net/ for updates. | |
8 * | |
14991
07f1e7669772
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
12303
diff
changeset
|
9 * Modified for use with MPlayer, changes contained in liba52_changes.diff. |
07f1e7669772
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
12303
diff
changeset
|
10 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
07f1e7669772
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
12303
diff
changeset
|
11 * $Id$ |
07f1e7669772
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
12303
diff
changeset
|
12 * |
3394 | 13 * a52dec is free software; you can redistribute it and/or modify |
14 * it under the terms of the GNU General Public License as published by | |
15 * the Free Software Foundation; either version 2 of the License, or | |
16 * (at your option) any later version. | |
17 * | |
18 * a52dec is distributed in the hope that it will be useful, | |
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 * GNU General Public License for more details. | |
22 * | |
23 * You should have received a copy of the GNU General Public License | |
24 * along with this program; if not, write to the Free Software | |
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
3579 | 26 * |
27 * SSE optimizations from Michael Niedermayer (michaelni@gmx.at) | |
3884 | 28 * 3DNOW optimizations from Nick Kurshev <nickols_k@mail.ru> |
29 * michael did port them from libac3 (untested, perhaps totally broken) | |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
30 * AltiVec optimizations from Romain Dolbeau (romain@dolbeau.org) |
3394 | 31 */ |
32 | |
33 #include "config.h" | |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
34 #include "asmalign.h" |
3394 | 35 |
36 #include <math.h> | |
37 #include <stdio.h> | |
38 #ifndef M_PI | |
39 #define M_PI 3.1415926535897932384626433832795029 | |
40 #endif | |
41 #include <inttypes.h> | |
42 | |
43 #include "a52.h" | |
44 #include "a52_internal.h" | |
45 #include "mm_accel.h" | |
4247
2dbd637ffe05
mangle for win32 in liba52 (includes dummy mangle.h pointing to the one in main)
atmos4
parents:
3908
diff
changeset
|
46 #include "mangle.h" |
3394 | 47 |
3884 | 48 #ifdef RUNTIME_CPUDETECT |
49 #undef HAVE_3DNOWEX | |
50 #endif | |
51 | |
52 #define USE_AC3_C | |
53 | |
3394 | 54 void (* imdct_256) (sample_t data[], sample_t delay[], sample_t bias); |
55 void (* imdct_512) (sample_t data[], sample_t delay[], sample_t bias); | |
56 | |
57 typedef struct complex_s { | |
58 sample_t real; | |
59 sample_t imag; | |
60 } complex_t; | |
61 | |
3884 | 62 static void fft_128p(complex_t *a); |
63 | |
12303
f881c918739b
attribute_used patch by (VMiklos <mamajom at axelero dot hu>)
michael
parents:
9122
diff
changeset
|
64 static const int pm128[128] attribute_used __attribute__((aligned(16))) = |
3884 | 65 { |
66 0, 16, 32, 48, 64, 80, 96, 112, 8, 40, 72, 104, 24, 56, 88, 120, | |
67 4, 20, 36, 52, 68, 84, 100, 116, 12, 28, 44, 60, 76, 92, 108, 124, | |
68 2, 18, 34, 50, 66, 82, 98, 114, 10, 42, 74, 106, 26, 58, 90, 122, | |
69 6, 22, 38, 54, 70, 86, 102, 118, 14, 46, 78, 110, 30, 62, 94, 126, | |
70 1, 17, 33, 49, 65, 81, 97, 113, 9, 41, 73, 105, 25, 57, 89, 121, | |
71 5, 21, 37, 53, 69, 85, 101, 117, 13, 29, 45, 61, 77, 93, 109, 125, | |
72 3, 19, 35, 51, 67, 83, 99, 115, 11, 43, 75, 107, 27, 59, 91, 123, | |
73 7, 23, 39, 55, 71, 87, 103, 119, 15, 31, 47, 63, 79, 95, 111, 127 | |
74 }; | |
3394 | 75 |
76 /* 128 point bit-reverse LUT */ | |
12303
f881c918739b
attribute_used patch by (VMiklos <mamajom at axelero dot hu>)
michael
parents:
9122
diff
changeset
|
77 static uint8_t attribute_used bit_reverse_512[] = { |
3394 | 78 0x00, 0x40, 0x20, 0x60, 0x10, 0x50, 0x30, 0x70, |
79 0x08, 0x48, 0x28, 0x68, 0x18, 0x58, 0x38, 0x78, | |
80 0x04, 0x44, 0x24, 0x64, 0x14, 0x54, 0x34, 0x74, | |
81 0x0c, 0x4c, 0x2c, 0x6c, 0x1c, 0x5c, 0x3c, 0x7c, | |
82 0x02, 0x42, 0x22, 0x62, 0x12, 0x52, 0x32, 0x72, | |
83 0x0a, 0x4a, 0x2a, 0x6a, 0x1a, 0x5a, 0x3a, 0x7a, | |
84 0x06, 0x46, 0x26, 0x66, 0x16, 0x56, 0x36, 0x76, | |
85 0x0e, 0x4e, 0x2e, 0x6e, 0x1e, 0x5e, 0x3e, 0x7e, | |
86 0x01, 0x41, 0x21, 0x61, 0x11, 0x51, 0x31, 0x71, | |
87 0x09, 0x49, 0x29, 0x69, 0x19, 0x59, 0x39, 0x79, | |
88 0x05, 0x45, 0x25, 0x65, 0x15, 0x55, 0x35, 0x75, | |
89 0x0d, 0x4d, 0x2d, 0x6d, 0x1d, 0x5d, 0x3d, 0x7d, | |
90 0x03, 0x43, 0x23, 0x63, 0x13, 0x53, 0x33, 0x73, | |
91 0x0b, 0x4b, 0x2b, 0x6b, 0x1b, 0x5b, 0x3b, 0x7b, | |
92 0x07, 0x47, 0x27, 0x67, 0x17, 0x57, 0x37, 0x77, | |
93 0x0f, 0x4f, 0x2f, 0x6f, 0x1f, 0x5f, 0x3f, 0x7f}; | |
94 | |
95 static uint8_t bit_reverse_256[] = { | |
96 0x00, 0x20, 0x10, 0x30, 0x08, 0x28, 0x18, 0x38, | |
97 0x04, 0x24, 0x14, 0x34, 0x0c, 0x2c, 0x1c, 0x3c, | |
98 0x02, 0x22, 0x12, 0x32, 0x0a, 0x2a, 0x1a, 0x3a, | |
99 0x06, 0x26, 0x16, 0x36, 0x0e, 0x2e, 0x1e, 0x3e, | |
100 0x01, 0x21, 0x11, 0x31, 0x09, 0x29, 0x19, 0x39, | |
101 0x05, 0x25, 0x15, 0x35, 0x0d, 0x2d, 0x1d, 0x3d, | |
102 0x03, 0x23, 0x13, 0x33, 0x0b, 0x2b, 0x1b, 0x3b, | |
103 0x07, 0x27, 0x17, 0x37, 0x0f, 0x2f, 0x1f, 0x3f}; | |
104 | |
16173 | 105 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
3508 | 106 // NOTE: SSE needs 16byte alignment or it will segfault |
3581 | 107 // |
3508 | 108 static complex_t __attribute__((aligned(16))) buf[128]; |
3581 | 109 static float __attribute__((aligned(16))) sseSinCos1c[256]; |
110 static float __attribute__((aligned(16))) sseSinCos1d[256]; | |
12303
f881c918739b
attribute_used patch by (VMiklos <mamajom at axelero dot hu>)
michael
parents:
9122
diff
changeset
|
111 static float attribute_used __attribute__((aligned(16))) ps111_1[4]={1,1,1,-1}; |
3534 | 112 //static float __attribute__((aligned(16))) sseW0[4]; |
113 static float __attribute__((aligned(16))) sseW1[8]; | |
114 static float __attribute__((aligned(16))) sseW2[16]; | |
115 static float __attribute__((aligned(16))) sseW3[32]; | |
116 static float __attribute__((aligned(16))) sseW4[64]; | |
117 static float __attribute__((aligned(16))) sseW5[128]; | |
118 static float __attribute__((aligned(16))) sseW6[256]; | |
119 static float __attribute__((aligned(16))) *sseW[7]= | |
120 {NULL /*sseW0*/,sseW1,sseW2,sseW3,sseW4,sseW5,sseW6}; | |
3553 | 121 static float __attribute__((aligned(16))) sseWindow[512]; |
3508 | 122 #else |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
123 static complex_t __attribute__((aligned(16))) buf[128]; |
3508 | 124 #endif |
3394 | 125 |
126 /* Twiddle factor LUT */ | |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
127 static complex_t __attribute__((aligned(16))) w_1[1]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
128 static complex_t __attribute__((aligned(16))) w_2[2]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
129 static complex_t __attribute__((aligned(16))) w_4[4]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
130 static complex_t __attribute__((aligned(16))) w_8[8]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
131 static complex_t __attribute__((aligned(16))) w_16[16]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
132 static complex_t __attribute__((aligned(16))) w_32[32]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
133 static complex_t __attribute__((aligned(16))) w_64[64]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
134 static complex_t __attribute__((aligned(16))) * w[7] = {w_1, w_2, w_4, w_8, w_16, w_32, w_64}; |
3394 | 135 |
136 /* Twiddle factors for IMDCT */ | |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
137 static sample_t __attribute__((aligned(16))) xcos1[128]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
138 static sample_t __attribute__((aligned(16))) xsin1[128]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
139 static sample_t __attribute__((aligned(16))) xcos2[64]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
140 static sample_t __attribute__((aligned(16))) xsin2[64]; |
3394 | 141 |
142 /* Windowing function for Modified DCT - Thank you acroread */ | |
143 sample_t imdct_window[] = { | |
144 0.00014, 0.00024, 0.00037, 0.00051, 0.00067, 0.00086, 0.00107, 0.00130, | |
145 0.00157, 0.00187, 0.00220, 0.00256, 0.00297, 0.00341, 0.00390, 0.00443, | |
146 0.00501, 0.00564, 0.00632, 0.00706, 0.00785, 0.00871, 0.00962, 0.01061, | |
147 0.01166, 0.01279, 0.01399, 0.01526, 0.01662, 0.01806, 0.01959, 0.02121, | |
148 0.02292, 0.02472, 0.02662, 0.02863, 0.03073, 0.03294, 0.03527, 0.03770, | |
149 0.04025, 0.04292, 0.04571, 0.04862, 0.05165, 0.05481, 0.05810, 0.06153, | |
150 0.06508, 0.06878, 0.07261, 0.07658, 0.08069, 0.08495, 0.08935, 0.09389, | |
151 0.09859, 0.10343, 0.10842, 0.11356, 0.11885, 0.12429, 0.12988, 0.13563, | |
152 0.14152, 0.14757, 0.15376, 0.16011, 0.16661, 0.17325, 0.18005, 0.18699, | |
153 0.19407, 0.20130, 0.20867, 0.21618, 0.22382, 0.23161, 0.23952, 0.24757, | |
154 0.25574, 0.26404, 0.27246, 0.28100, 0.28965, 0.29841, 0.30729, 0.31626, | |
155 0.32533, 0.33450, 0.34376, 0.35311, 0.36253, 0.37204, 0.38161, 0.39126, | |
156 0.40096, 0.41072, 0.42054, 0.43040, 0.44030, 0.45023, 0.46020, 0.47019, | |
157 0.48020, 0.49022, 0.50025, 0.51028, 0.52031, 0.53033, 0.54033, 0.55031, | |
158 0.56026, 0.57019, 0.58007, 0.58991, 0.59970, 0.60944, 0.61912, 0.62873, | |
159 0.63827, 0.64774, 0.65713, 0.66643, 0.67564, 0.68476, 0.69377, 0.70269, | |
160 0.71150, 0.72019, 0.72877, 0.73723, 0.74557, 0.75378, 0.76186, 0.76981, | |
161 0.77762, 0.78530, 0.79283, 0.80022, 0.80747, 0.81457, 0.82151, 0.82831, | |
162 0.83496, 0.84145, 0.84779, 0.85398, 0.86001, 0.86588, 0.87160, 0.87716, | |
163 0.88257, 0.88782, 0.89291, 0.89785, 0.90264, 0.90728, 0.91176, 0.91610, | |
164 0.92028, 0.92432, 0.92822, 0.93197, 0.93558, 0.93906, 0.94240, 0.94560, | |
165 0.94867, 0.95162, 0.95444, 0.95713, 0.95971, 0.96217, 0.96451, 0.96674, | |
166 0.96887, 0.97089, 0.97281, 0.97463, 0.97635, 0.97799, 0.97953, 0.98099, | |
167 0.98236, 0.98366, 0.98488, 0.98602, 0.98710, 0.98811, 0.98905, 0.98994, | |
168 0.99076, 0.99153, 0.99225, 0.99291, 0.99353, 0.99411, 0.99464, 0.99513, | |
169 0.99558, 0.99600, 0.99639, 0.99674, 0.99706, 0.99736, 0.99763, 0.99788, | |
170 0.99811, 0.99831, 0.99850, 0.99867, 0.99882, 0.99895, 0.99908, 0.99919, | |
171 0.99929, 0.99938, 0.99946, 0.99953, 0.99959, 0.99965, 0.99969, 0.99974, | |
172 0.99978, 0.99981, 0.99984, 0.99986, 0.99988, 0.99990, 0.99992, 0.99993, | |
173 0.99994, 0.99995, 0.99996, 0.99997, 0.99998, 0.99998, 0.99998, 0.99999, | |
174 0.99999, 0.99999, 0.99999, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, | |
175 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000 }; | |
176 | |
177 | |
178 static inline void swap_cmplx(complex_t *a, complex_t *b) | |
179 { | |
180 complex_t tmp; | |
181 | |
182 tmp = *a; | |
183 *a = *b; | |
184 *b = tmp; | |
185 } | |
186 | |
187 | |
188 | |
189 static inline complex_t cmplx_mult(complex_t a, complex_t b) | |
190 { | |
191 complex_t ret; | |
192 | |
193 ret.real = a.real * b.real - a.imag * b.imag; | |
194 ret.imag = a.real * b.imag + a.imag * b.real; | |
195 | |
196 return ret; | |
197 } | |
198 | |
199 void | |
200 imdct_do_512(sample_t data[],sample_t delay[], sample_t bias) | |
201 { | |
8254
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
202 int i; |
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
203 #ifndef USE_AC3_C |
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
204 int k; |
3394 | 205 int p,q; |
206 int m; | |
207 int two_m; | |
208 int two_m_plus_one; | |
209 | |
8254
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
210 sample_t tmp_b_i; |
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
211 sample_t tmp_b_r; |
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
212 #endif |
3394 | 213 sample_t tmp_a_i; |
214 sample_t tmp_a_r; | |
215 | |
216 sample_t *data_ptr; | |
217 sample_t *delay_ptr; | |
218 sample_t *window_ptr; | |
219 | |
220 /* 512 IMDCT with source and dest data in 'data' */ | |
221 | |
3884 | 222 /* Pre IFFT complex multiply plus IFFT cmplx conjugate & reordering*/ |
3394 | 223 for( i=0; i < 128; i++) { |
224 /* z[i] = (X[256-2*i-1] + j * X[2*i]) * (xcos1[i] + j * xsin1[i]) ; */ | |
3884 | 225 #ifdef USE_AC3_C |
226 int j= pm128[i]; | |
227 #else | |
228 int j= bit_reverse_512[i]; | |
229 #endif | |
230 buf[i].real = (data[256-2*j-1] * xcos1[j]) - (data[2*j] * xsin1[j]); | |
231 buf[i].imag = -1.0 * ((data[2*j] * xcos1[j]) + (data[256-2*j-1] * xsin1[j])); | |
3394 | 232 } |
233 | |
234 /* FFT Merge */ | |
3549 | 235 /* unoptimized variant |
236 for (m=1; m < 7; m++) { | |
237 if(m) | |
238 two_m = (1 << m); | |
239 else | |
240 two_m = 1; | |
241 | |
242 two_m_plus_one = (1 << (m+1)); | |
243 | |
244 for(i = 0; i < 128; i += two_m_plus_one) { | |
245 for(k = 0; k < two_m; k++) { | |
246 p = k + i; | |
247 q = p + two_m; | |
3508 | 248 tmp_a_r = buf[p].real; |
249 tmp_a_i = buf[p].imag; | |
3549 | 250 tmp_b_r = buf[q].real * w[m][k].real - buf[q].imag * w[m][k].imag; |
251 tmp_b_i = buf[q].imag * w[m][k].real + buf[q].real * w[m][k].imag; | |
3508 | 252 buf[p].real = tmp_a_r + tmp_b_r; |
253 buf[p].imag = tmp_a_i + tmp_b_i; | |
254 buf[q].real = tmp_a_r - tmp_b_r; | |
255 buf[q].imag = tmp_a_i - tmp_b_i; | |
3549 | 256 } |
257 } | |
258 } | |
259 */ | |
3884 | 260 #ifdef USE_AC3_C |
261 fft_128p (&buf[0]); | |
262 #else | |
263 | |
3623 | 264 /* 1. iteration */ |
3579 | 265 for(i = 0; i < 128; i += 2) { |
266 tmp_a_r = buf[i].real; | |
267 tmp_a_i = buf[i].imag; | |
268 tmp_b_r = buf[i+1].real; | |
269 tmp_b_i = buf[i+1].imag; | |
270 buf[i].real = tmp_a_r + tmp_b_r; | |
271 buf[i].imag = tmp_a_i + tmp_b_i; | |
272 buf[i+1].real = tmp_a_r - tmp_b_r; | |
273 buf[i+1].imag = tmp_a_i - tmp_b_i; | |
274 } | |
275 | |
3623 | 276 /* 2. iteration */ |
3579 | 277 // Note w[1]={{1,0}, {0,-1}} |
278 for(i = 0; i < 128; i += 4) { | |
279 tmp_a_r = buf[i].real; | |
280 tmp_a_i = buf[i].imag; | |
281 tmp_b_r = buf[i+2].real; | |
282 tmp_b_i = buf[i+2].imag; | |
283 buf[i].real = tmp_a_r + tmp_b_r; | |
284 buf[i].imag = tmp_a_i + tmp_b_i; | |
285 buf[i+2].real = tmp_a_r - tmp_b_r; | |
286 buf[i+2].imag = tmp_a_i - tmp_b_i; | |
287 tmp_a_r = buf[i+1].real; | |
288 tmp_a_i = buf[i+1].imag; | |
289 tmp_b_r = buf[i+3].imag; | |
290 tmp_b_i = buf[i+3].real; | |
291 buf[i+1].real = tmp_a_r + tmp_b_r; | |
292 buf[i+1].imag = tmp_a_i - tmp_b_i; | |
293 buf[i+3].real = tmp_a_r - tmp_b_r; | |
294 buf[i+3].imag = tmp_a_i + tmp_b_i; | |
295 } | |
296 | |
3623 | 297 /* 3. iteration */ |
3579 | 298 for(i = 0; i < 128; i += 8) { |
299 tmp_a_r = buf[i].real; | |
300 tmp_a_i = buf[i].imag; | |
301 tmp_b_r = buf[i+4].real; | |
302 tmp_b_i = buf[i+4].imag; | |
303 buf[i].real = tmp_a_r + tmp_b_r; | |
304 buf[i].imag = tmp_a_i + tmp_b_i; | |
305 buf[i+4].real = tmp_a_r - tmp_b_r; | |
306 buf[i+4].imag = tmp_a_i - tmp_b_i; | |
307 tmp_a_r = buf[1+i].real; | |
308 tmp_a_i = buf[1+i].imag; | |
309 tmp_b_r = (buf[i+5].real + buf[i+5].imag) * w[2][1].real; | |
310 tmp_b_i = (buf[i+5].imag - buf[i+5].real) * w[2][1].real; | |
311 buf[1+i].real = tmp_a_r + tmp_b_r; | |
312 buf[1+i].imag = tmp_a_i + tmp_b_i; | |
313 buf[i+5].real = tmp_a_r - tmp_b_r; | |
314 buf[i+5].imag = tmp_a_i - tmp_b_i; | |
315 tmp_a_r = buf[i+2].real; | |
316 tmp_a_i = buf[i+2].imag; | |
317 tmp_b_r = buf[i+6].imag; | |
318 tmp_b_i = - buf[i+6].real; | |
319 buf[i+2].real = tmp_a_r + tmp_b_r; | |
320 buf[i+2].imag = tmp_a_i + tmp_b_i; | |
321 buf[i+6].real = tmp_a_r - tmp_b_r; | |
322 buf[i+6].imag = tmp_a_i - tmp_b_i; | |
323 tmp_a_r = buf[i+3].real; | |
324 tmp_a_i = buf[i+3].imag; | |
325 tmp_b_r = (buf[i+7].real - buf[i+7].imag) * w[2][3].imag; | |
326 tmp_b_i = (buf[i+7].imag + buf[i+7].real) * w[2][3].imag; | |
327 buf[i+3].real = tmp_a_r + tmp_b_r; | |
328 buf[i+3].imag = tmp_a_i + tmp_b_i; | |
329 buf[i+7].real = tmp_a_r - tmp_b_r; | |
330 buf[i+7].imag = tmp_a_i - tmp_b_i; | |
331 } | |
332 | |
3623 | 333 /* 4-7. iterations */ |
3579 | 334 for (m=3; m < 7; m++) { |
335 two_m = (1 << m); | |
336 | |
337 two_m_plus_one = two_m<<1; | |
338 | |
339 for(i = 0; i < 128; i += two_m_plus_one) { | |
340 for(k = 0; k < two_m; k++) { | |
341 int p = k + i; | |
342 int q = p + two_m; | |
343 tmp_a_r = buf[p].real; | |
344 tmp_a_i = buf[p].imag; | |
345 tmp_b_r = buf[q].real * w[m][k].real - buf[q].imag * w[m][k].imag; | |
346 tmp_b_i = buf[q].imag * w[m][k].real + buf[q].real * w[m][k].imag; | |
347 buf[p].real = tmp_a_r + tmp_b_r; | |
348 buf[p].imag = tmp_a_i + tmp_b_i; | |
349 buf[q].real = tmp_a_r - tmp_b_r; | |
350 buf[q].imag = tmp_a_i - tmp_b_i; | |
351 } | |
352 } | |
353 } | |
3884 | 354 #endif |
3579 | 355 /* Post IFFT complex multiply plus IFFT complex conjugate*/ |
356 for( i=0; i < 128; i++) { | |
357 /* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */ | |
358 tmp_a_r = buf[i].real; | |
359 tmp_a_i = -1.0 * buf[i].imag; | |
360 buf[i].real =(tmp_a_r * xcos1[i]) - (tmp_a_i * xsin1[i]); | |
361 buf[i].imag =(tmp_a_r * xsin1[i]) + (tmp_a_i * xcos1[i]); | |
362 } | |
363 | |
364 data_ptr = data; | |
365 delay_ptr = delay; | |
366 window_ptr = imdct_window; | |
367 | |
368 /* Window and convert to real valued signal */ | |
369 for(i=0; i< 64; i++) { | |
370 *data_ptr++ = -buf[64+i].imag * *window_ptr++ + *delay_ptr++ + bias; | |
371 *data_ptr++ = buf[64-i-1].real * *window_ptr++ + *delay_ptr++ + bias; | |
372 } | |
373 | |
374 for(i=0; i< 64; i++) { | |
375 *data_ptr++ = -buf[i].real * *window_ptr++ + *delay_ptr++ + bias; | |
376 *data_ptr++ = buf[128-i-1].imag * *window_ptr++ + *delay_ptr++ + bias; | |
377 } | |
3884 | 378 |
3579 | 379 /* The trailing edge of the window goes into the delay line */ |
380 delay_ptr = delay; | |
381 | |
382 for(i=0; i< 64; i++) { | |
383 *delay_ptr++ = -buf[64+i].real * *--window_ptr; | |
384 *delay_ptr++ = buf[64-i-1].imag * *--window_ptr; | |
385 } | |
386 | |
387 for(i=0; i<64; i++) { | |
388 *delay_ptr++ = buf[i].imag * *--window_ptr; | |
389 *delay_ptr++ = -buf[128-i-1].real * *--window_ptr; | |
390 } | |
391 } | |
392 | |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
393 #ifdef HAVE_ALTIVEC |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
394 |
9122 | 395 #ifndef SYS_DARWIN |
396 #include <altivec.h> | |
397 #endif | |
398 | |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
399 // used to build registers permutation vectors (vcprm) |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
400 // the 's' are for words in the _s_econd vector |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
401 #define WORD_0 0x00,0x01,0x02,0x03 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
402 #define WORD_1 0x04,0x05,0x06,0x07 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
403 #define WORD_2 0x08,0x09,0x0a,0x0b |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
404 #define WORD_3 0x0c,0x0d,0x0e,0x0f |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
405 #define WORD_s0 0x10,0x11,0x12,0x13 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
406 #define WORD_s1 0x14,0x15,0x16,0x17 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
407 #define WORD_s2 0x18,0x19,0x1a,0x1b |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
408 #define WORD_s3 0x1c,0x1d,0x1e,0x1f |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
409 |
9122 | 410 #ifdef SYS_DARWIN |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
411 #define vcprm(a,b,c,d) (const vector unsigned char)(WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d) |
9122 | 412 #else |
413 #define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d} | |
414 #endif | |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
415 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
416 // vcprmle is used to keep the same index as in the SSE version. |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
417 // it's the same as vcprm, with the index inversed |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
418 // ('le' is Little Endian) |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
419 #define vcprmle(a,b,c,d) vcprm(d,c,b,a) |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
420 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
421 // used to build inverse/identity vectors (vcii) |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
422 // n is _n_egative, p is _p_ositive |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
423 #define FLOAT_n -1. |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
424 #define FLOAT_p 1. |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
425 |
9122 | 426 #ifdef SYS_DARWIN |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
427 #define vcii(a,b,c,d) (const vector float)(FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d) |
9122 | 428 #else |
429 #define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d} | |
430 #endif | |
431 | |
432 #ifdef SYS_DARWIN | |
433 #define FOUROF(a) (a) | |
434 #else | |
435 #define FOUROF(a) {a,a,a,a} | |
436 #endif | |
437 | |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
438 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
439 void |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
440 imdct_do_512_altivec(sample_t data[],sample_t delay[], sample_t bias) |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
441 { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
442 int i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
443 int k; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
444 int p,q; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
445 int m; |
16173 | 446 long two_m; |
447 long two_m_plus_one; | |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
448 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
449 sample_t tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
450 sample_t tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
451 sample_t tmp_a_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
452 sample_t tmp_a_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
453 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
454 sample_t *data_ptr; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
455 sample_t *delay_ptr; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
456 sample_t *window_ptr; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
457 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
458 /* 512 IMDCT with source and dest data in 'data' */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
459 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
460 /* Pre IFFT complex multiply plus IFFT cmplx conjugate & reordering*/ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
461 for( i=0; i < 128; i++) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
462 /* z[i] = (X[256-2*i-1] + j * X[2*i]) * (xcos1[i] + j * xsin1[i]) ; */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
463 int j= bit_reverse_512[i]; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
464 buf[i].real = (data[256-2*j-1] * xcos1[j]) - (data[2*j] * xsin1[j]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
465 buf[i].imag = -1.0 * ((data[2*j] * xcos1[j]) + (data[256-2*j-1] * xsin1[j])); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
466 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
467 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
468 /* 1. iteration */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
469 for(i = 0; i < 128; i += 2) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
470 #if 0 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
471 tmp_a_r = buf[i].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
472 tmp_a_i = buf[i].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
473 tmp_b_r = buf[i+1].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
474 tmp_b_i = buf[i+1].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
475 buf[i].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
476 buf[i].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
477 buf[i+1].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
478 buf[i+1].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
479 #else |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
480 vector float temp, bufv; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
481 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
482 bufv = vec_ld(i << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
483 temp = vec_perm(bufv, bufv, vcprm(2,3,0,1)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
484 bufv = vec_madd(bufv, vcii(p,p,n,n), temp); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
485 vec_st(bufv, i << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
486 #endif |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
487 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
488 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
489 /* 2. iteration */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
490 // Note w[1]={{1,0}, {0,-1}} |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
491 for(i = 0; i < 128; i += 4) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
492 #if 0 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
493 tmp_a_r = buf[i].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
494 tmp_a_i = buf[i].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
495 tmp_b_r = buf[i+2].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
496 tmp_b_i = buf[i+2].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
497 buf[i].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
498 buf[i].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
499 buf[i+2].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
500 buf[i+2].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
501 tmp_a_r = buf[i+1].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
502 tmp_a_i = buf[i+1].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
503 /* WARNING: im <-> re here ! */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
504 tmp_b_r = buf[i+3].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
505 tmp_b_i = buf[i+3].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
506 buf[i+1].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
507 buf[i+1].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
508 buf[i+3].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
509 buf[i+3].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
510 #else |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
511 vector float buf01, buf23, temp1, temp2; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
512 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
513 buf01 = vec_ld((i + 0) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
514 buf23 = vec_ld((i + 2) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
515 buf23 = vec_perm(buf23,buf23,vcprm(0,1,3,2)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
516 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
517 temp1 = vec_madd(buf23, vcii(p,p,p,n), buf01); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
518 temp2 = vec_madd(buf23, vcii(n,n,n,p), buf01); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
519 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
520 vec_st(temp1, (i + 0) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
521 vec_st(temp2, (i + 2) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
522 #endif |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
523 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
524 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
525 /* 3. iteration */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
526 for(i = 0; i < 128; i += 8) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
527 #if 0 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
528 tmp_a_r = buf[i].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
529 tmp_a_i = buf[i].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
530 tmp_b_r = buf[i+4].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
531 tmp_b_i = buf[i+4].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
532 buf[i].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
533 buf[i].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
534 buf[i+4].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
535 buf[i+4].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
536 tmp_a_r = buf[1+i].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
537 tmp_a_i = buf[1+i].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
538 tmp_b_r = (buf[i+5].real + buf[i+5].imag) * w[2][1].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
539 tmp_b_i = (buf[i+5].imag - buf[i+5].real) * w[2][1].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
540 buf[1+i].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
541 buf[1+i].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
542 buf[i+5].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
543 buf[i+5].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
544 tmp_a_r = buf[i+2].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
545 tmp_a_i = buf[i+2].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
546 /* WARNING re <-> im & sign */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
547 tmp_b_r = buf[i+6].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
548 tmp_b_i = - buf[i+6].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
549 buf[i+2].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
550 buf[i+2].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
551 buf[i+6].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
552 buf[i+6].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
553 tmp_a_r = buf[i+3].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
554 tmp_a_i = buf[i+3].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
555 tmp_b_r = (buf[i+7].real - buf[i+7].imag) * w[2][3].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
556 tmp_b_i = (buf[i+7].imag + buf[i+7].real) * w[2][3].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
557 buf[i+3].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
558 buf[i+3].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
559 buf[i+7].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
560 buf[i+7].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
561 #else |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
562 vector float buf01, buf23, buf45, buf67; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
563 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
564 buf01 = vec_ld((i + 0) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
565 buf23 = vec_ld((i + 2) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
566 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
567 tmp_b_r = (buf[i+5].real + buf[i+5].imag) * w[2][1].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
568 tmp_b_i = (buf[i+5].imag - buf[i+5].real) * w[2][1].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
569 buf[i+5].real = tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
570 buf[i+5].imag = tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
571 tmp_b_r = (buf[i+7].real - buf[i+7].imag) * w[2][3].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
572 tmp_b_i = (buf[i+7].imag + buf[i+7].real) * w[2][3].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
573 buf[i+7].real = tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
574 buf[i+7].imag = tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
575 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
576 buf23 = vec_ld((i + 2) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
577 buf45 = vec_ld((i + 4) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
578 buf67 = vec_ld((i + 6) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
579 buf67 = vec_perm(buf67, buf67, vcprm(1,0,2,3)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
580 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
581 vec_st(vec_add(buf01, buf45), (i + 0) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
582 vec_st(vec_madd(buf67, vcii(p,n,p,p), buf23), (i + 2) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
583 vec_st(vec_sub(buf01, buf45), (i + 4) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
584 vec_st(vec_nmsub(buf67, vcii(p,n,p,p), buf23), (i + 6) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
585 #endif |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
586 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
587 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
588 /* 4-7. iterations */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
589 for (m=3; m < 7; m++) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
590 two_m = (1 << m); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
591 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
592 two_m_plus_one = two_m<<1; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
593 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
594 for(i = 0; i < 128; i += two_m_plus_one) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
595 for(k = 0; k < two_m; k+=2) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
596 #if 0 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
597 int p = k + i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
598 int q = p + two_m; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
599 tmp_a_r = buf[p].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
600 tmp_a_i = buf[p].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
601 tmp_b_r = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
602 buf[q].real * w[m][k].real - |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
603 buf[q].imag * w[m][k].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
604 tmp_b_i = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
605 buf[q].imag * w[m][k].real + |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
606 buf[q].real * w[m][k].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
607 buf[p].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
608 buf[p].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
609 buf[q].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
610 buf[q].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
611 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
612 tmp_a_r = buf[(p + 1)].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
613 tmp_a_i = buf[(p + 1)].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
614 tmp_b_r = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
615 buf[(q + 1)].real * w[m][(k + 1)].real - |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
616 buf[(q + 1)].imag * w[m][(k + 1)].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
617 tmp_b_i = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
618 buf[(q + 1)].imag * w[m][(k + 1)].real + |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
619 buf[(q + 1)].real * w[m][(k + 1)].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
620 buf[(p + 1)].real = tmp_a_r + tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
621 buf[(p + 1)].imag = tmp_a_i + tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
622 buf[(q + 1)].real = tmp_a_r - tmp_b_r; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
623 buf[(q + 1)].imag = tmp_a_i - tmp_b_i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
624 #else |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
625 int p = k + i; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
626 int q = p + two_m; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
627 vector float vecp, vecq, vecw, temp1, temp2, temp3, temp4; |
9122 | 628 const vector float vczero = (const vector float)FOUROF(0.); |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
629 // first compute buf[q] and buf[q+1] |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
630 vecq = vec_ld(q << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
631 vecw = vec_ld(0, (float*)&(w[m][k])); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
632 temp1 = vec_madd(vecq, vecw, vczero); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
633 temp2 = vec_perm(vecq, vecq, vcprm(1,0,3,2)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
634 temp2 = vec_madd(temp2, vecw, vczero); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
635 temp3 = vec_perm(temp1, temp2, vcprm(0,s0,2,s2)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
636 temp4 = vec_perm(temp1, temp2, vcprm(1,s1,3,s3)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
637 vecq = vec_madd(temp4, vcii(n,p,n,p), temp3); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
638 // then butterfly with buf[p] and buf[p+1] |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
639 vecp = vec_ld(p << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
640 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
641 temp1 = vec_add(vecp, vecq); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
642 temp2 = vec_sub(vecp, vecq); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
643 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
644 vec_st(temp1, p << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
645 vec_st(temp2, q << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
646 #endif |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
647 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
648 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
649 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
650 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
651 /* Post IFFT complex multiply plus IFFT complex conjugate*/ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
652 for( i=0; i < 128; i+=4) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
653 /* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
654 #if 0 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
655 tmp_a_r = buf[(i + 0)].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
656 tmp_a_i = -1.0 * buf[(i + 0)].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
657 buf[(i + 0)].real = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
658 (tmp_a_r * xcos1[(i + 0)]) - (tmp_a_i * xsin1[(i + 0)]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
659 buf[(i + 0)].imag = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
660 (tmp_a_r * xsin1[(i + 0)]) + (tmp_a_i * xcos1[(i + 0)]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
661 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
662 tmp_a_r = buf[(i + 1)].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
663 tmp_a_i = -1.0 * buf[(i + 1)].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
664 buf[(i + 1)].real = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
665 (tmp_a_r * xcos1[(i + 1)]) - (tmp_a_i * xsin1[(i + 1)]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
666 buf[(i + 1)].imag = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
667 (tmp_a_r * xsin1[(i + 1)]) + (tmp_a_i * xcos1[(i + 1)]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
668 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
669 tmp_a_r = buf[(i + 2)].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
670 tmp_a_i = -1.0 * buf[(i + 2)].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
671 buf[(i + 2)].real = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
672 (tmp_a_r * xcos1[(i + 2)]) - (tmp_a_i * xsin1[(i + 2)]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
673 buf[(i + 2)].imag = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
674 (tmp_a_r * xsin1[(i + 2)]) + (tmp_a_i * xcos1[(i + 2)]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
675 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
676 tmp_a_r = buf[(i + 3)].real; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
677 tmp_a_i = -1.0 * buf[(i + 3)].imag; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
678 buf[(i + 3)].real = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
679 (tmp_a_r * xcos1[(i + 3)]) - (tmp_a_i * xsin1[(i + 3)]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
680 buf[(i + 3)].imag = |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
681 (tmp_a_r * xsin1[(i + 3)]) + (tmp_a_i * xcos1[(i + 3)]); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
682 #else |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
683 vector float bufv_0, bufv_2, cosv, sinv, temp1, temp2; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
684 vector float temp0022, temp1133, tempCS01; |
9122 | 685 const vector float vczero = (const vector float)FOUROF(0.); |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
686 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
687 bufv_0 = vec_ld((i + 0) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
688 bufv_2 = vec_ld((i + 2) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
689 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
690 cosv = vec_ld(i << 2, xcos1); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
691 sinv = vec_ld(i << 2, xsin1); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
692 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
693 temp0022 = vec_perm(bufv_0, bufv_0, vcprm(0,0,2,2)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
694 temp1133 = vec_perm(bufv_0, bufv_0, vcprm(1,1,3,3)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
695 tempCS01 = vec_perm(cosv, sinv, vcprm(0,s0,1,s1)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
696 temp1 = vec_madd(temp0022, tempCS01, vczero); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
697 tempCS01 = vec_perm(cosv, sinv, vcprm(s0,0,s1,1)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
698 temp2 = vec_madd(temp1133, tempCS01, vczero); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
699 bufv_0 = vec_madd(temp2, vcii(p,n,p,n), temp1); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
700 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
701 vec_st(bufv_0, (i + 0) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
702 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
703 /* idem with bufv_2 and high-order cosv/sinv */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
704 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
705 temp0022 = vec_perm(bufv_2, bufv_2, vcprm(0,0,2,2)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
706 temp1133 = vec_perm(bufv_2, bufv_2, vcprm(1,1,3,3)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
707 tempCS01 = vec_perm(cosv, sinv, vcprm(2,s2,3,s3)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
708 temp1 = vec_madd(temp0022, tempCS01, vczero); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
709 tempCS01 = vec_perm(cosv, sinv, vcprm(s2,2,s3,3)); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
710 temp2 = vec_madd(temp1133, tempCS01, vczero); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
711 bufv_2 = vec_madd(temp2, vcii(p,n,p,n), temp1); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
712 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
713 vec_st(bufv_2, (i + 2) << 3, (float*)buf); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
714 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
715 #endif |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
716 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
717 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
718 data_ptr = data; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
719 delay_ptr = delay; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
720 window_ptr = imdct_window; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
721 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
722 /* Window and convert to real valued signal */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
723 for(i=0; i< 64; i++) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
724 *data_ptr++ = -buf[64+i].imag * *window_ptr++ + *delay_ptr++ + bias; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
725 *data_ptr++ = buf[64-i-1].real * *window_ptr++ + *delay_ptr++ + bias; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
726 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
727 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
728 for(i=0; i< 64; i++) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
729 *data_ptr++ = -buf[i].real * *window_ptr++ + *delay_ptr++ + bias; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
730 *data_ptr++ = buf[128-i-1].imag * *window_ptr++ + *delay_ptr++ + bias; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
731 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
732 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
733 /* The trailing edge of the window goes into the delay line */ |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
734 delay_ptr = delay; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
735 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
736 for(i=0; i< 64; i++) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
737 *delay_ptr++ = -buf[64+i].real * *--window_ptr; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
738 *delay_ptr++ = buf[64-i-1].imag * *--window_ptr; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
739 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
740 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
741 for(i=0; i<64; i++) { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
742 *delay_ptr++ = buf[i].imag * *--window_ptr; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
743 *delay_ptr++ = -buf[128-i-1].real * *--window_ptr; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
744 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
745 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
746 #endif |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
747 |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
748 |
4497 | 749 // Stuff below this line is borrowed from libac3 |
750 #include "srfftp.h" | |
16173 | 751 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
4497 | 752 #ifndef HAVE_3DNOW |
753 #define HAVE_3DNOW 1 | |
754 #endif | |
3884 | 755 #include "srfftp_3dnow.h" |
756 | |
8451 | 757 const i_cmplx_t x_plus_minus_3dnow __attribute__ ((aligned (8))) = {{ 0x00000000UL, 0x80000000UL }}; |
758 const i_cmplx_t x_minus_plus_3dnow __attribute__ ((aligned (8))) = {{ 0x80000000UL, 0x00000000UL }}; | |
3884 | 759 const complex_t HSQRT2_3DNOW __attribute__ ((aligned (8))) = { 0.707106781188, 0.707106781188 }; |
760 | |
4497 | 761 #undef HAVE_3DNOWEX |
762 #include "imdct_3dnow.h" | |
763 #define HAVE_3DNOWEX | |
764 #include "imdct_3dnow.h" | |
3884 | 765 |
3579 | 766 void |
767 imdct_do_512_sse(sample_t data[],sample_t delay[], sample_t bias) | |
768 { | |
8254
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
769 /* int i,k; |
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
770 int p,q;*/ |
3579 | 771 int m; |
16173 | 772 long two_m; |
773 long two_m_plus_one; | |
774 long two_m_plus_one_shl3; | |
15617
130dd060f723
one bugfix and a few gcc4 bug workaorunds by (Gianluigi Tiesi: mplayer, netfarm it)
michael
parents:
14991
diff
changeset
|
775 complex_t *buf_offset; |
3579 | 776 |
8254
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
777 /* sample_t tmp_a_i; |
3579 | 778 sample_t tmp_a_r; |
779 sample_t tmp_b_i; | |
8254
772d6d27fd66
warning patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
4497
diff
changeset
|
780 sample_t tmp_b_r;*/ |
3579 | 781 |
782 sample_t *data_ptr; | |
783 sample_t *delay_ptr; | |
784 sample_t *window_ptr; | |
785 | |
786 /* 512 IMDCT with source and dest data in 'data' */ | |
3623 | 787 /* see the c version (dct_do_512()), its allmost identical, just in C */ |
788 | |
3579 | 789 /* Pre IFFT complex multiply plus IFFT cmplx conjugate */ |
790 /* Bit reversed shuffling */ | |
791 asm volatile( | |
16173 | 792 "xor %%"REG_S", %%"REG_S" \n\t" |
793 "lea "MANGLE(bit_reverse_512)", %%"REG_a"\n\t" | |
794 "mov $1008, %%"REG_D" \n\t" | |
795 "push %%"REG_BP" \n\t" //use ebp without telling gcc | |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
796 ASMALIGN16 |
3579 | 797 "1: \n\t" |
16173 | 798 "movlps (%0, %%"REG_S"), %%xmm0 \n\t" // XXXI |
799 "movhps 8(%0, %%"REG_D"), %%xmm0 \n\t" // RXXI | |
800 "movlps 8(%0, %%"REG_S"), %%xmm1 \n\t" // XXXi | |
801 "movhps (%0, %%"REG_D"), %%xmm1 \n\t" // rXXi | |
3584 | 802 "shufps $0x33, %%xmm1, %%xmm0 \n\t" // irIR |
16173 | 803 "movaps "MANGLE(sseSinCos1c)"(%%"REG_S"), %%xmm2\n\t" |
3584 | 804 "mulps %%xmm0, %%xmm2 \n\t" |
805 "shufps $0xB1, %%xmm0, %%xmm0 \n\t" // riRI | |
16173 | 806 "mulps "MANGLE(sseSinCos1d)"(%%"REG_S"), %%xmm0\n\t" |
3584 | 807 "subps %%xmm0, %%xmm2 \n\t" |
16173 | 808 "movzb (%%"REG_a"), %%"REG_d" \n\t" |
809 "movzb 1(%%"REG_a"), %%"REG_BP" \n\t" | |
810 "movlps %%xmm2, (%1, %%"REG_d", 8) \n\t" | |
811 "movhps %%xmm2, (%1, %%"REG_BP", 8) \n\t" | |
812 "add $16, %%"REG_S" \n\t" | |
813 "add $2, %%"REG_a" \n\t" // avoid complex addressing for P4 crap | |
814 "sub $16, %%"REG_D" \n\t" | |
815 "jnc 1b \n\t" | |
816 "pop %%"REG_BP" \n\t"//no we didnt touch ebp *g* | |
16189
72764c0dad8a
Fixes segfault on IA-32 machines caused by the ASM patch for AMD-64 for a52.
gpoirier
parents:
16173
diff
changeset
|
817 :: "b" (data), "c" (buf) |
16173 | 818 : "%"REG_S, "%"REG_D, "%"REG_a, "%"REG_d |
3579 | 819 ); |
820 | |
821 | |
822 /* FFT Merge */ | |
823 /* unoptimized variant | |
824 for (m=1; m < 7; m++) { | |
825 if(m) | |
826 two_m = (1 << m); | |
827 else | |
828 two_m = 1; | |
829 | |
830 two_m_plus_one = (1 << (m+1)); | |
831 | |
832 for(i = 0; i < 128; i += two_m_plus_one) { | |
833 for(k = 0; k < two_m; k++) { | |
834 p = k + i; | |
835 q = p + two_m; | |
836 tmp_a_r = buf[p].real; | |
837 tmp_a_i = buf[p].imag; | |
838 tmp_b_r = buf[q].real * w[m][k].real - buf[q].imag * w[m][k].imag; | |
839 tmp_b_i = buf[q].imag * w[m][k].real + buf[q].real * w[m][k].imag; | |
840 buf[p].real = tmp_a_r + tmp_b_r; | |
841 buf[p].imag = tmp_a_i + tmp_b_i; | |
842 buf[q].real = tmp_a_r - tmp_b_r; | |
843 buf[q].imag = tmp_a_i - tmp_b_i; | |
844 } | |
845 } | |
846 } | |
847 */ | |
848 | |
3623 | 849 /* 1. iteration */ |
3549 | 850 // Note w[0][0]={1,0} |
3508 | 851 asm volatile( |
852 "xorps %%xmm1, %%xmm1 \n\t" | |
853 "xorps %%xmm2, %%xmm2 \n\t" | |
16173 | 854 "mov %0, %%"REG_S" \n\t" |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
855 ASMALIGN16 |
3508 | 856 "1: \n\t" |
16173 | 857 "movlps (%%"REG_S"), %%xmm0\n\t" //buf[p] |
858 "movlps 8(%%"REG_S"), %%xmm1\n\t" //buf[q] | |
859 "movhps (%%"REG_S"), %%xmm0\n\t" //buf[p] | |
860 "movhps 8(%%"REG_S"), %%xmm2\n\t" //buf[q] | |
3508 | 861 "addps %%xmm1, %%xmm0 \n\t" |
862 "subps %%xmm2, %%xmm0 \n\t" | |
16173 | 863 "movaps %%xmm0, (%%"REG_S")\n\t" |
864 "add $16, %%"REG_S" \n\t" | |
865 "cmp %1, %%"REG_S" \n\t" | |
3508 | 866 " jb 1b \n\t" |
867 :: "g" (buf), "r" (buf + 128) | |
16173 | 868 : "%"REG_S |
3508 | 869 ); |
3549 | 870 |
3623 | 871 /* 2. iteration */ |
3512 | 872 // Note w[1]={{1,0}, {0,-1}} |
873 asm volatile( | |
4247
2dbd637ffe05
mangle for win32 in liba52 (includes dummy mangle.h pointing to the one in main)
atmos4
parents:
3908
diff
changeset
|
874 "movaps "MANGLE(ps111_1)", %%xmm7\n\t" // 1,1,1,-1 |
16173 | 875 "mov %0, %%"REG_S" \n\t" |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
876 ASMALIGN16 |
3512 | 877 "1: \n\t" |
16173 | 878 "movaps 16(%%"REG_S"), %%xmm2 \n\t" //r2,i2,r3,i3 |
3512 | 879 "shufps $0xB4, %%xmm2, %%xmm2 \n\t" //r2,i2,i3,r3 |
880 "mulps %%xmm7, %%xmm2 \n\t" //r2,i2,i3,-r3 | |
16173 | 881 "movaps (%%"REG_S"), %%xmm0 \n\t" //r0,i0,r1,i1 |
882 "movaps (%%"REG_S"), %%xmm1 \n\t" //r0,i0,r1,i1 | |
3512 | 883 "addps %%xmm2, %%xmm0 \n\t" |
884 "subps %%xmm2, %%xmm1 \n\t" | |
16173 | 885 "movaps %%xmm0, (%%"REG_S") \n\t" |
886 "movaps %%xmm1, 16(%%"REG_S") \n\t" | |
887 "add $32, %%"REG_S" \n\t" | |
888 "cmp %1, %%"REG_S" \n\t" | |
3512 | 889 " jb 1b \n\t" |
890 :: "g" (buf), "r" (buf + 128) | |
16173 | 891 : "%"REG_S |
3512 | 892 ); |
3549 | 893 |
3623 | 894 /* 3. iteration */ |
3534 | 895 /* |
896 Note sseW2+0={1,1,sqrt(2),sqrt(2)) | |
897 Note sseW2+16={0,0,sqrt(2),-sqrt(2)) | |
898 Note sseW2+32={0,0,-sqrt(2),-sqrt(2)) | |
899 Note sseW2+48={1,-1,sqrt(2),-sqrt(2)) | |
900 */ | |
901 asm volatile( | |
4247
2dbd637ffe05
mangle for win32 in liba52 (includes dummy mangle.h pointing to the one in main)
atmos4
parents:
3908
diff
changeset
|
902 "movaps 48+"MANGLE(sseW2)", %%xmm6\n\t" |
2dbd637ffe05
mangle for win32 in liba52 (includes dummy mangle.h pointing to the one in main)
atmos4
parents:
3908
diff
changeset
|
903 "movaps 16+"MANGLE(sseW2)", %%xmm7\n\t" |
3534 | 904 "xorps %%xmm5, %%xmm5 \n\t" |
905 "xorps %%xmm2, %%xmm2 \n\t" | |
16173 | 906 "mov %0, %%"REG_S" \n\t" |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
907 ASMALIGN16 |
3534 | 908 "1: \n\t" |
16173 | 909 "movaps 32(%%"REG_S"), %%xmm2 \n\t" //r4,i4,r5,i5 |
910 "movaps 48(%%"REG_S"), %%xmm3 \n\t" //r6,i6,r7,i7 | |
4247
2dbd637ffe05
mangle for win32 in liba52 (includes dummy mangle.h pointing to the one in main)
atmos4
parents:
3908
diff
changeset
|
911 "movaps "MANGLE(sseW2)", %%xmm4 \n\t" //r4,i4,r5,i5 |
2dbd637ffe05
mangle for win32 in liba52 (includes dummy mangle.h pointing to the one in main)
atmos4
parents:
3908
diff
changeset
|
912 "movaps 32+"MANGLE(sseW2)", %%xmm5\n\t" //r6,i6,r7,i7 |
3537 | 913 "mulps %%xmm2, %%xmm4 \n\t" |
914 "mulps %%xmm3, %%xmm5 \n\t" | |
3534 | 915 "shufps $0xB1, %%xmm2, %%xmm2 \n\t" //i4,r4,i5,r5 |
916 "shufps $0xB1, %%xmm3, %%xmm3 \n\t" //i6,r6,i7,r7 | |
3537 | 917 "mulps %%xmm6, %%xmm3 \n\t" |
3534 | 918 "mulps %%xmm7, %%xmm2 \n\t" |
16173 | 919 "movaps (%%"REG_S"), %%xmm0 \n\t" //r0,i0,r1,i1 |
920 "movaps 16(%%"REG_S"), %%xmm1 \n\t" //r2,i2,r3,i3 | |
3534 | 921 "addps %%xmm4, %%xmm2 \n\t" |
922 "addps %%xmm5, %%xmm3 \n\t" | |
923 "movaps %%xmm2, %%xmm4 \n\t" | |
924 "movaps %%xmm3, %%xmm5 \n\t" | |
925 "addps %%xmm0, %%xmm2 \n\t" | |
926 "addps %%xmm1, %%xmm3 \n\t" | |
927 "subps %%xmm4, %%xmm0 \n\t" | |
928 "subps %%xmm5, %%xmm1 \n\t" | |
16173 | 929 "movaps %%xmm2, (%%"REG_S") \n\t" |
930 "movaps %%xmm3, 16(%%"REG_S") \n\t" | |
931 "movaps %%xmm0, 32(%%"REG_S") \n\t" | |
932 "movaps %%xmm1, 48(%%"REG_S") \n\t" | |
933 "add $64, %%"REG_S" \n\t" | |
934 "cmp %1, %%"REG_S" \n\t" | |
3534 | 935 " jb 1b \n\t" |
936 :: "g" (buf), "r" (buf + 128) | |
16173 | 937 : "%"REG_S |
3534 | 938 ); |
3508 | 939 |
3623 | 940 /* 4-7. iterations */ |
3546 | 941 for (m=3; m < 7; m++) { |
942 two_m = (1 << m); | |
943 two_m_plus_one = two_m<<1; | |
15617
130dd060f723
one bugfix and a few gcc4 bug workaorunds by (Gianluigi Tiesi: mplayer, netfarm it)
michael
parents:
14991
diff
changeset
|
944 two_m_plus_one_shl3 = (two_m_plus_one<<3); |
130dd060f723
one bugfix and a few gcc4 bug workaorunds by (Gianluigi Tiesi: mplayer, netfarm it)
michael
parents:
14991
diff
changeset
|
945 buf_offset = buf+128; |
3546 | 946 asm volatile( |
16173 | 947 "mov %0, %%"REG_S" \n\t" |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
948 ASMALIGN16 |
3546 | 949 "1: \n\t" |
16173 | 950 "xor %%"REG_D", %%"REG_D" \n\t" // k |
951 "lea (%%"REG_S", %3), %%"REG_d" \n\t" | |
3546 | 952 "2: \n\t" |
16173 | 953 "movaps (%%"REG_d", %%"REG_D"), %%xmm1 \n\t" |
954 "movaps (%4, %%"REG_D", 2), %%xmm2 \n\t" | |
3546 | 955 "mulps %%xmm1, %%xmm2 \n\t" |
956 "shufps $0xB1, %%xmm1, %%xmm1 \n\t" | |
16173 | 957 "mulps 16(%4, %%"REG_D", 2), %%xmm1 \n\t" |
958 "movaps (%%"REG_S", %%"REG_D"), %%xmm0 \n\t" | |
3546 | 959 "addps %%xmm2, %%xmm1 \n\t" |
960 "movaps %%xmm1, %%xmm2 \n\t" | |
961 "addps %%xmm0, %%xmm1 \n\t" | |
962 "subps %%xmm2, %%xmm0 \n\t" | |
16173 | 963 "movaps %%xmm1, (%%"REG_S", %%"REG_D") \n\t" |
964 "movaps %%xmm0, (%%"REG_d", %%"REG_D") \n\t" | |
965 "add $16, %%"REG_D" \n\t" | |
966 "cmp %3, %%"REG_D" \n\t" //FIXME (opt) count against 0 | |
967 "jb 2b \n\t" | |
968 "add %2, %%"REG_S" \n\t" | |
969 "cmp %1, %%"REG_S" \n\t" | |
3546 | 970 " jb 1b \n\t" |
15617
130dd060f723
one bugfix and a few gcc4 bug workaorunds by (Gianluigi Tiesi: mplayer, netfarm it)
michael
parents:
14991
diff
changeset
|
971 :: "g" (buf), "m" (buf_offset), "m" (two_m_plus_one_shl3), "r" (two_m<<3), |
3546 | 972 "r" (sseW[m]) |
16173 | 973 : "%"REG_S, "%"REG_D, "%"REG_d |
3546 | 974 ); |
975 } | |
976 | |
3623 | 977 /* Post IFFT complex multiply plus IFFT complex conjugate*/ |
3581 | 978 asm volatile( |
16173 | 979 "mov $-1024, %%"REG_S" \n\t" |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
980 ASMALIGN16 |
3581 | 981 "1: \n\t" |
16173 | 982 "movaps (%0, %%"REG_S"), %%xmm0 \n\t" |
983 "movaps (%0, %%"REG_S"), %%xmm1 \n\t" | |
3581 | 984 "shufps $0xB1, %%xmm0, %%xmm0 \n\t" |
16173 | 985 "mulps 1024+"MANGLE(sseSinCos1c)"(%%"REG_S"), %%xmm1\n\t" |
986 "mulps 1024+"MANGLE(sseSinCos1d)"(%%"REG_S"), %%xmm0\n\t" | |
3581 | 987 "addps %%xmm1, %%xmm0 \n\t" |
16173 | 988 "movaps %%xmm0, (%0, %%"REG_S") \n\t" |
989 "add $16, %%"REG_S" \n\t" | |
3581 | 990 " jnz 1b \n\t" |
991 :: "r" (buf+128) | |
16173 | 992 : "%"REG_S |
3581 | 993 ); |
994 | |
3394 | 995 |
996 data_ptr = data; | |
997 delay_ptr = delay; | |
998 window_ptr = imdct_window; | |
999 | |
1000 /* Window and convert to real valued signal */ | |
3552 | 1001 asm volatile( |
16173 | 1002 "xor %%"REG_D", %%"REG_D" \n\t" // 0 |
1003 "xor %%"REG_S", %%"REG_S" \n\t" // 0 | |
3552 | 1004 "movss %3, %%xmm2 \n\t" // bias |
1005 "shufps $0x00, %%xmm2, %%xmm2 \n\t" // bias, bias, ... | |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
1006 ASMALIGN16 |
3552 | 1007 "1: \n\t" |
16173 | 1008 "movlps (%0, %%"REG_S"), %%xmm0 \n\t" // ? ? A ? |
1009 "movlps 8(%0, %%"REG_S"), %%xmm1 \n\t" // ? ? C ? | |
1010 "movhps -16(%0, %%"REG_D"), %%xmm1 \n\t" // ? D C ? | |
1011 "movhps -8(%0, %%"REG_D"), %%xmm0 \n\t" // ? B A ? | |
3552 | 1012 "shufps $0x99, %%xmm1, %%xmm0 \n\t" // D C B A |
16173 | 1013 "mulps "MANGLE(sseWindow)"(%%"REG_S"), %%xmm0\n\t" |
1014 "addps (%2, %%"REG_S"), %%xmm0 \n\t" | |
3552 | 1015 "addps %%xmm2, %%xmm0 \n\t" |
16173 | 1016 "movaps %%xmm0, (%1, %%"REG_S") \n\t" |
1017 "add $16, %%"REG_S" \n\t" | |
1018 "sub $16, %%"REG_D" \n\t" | |
1019 "cmp $512, %%"REG_S" \n\t" | |
3552 | 1020 " jb 1b \n\t" |
1021 :: "r" (buf+64), "r" (data_ptr), "r" (delay_ptr), "m" (bias) | |
16173 | 1022 : "%"REG_S, "%"REG_D |
3552 | 1023 ); |
1024 data_ptr+=128; | |
1025 delay_ptr+=128; | |
3553 | 1026 // window_ptr+=128; |
3579 | 1027 |
3552 | 1028 asm volatile( |
16173 | 1029 "mov $1024, %%"REG_D" \n\t" // 512 |
1030 "xor %%"REG_S", %%"REG_S" \n\t" // 0 | |
3552 | 1031 "movss %3, %%xmm2 \n\t" // bias |
1032 "shufps $0x00, %%xmm2, %%xmm2 \n\t" // bias, bias, ... | |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
1033 ASMALIGN16 |
3552 | 1034 "1: \n\t" |
16173 | 1035 "movlps (%0, %%"REG_S"), %%xmm0 \n\t" // ? ? ? A |
1036 "movlps 8(%0, %%"REG_S"), %%xmm1 \n\t" // ? ? ? C | |
1037 "movhps -16(%0, %%"REG_D"), %%xmm1 \n\t" // D ? ? C | |
1038 "movhps -8(%0, %%"REG_D"), %%xmm0 \n\t" // B ? ? A | |
3552 | 1039 "shufps $0xCC, %%xmm1, %%xmm0 \n\t" // D C B A |
16173 | 1040 "mulps 512+"MANGLE(sseWindow)"(%%"REG_S"), %%xmm0\n\t" |
1041 "addps (%2, %%"REG_S"), %%xmm0 \n\t" | |
3552 | 1042 "addps %%xmm2, %%xmm0 \n\t" |
16173 | 1043 "movaps %%xmm0, (%1, %%"REG_S") \n\t" |
1044 "add $16, %%"REG_S" \n\t" | |
1045 "sub $16, %%"REG_D" \n\t" | |
1046 "cmp $512, %%"REG_S" \n\t" | |
3552 | 1047 " jb 1b \n\t" |
1048 :: "r" (buf), "r" (data_ptr), "r" (delay_ptr), "m" (bias) | |
16173 | 1049 : "%"REG_S, "%"REG_D |
3552 | 1050 ); |
1051 data_ptr+=128; | |
3553 | 1052 // window_ptr+=128; |
3394 | 1053 |
1054 /* The trailing edge of the window goes into the delay line */ | |
1055 delay_ptr = delay; | |
1056 | |
3553 | 1057 asm volatile( |
16173 | 1058 "xor %%"REG_D", %%"REG_D" \n\t" // 0 |
1059 "xor %%"REG_S", %%"REG_S" \n\t" // 0 | |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
1060 ASMALIGN16 |
3553 | 1061 "1: \n\t" |
16173 | 1062 "movlps (%0, %%"REG_S"), %%xmm0 \n\t" // ? ? ? A |
1063 "movlps 8(%0, %%"REG_S"), %%xmm1 \n\t" // ? ? ? C | |
1064 "movhps -16(%0, %%"REG_D"), %%xmm1 \n\t" // D ? ? C | |
1065 "movhps -8(%0, %%"REG_D"), %%xmm0 \n\t" // B ? ? A | |
3553 | 1066 "shufps $0xCC, %%xmm1, %%xmm0 \n\t" // D C B A |
16173 | 1067 "mulps 1024+"MANGLE(sseWindow)"(%%"REG_S"), %%xmm0\n\t" |
1068 "movaps %%xmm0, (%1, %%"REG_S") \n\t" | |
1069 "add $16, %%"REG_S" \n\t" | |
1070 "sub $16, %%"REG_D" \n\t" | |
1071 "cmp $512, %%"REG_S" \n\t" | |
3553 | 1072 " jb 1b \n\t" |
1073 :: "r" (buf+64), "r" (delay_ptr) | |
16173 | 1074 : "%"REG_S, "%"REG_D |
3553 | 1075 ); |
1076 delay_ptr+=128; | |
1077 // window_ptr-=128; | |
3579 | 1078 |
3553 | 1079 asm volatile( |
16173 | 1080 "mov $1024, %%"REG_D" \n\t" // 1024 |
1081 "xor %%"REG_S", %%"REG_S" \n\t" // 0 | |
18104
7b408d60de9e
add support for intel mac. mp3lib is not fixed yet.
nplourde
parents:
16189
diff
changeset
|
1082 ASMALIGN16 |
3553 | 1083 "1: \n\t" |
16173 | 1084 "movlps (%0, %%"REG_S"), %%xmm0 \n\t" // ? ? A ? |
1085 "movlps 8(%0, %%"REG_S"), %%xmm1 \n\t" // ? ? C ? | |
1086 "movhps -16(%0, %%"REG_D"), %%xmm1 \n\t" // ? D C ? | |
1087 "movhps -8(%0, %%"REG_D"), %%xmm0 \n\t" // ? B A ? | |
3553 | 1088 "shufps $0x99, %%xmm1, %%xmm0 \n\t" // D C B A |
16173 | 1089 "mulps 1536+"MANGLE(sseWindow)"(%%"REG_S"), %%xmm0\n\t" |
1090 "movaps %%xmm0, (%1, %%"REG_S") \n\t" | |
1091 "add $16, %%"REG_S" \n\t" | |
1092 "sub $16, %%"REG_D" \n\t" | |
1093 "cmp $512, %%"REG_S" \n\t" | |
3553 | 1094 " jb 1b \n\t" |
1095 :: "r" (buf), "r" (delay_ptr) | |
16173 | 1096 : "%"REG_S, "%"REG_D |
3553 | 1097 ); |
3394 | 1098 } |
16173 | 1099 #endif // ARCH_X86 || ARCH_X86_64 |
3394 | 1100 |
1101 void | |
1102 imdct_do_256(sample_t data[],sample_t delay[],sample_t bias) | |
1103 { | |
1104 int i,k; | |
1105 int p,q; | |
1106 int m; | |
1107 int two_m; | |
1108 int two_m_plus_one; | |
1109 | |
1110 sample_t tmp_a_i; | |
1111 sample_t tmp_a_r; | |
1112 sample_t tmp_b_i; | |
1113 sample_t tmp_b_r; | |
1114 | |
1115 sample_t *data_ptr; | |
1116 sample_t *delay_ptr; | |
1117 sample_t *window_ptr; | |
1118 | |
1119 complex_t *buf_1, *buf_2; | |
1120 | |
1121 buf_1 = &buf[0]; | |
1122 buf_2 = &buf[64]; | |
1123 | |
1124 /* Pre IFFT complex multiply plus IFFT cmplx conjugate */ | |
1125 for(k=0; k<64; k++) { | |
1126 /* X1[k] = X[2*k] */ | |
1127 /* X2[k] = X[2*k+1] */ | |
1128 | |
1129 p = 2 * (128-2*k-1); | |
1130 q = 2 * (2 * k); | |
1131 | |
1132 /* Z1[k] = (X1[128-2*k-1] + j * X1[2*k]) * (xcos2[k] + j * xsin2[k]); */ | |
1133 buf_1[k].real = data[p] * xcos2[k] - data[q] * xsin2[k]; | |
1134 buf_1[k].imag = -1.0f * (data[q] * xcos2[k] + data[p] * xsin2[k]); | |
1135 /* Z2[k] = (X2[128-2*k-1] + j * X2[2*k]) * (xcos2[k] + j * xsin2[k]); */ | |
1136 buf_2[k].real = data[p + 1] * xcos2[k] - data[q + 1] * xsin2[k]; | |
1137 buf_2[k].imag = -1.0f * ( data[q + 1] * xcos2[k] + data[p + 1] * xsin2[k]); | |
1138 } | |
1139 | |
1140 /* IFFT Bit reversed shuffling */ | |
1141 for(i=0; i<64; i++) { | |
1142 k = bit_reverse_256[i]; | |
1143 if (k < i) { | |
1144 swap_cmplx(&buf_1[i],&buf_1[k]); | |
1145 swap_cmplx(&buf_2[i],&buf_2[k]); | |
1146 } | |
1147 } | |
1148 | |
1149 /* FFT Merge */ | |
1150 for (m=0; m < 6; m++) { | |
1151 two_m = (1 << m); | |
1152 two_m_plus_one = (1 << (m+1)); | |
1153 | |
1154 /* FIXME */ | |
1155 if(m) | |
1156 two_m = (1 << m); | |
1157 else | |
1158 two_m = 1; | |
1159 | |
1160 for(k = 0; k < two_m; k++) { | |
1161 for(i = 0; i < 64; i += two_m_plus_one) { | |
1162 p = k + i; | |
1163 q = p + two_m; | |
1164 /* Do block 1 */ | |
1165 tmp_a_r = buf_1[p].real; | |
1166 tmp_a_i = buf_1[p].imag; | |
1167 tmp_b_r = buf_1[q].real * w[m][k].real - buf_1[q].imag * w[m][k].imag; | |
1168 tmp_b_i = buf_1[q].imag * w[m][k].real + buf_1[q].real * w[m][k].imag; | |
1169 buf_1[p].real = tmp_a_r + tmp_b_r; | |
1170 buf_1[p].imag = tmp_a_i + tmp_b_i; | |
1171 buf_1[q].real = tmp_a_r - tmp_b_r; | |
1172 buf_1[q].imag = tmp_a_i - tmp_b_i; | |
1173 | |
1174 /* Do block 2 */ | |
1175 tmp_a_r = buf_2[p].real; | |
1176 tmp_a_i = buf_2[p].imag; | |
1177 tmp_b_r = buf_2[q].real * w[m][k].real - buf_2[q].imag * w[m][k].imag; | |
1178 tmp_b_i = buf_2[q].imag * w[m][k].real + buf_2[q].real * w[m][k].imag; | |
1179 buf_2[p].real = tmp_a_r + tmp_b_r; | |
1180 buf_2[p].imag = tmp_a_i + tmp_b_i; | |
1181 buf_2[q].real = tmp_a_r - tmp_b_r; | |
1182 buf_2[q].imag = tmp_a_i - tmp_b_i; | |
1183 } | |
1184 } | |
1185 } | |
1186 | |
1187 /* Post IFFT complex multiply */ | |
1188 for( i=0; i < 64; i++) { | |
1189 /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */ | |
1190 tmp_a_r = buf_1[i].real; | |
1191 tmp_a_i = -buf_1[i].imag; | |
1192 buf_1[i].real =(tmp_a_r * xcos2[i]) - (tmp_a_i * xsin2[i]); | |
1193 buf_1[i].imag =(tmp_a_r * xsin2[i]) + (tmp_a_i * xcos2[i]); | |
1194 /* y2[n] = z2[n] * (xcos2[n] + j * xsin2[n]) ; */ | |
1195 tmp_a_r = buf_2[i].real; | |
1196 tmp_a_i = -buf_2[i].imag; | |
1197 buf_2[i].real =(tmp_a_r * xcos2[i]) - (tmp_a_i * xsin2[i]); | |
1198 buf_2[i].imag =(tmp_a_r * xsin2[i]) + (tmp_a_i * xcos2[i]); | |
1199 } | |
1200 | |
1201 data_ptr = data; | |
1202 delay_ptr = delay; | |
1203 window_ptr = imdct_window; | |
1204 | |
1205 /* Window and convert to real valued signal */ | |
1206 for(i=0; i< 64; i++) { | |
1207 *data_ptr++ = -buf_1[i].imag * *window_ptr++ + *delay_ptr++ + bias; | |
1208 *data_ptr++ = buf_1[64-i-1].real * *window_ptr++ + *delay_ptr++ + bias; | |
1209 } | |
1210 | |
1211 for(i=0; i< 64; i++) { | |
1212 *data_ptr++ = -buf_1[i].real * *window_ptr++ + *delay_ptr++ + bias; | |
1213 *data_ptr++ = buf_1[64-i-1].imag * *window_ptr++ + *delay_ptr++ + bias; | |
1214 } | |
1215 | |
1216 delay_ptr = delay; | |
1217 | |
1218 for(i=0; i< 64; i++) { | |
1219 *delay_ptr++ = -buf_2[i].real * *--window_ptr; | |
1220 *delay_ptr++ = buf_2[64-i-1].imag * *--window_ptr; | |
1221 } | |
1222 | |
1223 for(i=0; i< 64; i++) { | |
1224 *delay_ptr++ = buf_2[i].imag * *--window_ptr; | |
1225 *delay_ptr++ = -buf_2[64-i-1].real * *--window_ptr; | |
1226 } | |
1227 } | |
1228 | |
1229 void imdct_init (uint32_t mm_accel) | |
1230 { | |
1231 #ifdef LIBA52_MLIB | |
1232 if (mm_accel & MM_ACCEL_MLIB) { | |
1233 fprintf (stderr, "Using mlib for IMDCT transform\n"); | |
1234 imdct_512 = imdct_do_512_mlib; | |
1235 imdct_256 = imdct_do_256_mlib; | |
1236 } else | |
1237 #endif | |
1238 { | |
1239 int i, j, k; | |
1240 | |
1241 /* Twiddle factors to turn IFFT into IMDCT */ | |
1242 for (i = 0; i < 128; i++) { | |
1243 xcos1[i] = -cos ((M_PI / 2048) * (8 * i + 1)); | |
1244 xsin1[i] = -sin ((M_PI / 2048) * (8 * i + 1)); | |
1245 } | |
16173 | 1246 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
3527 | 1247 for (i = 0; i < 128; i++) { |
3581 | 1248 sseSinCos1c[2*i+0]= xcos1[i]; |
1249 sseSinCos1c[2*i+1]= -xcos1[i]; | |
1250 sseSinCos1d[2*i+0]= xsin1[i]; | |
1251 sseSinCos1d[2*i+1]= xsin1[i]; | |
3527 | 1252 } |
1253 #endif | |
3394 | 1254 |
1255 /* More twiddle factors to turn IFFT into IMDCT */ | |
1256 for (i = 0; i < 64; i++) { | |
1257 xcos2[i] = -cos ((M_PI / 1024) * (8 * i + 1)); | |
1258 xsin2[i] = -sin ((M_PI / 1024) * (8 * i + 1)); | |
1259 } | |
1260 | |
1261 for (i = 0; i < 7; i++) { | |
1262 j = 1 << i; | |
1263 for (k = 0; k < j; k++) { | |
1264 w[i][k].real = cos (-M_PI * k / j); | |
1265 w[i][k].imag = sin (-M_PI * k / j); | |
1266 } | |
1267 } | |
16173 | 1268 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
3534 | 1269 for (i = 1; i < 7; i++) { |
1270 j = 1 << i; | |
1271 for (k = 0; k < j; k+=2) { | |
1272 | |
1273 sseW[i][4*k + 0] = w[i][k+0].real; | |
1274 sseW[i][4*k + 1] = w[i][k+0].real; | |
1275 sseW[i][4*k + 2] = w[i][k+1].real; | |
1276 sseW[i][4*k + 3] = w[i][k+1].real; | |
1277 | |
1278 sseW[i][4*k + 4] = -w[i][k+0].imag; | |
1279 sseW[i][4*k + 5] = w[i][k+0].imag; | |
1280 sseW[i][4*k + 6] = -w[i][k+1].imag; | |
1281 sseW[i][4*k + 7] = w[i][k+1].imag; | |
1282 | |
1283 //we multiply more or less uninitalized numbers so we need to use exactly 0.0 | |
1284 if(k==0) | |
1285 { | |
1286 // sseW[i][4*k + 0]= sseW[i][4*k + 1]= 1.0; | |
1287 sseW[i][4*k + 4]= sseW[i][4*k + 5]= 0.0; | |
1288 } | |
1289 | |
1290 if(2*k == j) | |
1291 { | |
1292 sseW[i][4*k + 0]= sseW[i][4*k + 1]= 0.0; | |
1293 // sseW[i][4*k + 4]= -(sseW[i][4*k + 5]= -1.0); | |
1294 } | |
1295 } | |
1296 } | |
3552 | 1297 |
1298 for(i=0; i<128; i++) | |
1299 { | |
1300 sseWindow[2*i+0]= -imdct_window[2*i+0]; | |
3553 | 1301 sseWindow[2*i+1]= imdct_window[2*i+1]; |
3552 | 1302 } |
3553 | 1303 |
1304 for(i=0; i<64; i++) | |
1305 { | |
1306 sseWindow[256 + 2*i+0]= -imdct_window[254 - 2*i+1]; | |
1307 sseWindow[256 + 2*i+1]= imdct_window[254 - 2*i+0]; | |
1308 sseWindow[384 + 2*i+0]= imdct_window[126 - 2*i+1]; | |
1309 sseWindow[384 + 2*i+1]= -imdct_window[126 - 2*i+0]; | |
1310 } | |
16173 | 1311 #endif // ARCH_X86 || ARCH_X86_64 |
3579 | 1312 |
3720
120ac80f13c2
Fixed #ifdef discrepancy that was breaking compilation on PPC platform
melanson
parents:
3623
diff
changeset
|
1313 imdct_512 = imdct_do_512; |
16173 | 1314 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
4497 | 1315 if(mm_accel & MM_ACCEL_X86_SSE) |
1316 { | |
1317 fprintf (stderr, "Using SSE optimized IMDCT transform\n"); | |
1318 imdct_512 = imdct_do_512_sse; | |
1319 } | |
1320 else | |
1321 if(mm_accel & MM_ACCEL_X86_3DNOWEXT) | |
1322 { | |
1323 fprintf (stderr, "Using 3DNowEx optimized IMDCT transform\n"); | |
1324 imdct_512 = imdct_do_512_3dnowex; | |
1325 } | |
1326 else | |
1327 if(mm_accel & MM_ACCEL_X86_3DNOW) | |
1328 { | |
1329 fprintf (stderr, "Using 3DNow optimized IMDCT transform\n"); | |
1330 imdct_512 = imdct_do_512_3dnow; | |
1331 } | |
1332 else | |
16173 | 1333 #endif // ARCH_X86 || ARCH_X86_64 |
9001
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
1334 #ifdef HAVE_ALTIVEC |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
1335 if (mm_accel & MM_ACCEL_PPC_ALTIVEC) |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
1336 { |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
1337 fprintf(stderr, "Using AltiVec optimized IMDCT transform\n"); |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
1338 imdct_512 = imdct_do_512_altivec; |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
1339 } |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
1340 else |
01a9cf43074c
An AltiVec-enhanced IMDCT for liba52 (liba52/imdct.c)
arpi
parents:
8451
diff
changeset
|
1341 #endif |
4497 | 1342 fprintf (stderr, "No accelerated IMDCT transform found\n"); |
3394 | 1343 imdct_256 = imdct_do_256; |
1344 } | |
1345 } | |
3884 | 1346 |
1347 static void fft_asmb(int k, complex_t *x, complex_t *wTB, | |
1348 const complex_t *d, const complex_t *d_3) | |
1349 { | |
1350 register complex_t *x2k, *x3k, *x4k, *wB; | |
1351 register float a_r, a_i, a1_r, a1_i, u_r, u_i, v_r, v_i; | |
1352 | |
1353 x2k = x + 2 * k; | |
1354 x3k = x2k + 2 * k; | |
1355 x4k = x3k + 2 * k; | |
1356 wB = wTB + 2 * k; | |
1357 | |
1358 TRANSZERO(x[0],x2k[0],x3k[0],x4k[0]); | |
1359 TRANS(x[1],x2k[1],x3k[1],x4k[1],wTB[1],wB[1],d[1],d_3[1]); | |
1360 | |
1361 --k; | |
1362 for(;;) { | |
1363 TRANS(x[2],x2k[2],x3k[2],x4k[2],wTB[2],wB[2],d[2],d_3[2]); | |
1364 TRANS(x[3],x2k[3],x3k[3],x4k[3],wTB[3],wB[3],d[3],d_3[3]); | |
1365 if (!--k) break; | |
1366 x += 2; | |
1367 x2k += 2; | |
1368 x3k += 2; | |
1369 x4k += 2; | |
1370 d += 2; | |
1371 d_3 += 2; | |
1372 wTB += 2; | |
1373 wB += 2; | |
1374 } | |
1375 | |
1376 } | |
1377 | |
1378 static void fft_asmb16(complex_t *x, complex_t *wTB) | |
1379 { | |
1380 register float a_r, a_i, a1_r, a1_i, u_r, u_i, v_r, v_i; | |
1381 int k = 2; | |
1382 | |
1383 /* transform x[0], x[8], x[4], x[12] */ | |
1384 TRANSZERO(x[0],x[4],x[8],x[12]); | |
1385 | |
1386 /* transform x[1], x[9], x[5], x[13] */ | |
1387 TRANS(x[1],x[5],x[9],x[13],wTB[1],wTB[5],delta16[1],delta16_3[1]); | |
1388 | |
1389 /* transform x[2], x[10], x[6], x[14] */ | |
1390 TRANSHALF_16(x[2],x[6],x[10],x[14]); | |
1391 | |
1392 /* transform x[3], x[11], x[7], x[15] */ | |
1393 TRANS(x[3],x[7],x[11],x[15],wTB[3],wTB[7],delta16[3],delta16_3[3]); | |
1394 | |
1395 } | |
1396 | |
1397 static void fft_4(complex_t *x) | |
1398 { | |
1399 /* delta_p = 1 here */ | |
1400 /* x[k] = sum_{i=0..3} x[i] * w^{i*k}, w=e^{-2*pi/4} | |
1401 */ | |
1402 | |
1403 register float yt_r, yt_i, yb_r, yb_i, u_r, u_i, vi_r, vi_i; | |
1404 | |
1405 yt_r = x[0].real; | |
1406 yb_r = yt_r - x[2].real; | |
1407 yt_r += x[2].real; | |
1408 | |
1409 u_r = x[1].real; | |
1410 vi_i = x[3].real - u_r; | |
1411 u_r += x[3].real; | |
1412 | |
1413 u_i = x[1].imag; | |
1414 vi_r = u_i - x[3].imag; | |
1415 u_i += x[3].imag; | |
1416 | |
1417 yt_i = yt_r; | |
1418 yt_i += u_r; | |
1419 x[0].real = yt_i; | |
1420 yt_r -= u_r; | |
1421 x[2].real = yt_r; | |
1422 yt_i = yb_r; | |
1423 yt_i += vi_r; | |
1424 x[1].real = yt_i; | |
1425 yb_r -= vi_r; | |
1426 x[3].real = yb_r; | |
1427 | |
1428 yt_i = x[0].imag; | |
1429 yb_i = yt_i - x[2].imag; | |
1430 yt_i += x[2].imag; | |
1431 | |
1432 yt_r = yt_i; | |
1433 yt_r += u_i; | |
1434 x[0].imag = yt_r; | |
1435 yt_i -= u_i; | |
1436 x[2].imag = yt_i; | |
1437 yt_r = yb_i; | |
1438 yt_r += vi_i; | |
1439 x[1].imag = yt_r; | |
1440 yb_i -= vi_i; | |
1441 x[3].imag = yb_i; | |
1442 } | |
1443 | |
1444 | |
1445 static void fft_8(complex_t *x) | |
1446 { | |
1447 /* delta_p = diag{1, sqrt(i)} here */ | |
1448 /* x[k] = sum_{i=0..7} x[i] * w^{i*k}, w=e^{-2*pi/8} | |
1449 */ | |
1450 register float wT1_r, wT1_i, wB1_r, wB1_i, wT2_r, wT2_i, wB2_r, wB2_i; | |
1451 | |
1452 wT1_r = x[1].real; | |
1453 wT1_i = x[1].imag; | |
1454 wB1_r = x[3].real; | |
1455 wB1_i = x[3].imag; | |
1456 | |
1457 x[1] = x[2]; | |
1458 x[2] = x[4]; | |
1459 x[3] = x[6]; | |
1460 fft_4(&x[0]); | |
1461 | |
1462 | |
1463 /* x[0] x[4] */ | |
1464 wT2_r = x[5].real; | |
1465 wT2_r += x[7].real; | |
1466 wT2_r += wT1_r; | |
1467 wT2_r += wB1_r; | |
1468 wT2_i = wT2_r; | |
1469 wT2_r += x[0].real; | |
1470 wT2_i = x[0].real - wT2_i; | |
1471 x[0].real = wT2_r; | |
1472 x[4].real = wT2_i; | |
1473 | |
1474 wT2_i = x[5].imag; | |
1475 wT2_i += x[7].imag; | |
1476 wT2_i += wT1_i; | |
1477 wT2_i += wB1_i; | |
1478 wT2_r = wT2_i; | |
1479 wT2_r += x[0].imag; | |
1480 wT2_i = x[0].imag - wT2_i; | |
1481 x[0].imag = wT2_r; | |
1482 x[4].imag = wT2_i; | |
1483 | |
1484 /* x[2] x[6] */ | |
1485 wT2_r = x[5].imag; | |
1486 wT2_r -= x[7].imag; | |
1487 wT2_r += wT1_i; | |
1488 wT2_r -= wB1_i; | |
1489 wT2_i = wT2_r; | |
1490 wT2_r += x[2].real; | |
1491 wT2_i = x[2].real - wT2_i; | |
1492 x[2].real = wT2_r; | |
1493 x[6].real = wT2_i; | |
1494 | |
1495 wT2_i = x[5].real; | |
1496 wT2_i -= x[7].real; | |
1497 wT2_i += wT1_r; | |
1498 wT2_i -= wB1_r; | |
1499 wT2_r = wT2_i; | |
1500 wT2_r += x[2].imag; | |
1501 wT2_i = x[2].imag - wT2_i; | |
1502 x[2].imag = wT2_i; | |
1503 x[6].imag = wT2_r; | |
1504 | |
1505 | |
1506 /* x[1] x[5] */ | |
1507 wT2_r = wT1_r; | |
1508 wT2_r += wB1_i; | |
1509 wT2_r -= x[5].real; | |
1510 wT2_r -= x[7].imag; | |
1511 wT2_i = wT1_i; | |
1512 wT2_i -= wB1_r; | |
1513 wT2_i -= x[5].imag; | |
1514 wT2_i += x[7].real; | |
1515 | |
1516 wB2_r = wT2_r; | |
1517 wB2_r += wT2_i; | |
1518 wT2_i -= wT2_r; | |
1519 wB2_r *= HSQRT2; | |
1520 wT2_i *= HSQRT2; | |
1521 wT2_r = wB2_r; | |
1522 wB2_r += x[1].real; | |
1523 wT2_r = x[1].real - wT2_r; | |
1524 | |
1525 wB2_i = x[5].real; | |
1526 x[1].real = wB2_r; | |
1527 x[5].real = wT2_r; | |
1528 | |
1529 wT2_r = wT2_i; | |
1530 wT2_r += x[1].imag; | |
1531 wT2_i = x[1].imag - wT2_i; | |
1532 wB2_r = x[5].imag; | |
1533 x[1].imag = wT2_r; | |
1534 x[5].imag = wT2_i; | |
1535 | |
1536 /* x[3] x[7] */ | |
1537 wT1_r -= wB1_i; | |
1538 wT1_i += wB1_r; | |
1539 wB1_r = wB2_i - x[7].imag; | |
1540 wB1_i = wB2_r + x[7].real; | |
1541 wT1_r -= wB1_r; | |
1542 wT1_i -= wB1_i; | |
1543 wB1_r = wT1_r + wT1_i; | |
1544 wB1_r *= HSQRT2; | |
1545 wT1_i -= wT1_r; | |
1546 wT1_i *= HSQRT2; | |
1547 wB2_r = x[3].real; | |
1548 wB2_i = wB2_r + wT1_i; | |
1549 wB2_r -= wT1_i; | |
1550 x[3].real = wB2_i; | |
1551 x[7].real = wB2_r; | |
1552 wB2_i = x[3].imag; | |
1553 wB2_r = wB2_i + wB1_r; | |
1554 wB2_i -= wB1_r; | |
1555 x[3].imag = wB2_i; | |
1556 x[7].imag = wB2_r; | |
1557 } | |
1558 | |
1559 | |
1560 static void fft_128p(complex_t *a) | |
1561 { | |
1562 fft_8(&a[0]); fft_4(&a[8]); fft_4(&a[12]); | |
1563 fft_asmb16(&a[0], &a[8]); | |
1564 | |
1565 fft_8(&a[16]), fft_8(&a[24]); | |
1566 fft_asmb(4, &a[0], &a[16],&delta32[0], &delta32_3[0]); | |
1567 | |
1568 fft_8(&a[32]); fft_4(&a[40]); fft_4(&a[44]); | |
1569 fft_asmb16(&a[32], &a[40]); | |
1570 | |
1571 fft_8(&a[48]); fft_4(&a[56]); fft_4(&a[60]); | |
1572 fft_asmb16(&a[48], &a[56]); | |
1573 | |
1574 fft_asmb(8, &a[0], &a[32],&delta64[0], &delta64_3[0]); | |
1575 | |
1576 fft_8(&a[64]); fft_4(&a[72]); fft_4(&a[76]); | |
1577 /* fft_16(&a[64]); */ | |
1578 fft_asmb16(&a[64], &a[72]); | |
1579 | |
1580 fft_8(&a[80]); fft_8(&a[88]); | |
1581 | |
1582 /* fft_32(&a[64]); */ | |
1583 fft_asmb(4, &a[64], &a[80],&delta32[0], &delta32_3[0]); | |
1584 | |
1585 fft_8(&a[96]); fft_4(&a[104]), fft_4(&a[108]); | |
1586 /* fft_16(&a[96]); */ | |
1587 fft_asmb16(&a[96], &a[104]); | |
1588 | |
1589 fft_8(&a[112]), fft_8(&a[120]); | |
1590 /* fft_32(&a[96]); */ | |
1591 fft_asmb(4, &a[96], &a[112], &delta32[0], &delta32_3[0]); | |
1592 | |
1593 /* fft_128(&a[0]); */ | |
1594 fft_asmb(16, &a[0], &a[64], &delta128[0], &delta128_3[0]); | |
1595 } | |
1596 | |
1597 | |
1598 |