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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1190 - (view) (download)

1 : edgomez 1190 ;/****************************************************************************
2 :     ; *
3 :     ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - MMX and XMM forward discrete cosine transform -
5 :     ; *
6 :     ; * Copyright(C) 2002 Pascal Massimino <skal@planet-d.net>
7 :     ; *
8 :     ; * This program is free software; you can redistribute it and/or modify it
9 :     ; * under the terms of the GNU General Public License as published by
10 :     ; * the Free Software Foundation; either version 2 of the License, or
11 :     ; * (at your option) any later version.
12 :     ; *
13 :     ; * This program is distributed in the hope that it will be useful,
14 :     ; * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 :     ; * GNU General Public License for more details.
17 :     ; *
18 :     ; * You should have received a copy of the GNU General Public License
19 :     ; * along with this program; if not, write to the Free Software
20 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 :     ; *
22 :     ; * $Id: fdct_mmx_skal.asm,v 1.1.2.1 2003-10-27 01:03:06 edgomez Exp $
23 :     ; *
24 :     ; ***************************************************************************/
25 :    
26 :     BITS 32
27 :    
28 :     %macro cglobal 1
29 :     %ifdef PREFIX
30 :     global _%1
31 :     %define %1 _%1
32 :     %else
33 :     global %1
34 :     %endif
35 :     %endmacro
36 :    
37 :     ;;; Define this if you want an unrolled version of the code
38 :     %define UNROLLED_LOOP
39 :    
40 :     ;=============================================================================
41 :     ;
42 :     ; Vertical pass is an implementation of the scheme:
43 :     ; Loeffler C., Ligtenberg A., and Moschytz C.S.:
44 :     ; Practical Fast 1D DCT Algorithm with Eleven Multiplications,
45 :     ; Proc. ICASSP 1989, 988-991.
46 :     ;
47 :     ; Horizontal pass is a double 4x4 vector/matrix multiplication,
48 :     ; (see also Intel's Application Note 922:
49 :     ; http://developer.intel.com/vtune/cbts/strmsimd/922down.htm
50 :     ; Copyright (C) 1999 Intel Corporation)
51 :     ;
52 :     ; Notes:
53 :     ; * tan(3pi/16) is greater than 0.5, and would use the
54 :     ; sign bit when turned into 16b fixed-point precision. So,
55 :     ; we use the trick: x*tan3 = x*(tan3-1)+x
56 :     ;
57 :     ; * There's only one SSE-specific instruction (pshufw).
58 :     ; Porting to SSE2 also seems straightforward.
59 :     ;
60 :     ; * There's still 1 or 2 ticks to save in fLLM_PASS, but
61 :     ; I prefer having a readable code, instead of a tightly
62 :     ; scheduled one...
63 :     ;
64 :     ; * Quantization stage (as well as pre-transposition for the
65 :     ; idct way back) can be included in the fTab* constants
66 :     ; (with induced loss of precision, somehow)
67 :     ;
68 :     ; * Some more details at: http://skal.planet-d.net/coding/dct.html
69 :     ;
70 :     ;=============================================================================
71 :     ;
72 :     ; idct-like IEEE errors:
73 :     ;
74 :     ; =========================
75 :     ; Peak error: 1.0000
76 :     ; Peak MSE: 0.0365
77 :     ; Overall MSE: 0.0201
78 :     ; Peak ME: 0.0265
79 :     ; Overall ME: 0.0006
80 :     ;
81 :     ; == Mean square errors ==
82 :     ; 0.000 0.001 0.001 0.002 0.000 0.002 0.001 0.000 [0.001]
83 :     ; 0.035 0.029 0.032 0.032 0.031 0.032 0.034 0.035 [0.032]
84 :     ; 0.026 0.028 0.027 0.027 0.025 0.028 0.028 0.025 [0.027]
85 :     ; 0.037 0.032 0.031 0.030 0.028 0.029 0.026 0.031 [0.030]
86 :     ; 0.000 0.001 0.001 0.002 0.000 0.002 0.001 0.001 [0.001]
87 :     ; 0.025 0.024 0.022 0.022 0.022 0.022 0.023 0.023 [0.023]
88 :     ; 0.026 0.028 0.025 0.028 0.030 0.025 0.026 0.027 [0.027]
89 :     ; 0.021 0.020 0.020 0.022 0.020 0.022 0.017 0.019 [0.020]
90 :     ;
91 :     ; == Abs Mean errors ==
92 :     ; 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 [0.000]
93 :     ; 0.020 0.001 0.003 0.003 0.000 0.004 0.002 0.003 [0.002]
94 :     ; 0.000 0.001 0.001 0.001 0.001 0.004 0.000 0.000 [0.000]
95 :     ; 0.027 0.001 0.000 0.002 0.002 0.002 0.001 0.000 [0.003]
96 :     ; 0.000 0.000 0.000 0.000 0.000 0.001 0.000 0.001 [-0.000]
97 :     ; 0.001 0.003 0.001 0.001 0.002 0.001 0.000 0.000 [-0.000]
98 :     ; 0.000 0.002 0.002 0.001 0.001 0.002 0.001 0.000 [-0.000]
99 :     ; 0.000 0.002 0.001 0.002 0.001 0.002 0.001 0.001 [-0.000]
100 :     ;
101 :     ;=============================================================================
102 :    
103 :     ;=============================================================================
104 :     ; Read only data
105 :     ;=============================================================================
106 :    
107 :     SECTION .rodata
108 :    
109 :     ALIGN 16
110 :     tan1:
111 :     dw 0x32ec,0x32ec,0x32ec,0x32ec ; tan( pi/16)
112 :     tan2:
113 :     dw 0x6a0a,0x6a0a,0x6a0a,0x6a0a ; tan(2pi/16) (=sqrt(2)-1)
114 :     tan3:
115 :     dw 0xab0e,0xab0e,0xab0e,0xab0e ; tan(3pi/16)-1
116 :     sqrt2:
117 :     dw 0x5a82,0x5a82,0x5a82,0x5a82 ; 0.5/sqrt(2)
118 :    
119 :     ALIGN 16
120 :     fdct_table:
121 :     ;fTab1:
122 :     dw 0x4000, 0x4000, 0x58c5, 0x4b42
123 :     dw 0x4000, 0x4000, 0x3249, 0x11a8
124 :     dw 0x539f, 0x22a3, 0x4b42, 0xee58
125 :     dw 0xdd5d, 0xac61, 0xa73b, 0xcdb7
126 :     dw 0x4000, 0xc000, 0x3249, 0xa73b
127 :     dw 0xc000, 0x4000, 0x11a8, 0x4b42
128 :     dw 0x22a3, 0xac61, 0x11a8, 0xcdb7
129 :     dw 0x539f, 0xdd5d, 0x4b42, 0xa73b
130 :    
131 :     ;fTab2:
132 :     dw 0x58c5, 0x58c5, 0x7b21, 0x6862
133 :     dw 0x58c5, 0x58c5, 0x45bf, 0x187e
134 :     dw 0x73fc, 0x300b, 0x6862, 0xe782
135 :     dw 0xcff5, 0x8c04, 0x84df, 0xba41
136 :     dw 0x58c5, 0xa73b, 0x45bf, 0x84df
137 :     dw 0xa73b, 0x58c5, 0x187e, 0x6862
138 :     dw 0x300b, 0x8c04, 0x187e, 0xba41
139 :     dw 0x73fc, 0xcff5, 0x6862, 0x84df
140 :    
141 :     ;fTab3:
142 :     dw 0x539f, 0x539f, 0x73fc, 0x6254
143 :     dw 0x539f, 0x539f, 0x41b3, 0x1712
144 :     dw 0x6d41, 0x2d41, 0x6254, 0xe8ee
145 :     dw 0xd2bf, 0x92bf, 0x8c04, 0xbe4d
146 :     dw 0x539f, 0xac61, 0x41b3, 0x8c04
147 :     dw 0xac61, 0x539f, 0x1712, 0x6254
148 :     dw 0x2d41, 0x92bf, 0x1712, 0xbe4d
149 :     dw 0x6d41, 0xd2bf, 0x6254, 0x8c04
150 :    
151 :     ;fTab4:
152 :     dw 0x4b42, 0x4b42, 0x6862, 0x587e
153 :     dw 0x4b42, 0x4b42, 0x3b21, 0x14c3
154 :     dw 0x6254, 0x28ba, 0x587e, 0xeb3d
155 :     dw 0xd746, 0x9dac, 0x979e, 0xc4df
156 :     dw 0x4b42, 0xb4be, 0x3b21, 0x979e
157 :     dw 0xb4be, 0x4b42, 0x14c3, 0x587e
158 :     dw 0x28ba, 0x9dac, 0x14c3, 0xc4df
159 :     dw 0x6254, 0xd746, 0x587e, 0x979e
160 :    
161 :     ;fTab1:
162 :     dw 0x4000, 0x4000, 0x58c5, 0x4b42
163 :     dw 0x4000, 0x4000, 0x3249, 0x11a8
164 :     dw 0x539f, 0x22a3, 0x4b42, 0xee58
165 :     dw 0xdd5d, 0xac61, 0xa73b, 0xcdb7
166 :     dw 0x4000, 0xc000, 0x3249, 0xa73b
167 :     dw 0xc000, 0x4000, 0x11a8, 0x4b42
168 :     dw 0x22a3, 0xac61, 0x11a8, 0xcdb7
169 :     dw 0x539f, 0xdd5d, 0x4b42, 0xa73b
170 :    
171 :     ;fTab4:
172 :     dw 0x4b42, 0x4b42, 0x6862, 0x587e
173 :     dw 0x4b42, 0x4b42, 0x3b21, 0x14c3
174 :     dw 0x6254, 0x28ba, 0x587e, 0xeb3d
175 :     dw 0xd746, 0x9dac, 0x979e, 0xc4df
176 :     dw 0x4b42, 0xb4be, 0x3b21, 0x979e
177 :     dw 0xb4be, 0x4b42, 0x14c3, 0x587e
178 :     dw 0x28ba, 0x9dac, 0x14c3, 0xc4df
179 :     dw 0x6254, 0xd746, 0x587e, 0x979e
180 :    
181 :     ;fTab3:
182 :     dw 0x539f, 0x539f, 0x73fc, 0x6254
183 :     dw 0x539f, 0x539f, 0x41b3, 0x1712
184 :     dw 0x6d41, 0x2d41, 0x6254, 0xe8ee
185 :     dw 0xd2bf, 0x92bf, 0x8c04, 0xbe4d
186 :     dw 0x539f, 0xac61, 0x41b3, 0x8c04
187 :     dw 0xac61, 0x539f, 0x1712, 0x6254
188 :     dw 0x2d41, 0x92bf, 0x1712, 0xbe4d
189 :     dw 0x6d41, 0xd2bf, 0x6254, 0x8c04
190 :    
191 :     ;fTab2:
192 :     dw 0x58c5, 0x58c5, 0x7b21, 0x6862
193 :     dw 0x58c5, 0x58c5, 0x45bf, 0x187e
194 :     dw 0x73fc, 0x300b, 0x6862, 0xe782
195 :     dw 0xcff5, 0x8c04, 0x84df, 0xba41
196 :     dw 0x58c5, 0xa73b, 0x45bf, 0x84df
197 :     dw 0xa73b, 0x58c5, 0x187e, 0x6862
198 :     dw 0x300b, 0x8c04, 0x187e, 0xba41
199 :     dw 0x73fc, 0xcff5, 0x6862, 0x84df
200 :    
201 :     ALIGN 16
202 :     fdct_rounding_1:
203 :     dw 6, 8, 8, 8
204 :     dw 10, 8, 8, 8
205 :     dw 8, 8, 8, 8
206 :     dw 8, 8, 8, 8
207 :     dw 6, 8, 8, 8
208 :     dw 8, 8, 8, 8
209 :     dw 8, 8, 8, 8
210 :     dw 8, 8, 8, 8
211 :    
212 :     ALIGN 16
213 :     fdct_rounding_2:
214 :     dw 6, 8, 8, 8
215 :     dw 8, 8, 8, 8
216 :     dw 8, 8, 8, 8
217 :     dw 8, 8, 8, 8
218 :     dw 6, 8, 8, 8
219 :     dw 8, 8, 8, 8
220 :     dw 8, 8, 8, 8
221 :     dw 8, 8, 8, 8
222 :    
223 :     ALIGN 16
224 :     MMX_One:
225 :     dw 1, 1, 1, 1
226 :    
227 :     ;=============================================================================
228 :     ; Helper Macros for real code
229 :     ;=============================================================================
230 :    
231 :     ;-----------------------------------------------------------------------------
232 :     ; FDCT LLM vertical pass (~39c)
233 :     ; %1=dst, %2=src, %3:Shift
234 :     ;-----------------------------------------------------------------------------
235 :    
236 :     %macro fLLM_PASS 3
237 :     movq mm0, [%2+0*16] ; In0
238 :     movq mm2, [%2+2*16] ; In2
239 :     movq mm3, mm0
240 :     movq mm4, mm2
241 :     movq mm7, [%2+7*16] ; In7
242 :     movq mm5, [%2+5*16] ; In5
243 :    
244 :     psubsw mm0, mm7 ; t7 = In0-In7
245 :     paddsw mm7, mm3 ; t0 = In0+In7
246 :     psubsw mm2, mm5 ; t5 = In2-In5
247 :     paddsw mm5, mm4 ; t2 = In2+In5
248 :    
249 :     movq mm3, [%2+3*16] ; In3
250 :     movq mm4, [%2+4*16] ; In4
251 :     movq mm1, mm3
252 :     psubsw mm3, mm4 ; t4 = In3-In4
253 :     paddsw mm4, mm1 ; t3 = In3+In4
254 :     movq mm6, [%2+6*16] ; In6
255 :     movq mm1, [%2+1*16] ; In1
256 :     psubsw mm1, mm6 ; t6 = In1-In6
257 :     paddsw mm6, [%2+1*16] ; t1 = In1+In6
258 :    
259 :     psubsw mm7, mm4 ; tm03 = t0-t3
260 :     psubsw mm6, mm5 ; tm12 = t1-t2
261 :     paddsw mm4, mm4 ; 2.t3
262 :     paddsw mm5, mm5 ; 2.t2
263 :     paddsw mm4, mm7 ; tp03 = t0+t3
264 :     paddsw mm5, mm6 ; tp12 = t1+t2
265 :    
266 :     psllw mm2, %3+1 ; shift t5 (shift +1 to..
267 :     psllw mm1, %3+1 ; shift t6 ..compensate cos4/2)
268 :     psllw mm4, %3 ; shift t3
269 :     psllw mm5, %3 ; shift t2
270 :     psllw mm7, %3 ; shift t0
271 :     psllw mm6, %3 ; shift t1
272 :     psllw mm3, %3 ; shift t4
273 :     psllw mm0, %3 ; shift t7
274 :    
275 :     psubsw mm4, mm5 ; out4 = tp03-tp12
276 :     psubsw mm1, mm2 ; mm1: t6-t5
277 :     paddsw mm5, mm5
278 :     paddsw mm2, mm2
279 :     paddsw mm5, mm4 ; out0 = tp03+tp12
280 :     movq [%1+4*16], mm4 ; => out4
281 :     paddsw mm2, mm1 ; mm2: t6+t5
282 :     movq [%1+0*16], mm5 ; => out0
283 :    
284 :     movq mm4, [tan2] ; mm4 <= tan2
285 :     pmulhw mm4, mm7 ; tm03*tan2
286 :     movq mm5, [tan2] ; mm5 <= tan2
287 :     psubsw mm4, mm6 ; out6 = tm03*tan2 - tm12
288 :     pmulhw mm5, mm6 ; tm12*tan2
289 :     paddsw mm5, mm7 ; out2 = tm12*tan2 + tm03
290 :    
291 :     movq mm6, [sqrt2]
292 :     movq mm7, [MMX_One]
293 :    
294 :     pmulhw mm2, mm6 ; mm2: tp65 = (t6 + t5)*cos4
295 :     por mm5, mm7 ; correct out2
296 :     por mm4, mm7 ; correct out6
297 :     pmulhw mm1, mm6 ; mm1: tm65 = (t6 - t5)*cos4
298 :     por mm2, mm7 ; correct tp65
299 :    
300 :     movq [%1+2*16], mm5 ; => out2
301 :     movq mm5, mm3 ; save t4
302 :     movq [%1+6*16], mm4 ; => out6
303 :     movq mm4, mm0 ; save t7
304 :    
305 :     psubsw mm3, mm1 ; mm3: tm465 = t4 - tm65
306 :     psubsw mm0, mm2 ; mm0: tm765 = t7 - tp65
307 :     paddsw mm2, mm4 ; mm2: tp765 = t7 + tp65
308 :     paddsw mm1, mm5 ; mm1: tp465 = t4 + tm65
309 :    
310 :     movq mm4, [tan3] ; tan3 - 1
311 :     movq mm5, [tan1] ; tan1
312 :    
313 :     movq mm7, mm3 ; save tm465
314 :     pmulhw mm3, mm4 ; tm465*(tan3-1)
315 :     movq mm6, mm1 ; save tp465
316 :     pmulhw mm1, mm5 ; tp465*tan1
317 :    
318 :     paddsw mm3, mm7 ; tm465*tan3
319 :     pmulhw mm4, mm0 ; tm765*(tan3-1)
320 :     paddsw mm4, mm0 ; tm765*tan3
321 :     pmulhw mm5, mm2 ; tp765*tan1
322 :    
323 :     paddsw mm1, mm2 ; out1 = tp765 + tp465*tan1
324 :     psubsw mm0, mm3 ; out3 = tm765 - tm465*tan3
325 :     paddsw mm7, mm4 ; out5 = tm465 + tm765*tan3
326 :     psubsw mm5, mm6 ; out7 =-tp465 + tp765*tan1
327 :    
328 :     movq [%1+1*16], mm1 ; => out1
329 :     movq [%1+3*16], mm0 ; => out3
330 :     movq [%1+5*16], mm7 ; => out5
331 :     movq [%1+7*16], mm5 ; => out7
332 :     %endmacro
333 :    
334 :     ;-----------------------------------------------------------------------------
335 :     ; fMTX_MULT_XMM (~20c)
336 :     ; %1=dst, %2=src, %3 = Coeffs, %4/%5=rounders
337 :     ;-----------------------------------------------------------------------------
338 :    
339 :     %macro fMTX_MULT_XMM 5
340 :     movq mm0, [%2 + 0] ; mm0 = [0123]
341 :     ; the 'pshufw' below is the only SSE instruction.
342 :     ; For MMX-only version, it should be emulated with
343 :     ; some 'punpck' soup...
344 :     pshufw mm1, [%2 + 8], 00011011b ; mm1 = [7654]
345 :     movq mm7, mm0
346 :    
347 :     paddsw mm0, mm1 ; mm0 = [a0 a1 a2 a3]
348 :     psubsw mm7, mm1 ; mm7 = [b0 b1 b2 b3]
349 :    
350 :     movq mm1, mm0
351 :     punpckldq mm0, mm7 ; mm0 = [a0 a1 b0 b1]
352 :     punpckhdq mm1, mm7 ; mm1 = [b2 b3 a2 a3]
353 :    
354 :     movq mm2, qword [%3 + 0] ; [ M00 M01 M16 M17]
355 :     movq mm3, qword [%3 + 8] ; [ M02 M03 M18 M19]
356 :     pmaddwd mm2, mm0 ; [a0.M00+a1.M01 | b0.M16+b1.M17]
357 :     movq mm4, qword [%3 + 16] ; [ M04 M05 M20 M21]
358 :     pmaddwd mm3, mm1 ; [a2.M02+a3.M03 | b2.M18+b3.M19]
359 :     movq mm5, qword [%3 + 24] ; [ M06 M07 M22 M23]
360 :     pmaddwd mm4, mm0 ; [a0.M04+a1.M05 | b0.M20+b1.M21]
361 :     movq mm6, qword [%3 + 32] ; [ M08 M09 M24 M25]
362 :     pmaddwd mm5, mm1 ; [a2.M06+a3.M07 | b2.M22+b3.M23]
363 :     movq mm7, qword [%3 + 40] ; [ M10 M11 M26 M27]
364 :     pmaddwd mm6, mm0 ; [a0.M08+a1.M09 | b0.M24+b1.M25]
365 :     paddd mm2, mm3 ; [ out0 | out1 ]
366 :     pmaddwd mm7, mm1 ; [a0.M10+a1.M11 | b0.M26+b1.M27]
367 :     psrad mm2, 16
368 :     pmaddwd mm0, qword [%3 + 48] ; [a0.M12+a1.M13 | b0.M28+b1.M29]
369 :     paddd mm4, mm5 ; [ out2 | out3 ]
370 :     pmaddwd mm1, qword [%3 + 56] ; [a0.M14+a1.M15 | b0.M30+b1.M31]
371 :     psrad mm4, 16
372 :    
373 :     paddd mm6, mm7 ; [ out4 | out5 ]
374 :     psrad mm6, 16
375 :     paddd mm0, mm1 ; [ out6 | out7 ]
376 :     psrad mm0, 16
377 :    
378 :     packssdw mm2, mm4 ; [ out0|out1|out2|out3 ]
379 :     paddsw mm2, [%4] ; Round
380 :     packssdw mm6, mm0 ; [ out4|out5|out6|out7 ]
381 :     paddsw mm6, [%5] ; Round
382 :    
383 :     psraw mm2, 4 ; => [-2048, 2047]
384 :     psraw mm6, 4
385 :    
386 :     movq [%1 + 0], mm2
387 :     movq [%1 + 8], mm6
388 :     %endmacro
389 :    
390 :     ;-----------------------------------------------------------------------------
391 :     ; fMTX_MULT_MMX (~22c)
392 :     ; %1=dst, %2=src, %3 = Coeffs, %4/%5=rounders
393 :     ;-----------------------------------------------------------------------------
394 :    
395 :     %macro fMTX_MULT_MMX 5
396 :     ; MMX-only version (no 'pshufw'. ~10% overall slower than SSE)
397 :     movd mm1, [%2 + 8 + 4] ; [67..]
398 :     movq mm0, [%2 + 0] ; mm0 = [0123]
399 :     movq mm7, mm0
400 :     punpcklwd mm1, [%2 + 8] ; [6475]
401 :     movq mm2, mm1
402 :     psrlq mm1, 32 ; [75..]
403 :     punpcklwd mm1,mm2 ; [7654]
404 :    
405 :     paddsw mm0, mm1 ; mm0 = [a0 a1 a2 a3]
406 :     psubsw mm7, mm1 ; mm7 = [b0 b1 b2 b3]
407 :    
408 :     movq mm1, mm0
409 :     punpckldq mm0, mm7 ; mm0 = [a0 a1 b0 b1]
410 :     punpckhdq mm1, mm7 ; mm1 = [b2 b3 a2 a3]
411 :    
412 :     movq mm2, qword [%3 + 0] ; [ M00 M01 M16 M17]
413 :     movq mm3, qword [%3 + 8] ; [ M02 M03 M18 M19]
414 :     pmaddwd mm2, mm0 ; [a0.M00+a1.M01 | b0.M16+b1.M17]
415 :     movq mm4, qword [%3 + 16] ; [ M04 M05 M20 M21]
416 :     pmaddwd mm3, mm1 ; [a2.M02+a3.M03 | b2.M18+b3.M19]
417 :     movq mm5, qword [%3 + 24] ; [ M06 M07 M22 M23]
418 :     pmaddwd mm4, mm0 ; [a0.M04+a1.M05 | b0.M20+b1.M21]
419 :     movq mm6, qword [%3 + 32] ; [ M08 M09 M24 M25]
420 :     pmaddwd mm5, mm1 ; [a2.M06+a3.M07 | b2.M22+b3.M23]
421 :     movq mm7, qword [%3 + 40] ; [ M10 M11 M26 M27]
422 :     pmaddwd mm6, mm0 ; [a0.M08+a1.M09 | b0.M24+b1.M25]
423 :     paddd mm2, mm3 ; [ out0 | out1 ]
424 :     pmaddwd mm7, mm1 ; [a0.M10+a1.M11 | b0.M26+b1.M27]
425 :     psrad mm2, 16
426 :     pmaddwd mm0, qword [%3 + 48] ; [a0.M12+a1.M13 | b0.M28+b1.M29]
427 :     paddd mm4, mm5 ; [ out2 | out3 ]
428 :     pmaddwd mm1, qword [%3 + 56] ; [a0.M14+a1.M15 | b0.M30+b1.M31]
429 :     psrad mm4, 16
430 :    
431 :     paddd mm6, mm7 ; [ out4 | out5 ]
432 :     psrad mm6, 16
433 :     paddd mm0, mm1 ; [ out6 | out7 ]
434 :     psrad mm0, 16
435 :    
436 :     packssdw mm2, mm4 ; [ out0|out1|out2|out3 ]
437 :     paddsw mm2, [%4] ; Round
438 :     packssdw mm6, mm0 ; [ out4|out5|out6|out7 ]
439 :     paddsw mm6, [%5] ; Round
440 :    
441 :     psraw mm2, 4 ; => [-2048, 2047]
442 :     psraw mm6, 4
443 :    
444 :     movq [%1 + 0], mm2
445 :     movq [%1 + 8], mm6
446 :     %endmacro
447 :    
448 :     ;-----------------------------------------------------------------------------
449 :     ; MAKE_FDCT_FUNC
450 :     ; %1 funcname, %2 macro for row dct
451 :     ;-----------------------------------------------------------------------------
452 :    
453 :     %macro MAKE_FDCT_FUNC 2
454 :     ALIGN 16
455 :     cglobal %1
456 :     %1:
457 :     %ifdef UNROLLED_LOOP
458 :     mov ecx, [esp + 4]
459 :     %else
460 :     push ebx
461 :     push edi
462 :     mov ecx, [esp + 8 + 4]
463 :     %endif
464 :    
465 :     fLLM_PASS ecx+0, ecx+0, 3
466 :     fLLM_PASS ecx+8, ecx+8, 3
467 :    
468 :     %ifdef UNROLLED_LOOP
469 :     %assign i 0
470 :     %rep 8
471 :     %2 ecx+i*16, ecx+i*16, fdct_table+i*64, fdct_rounding_1+i*8, fdct_rounding_2+i*8
472 :     %assign i i+1
473 :     %endrep
474 :     %else
475 :     mov eax, 8
476 :     mov edx, fdct_table
477 :     mov ebx, fdct_rounding_1
478 :     mov edi, fdct_rounding_2
479 :     .loop
480 :     %2 ecx, ecx, edx, ebx, edi
481 :     add eax, 2*16
482 :     add edx, 2*32
483 :     add ebx, 2*4
484 :     add edi, 2*4
485 :     dec eax
486 :     jne .loop
487 :    
488 :     pop edi
489 :     pop ebx
490 :     %endif
491 :    
492 :     ret
493 :     %endmacro
494 :    
495 :     ;=============================================================================
496 :     ; Code
497 :     ;=============================================================================
498 :    
499 :     SECTION .text
500 :    
501 :     ;-----------------------------------------------------------------------------
502 :     ; void fdct_mmx_skal(int16_t block[64]];
503 :     ;-----------------------------------------------------------------------------
504 :    
505 :     MAKE_FDCT_FUNC fdct_mmx_skal, fMTX_MULT_MMX
506 :    
507 :     ;-----------------------------------------------------------------------------
508 :     ; void fdct_xmm_skal(int16_t block[64]];
509 :     ;-----------------------------------------------------------------------------
510 :    
511 :     MAKE_FDCT_FUNC fdct_xmm_skal, fMTX_MULT_XMM

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