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 |
; * |
; * |
|
; * Under section 8 of the GNU General Public License, the copyright |
|
|
; * 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. |
|
|
; * |
|
23 |
; * $Id$ |
; * $Id$ |
24 |
; * |
; * |
25 |
; *************************************************************************/ |
; ***************************************************************************/ |
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 |
68 |
|
%else |
69 |
|
SECTION .rodata 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 |