--- trunk/xvidcore/src/bitstream/x86_asm/cbp_mmx.asm 2002/03/22 04:37:03 53 +++ trunk/xvidcore/src/bitstream/x86_asm/cbp_mmx.asm 2003/02/15 15:22:19 851 @@ -32,8 +32,7 @@ ; * ; * History: ; * -; * 22.03.2002 0.01 ; Min Chen -; * ; use 386 cpu's 'BTS' to replace 'cbp |= 1 << (edx-1)' +; * 14.06.2002 some further tweaks by -Skal- ; * 24.11.2001 inital version; (c)2001 peter ross ; * ; *************************************************************************/ @@ -44,19 +43,21 @@ section .data %macro cglobal 1 -%ifdef PREFIX -global _%1 -%define %1 _%1 -%else -global %1 -%endif + %ifdef PREFIX + global _%1 + %define %1 _%1 + %else + global %1 + %endif %endmacro -ignore_dc dw 0, -1, -1, -1 +align 16 +ignore_dc dw 0, -1, -1, -1, -1, -1, -1, -1 section .text +cglobal calc_cbp_mmx ;=========================================================================== ; @@ -65,72 +66,59 @@ ;=========================================================================== align 16 -cglobal calc_cbp_mmx -calc_cbp_mmx - push ebx - push ecx - push edx - push esi +calc_cbp_mmx: + push ebx + push esi + + mov esi, [esp + 8 + 4] ; coeff + xor eax, eax ; cbp = 0 + mov edx, (1 << 5) - mov esi, [esp + 16 + 4] ; coeff - movq mm7, [ignore_dc] + movq mm7, [ignore_dc] - xor eax, eax ; cbp = 0 - mov edx, 6 .loop - movq mm0, [esi] - pand mm0, mm7 - movq mm1, [esi+8] + movq mm0, [esi] + movq mm1, [esi+8] + pand mm0, mm7 - por mm0, [esi+16] - por mm1, [esi+24] + por mm0, [esi+16] + por mm1, [esi+24] - por mm0, [esi+32] - por mm1, [esi+40] + por mm0, [esi+32] + por mm1, [esi+40] - por mm0, [esi+48] - por mm1, [esi+56] + por mm0, [esi+48] + por mm1, [esi+56] - por mm0, [esi+64] - por mm1, [esi+72] + por mm0, [esi+64] + por mm1, [esi+72] - por mm0, [esi+80] - por mm1, [esi+88] + por mm0, [esi+80] + por mm1, [esi+88] - por mm0, [esi+96] - por mm1, [esi+104] + por mm0, [esi+96] + por mm1, [esi+104] - por mm0, [esi+112] - por mm1, [esi+120] + por mm0, [esi+112] + por mm1, [esi+120] - por mm0, mm1 - movq mm1, mm0 - psrlq mm1, 32 - por mm0, mm1 - movd ebx, mm0 + por mm0, mm1 + movq mm1, mm0 + psrlq mm1, 32 + lea esi, [esi + 128] - add esi, 128 + por mm0, mm1 + movd ebx, mm0 - or ebx, ebx - jz .iterate + test ebx, ebx + jz .next + or eax, edx ; cbp |= 1 << (5-i) - ; cbp |= 1 << (edx-1) - - ; Change by Chenm001 - ;mov ecx, edx - ;dec ecx - ;mov ebx, 1 - ;shl ebx, cl - ;or eax, ebx - lea ebx,[edx-1] - bts eax,ebx - -.iterate dec edx - jnz .loop - - pop esi - pop edx - pop ecx - pop ebx +.next + shr edx,1 + jnc .loop + + pop esi + pop ebx - ret + ret \ No newline at end of file