[svn] / branches / dev-api-4 / xvidcore / src / dct / x86_asm / simple_idct_mmx.asm Repository:
ViewVC logotype

Annotation of /branches/dev-api-4/xvidcore/src/dct/x86_asm/simple_idct_mmx.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1190 - (view) (download)

1 : edgomez 851 ;/*
2 :     ; * Simple IDCT MMX
3 :     ; *
4 :     ; * Copyright (c) 2001, 2002 Michael Niedermayer <michaelni@gmx.at>
5 :     ; *
6 :     ; * This library is free software; you can redistribute it and/or
7 :     ; * modify it under the terms of the GNU Lesser General Public
8 :     ; * License as published by the Free Software Foundation; either
9 :     ; * version 2 of the License, or (at your option) any later version.
10 :     ; *
11 :     ; * This library is distributed in the hope that it will be useful,
12 :     ; * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 :     ; * Lesser General Public License for more details.
15 :     ; *
16 :     ; * You should have received a copy of the GNU Lesser General Public
17 :     ; * License along with this library; if not, write to the Free Software
18 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 :     ; *
20 :     ; * Ported to nasm by Peter Ross <pross@xvid.org>
21 :     ; */
22 :    
23 : edgomez 1190 BITS 32
24 : edgomez 851
25 : edgomez 1190 ;=============================================================================
26 :     ; Macros and other preprocessor constants
27 :     ;=============================================================================
28 : edgomez 851
29 : edgomez 1190 %macro cglobal 1
30 :     %ifdef PREFIX
31 :     global _%1
32 :     %define %1 _%1
33 :     %else
34 :     global %1
35 :     %endif
36 :     %endmacro
37 : edgomez 851
38 :     %define ROW_SHIFT 11
39 :     %define COL_SHIFT 20
40 :     %define C0 23170 ;cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 = 23170.475006
41 :     %define C1 22725 ;cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 = 22725.260826
42 :     %define C2 21407 ;cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 = 21406.727617
43 :     %define C3 19266 ;cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 = 19265.545870
44 :     %define C4 16383 ;cos(i*M_PI/16)*sqrt(2)*(1<<14) - 0.5 = 16384.000000
45 :     %define C5 12873 ;cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 = 12872.826198
46 :     %define C6 8867 ;cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 = 8866.956905
47 :     %define C7 4520 ;cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 = 4520.335430
48 :    
49 : edgomez 1190 ;===========================================================================
50 :     ; Data (Read Only)
51 :     ;===========================================================================
52 :    
53 :     SECTION .rodata
54 :    
55 :     ;-----------------------------------------------------------------------------
56 :     ; Trigonometric Tables
57 :     ;-----------------------------------------------------------------------------
58 :    
59 :     ALIGN 16
60 :     wm1010:
61 :     dw 0, 0xffff, 0, 0xffff
62 :    
63 :     ALIGN 16
64 :     d40000:
65 :     dd 0x40000, 0
66 :    
67 :     ALIGN 16
68 :     coeffs:
69 : edgomez 851 dw 1<<(ROW_SHIFT-1), 0, 1<<(ROW_SHIFT-1), 0, ; 0
70 :     dw 1<<(ROW_SHIFT-1), 1, 1<<(ROW_SHIFT-1), 0, ; 8
71 :    
72 :     dw C4, C4, C4, C4 ; 16
73 :     dw C4, -C4, C4, -C4 ; 24
74 :    
75 :     dw C2, C6, C2, C6 ; 32
76 :     dw C6, -C2, C6, -C2 ; 40
77 :    
78 :     dw C1, C3, C1, C3 ; 48
79 :     dw C5, C7, C5, C7 ; 56
80 :    
81 :     dw C3, -C7, C3, -C7 ; 64
82 :     dw -C1, -C5, -C1, -C5 ; 72
83 :    
84 :     dw C5, -C1, C5, -C1 ; 80
85 :     dw C7, C3, C7, C3 ; 88
86 :    
87 :     dw C7, -C5, C7, -C5 ; 96
88 :     dw C3, -C1, C3, -C1 ; 104
89 :    
90 :    
91 :     ;===========================================================================
92 : edgomez 1190 ; Helper macros
93 : edgomez 851 ;===========================================================================
94 :    
95 : edgomez 1190 ;---------------------------------------------------------------------------
96 :     ; DC_COND_IDCT
97 :     ;---------------------------------------------------------------------------
98 :    
99 : edgomez 851 %macro DC_COND_IDCT 8
100 :     %define src0 %1
101 :     %define src4 %2
102 :     %define src1 %3
103 :     %define src5 %4
104 :     %define dst %5
105 :     %define rounder_op %6
106 :     %define rounder_arg %7
107 :     %define shift %8
108 :     movq mm0,[src0] ; R4 R0 r4 r0
109 :     movq mm1,[src4] ; R6 R2 r6 r2
110 :     movq mm2,[src1] ; R3 R1 r3 r1
111 :     movq mm3,[src5] ; R7 R5 r7 r5
112 :     movq mm4,[wm1010]
113 :     pand mm4,mm0
114 :     por mm4,mm1
115 :     por mm4,mm2
116 :     por mm4,mm3
117 :     packssdw mm4,mm4
118 :     movd eax,mm4
119 :     or eax,eax
120 :     jz near .skip1
121 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
122 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
123 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
124 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
125 :     movq mm5,[coeffs+32] ; C6 C2 C6 C2
126 :     pmaddwd mm5,mm1 ; C6R6+C2R2 C6r6+C2r2
127 :     movq mm6,[coeffs+40] ; -C2 C6 -C2 C6
128 :     pmaddwd mm1,mm6 ; -C2R6+C6R2 -C2r6+C6r2
129 :     movq mm7,[coeffs+48] ; C3 C1 C3 C1
130 :     pmaddwd mm7,mm2 ; C3R3+C1R1 C3r3+C1r1
131 :     rounder_op mm4, rounder_arg
132 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
133 :     paddd mm4,mm5 ; A0 a0
134 :     psubd mm6,mm5 ; A3 a3
135 :     movq mm5,[coeffs+56] ; C7 C5 C7 C5
136 :     pmaddwd mm5,mm3 ; C7R7+C5R5 C7r7+C5r5
137 :     rounder_op mm0, rounder_arg
138 :     paddd mm1,mm0 ; A1 a1
139 :     paddd mm0,mm0
140 :     psubd mm0,mm1 ; A2 a2
141 :     pmaddwd mm2,[coeffs+64] ; -C7R3+C3R1 -C7r3+C3r1
142 :     paddd mm7,mm5 ; B0 b0
143 :     movq mm5,[coeffs+72] ; -C5 -C1 -C5 -C1
144 :     pmaddwd mm5,mm3 ; -C5R7-C1R5 -C5r7-C1r5
145 :     paddd mm7,mm4 ; A0+B0 a0+b0
146 :     paddd mm4,mm4 ; 2A0 2a0
147 :     psubd mm4,mm7 ; A0-B0 a0-b0
148 :     paddd mm5,mm2 ; B1 b1
149 :     psrad mm7,shift
150 :     psrad mm4,shift
151 :     movq mm2,mm1 ; A1 a1
152 :     paddd mm1,mm5 ; A1+B1 a1+b1
153 :     psubd mm2,mm5 ; A1-B1 a1-b1
154 :     psrad mm1,shift
155 :     psrad mm2,shift
156 :     packssdw mm7,mm1 ; A1+B1 a1+b1 A0+B0 a0+b0
157 :     packssdw mm2,mm4 ; A0-B0 a0-b0 A1-B1 a1-b1
158 :     movq [dst],mm7
159 :     movq mm1,[src1] ; R3 R1 r3 r1
160 :     movq mm4,[coeffs+80] ;-C1 C5 -C1 C5
161 :     movq [dst + 24],mm2
162 :     pmaddwd mm4,mm1 ; -C1R3+C5R1 -C1r3+C5r1
163 :     movq mm7,[coeffs+88] ; C3 C7 C3 C7
164 :     pmaddwd mm1,[coeffs+96] ; -C5R3+C7R1 -C5r3+C7r1
165 :     pmaddwd mm7,mm3 ; C3R7+C7R5 C3r7+C7r5
166 :     movq mm2,mm0 ; A2 a2
167 :     pmaddwd mm3,[coeffs+104] ; -C1R7+C3R5 -C1r7+C3r5
168 :     paddd mm4,mm7 ; B2 b2
169 :     paddd mm2,mm4 ; A2+B2 a2+b2
170 :     psubd mm0,mm4 ; a2-B2 a2-b2
171 :     psrad mm2,shift
172 :     psrad mm0,shift
173 :     movq mm4,mm6 ; A3 a3
174 :     paddd mm3,mm1 ; B3 b3
175 :     paddd mm6,mm3 ; A3+B3 a3+b3
176 :     psubd mm4,mm3 ; a3-B3 a3-b3
177 :     psrad mm6,shift
178 :     packssdw mm2,mm6 ; A3+B3 a3+b3 A2+B2 a2+b2
179 :     movq [ dst + 8],mm2
180 :     psrad mm4,shift
181 :     packssdw mm4,mm0 ; A2-B2 a2-b2 A3-B3 a3-b3
182 :     movq [ dst + 16],mm4
183 :     jmp short .skip2
184 :     .skip1
185 :     pslld mm0,16
186 :     paddd mm0,[d40000]
187 :     psrad mm0,13
188 :     packssdw mm0,mm0
189 :     movq [ dst ],mm0
190 :     movq [ dst + 8],mm0
191 :     movq [ dst + 16],mm0
192 :     movq [ dst + 24],mm0
193 :     .skip2
194 :     %undef src0
195 :     %undef src4
196 :     %undef src1
197 :     %undef src5
198 :     %undef dst
199 :     %undef rounder_op
200 :     %undef rounder_arg
201 :     %undef shift
202 :     %endmacro
203 :    
204 : edgomez 1190 ;---------------------------------------------------------------------------
205 :     ; Z_COND_IDCT
206 :     ;---------------------------------------------------------------------------
207 : edgomez 851
208 :     %macro Z_COND_IDCT 9
209 :     %define src0 %1
210 :     %define src4 %2
211 :     %define src1 %3
212 :     %define src5 %4
213 :     %define dst %5
214 :     %define rounder_op %6
215 :     %define rounder_arg %7
216 :     %define shift %8
217 :     %define bt %9
218 :     movq mm0,[src0] ; R4 R0 r4 r0
219 :     movq mm1,[src4] ; R6 R2 r6 r2
220 :     movq mm2,[src1] ; R3 R1 r3 r1
221 :     movq mm3,[src5] ; R7 R5 r7 r5
222 :     movq mm4,mm0
223 :     por mm4,mm1
224 :     por mm4,mm2
225 :     por mm4,mm3
226 :     packssdw mm4,mm4
227 :     movd eax,mm4
228 :     or eax,eax
229 :     jz near bt
230 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
231 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
232 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
233 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
234 :     movq mm5,[coeffs+32] ; C6 C2 C6 C2
235 :     pmaddwd mm5,mm1 ; C6R6+C2R2 C6r6+C2r2
236 :     movq mm6,[coeffs+40] ; -C2 C6 -C2 C6
237 :     pmaddwd mm1,mm6 ; -C2R6+C6R2 -C2r6+C6r2
238 :     movq mm7,[coeffs+48] ; C3 C1 C3 C1
239 :     pmaddwd mm7,mm2 ; C3R3+C1R1 C3r3+C1r1
240 :     rounder_op mm4, rounder_arg
241 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
242 :     paddd mm4,mm5 ; A0 a0
243 :     psubd mm6,mm5 ; A3 a3
244 :     movq mm5,[coeffs+56] ; C7 C5 C7 C5
245 :     pmaddwd mm5,mm3 ; C7R7+C5R5 C7r7+C5r5
246 :     rounder_op mm0, rounder_arg
247 :     paddd mm1,mm0 ; A1 a1
248 :     paddd mm0,mm0
249 :     psubd mm0,mm1 ; A2 a2
250 :     pmaddwd mm2,[coeffs+64] ; -C7R3+C3R1 -C7r3+C3r1
251 :     paddd mm7,mm5 ; B0 b0
252 :     movq mm5,[coeffs+72] ; -C5 -C1 -C5 -C1
253 :     pmaddwd mm5,mm3 ; -C5R7-C1R5 -C5r7-C1r5
254 :     paddd mm7,mm4 ; A0+B0 a0+b0
255 :     paddd mm4,mm4 ; 2A0 2a0
256 :     psubd mm4,mm7 ; A0-B0 a0-b0
257 :     paddd mm5,mm2 ; B1 b1
258 :     psrad mm7,shift
259 :     psrad mm4,shift
260 :     movq mm2,mm1 ; A1 a1
261 :     paddd mm1,mm5 ; A1+B1 a1+b1
262 :     psubd mm2,mm5 ; A1-B1 a1-b1
263 :     psrad mm1,shift
264 :     psrad mm2,shift
265 :     packssdw mm7,mm1 ; A1+B1 a1+b1 A0+B0 a0+b0
266 :     packssdw mm2,mm4 ; A0-B0 a0-b0 A1-B1 a1-b1
267 :     movq [ dst ],mm7
268 :     movq mm1,[src1] ; R3 R1 r3 r1
269 :     movq mm4,[coeffs+80] ; -C1 C5 -C1 C5
270 :     movq [ dst + 24 ],mm2
271 :     pmaddwd mm4,mm1 ; -C1R3+C5R1 -C1r3+C5r1
272 :     movq mm7,[coeffs+88] ; C3 C7 C3 C7
273 :     pmaddwd mm1,[coeffs+96] ; -C5R3+C7R1 -C5r3+C7r1
274 :     pmaddwd mm7,mm3 ; C3R7+C7R5 C3r7+C7r5
275 :     movq mm2,mm0 ; A2 a2
276 :     pmaddwd mm3,[coeffs+104] ; -C1R7+C3R5 -C1r7+C3r5
277 :     paddd mm4,mm7 ; B2 b2
278 :     paddd mm2,mm4 ; A2+B2 a2+b2
279 :     psubd mm0,mm4 ; a2-B2 a2-b2
280 :     psrad mm2,shift
281 :     psrad mm0,shift
282 :     movq mm4,mm6 ; A3 a3
283 :     paddd mm3,mm1 ; B3 b3
284 :     paddd mm6,mm3 ; A3+B3 a3+b3
285 :     psubd mm4,mm3 ; a3-B3 a3-b3
286 :     psrad mm6,shift
287 :     packssdw mm2,mm6 ; A3+B3 a3+b3 A2+B2 a2+b2
288 :     movq [ dst + 8],mm2
289 :     psrad mm4,shift
290 :     packssdw mm4,mm0 ; A2-B2 a2-b2 A3-B3 a3-b3
291 :     movq [dst + 16],mm4
292 :     %undef src0
293 :     %undef src4
294 :     %undef src1
295 :     %undef src5
296 :     %undef dst
297 :     %undef rounder_op
298 :     %undef rounder_arg
299 :     %undef shift
300 :     %undef bt
301 :     %endmacro
302 :    
303 : edgomez 1190 ;---------------------------------------------------------------------------
304 :     ; IDCT0
305 :     ;---------------------------------------------------------------------------
306 : edgomez 851
307 :     %macro IDCT0 8
308 :     %define src0 %1
309 :     %define src4 %2
310 :     %define src1 %3
311 :     %define src5 %4
312 :     %define dst %5
313 :     %define rounder_op %6
314 :     %define rounder_arg %7
315 :     %define shift %8
316 :     movq mm0,[src0] ; R4 R0 r4 r0
317 :     movq mm1,[src4] ; R6 R2 r6 r2
318 :     movq mm2,[src1] ; R3 R1 r3 r1
319 :     movq mm3,[src5] ; R7 R5 r7 r5
320 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
321 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
322 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
323 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
324 :     movq mm5,[coeffs+32] ; C6 C2 C6 C2
325 :     pmaddwd mm5,mm1 ; C6R6+C2R2 C6r6+C2r2
326 :     movq mm6,[coeffs+40] ; -C2 C6 -C2 C6
327 :     pmaddwd mm1,mm6 ; -C2R6+C6R2 -C2r6+C6r2
328 :     ; rounder_op mm4, rounder_arg
329 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
330 :     movq mm7,[coeffs+48] ; C3 C1 C3 C1
331 :     ; rounder_op mm0, rounder_arg
332 :     pmaddwd mm7,mm2 ; C3R3+C1R1 C3r3+C1r1
333 :     paddd mm4,mm5 ; A0 a0
334 :     psubd mm6,mm5 ; A3 a3
335 :     movq mm5,mm0 ; -C4R4+C4R0 -C4r4+C4r0
336 :     paddd mm0,mm1 ; A1 a1
337 :     psubd mm5,mm1 ; A2 a2
338 :     movq mm1,[coeffs+56] ; C7 C5 C7 C5
339 :     pmaddwd mm1,mm3 ; C7R7+C5R5 C7r7+C5r5
340 :     pmaddwd mm2,[coeffs+64] ; -C7R3+C3R1 -C7r3+C3r1
341 :     paddd mm7,mm1 ; B0 b0
342 :     movq mm1,[coeffs+72] ; -C5 -C1 -C5 -C1
343 :     pmaddwd mm1,mm3 ; -C5R7-C1R5 -C5r7-C1r5
344 :     paddd mm7,mm4 ; A0+B0 a0+b0
345 :     paddd mm4,mm4 ; 2A0 2a0
346 :     psubd mm4,mm7 ; A0-B0 a0-b0
347 :     paddd mm1,mm2 ; B1 b1
348 :     psrad mm7,shift
349 :     psrad mm4,shift
350 :     movq mm2,mm0 ; A1 a1
351 :     paddd mm0,mm1 ; A1+B1 a1+b1
352 :     psubd mm2,mm1 ; A1-B1 a1-b1
353 :     psrad mm0,shift
354 :     psrad mm2,shift
355 :     packssdw mm7,mm7 ; A0+B0 a0+b0
356 :     movd [ dst ],mm7
357 :     packssdw mm0,mm0 ; A1+B1 a1+b1
358 :     movd [ dst + 16],mm0
359 :     packssdw mm2,mm2 ; A1-B1 a1-b1
360 :     movd [ dst + 96 ],mm2
361 :     packssdw mm4,mm4 ; A0-B0 a0-b0
362 :     movd [ dst + 112],mm4
363 :     movq mm0,[src1] ; R3 R1 r3 r1
364 :     movq mm4,[coeffs+80] ; -C1 C5 -C1 C5
365 :     pmaddwd mm4,mm0 ; -C1R3+C5R1 -C1r3+C5r1
366 :     movq mm7,[coeffs+88] ; C3 C7 C3 C7
367 :     pmaddwd mm0,[coeffs+96] ; -C5R3+C7R1 -C5r3+C7r1
368 :     pmaddwd mm7,mm3 ; C3R7+C7R5 C3r7+C7r5
369 :     movq mm2,mm5 ; A2 a2
370 :     pmaddwd mm3,[coeffs+104] ; -C1R7+C3R5 -C1r7+C3r5
371 :     paddd mm4,mm7 ; B2 b2
372 :     paddd mm2,mm4 ; A2+B2 a2+b2
373 :     psubd mm5,mm4 ; a2-B2 a2-b2
374 :     psrad mm2,shift
375 :     psrad mm5,shift
376 :     movq mm4,mm6 ; A3 a3
377 :     paddd mm3,mm0 ; B3 b3
378 :     paddd mm6,mm3 ; A3+B3 a3+b3
379 :     psubd mm4,mm3 ; a3-B3 a3-b3
380 :     psrad mm6,shift
381 :     psrad mm4,shift
382 :     packssdw mm2,mm2 ; A2+B2 a2+b2
383 :     packssdw mm6,mm6 ; A3+B3 a3+b3
384 :     movd [ dst + 32 ],mm2
385 :     packssdw mm4,mm4 ; A3-B3 a3-b3
386 :     packssdw mm5,mm5 ; A2-B2 a2-b2
387 :     movd [ dst + 48 ],mm6
388 :     movd [ dst + 64 ],mm4
389 :     movd [ dst + 80 ],mm5
390 :     %undef src0
391 :     %undef src4
392 :     %undef src1
393 :     %undef src5
394 :     %undef dst
395 :     %undef rounder_op
396 :     %undef rounder_arg
397 :     %undef shift
398 :     %endmacro
399 :    
400 : edgomez 1190 ;---------------------------------------------------------------------------
401 :     ; IDCT4
402 :     ;---------------------------------------------------------------------------
403 : edgomez 851
404 :     %macro IDCT4 8
405 :     %define src0 %1
406 :     %define src4 %2
407 :     %define src1 %3
408 :     %define src5 %4
409 :     %define dst %5
410 :     %define rounder_op %6
411 :     %define rounder_arg %7
412 :     %define shift %8
413 :     movq mm0,[src0] ; R4 R0 r4 r0
414 :     movq mm1,[src4] ; R6 R2 r6 r2
415 :     movq mm3,[src5] ; R7 R5 r7 r5
416 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
417 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
418 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
419 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
420 :     movq mm5,[coeffs+32] ; C6 C2 C6 C2
421 :     pmaddwd mm5,mm1 ; C6R6+C2R2 C6r6+C2r2
422 :     movq mm6,[coeffs+40] ; -C2 C6 -C2 C6
423 :     pmaddwd mm1,mm6 ; -C2R6+C6R2 -C2r6+C6r2
424 :     ; rounder_op mm4, rounder_arg
425 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
426 :     ; rounder_op mm0, rounder_arg
427 :     paddd mm4,mm5 ; A0 a0
428 :     psubd mm6,mm5 ; A3 a3
429 :     movq mm5,mm0 ; -C4R4+C4R0 -C4r4+C4r0
430 :     paddd mm0,mm1 ; A1 a1
431 :     psubd mm5,mm1 ; A2 a2
432 :     movq mm1,[coeffs+56] ; C7 C5 C7 C5
433 :     pmaddwd mm1,mm3 ; C7R7+C5R5 C7r7+C5r5
434 :     movq mm7,[coeffs+72] ; -C5 -C1 -C5 -C1
435 :     pmaddwd mm7,mm3 ; -C5R7-C1R5 -C5r7-C1r5
436 :     paddd mm1,mm4 ; A0+B0 a0+b0
437 :     paddd mm4,mm4 ; 2A0 2a0
438 :     psubd mm4,mm1 ; A0-B0 a0-b0
439 :     psrad mm1,shift
440 :     psrad mm4,shift
441 :     movq mm2,mm0 ; A1 a1
442 :     paddd mm0,mm7 ; A1+B1 a1+b1
443 :     psubd mm2,mm7 ; A1-B1 a1-b1
444 :     psrad mm0,shift
445 :     psrad mm2,shift
446 :     packssdw mm1,mm1 ; A0+B0 a0+b0
447 :     movd [ dst ],mm1
448 :     packssdw mm0,mm0 ; A1+B1 a1+b1
449 :     movd [ dst + 16 ],mm0
450 :     packssdw mm2,mm2 ; A1-B1 a1-b1
451 :     movd [ dst + 96 ],mm2
452 :     packssdw mm4,mm4 ; A0-B0 a0-b0
453 :     movd [ dst + 112 ],mm4
454 :     movq mm1,[coeffs+88] ; C3 C7 C3 C7
455 :     pmaddwd mm1,mm3 ; C3R7+C7R5 C3r7+C7r5
456 :     movq mm2,mm5 ; A2 a2
457 :     pmaddwd mm3,[coeffs+104] ; -C1R7+C3R5 -C1r7+C3r5
458 :     paddd mm2,mm1 ; A2+B2 a2+b2
459 :     psubd mm5,mm1 ; a2-B2 a2-b2
460 :     psrad mm2,shift
461 :     psrad mm5,shift
462 :     movq mm1,mm6 ; A3 a3
463 :     paddd mm6,mm3 ; A3+B3 a3+b3
464 :     psubd mm1,mm3 ; a3-B3 a3-b3
465 :     psrad mm6,shift
466 :     psrad mm1,shift
467 :     packssdw mm2,mm2 ; A2+B2 a2+b2
468 :     packssdw mm6,mm6 ; A3+B3 a3+b3
469 :     movd [dst + 32],mm2
470 :     packssdw mm1,mm1 ; A3-B3 a3-b3
471 :     packssdw mm5,mm5 ; A2-B2 a2-b2
472 :     movd [dst + 48],mm6
473 :     movd [dst + 64],mm1
474 :     movd [dst + 80],mm5
475 :     %undef src0
476 :     %undef src4
477 :     %undef src1
478 :     %undef src5
479 :     %undef dst
480 :     %undef rounder_op
481 :     %undef rounder_arg
482 :     %undef shift
483 :     %endmacro
484 :    
485 : edgomez 1190 ;---------------------------------------------------------------------------
486 :     ; IDCT6
487 :     ;---------------------------------------------------------------------------
488 : edgomez 851
489 :     %macro IDCT6 8
490 :     %define src0 %1
491 :     %define src4 %2
492 :     %define src1 %3
493 :     %define src5 %4
494 :     %define dst %5
495 :     %define rounder_op %6
496 :     %define rounder_arg %7
497 :     %define shift %8
498 :     movq mm0,[src0] ; R4 R0 r4 r0
499 :     movq mm3,[src5] ; R7 R5 r7 r5
500 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
501 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
502 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
503 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
504 :     ; rounder_op mm4, rounder_arg
505 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
506 :     ; rounder_op mm0, rounder_arg
507 :     movq mm5,mm0 ; -C4R4+C4R0 -C4r4+C4r0
508 :     movq mm1,[coeffs+56] ; C7 C5 C7 C5
509 :     pmaddwd mm1,mm3 ; C7R7+C5R5 C7r7+C5r5
510 :     movq mm7,[coeffs+72] ; -C5 -C1 -C5 -C1
511 :     pmaddwd mm7,mm3 ; -C5R7-C1R5 -C5r7-C1r5
512 :     paddd mm1,mm4 ; A0+B0 a0+b0
513 :     paddd mm4,mm4 ; 2A0 2a0
514 :     psubd mm4,mm1 ; A0-B0 a0-b0
515 :     psrad mm1,shift
516 :     psrad mm4,shift
517 :     movq mm2,mm0 ; A1 a1
518 :     paddd mm0,mm7 ; A1+B1 a1+b1
519 :     psubd mm2,mm7 ; A1-B1 a1-b1
520 :     psrad mm0,shift
521 :     psrad mm2,shift
522 :     packssdw mm1,mm1 ; A0+B0 a0+b0
523 :     movd [ dst ],mm1
524 :     packssdw mm0,mm0 ; A1+B1 a1+b1
525 :     movd [ dst + 16 ],mm0
526 :     packssdw mm2,mm2 ; A1-B1 a1-b1
527 :     movd [ dst + 96 ],mm2
528 :     packssdw mm4,mm4 ; A0-B0 a0-b0
529 :     movd [ dst + 112 ],mm4
530 :     movq mm1,[coeffs+88] ; C3 C7 C3 C7
531 :     pmaddwd mm1,mm3 ; C3R7+C7R5 C3r7+C7r5
532 :     movq mm2,mm5 ; A2 a2
533 :     pmaddwd mm3,[coeffs+104] ; -C1R7+C3R5 -C1r7+C3r5
534 :     paddd mm2,mm1 ; A2+B2 a2+b2
535 :     psubd mm5,mm1 ; a2-B2 a2-b2
536 :     psrad mm2,shift
537 :     psrad mm5,shift
538 :     movq mm1,mm6 ; A3 a3
539 :     paddd mm6,mm3 ; A3+B3 a3+b3
540 :     psubd mm1,mm3 ; a3-B3 a3-b3
541 :     psrad mm6,shift
542 :     psrad mm1,shift
543 :     packssdw mm2,mm2 ; A2+B2 a2+b2
544 :     packssdw mm6,mm6 ; A3+B3 a3+b3
545 :     movd [dst + 32],mm2
546 :     packssdw mm1,mm1 ; A3-B3 a3-b3
547 :     packssdw mm5,mm5 ; A2-B2 a2-b2
548 :     movd [dst + 48],mm6
549 :     movd [dst + 64],mm1
550 :     movd [dst + 80],mm5
551 :     %undef src0
552 :     %undef src4
553 :     %undef src1
554 :     %undef src5
555 :     %undef dst
556 :     %undef rounder_op
557 :     %undef rounder_arg
558 :     %undef shift
559 :     %endmacro
560 :    
561 : edgomez 1190 ;---------------------------------------------------------------------------
562 :     ; IDCT2
563 :     ;---------------------------------------------------------------------------
564 : edgomez 851
565 :     %macro IDCT2 8
566 :     %define src0 %1
567 :     %define src4 %2
568 :     %define src1 %3
569 :     %define src5 %4
570 :     %define dst %5
571 :     %define rounder_op %6
572 :     %define rounder_arg %7
573 :     %define shift %8
574 :     movq mm0,[src0] ; R4 R0 r4 r0
575 :     movq mm2,[src1] ; R3 R1 r3 r1
576 :     movq mm3,[src5] ; R7 R5 r7 r5
577 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
578 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
579 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
580 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
581 :     ; rounder_op mm4, rounder_arg
582 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
583 :     movq mm7,[coeffs+48] ; C3 C1 C3 C1
584 :     ; rounder_op mm0, rounder_arg
585 :     pmaddwd mm7,mm2 ; C3R3+C1R1 C3r3+C1r1
586 :     movq mm5,mm0 ; -C4R4+C4R0 -C4r4+C4r0
587 :     movq mm1,[coeffs+56] ; C7 C5 C7 C5
588 :     pmaddwd mm1,mm3 ; C7R7+C5R5 C7r7+C5r5
589 :     pmaddwd mm2,[coeffs+64] ; -C7R3+C3R1 -C7r3+C3r1
590 :     paddd mm7,mm1 ; B0 b0
591 :     movq mm1,[coeffs+72] ; -C5 -C1 -C5 -C1
592 :     pmaddwd mm1,mm3 ; -C5R7-C1R5 -C5r7-C1r5
593 :     paddd mm7,mm4 ; A0+B0 a0+b0
594 :     paddd mm4,mm4 ; 2A0 2a0
595 :     psubd mm4,mm7 ; A0-B0 a0-b0
596 :     paddd mm1,mm2 ; B1 b1
597 :     psrad mm7,shift
598 :     psrad mm4,shift
599 :     movq mm2,mm0 ; A1 a1
600 :     paddd mm0,mm1 ; A1+B1 a1+b1
601 :     psubd mm2,mm1 ; A1-B1 a1-b1
602 :     psrad mm0,shift
603 :     psrad mm2,shift
604 :     packssdw mm7,mm7 ; A0+B0 a0+b0
605 :     movd [dst],mm7
606 :     packssdw mm0,mm0 ; A1+B1 a1+b1
607 :     movd [dst + 16],mm0
608 :     packssdw mm2,mm2 ; A1-B1 a1-b1
609 :     movd [dst + 96],mm2
610 :     packssdw mm4,mm4 ; A0-B0 a0-b0
611 :     movd [dst + 112],mm4
612 :     movq mm0,[src1] ; R3 R1 r3 r1
613 :     movq mm4,[coeffs+80] ; -C1 C5 -C1 C5
614 :     pmaddwd mm4,mm0 ; -C1R3+C5R1 -C1r3+C5r1
615 :     movq mm7,[coeffs+88] ; C3 C7 C3 C7
616 :     pmaddwd mm0,[coeffs+96] ; -C5R3+C7R1 -C5r3+C7r1
617 :     pmaddwd mm7,mm3 ; C3R7+C7R5 C3r7+C7r5
618 :     movq mm2,mm5 ; A2 a2
619 :     pmaddwd mm3,[coeffs+104] ; -C1R7+C3R5 -C1r7+C3r5
620 :     paddd mm4,mm7 ; B2 b2
621 :     paddd mm2,mm4 ; A2+B2 a2+b2
622 :     psubd mm5,mm4 ; a2-B2 a2-b2
623 :     psrad mm2,shift
624 :     psrad mm5,shift
625 :     movq mm4,mm6 ; A3 a3
626 :     paddd mm3,mm0 ; B3 b3
627 :     paddd mm6,mm3 ; A3+B3 a3+b3
628 :     psubd mm4,mm3 ; a3-B3 a3-b3
629 :     psrad mm6,shift
630 :     psrad mm4,shift
631 :     packssdw mm2,mm2 ; A2+B2 a2+b2
632 :     packssdw mm6,mm6 ; A3+B3 a3+b3
633 :     movd [dst + 32],mm2
634 :     packssdw mm4,mm4 ; A3-B3 a3-b3
635 :     packssdw mm5,mm5 ; A2-B2 a2-b2
636 :     movd [dst + 48],mm6
637 :     movd [dst + 64],mm4
638 :     movd [dst + 80],mm5
639 :     %undef src0
640 :     %undef src4
641 :     %undef src1
642 :     %undef src5
643 :     %undef dst
644 :     %undef rounder_op
645 :     %undef rounder_arg
646 :     %undef shift
647 :     %endmacro
648 :    
649 : edgomez 1190 ;---------------------------------------------------------------------------
650 :     ; IDCT3
651 :     ;---------------------------------------------------------------------------
652 : edgomez 851
653 :     %macro IDCT3 8
654 :     %define src0 %1
655 :     %define src4 %2
656 :     %define src1 %3
657 :     %define src5 %4
658 :     %define dst %5
659 :     %define rounder_op %6
660 :     %define rounder_arg %7
661 :     %define shift %8
662 :     movq mm0,[src0] ; R4 R0 r4 r0
663 :     movq mm2,[src1] ; R3 R1 r3 r1
664 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
665 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
666 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
667 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
668 :     ; rounder_op mm4, rounder_arg
669 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
670 :     movq mm7,[coeffs+48] ; C3 C1 C3 C1
671 :     ; rounder_op mm0, rounder_arg
672 :     pmaddwd mm7,mm2 ; C3R3+C1R1 C3r3+C1r1
673 :     movq mm5,mm0 ; -C4R4+C4R0 -C4r4+C4r0
674 :     movq mm3,[coeffs+64]
675 :     pmaddwd mm3,mm2 ; -C7R3+C3R1 -C7r3+C3r1
676 :     paddd mm7,mm4 ; A0+B0 a0+b0
677 :     paddd mm4,mm4 ; 2A0 2a0
678 :     psubd mm4,mm7 ; A0-B0 a0-b0
679 :     psrad mm7,shift
680 :     psrad mm4,shift
681 :     movq mm1,mm0 ; A1 a1
682 :     paddd mm0,mm3 ; A1+B1 a1+b1
683 :     psubd mm1,mm3 ; A1-B1 a1-b1
684 :     psrad mm0,shift
685 :     psrad mm1,shift
686 :     packssdw mm7,mm7 ; A0+B0 a0+b0
687 :     movd [dst],mm7
688 :     packssdw mm0,mm0 ; A1+B1 a1+b1
689 :     movd [dst + 16],mm0
690 :     packssdw mm1,mm1 ; A1-B1 a1-b1
691 :     movd [dst + 96],mm1
692 :     packssdw mm4,mm4 ; A0-B0 a0-b0
693 :     movd [dst + 112],mm4
694 :     movq mm4,[coeffs+80] ; -C1 C5 -C1 C5
695 :     pmaddwd mm4,mm2 ; -C1R3+C5R1 -C1r3+C5r1
696 :     pmaddwd mm2,[coeffs+96] ; -C5R3+C7R1 -C5r3+C7r1
697 :     movq mm1,mm5 ; A2 a2
698 :     paddd mm1,mm4 ; A2+B2 a2+b2
699 :     psubd mm5,mm4 ; a2-B2 a2-b2
700 :     psrad mm1,shift
701 :     psrad mm5,shift
702 :     movq mm4,mm6 ; A3 a3
703 :     paddd mm6,mm2 ; A3+B3 a3+b3
704 :     psubd mm4,mm2 ; a3-B3 a3-b3
705 :     psrad mm6,shift
706 :     psrad mm4,shift
707 :     packssdw mm1,mm1 ; A2+B2 a2+b2
708 :     packssdw mm6,mm6 ; A3+B3 a3+b3
709 :     movd [dst + 32],mm1
710 :     packssdw mm4,mm4 ; A3-B3 a3-b3
711 :     packssdw mm5,mm5 ; A2-B2 a2-b2
712 :     movd [dst + 48],mm6
713 :     movd [dst + 64],mm4
714 :     movd [dst + 80],mm5
715 :     %undef src0
716 :     %undef src4
717 :     %undef src1
718 :     %undef src5
719 :     %undef dst
720 :     %undef rounder_op
721 :     %undef rounder_arg
722 :     %undef shift
723 :     %endmacro
724 :    
725 : edgomez 1190 ;---------------------------------------------------------------------------
726 :     ; IDCT5
727 :     ;---------------------------------------------------------------------------
728 : edgomez 851
729 :     %macro IDCT5 8
730 :     %define src0 %1
731 :     %define src4 %2
732 :     %define src1 %3
733 :     %define src5 %4
734 :     %define dst %5
735 :     %define rounder_op %6
736 :     %define rounder_arg %7
737 :     %define shift %8
738 :     movq mm0,[src0] ; R4 R0 r4 r0
739 :     movq mm1,[src4] ; R6 R2 r6 r2
740 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
741 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
742 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
743 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
744 :     movq mm5,[coeffs+32] ; C6 C2 C6 C2
745 :     pmaddwd mm5,mm1 ; C6R6+C2R2 C6r6+C2r2
746 :     movq mm6,[coeffs+40] ; -C2 C6 -C2 C6
747 :     pmaddwd mm1,mm6 ; -C2R6+C6R2 -C2r6+C6r2
748 :     ; rounder_op mm4, rounder_arg
749 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
750 :     paddd mm4,mm5 ; A0 a0
751 :     ; rounder_op mm0, rounder_arg
752 :     psubd mm6,mm5 ; A3 a3
753 :     movq mm5,mm0 ; -C4R4+C4R0 -C4r4+C4r0
754 :     paddd mm0,mm1 ; A1 a1
755 :     psubd mm5,mm1 ; A2 a2
756 :     movq mm2,[src0 + 8] ; R4 R0 r4 r0
757 :     movq mm3,[src4 + 8] ; R6 R2 r6 r2
758 :     movq mm1,[coeffs+16] ; C4 C4 C4 C4
759 :     pmaddwd mm1,mm2 ; C4R4+C4R0 C4r4+C4r0
760 :     movq mm7,[coeffs+24] ; -C4 C4 -C4 C4
761 :     pmaddwd mm2,mm7 ; -C4R4+C4R0 -C4r4+C4r0
762 :     movq mm7,[coeffs+32] ; C6 C2 C6 C2
763 :     pmaddwd mm7,mm3 ; C6R6+C2R2 C6r6+C2r2
764 :     pmaddwd mm3,[coeffs+40] ; -C2R6+C6R2 -C2r6+C6r2
765 :     ; rounder_op mm1, rounder_arg
766 :     paddd mm7,mm1 ; A0 a0
767 :     paddd mm1,mm1 ; 2C0 2c0
768 :     ; rounder_op mm2, rounder_arg
769 :     psubd mm1,mm7 ; A3 a3
770 :     paddd mm3,mm2 ; A1 a1
771 :     paddd mm2,mm2 ; 2C1 2c1
772 :     psubd mm2,mm3 ; A2 a2
773 :     psrad mm4,shift
774 :     psrad mm7,shift
775 :     psrad mm3,shift
776 :     packssdw mm4,mm7 ; A0 a0
777 :     movq [dst],mm4
778 :     psrad mm0,shift
779 :     packssdw mm0,mm3 ; A1 a1
780 :     movq [dst + 16],mm0
781 :     movq [dst + 96],mm0
782 :     movq [dst + 112],mm4
783 :     psrad mm5,shift
784 :     psrad mm6,shift
785 :     psrad mm2,shift
786 :     packssdw mm5,mm2 ; A2-B2 a2-b2
787 :     movq [dst + 32],mm5
788 :     psrad mm1,shift
789 :     packssdw mm6,mm1 ; A3+B3 a3+b3
790 :     movq [dst + 48],mm6
791 :     movq [dst + 64],mm6
792 :     movq [dst + 80],mm5
793 :     %undef src0
794 :     %undef src4
795 :     %undef src1
796 :     %undef src5
797 :     %undef dst
798 :     %undef rounder_op
799 :     %undef rounder_arg
800 :     %undef shift
801 :     %endmacro
802 :    
803 : edgomez 1190 ;---------------------------------------------------------------------------
804 :     ; IDCT1
805 :     ;---------------------------------------------------------------------------
806 : edgomez 851
807 :     %macro IDCT1 8
808 :     %define src0 %1
809 :     %define src4 %2
810 :     %define src1 %3
811 :     %define src5 %4
812 :     %define dst %5
813 :     %define rounder_op %6
814 :     %define rounder_arg %7
815 :     %define shift %8
816 :     movq mm0,[src0] ; R4 R0 r4 r0
817 :     movq mm1,[src4] ; R6 R2 r6 r2
818 :     movq mm2,[src1] ; R3 R1 r3 r1
819 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
820 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
821 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
822 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
823 :     movq mm5,[coeffs+32] ; C6 C2 C6 C2
824 :     pmaddwd mm5,mm1 ; C6R6+C2R2 C6r6+C2r2
825 :     movq mm6,[coeffs+40] ; -C2 C6 -C2 C6
826 :     pmaddwd mm1,mm6 ; -C2R6+C6R2 -C2r6+C6r2
827 :     ; rounder_op mm4, rounder_arg
828 :     movq mm6,mm4 ; C4R4+C4R0 C4r4+C4r0
829 :     movq mm7,[coeffs+48] ; C3 C1 C3 C1
830 :     ; rounder_op mm0, rounder_arg
831 :     pmaddwd mm7,mm2 ; C3R3+C1R1 C3r3+C1r1
832 :     paddd mm4,mm5 ; A0 a0
833 :     psubd mm6,mm5 ; A3 a3
834 :     movq mm5,mm0 ; -C4R4+C4R0 -C4r4+C4r0
835 :     paddd mm0,mm1 ; A1 a1
836 :     psubd mm5,mm1 ; A2 a2
837 :     movq mm1,[coeffs+64]
838 :     pmaddwd mm1,mm2 ; -C7R3+C3R1 -C7r3+C3r1
839 :     paddd mm7,mm4 ; A0+B0 a0+b0
840 :     paddd mm4,mm4 ; 2A0 2a0
841 :     psubd mm4,mm7 ; A0-B0 a0-b0
842 :     psrad mm7,shift
843 :     psrad mm4,shift
844 :     movq mm3,mm0 ; A1 a1
845 :     paddd mm0,mm1 ; A1+B1 a1+b1
846 :     psubd mm3,mm1 ; A1-B1 a1-b1
847 :     psrad mm0,shift
848 :     psrad mm3,shift
849 :     packssdw mm7,mm7 ; A0+B0 a0+b0
850 :     movd [dst],mm7
851 :     packssdw mm0,mm0 ; A1+B1 a1+b1
852 :     movd [dst + 16],mm0
853 :     packssdw mm3,mm3 ; A1-B1 a1-b1
854 :     movd [dst + 96],mm3
855 :     packssdw mm4,mm4 ; A0-B0 a0-b0
856 :     movd [dst + 112],mm4
857 :     movq mm4,[coeffs+80] ; -C1 C5 -C1 C5
858 :     pmaddwd mm4,mm2 ; -C1R3+C5R1 -C1r3+C5r1
859 :     pmaddwd mm2,[coeffs+96] ; -C5R3+C7R1 -C5r3+C7r1
860 :     movq mm3,mm5 ; A2 a2
861 :     paddd mm3,mm4 ; A2+B2 a2+b2
862 :     psubd mm5,mm4 ; a2-B2 a2-b2
863 :     psrad mm3,shift
864 :     psrad mm5,shift
865 :     movq mm4,mm6 ; A3 a3
866 :     paddd mm6,mm2 ; A3+B3 a3+b3
867 :     psubd mm4,mm2 ; a3-B3 a3-b3
868 :     psrad mm6,shift
869 :     packssdw mm3,mm3 ; A2+B2 a2+b2
870 :     movd [dst + 32],mm3
871 :     psrad mm4,shift
872 :     packssdw mm6,mm6 ; A3+B3 a3+b3
873 :     movd [dst + 48],mm6
874 :     packssdw mm4,mm4 ; A3-B3 a3-b3
875 :     packssdw mm5,mm5 ; A2-B2 a2-b2
876 :     movd [dst + 64],mm4
877 :     movd [dst + 80],mm5
878 :     %undef src0
879 :     %undef src4
880 :     %undef src1
881 :     %undef src5
882 :     %undef dst
883 :     %undef rounder_op
884 :     %undef rounder_arg
885 :     %undef shift
886 :     %endmacro
887 :    
888 : edgomez 1190 ;---------------------------------------------------------------------------
889 :     ; IDCT7
890 :     ;---------------------------------------------------------------------------
891 : edgomez 851
892 :     %macro IDCT7 8
893 :     %define src0 %1
894 :     %define src4 %2
895 :     %define src1 %3
896 :     %define src5 %4
897 :     %define dst %5
898 :     %define rounder_op %6
899 :     %define rounder_arg %7
900 :     %define shift %8
901 :     movq mm0,[src0] ; R4 R0 r4 r0
902 :     movq mm4,[coeffs+16] ; C4 C4 C4 C4
903 :     pmaddwd mm4,mm0 ; C4R4+C4R0 C4r4+C4r0
904 :     movq mm5,[coeffs+24] ; -C4 C4 -C4 C4
905 :     pmaddwd mm0,mm5 ; -C4R4+C4R0 -C4r4+C4r0
906 :     ; rounder_op mm4, rounder_arg
907 :     ; rounder_op mm0, rounder_arg
908 :     psrad mm4,shift
909 :     psrad mm0,shift
910 :     movq mm2,[src0 + 8] ; R4 R0 r4 r0
911 :     movq mm1,[coeffs+16] ; C4 C4 C4 C4
912 :     pmaddwd mm1,mm2 ; C4R4+C4R0 C4r4+C4r0
913 :     movq mm7,[coeffs+24] ; -C4 C4 -C4 C4
914 :     pmaddwd mm2,mm7 ; -C4R4+C4R0 -C4r4+C4r0
915 :     movq mm7,[coeffs+32] ; C6 C2 C6 C2
916 :     ; rounder_op mm1, rounder_arg
917 :     ; rounder_op mm2, rounder_arg
918 :     psrad mm1,shift
919 :     packssdw mm4,mm1 ; A0 a0
920 :     movq [dst],mm4
921 :     psrad mm2,shift
922 :     packssdw mm0,mm2 ; A1 a1
923 :     movq [dst + 16],mm0
924 :     movq [dst + 96],mm0
925 :     movq [dst + 112],mm4
926 :     movq [dst + 32],mm0
927 :     movq [dst + 48],mm4
928 :     movq [dst + 64],mm4
929 :     movq [dst + 80],mm0
930 :     %undef src0
931 :     %undef src4
932 :     %undef src1
933 :     %undef src5
934 :     %undef dst
935 :     %undef rounder_op
936 :     %undef rounder_arg
937 :     %undef shift
938 :     %endmacro
939 :    
940 : edgomez 1190 ;---------------------------------------------------------------------------
941 :     ; Permutation helpers
942 :     ;---------------------------------------------------------------------------
943 : edgomez 851
944 : edgomez 1190 %macro XLODA 2
945 :     mov bx, [srcP+2*%2] ; get src contents
946 :     mov ax, [srcP+2*%1] ; get dest contents
947 :     mov [srcP+2*%1], bx ; store new dest val
948 :     %endmacro
949 : edgomez 851
950 : edgomez 1190 %macro XCHGA 2
951 :     mov ax, [srcP+2*%1] ; get dest contents
952 :     mov [srcP+2*%1], bx ; store new dest val
953 : edgomez 851 %endmacro
954 :    
955 : edgomez 1190 %macro XCHGB 2
956 :     mov bx, [srcP+2*%1] ; get dest contents
957 :     mov [srcP+2*%1], ax ; store new dest val
958 :     %endmacro
959 : edgomez 851
960 : edgomez 1190 %macro XSTRA 2
961 :     mov [srcP+2*%1], bx ; store dest val
962 :     %endmacro
963 :    
964 :     %macro XSTRB 2
965 :     mov [srcP+2*%1], ax ; store dest val
966 :     %endmacro
967 :    
968 :     ;---------------------------------------------------------------------------
969 :     ; Permutation macro
970 :     ;---------------------------------------------------------------------------
971 :    
972 :     %macro PERMUTEP 1
973 :     %define srcP %1
974 :     push ebx
975 :    
976 :     ; XCHGA 0x00, 0x00 ; nothing to do
977 :    
978 :     XLODA 0x08, 0x01
979 :     XCHGB 0x10, 0x08
980 :     XCHGA 0x20, 0x10
981 :     XCHGB 0x02, 0x20
982 :     XCHGA 0x04, 0x02
983 :     XSTRB 0x01, 0x04
984 :    
985 :     XLODA 0x09, 0x03
986 :     XCHGB 0x18, 0x09
987 :     XCHGA 0x12, 0x18
988 :     XCHGB 0x24, 0x12
989 :     XSTRA 0x03, 0x24
990 :    
991 :     XLODA 0x0C, 0x05
992 :     XCHGB 0x11, 0x0C
993 :     XCHGA 0x28, 0x11
994 :     XCHGB 0x30, 0x28
995 :     XCHGA 0x22, 0x30
996 :     XCHGB 0x06, 0x22
997 :     XSTRA 0x05, 0x06
998 :    
999 :     XLODA 0x0D, 0x07
1000 :     XCHGB 0x1C, 0x0D
1001 :     XCHGA 0x13, 0x1C
1002 :     XCHGB 0x29, 0x13
1003 :     XCHGA 0x38, 0x29
1004 :     XCHGB 0x32, 0x38
1005 :     XCHGA 0x26, 0x32
1006 :     XSTRB 0x07, 0x26
1007 :    
1008 :     XLODA 0x14, 0x0A
1009 :     XCHGB 0x21, 0x14
1010 :     XSTRA 0x0A, 0x21
1011 :    
1012 :     XLODA 0x19, 0x0B
1013 :     XCHGB 0x1A, 0x19
1014 :     XCHGA 0x16, 0x1A
1015 :     XCHGB 0x25, 0x16
1016 :     XCHGA 0x0E, 0x25
1017 :     XCHGB 0x15, 0x0E
1018 :     XCHGA 0x2C, 0x15
1019 :     XCHGB 0x31, 0x2C
1020 :     XCHGA 0x2A, 0x31
1021 :     XCHGB 0x34, 0x2A
1022 :     XCHGA 0x23, 0x34
1023 :     XSTRB 0x0B, 0x23
1024 :    
1025 :     XLODA 0x1D, 0x0F
1026 :     XCHGB 0x1E, 0x1D
1027 :     XCHGA 0x17, 0x1E
1028 :     XCHGB 0x2D, 0x17
1029 :     XCHGA 0x3C, 0x2D
1030 :     XCHGB 0x33, 0x3C
1031 :     XCHGA 0x2B, 0x33
1032 :     XCHGB 0x39, 0x2B
1033 :     XCHGA 0x3A, 0x39
1034 :     XCHGB 0x36, 0x3A
1035 :     XCHGA 0x27, 0x36
1036 :     XSTRB 0x0F, 0x27
1037 :    
1038 :     ; XCHGA 0x1B, 0x1B
1039 :    
1040 :     ; XCHGA 0x1F, 0x1F
1041 :    
1042 :     XLODA 0x35, 0x2E
1043 :     XSTRB 0x2E, 0x35
1044 :    
1045 :     XLODA 0x3D, 0x2F
1046 :     XCHGB 0x3E, 0x3D
1047 :     XCHGA 0x37, 0x3E
1048 :     XSTRB 0x2F, 0x37
1049 :    
1050 :     ; XCHGA 0x3B, 0x3B
1051 :    
1052 :     ; XCHGA 0x3F, 0x3F
1053 :     pop ebx
1054 :     %undef srcP
1055 :     %endmacro
1056 :    
1057 :     ;=============================================================================
1058 :     ; Code
1059 :     ;=============================================================================
1060 :    
1061 :     SECTION .text
1062 :    
1063 :     ;-----------------------------------------------------------------------------
1064 :     ; void simple_idct_mmx_P(int16_t * const block)
1065 : edgomez 1058 ; expects input data to be permutated
1066 : edgomez 1190 ;-----------------------------------------------------------------------------
1067 :    
1068 :     ALIGN 16
1069 : edgomez 1058 cglobal simple_idct_mmx_P
1070 : edgomez 1190 simple_idct_mmx_P:
1071 : edgomez 851 sub esp, 128
1072 :     mov edx, [esp+128+4]
1073 :    
1074 :     ; src0, src4, src1, src5, dst, rndop, rndarg, shift, bt
1075 :     DC_COND_IDCT edx+0, edx+8, edx+16, edx+24, esp, paddd, [coeffs+8], 11
1076 :     Z_COND_IDCT edx+32, edx+40, edx+48, edx+56, esp+32, paddd, [coeffs], 11, .four
1077 :     Z_COND_IDCT edx+64, edx+72, edx+80, edx+88, esp+64, paddd, [coeffs], 11, .two
1078 :     Z_COND_IDCT edx+96, edx+104,edx+112,edx+120,esp+96, paddd, [coeffs], 11, .one
1079 :     IDCT0 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1080 :     IDCT0 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1081 :     IDCT0 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1082 :     IDCT0 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1083 :     jmp .ret
1084 :    
1085 : edgomez 1190 ALIGN 16
1086 : edgomez 851 .four
1087 :     Z_COND_IDCT edx+64, edx+72, edx+80, edx+88, esp+64, paddd, [coeffs], 11, .six
1088 :     Z_COND_IDCT edx+96, edx+104,edx+112,edx+120,esp+96, paddd, [coeffs], 11, .five
1089 :     IDCT4 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1090 :     IDCT4 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1091 :     IDCT4 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1092 :     IDCT4 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1093 :     jmp .ret
1094 :    
1095 : edgomez 1190 ALIGN 16
1096 : edgomez 851 .six
1097 :     Z_COND_IDCT edx+96, edx+104,edx+112,edx+120,esp+96, paddd, [coeffs], 11, .seven
1098 :     IDCT6 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1099 :     IDCT6 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1100 :     IDCT6 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1101 :     IDCT6 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1102 :     jmp .ret
1103 :    
1104 : edgomez 1190 ALIGN 16
1105 : edgomez 851 .two
1106 :     Z_COND_IDCT edx+96, edx+104,edx+112,edx+120,esp+96, paddd, [coeffs], 11, .three
1107 :     IDCT2 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1108 :     IDCT2 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1109 :     IDCT2 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1110 :     IDCT2 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1111 :     jmp .ret
1112 :    
1113 : edgomez 1190 ALIGN 16
1114 : edgomez 851 .three
1115 :     IDCT3 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1116 :     IDCT3 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1117 :     IDCT3 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1118 :     IDCT3 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1119 :     jmp .ret
1120 :    
1121 : edgomez 1190 ALIGN 16
1122 : edgomez 851 .five
1123 :     IDCT5 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1124 :     ; IDCT5 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1125 :     IDCT5 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1126 :     ; IDCT5 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1127 :     jmp .ret
1128 :    
1129 : edgomez 1190 ALIGN 16
1130 : edgomez 851 .one
1131 :     IDCT1 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1132 :     IDCT1 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1133 :     IDCT1 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1134 :     IDCT1 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1135 :     jmp .ret
1136 :    
1137 : edgomez 1190 ALIGN 16
1138 : edgomez 851 .seven
1139 :     IDCT7 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1140 :     ; IDCT7 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1141 :     IDCT7 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1142 :     ; IDCT7 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1143 :    
1144 :     .ret
1145 :     add esp, 128
1146 : edgomez 1190
1147 : edgomez 851 ret
1148 :    
1149 :    
1150 : edgomez 1190 ;-----------------------------------------------------------------------------
1151 :     ; void simple_idct_mmx(int16_t * const block)
1152 : edgomez 1058 ;
1153 : edgomez 1190 ; simple_idct_mmx is the same function as simple_idct_mmx_P above except that
1154 :     ; on entry it will do a fast in-line and in-place permutation on the iDCT parm
1155 :     ; list. This means that same parm list will also not have to be copied on the
1156 :     ; way out. - trbarry 6/2003
1157 :     ;-----------------------------------------------------------------------------
1158 : edgomez 1058
1159 : edgomez 1190 ALIGN 16
1160 : edgomez 1058 cglobal simple_idct_mmx
1161 : edgomez 1190 simple_idct_mmx:
1162 : edgomez 1058 sub esp, 128
1163 :     mov edx, [esp+128+4]
1164 :     PERMUTEP edx ; permute parm list in place
1165 :    
1166 :     ; src0, src4, src1, src5, dst, rndop, rndarg, shift, bt
1167 :     DC_COND_IDCT edx+0, edx+8, edx+16, edx+24, esp, paddd, [coeffs+8], 11
1168 :     Z_COND_IDCT edx+32, edx+40, edx+48, edx+56, esp+32, paddd, [coeffs], 11, .fourP
1169 :     Z_COND_IDCT edx+64, edx+72, edx+80, edx+88, esp+64, paddd, [coeffs], 11, .twoP
1170 :     Z_COND_IDCT edx+96, edx+104,edx+112,edx+120,esp+96, paddd, [coeffs], 11, .oneP
1171 :     IDCT0 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1172 :     IDCT0 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1173 :     IDCT0 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1174 :     IDCT0 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1175 :     jmp .retP
1176 :    
1177 : edgomez 1190 ALIGN 16
1178 : edgomez 1058 .fourP
1179 :     Z_COND_IDCT edx+64, edx+72, edx+80, edx+88, esp+64, paddd, [coeffs], 11, .sixP
1180 :     Z_COND_IDCT edx+96, edx+104,edx+112,edx+120,esp+96, paddd, [coeffs], 11, .fiveP
1181 :     IDCT4 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1182 :     IDCT4 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1183 :     IDCT4 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1184 :     IDCT4 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1185 :     jmp .retP
1186 :    
1187 : edgomez 1190 ALIGN 16
1188 : edgomez 1058 .sixP
1189 :     Z_COND_IDCT edx+96, edx+104,edx+112,edx+120,esp+96, paddd, [coeffs], 11, .sevenP
1190 :     IDCT6 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1191 :     IDCT6 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1192 :     IDCT6 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1193 :     IDCT6 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1194 :     jmp .retP
1195 :    
1196 : edgomez 1190 ALIGN 16
1197 : edgomez 1058 .twoP
1198 :     Z_COND_IDCT edx+96, edx+104,edx+112,edx+120,esp+96, paddd, [coeffs], 11, .threeP
1199 :     IDCT2 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1200 :     IDCT2 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1201 :     IDCT2 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1202 :     IDCT2 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1203 :     jmp .retP
1204 :    
1205 : edgomez 1190 ALIGN 16
1206 : edgomez 1058 .threeP
1207 :     IDCT3 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1208 :     IDCT3 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1209 :     IDCT3 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1210 :     IDCT3 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1211 :     jmp .retP
1212 :    
1213 : edgomez 1190 ALIGN 16
1214 : edgomez 1058 .fiveP
1215 :     IDCT5 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1216 :     ; IDCT5 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1217 :     IDCT5 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1218 :     ; IDCT5 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1219 :     jmp .retP
1220 :    
1221 : edgomez 1190 ALIGN 16
1222 : edgomez 1058 .oneP
1223 :     IDCT1 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1224 :     IDCT1 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1225 :     IDCT1 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1226 :     IDCT1 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1227 :     jmp .retP
1228 :    
1229 : edgomez 1190 ALIGN 16
1230 : edgomez 1058 .sevenP
1231 :     IDCT7 esp, esp+64, esp+32, esp+96, edx, nop, 0, 20
1232 :     ; IDCT7 esp+8, esp+72, esp+40, esp+104,edx+4, nop, 0, 20
1233 :     IDCT7 esp+16, esp+80, esp+48, esp+112,edx+8, nop, 0, 20
1234 :     ; IDCT7 esp+24, esp+88, esp+56, esp+120,edx+12, nop, 0, 20
1235 :    
1236 :     .retP
1237 : edgomez 1190 add esp, 128
1238 :    
1239 : edgomez 1058 ret
1240 :    
1241 :    

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4