--- trunk/xvidcore/src/bitstream/x86_asm/cbp_mmx.asm 2008/11/14 15:43:28 1794 +++ trunk/xvidcore/src/bitstream/x86_asm/cbp_mmx.asm 2008/11/26 01:04:34 1795 @@ -21,49 +21,23 @@ ; * along with this program ; if not, write to the Free Software ; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; * -; * $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 $ ; * ; ***************************************************************************/ -BITS 32 - ;============================================================================= ; Macros ;============================================================================= -%macro cglobal 1 - %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 +%include "nasm.inc" ;============================================================================= ; Local data ;============================================================================= -%ifdef FORMAT_COFF -SECTION .rodata -%else -SECTION .rodata align=16 -%endif +DATA -ALIGN 16 +ALIGN SECTION_ALIGN mult_mask: db 0x10,0x20,0x04,0x08,0x01,0x02,0x00,0x00 @@ -74,7 +48,7 @@ ; Code ;============================================================================= -SECTION .text +SECTION .rotext align=SECTION_ALIGN cglobal calc_cbp_mmx @@ -82,28 +56,28 @@ ; uint32_t calc_cbp_mmx(const int16_t coeff[6][64]); ;----------------------------------------------------------------------------- -%macro MAKE_LOAD 1 - por mm0, [eax-128*1+%1*8] - por mm1, [eax+128*0+%1*8] - por mm2, [eax+128*1+%1*8] - por mm3, [eax+128*2+%1*8] - por mm4, [eax+128*3+%1*8] - por mm5, [eax+128*4+%1*8] +%macro MAKE_LOAD 2 + por mm0, [%2-128*1+%1*8] + por mm1, [%2+128*0+%1*8] + por mm2, [%2+128*1+%1*8] + por mm3, [%2+128*2+%1*8] + por mm4, [%2+128*3+%1*8] + por mm5, [%2+128*4+%1*8] %endmacro -ALIGN 16 +ALIGN SECTION_ALIGN calc_cbp_mmx: - mov eax, [esp + 4] ; coeff + mov _EAX, prm1 ; coeff movq mm7, [ignore_dc] pxor mm6, mm6 ; used only for comparing - movq mm0, [eax+128*0] - movq mm1, [eax+128*1] - movq mm2, [eax+128*2] - movq mm3, [eax+128*3] - movq mm4, [eax+128*4] - movq mm5, [eax+128*5] - add eax, 8+128 + movq mm0, [_EAX+128*0] + movq mm1, [_EAX+128*1] + movq mm2, [_EAX+128*2] + movq mm3, [_EAX+128*3] + movq mm4, [_EAX+128*4] + movq mm5, [_EAX+128*5] + add _EAX, 8+128 pand mm0, mm7 pand mm1, mm7 pand mm2, mm7 @@ -111,21 +85,21 @@ pand mm4, mm7 pand mm5, mm7 - MAKE_LOAD 0 - MAKE_LOAD 1 - MAKE_LOAD 2 - MAKE_LOAD 3 - MAKE_LOAD 4 - MAKE_LOAD 5 - MAKE_LOAD 6 - MAKE_LOAD 7 - MAKE_LOAD 8 - MAKE_LOAD 9 - MAKE_LOAD 10 - MAKE_LOAD 11 - MAKE_LOAD 12 - MAKE_LOAD 13 - MAKE_LOAD 14 + MAKE_LOAD 0, _EAX + MAKE_LOAD 1, _EAX + MAKE_LOAD 2, _EAX + MAKE_LOAD 3, _EAX + MAKE_LOAD 4, _EAX + MAKE_LOAD 5, _EAX + MAKE_LOAD 6, _EAX + MAKE_LOAD 7, _EAX + MAKE_LOAD 8, _EAX + MAKE_LOAD 9, _EAX + MAKE_LOAD 10, _EAX + MAKE_LOAD 11, _EAX + MAKE_LOAD 12, _EAX + MAKE_LOAD 13, _EAX + MAKE_LOAD 14, _EAX movq mm7, [mult_mask] packssdw mm0, mm1 @@ -147,8 +121,8 @@ paddusb mm0, mm1 movd eax, mm0 - shr eax, 8 - and eax, 0x3F + shr _EAX, 8 + and _EAX, 0x3F ret ENDFUNC