1 |
;/************************************************************************** |
;/**************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * sse2 cbp calc |
; * - SSE2 CBP computation - |
5 |
; * |
; * |
6 |
; * This file is part of XviD, a free MPEG-4 video encoder/decoder |
; * Copyright (C) 2002 Daniel Smith <danielsmith@astroboymail.com> |
7 |
|
; * 2002 Pascal Massimino <skal@planet-d.net> |
8 |
; * |
; * |
9 |
; * XviD is free software; you can redistribute it and/or modify it |
; * This program is free software ; you can redistribute it and/or modify |
10 |
; * 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 |
11 |
; * the Free Software Foundation; either version 2 of the License, or |
; * the Free Software Foundation; either version 2 of the License, or |
12 |
; * (at your option) any later version. |
; * (at your option) any later version. |
13 |
; * |
; * |
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 |
; * |
; * |
23 |
; * Under section 8 of the GNU General Public License, the copyright |
; * $Id: cbp_sse2.asm,v 1.8 2008-08-19 09:06:48 Isibaar Exp $ |
|
; * holders of XVID explicitly forbid distribution in the following |
|
|
; * countries: |
|
|
; * |
|
|
; * - Japan |
|
|
; * - United States of America |
|
|
; * |
|
|
; * Linking XviD statically or dynamically with other modules is making a |
|
|
; * combined work based on XviD. Thus, the terms and conditions of the |
|
|
; * GNU General Public License cover the whole combination. |
|
|
; * |
|
|
; * As a special exception, the copyright holders of XviD give you |
|
|
; * permission to link XviD with independent modules that communicate with |
|
|
; * XviD solely through the VFW1.1 and DShow interfaces, regardless of the |
|
|
; * license terms of these independent modules, and to copy and distribute |
|
|
; * the resulting combined work under terms of your choice, provided that |
|
|
; * every copy of the combined work is accompanied by a complete copy of |
|
|
; * the source code of XviD (the version of XviD used to produce the |
|
|
; * combined work), being distributed under the terms of the GNU General |
|
|
; * Public License plus this exception. An independent module is a module |
|
|
; * which is not derived from or based on XviD. |
|
|
; * |
|
|
; * Note that people who make modified versions of XviD are not obligated |
|
|
; * to grant this special exception for their modified versions; it is |
|
|
; * their choice whether to do so. The GNU General Public License gives |
|
|
; * permission to release a modified version without this exception; this |
|
|
; * exception also makes it possible to release a modified version which |
|
|
; * carries forward this exception. |
|
24 |
; * |
; * |
25 |
; * $Id: cbp_sse2.asm,v 1.2 2002-11-17 00:57:58 edgomez Exp $ |
; ***************************************************************************/ |
|
; * |
|
|
; *************************************************************************/ |
|
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 |
35 |
|
%ifdef MARK_FUNCS |
36 |
|
global _%1:function %1.endfunc-%1 |
37 |
|
%define %1 _%1:function %1.endfunc-%1 |
38 |
|
%else |
39 |
global _%1 |
global _%1 |
40 |
%define %1 _%1 |
%define %1 _%1 |
41 |
|
%endif |
42 |
|
%else |
43 |
|
%ifdef MARK_FUNCS |
44 |
|
global %1:function %1.endfunc-%1 |
45 |
%else |
%else |
46 |
global %1 |
global %1 |
47 |
%endif |
%endif |
48 |
|
%endif |
49 |
%endmacro |
%endmacro |
50 |
|
|
|
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? |
|
|
; |
|
|
;=========================================================================== |
|
|
|
|
51 |
%macro LOOP_SSE2 1 |
%macro LOOP_SSE2 1 |
52 |
movdqa xmm0, [edx+(%1)*128] |
movdqa xmm0, [edx+(%1)*128] |
53 |
pand xmm0, xmm7 |
pand xmm0, xmm7 |
68 |
test ecx, ecx |
test ecx, ecx |
69 |
%endmacro |
%endmacro |
70 |
|
|
71 |
align 16 |
;============================================================================= |
72 |
|
; Data (Read Only) |
73 |
|
;============================================================================= |
74 |
|
|
75 |
|
%ifdef FORMAT_COFF |
76 |
|
SECTION .rodata |
77 |
|
%else |
78 |
|
SECTION .rodata align=16 |
79 |
|
%endif |
80 |
|
|
81 |
|
ALIGN 16 |
82 |
|
ignore_dc: |
83 |
|
dw 0, -1, -1, -1, -1, -1, -1, -1 |
84 |
|
|
85 |
|
;============================================================================= |
86 |
|
; Code |
87 |
|
;============================================================================= |
88 |
|
|
89 |
|
SECTION .text |
90 |
|
|
91 |
|
;----------------------------------------------------------------------------- |
92 |
|
; uint32_t calc_cbp_sse2(const int16_t coeff[6*64]); |
93 |
|
;----------------------------------------------------------------------------- |
94 |
|
|
95 |
|
ALIGN 16 |
96 |
|
cglobal calc_cbp_sse2 |
97 |
calc_cbp_sse2: |
calc_cbp_sse2: |
98 |
mov edx, [esp+4] ; coeff[] |
mov edx, [esp+4] ; coeff[] |
99 |
xor eax, eax ; cbp = 0 |
xor eax, eax ; cbp = 0 |
105 |
test ecx, ecx |
test ecx, ecx |
106 |
jz .blk2 |
jz .blk2 |
107 |
or eax, (1<<5) |
or eax, (1<<5) |
108 |
|
|
109 |
.blk2 |
.blk2 |
110 |
LOOP_SSE2 1 |
LOOP_SSE2 1 |
111 |
test ecx, ecx |
test ecx, ecx |
112 |
jz .blk3 |
jz .blk3 |
113 |
or eax, (1<<4) |
or eax, (1<<4) |
114 |
|
|
115 |
.blk3 |
.blk3 |
116 |
LOOP_SSE2 2 |
LOOP_SSE2 2 |
117 |
test ecx, ecx |
test ecx, ecx |
118 |
jz .blk4 |
jz .blk4 |
119 |
or eax, (1<<3) |
or eax, (1<<3) |
120 |
|
|
121 |
.blk4 |
.blk4 |
122 |
LOOP_SSE2 3 |
LOOP_SSE2 3 |
123 |
test ecx, ecx |
test ecx, ecx |
124 |
jz .blk5 |
jz .blk5 |
125 |
or eax, (1<<2) |
or eax, (1<<2) |
126 |
|
|
127 |
.blk5 |
.blk5 |
128 |
LOOP_SSE2 4 |
LOOP_SSE2 4 |
129 |
test ecx, ecx |
test ecx, ecx |
130 |
jz .blk6 |
jz .blk6 |
131 |
or eax, (1<<1) |
or eax, (1<<1) |
132 |
|
|
133 |
.blk6 |
.blk6 |
134 |
LOOP_SSE2 5 |
LOOP_SSE2 5 |
135 |
test ecx, ecx |
test ecx, ecx |
136 |
jz .finished |
jz .finished |
137 |
or eax, (1<<0) |
or eax, (1<<0) |
|
.finished |
|
138 |
|
|
139 |
|
.finished |
140 |
ret |
ret |
141 |
|
.endfunc |
142 |
|
|
143 |
|
|
144 |
|
%ifidn __OUTPUT_FORMAT__,elf |
145 |
|
section ".note.GNU-stack" noalloc noexec nowrite progbits |
146 |
|
%endif |
147 |
|
|