1 |
;/************************************************************************** |
;/**************************************************************************** |
2 |
; * |
; * |
3 |
; * XVID MPEG-4 VIDEO CODEC |
; * XVID MPEG-4 VIDEO CODEC |
4 |
; * mmx cbp calc |
; * - 3dne CBP computation - |
5 |
; * |
; * |
6 |
; * This program is an implementation of a part of one or more MPEG-4 |
; * Copyright (C) 2002 Jaan Kalda |
|
; * Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
|
|
; * 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. |
|
7 |
; * |
; * |
8 |
; * This program is free software; you can redistribute it and/or modify |
; * This program is free software; you can redistribute it and/or modify |
9 |
; * 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 |
17 |
; * |
; * |
18 |
; * You should have received a copy of the GNU General Public License |
; * You should have received a copy of the GNU General Public License |
19 |
; * along with this program; if not, write to the Free Software |
; * along with this program; if not, write to the Free Software |
20 |
; * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
; * |
; * |
22 |
; *************************************************************************/ |
; * $Id$ |
23 |
|
; * |
24 |
|
; ***************************************************************************/ |
25 |
|
|
26 |
|
; these 3dne functions are compatible with iSSE, but are optimized |
27 |
|
; specifically for K7 pipelines |
28 |
|
|
29 |
; these 3dne functions are compatible with iSSE, but are optimized specifically for |
BITS 32 |
|
; K7 pipelines |
|
|
; |
|
|
;------------------------------------------------------------------------------ |
|
|
; 09.12.2002 Athlon optimizations contributed by Jaan Kalda |
|
|
;------------------------------------------------------------------------------ |
|
30 |
|
|
31 |
bits 32 |
;============================================================================= |
32 |
|
; Macros |
33 |
|
;============================================================================= |
34 |
|
|
|
section .data |
|
35 |
%macro cglobal 1 |
%macro cglobal 1 |
36 |
%ifdef PREFIX |
%ifdef PREFIX |
37 |
|
%ifdef MARK_FUNCS |
38 |
|
global _%1:function %1.endfunc-%1 |
39 |
|
%define %1 _%1:function %1.endfunc-%1 |
40 |
|
%define ENDFUNC .endfunc |
41 |
|
%else |
42 |
global _%1 |
global _%1 |
43 |
%define %1 _%1 |
%define %1 _%1 |
44 |
|
%define ENDFUNC |
45 |
|
%endif |
46 |
|
%else |
47 |
|
%ifdef MARK_FUNCS |
48 |
|
global %1:function %1.endfunc-%1 |
49 |
|
%define ENDFUNC .endfunc |
50 |
%else |
%else |
51 |
global %1 |
global %1 |
52 |
|
%define ENDFUNC |
53 |
|
%endif |
54 |
%endif |
%endif |
55 |
%endmacro |
%endmacro |
56 |
|
|
|
section .text |
|
|
|
|
|
cglobal calc_cbp_3dne |
|
|
|
|
|
;=========================================================================== |
|
|
; |
|
|
; uint32_t calc_cbp_3dne(const int16_t coeff[6][64]); |
|
|
; |
|
|
;=========================================================================== |
|
57 |
%macro calc_cbp 1 |
%macro calc_cbp 1 |
58 |
pshufw mm0, [eax], 229 ; =11100101 |
pshufw mm0, [eax], 229 ; =11100101 |
59 |
movq mm1, [eax+8] |
movq mm1, [eax+8] |
88 |
movd [esp+%1*4],mm7 |
movd [esp+%1*4],mm7 |
89 |
%endmacro |
%endmacro |
90 |
|
|
91 |
|
;============================================================================= |
92 |
|
; Code |
93 |
|
;============================================================================= |
94 |
|
|
95 |
|
SECTION .text |
96 |
|
|
97 |
align 16 ;AMD K7, in cache: ca 80 clk |
cglobal calc_cbp_3dne |
98 |
|
|
99 |
|
;----------------------------------------------------------------------------- |
100 |
|
; uint32_t calc_cbp_3dne(const int16_t coeff[6*64]); |
101 |
|
;----------------------------------------------------------------------------- |
102 |
|
;AMD K7, in cache: ca 80 clk |
103 |
|
|
104 |
|
ALIGN 16 |
105 |
calc_cbp_3dne: |
calc_cbp_3dne: |
106 |
mov eax, [esp+ 4] ; coeff |
mov eax, [esp+ 4] ; coeff |
107 |
lea esp,[esp-24] |
lea esp,[esp-24] |
125 |
adc eax,eax |
adc eax,eax |
126 |
add esp,byte 24 |
add esp,byte 24 |
127 |
ret |
ret |
128 |
|
ENDFUNC |
129 |
|
|
130 |
|
|
131 |
|
%ifidn __OUTPUT_FORMAT__,elf |
132 |
|
section ".note.GNU-stack" noalloc noexec nowrite progbits |
133 |
|
%endif |
134 |
|
|