#Include Once "../../../inc/gfx/blit/sse/generic_scale2x.bi" Extern "C" Namespace gfx Namespace Scalers Namespace sse Public _ Sub Scale2x Naked ( ByVal pSrc As Any Ptr, ByVal pDst As Any Ptr, ByVal wid As Integer, ByVal hei As Integer, ByVal sPitch As Integer, ByVal dPitch As Integer ) #Define SAVED_REGS 0+ 4 #Define pSrc_ esp+SAVED_REGS+ 0 #Define pDst_ esp+SAVED_REGS+ 4 #Define wid_ esp+SAVED_REGS+ 8 #Define hei_ esp+SAVED_REGS+12 #Define sPitch_ esp+SAVED_REGS+16 #Define dPitch_ esp+SAVED_REGS+20 Asm 'push edi 'push esi 'push ebx mov ebx, [hei_] mov ecx, [wid_] shr ebx, 1 shr ecx, 1 dec ebx sub ecx, 4 shl ecx, 2 mov eax, [sPitch_] mul ebx add eax, ecx add [pSrc_], eax mov eax, [dPitch_] shl ebx, 1 Shl ecx, 1 mul ebx add eax, ecx add [pDst_], eax mov esi, [pSrc_] mov edi, [pDst_] mov edx, edi add edx, [dPitch_] mov eax, [wid_] shl eax, 2 shl dword Ptr [dPitch_], 1 sub [dPitch_], eax shr eax, 1 sub [sPitch_], eax shr eax, 4 mov ebx, [hei_] shr ebx, 1 0: mov ecx, eax 1: movaps xmm1, [esi] '' xmm1 = p3_p2_p1_p0 movaps xmm2, xmm1 '' xmm2 = p3_p2_p1_p0 movaps xmm3, xmm1 '' xmm3 = p3_p2_p1_p0 unpcklps xmm2, xmm1 '' xmm2 = p1_p1_p0_p0 unpckhps xmm3, xmm1 '' xmm3 = p3_p3_p2_p2 movaps [edi], xmm2 movaps [edx], xmm2 movaps [edi+16], xmm3 movaps [edx+16], xmm3 Sub esi, 16 Sub edi, 32 Sub edx, 32 dec ecx jnz 1b Sub esi, [sPitch_] Sub edi, [dPitch_] sub edx, [dPitch_] dec ebx jnz 0b 'pop ebx 'pop esi 'pop edi ret End Asm #Undef pSrc_ #Undef pDst_ #Undef wid_ #Undef hei_ #Undef sPitch_ #Undef dPitch_ #Undef SAVED_REGS End Sub End Namespace End Namespace End Namespace End Extern