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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download)

1 : edgomez 1.3 ;/****************************************************************************
2 : edgomez 1.2 ; *
3 : edgomez 1.3 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - 3dne CBP computation -
5 : edgomez 1.2 ; *
6 : edgomez 1.3 ; * Copyright (C) 2002 Jaan Kalda
7 :     ; *
8 :     ; * 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 :     ; *
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$
23 :     ; *
24 :     ; ***************************************************************************/
25 :    
26 :     ; these 3dne functions are compatible with iSSE, but are optimized
27 :     ; specifically for K7 pipelines
28 : edgomez 1.2
29 : edgomez 1.3 BITS 32
30 :    
31 :     ;=============================================================================
32 :     ; Macros
33 :     ;=============================================================================
34 : edgomez 1.2
35 :     %macro cglobal 1
36 :     %ifdef PREFIX
37 : edgomez 1.4 %ifdef MARK_FUNCS
38 :     global _%1:function
39 :     %define %1 _%1:function
40 :     %else
41 :     global _%1
42 :     %define %1 _%1
43 :     %endif
44 : edgomez 1.2 %else
45 : edgomez 1.4 %ifdef MARK_FUNCS
46 :     global %1:function
47 :     %else
48 :     global %1
49 :     %endif
50 : edgomez 1.2 %endif
51 :     %endmacro
52 :    
53 :     %macro calc_cbp 1
54 : edgomez 1.3 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 1.2 %else
74 : edgomez 1.3 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 1.2 %endmacro
86 :    
87 : edgomez 1.3 ;=============================================================================
88 :     ; Code
89 :     ;=============================================================================
90 :    
91 :     SECTION .text
92 :    
93 :     cglobal calc_cbp_3dne
94 : edgomez 1.2
95 : edgomez 1.3 ;-----------------------------------------------------------------------------
96 :     ; uint32_t calc_cbp_3dne(const int16_t coeff[6*64]);
97 :     ;-----------------------------------------------------------------------------
98 :     ;AMD K7, in cache: ca 80 clk
99 : edgomez 1.2
100 : edgomez 1.3 ALIGN 16
101 : edgomez 1.2 calc_cbp_3dne:
102 : edgomez 1.3 mov eax, [esp+ 4] ; coeff
103 :     lea esp, [esp-24]
104 : edgomez 1.2 calc_cbp 5 ;bit 5
105 : edgomez 1.3 calc_cbp 4 ;b4
106 : edgomez 1.2 calc_cbp 3 ;b3
107 :     calc_cbp 2 ;b2
108 :     calc_cbp 1 ;b1
109 :     calc_cbp 0 ;b0
110 : edgomez 1.3 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

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