sad.asm as used in processing is an exact subset of the code in satd_sad.asm in the encoder.
Showing the changes to codec/processing (3 of 7 files). Show all
Unified · Split
| @@ -634,7 +634,7 @@ · 633 unmodified lines | |||
| 634 | </FileConfiguration> | 634 | </FileConfiguration> |
| 635 | </File> | 635 | </File> |
| 636 | <File | 636 | <File |
| 637 | RelativePath="..\..\src\asm\sad.asm" | 637 | RelativePath="..\..\..\common\satd_sad.asm" |
| 638 | > | 638 | > |
| 639 | <FileConfiguration | 639 | <FileConfiguration |
| 640 | Name="Debug|Win32" | 640 | Name="Debug|Win32" |
| @@ -1,220 +0,0 @@ | |||
| 1 | ;*! | ||
| 2 | ;* \copy | ||
| 3 | ;* Copyright (c) 2009-2013, Cisco Systems | ||
| 4 | ;* All rights reserved. | ||
| 5 | ;* | ||
| 6 | ;* Redistribution and use in source and binary forms, with or without | ||
| 7 | ;* modification, are permitted provided that the following conditions | ||
| 8 | ;* are met: | ||
| 9 | ;* | ||
| 10 | ;* * Redistributions of source code must retain the above copyright | ||
| 11 | ;* notice, this list of conditions and the following disclaimer. | ||
| 12 | ;* | ||
| 13 | ;* * Redistributions in binary form must reproduce the above copyright | ||
| 14 | ;* notice, this list of conditions and the following disclaimer in | ||
| 15 | ;* the documentation and/or other materials provided with the | ||
| 16 | ;* distribution. | ||
| 17 | ;* | ||
| 18 | ;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 19 | ;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 20 | ;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
| 21 | ;* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 22 | ;* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 23 | ;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
| 24 | ;* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
| 25 | ;* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | ;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 27 | ;* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
| 28 | ;* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 29 | ;* POSSIBILITY OF SUCH DAMAGE. | ||
| 30 | ;* | ||
| 31 | ;* | ||
| 32 | ;* sad.asm | ||
| 33 | ;* | ||
| 34 | ;* Abstract | ||
| 35 | ;* WelsSampleSad8x8_sse21 | ||
| 36 | ;* | ||
| 37 | ;* History | ||
| 38 | ;* 8/5/2009 Created | ||
| 39 | ;* | ||
| 40 | ;* | ||
| 41 | ;*************************************************************************/ | ||
| 42 | |||
| 43 | %include "asm_inc.asm" | ||
| 44 | |||
| 45 | ;*********************************************************************** | ||
| 46 | ; Macros and other preprocessor constants | ||
| 47 | ;*********************************************************************** | ||
| 48 | %macro CACHE_SPLIT_CHECK 3 ; address, width, cacheline | ||
| 49 | and %1, 0x1f|(%3>>1) | ||
| 50 | cmp %1, (32-%2)|(%3>>1) | ||
| 51 | %endmacro | ||
| 52 | |||
| 53 | %macro SSE2_GetSad8x4 0 | ||
| 54 | movq xmm0, [r0] | ||
| 55 | movq xmm1, [r0+r1] | ||
| 56 | lea r0, [r0+2*r1] | ||
| 57 | movhps xmm0, [r0] | ||
| 58 | movhps xmm1, [r0+r1] | ||
| 59 | |||
| 60 | movq xmm2, [r2] | ||
| 61 | movq xmm3, [r2+r3] | ||
| 62 | lea r2, [r2+2*r3] | ||
| 63 | movhps xmm2, [r2] | ||
| 64 | movhps xmm3, [r2+r3] | ||
| 65 | psadbw xmm0, xmm2 | ||
| 66 | psadbw xmm1, xmm3 | ||
| 67 | paddw xmm6, xmm0 | ||
| 68 | paddw xmm6, xmm1 | ||
| 69 | %endmacro | ||
| 70 | |||
| 71 | |||
| 72 | ;*********************************************************************** | ||
| 73 | ; Code | ||
| 74 | ;*********************************************************************** | ||
| 75 | SECTION .text | ||
| 76 | |||
| 77 | WELS_EXTERN WelsSampleSad8x8_sse21 | ||
| 78 | WelsSampleSad8x8_sse21: | ||
| 79 | ;mov ecx, [esp+12] | ||
| 80 | ;mov edx, ecx | ||
| 81 | ;CACHE_SPLIT_CHECK edx, 8, 64 | ||
| 82 | ;jle near .pixel_sad_8x8_nsplit | ||
| 83 | ;push ebx | ||
| 84 | ;push edi | ||
| 85 | ;mov eax, [esp+12] | ||
| 86 | ;mov ebx, [esp+16] | ||
| 87 | |||
| 88 | %assign push_num 0 | ||
| 89 | mov r2, arg3 | ||
| 90 | push r2 | ||
| 91 | CACHE_SPLIT_CHECK r2, 8, 64 | ||
| 92 | jle near .pixel_sad_8x8_nsplit | ||
| 93 | pop r2 | ||
| 94 | %ifdef X86_32 | ||
| 95 | push r3 | ||
| 96 | push r4 | ||
| 97 | push r5 | ||
| 98 | %endif | ||
| 99 | %assign push_num 3 | ||
| 100 | mov r0, arg1 | ||
| 101 | mov r1, arg2 | ||
| 102 | SIGN_EXTENTION r1, r1d | ||
| 103 | pxor xmm7, xmm7 | ||
| 104 | |||
| 105 | ;ecx r2, edx r4, edi r5 | ||
| 106 | |||
| 107 | mov r5, r2 | ||
| 108 | and r5, 0x07 | ||
| 109 | sub r2, r5 | ||
| 110 | mov r4, 8 | ||
| 111 | sub r4, r5 | ||
| 112 | |||
| 113 | shl r5, 3 | ||
| 114 | shl r4, 3 | ||
| 115 | movd xmm5, r5d | ||
| 116 | movd xmm6, r4d | ||
| 117 | mov r5, 8 | ||
| 118 | add r5, r2 | ||
| 119 | mov r3, arg4 | ||
| 120 | SIGN_EXTENTION r3, r3d | ||
| 121 | movq xmm0, [r0] | ||
| 122 | movhps xmm0, [r0+r1] | ||
| 123 | |||
| 124 | movq xmm1, [r2] | ||
| 125 | movq xmm2, [r5] | ||
| 126 | movhps xmm1, [r2+r3] | ||
| 127 | movhps xmm2, [r5+r3] | ||
| 128 | psrlq xmm1, xmm5 | ||
| 129 | psllq xmm2, xmm6 | ||
| 130 | por xmm1, xmm2 | ||
| 131 | |||
| 132 | psadbw xmm0, xmm1 | ||
| 133 | paddw xmm7, xmm0 | ||
| 134 | |||
| 135 | lea r0, [r0+2*r1] | ||
| 136 | lea r2, [r2+2*r3] | ||
| 137 | lea r5, [r5+2*r3] | ||
| 138 | |||
| 139 | movq xmm0, [r0] | ||
| 140 | movhps xmm0, [r0+r1] | ||
| 141 | |||
| 142 | movq xmm1, [r2] | ||
| 143 | movq xmm2, [r5] | ||
| 144 | movhps xmm1, [r2+r3] | ||
| 145 | movhps xmm2, [r5+r3] | ||
| 146 | psrlq xmm1, xmm5 | ||
| 147 | psllq xmm2, xmm6 | ||
| 148 | por xmm1, xmm2 | ||
| 149 | |||
| 150 | psadbw xmm0, xmm1 | ||
| 151 | paddw xmm7, xmm0 | ||
| 152 | |||
| 153 | lea r0, [r0+2*r1] | ||
| 154 | lea r2, [r2+2*r3] | ||
| 155 | lea r5, [r5+2*r3] | ||
| 156 | |||
| 157 | movq xmm0, [r0] | ||
| 158 | movhps xmm0, [r0+r1] | ||
| 159 | |||
| 160 | movq xmm1, [r2] | ||
| 161 | movq xmm2, [r5] | ||
| 162 | movhps xmm1, [r2+r3] | ||
| 163 | movhps xmm2, [r5+r3] | ||
| 164 | psrlq xmm1, xmm5 | ||
| 165 | psllq xmm2, xmm6 | ||
| 166 | por xmm1, xmm2 | ||
| 167 | |||
| 168 | psadbw xmm0, xmm1 | ||
| 169 | paddw xmm7, xmm0 | ||
| 170 | |||
| 171 | lea r0, [r0+2*r1] | ||
| 172 | lea r2, [r2+2*r3] | ||
| 173 | lea r5, [r5+2*r3] | ||
| 174 | |||
| 175 | movq xmm0, [r0] | ||
| 176 | movhps xmm0, [r0+r1] | ||
| 177 | |||
| 178 | movq xmm1, [r2] | ||
| 179 | movq xmm2, [r5] | ||
| 180 | movhps xmm1, [r2+r3] | ||
| 181 | movhps xmm2, [r5+r3] | ||
| 182 | psrlq xmm1, xmm5 | ||
| 183 | psllq xmm2, xmm6 | ||
| 184 | por xmm1, xmm2 | ||
| 185 | |||
| 186 | psadbw xmm0, xmm1 | ||
| 187 | paddw xmm7, xmm0 | ||
| 188 | |||
| 189 | movhlps xmm0, xmm7 | ||
| 190 | paddw xmm0, xmm7 | ||
| 191 | movd retrd, xmm0 | ||
| 192 | %ifdef X86_32 | ||
| 193 | pop r5 | ||
| 194 | pop r4 | ||
| 195 | pop r3 | ||
| 196 | %endif | ||
| 197 | jmp .return | ||
| 198 | |||
| 199 | .pixel_sad_8x8_nsplit: | ||
| 200 | ;push ebx | ||
| 201 | ;mov eax, [esp+8] | ||
| 202 | ;mov ebx, [esp+12] | ||
| 203 | ;mov edx, [esp+20] | ||
| 204 | |||
| 205 | pop r2 | ||
| 206 | %assign push_num 0 | ||
| 207 | LOAD_4_PARA | ||
| 208 | SIGN_EXTENTION r1, r1d | ||
| 209 | SIGN_EXTENTION r3, r3d | ||
| 210 | pxor xmm6, xmm6 | ||
| 211 | SSE2_GetSad8x4 | ||
| 212 | lea r0, [r0+2*r1] | ||
| 213 | lea r2, [r2+2*r3] | ||
| 214 | SSE2_GetSad8x4 | ||
| 215 | movhlps xmm0, xmm6 | ||
| 216 | paddw xmm0, xmm6 | ||
| 217 | movd retrd, xmm0 | ||
| 218 | LOAD_4_PARA_POP | ||
| 219 | .return: | ||
| 220 | ret | ||
| @@ -24,7 +24,6 @@ PROCESSING_ASM_SRCS=\ · 23 unmodified lines | |||
| 24 | $(PROCESSING_SRCDIR)/./src/asm/denoisefilter.asm\ | 24 | $(PROCESSING_SRCDIR)/./src/asm/denoisefilter.asm\ |
| 25 | $(PROCESSING_SRCDIR)/./src/asm/downsample_bilinear.asm\ | 25 | $(PROCESSING_SRCDIR)/./src/asm/downsample_bilinear.asm\ |
| 26 | $(PROCESSING_SRCDIR)/./src/asm/intra_pred.asm\ | 26 | $(PROCESSING_SRCDIR)/./src/asm/intra_pred.asm\ |
| 27 | $(PROCESSING_SRCDIR)/./src/asm/sad.asm\ | ||
| 28 | $(PROCESSING_SRCDIR)/./src/asm/vaa.asm\ | 27 | $(PROCESSING_SRCDIR)/./src/asm/vaa.asm\ |
| 29 | 28 | ||
| 30 | PROCESSING_OBJS += $(PROCESSING_ASM_SRCS:.asm=.o) | 29 | PROCESSING_OBJS += $(PROCESSING_ASM_SRCS:.asm=.o) |