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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (view) (download)

1 : edgomez 1.9 ;/****************************************************************************
2 : Isibaar 1.1 ; *
3 : edgomez 1.9 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - MMX CBP computation -
5 : Isibaar 1.1 ; *
6 : Skal 1.13 ; * Copyright (C) 2005 Carlo Bramini <carlo.bramix@libero.it>
7 :     ; * 2001-2003 Peter Ross <pross@xvid.org>
8 : edgomez 1.9 ; * 2002-2003 Pascal Massimino <skal@planet-d.net>
9 : edgomez 1.8 ; *
10 : edgomez 1.9 ; * This program is free software ; you can redistribute it and/or modify
11 :     ; * it under the terms of the GNU General Public License as published by
12 :     ; * the Free Software Foundation ; either version 2 of the License, or
13 :     ; * (at your option) any later version.
14 : edgomez 1.8 ; *
15 : edgomez 1.9 ; * This program is distributed in the hope that it will be useful,
16 :     ; * but WITHOUT ANY WARRANTY ; without even the implied warranty of
17 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 :     ; * GNU General Public License for more details.
19 : edgomez 1.8 ; *
20 : edgomez 1.9 ; * You should have received a copy of the GNU General Public License
21 :     ; * along with this program ; if not, write to the Free Software
22 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 : Isibaar 1.1 ; *
24 : Isibaar 1.16 ; * $Id: cbp_mmx.asm,v 1.15 2008/08/19 09:06:48 Isibaar Exp $
25 : Isibaar 1.1 ; *
26 : edgomez 1.9 ; ***************************************************************************/
27 : edgomez 1.8
28 : edgomez 1.9 BITS 32
29 : Isibaar 1.1
30 : edgomez 1.9 ;=============================================================================
31 :     ; Macros
32 :     ;=============================================================================
33 : Isibaar 1.1
34 :     %macro cglobal 1
35 : Isibaar 1.5 %ifdef PREFIX
36 : edgomez 1.11 %ifdef MARK_FUNCS
37 : edgomez 1.12 global _%1:function %1.endfunc-%1
38 :     %define %1 _%1:function %1.endfunc-%1
39 : Isibaar 1.16 %define ENDFUNC .endfunc
40 : edgomez 1.11 %else
41 :     global _%1
42 :     %define %1 _%1
43 : Isibaar 1.16 %define ENDFUNC
44 : edgomez 1.11 %endif
45 : Isibaar 1.5 %else
46 : edgomez 1.11 %ifdef MARK_FUNCS
47 : edgomez 1.12 global %1:function %1.endfunc-%1
48 : Isibaar 1.16 %define ENDFUNC .endfunc
49 : edgomez 1.11 %else
50 :     global %1
51 : Isibaar 1.16 %define ENDFUNC
52 : edgomez 1.11 %endif
53 : Isibaar 1.5 %endif
54 : Isibaar 1.1 %endmacro
55 :    
56 : edgomez 1.9 ;=============================================================================
57 :     ; Local data
58 :     ;=============================================================================
59 :    
60 :     %ifdef FORMAT_COFF
61 : edgomez 1.10 SECTION .rodata
62 : edgomez 1.9 %else
63 : edgomez 1.10 SECTION .rodata align=16
64 : edgomez 1.9 %endif
65 :    
66 :     ALIGN 16
67 :    
68 : Skal 1.13 mult_mask:
69 :     db 0x10,0x20,0x04,0x08,0x01,0x02,0x00,0x00
70 : edgomez 1.9 ignore_dc:
71 : Skal 1.13 dw 0, -1, -1, -1
72 : edgomez 1.9
73 :     ;=============================================================================
74 :     ; Code
75 :     ;=============================================================================
76 : Isibaar 1.1
77 : edgomez 1.9 SECTION .text
78 : Isibaar 1.1
79 : Isibaar 1.5 cglobal calc_cbp_mmx
80 : Isibaar 1.1
81 : edgomez 1.9 ;-----------------------------------------------------------------------------
82 : Isibaar 1.1 ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]);
83 : edgomez 1.9 ;-----------------------------------------------------------------------------
84 : Isibaar 1.1
85 : Skal 1.13 %macro MAKE_LOAD 1
86 :     por mm0, [eax-128*1+%1*8]
87 :     por mm1, [eax+128*0+%1*8]
88 :     por mm2, [eax+128*1+%1*8]
89 :     por mm3, [eax+128*2+%1*8]
90 :     por mm4, [eax+128*3+%1*8]
91 :     por mm5, [eax+128*4+%1*8]
92 :     %endmacro
93 :    
94 : edgomez 1.9 ALIGN 16
95 : Isibaar 1.5 calc_cbp_mmx:
96 : Skal 1.13 mov eax, [esp + 4] ; coeff
97 : Isibaar 1.1
98 : edgomez 1.9 movq mm7, [ignore_dc]
99 : Skal 1.13 pxor mm6, mm6 ; used only for comparing
100 :     movq mm0, [eax+128*0]
101 :     movq mm1, [eax+128*1]
102 :     movq mm2, [eax+128*2]
103 :     movq mm3, [eax+128*3]
104 :     movq mm4, [eax+128*4]
105 :     movq mm5, [eax+128*5]
106 :     add eax, 8+128
107 : edgomez 1.9 pand mm0, mm7
108 : Skal 1.13 pand mm1, mm7
109 :     pand mm2, mm7
110 :     pand mm3, mm7
111 :     pand mm4, mm7
112 :     pand mm5, mm7
113 :    
114 :     MAKE_LOAD 0
115 :     MAKE_LOAD 1
116 :     MAKE_LOAD 2
117 :     MAKE_LOAD 3
118 :     MAKE_LOAD 4
119 :     MAKE_LOAD 5
120 :     MAKE_LOAD 6
121 :     MAKE_LOAD 7
122 :     MAKE_LOAD 8
123 :     MAKE_LOAD 9
124 :     MAKE_LOAD 10
125 :     MAKE_LOAD 11
126 :     MAKE_LOAD 12
127 :     MAKE_LOAD 13
128 :     MAKE_LOAD 14
129 :    
130 :     movq mm7, [mult_mask]
131 :     packssdw mm0, mm1
132 :     packssdw mm2, mm3
133 :     packssdw mm4, mm5
134 :     packssdw mm0, mm2
135 :     packssdw mm4, mm6
136 : suxen_drol 1.14 pcmpeqw mm0, mm6
137 :     pcmpeqw mm4, mm6
138 :     pcmpeqw mm0, mm6
139 :     pcmpeqw mm4, mm6
140 : Skal 1.13 psrlw mm0, 15
141 :     psrlw mm4, 15
142 :     packuswb mm0, mm4
143 :     pmaddwd mm0, mm7
144 : Isibaar 1.5
145 : edgomez 1.9 movq mm1, mm0
146 :     psrlq mm1, 32
147 : Skal 1.13 paddusb mm0, mm1
148 : Isibaar 1.1
149 : Skal 1.13 movd eax, mm0
150 :     shr eax, 8
151 :     and eax, 0x3F
152 : edgomez 1.9 ret
153 : Isibaar 1.16 ENDFUNC
154 : edgomez 1.12
155 : Isibaar 1.15
156 :     %ifidn __OUTPUT_FORMAT__,elf
157 :     section ".note.GNU-stack" noalloc noexec nowrite progbits
158 :     %endif
159 :    

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