[svn] / trunk / xvidcore / src / dct / x86_asm / fdct_mmx_skal.asm Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/dct/x86_asm/fdct_mmx_skal.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1877 - (view) (download)

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

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