annotate liba52/imdct_3dnow.h @ 6364:2ef20eaf8c39

typo, noticed by Jonas Jermann
author gabucino
date Sun, 09 Jun 2002 21:07:13 +0000
parents d3aedd7db02c
children 330086b89d8f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4497
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
1 /*
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
2 3DNOW and 3DNOWEX optimized IMDCT
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
3 Licence: GPL v2
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
4 Copyrights: Nick Kurshev
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
5 */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
6
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
7 #undef FFT_4_3DNOW
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
8 #undef FFT_8_3DNOW
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
9 #undef FFT_ASMB_3DNOW
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
10 #undef FFT_ASMB16_3DNOW
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
11 #undef FFT_128P_3DNOW
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
12
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
13 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
14 #define FFT_4_3DNOW fft_4_3dnowex
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
15 #define FFT_8_3DNOW fft_8_3dnowex
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
16 #define FFT_ASMB_3DNOW fft_asmb_3dnowex
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
17 #define FFT_ASMB16_3DNOW fft_asmb16_3dnowex
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
18 #define FFT_128P_3DNOW fft_128p_3dnowex
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
19 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
20 #define FFT_4_3DNOW fft_4_3dnow
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
21 #define FFT_8_3DNOW fft_8_3dnow
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
22 #define FFT_ASMB_3DNOW fft_asmb_3dnow
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
23 #define FFT_ASMB16_3DNOW fft_asmb16_3dnow
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
24 #define FFT_128P_3DNOW fft_128p_3dnow
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
25 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
26
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
27 static void FFT_4_3DNOW(complex_t *x)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
28 {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
29 /* delta_p = 1 here */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
30 /* x[k] = sum_{i=0..3} x[i] * w^{i*k}, w=e^{-2*pi/4}
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
31 */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
32 __asm__ __volatile__(
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
33 "movq 24(%1), %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
34 "movq 8(%1), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
35 "pxor %2, %%mm3\n\t" /* mm3.re | -mm3.im */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
36 "pxor %3, %%mm1\n\t" /* -mm1.re | mm1.im */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
37 "pfadd %%mm1, %%mm3\n\t" /* vi.im = x[3].re - x[1].re; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
38 "movq %%mm3, %%mm4\n\t" /* vi.re =-x[3].im + x[1].im; mm4 = vi */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
39 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
40 "pswapd %%mm4, %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
41 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
42 "movq %%mm4, %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
43 "psrlq $32, %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
44 "punpckldq %%mm5, %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
45 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
46 "movq (%1), %%mm5\n\t" /* yb.re = x[0].re - x[2].re; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
47 "movq (%1), %%mm6\n\t" /* yt.re = x[0].re + x[2].re; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
48 "movq 24(%1), %%mm7\n\t" /* u.re = x[3].re + x[1].re; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
49 "pfsub 16(%1), %%mm5\n\t" /* yb.im = x[0].im - x[2].im; mm5 = yb */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
50 "pfadd 16(%1), %%mm6\n\t" /* yt.im = x[0].im + x[2].im; mm6 = yt */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
51 "pfadd 8(%1), %%mm7\n\t" /* u.im = x[3].im + x[1].im; mm7 = u */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
52
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
53 "movq %%mm6, %%mm0\n\t" /* x[0].re = yt.re + u.re; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
54 "movq %%mm5, %%mm1\n\t" /* x[1].re = yb.re + vi.re; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
55 "pfadd %%mm7, %%mm0\n\t" /*x[0].im = yt.im + u.im; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
56 "pfadd %%mm4, %%mm1\n\t" /* x[1].im = yb.im + vi.im; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
57 "movq %%mm0, (%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
58 "movq %%mm1, 8(%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
59
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
60 "pfsub %%mm7, %%mm6\n\t" /* x[2].re = yt.re - u.re; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
61 "pfsub %%mm4, %%mm5\n\t" /* x[3].re = yb.re - vi.re; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
62 "movq %%mm6, 16(%0)\n\t" /* x[2].im = yt.im - u.im; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
63 "movq %%mm5, 24(%0)" /* x[3].im = yb.im - vi.im; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
64 :"=r"(x)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
65 :"0"(x),
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
66 "m"(x_plus_minus_3dnow),
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
67 "m"(x_minus_plus_3dnow)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
68 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
69 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
70
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
71 static void FFT_8_3DNOW(complex_t *x)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
72 {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
73 /* delta_p = diag{1, sqrt(i)} here */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
74 /* x[k] = sum_{i=0..7} x[i] * w^{i*k}, w=e^{-2*pi/8}
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
75 */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
76 complex_t wT1, wB1, wB2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
77
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
78 __asm__ __volatile__(
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
79 "movq 8(%2), %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
80 "movq 24(%2), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
81 "movq %%mm0, %0\n\t" /* wT1 = x[1]; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
82 "movq %%mm1, %1\n\t" /* wB1 = x[3]; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
83 :"=m"(wT1), "=m"(wB1)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
84 :"r"(x)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
85 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
86
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
87 __asm__ __volatile__(
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
88 "movq 16(%0), %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
89 "movq 32(%0), %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
90 "movq %%mm2, 8(%0)\n\t" /* x[1] = x[2]; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
91 "movq 48(%0), %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
92 "movq %%mm3, 16(%0)\n\t" /* x[2] = x[4]; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
93 "movq %%mm4, 24(%0)\n\t" /* x[3] = x[6]; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
94 :"=r"(x)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
95 :"0"(x)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
96 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
97
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
98 fft_4_3dnow(&x[0]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
99
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
100 /* x[0] x[4] x[2] x[6] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
101
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
102 __asm__ __volatile__(
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
103 "movq 40(%1), %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
104 "movq %%mm0, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
105 "movq 56(%1), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
106 "pfadd %%mm1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
107 "pfsub %%mm1, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
108 "movq (%2), %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
109 "pfadd %%mm2, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
110 "pfadd %%mm2, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
111 "movq (%3), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
112 "pfadd %%mm1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
113 "pfsub %%mm1, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
114 "movq (%1), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
115 "movq 16(%1), %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
116 "movq %%mm1, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
117 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
118 "pswapd %%mm3, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
119 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
120 "movq %%mm3, %%mm6\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
121 "psrlq $32, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
122 "punpckldq %%mm6, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
123 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
124 "pfadd %%mm0, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
125 "movq %%mm4, %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
126 "pfsub %%mm0, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
127 "pfadd %%mm3, %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
128 "movq %%mm1, (%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
129 "pfsub %%mm3, %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
130 "movq %%mm2, 32(%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
131 "movd %%mm4, 16(%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
132 "movd %%mm5, 48(%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
133 "psrlq $32, %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
134 "psrlq $32, %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
135 "movd %%mm4, 52(%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
136 "movd %%mm5, 20(%0)"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
137 :"=r"(x)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
138 :"0"(x), "r"(&wT1), "r"(&wB1)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
139 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
140
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
141 /* x[1] x[5] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
142 __asm__ __volatile__ (
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
143 "movq %6, %%mm6\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
144 "movq %5, %%mm7\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
145 "movq %1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
146 "movq %2, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
147 "movq 56(%3), %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
148 "pfsub 40(%3), %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
149 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
150 "pswapd %%mm1, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
151 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
152 "movq %%mm1, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
153 "psrlq $32, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
154 "punpckldq %%mm2,%%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
155 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
156 "pxor %%mm7, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
157 "pfadd %%mm1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
158 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
159 "pswapd %%mm3, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
160 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
161 "movq %%mm3, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
162 "psrlq $32, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
163 "punpckldq %%mm2,%%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
164 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
165 "pxor %%mm6, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
166 "pfadd %%mm3, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
167 "movq %%mm0, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
168 "pxor %%mm6, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
169 "pfacc %%mm1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
170 "pfmul %4, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
171
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
172 "movq 40(%3), %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
173 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
174 "pswapd %%mm5, %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
175 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
176 "movq %%mm5, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
177 "psrlq $32, %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
178 "punpckldq %%mm1,%%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
179 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
180 "movq %%mm5, %0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
181
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
182 "movq 8(%3), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
183 "movq %%mm1, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
184 "pfsub %%mm0, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
185 "pfadd %%mm0, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
186 "movq %%mm1, 40(%3)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
187 "movq %%mm2, 8(%3)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
188 :"=m"(wB2)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
189 :"m"(wT1), "m"(wB1), "r"(x), "m"(HSQRT2_3DNOW),
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
190 "m"(x_plus_minus_3dnow), "m"(x_minus_plus_3dnow)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
191 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
192
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
193
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
194 /* x[3] x[7] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
195 __asm__ __volatile__(
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
196 "movq %1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
197 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
198 "pswapd %3, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
199 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
200 "movq %3, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
201 "psrlq $32, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
202 "punpckldq %3, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
203 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
204 "pxor %%mm6, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
205 "pfadd %%mm1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
206 "movq %2, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
207 "movq 56(%4), %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
208 "pxor %%mm7, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
209 "pfadd %%mm3, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
210 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
211 "pswapd %%mm2, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
212 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
213 "movq %%mm2, %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
214 "psrlq $32, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
215 "punpckldq %%mm5,%%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
216 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
217 "movq 24(%4), %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
218 "pfsub %%mm2, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
219 "movq %%mm3, %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
220 "movq %%mm0, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
221 "pxor %%mm6, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
222 "pfacc %%mm1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
223 "pfmul %5, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
224 "movq %%mm0, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
225 "pxor %%mm6, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
226 "pxor %%mm7, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
227 "pfadd %%mm1, %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
228 "pfadd %%mm0, %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
229 "movq %%mm4, 24(%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
230 "movq %%mm3, 56(%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
231 :"=r"(x)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
232 :"m"(wT1), "m"(wB2), "m"(wB1), "0"(x), "m"(HSQRT2_3DNOW)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
233 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
234 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
235
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
236 static void FFT_ASMB_3DNOW(int k, complex_t *x, complex_t *wTB,
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
237 const complex_t *d, const complex_t *d_3)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
238 {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
239 register complex_t *x2k, *x3k, *x4k, *wB;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
240
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
241 TRANS_FILL_MM6_MM7_3DNOW();
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
242 x2k = x + 2 * k;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
243 x3k = x2k + 2 * k;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
244 x4k = x3k + 2 * k;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
245 wB = wTB + 2 * k;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
246
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
247 TRANSZERO_3DNOW(x[0],x2k[0],x3k[0],x4k[0]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
248 TRANS_3DNOW(x[1],x2k[1],x3k[1],x4k[1],wTB[1],wB[1],d[1],d_3[1]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
249
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
250 --k;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
251 for(;;) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
252 TRANS_3DNOW(x[2],x2k[2],x3k[2],x4k[2],wTB[2],wB[2],d[2],d_3[2]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
253 TRANS_3DNOW(x[3],x2k[3],x3k[3],x4k[3],wTB[3],wB[3],d[3],d_3[3]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
254 if (!--k) break;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
255 x += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
256 x2k += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
257 x3k += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
258 x4k += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
259 d += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
260 d_3 += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
261 wTB += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
262 wB += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
263 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
264
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
265 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
266
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
267 void FFT_ASMB16_3DNOW(complex_t *x, complex_t *wTB)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
268 {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
269 int k = 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
270
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
271 TRANS_FILL_MM6_MM7_3DNOW();
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
272 /* transform x[0], x[8], x[4], x[12] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
273 TRANSZERO_3DNOW(x[0],x[4],x[8],x[12]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
274
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
275 /* transform x[1], x[9], x[5], x[13] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
276 TRANS_3DNOW(x[1],x[5],x[9],x[13],wTB[1],wTB[5],delta16[1],delta16_3[1]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
277
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
278 /* transform x[2], x[10], x[6], x[14] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
279 TRANSHALF_16_3DNOW(x[2],x[6],x[10],x[14]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
280
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
281 /* transform x[3], x[11], x[7], x[15] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
282 TRANS_3DNOW(x[3],x[7],x[11],x[15],wTB[3],wTB[7],delta16[3],delta16_3[3]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
283
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
284 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
285
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
286 static void FFT_128P_3DNOW(complex_t *a)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
287 {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
288 FFT_8_3DNOW(&a[0]); FFT_4_3DNOW(&a[8]); FFT_4_3DNOW(&a[12]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
289 FFT_ASMB16_3DNOW(&a[0], &a[8]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
290
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
291 FFT_8_3DNOW(&a[16]), FFT_8_3DNOW(&a[24]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
292 FFT_ASMB_3DNOW(4, &a[0], &a[16],&delta32[0], &delta32_3[0]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
293
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
294 FFT_8_3DNOW(&a[32]); FFT_4_3DNOW(&a[40]); FFT_4_3DNOW(&a[44]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
295 FFT_ASMB16_3DNOW(&a[32], &a[40]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
296
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
297 FFT_8_3DNOW(&a[48]); FFT_4_3DNOW(&a[56]); FFT_4_3DNOW(&a[60]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
298 FFT_ASMB16_3DNOW(&a[48], &a[56]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
299
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
300 FFT_ASMB_3DNOW(8, &a[0], &a[32],&delta64[0], &delta64_3[0]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
301
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
302 FFT_8_3DNOW(&a[64]); FFT_4_3DNOW(&a[72]); FFT_4_3DNOW(&a[76]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
303 /* FFT_16(&a[64]); */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
304 FFT_ASMB16_3DNOW(&a[64], &a[72]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
305
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
306 FFT_8_3DNOW(&a[80]); FFT_8_3DNOW(&a[88]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
307
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
308 /* FFT_32(&a[64]); */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
309 FFT_ASMB_3DNOW(4, &a[64], &a[80],&delta32[0], &delta32_3[0]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
310
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
311 FFT_8_3DNOW(&a[96]); FFT_4_3DNOW(&a[104]), FFT_4_3DNOW(&a[108]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
312 /* FFT_16(&a[96]); */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
313 FFT_ASMB16_3DNOW(&a[96], &a[104]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
314
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
315 FFT_8_3DNOW(&a[112]), FFT_8_3DNOW(&a[120]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
316 /* FFT_32(&a[96]); */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
317 FFT_ASMB_3DNOW(4, &a[96], &a[112], &delta32[0], &delta32_3[0]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
318
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
319 /* FFT_128(&a[0]); */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
320 FFT_ASMB_3DNOW(16, &a[0], &a[64], &delta128[0], &delta128_3[0]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
321 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
322
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
323 static void
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
324 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
325 imdct_do_512_3dnowex
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
326 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
327 imdct_do_512_3dnow
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
328 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
329 (sample_t data[],sample_t delay[], sample_t bias)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
330 {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
331 int i,k;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
332 int p,q;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
333 int m;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
334 int two_m;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
335 int two_m_plus_one;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
336
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
337 sample_t tmp_a_i;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
338 sample_t tmp_a_r;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
339 sample_t tmp_b_i;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
340 sample_t tmp_b_r;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
341
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
342 sample_t *data_ptr;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
343 sample_t *delay_ptr;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
344 sample_t *window_ptr;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
345
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
346 /* 512 IMDCT with source and dest data in 'data' */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
347
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
348 /* Pre IFFT complex multiply plus IFFT cmplx conjugate & reordering*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
349 #if 1
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
350 __asm__ __volatile__ (
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
351 "movq %0, %%mm7\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
352 ::"m"(x_plus_minus_3dnow)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
353 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
354 for( i=0; i < 128; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
355 int j = pm128[i];
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
356 __asm__ __volatile__ (
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
357 "movd %1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
358 "movd %3, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
359 "punpckldq %2, %%mm0\n\t" /* mm0 = data[256-2*j-1] | data[2*j]*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
360 "punpckldq %4, %%mm1\n\t" /* mm1 = xcos[j] | xsin[j] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
361 "movq %%mm0, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
362 "pfmul %%mm1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
363 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
364 "pswapd %%mm1, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
365 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
366 "movq %%mm1, %%mm5\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
367 "psrlq $32, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
368 "punpckldq %%mm5, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
369 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
370 "pfmul %%mm1, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
371 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
372 "pfpnacc %%mm2, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
373 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
374 "pxor %%mm7, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
375 "pfacc %%mm2, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
376 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
377 "pxor %%mm7, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
378 "movq %%mm0, %0"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
379 :"=m"(buf[i])
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
380 :"m"(data[256-2*j-1]), "m"(data[2*j]), "m"(xcos1[j]), "m"(xsin1[j])
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
381 :"memory"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
382 );
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
383 /* buf[i].re = (data[256-2*j-1] * xcos1[j] - data[2*j] * xsin1[j]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
384 buf[i].im = (data[256-2*j-1] * xsin1[j] + data[2*j] * xcos1[j])*(-1.0);*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
385 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
386 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
387 __asm__ __volatile__ ("femms":::"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
388 for( i=0; i < 128; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
389 /* z[i] = (X[256-2*i-1] + j * X[2*i]) * (xcos1[i] + j * xsin1[i]) ; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
390 int j= pm128[i];
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
391 buf[i].real = (data[256-2*j-1] * xcos1[j]) - (data[2*j] * xsin1[j]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
392 buf[i].imag = -1.0 * ((data[2*j] * xcos1[j]) + (data[256-2*j-1] * xsin1[j]));
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
393 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
394 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
395
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
396 /* FFT Merge */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
397 /* unoptimized variant
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
398 for (m=1; m < 7; m++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
399 if(m)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
400 two_m = (1 << m);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
401 else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
402 two_m = 1;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
403
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
404 two_m_plus_one = (1 << (m+1));
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
405
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
406 for(i = 0; i < 128; i += two_m_plus_one) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
407 for(k = 0; k < two_m; k++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
408 p = k + i;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
409 q = p + two_m;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
410 tmp_a_r = buf[p].real;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
411 tmp_a_i = buf[p].imag;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
412 tmp_b_r = buf[q].real * w[m][k].real - buf[q].imag * w[m][k].imag;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
413 tmp_b_i = buf[q].imag * w[m][k].real + buf[q].real * w[m][k].imag;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
414 buf[p].real = tmp_a_r + tmp_b_r;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
415 buf[p].imag = tmp_a_i + tmp_b_i;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
416 buf[q].real = tmp_a_r - tmp_b_r;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
417 buf[q].imag = tmp_a_i - tmp_b_i;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
418 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
419 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
420 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
421 */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
422
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
423 FFT_128P_3DNOW (&buf[0]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
424 // asm volatile ("femms \n\t":::"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
425
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
426 /* Post IFFT complex multiply plus IFFT complex conjugate*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
427 #if 1
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
428 __asm__ __volatile__ (
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
429 "movq %0, %%mm7\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
430 "movq %1, %%mm6\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
431 ::"m"(x_plus_minus_3dnow),
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
432 "m"(x_minus_plus_3dnow)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
433 :"eax","memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
434 for (i=0; i < 128; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
435 __asm__ __volatile__ (
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
436 "movq %1, %%mm0\n\t" /* ac3_buf[i].re | ac3_buf[i].im */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
437 "movq %%mm0, %%mm1\n\t" /* ac3_buf[i].re | ac3_buf[i].im */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
438 #ifndef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
439 "movq %%mm1, %%mm2\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
440 "psrlq $32, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
441 "punpckldq %%mm2, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
442 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
443 "pswapd %%mm1, %%mm1\n\t" /* ac3_buf[i].re | ac3_buf[i].im */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
444 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
445 "movd %3, %%mm3\n\t" /* ac3_xsin[i] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
446 "punpckldq %2, %%mm3\n\t" /* ac3_xsin[i] | ac3_xcos[i] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
447 "pfmul %%mm3, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
448 "pfmul %%mm3, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
449 #ifndef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
450 "pxor %%mm7, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
451 "pfacc %%mm1, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
452 "movd %%mm0, 4%0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
453 "psrlq $32, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
454 "movd %%mm0, %0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
455 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
456 "pfpnacc %%mm1, %%mm0\n\t" /* mm0 = mm0[0] - mm0[1] | mm1[0] + mm1[1] */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
457 "pswapd %%mm0, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
458 "movq %%mm0, %0"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
459 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
460 :"=m"(buf[i])
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
461 :"m"(buf[i]),"m"(xcos1[i]),"m"(xsin1[i])
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
462 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
463 /* ac3_buf[i].re =(tmp_a_r * ac3_xcos1[i]) + (tmp_a_i * ac3_xsin1[i]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
464 ac3_buf[i].im =(tmp_a_r * ac3_xsin1[i]) - (tmp_a_i * ac3_xcos1[i]);*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
465 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
466 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
467 __asm__ __volatile__ ("femms":::"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
468 for( i=0; i < 128; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
469 /* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
470 tmp_a_r = buf[i].real;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
471 tmp_a_i = -1.0 * buf[i].imag;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
472 buf[i].real =(tmp_a_r * xcos1[i]) - (tmp_a_i * xsin1[i]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
473 buf[i].imag =(tmp_a_r * xsin1[i]) + (tmp_a_i * xcos1[i]);
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
474 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
475 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
476
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
477 data_ptr = data;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
478 delay_ptr = delay;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
479 window_ptr = imdct_window;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
480
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
481 /* Window and convert to real valued signal */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
482 #if 1
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
483 asm volatile (
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
484 "movd (%0), %%mm3 \n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
485 "punpckldq %%mm3, %%mm3 \n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
486 :: "r" (&bias)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
487 );
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
488 for (i=0; i< 64; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
489 /* merge two loops in one to enable working of 2 decoders */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
490 __asm__ __volatile__ (
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
491 "movd 516(%1), %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
492 "movd (%1), %%mm1\n\t" /**data_ptr++=-buf[64+i].im**window_ptr+++*delay_ptr++;*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
493 "punpckldq (%2), %%mm0\n\t"/*data_ptr[128]=-buf[i].re*window_ptr[128]+delay_ptr[128];*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
494 "punpckldq 516(%2), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
495 "pfmul (%3), %%mm0\n\t"/**data_ptr++=buf[64-i-1].re**window_ptr+++*delay_ptr++;*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
496 "pfmul 512(%3), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
497 "pxor %%mm6, %%mm0\n\t"/*data_ptr[128]=buf[128-i-1].im*window_ptr[128]+delay_ptr[128];*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
498 "pxor %%mm6, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
499 "pfadd (%4), %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
500 "pfadd 512(%4), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
501 "pfadd %%mm3, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
502 "pfadd %%mm3, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
503 "movq %%mm0, (%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
504 "movq %%mm1, 512(%0)"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
505 :"=r"(data_ptr)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
506 :"r"(&buf[i].real), "r"(&buf[64-i-1].real), "r"(window_ptr), "r"(delay_ptr), "0"(data_ptr)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
507 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
508 data_ptr += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
509 window_ptr += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
510 delay_ptr += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
511 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
512 window_ptr += 128;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
513 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
514 __asm__ __volatile__ ("femms":::"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
515 for(i=0; i< 64; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
516 *data_ptr++ = -buf[64+i].imag * *window_ptr++ + *delay_ptr++ + bias;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
517 *data_ptr++ = buf[64-i-1].real * *window_ptr++ + *delay_ptr++ + bias;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
518 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
519
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
520 for(i=0; i< 64; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
521 *data_ptr++ = -buf[i].real * *window_ptr++ + *delay_ptr++ + bias;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
522 *data_ptr++ = buf[128-i-1].imag * *window_ptr++ + *delay_ptr++ + bias;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
523 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
524 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
525
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
526 /* The trailing edge of the window goes into the delay line */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
527 delay_ptr = delay;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
528 #if 1
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
529 for(i=0; i< 64; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
530 /* merge two loops in one to enable working of 2 decoders */
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
531 window_ptr -=2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
532 __asm__ __volatile__(
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
533 "movd 508(%1), %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
534 "movd (%1), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
535 "punpckldq (%2), %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
536 "punpckldq 508(%2), %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
537 #ifdef HAVE_3DNOWEX
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
538 "pswapd (%3), %%mm3\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
539 "pswapd -512(%3), %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
540 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
541 "movq (%3), %%mm3\n\t"/**delay_ptr++=-buf[64+i].re**--window_ptr;*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
542 "movq -512(%3), %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
543 "psrlq $32, %%mm3\n\t"/*delay_ptr[128]=buf[i].im**window_ptr[-512];*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
544 "psrlq $32, %%mm4\n\t"/**delay_ptr++=buf[64-i-1].im**--window_ptr;*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
545 "punpckldq (%3), %%mm3\n\t"/*delay_ptr[128]=-buf[128-i-1].re**window_ptr[-512];*/
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
546 "punpckldq -512(%3), %%mm4\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
547 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
548 "pfmul %%mm3, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
549 "pfmul %%mm4, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
550 "pxor %%mm6, %%mm0\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
551 "pxor %%mm7, %%mm1\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
552 "movq %%mm0, (%0)\n\t"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
553 "movq %%mm1, 512(%0)"
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
554 :"=r"(delay_ptr)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
555 :"r"(&buf[i].imag), "r"(&buf[64-i-1].imag), "r"(window_ptr), "0"(delay_ptr)
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
556 :"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
557 delay_ptr += 2;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
558 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
559 __asm__ __volatile__ ("femms":::"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
560 #else
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
561 __asm__ __volatile__ ("femms":::"memory");
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
562 for(i=0; i< 64; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
563 *delay_ptr++ = -buf[64+i].real * *--window_ptr;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
564 *delay_ptr++ = buf[64-i-1].imag * *--window_ptr;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
565 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
566
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
567 for(i=0; i<64; i++) {
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
568 *delay_ptr++ = buf[i].imag * *--window_ptr;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
569 *delay_ptr++ = -buf[128-i-1].real * *--window_ptr;
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
570 }
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
571 #endif
d3aedd7db02c Restore K7 support
nick
parents:
diff changeset
572 }