[svn] / trunk / xvidcore / src / bitstream / x86_asm / cbp_3dne.asm Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/bitstream/x86_asm/cbp_3dne.asm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1540 - (view) (download)

1 : edgomez 1382 ;/****************************************************************************
2 : edgomez 851 ; *
3 : edgomez 1382 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - 3dne CBP computation -
5 : edgomez 851 ; *
6 : edgomez 1382 ; * Copyright (C) 2002 Jaan Kalda
7 : edgomez 851 ; *
8 : edgomez 1382 ; * This program is free software ; you can redistribute it and/or modify
9 :     ; * it 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 : edgomez 851 ; *
13 : edgomez 1382 ; * 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 : edgomez 851 ; *
18 : edgomez 1382 ; * 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 : edgomez 851 ; *
22 : edgomez 1540 ; * $Id: cbp_3dne.asm,v 1.5 2004-08-29 10:02:38 edgomez Exp $
23 : edgomez 1382 ; *
24 :     ; ***************************************************************************/
25 : edgomez 851
26 : edgomez 1382 ; these 3dne functions are compatible with iSSE, but are optimized
27 :     ; specifically for K7 pipelines
28 : edgomez 851
29 : edgomez 1382 BITS 32
30 : edgomez 851
31 : edgomez 1382 ;=============================================================================
32 :     ; Macros
33 :     ;=============================================================================
34 : edgomez 851
35 :     %macro cglobal 1
36 :     %ifdef PREFIX
37 : edgomez 1535 %ifdef MARK_FUNCS
38 : edgomez 1540 global _%1:function %1.endfunc-%1
39 :     %define %1 _%1:function %1.endfunc-%1
40 : edgomez 1535 %else
41 :     global _%1
42 :     %define %1 _%1
43 :     %endif
44 : edgomez 851 %else
45 : edgomez 1535 %ifdef MARK_FUNCS
46 : edgomez 1540 global %1:function %1.endfunc-%1
47 : edgomez 1535 %else
48 :     global %1
49 :     %endif
50 : edgomez 851 %endif
51 :     %endmacro
52 :    
53 :     %macro calc_cbp 1
54 : edgomez 1382 pshufw mm0, [eax], 229 ; =11100101
55 :     movq mm1, [eax+8]
56 :     por mm0, [eax+64]
57 :     por mm1, [eax+72]
58 :     movq mm2, [eax+16]
59 :     movq mm3, [eax+24]
60 :     por mm2, [eax+80]
61 :     por mm3, [eax+88]
62 :     movq mm4, [eax+32]
63 :     movq mm5, [eax+40]
64 :     por mm4, [eax+96]
65 :     por mm5, [eax+104]
66 :     movq mm6, [eax+48]
67 :     movq mm7, [eax+56]
68 :     por mm6, [eax+112]
69 :     por mm7, [eax+120]
70 :     por mm1, mm0
71 :     %if %1
72 :     sub eax, byte -128 ;ecx ;+= 128; needed 3 bytes for alignment
73 : edgomez 851 %else
74 : edgomez 1382 xor eax, eax
75 :     xor edx, edx
76 :     %endif
77 :     por mm3, mm2
78 :     por mm5, mm4
79 :     por mm7, mm6
80 :     por mm3, mm1
81 :     por mm7, mm5
82 :     por mm7, mm3
83 :     packsswb mm7, mm7
84 :     movd [esp+%1*4], mm7
85 : edgomez 851 %endmacro
86 :    
87 : edgomez 1382 ;=============================================================================
88 :     ; Code
89 :     ;=============================================================================
90 : edgomez 851
91 : edgomez 1382 SECTION .text
92 : edgomez 851
93 : edgomez 1382 cglobal calc_cbp_3dne
94 :    
95 :     ;-----------------------------------------------------------------------------
96 :     ; uint32_t calc_cbp_3dne(const int16_t coeff[6*64]);
97 :     ;-----------------------------------------------------------------------------
98 :     ;AMD K7, in cache: ca 80 clk
99 :    
100 :     ALIGN 16
101 : edgomez 851 calc_cbp_3dne:
102 : edgomez 1382 mov eax, [esp+ 4] ; coeff
103 :     lea esp, [esp-24]
104 : edgomez 851 calc_cbp 5 ;bit 5
105 : edgomez 1382 calc_cbp 4 ;b4
106 : edgomez 851 calc_cbp 3 ;b3
107 :     calc_cbp 2 ;b2
108 :     calc_cbp 1 ;b1
109 :     calc_cbp 0 ;b0
110 : edgomez 1382 cmp eax, [esp+5*4]
111 :     adc eax, eax
112 :     cmp edx, [esp+4*4]
113 :     adc eax, eax
114 :     cmp edx, [esp+3*4]
115 :     adc eax, eax
116 :     cmp edx, [esp+2*4]
117 :     adc eax, eax
118 :     cmp edx, [esp+1*4]
119 :     adc eax, eax
120 :     cmp edx, [esp+0*4]
121 :     adc eax, eax
122 :     add esp, byte 24
123 :     ret
124 : edgomez 1540 .endfunc
125 :    

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