1829 lines · 49.9 KB · Assembly
RawDownload
;*!;* \copy;*     Copyright (c)  2009-2013, Cisco Systems;*     All rights reserved.;*;*     Redistribution and use in source and binary forms, with or without;*     modification, are permitted provided that the following conditions;*     are met:;*;*        * Redistributions of source code must retain the above copyright;*          notice, this list of conditions and the following disclaimer.;*;*        * Redistributions in binary form must reproduce the above copyright;*          notice, this list of conditions and the following disclaimer in;*          the documentation and/or other materials provided with the;*          distribution.;*;*     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS;*     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT;*     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS;*     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE;*     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,;*     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,;*     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;;*     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER;*     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT;*     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN;*     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE;*     POSSIBILITY OF SUCH DAMAGE.;*;*************************************************************************/%include "asm_inc.asm" ;***********************************************************************; Local Data (Read Only);***********************************************************************%ifdef X86_32_PICASMSECTION .text align=16%elseSECTION .rodata align=16%endif ALIGN 16mv_x_inc_x4     dw  0x10, 0x10, 0x10, 0x10mv_y_inc_x4     dw  0x04, 0x04, 0x04, 0x04mx_x_offset_x4  dw  0x00, 0x04, 0x08, 0x0C SECTION .text%ifdef X86_32;**********************************************************************************************************************;void SumOf8x8BlockOfFrame_sse2(uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight, const int32_t kiRefStride,;                             uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]);;*********************************************************************************************************************WELS_EXTERN SumOf8x8BlockOfFrame_sse2%define     pushsize        16%define     localsize       4%define     ref             esp + pushsize + localsize + 4%define     sum_ref         esp + pushsize + localsize + 20%define     times_of_sum    esp + pushsize + localsize + 24%define     width           esp + pushsize + localsize + 8%define     height          esp + pushsize + localsize + 12%define     linesize        esp + pushsize + localsize + 16%define     tmp_width       esp + 0    push    ebx    push    ebp    push    esi    push    edi    sub     esp,    localsize     pxor    xmm0,   xmm0    mov     esi,    [ref]    mov     edi,    [sum_ref]    mov     edx,    [times_of_sum]    mov     ebx,    [linesize]    mov     eax,    [width]    lea     ecx,    [ebx+ebx*2] ; 3*linesize     mov     [tmp_width],    eax    lea     ebp,    [esi+ebx*4]FIRST_ROW:    movq    xmm1,   [esi]    movq    xmm2,   [esi+ebx]    movq    xmm3,   [esi+ebx*2]    movq    xmm4,   [esi+ecx]     shufps  xmm1,   xmm2,   01000100b    shufps  xmm3,   xmm4,   01000100b    psadbw  xmm1,   xmm0    psadbw  xmm3,   xmm0    paddd   xmm1,   xmm3     movq    xmm2,   [ebp]    movq    xmm3,   [ebp+ebx]    movq    xmm4,   [ebp+ebx*2]    movq    xmm5,   [ebp+ecx]     shufps  xmm2,   xmm3,   01000100b    shufps  xmm4,   xmm5,   01000100b    psadbw  xmm2,   xmm0    psadbw  xmm4,   xmm0    paddd   xmm2,   xmm4     paddd   xmm1,   xmm2    pshufd  xmm2,   xmm1,   00001110b    paddd   xmm1,   xmm2    movd    eax,    xmm1    mov     [edi],  ax    inc     dword [edx+eax*4]     inc     esi    inc     ebp    add     edi,    2     dec     dword [tmp_width]    jg      FIRST_ROW     mov     esi,    [ref]    mov     edi,    [sum_ref]    mov     ebp,    [width]    dec     dword [height]HEIGHT_LOOP:    mov     [tmp_width],    ebpWIDTH_LOOP:    movq    xmm1,   [esi+ebx*8]    movq    xmm2,   [esi]    psadbw  xmm1,   xmm0    psadbw  xmm2,   xmm0    psubd   xmm1,   xmm2    movd    eax,    xmm1    mov     cx,     [edi]    add     eax,    ecx     mov     [edi+ebp*2],    ax    inc     dword [edx+eax*4]     inc     esi    add     edi,    2     dec     dword [tmp_width]    jg      WIDTH_LOOP     add     esi,    ebx    sub     esi,    ebp     dec     dword [height]    jg      HEIGHT_LOOP     add     esp,    localsize    pop     edi    pop     esi    pop     ebp    pop     ebx%undef      pushsize%undef      localsize%undef      ref%undef      sum_ref%undef      times_of_sum%undef      width%undef      height%undef      linesize%undef      tmp_width    ret  %macro COUNT_SUM 3%define xmm_reg %1%define tmp_reg %2    movd    tmp_reg,    xmm_reg    inc     dword [edx+tmp_reg*4]%if %3 == 1    psrldq  xmm_reg,    4%endif%endmacro  ;-----------------------------------------------------------------------------; requires:  width % 8 == 0 && height > 1;-----------------------------------------------------------------------------;void SumOf8x8BlockOfFrame_sse4(uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight, const int32_t kiRefStride,;                             uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]);;-----------------------------------------------------------------------------; read extra (16 - (width % 8) ) mod 16 bytes of every line; write extra (16 - (width % 8)*2 ) mod 16 bytes in the end of sum_refWELS_EXTERN SumOf8x8BlockOfFrame_sse4%define     pushsize        16%define     localsize       4%define     ref             esp + pushsize + localsize + 4%define     sum_ref         esp + pushsize + localsize + 20%define     times_of_sum    esp + pushsize + localsize + 24%define     width           esp + pushsize + localsize + 8%define     height          esp + pushsize + localsize + 12%define     linesize        esp + pushsize + localsize + 16%define     tmp_width       esp + 0    push    ebx    push    ebp    push    esi    push    edi    sub     esp,    localsize     pxor    xmm0,   xmm0    mov     esi,    [ref]    mov     edi,    [sum_ref]    mov     edx,    [times_of_sum]    mov     ebx,    [linesize]    mov     eax,    [width]    lea     ecx,    [ebx+ebx*2] ; 3*linesize     mov     [tmp_width],    eax    lea     ebp,    [esi+ebx*4]FIRST_ROW_SSE4:    movdqu  xmm1,   [esi]    movdqu  xmm3,   [esi+ebx]    movdqu  xmm5,   [esi+ebx*2]    movdqu  xmm7,   [esi+ecx]     movdqa  xmm2,   xmm1    mpsadbw xmm1,   xmm0,   000b    mpsadbw xmm2,   xmm0,   100b    paddw   xmm1,   xmm2            ; 8 sums of line1     movdqa  xmm4,   xmm3    mpsadbw xmm3,   xmm0,   000b    mpsadbw xmm4,   xmm0,   100b    paddw   xmm3,   xmm4            ; 8 sums of line2     movdqa  xmm2,   xmm5    mpsadbw xmm5,   xmm0,   000b    mpsadbw xmm2,   xmm0,   100b    paddw   xmm5,   xmm2            ; 8 sums of line3     movdqa  xmm4,   xmm7    mpsadbw xmm7,   xmm0,   000b    mpsadbw xmm4,   xmm0,   100b    paddw   xmm7,   xmm4            ; 8 sums of line4     paddw   xmm1,   xmm3    paddw   xmm5,   xmm7    paddw   xmm1,   xmm5            ; sum the upper 4 lines first     movdqu  xmm2,   [ebp]    movdqu  xmm3,   [ebp+ebx]    movdqu  xmm4,   [ebp+ebx*2]    movdqu  xmm5,   [ebp+ecx]     movdqa  xmm6,   xmm2    mpsadbw xmm2,   xmm0,   000b    mpsadbw xmm6,   xmm0,   100b    paddw   xmm2,   xmm6     movdqa  xmm7,   xmm3    mpsadbw xmm3,   xmm0,   000b    mpsadbw xmm7,   xmm0,   100b    paddw   xmm3,   xmm7     movdqa  xmm6,   xmm4    mpsadbw xmm4,   xmm0,   000b    mpsadbw xmm6,   xmm0,   100b    paddw   xmm4,   xmm6     movdqa  xmm7,   xmm5    mpsadbw xmm5,   xmm0,   000b    mpsadbw xmm7,   xmm0,   100b    paddw   xmm5,   xmm7     paddw   xmm2,   xmm3    paddw   xmm4,   xmm5    paddw   xmm1,   xmm2    paddw   xmm1,   xmm4            ; sum of lines 1- 8     movdqu  [edi],  xmm1     movdqa  xmm2,   xmm1    punpcklwd   xmm1,   xmm0    punpckhwd   xmm2,   xmm0     COUNT_SUM   xmm1,   eax,    1    COUNT_SUM   xmm1,   eax,    1    COUNT_SUM   xmm1,   eax,    1    COUNT_SUM   xmm1,   eax,    0    COUNT_SUM   xmm2,   eax,    1    COUNT_SUM   xmm2,   eax,    1    COUNT_SUM   xmm2,   eax,    1    COUNT_SUM   xmm2,   eax,    0     lea     esi,    [esi+8]    lea     ebp,    [ebp+8]    lea     edi,    [edi+16]        ; element size is 2     sub     dword [tmp_width], 8    jg      near FIRST_ROW_SSE4     mov     esi,    [ref]    mov     edi,    [sum_ref]    mov     ebp,    [width]    dec     dword [height]HEIGHT_LOOP_SSE4:    mov     ecx,    ebpWIDTH_LOOP_SSE4:    movdqu  xmm1,   [esi+ebx*8]    movdqu  xmm2,   [esi]    movdqu  xmm7,   [edi]     movdqa  xmm3,   xmm1    mpsadbw xmm1,   xmm0,   000b    mpsadbw xmm3,   xmm0,   100b    paddw   xmm1,   xmm3     movdqa  xmm4,   xmm2    mpsadbw xmm2,   xmm0,   000b    mpsadbw xmm4,   xmm0,   100b    paddw   xmm2,   xmm4     paddw   xmm7,   xmm1    psubw   xmm7,   xmm2    movdqu  [edi+ebp*2], xmm7     movdqa  xmm6,   xmm7    punpcklwd   xmm7,   xmm0    punpckhwd   xmm6,   xmm0     COUNT_SUM   xmm7,   eax,    1    COUNT_SUM   xmm7,   eax,    1    COUNT_SUM   xmm7,   eax,    1    COUNT_SUM   xmm7,   eax,    0    COUNT_SUM   xmm6,   eax,    1    COUNT_SUM   xmm6,   eax,    1    COUNT_SUM   xmm6,   eax,    1    COUNT_SUM   xmm6,   eax,    0     lea     esi,    [esi+8]    lea     edi,    [edi+16]     sub     ecx,    8    jg      near WIDTH_LOOP_SSE4     lea     esi,    [esi+ebx]    sub     esi,    ebp     dec     dword [height]    jg      near HEIGHT_LOOP_SSE4     add     esp,    localsize    pop     edi    pop     esi    pop     ebp    pop     ebx%undef      pushsize%undef      localsize%undef      ref%undef      sum_ref%undef      times_of_sum%undef      width%undef      height%undef      linesize%undef      tmp_width    ret  ;****************************************************************************************************************************************************;void SumOf16x16BlockOfFrame_sse2(uint8_t* pRefPicture, const int32_t kiWidth, const int32_t kiHeight, const int32_t kiRefStride,;                             uint16_t* pFeatureOfBlock, uint32_t pTimesOfFeatureValue[]);;****************************************************************************************************************************************************WELS_EXTERN SumOf16x16BlockOfFrame_sse2%define     pushsize        16%define     localsize       4%define     ref             esp + pushsize + localsize + 4%define     sum_ref         esp + pushsize + localsize + 20%define     times_of_sum    esp + pushsize + localsize + 24%define     width           esp + pushsize + localsize + 8%define     height          esp + pushsize + localsize + 12%define     linesize        esp + pushsize + localsize + 16%define     tmp_width       esp    push    ebx    push    ebp    push    esi    push    edi    sub     esp,    localsize     pxor    xmm0,   xmm0    mov     esi,    [ref]    mov     edi,    [sum_ref]    mov     edx,    [times_of_sum]    mov     ebx,    [linesize]    mov     eax,    [width]     lea     ecx,    [ebx+ebx*2]    mov     [tmp_width],    eaxFIRST_ROW_X16H:    movdqu  xmm1,   [esi]    movdqu  xmm2,   [esi+ebx]    movdqu  xmm3,   [esi+ebx*2]    movdqu  xmm4,   [esi+ecx]     psadbw  xmm1,   xmm0    psadbw  xmm2,   xmm0    psadbw  xmm3,   xmm0    psadbw  xmm4,   xmm0    paddw   xmm1,   xmm2    paddw   xmm3,   xmm4    paddw   xmm1,   xmm3     lea     ebp,    [esi+ebx*4]    movdqu  xmm2,   [ebp]    movdqu  xmm3,   [ebp+ebx]    movdqu  xmm4,   [ebp+ebx*2]    movdqu  xmm5,   [ebp+ecx]     psadbw  xmm2,   xmm0    psadbw  xmm3,   xmm0    psadbw  xmm4,   xmm0    psadbw  xmm5,   xmm0    paddw   xmm2,   xmm3    paddw   xmm4,   xmm5    paddw   xmm2,   xmm4     paddw   xmm1,   xmm2     lea     ebp,    [ebp+ebx*4]    movdqu  xmm2,   [ebp]    movdqu  xmm3,   [ebp+ebx]    movdqu  xmm4,   [ebp+ebx*2]    movdqu  xmm5,   [ebp+ecx]     psadbw  xmm2,   xmm0    psadbw  xmm3,   xmm0    psadbw  xmm4,   xmm0    psadbw  xmm5,   xmm0    paddw   xmm2,   xmm3    paddw   xmm4,   xmm5    paddw   xmm2,   xmm4     paddw   xmm1,   xmm2     lea     ebp,    [ebp+ebx*4]    movdqu  xmm2,   [ebp]    movdqu  xmm3,   [ebp+ebx]    movdqu  xmm4,   [ebp+ebx*2]    movdqu  xmm5,   [ebp+ecx]     psadbw  xmm2,   xmm0    psadbw  xmm3,   xmm0    psadbw  xmm4,   xmm0    psadbw  xmm5,   xmm0    paddw   xmm2,   xmm3    paddw   xmm4,   xmm5    paddw   xmm2,   xmm4     paddw   xmm1,   xmm2    movdqa  xmm2,   xmm1    punpckhwd xmm2, xmm0    paddw xmm1, xmm2    movd    eax,    xmm1    mov     [edi],  ax    inc     dword [edx+eax*4]     inc     esi    lea     edi,    [edi+2]     dec     dword [tmp_width]    jg      near FIRST_ROW_X16H     mov     esi,    [ref]    mov     edi,    [sum_ref]    mov     ebp,    [width]    dec     dword [height]     mov     ecx,    ebx    sal     ecx,    4       ; succeeded 16th lineHEIGHT_LOOP_X16:    mov     [tmp_width],    ebpWIDTH_LOOP_X16:    movdqu  xmm1,   [esi+ecx]    movdqu  xmm2,   [esi]    psadbw  xmm1,   xmm0    psadbw  xmm2,   xmm0    psubw   xmm1,   xmm2    movdqa  xmm2,   xmm1    punpckhwd xmm2, xmm0    paddw   xmm1,   xmm2    movd    eax,    xmm1    add     ax, word [edi]    mov     [edi+ebp*2],    ax    inc     dword [edx+eax*4]     inc     esi    add     edi,    2     dec     dword [tmp_width]    jg      near WIDTH_LOOP_X16     add     esi,    ebx    sub     esi,    ebp     dec     dword [height]    jg      near HEIGHT_LOOP_X16     add     esp,    localsize    pop     edi    pop     esi    pop     ebp

Lines 1–500 of 1829.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t