[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.2.2.1 - (view) (download)

1 : edgomez 1.2.2.1 ;/****************************************************************************
2 : edgomez 1.2 ; *
3 : edgomez 1.2.2.1 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - 3dne CBP computation -
5 : edgomez 1.2 ; *
6 : edgomez 1.2.2.1 ; * 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.2.2.1 BITS 32
30 :    
31 :     ;=============================================================================
32 :     ; Macros
33 :     ;=============================================================================
34 : edgomez 1.2
35 :     %macro cglobal 1
36 :     %ifdef PREFIX
37 :     global _%1
38 :     %define %1 _%1
39 :     %else
40 :     global %1
41 :     %endif
42 :     %endmacro
43 :    
44 :    
45 :     %macro calc_cbp 1
46 : edgomez 1.2.2.1 pshufw mm0, [eax], 229 ; =11100101
47 :     movq mm1, [eax+8]
48 :     por mm0, [eax+64]
49 :     por mm1, [eax+72]
50 :     movq mm2, [eax+16]
51 :     movq mm3, [eax+24]
52 :     por mm2, [eax+80]
53 :     por mm3, [eax+88]
54 :     movq mm4, [eax+32]
55 :     movq mm5, [eax+40]
56 :     por mm4, [eax+96]
57 :     por mm5, [eax+104]
58 :     movq mm6, [eax+48]
59 :     movq mm7, [eax+56]
60 :     por mm6, [eax+112]
61 :     por mm7, [eax+120]
62 :     por mm1, mm0
63 :     %if %1
64 :     sub eax, byte -128 ;ecx ;+= 128; needed 3 bytes for alignment
65 : edgomez 1.2 %else
66 : edgomez 1.2.2.1 xor eax, eax
67 :     xor edx, edx
68 :     %endif
69 :     por mm3, mm2
70 :     por mm5, mm4
71 :     por mm7, mm6
72 :     por mm3, mm1
73 :     por mm7, mm5
74 :     por mm7, mm3
75 :     packsswb mm7, mm7
76 :     movd [esp+%1*4], mm7
77 : edgomez 1.2 %endmacro
78 :    
79 : edgomez 1.2.2.1 ;=============================================================================
80 :     ; Code
81 :     ;=============================================================================
82 :    
83 :     SECTION .text
84 :    
85 :     cglobal calc_cbp_3dne
86 : edgomez 1.2
87 : edgomez 1.2.2.1 ;-----------------------------------------------------------------------------
88 :     ; uint32_t calc_cbp_3dne(const int16_t coeff[6*64]);
89 :     ;-----------------------------------------------------------------------------
90 :     ;AMD K7, in cache: ca 80 clk
91 : edgomez 1.2
92 : edgomez 1.2.2.1 ALIGN 16
93 : edgomez 1.2 calc_cbp_3dne:
94 : edgomez 1.2.2.1 mov eax, [esp+ 4] ; coeff
95 :     lea esp, [esp-24]
96 : edgomez 1.2 calc_cbp 5 ;bit 5
97 : edgomez 1.2.2.1 calc_cbp 4 ;b4
98 : edgomez 1.2 calc_cbp 3 ;b3
99 :     calc_cbp 2 ;b2
100 :     calc_cbp 1 ;b1
101 :     calc_cbp 0 ;b0
102 : edgomez 1.2.2.1 cmp eax, [esp+5*4]
103 :     adc eax, eax
104 :     cmp edx, [esp+4*4]
105 :     adc eax, eax
106 :     cmp edx, [esp+3*4]
107 :     adc eax, eax
108 :     cmp edx, [esp+2*4]
109 :     adc eax, eax
110 :     cmp edx, [esp+1*4]
111 :     adc eax, eax
112 :     cmp edx, [esp+0*4]
113 :     adc eax, eax
114 :     add esp, byte 24
115 :     ret

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