Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | ; |
michael@0 | 2 | ; jdsamss2.asm - upsampling (SSE2) |
michael@0 | 3 | ; |
michael@0 | 4 | ; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
michael@0 | 5 | ; |
michael@0 | 6 | ; Based on |
michael@0 | 7 | ; x86 SIMD extension for IJG JPEG library |
michael@0 | 8 | ; Copyright (C) 1999-2006, MIYASAKA Masaru. |
michael@0 | 9 | ; For conditions of distribution and use, see copyright notice in jsimdext.inc |
michael@0 | 10 | ; |
michael@0 | 11 | ; This file should be assembled with NASM (Netwide Assembler), |
michael@0 | 12 | ; can *not* be assembled with Microsoft's MASM or any compatible |
michael@0 | 13 | ; assembler (including Borland's Turbo Assembler). |
michael@0 | 14 | ; NASM is available from http://nasm.sourceforge.net/ or |
michael@0 | 15 | ; http://sourceforge.net/project/showfiles.php?group_id=6208 |
michael@0 | 16 | ; |
michael@0 | 17 | ; [TAB8] |
michael@0 | 18 | |
michael@0 | 19 | %include "jsimdext.inc" |
michael@0 | 20 | |
michael@0 | 21 | ; -------------------------------------------------------------------------- |
michael@0 | 22 | SECTION SEG_CONST |
michael@0 | 23 | |
michael@0 | 24 | alignz 16 |
michael@0 | 25 | global EXTN(jconst_fancy_upsample_sse2) |
michael@0 | 26 | |
michael@0 | 27 | EXTN(jconst_fancy_upsample_sse2): |
michael@0 | 28 | |
michael@0 | 29 | PW_ONE times 8 dw 1 |
michael@0 | 30 | PW_TWO times 8 dw 2 |
michael@0 | 31 | PW_THREE times 8 dw 3 |
michael@0 | 32 | PW_SEVEN times 8 dw 7 |
michael@0 | 33 | PW_EIGHT times 8 dw 8 |
michael@0 | 34 | |
michael@0 | 35 | alignz 16 |
michael@0 | 36 | |
michael@0 | 37 | ; -------------------------------------------------------------------------- |
michael@0 | 38 | SECTION SEG_TEXT |
michael@0 | 39 | BITS 32 |
michael@0 | 40 | ; |
michael@0 | 41 | ; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical. |
michael@0 | 42 | ; |
michael@0 | 43 | ; The upsampling algorithm is linear interpolation between pixel centers, |
michael@0 | 44 | ; also known as a "triangle filter". This is a good compromise between |
michael@0 | 45 | ; speed and visual quality. The centers of the output pixels are 1/4 and 3/4 |
michael@0 | 46 | ; of the way between input pixel centers. |
michael@0 | 47 | ; |
michael@0 | 48 | ; GLOBAL(void) |
michael@0 | 49 | ; jsimd_h2v1_fancy_upsample_sse2 (int max_v_samp_factor, |
michael@0 | 50 | ; JDIMENSION downsampled_width, |
michael@0 | 51 | ; JSAMPARRAY input_data, |
michael@0 | 52 | ; JSAMPARRAY * output_data_ptr); |
michael@0 | 53 | ; |
michael@0 | 54 | |
michael@0 | 55 | %define max_v_samp(b) (b)+8 ; int max_v_samp_factor |
michael@0 | 56 | %define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width |
michael@0 | 57 | %define input_data(b) (b)+16 ; JSAMPARRAY input_data |
michael@0 | 58 | %define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr |
michael@0 | 59 | |
michael@0 | 60 | align 16 |
michael@0 | 61 | global EXTN(jsimd_h2v1_fancy_upsample_sse2) |
michael@0 | 62 | |
michael@0 | 63 | EXTN(jsimd_h2v1_fancy_upsample_sse2): |
michael@0 | 64 | push ebp |
michael@0 | 65 | mov ebp,esp |
michael@0 | 66 | pushpic ebx |
michael@0 | 67 | ; push ecx ; need not be preserved |
michael@0 | 68 | ; push edx ; need not be preserved |
michael@0 | 69 | push esi |
michael@0 | 70 | push edi |
michael@0 | 71 | |
michael@0 | 72 | get_GOT ebx ; get GOT address |
michael@0 | 73 | |
michael@0 | 74 | mov eax, JDIMENSION [downsamp_width(ebp)] ; colctr |
michael@0 | 75 | test eax,eax |
michael@0 | 76 | jz near .return |
michael@0 | 77 | |
michael@0 | 78 | mov ecx, INT [max_v_samp(ebp)] ; rowctr |
michael@0 | 79 | test ecx,ecx |
michael@0 | 80 | jz near .return |
michael@0 | 81 | |
michael@0 | 82 | mov esi, JSAMPARRAY [input_data(ebp)] ; input_data |
michael@0 | 83 | mov edi, POINTER [output_data_ptr(ebp)] |
michael@0 | 84 | mov edi, JSAMPARRAY [edi] ; output_data |
michael@0 | 85 | alignx 16,7 |
michael@0 | 86 | .rowloop: |
michael@0 | 87 | push eax ; colctr |
michael@0 | 88 | push edi |
michael@0 | 89 | push esi |
michael@0 | 90 | |
michael@0 | 91 | mov esi, JSAMPROW [esi] ; inptr |
michael@0 | 92 | mov edi, JSAMPROW [edi] ; outptr |
michael@0 | 93 | |
michael@0 | 94 | test eax, SIZEOF_XMMWORD-1 |
michael@0 | 95 | jz short .skip |
michael@0 | 96 | mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] |
michael@0 | 97 | mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample |
michael@0 | 98 | .skip: |
michael@0 | 99 | pxor xmm0,xmm0 ; xmm0=(all 0's) |
michael@0 | 100 | pcmpeqb xmm7,xmm7 |
michael@0 | 101 | psrldq xmm7,(SIZEOF_XMMWORD-1) |
michael@0 | 102 | pand xmm7, XMMWORD [esi+0*SIZEOF_XMMWORD] |
michael@0 | 103 | |
michael@0 | 104 | add eax, byte SIZEOF_XMMWORD-1 |
michael@0 | 105 | and eax, byte -SIZEOF_XMMWORD |
michael@0 | 106 | cmp eax, byte SIZEOF_XMMWORD |
michael@0 | 107 | ja short .columnloop |
michael@0 | 108 | alignx 16,7 |
michael@0 | 109 | |
michael@0 | 110 | .columnloop_last: |
michael@0 | 111 | pcmpeqb xmm6,xmm6 |
michael@0 | 112 | pslldq xmm6,(SIZEOF_XMMWORD-1) |
michael@0 | 113 | pand xmm6, XMMWORD [esi+0*SIZEOF_XMMWORD] |
michael@0 | 114 | jmp short .upsample |
michael@0 | 115 | alignx 16,7 |
michael@0 | 116 | |
michael@0 | 117 | .columnloop: |
michael@0 | 118 | movdqa xmm6, XMMWORD [esi+1*SIZEOF_XMMWORD] |
michael@0 | 119 | pslldq xmm6,(SIZEOF_XMMWORD-1) |
michael@0 | 120 | |
michael@0 | 121 | .upsample: |
michael@0 | 122 | movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD] |
michael@0 | 123 | movdqa xmm2,xmm1 |
michael@0 | 124 | movdqa xmm3,xmm1 ; xmm1=( 0 1 2 ... 13 14 15) |
michael@0 | 125 | pslldq xmm2,1 ; xmm2=(-- 0 1 ... 12 13 14) |
michael@0 | 126 | psrldq xmm3,1 ; xmm3=( 1 2 3 ... 14 15 --) |
michael@0 | 127 | |
michael@0 | 128 | por xmm2,xmm7 ; xmm2=(-1 0 1 ... 12 13 14) |
michael@0 | 129 | por xmm3,xmm6 ; xmm3=( 1 2 3 ... 14 15 16) |
michael@0 | 130 | |
michael@0 | 131 | movdqa xmm7,xmm1 |
michael@0 | 132 | psrldq xmm7,(SIZEOF_XMMWORD-1) ; xmm7=(15 -- -- ... -- -- --) |
michael@0 | 133 | |
michael@0 | 134 | movdqa xmm4,xmm1 |
michael@0 | 135 | punpcklbw xmm1,xmm0 ; xmm1=( 0 1 2 3 4 5 6 7) |
michael@0 | 136 | punpckhbw xmm4,xmm0 ; xmm4=( 8 9 10 11 12 13 14 15) |
michael@0 | 137 | movdqa xmm5,xmm2 |
michael@0 | 138 | punpcklbw xmm2,xmm0 ; xmm2=(-1 0 1 2 3 4 5 6) |
michael@0 | 139 | punpckhbw xmm5,xmm0 ; xmm5=( 7 8 9 10 11 12 13 14) |
michael@0 | 140 | movdqa xmm6,xmm3 |
michael@0 | 141 | punpcklbw xmm3,xmm0 ; xmm3=( 1 2 3 4 5 6 7 8) |
michael@0 | 142 | punpckhbw xmm6,xmm0 ; xmm6=( 9 10 11 12 13 14 15 16) |
michael@0 | 143 | |
michael@0 | 144 | pmullw xmm1,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 145 | pmullw xmm4,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 146 | paddw xmm2,[GOTOFF(ebx,PW_ONE)] |
michael@0 | 147 | paddw xmm5,[GOTOFF(ebx,PW_ONE)] |
michael@0 | 148 | paddw xmm3,[GOTOFF(ebx,PW_TWO)] |
michael@0 | 149 | paddw xmm6,[GOTOFF(ebx,PW_TWO)] |
michael@0 | 150 | |
michael@0 | 151 | paddw xmm2,xmm1 |
michael@0 | 152 | paddw xmm5,xmm4 |
michael@0 | 153 | psrlw xmm2,2 ; xmm2=OutLE=( 0 2 4 6 8 10 12 14) |
michael@0 | 154 | psrlw xmm5,2 ; xmm5=OutHE=(16 18 20 22 24 26 28 30) |
michael@0 | 155 | paddw xmm3,xmm1 |
michael@0 | 156 | paddw xmm6,xmm4 |
michael@0 | 157 | psrlw xmm3,2 ; xmm3=OutLO=( 1 3 5 7 9 11 13 15) |
michael@0 | 158 | psrlw xmm6,2 ; xmm6=OutHO=(17 19 21 23 25 27 29 31) |
michael@0 | 159 | |
michael@0 | 160 | psllw xmm3,BYTE_BIT |
michael@0 | 161 | psllw xmm6,BYTE_BIT |
michael@0 | 162 | por xmm2,xmm3 ; xmm2=OutL=( 0 1 2 ... 13 14 15) |
michael@0 | 163 | por xmm5,xmm6 ; xmm5=OutH=(16 17 18 ... 29 30 31) |
michael@0 | 164 | |
michael@0 | 165 | movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2 |
michael@0 | 166 | movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm5 |
michael@0 | 167 | |
michael@0 | 168 | sub eax, byte SIZEOF_XMMWORD |
michael@0 | 169 | add esi, byte 1*SIZEOF_XMMWORD ; inptr |
michael@0 | 170 | add edi, byte 2*SIZEOF_XMMWORD ; outptr |
michael@0 | 171 | cmp eax, byte SIZEOF_XMMWORD |
michael@0 | 172 | ja near .columnloop |
michael@0 | 173 | test eax,eax |
michael@0 | 174 | jnz near .columnloop_last |
michael@0 | 175 | |
michael@0 | 176 | pop esi |
michael@0 | 177 | pop edi |
michael@0 | 178 | pop eax |
michael@0 | 179 | |
michael@0 | 180 | add esi, byte SIZEOF_JSAMPROW ; input_data |
michael@0 | 181 | add edi, byte SIZEOF_JSAMPROW ; output_data |
michael@0 | 182 | dec ecx ; rowctr |
michael@0 | 183 | jg near .rowloop |
michael@0 | 184 | |
michael@0 | 185 | .return: |
michael@0 | 186 | pop edi |
michael@0 | 187 | pop esi |
michael@0 | 188 | ; pop edx ; need not be preserved |
michael@0 | 189 | ; pop ecx ; need not be preserved |
michael@0 | 190 | poppic ebx |
michael@0 | 191 | pop ebp |
michael@0 | 192 | ret |
michael@0 | 193 | |
michael@0 | 194 | ; -------------------------------------------------------------------------- |
michael@0 | 195 | ; |
michael@0 | 196 | ; Fancy processing for the common case of 2:1 horizontal and 2:1 vertical. |
michael@0 | 197 | ; Again a triangle filter; see comments for h2v1 case, above. |
michael@0 | 198 | ; |
michael@0 | 199 | ; GLOBAL(void) |
michael@0 | 200 | ; jsimd_h2v2_fancy_upsample_sse2 (int max_v_samp_factor, |
michael@0 | 201 | ; JDIMENSION downsampled_width, |
michael@0 | 202 | ; JSAMPARRAY input_data, |
michael@0 | 203 | ; JSAMPARRAY * output_data_ptr); |
michael@0 | 204 | ; |
michael@0 | 205 | |
michael@0 | 206 | %define max_v_samp(b) (b)+8 ; int max_v_samp_factor |
michael@0 | 207 | %define downsamp_width(b) (b)+12 ; JDIMENSION downsampled_width |
michael@0 | 208 | %define input_data(b) (b)+16 ; JSAMPARRAY input_data |
michael@0 | 209 | %define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr |
michael@0 | 210 | |
michael@0 | 211 | %define original_ebp ebp+0 |
michael@0 | 212 | %define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM] |
michael@0 | 213 | %define WK_NUM 4 |
michael@0 | 214 | %define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr |
michael@0 | 215 | |
michael@0 | 216 | align 16 |
michael@0 | 217 | global EXTN(jsimd_h2v2_fancy_upsample_sse2) |
michael@0 | 218 | |
michael@0 | 219 | EXTN(jsimd_h2v2_fancy_upsample_sse2): |
michael@0 | 220 | push ebp |
michael@0 | 221 | mov eax,esp ; eax = original ebp |
michael@0 | 222 | sub esp, byte 4 |
michael@0 | 223 | and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits |
michael@0 | 224 | mov [esp],eax |
michael@0 | 225 | mov ebp,esp ; ebp = aligned ebp |
michael@0 | 226 | lea esp, [wk(0)] |
michael@0 | 227 | pushpic eax ; make a room for GOT address |
michael@0 | 228 | push ebx |
michael@0 | 229 | ; push ecx ; need not be preserved |
michael@0 | 230 | ; push edx ; need not be preserved |
michael@0 | 231 | push esi |
michael@0 | 232 | push edi |
michael@0 | 233 | |
michael@0 | 234 | get_GOT ebx ; get GOT address |
michael@0 | 235 | movpic POINTER [gotptr], ebx ; save GOT address |
michael@0 | 236 | |
michael@0 | 237 | mov edx,eax ; edx = original ebp |
michael@0 | 238 | mov eax, JDIMENSION [downsamp_width(edx)] ; colctr |
michael@0 | 239 | test eax,eax |
michael@0 | 240 | jz near .return |
michael@0 | 241 | |
michael@0 | 242 | mov ecx, INT [max_v_samp(edx)] ; rowctr |
michael@0 | 243 | test ecx,ecx |
michael@0 | 244 | jz near .return |
michael@0 | 245 | |
michael@0 | 246 | mov esi, JSAMPARRAY [input_data(edx)] ; input_data |
michael@0 | 247 | mov edi, POINTER [output_data_ptr(edx)] |
michael@0 | 248 | mov edi, JSAMPARRAY [edi] ; output_data |
michael@0 | 249 | alignx 16,7 |
michael@0 | 250 | .rowloop: |
michael@0 | 251 | push eax ; colctr |
michael@0 | 252 | push ecx |
michael@0 | 253 | push edi |
michael@0 | 254 | push esi |
michael@0 | 255 | |
michael@0 | 256 | mov ecx, JSAMPROW [esi-1*SIZEOF_JSAMPROW] ; inptr1(above) |
michael@0 | 257 | mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0 |
michael@0 | 258 | mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1(below) |
michael@0 | 259 | mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 |
michael@0 | 260 | mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 |
michael@0 | 261 | |
michael@0 | 262 | test eax, SIZEOF_XMMWORD-1 |
michael@0 | 263 | jz short .skip |
michael@0 | 264 | push edx |
michael@0 | 265 | mov dl, JSAMPLE [ecx+(eax-1)*SIZEOF_JSAMPLE] |
michael@0 | 266 | mov JSAMPLE [ecx+eax*SIZEOF_JSAMPLE], dl |
michael@0 | 267 | mov dl, JSAMPLE [ebx+(eax-1)*SIZEOF_JSAMPLE] |
michael@0 | 268 | mov JSAMPLE [ebx+eax*SIZEOF_JSAMPLE], dl |
michael@0 | 269 | mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE] |
michael@0 | 270 | mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample |
michael@0 | 271 | pop edx |
michael@0 | 272 | .skip: |
michael@0 | 273 | ; -- process the first column block |
michael@0 | 274 | |
michael@0 | 275 | movdqa xmm0, XMMWORD [ebx+0*SIZEOF_XMMWORD] ; xmm0=row[ 0][0] |
michael@0 | 276 | movdqa xmm1, XMMWORD [ecx+0*SIZEOF_XMMWORD] ; xmm1=row[-1][0] |
michael@0 | 277 | movdqa xmm2, XMMWORD [esi+0*SIZEOF_XMMWORD] ; xmm2=row[+1][0] |
michael@0 | 278 | |
michael@0 | 279 | pushpic ebx |
michael@0 | 280 | movpic ebx, POINTER [gotptr] ; load GOT address |
michael@0 | 281 | |
michael@0 | 282 | pxor xmm3,xmm3 ; xmm3=(all 0's) |
michael@0 | 283 | movdqa xmm4,xmm0 |
michael@0 | 284 | punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) |
michael@0 | 285 | punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) |
michael@0 | 286 | movdqa xmm5,xmm1 |
michael@0 | 287 | punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) |
michael@0 | 288 | punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) |
michael@0 | 289 | movdqa xmm6,xmm2 |
michael@0 | 290 | punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) |
michael@0 | 291 | punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) |
michael@0 | 292 | |
michael@0 | 293 | pmullw xmm0,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 294 | pmullw xmm4,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 295 | |
michael@0 | 296 | pcmpeqb xmm7,xmm7 |
michael@0 | 297 | psrldq xmm7,(SIZEOF_XMMWORD-2) |
michael@0 | 298 | |
michael@0 | 299 | paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) |
michael@0 | 300 | paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) |
michael@0 | 301 | paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) |
michael@0 | 302 | paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) |
michael@0 | 303 | |
michael@0 | 304 | movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 ; temporarily save |
michael@0 | 305 | movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 ; the intermediate data |
michael@0 | 306 | movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2 |
michael@0 | 307 | movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm6 |
michael@0 | 308 | |
michael@0 | 309 | pand xmm1,xmm7 ; xmm1=( 0 -- -- -- -- -- -- --) |
michael@0 | 310 | pand xmm2,xmm7 ; xmm2=( 0 -- -- -- -- -- -- --) |
michael@0 | 311 | |
michael@0 | 312 | movdqa XMMWORD [wk(0)], xmm1 |
michael@0 | 313 | movdqa XMMWORD [wk(1)], xmm2 |
michael@0 | 314 | |
michael@0 | 315 | poppic ebx |
michael@0 | 316 | |
michael@0 | 317 | add eax, byte SIZEOF_XMMWORD-1 |
michael@0 | 318 | and eax, byte -SIZEOF_XMMWORD |
michael@0 | 319 | cmp eax, byte SIZEOF_XMMWORD |
michael@0 | 320 | ja short .columnloop |
michael@0 | 321 | alignx 16,7 |
michael@0 | 322 | |
michael@0 | 323 | .columnloop_last: |
michael@0 | 324 | ; -- process the last column block |
michael@0 | 325 | |
michael@0 | 326 | pushpic ebx |
michael@0 | 327 | movpic ebx, POINTER [gotptr] ; load GOT address |
michael@0 | 328 | |
michael@0 | 329 | pcmpeqb xmm1,xmm1 |
michael@0 | 330 | pslldq xmm1,(SIZEOF_XMMWORD-2) |
michael@0 | 331 | movdqa xmm2,xmm1 |
michael@0 | 332 | |
michael@0 | 333 | pand xmm1, XMMWORD [edx+1*SIZEOF_XMMWORD] |
michael@0 | 334 | pand xmm2, XMMWORD [edi+1*SIZEOF_XMMWORD] |
michael@0 | 335 | |
michael@0 | 336 | movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15) |
michael@0 | 337 | movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15) |
michael@0 | 338 | |
michael@0 | 339 | jmp near .upsample |
michael@0 | 340 | alignx 16,7 |
michael@0 | 341 | |
michael@0 | 342 | .columnloop: |
michael@0 | 343 | ; -- process the next column block |
michael@0 | 344 | |
michael@0 | 345 | movdqa xmm0, XMMWORD [ebx+1*SIZEOF_XMMWORD] ; xmm0=row[ 0][1] |
michael@0 | 346 | movdqa xmm1, XMMWORD [ecx+1*SIZEOF_XMMWORD] ; xmm1=row[-1][1] |
michael@0 | 347 | movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] ; xmm2=row[+1][1] |
michael@0 | 348 | |
michael@0 | 349 | pushpic ebx |
michael@0 | 350 | movpic ebx, POINTER [gotptr] ; load GOT address |
michael@0 | 351 | |
michael@0 | 352 | pxor xmm3,xmm3 ; xmm3=(all 0's) |
michael@0 | 353 | movdqa xmm4,xmm0 |
michael@0 | 354 | punpcklbw xmm0,xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7) |
michael@0 | 355 | punpckhbw xmm4,xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15) |
michael@0 | 356 | movdqa xmm5,xmm1 |
michael@0 | 357 | punpcklbw xmm1,xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7) |
michael@0 | 358 | punpckhbw xmm5,xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15) |
michael@0 | 359 | movdqa xmm6,xmm2 |
michael@0 | 360 | punpcklbw xmm2,xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7) |
michael@0 | 361 | punpckhbw xmm6,xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15) |
michael@0 | 362 | |
michael@0 | 363 | pmullw xmm0,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 364 | pmullw xmm4,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 365 | |
michael@0 | 366 | paddw xmm1,xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7) |
michael@0 | 367 | paddw xmm5,xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15) |
michael@0 | 368 | paddw xmm2,xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7) |
michael@0 | 369 | paddw xmm6,xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15) |
michael@0 | 370 | |
michael@0 | 371 | movdqa XMMWORD [edx+2*SIZEOF_XMMWORD], xmm1 ; temporarily save |
michael@0 | 372 | movdqa XMMWORD [edx+3*SIZEOF_XMMWORD], xmm5 ; the intermediate data |
michael@0 | 373 | movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 |
michael@0 | 374 | movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm6 |
michael@0 | 375 | |
michael@0 | 376 | pslldq xmm1,(SIZEOF_XMMWORD-2) ; xmm1=(-- -- -- -- -- -- -- 0) |
michael@0 | 377 | pslldq xmm2,(SIZEOF_XMMWORD-2) ; xmm2=(-- -- -- -- -- -- -- 0) |
michael@0 | 378 | |
michael@0 | 379 | movdqa XMMWORD [wk(2)], xmm1 |
michael@0 | 380 | movdqa XMMWORD [wk(3)], xmm2 |
michael@0 | 381 | |
michael@0 | 382 | .upsample: |
michael@0 | 383 | ; -- process the upper row |
michael@0 | 384 | |
michael@0 | 385 | movdqa xmm7, XMMWORD [edx+0*SIZEOF_XMMWORD] |
michael@0 | 386 | movdqa xmm3, XMMWORD [edx+1*SIZEOF_XMMWORD] |
michael@0 | 387 | |
michael@0 | 388 | movdqa xmm0,xmm7 ; xmm7=Int0L=( 0 1 2 3 4 5 6 7) |
michael@0 | 389 | movdqa xmm4,xmm3 ; xmm3=Int0H=( 8 9 10 11 12 13 14 15) |
michael@0 | 390 | psrldq xmm0,2 ; xmm0=( 1 2 3 4 5 6 7 --) |
michael@0 | 391 | pslldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(-- -- -- -- -- -- -- 8) |
michael@0 | 392 | movdqa xmm5,xmm7 |
michael@0 | 393 | movdqa xmm6,xmm3 |
michael@0 | 394 | psrldq xmm5,(SIZEOF_XMMWORD-2) ; xmm5=( 7 -- -- -- -- -- -- --) |
michael@0 | 395 | pslldq xmm6,2 ; xmm6=(-- 8 9 10 11 12 13 14) |
michael@0 | 396 | |
michael@0 | 397 | por xmm0,xmm4 ; xmm0=( 1 2 3 4 5 6 7 8) |
michael@0 | 398 | por xmm5,xmm6 ; xmm5=( 7 8 9 10 11 12 13 14) |
michael@0 | 399 | |
michael@0 | 400 | movdqa xmm1,xmm7 |
michael@0 | 401 | movdqa xmm2,xmm3 |
michael@0 | 402 | pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) |
michael@0 | 403 | psrldq xmm2,2 ; xmm2=( 9 10 11 12 13 14 15 --) |
michael@0 | 404 | movdqa xmm4,xmm3 |
michael@0 | 405 | psrldq xmm4,(SIZEOF_XMMWORD-2) ; xmm4=(15 -- -- -- -- -- -- --) |
michael@0 | 406 | |
michael@0 | 407 | por xmm1, XMMWORD [wk(0)] ; xmm1=(-1 0 1 2 3 4 5 6) |
michael@0 | 408 | por xmm2, XMMWORD [wk(2)] ; xmm2=( 9 10 11 12 13 14 15 16) |
michael@0 | 409 | |
michael@0 | 410 | movdqa XMMWORD [wk(0)], xmm4 |
michael@0 | 411 | |
michael@0 | 412 | pmullw xmm7,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 413 | pmullw xmm3,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 414 | paddw xmm1,[GOTOFF(ebx,PW_EIGHT)] |
michael@0 | 415 | paddw xmm5,[GOTOFF(ebx,PW_EIGHT)] |
michael@0 | 416 | paddw xmm0,[GOTOFF(ebx,PW_SEVEN)] |
michael@0 | 417 | paddw xmm2,[GOTOFF(ebx,PW_SEVEN)] |
michael@0 | 418 | |
michael@0 | 419 | paddw xmm1,xmm7 |
michael@0 | 420 | paddw xmm5,xmm3 |
michael@0 | 421 | psrlw xmm1,4 ; xmm1=Out0LE=( 0 2 4 6 8 10 12 14) |
michael@0 | 422 | psrlw xmm5,4 ; xmm5=Out0HE=(16 18 20 22 24 26 28 30) |
michael@0 | 423 | paddw xmm0,xmm7 |
michael@0 | 424 | paddw xmm2,xmm3 |
michael@0 | 425 | psrlw xmm0,4 ; xmm0=Out0LO=( 1 3 5 7 9 11 13 15) |
michael@0 | 426 | psrlw xmm2,4 ; xmm2=Out0HO=(17 19 21 23 25 27 29 31) |
michael@0 | 427 | |
michael@0 | 428 | psllw xmm0,BYTE_BIT |
michael@0 | 429 | psllw xmm2,BYTE_BIT |
michael@0 | 430 | por xmm1,xmm0 ; xmm1=Out0L=( 0 1 2 ... 13 14 15) |
michael@0 | 431 | por xmm5,xmm2 ; xmm5=Out0H=(16 17 18 ... 29 30 31) |
michael@0 | 432 | |
michael@0 | 433 | movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 |
michael@0 | 434 | movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 |
michael@0 | 435 | |
michael@0 | 436 | ; -- process the lower row |
michael@0 | 437 | |
michael@0 | 438 | movdqa xmm6, XMMWORD [edi+0*SIZEOF_XMMWORD] |
michael@0 | 439 | movdqa xmm4, XMMWORD [edi+1*SIZEOF_XMMWORD] |
michael@0 | 440 | |
michael@0 | 441 | movdqa xmm7,xmm6 ; xmm6=Int1L=( 0 1 2 3 4 5 6 7) |
michael@0 | 442 | movdqa xmm3,xmm4 ; xmm4=Int1H=( 8 9 10 11 12 13 14 15) |
michael@0 | 443 | psrldq xmm7,2 ; xmm7=( 1 2 3 4 5 6 7 --) |
michael@0 | 444 | pslldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(-- -- -- -- -- -- -- 8) |
michael@0 | 445 | movdqa xmm0,xmm6 |
michael@0 | 446 | movdqa xmm2,xmm4 |
michael@0 | 447 | psrldq xmm0,(SIZEOF_XMMWORD-2) ; xmm0=( 7 -- -- -- -- -- -- --) |
michael@0 | 448 | pslldq xmm2,2 ; xmm2=(-- 8 9 10 11 12 13 14) |
michael@0 | 449 | |
michael@0 | 450 | por xmm7,xmm3 ; xmm7=( 1 2 3 4 5 6 7 8) |
michael@0 | 451 | por xmm0,xmm2 ; xmm0=( 7 8 9 10 11 12 13 14) |
michael@0 | 452 | |
michael@0 | 453 | movdqa xmm1,xmm6 |
michael@0 | 454 | movdqa xmm5,xmm4 |
michael@0 | 455 | pslldq xmm1,2 ; xmm1=(-- 0 1 2 3 4 5 6) |
michael@0 | 456 | psrldq xmm5,2 ; xmm5=( 9 10 11 12 13 14 15 --) |
michael@0 | 457 | movdqa xmm3,xmm4 |
michael@0 | 458 | psrldq xmm3,(SIZEOF_XMMWORD-2) ; xmm3=(15 -- -- -- -- -- -- --) |
michael@0 | 459 | |
michael@0 | 460 | por xmm1, XMMWORD [wk(1)] ; xmm1=(-1 0 1 2 3 4 5 6) |
michael@0 | 461 | por xmm5, XMMWORD [wk(3)] ; xmm5=( 9 10 11 12 13 14 15 16) |
michael@0 | 462 | |
michael@0 | 463 | movdqa XMMWORD [wk(1)], xmm3 |
michael@0 | 464 | |
michael@0 | 465 | pmullw xmm6,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 466 | pmullw xmm4,[GOTOFF(ebx,PW_THREE)] |
michael@0 | 467 | paddw xmm1,[GOTOFF(ebx,PW_EIGHT)] |
michael@0 | 468 | paddw xmm0,[GOTOFF(ebx,PW_EIGHT)] |
michael@0 | 469 | paddw xmm7,[GOTOFF(ebx,PW_SEVEN)] |
michael@0 | 470 | paddw xmm5,[GOTOFF(ebx,PW_SEVEN)] |
michael@0 | 471 | |
michael@0 | 472 | paddw xmm1,xmm6 |
michael@0 | 473 | paddw xmm0,xmm4 |
michael@0 | 474 | psrlw xmm1,4 ; xmm1=Out1LE=( 0 2 4 6 8 10 12 14) |
michael@0 | 475 | psrlw xmm0,4 ; xmm0=Out1HE=(16 18 20 22 24 26 28 30) |
michael@0 | 476 | paddw xmm7,xmm6 |
michael@0 | 477 | paddw xmm5,xmm4 |
michael@0 | 478 | psrlw xmm7,4 ; xmm7=Out1LO=( 1 3 5 7 9 11 13 15) |
michael@0 | 479 | psrlw xmm5,4 ; xmm5=Out1HO=(17 19 21 23 25 27 29 31) |
michael@0 | 480 | |
michael@0 | 481 | psllw xmm7,BYTE_BIT |
michael@0 | 482 | psllw xmm5,BYTE_BIT |
michael@0 | 483 | por xmm1,xmm7 ; xmm1=Out1L=( 0 1 2 ... 13 14 15) |
michael@0 | 484 | por xmm0,xmm5 ; xmm0=Out1H=(16 17 18 ... 29 30 31) |
michael@0 | 485 | |
michael@0 | 486 | movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm1 |
michael@0 | 487 | movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm0 |
michael@0 | 488 | |
michael@0 | 489 | poppic ebx |
michael@0 | 490 | |
michael@0 | 491 | sub eax, byte SIZEOF_XMMWORD |
michael@0 | 492 | add ecx, byte 1*SIZEOF_XMMWORD ; inptr1(above) |
michael@0 | 493 | add ebx, byte 1*SIZEOF_XMMWORD ; inptr0 |
michael@0 | 494 | add esi, byte 1*SIZEOF_XMMWORD ; inptr1(below) |
michael@0 | 495 | add edx, byte 2*SIZEOF_XMMWORD ; outptr0 |
michael@0 | 496 | add edi, byte 2*SIZEOF_XMMWORD ; outptr1 |
michael@0 | 497 | cmp eax, byte SIZEOF_XMMWORD |
michael@0 | 498 | ja near .columnloop |
michael@0 | 499 | test eax,eax |
michael@0 | 500 | jnz near .columnloop_last |
michael@0 | 501 | |
michael@0 | 502 | pop esi |
michael@0 | 503 | pop edi |
michael@0 | 504 | pop ecx |
michael@0 | 505 | pop eax |
michael@0 | 506 | |
michael@0 | 507 | add esi, byte 1*SIZEOF_JSAMPROW ; input_data |
michael@0 | 508 | add edi, byte 2*SIZEOF_JSAMPROW ; output_data |
michael@0 | 509 | sub ecx, byte 2 ; rowctr |
michael@0 | 510 | jg near .rowloop |
michael@0 | 511 | |
michael@0 | 512 | .return: |
michael@0 | 513 | pop edi |
michael@0 | 514 | pop esi |
michael@0 | 515 | ; pop edx ; need not be preserved |
michael@0 | 516 | ; pop ecx ; need not be preserved |
michael@0 | 517 | pop ebx |
michael@0 | 518 | mov esp,ebp ; esp <- aligned ebp |
michael@0 | 519 | pop esp ; esp <- original ebp |
michael@0 | 520 | pop ebp |
michael@0 | 521 | ret |
michael@0 | 522 | |
michael@0 | 523 | ; -------------------------------------------------------------------------- |
michael@0 | 524 | ; |
michael@0 | 525 | ; Fast processing for the common case of 2:1 horizontal and 1:1 vertical. |
michael@0 | 526 | ; It's still a box filter. |
michael@0 | 527 | ; |
michael@0 | 528 | ; GLOBAL(void) |
michael@0 | 529 | ; jsimd_h2v1_upsample_sse2 (int max_v_samp_factor, |
michael@0 | 530 | ; JDIMENSION output_width, |
michael@0 | 531 | ; JSAMPARRAY input_data, |
michael@0 | 532 | ; JSAMPARRAY * output_data_ptr); |
michael@0 | 533 | ; |
michael@0 | 534 | |
michael@0 | 535 | %define max_v_samp(b) (b)+8 ; int max_v_samp_factor |
michael@0 | 536 | %define output_width(b) (b)+12 ; JDIMENSION output_width |
michael@0 | 537 | %define input_data(b) (b)+16 ; JSAMPARRAY input_data |
michael@0 | 538 | %define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr |
michael@0 | 539 | |
michael@0 | 540 | align 16 |
michael@0 | 541 | global EXTN(jsimd_h2v1_upsample_sse2) |
michael@0 | 542 | |
michael@0 | 543 | EXTN(jsimd_h2v1_upsample_sse2): |
michael@0 | 544 | push ebp |
michael@0 | 545 | mov ebp,esp |
michael@0 | 546 | ; push ebx ; unused |
michael@0 | 547 | ; push ecx ; need not be preserved |
michael@0 | 548 | ; push edx ; need not be preserved |
michael@0 | 549 | push esi |
michael@0 | 550 | push edi |
michael@0 | 551 | |
michael@0 | 552 | mov edx, JDIMENSION [output_width(ebp)] |
michael@0 | 553 | add edx, byte (2*SIZEOF_XMMWORD)-1 |
michael@0 | 554 | and edx, byte -(2*SIZEOF_XMMWORD) |
michael@0 | 555 | jz short .return |
michael@0 | 556 | |
michael@0 | 557 | mov ecx, INT [max_v_samp(ebp)] ; rowctr |
michael@0 | 558 | test ecx,ecx |
michael@0 | 559 | jz short .return |
michael@0 | 560 | |
michael@0 | 561 | mov esi, JSAMPARRAY [input_data(ebp)] ; input_data |
michael@0 | 562 | mov edi, POINTER [output_data_ptr(ebp)] |
michael@0 | 563 | mov edi, JSAMPARRAY [edi] ; output_data |
michael@0 | 564 | alignx 16,7 |
michael@0 | 565 | .rowloop: |
michael@0 | 566 | push edi |
michael@0 | 567 | push esi |
michael@0 | 568 | |
michael@0 | 569 | mov esi, JSAMPROW [esi] ; inptr |
michael@0 | 570 | mov edi, JSAMPROW [edi] ; outptr |
michael@0 | 571 | mov eax,edx ; colctr |
michael@0 | 572 | alignx 16,7 |
michael@0 | 573 | .columnloop: |
michael@0 | 574 | |
michael@0 | 575 | movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] |
michael@0 | 576 | |
michael@0 | 577 | movdqa xmm1,xmm0 |
michael@0 | 578 | punpcklbw xmm0,xmm0 |
michael@0 | 579 | punpckhbw xmm1,xmm1 |
michael@0 | 580 | |
michael@0 | 581 | movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 |
michael@0 | 582 | movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1 |
michael@0 | 583 | |
michael@0 | 584 | sub eax, byte 2*SIZEOF_XMMWORD |
michael@0 | 585 | jz short .nextrow |
michael@0 | 586 | |
michael@0 | 587 | movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] |
michael@0 | 588 | |
michael@0 | 589 | movdqa xmm3,xmm2 |
michael@0 | 590 | punpcklbw xmm2,xmm2 |
michael@0 | 591 | punpckhbw xmm3,xmm3 |
michael@0 | 592 | |
michael@0 | 593 | movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 |
michael@0 | 594 | movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3 |
michael@0 | 595 | |
michael@0 | 596 | sub eax, byte 2*SIZEOF_XMMWORD |
michael@0 | 597 | jz short .nextrow |
michael@0 | 598 | |
michael@0 | 599 | add esi, byte 2*SIZEOF_XMMWORD ; inptr |
michael@0 | 600 | add edi, byte 4*SIZEOF_XMMWORD ; outptr |
michael@0 | 601 | jmp short .columnloop |
michael@0 | 602 | alignx 16,7 |
michael@0 | 603 | |
michael@0 | 604 | .nextrow: |
michael@0 | 605 | pop esi |
michael@0 | 606 | pop edi |
michael@0 | 607 | |
michael@0 | 608 | add esi, byte SIZEOF_JSAMPROW ; input_data |
michael@0 | 609 | add edi, byte SIZEOF_JSAMPROW ; output_data |
michael@0 | 610 | dec ecx ; rowctr |
michael@0 | 611 | jg short .rowloop |
michael@0 | 612 | |
michael@0 | 613 | .return: |
michael@0 | 614 | pop edi |
michael@0 | 615 | pop esi |
michael@0 | 616 | ; pop edx ; need not be preserved |
michael@0 | 617 | ; pop ecx ; need not be preserved |
michael@0 | 618 | ; pop ebx ; unused |
michael@0 | 619 | pop ebp |
michael@0 | 620 | ret |
michael@0 | 621 | |
michael@0 | 622 | ; -------------------------------------------------------------------------- |
michael@0 | 623 | ; |
michael@0 | 624 | ; Fast processing for the common case of 2:1 horizontal and 2:1 vertical. |
michael@0 | 625 | ; It's still a box filter. |
michael@0 | 626 | ; |
michael@0 | 627 | ; GLOBAL(void) |
michael@0 | 628 | ; jsimd_h2v2_upsample_sse2 (nt max_v_samp_factor, |
michael@0 | 629 | ; JDIMENSION output_width, |
michael@0 | 630 | ; JSAMPARRAY input_data, |
michael@0 | 631 | ; JSAMPARRAY * output_data_ptr); |
michael@0 | 632 | ; |
michael@0 | 633 | |
michael@0 | 634 | %define max_v_samp(b) (b)+8 ; int max_v_samp_factor |
michael@0 | 635 | %define output_width(b) (b)+12 ; JDIMENSION output_width |
michael@0 | 636 | %define input_data(b) (b)+16 ; JSAMPARRAY input_data |
michael@0 | 637 | %define output_data_ptr(b) (b)+20 ; JSAMPARRAY * output_data_ptr |
michael@0 | 638 | |
michael@0 | 639 | align 16 |
michael@0 | 640 | global EXTN(jsimd_h2v2_upsample_sse2) |
michael@0 | 641 | |
michael@0 | 642 | EXTN(jsimd_h2v2_upsample_sse2): |
michael@0 | 643 | push ebp |
michael@0 | 644 | mov ebp,esp |
michael@0 | 645 | push ebx |
michael@0 | 646 | ; push ecx ; need not be preserved |
michael@0 | 647 | ; push edx ; need not be preserved |
michael@0 | 648 | push esi |
michael@0 | 649 | push edi |
michael@0 | 650 | |
michael@0 | 651 | mov edx, JDIMENSION [output_width(ebp)] |
michael@0 | 652 | add edx, byte (2*SIZEOF_XMMWORD)-1 |
michael@0 | 653 | and edx, byte -(2*SIZEOF_XMMWORD) |
michael@0 | 654 | jz near .return |
michael@0 | 655 | |
michael@0 | 656 | mov ecx, INT [max_v_samp(ebp)] ; rowctr |
michael@0 | 657 | test ecx,ecx |
michael@0 | 658 | jz near .return |
michael@0 | 659 | |
michael@0 | 660 | mov esi, JSAMPARRAY [input_data(ebp)] ; input_data |
michael@0 | 661 | mov edi, POINTER [output_data_ptr(ebp)] |
michael@0 | 662 | mov edi, JSAMPARRAY [edi] ; output_data |
michael@0 | 663 | alignx 16,7 |
michael@0 | 664 | .rowloop: |
michael@0 | 665 | push edi |
michael@0 | 666 | push esi |
michael@0 | 667 | |
michael@0 | 668 | mov esi, JSAMPROW [esi] ; inptr |
michael@0 | 669 | mov ebx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0 |
michael@0 | 670 | mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1 |
michael@0 | 671 | mov eax,edx ; colctr |
michael@0 | 672 | alignx 16,7 |
michael@0 | 673 | .columnloop: |
michael@0 | 674 | |
michael@0 | 675 | movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD] |
michael@0 | 676 | |
michael@0 | 677 | movdqa xmm1,xmm0 |
michael@0 | 678 | punpcklbw xmm0,xmm0 |
michael@0 | 679 | punpckhbw xmm1,xmm1 |
michael@0 | 680 | |
michael@0 | 681 | movdqa XMMWORD [ebx+0*SIZEOF_XMMWORD], xmm0 |
michael@0 | 682 | movdqa XMMWORD [ebx+1*SIZEOF_XMMWORD], xmm1 |
michael@0 | 683 | movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0 |
michael@0 | 684 | movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1 |
michael@0 | 685 | |
michael@0 | 686 | sub eax, byte 2*SIZEOF_XMMWORD |
michael@0 | 687 | jz short .nextrow |
michael@0 | 688 | |
michael@0 | 689 | movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] |
michael@0 | 690 | |
michael@0 | 691 | movdqa xmm3,xmm2 |
michael@0 | 692 | punpcklbw xmm2,xmm2 |
michael@0 | 693 | punpckhbw xmm3,xmm3 |
michael@0 | 694 | |
michael@0 | 695 | movdqa XMMWORD [ebx+2*SIZEOF_XMMWORD], xmm2 |
michael@0 | 696 | movdqa XMMWORD [ebx+3*SIZEOF_XMMWORD], xmm3 |
michael@0 | 697 | movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2 |
michael@0 | 698 | movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3 |
michael@0 | 699 | |
michael@0 | 700 | sub eax, byte 2*SIZEOF_XMMWORD |
michael@0 | 701 | jz short .nextrow |
michael@0 | 702 | |
michael@0 | 703 | add esi, byte 2*SIZEOF_XMMWORD ; inptr |
michael@0 | 704 | add ebx, byte 4*SIZEOF_XMMWORD ; outptr0 |
michael@0 | 705 | add edi, byte 4*SIZEOF_XMMWORD ; outptr1 |
michael@0 | 706 | jmp short .columnloop |
michael@0 | 707 | alignx 16,7 |
michael@0 | 708 | |
michael@0 | 709 | .nextrow: |
michael@0 | 710 | pop esi |
michael@0 | 711 | pop edi |
michael@0 | 712 | |
michael@0 | 713 | add esi, byte 1*SIZEOF_JSAMPROW ; input_data |
michael@0 | 714 | add edi, byte 2*SIZEOF_JSAMPROW ; output_data |
michael@0 | 715 | sub ecx, byte 2 ; rowctr |
michael@0 | 716 | jg short .rowloop |
michael@0 | 717 | |
michael@0 | 718 | .return: |
michael@0 | 719 | pop edi |
michael@0 | 720 | pop esi |
michael@0 | 721 | ; pop edx ; need not be preserved |
michael@0 | 722 | ; pop ecx ; need not be preserved |
michael@0 | 723 | pop ebx |
michael@0 | 724 | pop ebp |
michael@0 | 725 | ret |
michael@0 | 726 | |
michael@0 | 727 | ; For some reason, the OS X linker does not honor the request to align the |
michael@0 | 728 | ; segment unless we do this. |
michael@0 | 729 | align 16 |