1;/*
2; * mdct.c ASM version for the XingMPG Decoder
3; * Include hybrid and FreqInvert functions
4; *
5; * Copyright (c) 1999, Jean-Michel HERVE
6; *
7; * This is hardcore coding, really! But should work pretty fine. If you find
8; * a bug mmmmh... tell me where :)
9; *
10; * Code : TuO / StG
11; * Date : 05/04/99
12; *
13; * This program 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; * This program 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., 675 Mass Ave, Cambridge, MA 02139, USA.
26; *
27; * $Id: mdctasm.asm,v 1.4 2000/10/13 14:29:02 ijr Exp $
28; */
29
30  BITS 32
31
32SECTION .data USE32
33
34GLOBAL _imdct18_asm
35GLOBAL _imdct6_3_asm
36GLOBAL _hybrid_asm
37GLOBAL _FreqInvert_asm
38
39EXTERN _mdct18w
40EXTERN _mdct18w2
41EXTERN _mdct6_3v
42EXTERN _mdct6_3v2
43EXTERN _coef
44EXTERN _coef87
45;EXTERN _win
46;EXTERN _band_limit_nsb
47
48WINSIZE equ 144
49
50;/* temp table */
51tab_a dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
52tab_b dd 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
53
54My_FPU_Half dd 0.5
55
56SaveReturn dd 0
57
58SECTION .text USE32
59
60;/*
61; * imdct18 ASM Version
62; */
63_imdct18_asm: ;// PROC f[]
64              ;//      ebp
65        push   ebp
66        lea    ebp,[esp+8]
67        pushad
68
69        mov    ebp,[ebp]               ;/* Save arg */
70        mov    edi,_mdct18w
71        mov    esi,_mdct18w2
72        mov    eax,tab_a
73        mov    ebx,tab_b
74        mov    ecx,_coef
75;/* Unroll the loop because it is a known-value count */
76%assign p 0                            ;/* Use compiler var as counter */
77%rep 4
78        ;/* First part - compute ap and bp */
79        fld    dword [edi+p*4]         ;/* w[p] */
80        fmul   dword [ebp+p*4]         ;/* g1 */
81        fld    dword [edi+(17-p)*4]    ;/* w[17-p] g1 */
82        fmul   dword [ebp+(17-p)*4]    ;/* g2 g1 */
83        fld    st0                     ;/* g2 g2 g1 */
84        fadd   st2                     ;/* ap g2 g1 */
85        fxch   st1                     ;/* g2 ap g1 */
86        fsubp  st2,st0                 ;/* ap g1-g2 */
87        fxch   st1                     ;/* g1-g2 ap */
88        fmul   dword [esi+p*4]         ;/* bp ap */
89
90        ;/* Second part - compute a8p and b8p */
91        fld    dword [edi+(8-p)*4]     ;/* w[8-p] bp ap */
92        fmul   dword [ebp+(8-p)*4]     ;/* g1 bp ap */
93        fld    dword [edi+(9+p)*4]     ;/* w[9+p] g1 bp ap */
94        fmul   dword [ebp+(9+p)*4]     ;/* g2 g1 bp ap */
95        fld    st0                     ;/* g2 g2 g1 bp ap */
96        fadd   st2                     ;/* a8p g2 g1 bp ap */
97        fxch   st1                     ;/* g2 a8p g1 bp ap */
98        fsubp  st2,st0                 ;/* a8p g1-g2 bp ap */
99        fxch   st1                     ;/* g1-g2 a8p bp ap */
100        fmul   dword [esi+(8-p)*4]     ;/* b8p a8p bp ap */
101
102        ;/* Final part - finalize computing and store values */
103        fld    st3                     ;/* ap b8p a8p bp ap */
104        fadd   st2                     ;/* ap+a8p b8p a8p bp ap */
105        fstp   dword [eax+p*4]         ;/* b8p a8p bp ap */
106        fxch   st1                     ;/* a8p b8p bp ap */
107        fsubp  st3,st0                 ;/* b8p bp ap-a8p */
108        fxch   st2                     ;/* ap-a8p bp b8p */
109        fstp   dword [eax+(p+5)*4]     ;/* bp b8p */
110        fxch   st1                     ;/* b8p bp */
111        fld    st0                     ;/* b8p b8p bp */
112        fadd   st2                     ;/* b8p+bp b8p bp */
113        fstp   dword [ebx+p*4]         ;/* b8p bp */
114        fsubp  st1,st0                 ;/* bp-b8p */
115        fstp   dword [ebx+(p+5)*4]     ;/* - */
116%assign p p+1
117%endrep
118
119%assign p 4
120        ;/* Last - finalize array */
121        fld    dword [edi+p*4]         ;/* w[p] */
122        fmul   dword [ebp+p*4]         ;/* g1 */
123        fld    dword [edi+(17-p)*4]    ;/* w[17-p] g1 */
124        fmul   dword [ebp+(17-p)*4]    ;/* g2 g1 */
125        fld    st0                     ;/* g2 g2 g1 */
126        fadd   st2                     ;/* ap g2 g1 */
127        fstp   dword [eax+p*4]         ;/* g2 g1 */
128        fsubp  st1,st0                 ;/* g1-g2 */
129        fmul   dword [esi+p*4]         ;/* bp */
130        fstp   dword [ebx+p*4]         ;/* - */
131
132;/* Now the huge and boring part */
133;//   f[0] = 0.5f * (a[0] + a[1] + a[2] + a[3] + a[4]);
134;// TO DO : avoid reload of a[4] and b[4]
135        fld    dword [eax+0*4]         ;/* a[0] */
136        fadd   dword [eax+1*4]         ;/* a[0]+a[1] */
137        fadd   dword [eax+2*4]         ;/* a[0]+a[1]+a[2] */
138        fadd   dword [eax+3*4]         ;/* a[0]+a[1]+a[2]+a[3] */
139        fadd   dword [eax+4*4]         ;/* a[0]+a[1]+a[2]+a[3]+a[4] */
140        fmul   dword [My_FPU_Half]       ;/* 0.5*(a[0]+a[1]+a[2]+a[3]+a[4]) */
141        fst    dword [ebp+0*4]         ;/* f[0] */
142;//   f[1] = 0.5f * (b[0] + b[1] + b[2] + b[3] + b[4]);
143        fld    dword [ebx+0*4]         ;/* b[0] f[0] */
144        fadd   dword [ebx+1*4]         ;/* b[0]+b[1] f[0] */
145        fadd   dword [ebx+2*4]         ;/* b[0]+b[1]+b[2] f[0] */
146        fadd   dword [ebx+3*4]         ;/* b[0]+b[1]+b[2]+b[3] f[0] */
147        fadd   dword [ebx+4*4]         ;/* b[0]+b[1]+b[2]+b[3]+b[4] f[0] */
148        fmul   dword [My_FPU_Half]       ;/* f[1]' f[0] */
149;//   f[2] = coef[1][0]*a[5]+coef[1][1]*a[6]+coef[1][2]*a[7]+coef[1][3]*a[8];
150        fld    dword [ecx+1*16+0*4]    ;/* coef[1][0]  f[1]' f[0] */
151        fld    dword [ecx+1*16+1*4]    ;/* coef[1][1]  coef[1][0] f[1]' f[0] */
152        fld    dword [ecx+1*16+2*4]    ;/* coef[1][2]  coef[1][1] coef[1][0] f[1]' f[0] */
153        fld    dword [ecx+1*16+3*4]    ;/* coef[1][3]  coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
154        fld    st3                     ;/* coef[1][0]  coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
155        fmul   dword [eax+5*4]         ;/* v0          coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
156        fld    st3                     ;/* coef[1][1]  v0         coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
157        fmul   dword [eax+6*4]         ;/* v1          v0         coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
158        faddp  st1,st0                 ;/* v1+v0       coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
159        fld    st2                     ;/* coef[1][2]  v1+v0      coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
160        fmul   dword [eax+7*4]         ;/* v2 v1+v0    coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
161        faddp  st1,st0                 ;/* v2+v1+v0    coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
162        fld    st1                     ;/* coef[1][3]  v2+v1+v0   coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
163        fmul   dword [eax+8*4]         ;/* v3 v2+v1+v0 coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
164        faddp  st1,st0                 ;/* f[2]'       coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
165;//   f[3] = coef[1][0]*b[5]+coef[1][1]*b[6]+coef[1][2]*b[7]+coef[1][3]*b[8]-f[1];
166        fxch   st4                     ;/* coef[1][0]  coef[1][3] coef[1][2] coef[1][1] f[2]'      f[1]' f[0] */
167        fmul   dword [ebx+5*4]         ;/* v0          coef[1][3] coef[1][2] coef[1][1] f[2]'      f[1]' f[0] */
168        fxch   st3                     ;/* coef[1][1]  coef[1][3] coef[1][2] v0         f[2]'      f[1]' f[0] */
169        fmul   dword [ebx+6*4]         ;/* v1          coef[1][3] coef[1][2] v0         f[2]'      f[1]' f[0] */
170        faddp  st3,st0                 ;/* coef[1][3]  coef[1][2] v0+v1      f[2]'      f[1]' f[0] */
171        fxch   st1                     ;/* coef[1][2]  coef[1][3] v0+v1      f[2]'      f[1]' f[0] */
172        fmul   dword [ebx+7*4]         ;/* v2          coef[1][3] v0+v1      f[2]'      f[1]' f[0] */
173        faddp  st2,st0                 ;/* coef[1][3]  v0+v1+v2   f[2]'      f[1]' f[0] */
174        fmul   dword [ebx+8*4]         ;/* v3          v0+v1+v2   f[2]'      f[1]' f[0] */
175        faddp  st1,st0                 ;/* v0+v1+v2+v3 f[2]'      f[1]' f[0] */
176        fsub   st0,st2                 ;/* f[3]'       f[2]'      f[1]' f[0] */
177;//   f[1] = f[1] - f[0];
178        fxch   st3                     ;/* f[0]        f[2]'      f[1]' f[3]' */
179        fsubp  st2,st0                 ;/* f[2]'       f[1]       f[3]' */
180        fxch   st1                     ;/* f[1]        f[2]'      f[3]' */
181        fst    dword [ebp+1*4]         ;/* f[1]        f[2]'      f[3]' */
182;//   f[2] = f[2] - f[1];
183        fsubp  st1,st0                 ;/* f[2]        f[3]' */
184        fst    dword [ebp+2*4]         ;/* f[2]        f[3]' */
185        fxch   st1                     ;/* f[3]'       f[2] */
186;//   f[4]=coef[2][0]*a[0]+coef[2][1]*a[1]+coef[2][2]*a[2]+coef[2][3]*a[3]-a[4];
187        fld    dword [ecx+2*16+0*4]    ;/* c[2,0] f[3]' f[2] */
188        fld    dword [ecx+2*16+1*4]    ;/* c[2,1] c[2,0] f[3]' f[2] */
189        fld    dword [ecx+2*16+2*4]    ;/* c[2,2] c[2,1] c[2,0] f[3]' f[2] */
190        fld    dword [ecx+2*16+3*4]    ;/* c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
191        fld    st3                     ;/* c[2,0] c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
192        fmul   dword [eax+0*4]         ;/* v0     c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
193        fld    st3                     ;/* c[2,1] v0     c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
194        fmul   dword [eax+1*4]         ;/* v1     v0     c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
195        faddp  st1,st0                 ;/* v1+v0  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
196        fld    st2                     ;/* c[2,2] v1+v0  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
197        fmul   dword [eax+2*4]         ;/* v2     v1+v0  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
198        faddp  st1,st0                 ;/* v0v1v2 c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
199        fld    st1                     ;/* c[2,3] v0v1v2 c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
200        fmul   dword [eax+3*4]         ;/* v3     v0v1v2 c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
201        faddp  st1,st0                 ;/* f[4]'  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
202        fsub   dword [eax+4*4]         ;/* f[4]'  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
203        fxch   st4                     ;/* c[2,0] c[2,3] c[2,2] c[2,1] f[4]'  f[3]' f[2] */
204;//   f[5]=coef[2][0]*b[0]+coef[2][1]*b[1]+coef[2][2]*b[2]+coef[2][3]*b[3]-b[4]-f[3];
205        fmul   dword [ebx+0*4]         ;/* v0     c[2,3] c[2,2] c[2,1] f[4]'  f[3]' f[2] */
206        fxch   st3                     ;/* c[2,1] c[2,3] c[2,2] v0     f[4]'  f[3]' f[2] */
207        fmul   dword [ebx+1*4]         ;/* v1     c[2,3] c[2,2] v0     f[4]'  f[3]' f[2] */
208        faddp  st3,st0                 ;/* c[2,3] c[2,2] v0+v1  f[4]'  f[3]' f[2] */
209        fxch   st1                     ;/* c[2,2] c[2,3] v0+v1  f[4]'  f[3]' f[2] */
210        fmul   dword [ebx+2*4]         ;/* v2     c[2,3] v0+v1  f[4]'  f[3]' f[2] */
211        faddp  st2,st0                 ;/* c[2,3] v0v1v2 f[4]'  f[3]' f[2] */
212        fmul   dword [ebx+3*4]         ;/* v3     v0v1v2 f[4]'  f[3]' f[2] */
213        faddp  st1,st0                 ;/* f[5]'' f[4]'  f[3]' f[2] */
214        fsub   dword [ebx+4*4]         ;/* f[5]'' f[4]'  f[3]' f[2] */
215        fsub   st2                     ;/* f[5]'  f[4]'  f[3]' f[2] */
216;//   f[3] = f[3] - f[2];
217        fxch   st3                     ;/* f[2]   f[4]'  f[3]' f[5]' */
218        fsubp  st2,st0                 ;/* f[4]'  f[3]   f[5]' */
219        fxch   st1                     ;/* f[3]   f[4]'  f[5]' */
220        fst    dword [ebp+3*4]         ;/* f[3]   f[4]'  f[5]' */
221;//   f[4] = f[4] - f[3];
222        fsubp  st1,st0                 ;/* f[4]   f[5]' */
223        fst    dword [ebp+4*4]         ;/* f[4]   f[5]' */
224        fxch   st1                     ;/* f[5]'  f[4] */
225;//   f[6] = coef[3][0] * (a[5] - a[7] - a[8]);
226        fld    dword [eax+5*4]         ;/* a[5] f[5]' f[4] */
227        fsub   dword [eax+7*4]         ;/* a[5]-a[7] f[5]' f[4] */
228        fsub   dword [eax+8*4]         ;/* a[5]-a[7]-a[8] f[5]' f[4] */
229        fmul   dword [ecx+3*16+0*4]    ;/* f[6]' f[5]' f[4] */
230;//   f[7] = coef[3][0] * (b[5] - b[7] - b[8]) - f[5];
231        fld    dword [ebx+5*4]         ;/* b[5] f[6]' f[5]' f[4] */
232        fsub   dword [ebx+7*4]         ;/* b[5]-b[7] f[6]' f[5]' f[4] */
233        fsub   dword [ebx+8*4]         ;/* b[5]-b[7]-b[8] f[6]' f[5]' f[4] */
234        fmul   dword [ecx+3*16+0*4]    ;/* c[3,0]*(b5-b7-b8) f[6]' f[5]' f[4] */
235        fsub   st2                     ;/* f[7]' f[6]' f[5]' f[4] */
236;//   f[5] = f[5] - f[4];
237        fxch   st3                     ;/* f[4] f[6]' f[5]' f[7]' */
238        fsubp  st2,st0                 ;/* f[6]' f[5] f[7]' */
239        fxch   st1                     ;/* f[5] f[6]' f[7]' */
240        fst    dword [ebp+5*4]         ;/* f[5] f[6]' f[7]' */
241;//   f[6] = f[6] - f[5];
242        fsubp  st1,st0                 ;/* f[6] f[7]' */
243        fst    dword [ebp+6*4]         ;/* f[6] f[7]' */
244        fxch   st1                     ;/* f[7]' f[6] */
245;//   f[8] = coef[4][0]*a[0]+coef[4][1]*a[1]+coef[4][2]*a[2]+coef[4][3]*a[3]+a[4];
246        fld    dword [ecx+4*16+0*4]    ;/* c[4,0] f[7]' f[6] */
247        fld    dword [ecx+4*16+1*4]    ;/* c[4,1] c[4,0] f[7]' f[6] */
248        fld    dword [ecx+4*16+2*4]    ;/* c[4,2] c[4,1] c[4,0] f[7]' f[6] */
249        fld    dword [ecx+4*16+3*4]    ;/* c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
250        fld    st3                     ;/* c[4,0] c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
251        fmul   dword [eax+0*4]         ;/* v0     c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
252        fld    st3                     ;/* c[4,1] v0     c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
253        fmul   dword [eax+1*4]         ;/* v1     v0     c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
254        faddp  st1,st0                 ;/* v1+v0  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
255        fld    st2                     ;/* c[4,2] v1+v0  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
256        fmul   dword [eax+2*4]         ;/* v2     v1+v0  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
257        faddp  st1,st0                 ;/* v0v1v2 c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
258        fld    st1                     ;/* c[4,3] v0v1v2 c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
259        fmul   dword [eax+3*4]         ;/* v3     v0v1v2 c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
260        faddp  st1,st0                 ;/* f[8]'  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
261        fadd   dword [eax+4*4]         ;/* f[8]'  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */        ;// CHECK HERE
262        fxch   st4                     ;/* c[4,0] c[4,3] c[4,2] c[4,1] f[8]'  f[7]' f[6] */
263;//   f[9] = coef[4][0]*b[0]+coef[4][1]*b[1]+coef[4][2]*b[2]+coef[4][3]*b[3]+b[4]-f[7];
264        fmul   dword [ebx+0*4]         ;/* v0     c[4,3] c[4,2] c[4,1] f[8]'  f[7]' f[6] */
265        fxch   st3                     ;/* c[4,1] c[4,3] c[4,2] v0     f[8]'  f[7]' f[6] */
266        fmul   dword [ebx+1*4]         ;/* v1     c[4,3] c[4,2] v0     f[8]'  f[7]' f[6] */
267        faddp  st3,st0                 ;/* c[4,3] c[4,2] v0+v1  f[8]'  f[7]' f[6] */
268        fxch   st1                     ;/* c[4,2] c[4,3] v0+v1  f[8]'  f[7]' f[6] */
269        fmul   dword [ebx+2*4]         ;/* v2     c[4,3] v0+v1  f[8]'  f[7]' f[6] */
270        faddp  st2,st0                 ;/* c[4,3] v0v1v2 f[8]'  f[7]' f[6] */
271        fmul   dword [ebx+3*4]         ;/* v3     v0v1v2 f[8]'  f[7]' f[6] */
272        faddp  st1,st0                 ;/* f[9]'' f[8]'  f[7]' f[6] */
273        fadd   dword [ebx+4*4]         ;/* f[9]'' f[8]'  f[7]' f[6] */  ;// CHECK HERE
274        fsub   st2                     ;/* f[9]'  f[8]'  f[7]' f[6] */
275;//   f[7] = f[7] - f[6];
276        fxch   st3                     ;/* f[6]   f[8]'  f[7]' f[9]' */
277        fsubp  st2,st0                 ;/* f[8]'  f[7]   f[9]' */
278        fxch   st1                     ;/* f[7]   f[8]'  f[9]' */
279        fst    dword [ebp+7*4]         ;/* f[7]   f[8]'  f[9]' */
280;//   f[8] = f[8] - f[7];
281        fsubp  st1,st0                 ;/* f[8]   f[9]' */
282        fst    dword [ebp+8*4]         ;/* f[8]   f[9]' */
283        fxch   st1                     ;/* f[9]'  f[8] */
284;//   f[10] = coef[5][0]*a[5]+coef[5][1]*a[6]+coef[5][2]*a[7]+coef[5][3]*a[8];
285        fld    dword [ecx+5*16+0*4]    ;/* coef[5][0]  f[9]' f[8] */
286        fld    dword [ecx+5*16+1*4]    ;/* coef[5][1]  coef[5][0] f[9]' f[8] */
287        fld    dword [ecx+5*16+2*4]    ;/* coef[5][2]  coef[5][1] coef[5][0] f[9]' f[8] */
288        fld    dword [ecx+5*16+3*4]    ;/* coef[5][3]  coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
289        fld    st3                     ;/* coef[5][0]  coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
290        fmul   dword [eax+5*4]         ;/* v0          coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
291        fld    st3                     ;/* coef[5][1]  v0         coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
292        fmul   dword [eax+6*4]         ;/* v1          v0         coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
293        faddp  st1,st0                 ;/* v1+v0       coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
294        fld    st2                     ;/* coef[5][2]  v1+v0      coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
295        fmul   dword [eax+7*4]         ;/* v2 v1+v0    coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
296        faddp  st1,st0                 ;/* v2+v1+v0    coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
297        fld    st1                     ;/* coef[5][3]  v2+v1+v0   coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
298        fmul   dword [eax+8*4]         ;/* v3 v2+v1+v0 coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
299        faddp  st1,st0                 ;/* f[10]'      coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
300;//   f[11] = coef[5][0]*b[5]+coef[5][1]*b[6]+coef[5][2]*b[7]+coef[5][3]*b[8]-f[9];
301        fxch   st4                     ;/* coef[5][0]  coef[5][3] coef[5][2] coef[5][1] f[10]'     f[9]' f[8] */
302        fmul   dword [ebx+5*4]         ;/* v0          coef[5][3] coef[5][2] coef[5][1] f[10]'     f[9]' f[8] */
303        fxch   st3                     ;/* coef[5][1]  coef[5][3] coef[5][2] v0         f[10]'     f[9]' f[8] */
304        fmul   dword [ebx+6*4]         ;/* v1          coef[5][3] coef[5][2] v0         f[10]'     f[9]' f[8] */
305        faddp  st3,st0                 ;/* coef[5][3]  coef[5][2] v0+v1      f[10]'     f[9]' f[8] */
306        fxch   st1                     ;/* coef[5][2]  coef[5][3] v0+v1      f[10]'     f[9]' f[8] */
307        fmul   dword [ebx+7*4]         ;/* v2          coef[5][3] v0+v1      f[10]'     f[9]' f[8] */
308        faddp  st2,st0                 ;/* coef[5][3]  v0+v1+v2   f[10]'     f[9]' f[8] */
309        fmul   dword [ebx+8*4]         ;/* v3          v0+v1+v2   f[10]'     f[9]' f[8] */
310        faddp  st1,st0                 ;/* v0+v1+v2+v3 f[10]'     f[9]' f[8] */
311        fsub   st0,st2                 ;/* f[11]'      f[10]'     f[9]' f[8] */
312;//   f[9] = f[9] - f[8];
313        fxch   st3                     ;/* f[8]        f[10]'     f[9]' f[11]' */
314        fsubp  st2,st0                 ;/* f[10]'      f[9]       f[11]' */
315        fxch   st1                     ;/* f[9]        f[10]'     f[11]' */
316        fst    dword [ebp+9*4]         ;/* f[9]        f[10]'     f[11]' */
317;//   f[10] = f[10] - f[9];
318        fsubp  st1,st0                 ;/* f[10]       f[11]' */
319        fst    dword [ebp+10*4]        ;/* f[10]       f[11]' */
320        fxch   st1                     ;/* f[11]'      f[10]  */
321;//   f[12] = 0.5f * (a[0] + a[2] + a[3]) - a[1] - a[4];
322        fld    dword [eax+0*4]         ;/* a[0] f[11]' f[10]  */
323        fadd   dword [eax+2*4]         ;/* a[0]+a[2] f[11]' f[10]  */
324        fadd   dword [eax+3*4]         ;/* a[0]+a[2]+a[3] f[11]' f[10]  */
325        fmul   dword [My_FPU_Half]       ;/* 0.5*(a[0]+a[2]+a[3]) f[11]' f[10]  */
326        fsub   dword [eax+1*4]         ;/* 0.5*(a[0]+a[2]+a[3])-a[1] f[11]' f[10]  */
327        fsub   dword [eax+4*4]         ;/* f[12]' f[11]' f[10]  */
328;//   f[13] = 0.5f * (b[0] + b[2] + b[3]) - b[1] - b[4] - f[11];
329        fld    dword [ebx+0*4]         ;/* b[0] f[12]' f[11]' f[10]  */
330        fadd   dword [ebx+2*4]         ;/* b[0]+b[2] f[12]' f[11]' f[10]  */
331        fadd   dword [ebx+3*4]         ;/* b[0]+b[2]+b[3] f[12]' f[11]' f[10]  */
332        fmul   dword [My_FPU_Half]       ;/* 0.5*(b[0]+b[2]+b[3]) f[12]' f[11]' f[10]  */
333        fsub   dword [ebx+1*4]         ;/* 0.5*(b[0]+b[2]+b[3])-b[1] f[12]' f[11]' f[10]  */
334        fsub   dword [ebx+4*4]         ;/* 0.5*(b[0]+b[2]+b[3])-b[1]-b[4] f[12]' f[11]' f[10]  */
335        fsub   st2                     ;/* f[13]' f[12]' f[11]' f[10]  */
336;//   f[11] = f[11] - f[10];
337        fxch   st3                     ;/* f[10]  f[12]' f[11]' f[13]' */
338        fsubp  st2,st0                 ;/* f[12]' f[11]  f[13]' */
339        fxch   st1                     ;/* f[11]  f[12]' f[13]' */
340        fst    dword [ebp+11*4]        ;/* f[11]  f[12]' f[13]' */
341;//   f[12] = f[12] - f[11];
342        fsubp  st1,st0                 ;/* f[12]       f[13]' */
343        fst    dword [ebp+12*4]        ;/* f[12]       f[13]' */
344        fxch   st1                     ;/* f[13]'      f[12]  */
345;//   f[14] = coef[7][0]*a[5]+coef[7][1]*a[6]+coef[7][2]*a[7]+coef[7][3]*a[8];
346        fld    dword [ecx+7*16+0*4]    ;/* coef[7][0]  f[13]' f[12] */
347        fld    dword [ecx+7*16+1*4]    ;/* coef[7][1]  coef[7][0] f[13]' f[12] */
348        fld    dword [ecx+7*16+2*4]    ;/* coef[7][2]  coef[7][1] coef[7][0] f[13]' f[12] */
349        fld    dword [ecx+7*16+3*4]    ;/* coef[7][3]  coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
350        fld    st3                     ;/* coef[7][0]  coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
351        fmul   dword [eax+5*4]         ;/* v0          coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
352        fld    st3                     ;/* coef[7][1]  v0         coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
353        fmul   dword [eax+6*4]         ;/* v1          v0         coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
354        faddp  st1,st0                 ;/* v1+v0       coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
355        fld    st2                     ;/* coef[7][2]  v1+v0      coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
356        fmul   dword [eax+7*4]         ;/* v2 v1+v0    coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
357        faddp  st1,st0                 ;/* v2+v1+v0    coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
358        fld    st1                     ;/* coef[7][3]  v2+v1+v0   coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
359        fmul   dword [eax+8*4]         ;/* v3 v2+v1+v0 coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
360        faddp  st1,st0                 ;/* f[14]'      coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
361;//   f[15] = coef[7][0]*b[5]+coef[7][1]*b[6]+coef[7][2]*b[7]+coef[7][3]*b[8]-f[13];
362        fxch   st4                     ;/* coef[7][0]  coef[7][3] coef[7][2] coef[7][1] f[14]'     f[13]' f[12] */
363        fmul   dword [ebx+5*4]         ;/* v0          coef[7][3] coef[7][2] coef[7][1] f[14]'     f[13]' f[12] */
364        fxch   st3                     ;/* coef[7][1]  coef[7][3] coef[7][2] v0         f[14]'     f[13]' f[12] */
365        fmul   dword [ebx+6*4]         ;/* v1          coef[7][3] coef[7][2] v0         f[14]'     f[13]' f[12] */
366        faddp  st3,st0                 ;/* coef[7][3]  coef[7][2] v0+v1      f[14]'     f[13]' f[12] */
367        fxch   st1                     ;/* coef[7][2]  coef[7][3] v0+v1      f[14]'     f[13]' f[12] */
368        fmul   dword [ebx+7*4]         ;/* v2          coef[7][3] v0+v1      f[14]'     f[13]' f[12] */
369        faddp  st2,st0                 ;/* coef[7][3]  v0+v1+v2   f[14]'     f[13]' f[12] */
370        fmul   dword [ebx+8*4]         ;/* v3          v0+v1+v2   f[14]'     f[13]' f[12] */
371        faddp  st1,st0                 ;/* v0+v1+v2+v3 f[14]'     f[13]' f[12] */
372        fsub   st0,st2                 ;/* f[15]'      f[14]'     f[13]' f[12] */
373;//   f[13] = f[13] - f[12];
374        fxch   st3                     ;/* f[12]  f[14]' f[13]' f[15]' */
375        fsubp  st2,st0                 ;/* f[14]' f[13]  f[15]' */
376        fxch   st1                     ;/* f[13]  f[14]' f[15]' */
377        fst    dword [ebp+13*4]        ;/* f[13]  f[14]' f[15]' */
378;//   f[14] = f[14] - f[13];
379        fsubp  st1,st0                 ;/* f[14]       f[15]' */
380        fst    dword [ebp+14*4]        ;/* f[14]       f[15]' */
381        fxch   st1                     ;/* f[15]'      f[14]  */
382;//   f[16] = coef[8][0]*a[0]+coef[8][1]*a[1]+coef[8][2]*a[2]+coef[8][3]*a[3]+a[4];
383        fld    dword [ecx+8*16+0*4]    ;/* c[8,0] f[15]' f[14] */
384        fld    dword [ecx+8*16+1*4]    ;/* c[8,1] c[8,0] f[15]' f[14] */
385        fld    dword [ecx+8*16+2*4]    ;/* c[8,2] c[8,1] c[8,0] f[15]' f[14] */
386        fld    dword [ecx+8*16+3*4]    ;/* c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
387        fld    st3                     ;/* c[8,0] c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
388        fmul   dword [eax+0*4]         ;/* v0     c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
389        fld    st3                     ;/* c[8,1] v0     c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
390        fmul   dword [eax+1*4]         ;/* v1     v0     c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
391        faddp  st1,st0                 ;/* v1+v0  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
392        fld    st2                     ;/* c[8,2] v1+v0  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
393        fmul   dword [eax+2*4]         ;/* v2     v1+v0  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
394        faddp  st1,st0                 ;/* v0v1v2 c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
395        fld    st1                     ;/* c[8,3] v0v1v2 c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
396        fmul   dword [eax+3*4]         ;/* v3     v0v1v2 c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
397        faddp  st1,st0                 ;/* f[8]'  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
398        fadd   dword [eax+4*4]         ;/* f[8]'  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */        ;// CHECK HERE
399        fxch   st4                     ;/* c[8,0] c[8,3] c[8,2] c[8,1] f[16]' f[15]' f[14] */
400;//   f[17] = coef[8][0]*b[0]+coef[8][1]*b[1]+coef[8][2]*b[2]+coef[8][3]*b[3]+b[4]-f[15];
401        fmul   dword [ebx+0*4]         ;/* v0     c[8,3] c[8,2] c[8,1] f[16]'  f[15]' f[14] */
402        fxch   st3                     ;/* c[8,1] c[8,3] c[8,2] v0     f[16]'  f[15]' f[14] */
403        fmul   dword [ebx+1*4]         ;/* v1     c[8,3] c[8,2] v0     f[16]'  f[15]' f[14] */
404        faddp  st3,st0                 ;/* c[8,3] c[8,2] v0+v1  f[16]'  f[15]' f[14] */
405        fxch   st1                     ;/* c[8,2] c[8,3] v0+v1  f[16]'  f[15]' f[14] */
406        fmul   dword [ebx+2*4]         ;/* v2     c[8,3] v0+v1  f[16]'  f[15]' f[14] */
407        faddp  st2,st0                 ;/* c[8,3] v0v1v2 f[16]'  f[15]' f[14] */
408        fmul   dword [ebx+3*4]         ;/* v3     v0v1v2 f[16]'  f[15]' f[14] */
409        faddp  st1,st0                 ;/* f[17]'' f[16]'  f[15]' f[14] */
410        fadd   dword [ebx+4*4]         ;/* f[17]'' f[16]'  f[15]' f[14] */  ;// CHECK HERE
411        fsub   st0,st2                 ;/* f[17]'  f[16]'  f[15]' f[14] */
412;//   f[15] = f[15] - f[14];
413        fxch   st3                     ;/* f[14]  f[16]' f[15]' f[17]' */
414        fsubp  st2,st0                 ;/* f[16]' f[15]  f[17]' */
415        fxch   st1                     ;/* f[15]  f[16]' f[17]' */
416        fst    dword [ebp+15*4]        ;/* f[15]  f[16]' f[17]' */
417;//   f[16] = f[16] - f[15];
418        fsubp  st1,st0                 ;/* f[16]       f[17]' */
419        fst    dword [ebp+16*4]        ;/* f[16]       f[17]' */
420;//   f[17] = f[17] - f[16];
421        fsubp  st1,st0                 ;/* f[17] */
422        fstp   dword [ebp+17*4]        ;/* - */
423
424        popad
425        pop    ebp
426        ret
427
428;/*
429; * imdct6_3 ASM Version
430; */
431_imdct6_3_asm: ;// PROC f[]
432               ;//      ebp
433        push   ebp
434        lea    ebp,[esp+8]
435        pushad
436
437        mov    ebp,[ebp]               ;/* Save arg */
438        mov    edi,_mdct6_3v
439        mov    esi,_mdct6_3v2
440        mov    eax,tab_a
441;/* Unroll the loop because it is a known-value count */
442%assign p 0
443%rep 3
444;//      g1 = v[0] * f[3 * 0];
445        fld    dword [ebp+(p+(3*0))*4] ;/* f[3*0] */
446        fmul   dword [edi+0*4]         ;/* g1 */
447;//      g2 = v[5] * f[3 * 5];
448        fld    dword [ebp+(p+(3*5))*4] ;/* f[3*5] g1 */
449        fmul   dword [edi+5*4]         ;/* g2 g1 */
450;//      a[0] = g1 + g2;
451        fld    st0                     ;/* g2 g2 g1 */
452        fadd   st2                     ;/* a[0] g2 g1 */
453        fstp   dword [eax+(p*6+0)*4]   ;/* g2 g1 */
454;//      a[3 + 0] = v2[0] * (g1 - g2);
455        fsubp  st1,st0                 ;/* g1-g2 */
456        fmul   dword [esi+0*4]         ;/* a[3+0] */
457        fstp   dword [eax+(p*6+3)*4]   ;/* - */
458
459;//      g1 = v[1] * f[3 * 1];
460        fld    dword [ebp+(p+(3*1))*4] ;/* f[3*1] */
461        fmul   dword [edi+1*4]         ;/* g1 */
462;//      g2 = v[4] * f[3 * 4];
463        fld    dword [ebp+(p+(3*4))*4] ;/* f[3*4] g1 */
464        fmul   dword [edi+4*4]         ;/* g2 g1 */
465;//      a[1] = g1 + g2;
466        fld    st0                     ;/* g2 g2 g1 */
467        fadd   st2                     ;/* a[1] g2 g1 */
468        fstp   dword [eax+(p*6+1)*4]   ;/* g2 g1 */
469;//      a[3 + 1] = v2[1] * (g1 - g2);
470        fsubp  st1,st0                 ;/* g1-g2 */
471        fmul   dword [esi+1*4]         ;/* a[3+1] */
472        fstp   dword [eax+(p*6+3+1)*4] ;/* - */
473
474;//      g1 = v[2] * f[3 * 2];
475        fld    dword [ebp+(p+(3*2))*4] ;/* f[3*2] */
476        fmul   dword [edi+2*4]         ;/* g1 */
477;//      g2 = v[3] * f[3 * 3];
478        fld    dword [ebp+(p+(3*3))*4] ;/* f[3*3] g1 */
479        fmul   dword [edi+3*4]         ;/* g2 g1 */
480;//      a[2] = g1 + g2;
481        fld    st0                     ;/* g2 g2 g1 */
482        fadd   st2                     ;/* a[2] g2 g1 */
483        fstp   dword [eax+(p*6+2)*4]   ;/* g2 g1 */
484;//      a[3 + 2] = v2[2] * (g1 - g2);
485        fsubp  st1,st0                 ;/* g1-g2 */
486        fmul   dword [esi+2*4]         ;/* a[3+2] */
487        fstp   dword [eax+(p*6+3+2)*4] ;/* - */
488%assign p p+1
489%endrep
490
491;/* Unroll the loop because it is a known-value count */
492%assign p 0
493%rep 3
494;//      a02 = (a[0] + a[2]);
495        fld    dword [eax+(p*6+0)*4]   ;/* a[0] */
496        fadd   dword [eax+(p*6+2)*4]   ;/* a02 */
497;//      b02 = (a[3 + 0] + a[3 + 2]);
498        fld    dword [eax+(p*6+3+0)*4] ;/* a[3+0] a02 */
499        fadd   dword [eax+(p*6+3+2)*4] ;/* b02 a02 */
500;//      c[0] = a02 + a[1];
501        fld    st1                     ;/* a02 b02 a02 */
502        fadd   dword [eax+(p*6+1)*4]   ;/* c[0] b02 a02 */
503        fst    dword [ebp+(p*6+0)*4]   ;/* c[0] b02 a02 */
504;//      c[1] = b02 + a[3 + 1];
505        fld    st1                     ;/* b02 c[0] b02 a02 */
506        fadd   dword [eax+(p*6+3+1)*4] ;/* c[1]' c[0] b02 a02 */
507;//      c[2] = coef87 * (a[0] - a[2]);
508        fld    dword [eax+(p*6+0)*4]   ;/* a[0] c[1]' c[0] b02 a02 */
509        fsub   dword [eax+(p*6+2)*4]   ;/* a[0]-a[2] c[1]' c[0] b02 a02 */
510        fmul   dword [_coef87]         ;/* c[2]' c[1]' c[0] b02 a02 */
511;//      c[3] = coef87 * (a[3 + 0] - a[3 + 2]) - c[1];
512        fld    dword [eax+(p*6+3)*4]   ;/* a[3] c[2]' c[1]' c[0] b02 a02 */
513        fsub   dword [eax+(p*6+3+2)*4] ;/* a[3]-a[5] c[2]' c[1]' c[0] b02 a02 */
514        fmul   dword [_coef87]         ;/* c[3]'' c[2]' c[1]' c[0] b02 a02 */
515        fsub   st2                     ;/* c[3]' c[2]' c[1]' c[0] b02 a02 */
516;//      c[1] = c[1] - c[0];
517        fxch   st3                     ;/* c[0] c[2]' c[1]' c[3]' b02 a02 */
518        fsubp  st2,st0                 ;/* c[2]' c[1] c[3]' b02 a02 */
519        fxch   st1                     ;/* c[1] c[2]' c[3]' b02 a02 */
520        fst    dword [ebp+(p*6+1)*4]   ;/* c[1] c[2]' c[3]' b02 a02 */
521;//      c[2] = c[2] - c[1];
522        fsubp  st1,st0                 ;/* c[2] c[3]' b02 a02 */
523        fst    dword [ebp+(p*6+2)*4]   ;/* c[2] c[3]' b02 a02 */
524;//      c[4] = a02 - a[1] - a[1];
525        fxch   st3                     ;/* a02 c[3]' b02 c[2] */
526        fsub   dword [eax+(p*6+1)*4]   ;/* a02-a[1] c[3]' b02 c[2] */
527        fsub   dword [eax+(p*6+1)*4]   ;/* c[4]' c[3]' b02 c[2] */
528;//      c[5] = b02 - a[3 + 1] - a[3 + 1] - c[3];
529        fxch   st2                     ;/* b02 c[3]' c[4]' c[2] */
530        fsub   dword [eax+(p*6+3+1)*4] ;/* b02-a[3+1] c[3]' c[4]' c[2] */
531        fsub   dword [eax+(p*6+3+1)*4] ;/* c[5]'' c[3]' c[4]' c[2] */
532        fsub   st0,st1                 ;/* c[5]' c[3]' c[4]' c[2] */
533;//      c[3] = c[3] - c[2];
534        fxch   st3                     ;/* c[2] c[3]' c[4]' c[5]' */
535        fsubp  st1,st0                 ;/* c[3] c[4]' c[5]' */
536        fst    dword [ebp+(p*6+3)*4]   ;/* c[3] c[4]' c[5]' */
537;//      c[4] = c[4] - c[3];
538        fsubp  st1,st0                 ;/* c[4] c[5]' */
539        fst    dword [ebp+(p*6+4)*4]   ;/* c[4] c[5]' */
540;//      c[5] = c[5] - c[4];
541        fsubp  st1,st0                 ;/* c[5] */
542        fstp   dword [ebp+(p*6+5)*4]   ;/* - */
543%assign p p+1
544%endrep
545
546        popad
547        pop    ebp
548        ret
549
550;/*
551; * imdct18 ASM MACRO Version
552; */
553%macro imdct18 1
554        push   ebp
555
556        mov    ebp,%1                  ;/* Save arg */
557;/* Unroll the loop because it is a known-value count */
558%assign p 0                            ;/* Use compiler var as counter */
559%rep 4
560        ;/* First part - compute ap and bp */
561        fld    dword [_mdct18w+p*4]    ;/* w[p] */
562        fmul   dword [ebp+p*4]         ;/* g1 */
563        fld    dword [_mdct18w+(17-p)*4] ;/* w[17-p] g1 */
564        fmul   dword [ebp+(17-p)*4]    ;/* g2 g1 */
565        fld    st0                     ;/* g2 g2 g1 */
566        fadd   st2                     ;/* ap g2 g1 */
567        fxch   st1                     ;/* g2 ap g1 */
568        fsubp  st2,st0                 ;/* ap g1-g2 */
569        fxch   st1                     ;/* g1-g2 ap */
570        fmul   dword [_mdct18w2+p*4]   ;/* bp ap */
571
572        ;/* Second part - compute a8p and b8p */
573        fld    dword [_mdct18w+(8-p)*4];/* w[8-p] bp ap */
574        fmul   dword [ebp+(8-p)*4]     ;/* g1 bp ap */
575        fld    dword [_mdct18w+(9+p)*4];/* w[9+p] g1 bp ap */
576        fmul   dword [ebp+(9+p)*4]     ;/* g2 g1 bp ap */
577        fld    st0                     ;/* g2 g2 g1 bp ap */
578        fadd   st2                     ;/* a8p g2 g1 bp ap */
579        fxch   st1                     ;/* g2 a8p g1 bp ap */
580        fsubp  st2,st0                 ;/* a8p g1-g2 bp ap */
581        fxch   st1                     ;/* g1-g2 a8p bp ap */
582        fmul   dword [_mdct18w2+(8-p)*4] ;/* b8p a8p bp ap */
583
584        ;/* Final part - finalize computing and store values */
585        fld    st3                     ;/* ap b8p a8p bp ap */
586        fadd   st2                     ;/* ap+a8p b8p a8p bp ap */
587        fstp   dword [tab_a+p*4]       ;/* b8p a8p bp ap */
588        fxch   st1                     ;/* a8p b8p bp ap */
589        fsubp  st3,st0                 ;/* b8p bp ap-a8p */
590        fxch   st2                     ;/* ap-a8p bp b8p */
591        fstp   dword [tab_a+(p+5)*4]   ;/* bp b8p */
592        fxch   st1                     ;/* b8p bp */
593        fld    st0                     ;/* b8p b8p bp */
594        fadd   st2                     ;/* b8p+bp b8p bp */
595        fstp   dword [tab_b+p*4]       ;/* b8p bp */
596        fsubp  st1,st0                 ;/* bp-b8p */
597        fstp   dword [tab_b+(p+5)*4]   ;/* - */
598%assign p p+1
599%endrep
600
601%assign p 4
602        ;/* Last - finalize array */
603        fld    dword [_mdct18w+p*4]    ;/* w[p] */
604        fmul   dword [ebp+p*4]         ;/* g1 */
605        fld    dword [_mdct18w+(17-p)*4] ;/* w[17-p] g1 */
606        fmul   dword [ebp+(17-p)*4]    ;/* g2 g1 */
607        fld    st0                     ;/* g2 g2 g1 */
608        fadd   st2                     ;/* ap g2 g1 */
609        fstp   dword [tab_a+p*4]       ;/* g2 g1 */
610        fsubp  st1,st0                 ;/* g1-g2 */
611        fmul   dword [_mdct18w2+p*4]   ;/* bp */
612        fstp   dword [tab_b+p*4]       ;/* - */
613
614;/* Now the huge and boring part */
615;//   f[0] = 0.5f * (a[0] + a[1] + a[2] + a[3] + a[4]);
616;// TO DO : avoid reload of a[4] and b[4]
617        fld    dword [tab_a+0*4]       ;/* a[0] */
618        fadd   dword [tab_a+1*4]       ;/* a[0]+a[1] */
619        fadd   dword [tab_a+2*4]       ;/* a[0]+a[1]+a[2] */
620        fadd   dword [tab_a+3*4]       ;/* a[0]+a[1]+a[2]+a[3] */
621        fadd   dword [tab_a+4*4]       ;/* a[0]+a[1]+a[2]+a[3]+a[4] */
622        fmul   dword [My_FPU_Half]       ;/* 0.5*(a[0]+a[1]+a[2]+a[3]+a[4]) */
623        fst    dword [ebp+0*4]         ;/* f[0] */
624;//   f[1] = 0.5f * (b[0] + b[1] + b[2] + b[3] + b[4]);
625        fld    dword [tab_b+0*4]       ;/* b[0] f[0] */
626        fadd   dword [tab_b+1*4]       ;/* b[0]+b[1] f[0] */
627        fadd   dword [tab_b+2*4]       ;/* b[0]+b[1]+b[2] f[0] */
628        fadd   dword [tab_b+3*4]       ;/* b[0]+b[1]+b[2]+b[3] f[0] */
629        fadd   dword [tab_b+4*4]       ;/* b[0]+b[1]+b[2]+b[3]+b[4] f[0] */
630        fmul   dword [My_FPU_Half]       ;/* f[1]' f[0] */
631;//   f[2] = coef[1][0]*a[5]+coef[1][1]*a[6]+coef[1][2]*a[7]+coef[1][3]*a[8];
632        fld    dword [_coef+1*16+0*4]  ;/* coef[1][0]  f[1]' f[0] */
633        fld    dword [_coef+1*16+1*4]  ;/* coef[1][1]  coef[1][0] f[1]' f[0] */
634        fld    dword [_coef+1*16+2*4]  ;/* coef[1][2]  coef[1][1] coef[1][0] f[1]' f[0] */
635        fld    dword [_coef+1*16+3*4]  ;/* coef[1][3]  coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
636        fld    st3                     ;/* coef[1][0]  coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
637        fmul   dword [tab_a+5*4]       ;/* v0          coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
638        fld    st3                     ;/* coef[1][1]  v0         coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
639        fmul   dword [tab_a+6*4]       ;/* v1          v0         coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
640        faddp  st1,st0                 ;/* v1+v0       coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
641        fld    st2                     ;/* coef[1][2]  v1+v0      coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
642        fmul   dword [tab_a+7*4]       ;/* v2 v1+v0    coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
643        faddp  st1,st0                 ;/* v2+v1+v0    coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
644        fld    st1                     ;/* coef[1][3]  v2+v1+v0   coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
645        fmul   dword [tab_a+8*4]       ;/* v3 v2+v1+v0 coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
646        faddp  st1,st0                 ;/* f[2]'       coef[1][3] coef[1][2] coef[1][1] coef[1][0] f[1]' f[0] */
647;//   f[3] = coef[1][0]*b[5]+coef[1][1]*b[6]+coef[1][2]*b[7]+coef[1][3]*b[8]-f[1];
648        fxch   st4                     ;/* coef[1][0]  coef[1][3] coef[1][2] coef[1][1] f[2]'      f[1]' f[0] */
649        fmul   dword [tab_b+5*4]       ;/* v0          coef[1][3] coef[1][2] coef[1][1] f[2]'      f[1]' f[0] */
650        fxch   st3                     ;/* coef[1][1]  coef[1][3] coef[1][2] v0         f[2]'      f[1]' f[0] */
651        fmul   dword [tab_b+6*4]       ;/* v1          coef[1][3] coef[1][2] v0         f[2]'      f[1]' f[0] */
652        faddp  st3,st0                 ;/* coef[1][3]  coef[1][2] v0+v1      f[2]'      f[1]' f[0] */
653        fxch   st1                     ;/* coef[1][2]  coef[1][3] v0+v1      f[2]'      f[1]' f[0] */
654        fmul   dword [tab_b+7*4]       ;/* v2          coef[1][3] v0+v1      f[2]'      f[1]' f[0] */
655        faddp  st2,st0                 ;/* coef[1][3]  v0+v1+v2   f[2]'      f[1]' f[0] */
656        fmul   dword [tab_b+8*4]       ;/* v3          v0+v1+v2   f[2]'      f[1]' f[0] */
657        faddp  st1,st0                 ;/* v0+v1+v2+v3 f[2]'      f[1]' f[0] */
658        fsub   st0,st2                 ;/* f[3]'       f[2]'      f[1]' f[0] */
659;//   f[1] = f[1] - f[0];
660        fxch   st3                     ;/* f[0]        f[2]'      f[1]' f[3]' */
661        fsubp  st2,st0                 ;/* f[2]'       f[1]       f[3]' */
662        fxch   st1                     ;/* f[1]        f[2]'      f[3]' */
663        fst    dword [ebp+1*4]         ;/* f[1]        f[2]'      f[3]' */
664;//   f[2] = f[2] - f[1];
665        fsubp  st1,st0                 ;/* f[2]        f[3]' */
666        fst    dword [ebp+2*4]         ;/* f[2]        f[3]' */
667        fxch   st1                     ;/* f[3]'       f[2] */
668;//   f[4]=coef[2][0]*a[0]+coef[2][1]*a[1]+coef[2][2]*a[2]+coef[2][3]*a[3]-a[4];
669        fld    dword [_coef+2*16+0*4]  ;/* c[2,0] f[3]' f[2] */
670        fld    dword [_coef+2*16+1*4]  ;/* c[2,1] c[2,0] f[3]' f[2] */
671        fld    dword [_coef+2*16+2*4]  ;/* c[2,2] c[2,1] c[2,0] f[3]' f[2] */
672        fld    dword [_coef+2*16+3*4]  ;/* c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
673        fld    st3                     ;/* c[2,0] c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
674        fmul   dword [tab_a+0*4]       ;/* v0     c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
675        fld    st3                     ;/* c[2,1] v0     c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
676        fmul   dword [tab_a+1*4]       ;/* v1     v0     c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
677        faddp  st1,st0                 ;/* v1+v0  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
678        fld    st2                     ;/* c[2,2] v1+v0  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
679        fmul   dword [tab_a+2*4]       ;/* v2     v1+v0  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
680        faddp  st1,st0                 ;/* v0v1v2 c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
681        fld    st1                     ;/* c[2,3] v0v1v2 c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
682        fmul   dword [tab_a+3*4]       ;/* v3     v0v1v2 c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
683        faddp  st1,st0                 ;/* f[4]'  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
684        fsub   dword [tab_a+4*4]       ;/* f[4]'  c[2,3] c[2,2] c[2,1] c[2,0] f[3]' f[2] */
685        fxch   st4                     ;/* c[2,0] c[2,3] c[2,2] c[2,1] f[4]'  f[3]' f[2] */
686;//   f[5]=coef[2][0]*b[0]+coef[2][1]*b[1]+coef[2][2]*b[2]+coef[2][3]*b[3]-b[4]-f[3];
687        fmul   dword [tab_b+0*4]       ;/* v0     c[2,3] c[2,2] c[2,1] f[4]'  f[3]' f[2] */
688        fxch   st3                     ;/* c[2,1] c[2,3] c[2,2] v0     f[4]'  f[3]' f[2] */
689        fmul   dword [tab_b+1*4]       ;/* v1     c[2,3] c[2,2] v0     f[4]'  f[3]' f[2] */
690        faddp  st3,st0                 ;/* c[2,3] c[2,2] v0+v1  f[4]'  f[3]' f[2] */
691        fxch   st1                     ;/* c[2,2] c[2,3] v0+v1  f[4]'  f[3]' f[2] */
692        fmul   dword [tab_b+2*4]       ;/* v2     c[2,3] v0+v1  f[4]'  f[3]' f[2] */
693        faddp  st2,st0                 ;/* c[2,3] v0v1v2 f[4]'  f[3]' f[2] */
694        fmul   dword [tab_b+3*4]       ;/* v3     v0v1v2 f[4]'  f[3]' f[2] */
695        faddp  st1,st0                 ;/* f[5]'' f[4]'  f[3]' f[2] */
696        fsub   dword [tab_b+4*4]       ;/* f[5]'' f[4]'  f[3]' f[2] */
697        fsub   st2                     ;/* f[5]'  f[4]'  f[3]' f[2] */
698;//   f[3] = f[3] - f[2];
699        fxch   st3                     ;/* f[2]   f[4]'  f[3]' f[5]' */
700        fsubp  st2,st0                 ;/* f[4]'  f[3]   f[5]' */
701        fxch   st1                     ;/* f[3]   f[4]'  f[5]' */
702        fst    dword [ebp+3*4]         ;/* f[3]   f[4]'  f[5]' */
703;//   f[4] = f[4] - f[3];
704        fsubp  st1,st0                 ;/* f[4]   f[5]' */
705        fst    dword [ebp+4*4]         ;/* f[4]   f[5]' */
706        fxch   st1                     ;/* f[5]'  f[4] */
707;//   f[6] = coef[3][0] * (a[5] - a[7] - a[8]);
708        fld    dword [tab_a+5*4]       ;/* a[5] f[5]' f[4] */
709        fsub   dword [tab_a+7*4]       ;/* a[5]-a[7] f[5]' f[4] */
710        fsub   dword [tab_a+8*4]       ;/* a[5]-a[7]-a[8] f[5]' f[4] */
711        fmul   dword [_coef+3*16+0*4]  ;/* f[6]' f[5]' f[4] */
712;//   f[7] = coef[3][0] * (b[5] - b[7] - b[8]) - f[5];
713        fld    dword [tab_b+5*4]       ;/* b[5] f[6]' f[5]' f[4] */
714        fsub   dword [tab_b+7*4]       ;/* b[5]-b[7] f[6]' f[5]' f[4] */
715        fsub   dword [tab_b+8*4]       ;/* b[5]-b[7]-b[8] f[6]' f[5]' f[4] */
716        fmul   dword [_coef+3*16+0*4]  ;/* c[3,0]*(b5-b7-b8) f[6]' f[5]' f[4] */
717        fsub   st2                     ;/* f[7]' f[6]' f[5]' f[4] */
718;//   f[5] = f[5] - f[4];
719        fxch   st3                     ;/* f[4] f[6]' f[5]' f[7]' */
720        fsubp  st2,st0                 ;/* f[6]' f[5] f[7]' */
721        fxch   st1                     ;/* f[5] f[6]' f[7]' */
722        fst    dword [ebp+5*4]         ;/* f[5] f[6]' f[7]' */
723;//   f[6] = f[6] - f[5];
724        fsubp  st1,st0                 ;/* f[6] f[7]' */
725        fst    dword [ebp+6*4]         ;/* f[6] f[7]' */
726        fxch   st1                     ;/* f[7]' f[6] */
727;//   f[8] = coef[4][0]*a[0]+coef[4][1]*a[1]+coef[4][2]*a[2]+coef[4][3]*a[3]+a[4];
728        fld    dword [_coef+4*16+0*4]  ;/* c[4,0] f[7]' f[6] */
729        fld    dword [_coef+4*16+1*4]  ;/* c[4,1] c[4,0] f[7]' f[6] */
730        fld    dword [_coef+4*16+2*4]  ;/* c[4,2] c[4,1] c[4,0] f[7]' f[6] */
731        fld    dword [_coef+4*16+3*4]  ;/* c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
732        fld    st3                     ;/* c[4,0] c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
733        fmul   dword [tab_a+0*4]       ;/* v0     c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
734        fld    st3                     ;/* c[4,1] v0     c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
735        fmul   dword [tab_a+1*4]       ;/* v1     v0     c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
736        faddp  st1,st0                 ;/* v1+v0  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
737        fld    st2                     ;/* c[4,2] v1+v0  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
738        fmul   dword [tab_a+2*4]       ;/* v2     v1+v0  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
739        faddp  st1,st0                 ;/* v0v1v2 c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
740        fld    st1                     ;/* c[4,3] v0v1v2 c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
741        fmul   dword [tab_a+3*4]       ;/* v3     v0v1v2 c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
742        faddp  st1,st0                 ;/* f[8]'  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */
743        fadd   dword [tab_a+4*4]       ;/* f[8]'  c[4,3] c[4,2] c[4,1] c[4,0] f[7]' f[6] */        ;// CHECK HERE
744        fxch   st4                     ;/* c[4,0] c[4,3] c[4,2] c[4,1] f[8]'  f[7]' f[6] */
745;//   f[9] = coef[4][0]*b[0]+coef[4][1]*b[1]+coef[4][2]*b[2]+coef[4][3]*b[3]+b[4]-f[7];
746        fmul   dword [tab_b+0*4]       ;/* v0     c[4,3] c[4,2] c[4,1] f[8]'  f[7]' f[6] */
747        fxch   st3                     ;/* c[4,1] c[4,3] c[4,2] v0     f[8]'  f[7]' f[6] */
748        fmul   dword [tab_b+1*4]       ;/* v1     c[4,3] c[4,2] v0     f[8]'  f[7]' f[6] */
749        faddp  st3,st0                 ;/* c[4,3] c[4,2] v0+v1  f[8]'  f[7]' f[6] */
750        fxch   st1                     ;/* c[4,2] c[4,3] v0+v1  f[8]'  f[7]' f[6] */
751        fmul   dword [tab_b+2*4]       ;/* v2     c[4,3] v0+v1  f[8]'  f[7]' f[6] */
752        faddp  st2,st0                 ;/* c[4,3] v0v1v2 f[8]'  f[7]' f[6] */
753        fmul   dword [tab_b+3*4]       ;/* v3     v0v1v2 f[8]'  f[7]' f[6] */
754        faddp  st1,st0                 ;/* f[9]'' f[8]'  f[7]' f[6] */
755        fadd   dword [tab_b+4*4]       ;/* f[9]'' f[8]'  f[7]' f[6] */  ;// CHECK HERE
756        fsub   st2                     ;/* f[9]'  f[8]'  f[7]' f[6] */
757;//   f[7] = f[7] - f[6];
758        fxch   st3                     ;/* f[6]   f[8]'  f[7]' f[9]' */
759        fsubp  st2,st0                 ;/* f[8]'  f[7]   f[9]' */
760        fxch   st1                     ;/* f[7]   f[8]'  f[9]' */
761        fst    dword [ebp+7*4]         ;/* f[7]   f[8]'  f[9]' */
762;//   f[8] = f[8] - f[7];
763        fsubp  st1,st0                 ;/* f[8]   f[9]' */
764        fst    dword [ebp+8*4]         ;/* f[8]   f[9]' */
765        fxch   st1                     ;/* f[9]'  f[8] */
766;//   f[10] = coef[5][0]*a[5]+coef[5][1]*a[6]+coef[5][2]*a[7]+coef[5][3]*a[8];
767        fld    dword [_coef+5*16+0*4]  ;/* coef[5][0]  f[9]' f[8] */
768        fld    dword [_coef+5*16+1*4]  ;/* coef[5][1]  coef[5][0] f[9]' f[8] */
769        fld    dword [_coef+5*16+2*4]  ;/* coef[5][2]  coef[5][1] coef[5][0] f[9]' f[8] */
770        fld    dword [_coef+5*16+3*4]  ;/* coef[5][3]  coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
771        fld    st3                     ;/* coef[5][0]  coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
772        fmul   dword [tab_a+5*4]       ;/* v0          coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
773        fld    st3                     ;/* coef[5][1]  v0         coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
774        fmul   dword [tab_a+6*4]       ;/* v1          v0         coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
775        faddp  st1,st0                 ;/* v1+v0       coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
776        fld    st2                     ;/* coef[5][2]  v1+v0      coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
777        fmul   dword [tab_a+7*4]       ;/* v2 v1+v0    coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
778        faddp  st1,st0                 ;/* v2+v1+v0    coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
779        fld    st1                     ;/* coef[5][3]  v2+v1+v0   coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
780        fmul   dword [tab_a+8*4]       ;/* v3 v2+v1+v0 coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
781        faddp  st1,st0                 ;/* f[10]'      coef[5][3] coef[5][2] coef[5][1] coef[5][0] f[9]' f[8] */
782;//   f[11] = coef[5][0]*b[5]+coef[5][1]*b[6]+coef[5][2]*b[7]+coef[5][3]*b[8]-f[9];
783        fxch   st4                     ;/* coef[5][0]  coef[5][3] coef[5][2] coef[5][1] f[10]'     f[9]' f[8] */
784        fmul   dword [tab_b+5*4]       ;/* v0          coef[5][3] coef[5][2] coef[5][1] f[10]'     f[9]' f[8] */
785        fxch   st3                     ;/* coef[5][1]  coef[5][3] coef[5][2] v0         f[10]'     f[9]' f[8] */
786        fmul   dword [tab_b+6*4]       ;/* v1          coef[5][3] coef[5][2] v0         f[10]'     f[9]' f[8] */
787        faddp  st3,st0                 ;/* coef[5][3]  coef[5][2] v0+v1      f[10]'     f[9]' f[8] */
788        fxch   st1                     ;/* coef[5][2]  coef[5][3] v0+v1      f[10]'     f[9]' f[8] */
789        fmul   dword [tab_b+7*4]       ;/* v2          coef[5][3] v0+v1      f[10]'     f[9]' f[8] */
790        faddp  st2,st0                 ;/* coef[5][3]  v0+v1+v2   f[10]'     f[9]' f[8] */
791        fmul   dword [tab_b+8*4]       ;/* v3          v0+v1+v2   f[10]'     f[9]' f[8] */
792        faddp  st1,st0                 ;/* v0+v1+v2+v3 f[10]'     f[9]' f[8] */
793        fsub   st0,st2                 ;/* f[11]'      f[10]'     f[9]' f[8] */
794;//   f[9] = f[9] - f[8];
795        fxch   st3                     ;/* f[8]        f[10]'     f[9]' f[11]' */
796        fsubp  st2,st0                 ;/* f[10]'      f[9]       f[11]' */
797        fxch   st1                     ;/* f[9]        f[10]'     f[11]' */
798        fst    dword [ebp+9*4]         ;/* f[9]        f[10]'     f[11]' */
799;//   f[10] = f[10] - f[9];
800        fsubp  st1,st0                 ;/* f[10]       f[11]' */
801        fst    dword [ebp+10*4]        ;/* f[10]       f[11]' */
802        fxch   st1                     ;/* f[11]'      f[10]  */
803;//   f[12] = 0.5f * (a[0] + a[2] + a[3]) - a[1] - a[4];
804        fld    dword [tab_a+0*4]       ;/* a[0] f[11]' f[10]  */
805        fadd   dword [tab_a+2*4]       ;/* a[0]+a[2] f[11]' f[10]  */
806        fadd   dword [tab_a+3*4]       ;/* a[0]+a[2]+a[3] f[11]' f[10]  */
807        fmul   dword [My_FPU_Half]       ;/* 0.5*(a[0]+a[2]+a[3]) f[11]' f[10]  */
808        fsub   dword [tab_a+1*4]       ;/* 0.5*(a[0]+a[2]+a[3])-a[1] f[11]' f[10]  */
809        fsub   dword [tab_a+4*4]       ;/* f[12]' f[11]' f[10]  */
810;//   f[13] = 0.5f * (b[0] + b[2] + b[3]) - b[1] - b[4] - f[11];
811        fld    dword [tab_b+0*4]       ;/* b[0] f[12]' f[11]' f[10]  */
812        fadd   dword [tab_b+2*4]       ;/* b[0]+b[2] f[12]' f[11]' f[10]  */
813        fadd   dword [tab_b+3*4]       ;/* b[0]+b[2]+b[3] f[12]' f[11]' f[10]  */
814        fmul   dword [My_FPU_Half]       ;/* 0.5*(b[0]+b[2]+b[3]) f[12]' f[11]' f[10]  */
815        fsub   dword [tab_b+1*4]       ;/* 0.5*(b[0]+b[2]+b[3])-b[1] f[12]' f[11]' f[10]  */
816        fsub   dword [tab_b+4*4]       ;/* 0.5*(b[0]+b[2]+b[3])-b[1]-b[4] f[12]' f[11]' f[10]  */
817        fsub   st2                     ;/* f[13]' f[12]' f[11]' f[10]  */
818;//   f[11] = f[11] - f[10];
819        fxch   st3                     ;/* f[10]  f[12]' f[11]' f[13]' */
820        fsubp  st2,st0                 ;/* f[12]' f[11]  f[13]' */
821        fxch   st1                     ;/* f[11]  f[12]' f[13]' */
822        fst    dword [ebp+11*4]        ;/* f[11]  f[12]' f[13]' */
823;//   f[12] = f[12] - f[11];
824        fsubp  st1,st0                 ;/* f[12]       f[13]' */
825        fst    dword [ebp+12*4]        ;/* f[12]       f[13]' */
826        fxch   st1                     ;/* f[13]'      f[12]  */
827;//   f[14] = coef[7][0]*a[5]+coef[7][1]*a[6]+coef[7][2]*a[7]+coef[7][3]*a[8];
828        fld    dword [_coef+7*16+0*4]  ;/* coef[7][0]  f[13]' f[12] */
829        fld    dword [_coef+7*16+1*4]  ;/* coef[7][1]  coef[7][0] f[13]' f[12] */
830        fld    dword [_coef+7*16+2*4]  ;/* coef[7][2]  coef[7][1] coef[7][0] f[13]' f[12] */
831        fld    dword [_coef+7*16+3*4]  ;/* coef[7][3]  coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
832        fld    st3                     ;/* coef[7][0]  coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
833        fmul   dword [tab_a+5*4]       ;/* v0          coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
834        fld    st3                     ;/* coef[7][1]  v0         coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
835        fmul   dword [tab_a+6*4]       ;/* v1          v0         coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
836        faddp  st1,st0                 ;/* v1+v0       coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
837        fld    st2                     ;/* coef[7][2]  v1+v0      coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
838        fmul   dword [tab_a+7*4]       ;/* v2 v1+v0    coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
839        faddp  st1,st0                 ;/* v2+v1+v0    coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
840        fld    st1                     ;/* coef[7][3]  v2+v1+v0   coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
841        fmul   dword [tab_a+8*4]       ;/* v3 v2+v1+v0 coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
842        faddp  st1,st0                 ;/* f[14]'      coef[7][3] coef[7][2] coef[7][1] coef[7][0] f[13]' f[12] */
843;//   f[15] = coef[7][0]*b[5]+coef[7][1]*b[6]+coef[7][2]*b[7]+coef[7][3]*b[8]-f[13];
844        fxch   st4                     ;/* coef[7][0]  coef[7][3] coef[7][2] coef[7][1] f[14]'     f[13]' f[12] */
845        fmul   dword [tab_b+5*4]       ;/* v0          coef[7][3] coef[7][2] coef[7][1] f[14]'     f[13]' f[12] */
846        fxch   st3                     ;/* coef[7][1]  coef[7][3] coef[7][2] v0         f[14]'     f[13]' f[12] */
847        fmul   dword [tab_b+6*4]       ;/* v1          coef[7][3] coef[7][2] v0         f[14]'     f[13]' f[12] */
848        faddp  st3,st0                 ;/* coef[7][3]  coef[7][2] v0+v1      f[14]'     f[13]' f[12] */
849        fxch   st1                     ;/* coef[7][2]  coef[7][3] v0+v1      f[14]'     f[13]' f[12] */
850        fmul   dword [tab_b+7*4]       ;/* v2          coef[7][3] v0+v1      f[14]'     f[13]' f[12] */
851        faddp  st2,st0                 ;/* coef[7][3]  v0+v1+v2   f[14]'     f[13]' f[12] */
852        fmul   dword [tab_b+8*4]       ;/* v3          v0+v1+v2   f[14]'     f[13]' f[12] */
853        faddp  st1,st0                 ;/* v0+v1+v2+v3 f[14]'     f[13]' f[12] */
854        fsub   st0,st2                 ;/* f[15]'      f[14]'     f[13]' f[12] */
855;//   f[13] = f[13] - f[12];
856        fxch   st3                     ;/* f[12]  f[14]' f[13]' f[15]' */
857        fsubp  st2,st0                 ;/* f[14]' f[13]  f[15]' */
858        fxch   st1                     ;/* f[13]  f[14]' f[15]' */
859        fst    dword [ebp+13*4]        ;/* f[13]  f[14]' f[15]' */
860;//   f[14] = f[14] - f[13];
861        fsubp  st1,st0                 ;/* f[14]       f[15]' */
862        fst    dword [ebp+14*4]        ;/* f[14]       f[15]' */
863        fxch   st1                     ;/* f[15]'      f[14]  */
864;//   f[16] = coef[8][0]*a[0]+coef[8][1]*a[1]+coef[8][2]*a[2]+coef[8][3]*a[3]+a[4];
865        fld    dword [_coef+8*16+0*4]  ;/* c[8,0] f[15]' f[14] */
866        fld    dword [_coef+8*16+1*4]  ;/* c[8,1] c[8,0] f[15]' f[14] */
867        fld    dword [_coef+8*16+2*4]  ;/* c[8,2] c[8,1] c[8,0] f[15]' f[14] */
868        fld    dword [_coef+8*16+3*4]  ;/* c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
869        fld    st3                     ;/* c[8,0] c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
870        fmul   dword [tab_a+0*4]       ;/* v0     c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
871        fld    st3                     ;/* c[8,1] v0     c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
872        fmul   dword [tab_a+1*4]       ;/* v1     v0     c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
873        faddp  st1,st0                 ;/* v1+v0  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
874        fld    st2                     ;/* c[8,2] v1+v0  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
875        fmul   dword [tab_a+2*4]       ;/* v2     v1+v0  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
876        faddp  st1,st0                 ;/* v0v1v2 c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
877        fld    st1                     ;/* c[8,3] v0v1v2 c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
878        fmul   dword [tab_a+3*4]       ;/* v3     v0v1v2 c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
879        faddp  st1,st0                 ;/* f[8]'  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */
880        fadd   dword [tab_a+4*4]       ;/* f[8]'  c[8,3] c[8,2] c[8,1] c[8,0] f[15]' f[14] */        ;// CHECK HERE
881        fxch   st4                     ;/* c[8,0] c[8,3] c[8,2] c[8,1] f[16]' f[15]' f[14] */
882;//   f[17] = coef[8][0]*b[0]+coef[8][1]*b[1]+coef[8][2]*b[2]+coef[8][3]*b[3]+b[4]-f[15];
883        fmul   dword [tab_b+0*4]       ;/* v0     c[8,3] c[8,2] c[8,1] f[16]'  f[15]' f[14] */
884        fxch   st3                     ;/* c[8,1] c[8,3] c[8,2] v0     f[16]'  f[15]' f[14] */
885        fmul   dword [tab_b+1*4]       ;/* v1     c[8,3] c[8,2] v0     f[16]'  f[15]' f[14] */
886        faddp  st3,st0                 ;/* c[8,3] c[8,2] v0+v1  f[16]'  f[15]' f[14] */
887        fxch   st1                     ;/* c[8,2] c[8,3] v0+v1  f[16]'  f[15]' f[14] */
888        fmul   dword [tab_b+2*4]       ;/* v2     c[8,3] v0+v1  f[16]'  f[15]' f[14] */
889        faddp  st2,st0                 ;/* c[8,3] v0v1v2 f[16]'  f[15]' f[14] */
890        fmul   dword [tab_b+3*4]       ;/* v3     v0v1v2 f[16]'  f[15]' f[14] */
891        faddp  st1,st0                 ;/* f[17]'' f[16]'  f[15]' f[14] */
892        fadd   dword [tab_b+4*4]       ;/* f[17]'' f[16]'  f[15]' f[14] */  ;// CHECK HERE
893        fsub   st0,st2                 ;/* f[17]'  f[16]'  f[15]' f[14] */
894;//   f[15] = f[15] - f[14];
895        fxch   st3                     ;/* f[14]  f[16]' f[15]' f[17]' */
896        fsubp  st2,st0                 ;/* f[16]' f[15]  f[17]' */
897        fxch   st1                     ;/* f[15]  f[16]' f[17]' */
898        fst    dword [ebp+15*4]        ;/* f[15]  f[16]' f[17]' */
899;//   f[16] = f[16] - f[15];
900        fsubp  st1,st0                 ;/* f[16]       f[17]' */
901        fst    dword [ebp+16*4]        ;/* f[16]       f[17]' */
902;//   f[17] = f[17] - f[16];
903        fsubp  st1,st0                 ;/* f[17] */
904        fstp   dword [ebp+17*4]        ;/* - */
905
906        pop    ebp
907%endmacro
908
909;/*
910; * imdct6_3 ASM MACRO Version
911; */
912%macro imdct6_3 1 ;// PROC f[]
913        push   ebp
914
915        mov    ebp,%1                  ;/* Save arg */
916;/* Unroll the loop because it is a known-value count */
917%assign p 0
918%rep 3
919        fld    dword [ebp+(p+(3*0))*4] ;/* f[3*0] */
920        fmul   dword [_mdct6_3v+0*4]   ;/* g1 */
921        fld    dword [ebp+(p+(3*5))*4] ;/* f[3*5] g1 */
922        fmul   dword [_mdct6_3v+5*4]   ;/* g2 g1 */
923        fld    st0                     ;/* g2 g2 g1 */
924        fadd   st2                     ;/* a[0] g2 g1 */
925        fstp   dword [tab_a+(p*6+0)*4] ;/* g2 g1 */
926        fsubp  st1,st0                 ;/* g1-g2 */
927        fmul   dword [_mdct6_3v2+0*4]  ;/* a[3+0] */
928        fstp   dword [tab_a+(p*6+3)*4] ;/* - */
929
930        fld    dword [ebp+(p+(3*1))*4] ;/* f[3*1] */
931        fmul   dword [_mdct6_3v+1*4]   ;/* g1 */
932        fld    dword [ebp+(p+(3*4))*4] ;/* f[3*4] g1 */
933        fmul   dword [_mdct6_3v+4*4]   ;/* g2 g1 */
934        fld    st0                     ;/* g2 g2 g1 */
935        fadd   st2                     ;/* a[1] g2 g1 */
936        fstp   dword [tab_a+(p*6+1)*4] ;/* g2 g1 */
937        fsubp  st1,st0                 ;/* g1-g2 */
938        fmul   dword [_mdct6_3v2+1*4]  ;/* a[3+1] */
939        fstp   dword [tab_a+(p*6+3+1)*4] ;/* - */
940
941        fld    dword [ebp+(p+(3*2))*4] ;/* f[3*2] */
942        fmul   dword [_mdct6_3v+2*4]   ;/* g1 */
943        fld    dword [ebp+(p+(3*3))*4] ;/* f[3*3] g1 */
944        fmul   dword [_mdct6_3v+3*4]   ;/* g2 g1 */
945        fld    st0                     ;/* g2 g2 g1 */
946        fadd   st2                     ;/* a[2] g2 g1 */
947        fstp   dword [tab_a+(p*6+2)*4] ;/* g2 g1 */
948        fsubp  st1,st0                 ;/* g1-g2 */
949        fmul   dword [_mdct6_3v2+2*4]  ;/* a[3+2] */
950        fstp   dword [tab_a+(p*6+3+2)*4] ;/* - */
951%assign p p+1
952%endrep
953
954;/* Unroll the loop because it is a known-value count */
955%assign p 0
956%rep 3
957        fld    dword [tab_a+(p*6+0)*4] ;/* a[0] */
958        fadd   dword [tab_a+(p*6+2)*4] ;/* a02 */
959        fld    dword [tab_a+(p*6+3+0)*4] ;/* a[3+0] a02 */
960        fadd   dword [tab_a+(p*6+3+2)*4] ;/* b02 a02 */
961        fld    st1                     ;/* a02 b02 a02 */
962        fadd   dword [tab_a+(p*6+1)*4] ;/* c[0] b02 a02 */
963        fst    dword [ebp+(p*6+0)*4]   ;/* c[0] b02 a02 */
964        fld    st1                     ;/* b02 c[0] b02 a02 */
965        fadd   dword [tab_a+(p*6+3+1)*4] ;/* c[1]' c[0] b02 a02 */
966        fld    dword [tab_a+(p*6+0)*4] ;/* a[0] c[1]' c[0] b02 a02 */
967        fsub   dword [tab_a+(p*6+2)*4] ;/* a[0]-a[2] c[1]' c[0] b02 a02 */
968        fmul   dword [_coef87]         ;/* c[2]' c[1]' c[0] b02 a02 */
969        fld    dword [tab_a+(p*6+3)*4] ;/* a[3] c[2]' c[1]' c[0] b02 a02 */
970        fsub   dword [tab_a+(p*6+3+2)*4] ;/* a[3]-a[5] c[2]' c[1]' c[0] b02 a02 */
971        fmul   dword [_coef87]         ;/* c[3]'' c[2]' c[1]' c[0] b02 a02 */
972        fsub   st2                     ;/* c[3]' c[2]' c[1]' c[0] b02 a02 */
973        fxch   st3                     ;/* c[0] c[2]' c[1]' c[3]' b02 a02 */
974        fsubp  st2,st0                 ;/* c[2]' c[1] c[3]' b02 a02 */
975        fxch   st1                     ;/* c[1] c[2]' c[3]' b02 a02 */
976        fst    dword [ebp+(p*6+1)*4]   ;/* c[1] c[2]' c[3]' b02 a02 */
977        fsubp  st1,st0                 ;/* c[2] c[3]' b02 a02 */
978        fst    dword [ebp+(p*6+2)*4]   ;/* c[2] c[3]' b02 a02 */
979        fxch   st3                     ;/* a02 c[3]' b02 c[2] */
980        fsub   dword [tab_a+(p*6+1)*4] ;/* a02-a[1] c[3]' b02 c[2] */
981        fsub   dword [tab_a+(p*6+1)*4] ;/* c[4]' c[3]' b02 c[2] */
982        fxch   st2                     ;/* b02 c[3]' c[4]' c[2] */
983        fsub   dword [tab_a+(p*6+3+1)*4] ;/* b02-a[3+1] c[3]' c[4]' c[2] */
984        fsub   dword [tab_a+(p*6+3+1)*4] ;/* c[5]'' c[3]' c[4]' c[2] */
985        fsub   st0,st1                 ;/* c[5]' c[3]' c[4]' c[2] */
986        fxch   st3                     ;/* c[2] c[3]' c[4]' c[5]' */
987        fsubp  st1,st0                 ;/* c[3] c[4]' c[5]' */
988        fst    dword [ebp+(p*6+3)*4]   ;/* c[3] c[4]' c[5]' */
989        fsubp  st1,st0                 ;/* c[4] c[5]' */
990        fst    dword [ebp+(p*6+4)*4]   ;/* c[4] c[5]' */
991        fsubp  st1,st0                 ;/* c[5] */
992        fstp   dword [ebp+(p*6+5)*4]   ;/* - */
993%assign p p+1
994%endrep
995
996        pop    ebp
997%endmacro
998
999;/*
1000; * hybrid ASM Version
1001; * Uses imdct18 and imdct6_3 macros
1002; */
1003_hybrid_asm: ;// xin[] xprev[] y[18][32] btype  nlong  ntot   nprev  win    band_limit
1004             ;// ebp   ebp+4   ebp+8     ebp+12 ebp+16 ebp+20 ebp+24 ebp+28 ebp+32
1005        push   ebp
1006        lea    ebp,[esp+8]
1007        pushad
1008
1009        ;/* Check btype */
1010        mov    ebx,[ebp+12]
1011        cmp    ebx,2
1012        jne    .SkipBTYPE
1013        xor    ebx,ebx
1014      .SkipBTYPE:
1015        mov    eax,WINSIZE
1016        mul    ebx
1017        mov    ecx,eax                 ;/* Store win[btype] address */
1018        add    ecx,[ebp+28]
1019
1020        ;/* Compute number of dct's to do */
1021        mov    eax,[ebp+16]
1022        add    eax,17
1023        mov    ebx,18
1024        cdq
1025        div    ebx                     ;/* Number of dct's to do in eax */
1026        ;/* Initialize x and x0 */
1027        mov    edi,[ebp]               ;/* edi is x */
1028        mov    esi,[ebp+4]             ;/* esi is x0 */
1029        ;/* Initialize win[btype] */
1030        mov    edx,ecx                 ;/* edx is win[btype] */
1031        ;/* Initialize loop counter */
1032        xor    ecx,ecx                 ;/* ecx is the loop counter */
1033        mov    ebx,[ebp+8]             ;/* ebx is y */
1034        ;/* First check */
1035        cmp    ecx,eax
1036        jge    near .ExitLongBlockLoop
1037
1038        ;/* Long block loop */
1039      .LongBlockLoop:
1040        ;/* call imdct 18 macro */
1041        imdct18 edi
1042
1043        ;/* Unrool first J-controlled loop */
1044%assign j 0
1045%rep 9
1046        fld    dword [esi+j*4]         ;/* x0[j] */
1047        fld    dword [edx+j*4]         ;/* win[btype][j] x0[j] */
1048        fmul   dword [edi+(9+j)*4]     ;/* win[btype][j]*x[9+j] x0[j] */
1049        faddp  st1,st0                 ;/* y[j][i] */
1050        fstp   dword [ebx+ecx*4+j*128] ;/* - */
1051
1052        fld    dword [esi+(j+9)*4]     ;/* x0[9+j] */
1053        fld    dword [edx+(j+9)*4]     ;/* win[btype][9+j] x0[9+j] */
1054        fmul   dword [edi+(17-j)*4]    ;/* win[btype][9+j]*x[17-+j] x0[9+j] */
1055        faddp  st1,st0
1056        fstp   dword [ebx+ecx*4+(j+9)*128] ;/* - */
1057%assign j j+1
1058%endrep
1059
1060        ;/* Unrool second J-controlled loop */
1061%assign j 0
1062%rep 4
1063        fld    dword [edi+j*4]         ;/* xa */
1064        fld    dword [edi+(8-j)*4]     ;/* xb xa */
1065        fld    dword [edx+(18+j)*4]    ;/* win[btype][18+j] xb xa */
1066        fmul   st1                     ;/* x[j] xb xa */
1067        fstp   dword [edi+j*4]         ;/* xb xa */
1068        fld    dword [edx+((18+8)-j)*4];/* win[btype][(18+8)-j] xb xa */
1069        fmul   st2                     ;/* x[8-j] xb xa */
1070        fstp   dword [edi+(8-j)*4]     ;/* xb xa */
1071        fxch   st1                     ;/* xa xb */
1072        fmul   dword [edx+((18+9)+j)*4];/* x[9+j] xb */
1073        fstp   dword [edi+(9+j)*4]     ;/* xb */
1074        fmul   dword [edx+(18+17-j)*4] ;/* x[17-j] */
1075        fstp   dword [edi+(17-j)*4]    ;/* - */
1076%assign j j+1
1077%endrep
1078        ;/* Handle last special case */
1079        fld    dword [edi+j*4]         ;/* xa */
1080        fld    st0                     ;/* xa xa */
1081        fmul   dword [edx+(18+j)*4]    ;/* x[j] xa */
1082        fxch   st1                     ;/* xa x[j] */
1083        fmul   dword [edx+(18+9+j)*4]  ;/* x[9+j] x[j] */
1084        fxch   st1                     ;/* x[j] x[9+j] */
1085        fstp   dword [edi+j*4]         ;/* x[9+j] */
1086        fstp   dword [edi+(j+9)*4]     ;/* - */
1087
1088        add    edi,18*4                ;/* Update x */
1089        add    esi,18*4                ;/* Update x0 */
1090
1091        inc    ecx                     ;/* Increment counter */
1092        cmp    ecx,eax
1093        jl     near .LongBlockLoop
1094      .ExitLongBlockLoop:
1095
1096        mov    eax,[ebp+20]
1097        add    eax,17
1098        mov    ebx,18
1099        cdq
1100        div    ebx                     ;/* Number of 6 pts dct's triples to do in eax */
1101;        mov    edx,_win+(WINSIZE*2)
1102        mov    edx, [ebp + 28]         ;/* address of win[2] is in edx */
1103        add    edx, WINSIZE * 2
1104        mov    ebx,[ebp+8]             ;/* ebx is y */
1105
1106        ;/* First check */
1107        cmp    ecx,eax
1108        jge    near .ExitShortBlockLoop
1109        ;/* Short block loop */
1110      .ShortBlockLoop:
1111        ;/* call imdct6_3 macro */
1112        imdct6_3 edi
1113        ;/* First unrolled loop */
1114%assign j 0
1115%rep 3
1116        fld    dword [esi+j*4]         ;/* x0[j] */
1117        fstp   dword [ebx+ecx*4+j*128] ;/* - */
1118        fld    dword [esi+(3+j)*4]     ;/* x0[3+j] */
1119        fstp   dword [ebx+ecx*4+(3+j)*128] ;/* - */
1120
1121        fld    dword [edi+(3+j)*4]     ;/* x[3+j] */
1122        fld    dword [edx+j*4]         ;/* win[2][j] x[3+j] */
1123        fxch   st1                     ;/* x[3+j] win[2][j] */
1124        fmul   st0,st1                 ;/* win[2][j]*x[3+j] win[2][j] */
1125        fadd   dword [esi+(6+j)*4]     ;/* y[6+j][i] win[2][j] */
1126        fstp   dword [ebx+ecx*4+(6+j)*128] ;/* win[2][j] */
1127
1128        fld    dword [edi+(5-j)*4]     ;/* x[5-j] win[2][j] */
1129        fld    dword [edx+(3+j)*4]     ;/* win[2][3+j] x[5-j] win[2][j] */
1130        fxch   st1                     ;/* x[5-j] win[2][3+j] win[2][j] */
1131        fmul   st0,st1                 ;/* win[2][3+j]*x[5-j] win[2][3+j] win[2][j] */
1132        fadd   dword [esi+(9+j)*4]     ;/* y[9+j][i] win[2][3+j] win[2][j] */
1133        fstp   dword [ebx+ecx*4+(9+j)*128] ;/* win[2][3+j] win[2][j] */
1134        fxch   st1                     ;/* win[2][j] win[2][3+j] */
1135
1136        fld    dword [edx+(6+j)*4]     ;/* win[2][6+j] win[2][j] win[2][3+j] */
1137        fmul   dword [edi+(2-j)*4]     ;/* win[2][6+j]*x[2-j] win[2][j] win[2][3+j] */
1138        fxch   st1                     ;/* win[2][j] win[2][6+j]*x[2-j] win[2][3+j] */
1139        fmul   dword [edi+(9+j)*4]     ;/* win[2][j]*x[9+j] win[2][6+j]*x[2-j] win[2][3+j] */
1140        fadd   dword [esi+(12+j)*4]    ;/* x0[12+j]+win[2][j]*x[9+j] win[2][6+j]*x[2-j] win[2][3+j] */
1141        faddp  st1,st0                 ;/* y[12+j][i] win[2][3+j] */
1142        fstp   dword [ebx+ecx*4+(12+j)*128] ;/* win[2][3+j] */
1143
1144        fld    dword [edx+(9+j)*4]     ;/* win[2][9+j] win[2][3+j] */
1145        fmul   dword [edi+j*4]         ;/* win[2][9+j]*x[j] win[2][3+j] */
1146        fxch   st1                     ;/* win[2][3+j] win[2][9+j]*x[j] */
1147        fmul   dword [edi+(11-j)*4]    ;/* win[2][3+j]*x[11-j] win[2][9+j]*x[j] */
1148        fadd   dword [esi+(15+j)*4]    ;/* x0[15+j]+win[2][3+j]*x[11-j] win[2][9+j]*x[j] */
1149        faddp  st1,st0                 ;/* y[15+j][i] */
1150        fstp   dword [ebx+ecx*4+(15+j)*128] ;/* - */
1151%assign j j+1
1152%endrep
1153
1154        ;/* Second unrolled loop */
1155%assign j 0
1156%rep 3
1157        fld    dword [edx+(6+j)*4]     ;/* win[2][6+j] */
1158        fmul   dword [edi+(8-j)*4]     ;/* win[2][6+j]*x[8-j] */
1159        fld    dword [edx+j*4]         ;/* win[2][j] win[2][6+j]*x[8-j] */
1160        fmul   dword [edi+(15+j)*4]    ;/* win[2][j]*x[15+j] win[2][6+j]*x[8-j] */
1161        faddp  st1,st0                 ;/* x[j] */
1162        fstp   dword [edi+j*4]         ;/* - */
1163
1164        fld    dword [edx+(9+j)*4]     ;/* win[2][9+j] */
1165        fmul   dword [edi+(6+j)*4]     ;/* win[2][9+j]*x[6+j] */
1166        fld    dword [edx+(3+j)*4]     ;/* win[2][3+j] win[2][9+j]*x[6+j] */
1167        fmul   dword [edi+(17-j)*4]    ;/* win[2][3+j]*x[17-j] win[2][9+j]*x[6+j] */
1168        faddp  st1,st0                 ;/* x[3+j] */
1169        fstp   dword [edi+(3+j)*4]     ;/* - */
1170%assign j j+1
1171%endrep
1172
1173        ;/* Third unrolled loop */
1174%assign j 0
1175%rep 3
1176        fld    dword [edx+(6+j)*4]     ;/* win[2][6+j] */
1177        fmul   dword [edi+(14-j)*4]    ;/* win[2][6+j]*x[14-j] */
1178        fstp   dword [edi+(6+j)*4]     ;/* - */
1179
1180        fld    dword [edx+(9+j)*4]     ;/* win[2][9+j] */
1181        fmul   dword [edi+(12+j)*4]    ;/* win[2][9+j]*x[12+j] */
1182        fstp   dword [edi+(9+j)*4]     ;/* - */
1183%assign j j+1
1184%endrep
1185
1186        ;/* Fourth unrolled loop */
1187        fldz
1188%assign j 0
1189%rep 3
1190        fst    dword [edi+(12+j)*4];
1191        ;/* If it is the last one, pop value */
1192%if j==2
1193        fstp   dword [edi+(15+j)*4];
1194%else
1195        fst    dword [edi+(15+j)*4];
1196%endif
1197%assign j j+1
1198%endrep
1199
1200        add    edi,18*4                ;/* Update x */
1201        add    esi,18*4                ;/* Update x0 */
1202
1203        inc    ecx
1204        cmp    ecx,eax
1205        jl     near .ShortBlockLoop
1206      .ExitShortBlockLoop:
1207
1208        mov    eax,[ebp+24]
1209        add    eax,17
1210        mov    ebx,18
1211        cdq
1212        div    ebx                     ;/* number of block is in eax */
1213        mov    ebx,[ebp+8]             ;/* ebx is y */
1214
1215        ;/* First check */
1216        cmp    ecx,eax
1217        jge    near .ExitLastBlockLoop
1218        ;/* Short block loop */
1219      .LastBlockLoop:
1220
1221%assign j 0
1222%rep 18
1223        mov    edx,[esi + j * 4]
1224        mov    [ebx + ecx * 4 + j * 128], edx
1225%assign j j+1
1226%endrep
1227        add    esi,18 * 4
1228
1229        inc    ecx
1230        cmp    ecx,eax
1231        jl     near .LastBlockLoop
1232      .ExitLastBlockLoop:
1233
1234        ;/* Compute return value */
1235        mov    eax,18
1236        mul    ecx
1237        mov    [SaveReturn],eax
1238
1239;        mov    eax,[_band_limit_nsb]
1240        mov    eax,[ebp + 32]
1241        cmp    ecx,eax
1242        jge    near .SkipFinalClear
1243      .FinalClear:
1244%assign j 0
1245%rep 18
1246        mov    dword [ebx + ecx * 4 + j * 128], 0
1247%assign j j+1
1248%endrep
1249        inc    ecx
1250        cmp    ecx,eax
1251        jl     near .FinalClear
1252
1253      .SkipFinalClear:
1254
1255        popad
1256        pop    ebp
1257        mov    eax,[SaveReturn]
1258        ret
1259
1260end
1261
1262;/* Small macro */
1263%macro InnerLoop 1
1264        xor    ecx,ecx
1265
1266      .loop_%1:
1267
1268        fld    dword [edi+ecx*8+4+(1+j)*128]
1269        fchs
1270        fstp   dword [edi+ecx*8+4+(1+j)*128]
1271
1272        inc    ecx
1273        cmp    ecx,eax
1274        jl     .loop_%1
1275%endmacro
1276;/*
1277; * FreqInvert ASM Version
1278; */
1279_FreqInvert_asm:
1280        push   ebp
1281        lea    ebp,[esp+8]
1282        pushad
1283
1284        mov    eax,[ebp+4]
1285        add    eax,17
1286        mov    ebx,18
1287        cdq
1288        div    ebx                     ;/* Number of blocks in eax */
1289        shr    eax,1
1290
1291        mov    edi,[ebp]
1292
1293        or     eax,eax
1294        je     near .ExitNow
1295
1296%assign j 0
1297%rep 9
1298        InnerLoop j
1299%assign j j+2
1300%endrep
1301      .ExitNow:
1302
1303        popad
1304        pop    ebp
1305        ret
1306