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

1 : edgomez 1.4 ;/****************************************************************************
2 : Isibaar 1.1 ; *
3 : edgomez 1.4 ; * XVID MPEG-4 VIDEO CODEC
4 :     ; * - SSE2 CBP computation -
5 : Isibaar 1.1 ; *
6 : edgomez 1.4 ; * Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com>
7 :     ; * 2002 Pascal Massimino <skal@planet-d.net>
8 : edgomez 1.3 ; *
9 : edgomez 1.4 ; * 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.4 ; * 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.4 ; * 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 : Isibaar 1.14 ; * $Id: cbp_sse2.asm,v 1.13 2008/12/04 14:41:50 Isibaar Exp $
24 : Isibaar 1.1 ; *
25 : edgomez 1.4 ; ***************************************************************************/
26 : edgomez 1.3
27 : edgomez 1.4 ;=============================================================================
28 :     ; Macros
29 :     ;=============================================================================
30 : Isibaar 1.1
31 : Isibaar 1.10 %include "nasm.inc"
32 : Isibaar 1.1
33 : Isibaar 1.10 %macro LOOP_SSE2 2
34 :     movdqa xmm0, [%2+(%1)*128]
35 : Isibaar 1.12 pand xmm0, xmm3
36 : Isibaar 1.10 movdqa xmm1, [%2+(%1)*128+16]
37 : edgomez 1.4
38 : Isibaar 1.10 por xmm0, [%2+(%1)*128+32]
39 :     por xmm1, [%2+(%1)*128+48]
40 :     por xmm0, [%2+(%1)*128+64]
41 :     por xmm1, [%2+(%1)*128+80]
42 :     por xmm0, [%2+(%1)*128+96]
43 :     por xmm1, [%2+(%1)*128+112]
44 : edgomez 1.4
45 :     por xmm0, xmm1 ; xmm0 = xmm1 = 128 bits worth of info
46 : Isibaar 1.12 psadbw xmm0, xmm2 ; contains 2 dwords with sums
47 : edgomez 1.4 movhlps xmm1, xmm0 ; move high dword from xmm0 to low xmm1
48 :     por xmm0, xmm1 ; combine
49 :     movd ecx, xmm0 ; if ecx set, values were found
50 : Isibaar 1.10 test _ECX, _ECX
51 : Isibaar 1.1 %endmacro
52 :    
53 : edgomez 1.4 ;=============================================================================
54 :     ; Data (Read Only)
55 :     ;=============================================================================
56 :    
57 : Isibaar 1.10 DATA
58 : edgomez 1.4
59 : Isibaar 1.10 ALIGN SECTION_ALIGN
60 : edgomez 1.4 ignore_dc:
61 :     dw 0, -1, -1, -1, -1, -1, -1, -1
62 :    
63 :     ;=============================================================================
64 :     ; Code
65 :     ;=============================================================================
66 :    
67 : Isibaar 1.13 TEXT
68 : edgomez 1.4
69 :     ;-----------------------------------------------------------------------------
70 :     ; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]);
71 :     ;-----------------------------------------------------------------------------
72 : Isibaar 1.1
73 : Isibaar 1.10 ALIGN SECTION_ALIGN
74 : edgomez 1.4 cglobal calc_cbp_sse2
75 : Isibaar 1.1 calc_cbp_sse2:
76 : Isibaar 1.10 mov _EDX, prm1 ; coeff[]
77 :     xor _EAX, _EAX ; cbp = 0
78 : Isibaar 1.1
79 : Isibaar 1.12 movdqu xmm3, [ignore_dc] ; mask to ignore dc value
80 :     pxor xmm2, xmm2 ; zero
81 : Isibaar 1.1
82 : Isibaar 1.10 LOOP_SSE2 0, _EDX
83 : edgomez 1.4 jz .blk2
84 : Isibaar 1.10 or _EAX, (1<<5)
85 : edgomez 1.4
86 : Isibaar 1.9 .blk2:
87 : Isibaar 1.10 LOOP_SSE2 1, _EDX
88 : edgomez 1.4 jz .blk3
89 : Isibaar 1.10 or _EAX, (1<<4)
90 : edgomez 1.4
91 : Isibaar 1.9 .blk3:
92 : Isibaar 1.10 LOOP_SSE2 2, _EDX
93 : edgomez 1.4 jz .blk4
94 : Isibaar 1.10 or _EAX, (1<<3)
95 : edgomez 1.4
96 : Isibaar 1.9 .blk4:
97 : Isibaar 1.10 LOOP_SSE2 3, _EDX
98 : edgomez 1.4 jz .blk5
99 : Isibaar 1.10 or _EAX, (1<<2)
100 : edgomez 1.4
101 : Isibaar 1.9 .blk5:
102 : Isibaar 1.10 LOOP_SSE2 4, _EDX
103 : edgomez 1.4 jz .blk6
104 : Isibaar 1.10 or _EAX, (1<<1)
105 : edgomez 1.4
106 : Isibaar 1.9 .blk6:
107 : Isibaar 1.10 LOOP_SSE2 5, _EDX
108 : edgomez 1.4 jz .finished
109 : Isibaar 1.10 or _EAX, (1<<0)
110 : edgomez 1.4
111 : Isibaar 1.9 .finished:
112 : Isibaar 1.11
113 :     ret
114 : Isibaar 1.9 ENDFUNC
115 : edgomez 1.7
116 : Isibaar 1.14 NON_EXEC_STACK

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