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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3.2.1 - (view) (download)

1 : edgomez 1.3.2.1 ;/****************************************************************************
2 : Isibaar 1.1 ; *
3 : edgomez 1.3.2.1 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - SSE2 CBP computation -
5 : Isibaar 1.1 ; *
6 : edgomez 1.3.2.1 ; * Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com>
7 :     ; * 2002 Pascal Massimino <skal@planet-d.net>
8 : edgomez 1.3 ; *
9 : edgomez 1.3.2.1 ; * This program is free software ; you can redistribute it and/or modify
10 :     ; * it under the terms of the GNU General Public License as published by
11 :     ; * the Free Software Foundation ; either version 2 of the License, or
12 :     ; * (at your option) any later version.
13 : edgomez 1.3 ; *
14 : edgomez 1.3.2.1 ; * This program is distributed in the hope that it will be useful,
15 :     ; * but WITHOUT ANY WARRANTY ; without even the implied warranty of
16 :     ; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 :     ; * GNU General Public License for more details.
18 : edgomez 1.3 ; *
19 : edgomez 1.3.2.1 ; * You should have received a copy of the GNU General Public License
20 :     ; * along with this program ; if not, write to the Free Software
21 :     ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 : Isibaar 1.1 ; *
23 : edgomez 1.3.2.1 ; * $Id$
24 : Isibaar 1.1 ; *
25 : edgomez 1.3.2.1 ; ***************************************************************************/
26 : Isibaar 1.1
27 : edgomez 1.3.2.1 BITS 32
28 : Isibaar 1.1
29 : edgomez 1.3.2.1 ;=============================================================================
30 :     ; Macros
31 :     ;=============================================================================
32 : Isibaar 1.1
33 :     %macro cglobal 1
34 :     %ifdef PREFIX
35 :     global _%1
36 :     %define %1 _%1
37 :     %else
38 :     global %1
39 :     %endif
40 :     %endmacro
41 :    
42 : edgomez 1.3.2.1 %macro LOOP_SSE2 1
43 :     movdqa xmm0, [edx+(%1)*128]
44 :     pand xmm0, xmm7
45 :     movdqa xmm1, [edx+(%1)*128+16]
46 :    
47 :     por xmm0, [edx+(%1)*128+32]
48 :     por xmm1, [edx+(%1)*128+48]
49 :     por xmm0, [edx+(%1)*128+64]
50 :     por xmm1, [edx+(%1)*128+80]
51 :     por xmm0, [edx+(%1)*128+96]
52 :     por xmm1, [edx+(%1)*128+112]
53 :    
54 :     por xmm0, xmm1 ; xmm0 = xmm1 = 128 bits worth of info
55 :     psadbw xmm0, xmm6 ; contains 2 dwords with sums
56 :     movhlps xmm1, xmm0 ; move high dword from xmm0 to low xmm1
57 :     por xmm0, xmm1 ; combine
58 :     movd ecx, xmm0 ; if ecx set, values were found
59 :     test ecx, ecx
60 :     %endmacro
61 : Isibaar 1.1
62 : edgomez 1.3.2.1 ;=============================================================================
63 :     ; Data (Read Only)
64 :     ;=============================================================================
65 : Isibaar 1.1
66 : edgomez 1.3.2.1 SECTION .rodata
67 : Isibaar 1.1
68 : edgomez 1.3.2.1 ALIGN 16
69 :     ignore_dc:
70 :     dw 0, -1, -1, -1, -1, -1, -1, -1
71 : Isibaar 1.1
72 : edgomez 1.3.2.1 ;=============================================================================
73 :     ; Code
74 :     ;=============================================================================
75 : Isibaar 1.1
76 : edgomez 1.3.2.1 SECTION .text
77 : Isibaar 1.1
78 : edgomez 1.3.2.1 ;-----------------------------------------------------------------------------
79 :     ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]);
80 :     ;-----------------------------------------------------------------------------
81 : Isibaar 1.1
82 : edgomez 1.3.2.1 ALIGN 16
83 :     cglobal calc_cbp_sse2
84 : Isibaar 1.1 calc_cbp_sse2:
85 : edgomez 1.3.2.1 mov edx, [esp+4] ; coeff[]
86 :     xor eax, eax ; cbp = 0
87 : Isibaar 1.1
88 : edgomez 1.3.2.1 movdqu xmm7, [ignore_dc] ; mask to ignore dc value
89 :     pxor xmm6, xmm6 ; zero
90 : Isibaar 1.1
91 :     LOOP_SSE2 0
92 : edgomez 1.3.2.1 test ecx, ecx
93 :     jz .blk2
94 :     or eax, (1<<5)
95 :    
96 : Isibaar 1.1 .blk2
97 :     LOOP_SSE2 1
98 : edgomez 1.3.2.1 test ecx, ecx
99 :     jz .blk3
100 : Isibaar 1.1 or eax, (1<<4)
101 : edgomez 1.3.2.1
102 : Isibaar 1.1 .blk3
103 :     LOOP_SSE2 2
104 : edgomez 1.3.2.1 test ecx, ecx
105 :     jz .blk4
106 : Isibaar 1.1 or eax, (1<<3)
107 : edgomez 1.3.2.1
108 : Isibaar 1.1 .blk4
109 :     LOOP_SSE2 3
110 : edgomez 1.3.2.1 test ecx, ecx
111 :     jz .blk5
112 : Isibaar 1.1 or eax, (1<<2)
113 : edgomez 1.3.2.1
114 : Isibaar 1.1 .blk5
115 :     LOOP_SSE2 4
116 : edgomez 1.3.2.1 test ecx, ecx
117 :     jz .blk6
118 : Isibaar 1.1 or eax, (1<<1)
119 : edgomez 1.3.2.1
120 : Isibaar 1.1 .blk6
121 :     LOOP_SSE2 5
122 : edgomez 1.3.2.1 test ecx, ecx
123 :     jz .finished
124 : Isibaar 1.1 or eax, (1<<0)
125 : edgomez 1.3.2.1
126 : Isibaar 1.1 .finished
127 : edgomez 1.3.2.1 ret

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