1 |
;/************************************************************************** |
;/**************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * sse2 cbp calc |
; * - SSE2 CBP computation - |
5 |
; * |
; * |
6 |
; * This program is an implementation of a part of one or more MPEG-4 |
; * Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com> |
7 |
; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
; * 2002 Pascal Massimino <skal@planet-d.net> |
|
; * to use this software module in hardware or software products are |
|
|
; * advised that its use may infringe existing patents or copyrights, and |
|
|
; * any such use would be at such party's own risk. The original |
|
|
; * developer of this software module and his/her company, and subsequent |
|
|
; * editors and their companies, will have no liability for use of this |
|
|
; * software or modifications or derivatives thereof. |
|
8 |
; * |
; * |
9 |
; * This program is free software; you can redistribute it and/or modify |
; * 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 |
; * it under the terms of the GNU General Public License as published by |
18 |
; * |
; * |
19 |
; * You should have received a copy of the GNU General Public License |
; * You should have received a copy of the GNU General Public License |
20 |
; * along with this program; if not, write to the Free Software |
; * along with this program; if not, write to the Free Software |
21 |
; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
; * |
; * |
23 |
; *************************************************************************/ |
; * $Id: cbp_sse2.asm,v 1.4 2004-03-22 22:36:23 edgomez Exp $ |
|
|
|
|
;/************************************************************************** |
|
|
; * |
|
|
; * History: |
|
24 |
; * |
; * |
25 |
; * 14.06.2002 cleanup -Skal- |
; ***************************************************************************/ |
|
; * 24.04.2002 had to use sse2's movdqu instead of movdqa (???) |
|
|
; * 17.04.2002 initial version (c) 2002 Daniel Smith |
|
|
; * |
|
|
; *************************************************************************/ |
|
|
|
|
26 |
|
|
27 |
bits 32 |
BITS 32 |
28 |
|
|
29 |
section .data |
;============================================================================= |
30 |
|
; Macros |
31 |
|
;============================================================================= |
32 |
|
|
33 |
%macro cglobal 1 |
%macro cglobal 1 |
34 |
%ifdef PREFIX |
%ifdef PREFIX |
39 |
%endif |
%endif |
40 |
%endmacro |
%endmacro |
41 |
|
|
|
align 16 |
|
|
|
|
|
ignore_dc dw 0, -1, -1, -1, -1, -1, -1, -1 |
|
|
|
|
|
section .text |
|
|
|
|
|
cglobal calc_cbp_sse2 |
|
|
|
|
|
;=========================================================================== |
|
|
; |
|
|
; uint32_t calc_cbp_sse2(const int16_t coeff[6][64]); |
|
|
; |
|
|
; not enabled - slower than mmx? |
|
|
; |
|
|
;=========================================================================== |
|
|
|
|
42 |
%macro LOOP_SSE2 1 |
%macro LOOP_SSE2 1 |
43 |
movdqa xmm0, [edx+(%1)*128] |
movdqa xmm0, [edx+(%1)*128] |
44 |
pand xmm0, xmm7 |
pand xmm0, xmm7 |
59 |
test ecx, ecx |
test ecx, ecx |
60 |
%endmacro |
%endmacro |
61 |
|
|
62 |
align 16 |
;============================================================================= |
63 |
|
; Data (Read Only) |
64 |
|
;============================================================================= |
65 |
|
|
66 |
|
%ifdef FORMAT_COFF |
67 |
|
SECTION .rodata data |
68 |
|
%else |
69 |
|
SECTION .rodata data align=16 |
70 |
|
%endif |
71 |
|
|
72 |
|
ALIGN 16 |
73 |
|
ignore_dc: |
74 |
|
dw 0, -1, -1, -1, -1, -1, -1, -1 |
75 |
|
|
76 |
|
;============================================================================= |
77 |
|
; Code |
78 |
|
;============================================================================= |
79 |
|
|
80 |
|
SECTION .text |
81 |
|
|
82 |
|
;----------------------------------------------------------------------------- |
83 |
|
; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]); |
84 |
|
;----------------------------------------------------------------------------- |
85 |
|
|
86 |
|
ALIGN 16 |
87 |
|
cglobal calc_cbp_sse2 |
88 |
calc_cbp_sse2: |
calc_cbp_sse2: |
89 |
mov edx, [esp+4] ; coeff[] |
mov edx, [esp+4] ; coeff[] |
90 |
xor eax, eax ; cbp = 0 |
xor eax, eax ; cbp = 0 |
96 |
test ecx, ecx |
test ecx, ecx |
97 |
jz .blk2 |
jz .blk2 |
98 |
or eax, (1<<5) |
or eax, (1<<5) |
99 |
|
|
100 |
.blk2 |
.blk2 |
101 |
LOOP_SSE2 1 |
LOOP_SSE2 1 |
102 |
test ecx, ecx |
test ecx, ecx |
103 |
jz .blk3 |
jz .blk3 |
104 |
or eax, (1<<4) |
or eax, (1<<4) |
105 |
|
|
106 |
.blk3 |
.blk3 |
107 |
LOOP_SSE2 2 |
LOOP_SSE2 2 |
108 |
test ecx, ecx |
test ecx, ecx |
109 |
jz .blk4 |
jz .blk4 |
110 |
or eax, (1<<3) |
or eax, (1<<3) |
111 |
|
|
112 |
.blk4 |
.blk4 |
113 |
LOOP_SSE2 3 |
LOOP_SSE2 3 |
114 |
test ecx, ecx |
test ecx, ecx |
115 |
jz .blk5 |
jz .blk5 |
116 |
or eax, (1<<2) |
or eax, (1<<2) |
117 |
|
|
118 |
.blk5 |
.blk5 |
119 |
LOOP_SSE2 4 |
LOOP_SSE2 4 |
120 |
test ecx, ecx |
test ecx, ecx |
121 |
jz .blk6 |
jz .blk6 |
122 |
or eax, (1<<1) |
or eax, (1<<1) |
123 |
|
|
124 |
.blk6 |
.blk6 |
125 |
LOOP_SSE2 5 |
LOOP_SSE2 5 |
126 |
test ecx, ecx |
test ecx, ecx |
127 |
jz .finished |
jz .finished |
128 |
or eax, (1<<0) |
or eax, (1<<0) |
|
.finished |
|
129 |
|
|
130 |
|
.finished |
131 |
ret |
ret |