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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1793 - (view) (download)

1 : edgomez 1382 ;/****************************************************************************
2 : Isibaar 3 ; *
3 : edgomez 1382 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - MMX CBP computation -
5 : Isibaar 3 ; *
6 : Skal 1629 ; * Copyright (C) 2005 Carlo Bramini <carlo.bramix@libero.it>
7 :     ; * 2001-2003 Peter Ross <pross@xvid.org>
8 : edgomez 1382 ; * 2002-2003 Pascal Massimino <skal@planet-d.net>
9 : Isibaar 3 ; *
10 : edgomez 1382 ; * 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 : Isibaar 3 ; *
15 : edgomez 1382 ; * 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 : Isibaar 3 ; *
20 : edgomez 1382 ; * 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 3 ; *
24 : Isibaar 1793 ; * $Id: cbp_mmx.asm,v 1.16 2008-11-11 20:46:24 Isibaar Exp $
25 : Isibaar 3 ; *
26 : edgomez 1382 ; ***************************************************************************/
27 : Isibaar 3
28 : edgomez 1382 BITS 32
29 : edgomez 851
30 : edgomez 1382 ;=============================================================================
31 :     ; Macros
32 :     ;=============================================================================
33 : Isibaar 3
34 :     %macro cglobal 1
35 : Isibaar 262 %ifdef PREFIX
36 : edgomez 1535 %ifdef MARK_FUNCS
37 : edgomez 1540 global _%1:function %1.endfunc-%1
38 :     %define %1 _%1:function %1.endfunc-%1
39 : Isibaar 1793 %define ENDFUNC .endfunc
40 : edgomez 1535 %else
41 :     global _%1
42 :     %define %1 _%1
43 : Isibaar 1793 %define ENDFUNC
44 : edgomez 1535 %endif
45 : Isibaar 262 %else
46 : edgomez 1535 %ifdef MARK_FUNCS
47 : edgomez 1540 global %1:function %1.endfunc-%1
48 : Isibaar 1793 %define ENDFUNC .endfunc
49 : edgomez 1535 %else
50 :     global %1
51 : Isibaar 1793 %define ENDFUNC
52 : edgomez 1535 %endif
53 : Isibaar 262 %endif
54 : Isibaar 3 %endmacro
55 :    
56 : edgomez 1382 ;=============================================================================
57 :     ; Local data
58 :     ;=============================================================================
59 : Isibaar 3
60 : edgomez 1382 %ifdef FORMAT_COFF
61 : edgomez 1519 SECTION .rodata
62 : edgomez 1382 %else
63 : edgomez 1519 SECTION .rodata align=16
64 : edgomez 1382 %endif
65 : Isibaar 3
66 : edgomez 1382 ALIGN 16
67 : Isibaar 3
68 : Skal 1629 mult_mask:
69 :     db 0x10,0x20,0x04,0x08,0x01,0x02,0x00,0x00
70 : edgomez 1382 ignore_dc:
71 : Skal 1629 dw 0, -1, -1, -1
72 : edgomez 1382
73 :     ;=============================================================================
74 :     ; Code
75 :     ;=============================================================================
76 :    
77 :     SECTION .text
78 :    
79 : Isibaar 262 cglobal calc_cbp_mmx
80 : Isibaar 3
81 : edgomez 1382 ;-----------------------------------------------------------------------------
82 : Isibaar 3 ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]);
83 : edgomez 1382 ;-----------------------------------------------------------------------------
84 : Isibaar 3
85 : Skal 1629 %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 1382 ALIGN 16
95 : Isibaar 262 calc_cbp_mmx:
96 : Skal 1629 mov eax, [esp + 4] ; coeff
97 : Isibaar 3
98 : edgomez 1382 movq mm7, [ignore_dc]
99 : Skal 1629 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 1382 pand mm0, mm7
108 : Skal 1629 pand mm1, mm7
109 :     pand mm2, mm7
110 :     pand mm3, mm7
111 :     pand mm4, mm7
112 :     pand mm5, mm7
113 : Isibaar 3
114 : Skal 1629 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 : Isibaar 3
130 : Skal 1629 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 1642 pcmpeqw mm0, mm6
137 :     pcmpeqw mm4, mm6
138 :     pcmpeqw mm0, mm6
139 :     pcmpeqw mm4, mm6
140 : Skal 1629 psrlw mm0, 15
141 :     psrlw mm4, 15
142 :     packuswb mm0, mm4
143 :     pmaddwd mm0, mm7
144 : Isibaar 3
145 : edgomez 1382 movq mm1, mm0
146 :     psrlq mm1, 32
147 : Skal 1629 paddusb mm0, mm1
148 : Isibaar 3
149 : Skal 1629 movd eax, mm0
150 :     shr eax, 8
151 :     and eax, 0x3F
152 : edgomez 1382 ret
153 : Isibaar 1793 ENDFUNC
154 : edgomez 1540
155 : Isibaar 1790
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