21 |
; * along with this program ; if not, write to the Free Software |
; * along with this program ; if not, write to the Free Software |
22 |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 |
; * |
; * |
24 |
; * $Id: cbp_mmx.asm,v 1.16 2008-11-11 20:46:24 Isibaar Exp $ |
; * $Id: cbp_mmx.asm,v 1.17 2008-11-26 01:04:34 Isibaar Exp $ |
25 |
; * |
; * |
26 |
; ***************************************************************************/ |
; ***************************************************************************/ |
27 |
|
|
|
BITS 32 |
|
|
|
|
28 |
;============================================================================= |
;============================================================================= |
29 |
; Macros |
; Macros |
30 |
;============================================================================= |
;============================================================================= |
31 |
|
|
32 |
%macro cglobal 1 |
%include "nasm.inc" |
|
%ifdef PREFIX |
|
|
%ifdef MARK_FUNCS |
|
|
global _%1:function %1.endfunc-%1 |
|
|
%define %1 _%1:function %1.endfunc-%1 |
|
|
%define ENDFUNC .endfunc |
|
|
%else |
|
|
global _%1 |
|
|
%define %1 _%1 |
|
|
%define ENDFUNC |
|
|
%endif |
|
|
%else |
|
|
%ifdef MARK_FUNCS |
|
|
global %1:function %1.endfunc-%1 |
|
|
%define ENDFUNC .endfunc |
|
|
%else |
|
|
global %1 |
|
|
%define ENDFUNC |
|
|
%endif |
|
|
%endif |
|
|
%endmacro |
|
33 |
|
|
34 |
;============================================================================= |
;============================================================================= |
35 |
; Local data |
; Local data |
36 |
;============================================================================= |
;============================================================================= |
37 |
|
|
38 |
%ifdef FORMAT_COFF |
DATA |
|
SECTION .rodata |
|
|
%else |
|
|
SECTION .rodata align=16 |
|
|
%endif |
|
39 |
|
|
40 |
ALIGN 16 |
ALIGN SECTION_ALIGN |
41 |
|
|
42 |
mult_mask: |
mult_mask: |
43 |
db 0x10,0x20,0x04,0x08,0x01,0x02,0x00,0x00 |
db 0x10,0x20,0x04,0x08,0x01,0x02,0x00,0x00 |
48 |
; Code |
; Code |
49 |
;============================================================================= |
;============================================================================= |
50 |
|
|
51 |
SECTION .text |
SECTION .rotext align=SECTION_ALIGN |
52 |
|
|
53 |
cglobal calc_cbp_mmx |
cglobal calc_cbp_mmx |
54 |
|
|
56 |
; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]); |
; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]); |
57 |
;----------------------------------------------------------------------------- |
;----------------------------------------------------------------------------- |
58 |
|
|
59 |
%macro MAKE_LOAD 1 |
%macro MAKE_LOAD 2 |
60 |
por mm0, [eax-128*1+%1*8] |
por mm0, [%2-128*1+%1*8] |
61 |
por mm1, [eax+128*0+%1*8] |
por mm1, [%2+128*0+%1*8] |
62 |
por mm2, [eax+128*1+%1*8] |
por mm2, [%2+128*1+%1*8] |
63 |
por mm3, [eax+128*2+%1*8] |
por mm3, [%2+128*2+%1*8] |
64 |
por mm4, [eax+128*3+%1*8] |
por mm4, [%2+128*3+%1*8] |
65 |
por mm5, [eax+128*4+%1*8] |
por mm5, [%2+128*4+%1*8] |
66 |
%endmacro |
%endmacro |
67 |
|
|
68 |
ALIGN 16 |
ALIGN SECTION_ALIGN |
69 |
calc_cbp_mmx: |
calc_cbp_mmx: |
70 |
mov eax, [esp + 4] ; coeff |
mov _EAX, prm1 ; coeff |
71 |
|
|
72 |
movq mm7, [ignore_dc] |
movq mm7, [ignore_dc] |
73 |
pxor mm6, mm6 ; used only for comparing |
pxor mm6, mm6 ; used only for comparing |
74 |
movq mm0, [eax+128*0] |
movq mm0, [_EAX+128*0] |
75 |
movq mm1, [eax+128*1] |
movq mm1, [_EAX+128*1] |
76 |
movq mm2, [eax+128*2] |
movq mm2, [_EAX+128*2] |
77 |
movq mm3, [eax+128*3] |
movq mm3, [_EAX+128*3] |
78 |
movq mm4, [eax+128*4] |
movq mm4, [_EAX+128*4] |
79 |
movq mm5, [eax+128*5] |
movq mm5, [_EAX+128*5] |
80 |
add eax, 8+128 |
add _EAX, 8+128 |
81 |
pand mm0, mm7 |
pand mm0, mm7 |
82 |
pand mm1, mm7 |
pand mm1, mm7 |
83 |
pand mm2, mm7 |
pand mm2, mm7 |
85 |
pand mm4, mm7 |
pand mm4, mm7 |
86 |
pand mm5, mm7 |
pand mm5, mm7 |
87 |
|
|
88 |
MAKE_LOAD 0 |
MAKE_LOAD 0, _EAX |
89 |
MAKE_LOAD 1 |
MAKE_LOAD 1, _EAX |
90 |
MAKE_LOAD 2 |
MAKE_LOAD 2, _EAX |
91 |
MAKE_LOAD 3 |
MAKE_LOAD 3, _EAX |
92 |
MAKE_LOAD 4 |
MAKE_LOAD 4, _EAX |
93 |
MAKE_LOAD 5 |
MAKE_LOAD 5, _EAX |
94 |
MAKE_LOAD 6 |
MAKE_LOAD 6, _EAX |
95 |
MAKE_LOAD 7 |
MAKE_LOAD 7, _EAX |
96 |
MAKE_LOAD 8 |
MAKE_LOAD 8, _EAX |
97 |
MAKE_LOAD 9 |
MAKE_LOAD 9, _EAX |
98 |
MAKE_LOAD 10 |
MAKE_LOAD 10, _EAX |
99 |
MAKE_LOAD 11 |
MAKE_LOAD 11, _EAX |
100 |
MAKE_LOAD 12 |
MAKE_LOAD 12, _EAX |
101 |
MAKE_LOAD 13 |
MAKE_LOAD 13, _EAX |
102 |
MAKE_LOAD 14 |
MAKE_LOAD 14, _EAX |
103 |
|
|
104 |
movq mm7, [mult_mask] |
movq mm7, [mult_mask] |
105 |
packssdw mm0, mm1 |
packssdw mm0, mm1 |
121 |
paddusb mm0, mm1 |
paddusb mm0, mm1 |
122 |
|
|
123 |
movd eax, mm0 |
movd eax, mm0 |
124 |
shr eax, 8 |
shr _EAX, 8 |
125 |
and eax, 0x3F |
and _EAX, 0x3F |
126 |
ret |
ret |
127 |
ENDFUNC |
ENDFUNC |
128 |
|
|