OLD | NEW |
(Empty) | |
| 1 ; |
| 2 ; jdmrgmmx.asm - merged upsampling/color conversion (MMX) |
| 3 ; |
| 4 ; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
| 5 ; |
| 6 ; Based on |
| 7 ; x86 SIMD extension for IJG JPEG library |
| 8 ; Copyright (C) 1999-2006, MIYASAKA Masaru. |
| 9 ; For conditions of distribution and use, see copyright notice in jsimdext.inc |
| 10 ; |
| 11 ; This file should be assembled with NASM (Netwide Assembler), |
| 12 ; can *not* be assembled with Microsoft's MASM or any compatible |
| 13 ; assembler (including Borland's Turbo Assembler). |
| 14 ; NASM is available from http://nasm.sourceforge.net/ or |
| 15 ; http://sourceforge.net/project/showfiles.php?group_id=6208 |
| 16 ; |
| 17 ; [TAB8] |
| 18 |
| 19 %include "jcolsamp.inc" |
| 20 |
| 21 ; -------------------------------------------------------------------------- |
| 22 SECTION SEG_TEXT |
| 23 BITS 32 |
| 24 ; |
| 25 ; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical. |
| 26 ; |
| 27 ; GLOBAL(void) |
| 28 ; jsimd_h2v1_merged_upsample_mmx (JDIMENSION output_width, |
| 29 ; JSAMPIMAGE input_buf, |
| 30 ; JDIMENSION in_row_group_ctr, |
| 31 ; JSAMPARRAY output_buf); |
| 32 ; |
| 33 |
| 34 %define output_width(b) (b)+8 ; JDIMENSION output_width |
| 35 %define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf |
| 36 %define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr |
| 37 %define output_buf(b) (b)+20 ; JSAMPARRAY output_buf |
| 38 |
| 39 %define original_ebp ebp+0 |
| 40 %define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM] |
| 41 %define WK_NUM 3 |
| 42 %define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr |
| 43 |
| 44 align 16 |
| 45 global EXTN(jsimd_h2v1_merged_upsample_mmx) |
| 46 |
| 47 EXTN(jsimd_h2v1_merged_upsample_mmx): |
| 48 push ebp |
| 49 mov eax,esp ; eax = original ebp |
| 50 sub esp, byte 4 |
| 51 and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits |
| 52 mov [esp],eax |
| 53 mov ebp,esp ; ebp = aligned ebp |
| 54 lea esp, [wk(0)] |
| 55 pushpic eax ; make a room for GOT address |
| 56 push ebx |
| 57 ; push ecx ; need not be preserved |
| 58 ; push edx ; need not be preserved |
| 59 push esi |
| 60 push edi |
| 61 |
| 62 get_GOT ebx ; get GOT address |
| 63 movpic POINTER [gotptr], ebx ; save GOT address |
| 64 |
| 65 mov ecx, JDIMENSION [output_width(eax)] ; col |
| 66 test ecx,ecx |
| 67 jz near .return |
| 68 |
| 69 push ecx |
| 70 |
| 71 mov edi, JSAMPIMAGE [input_buf(eax)] |
| 72 mov ecx, JDIMENSION [in_row_group_ctr(eax)] |
| 73 mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] |
| 74 mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] |
| 75 mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] |
| 76 mov edi, JSAMPARRAY [output_buf(eax)] |
| 77 mov esi, JSAMPROW [esi+ecx*SIZEOF_JSAMPROW] ; inptr0 |
| 78 mov ebx, JSAMPROW [ebx+ecx*SIZEOF_JSAMPROW] ; inptr1 |
| 79 mov edx, JSAMPROW [edx+ecx*SIZEOF_JSAMPROW] ; inptr2 |
| 80 mov edi, JSAMPROW [edi] ; outptr |
| 81 |
| 82 pop ecx ; col |
| 83 |
| 84 alignx 16,7 |
| 85 .columnloop: |
| 86 movpic eax, POINTER [gotptr] ; load GOT address (eax) |
| 87 |
| 88 movq mm6, MMWORD [ebx] ; mm6=Cb(01234567) |
| 89 movq mm7, MMWORD [edx] ; mm7=Cr(01234567) |
| 90 |
| 91 pxor mm1,mm1 ; mm1=(all 0's) |
| 92 pcmpeqw mm3,mm3 |
| 93 psllw mm3,7 ; mm3={0xFF80 0xFF80 0xFF80 0xFF80} |
| 94 |
| 95 movq mm4,mm6 |
| 96 punpckhbw mm6,mm1 ; mm6=Cb(4567)=CbH |
| 97 punpcklbw mm4,mm1 ; mm4=Cb(0123)=CbL |
| 98 movq mm0,mm7 |
| 99 punpckhbw mm7,mm1 ; mm7=Cr(4567)=CrH |
| 100 punpcklbw mm0,mm1 ; mm0=Cr(0123)=CrL |
| 101 |
| 102 paddw mm6,mm3 |
| 103 paddw mm4,mm3 |
| 104 paddw mm7,mm3 |
| 105 paddw mm0,mm3 |
| 106 |
| 107 ; (Original) |
| 108 ; R = Y + 1.40200 * Cr |
| 109 ; G = Y - 0.34414 * Cb - 0.71414 * Cr |
| 110 ; B = Y + 1.77200 * Cb |
| 111 ; |
| 112 ; (This implementation) |
| 113 ; R = Y + 0.40200 * Cr + Cr |
| 114 ; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr |
| 115 ; B = Y - 0.22800 * Cb + Cb + Cb |
| 116 |
| 117 movq mm5,mm6 ; mm5=CbH |
| 118 movq mm2,mm4 ; mm2=CbL |
| 119 paddw mm6,mm6 ; mm6=2*CbH |
| 120 paddw mm4,mm4 ; mm4=2*CbL |
| 121 movq mm1,mm7 ; mm1=CrH |
| 122 movq mm3,mm0 ; mm3=CrL |
| 123 paddw mm7,mm7 ; mm7=2*CrH |
| 124 paddw mm0,mm0 ; mm0=2*CrL |
| 125 |
| 126 pmulhw mm6,[GOTOFF(eax,PW_MF0228)] ; mm6=(2*CbH * -FIX(0.22800)) |
| 127 pmulhw mm4,[GOTOFF(eax,PW_MF0228)] ; mm4=(2*CbL * -FIX(0.22800)) |
| 128 pmulhw mm7,[GOTOFF(eax,PW_F0402)] ; mm7=(2*CrH * FIX(0.40200)) |
| 129 pmulhw mm0,[GOTOFF(eax,PW_F0402)] ; mm0=(2*CrL * FIX(0.40200)) |
| 130 |
| 131 paddw mm6,[GOTOFF(eax,PW_ONE)] |
| 132 paddw mm4,[GOTOFF(eax,PW_ONE)] |
| 133 psraw mm6,1 ; mm6=(CbH * -FIX(0.22800)) |
| 134 psraw mm4,1 ; mm4=(CbL * -FIX(0.22800)) |
| 135 paddw mm7,[GOTOFF(eax,PW_ONE)] |
| 136 paddw mm0,[GOTOFF(eax,PW_ONE)] |
| 137 psraw mm7,1 ; mm7=(CrH * FIX(0.40200)) |
| 138 psraw mm0,1 ; mm0=(CrL * FIX(0.40200)) |
| 139 |
| 140 paddw mm6,mm5 |
| 141 paddw mm4,mm2 |
| 142 paddw mm6,mm5 ; mm6=(CbH * FIX(1.77200))=(B-Y)H |
| 143 paddw mm4,mm2 ; mm4=(CbL * FIX(1.77200))=(B-Y)L |
| 144 paddw mm7,mm1 ; mm7=(CrH * FIX(1.40200))=(R-Y)H |
| 145 paddw mm0,mm3 ; mm0=(CrL * FIX(1.40200))=(R-Y)L |
| 146 |
| 147 movq MMWORD [wk(0)], mm6 ; wk(0)=(B-Y)H |
| 148 movq MMWORD [wk(1)], mm7 ; wk(1)=(R-Y)H |
| 149 |
| 150 movq mm6,mm5 |
| 151 movq mm7,mm2 |
| 152 punpcklwd mm5,mm1 |
| 153 punpckhwd mm6,mm1 |
| 154 pmaddwd mm5,[GOTOFF(eax,PW_MF0344_F0285)] |
| 155 pmaddwd mm6,[GOTOFF(eax,PW_MF0344_F0285)] |
| 156 punpcklwd mm2,mm3 |
| 157 punpckhwd mm7,mm3 |
| 158 pmaddwd mm2,[GOTOFF(eax,PW_MF0344_F0285)] |
| 159 pmaddwd mm7,[GOTOFF(eax,PW_MF0344_F0285)] |
| 160 |
| 161 paddd mm5,[GOTOFF(eax,PD_ONEHALF)] |
| 162 paddd mm6,[GOTOFF(eax,PD_ONEHALF)] |
| 163 psrad mm5,SCALEBITS |
| 164 psrad mm6,SCALEBITS |
| 165 paddd mm2,[GOTOFF(eax,PD_ONEHALF)] |
| 166 paddd mm7,[GOTOFF(eax,PD_ONEHALF)] |
| 167 psrad mm2,SCALEBITS |
| 168 psrad mm7,SCALEBITS |
| 169 |
| 170 packssdw mm5,mm6 ; mm5=CbH*-FIX(0.344)+CrH*FIX(0.285) |
| 171 packssdw mm2,mm7 ; mm2=CbL*-FIX(0.344)+CrL*FIX(0.285) |
| 172 psubw mm5,mm1 ; mm5=CbH*-FIX(0.344)+CrH*-FIX(0.714)=(G-Y)H |
| 173 psubw mm2,mm3 ; mm2=CbL*-FIX(0.344)+CrL*-FIX(0.714)=(G-Y)L |
| 174 |
| 175 movq MMWORD [wk(2)], mm5 ; wk(2)=(G-Y)H |
| 176 |
| 177 mov al,2 ; Yctr |
| 178 jmp short .Yloop_1st |
| 179 alignx 16,7 |
| 180 |
| 181 .Yloop_2nd: |
| 182 movq mm0, MMWORD [wk(1)] ; mm0=(R-Y)H |
| 183 movq mm2, MMWORD [wk(2)] ; mm2=(G-Y)H |
| 184 movq mm4, MMWORD [wk(0)] ; mm4=(B-Y)H |
| 185 alignx 16,7 |
| 186 |
| 187 .Yloop_1st: |
| 188 movq mm7, MMWORD [esi] ; mm7=Y(01234567) |
| 189 |
| 190 pcmpeqw mm6,mm6 |
| 191 psrlw mm6,BYTE_BIT ; mm6={0xFF 0x00 0xFF 0x00 ..} |
| 192 pand mm6,mm7 ; mm6=Y(0246)=YE |
| 193 psrlw mm7,BYTE_BIT ; mm7=Y(1357)=YO |
| 194 |
| 195 movq mm1,mm0 ; mm1=mm0=(R-Y)(L/H) |
| 196 movq mm3,mm2 ; mm3=mm2=(G-Y)(L/H) |
| 197 movq mm5,mm4 ; mm5=mm4=(B-Y)(L/H) |
| 198 |
| 199 paddw mm0,mm6 ; mm0=((R-Y)+YE)=RE=(R0 R2 R4 R6) |
| 200 paddw mm1,mm7 ; mm1=((R-Y)+YO)=RO=(R1 R3 R5 R7) |
| 201 packuswb mm0,mm0 ; mm0=(R0 R2 R4 R6 ** ** ** **) |
| 202 packuswb mm1,mm1 ; mm1=(R1 R3 R5 R7 ** ** ** **) |
| 203 |
| 204 paddw mm2,mm6 ; mm2=((G-Y)+YE)=GE=(G0 G2 G4 G6) |
| 205 paddw mm3,mm7 ; mm3=((G-Y)+YO)=GO=(G1 G3 G5 G7) |
| 206 packuswb mm2,mm2 ; mm2=(G0 G2 G4 G6 ** ** ** **) |
| 207 packuswb mm3,mm3 ; mm3=(G1 G3 G5 G7 ** ** ** **) |
| 208 |
| 209 paddw mm4,mm6 ; mm4=((B-Y)+YE)=BE=(B0 B2 B4 B6) |
| 210 paddw mm5,mm7 ; mm5=((B-Y)+YO)=BO=(B1 B3 B5 B7) |
| 211 packuswb mm4,mm4 ; mm4=(B0 B2 B4 B6 ** ** ** **) |
| 212 packuswb mm5,mm5 ; mm5=(B1 B3 B5 B7 ** ** ** **) |
| 213 |
| 214 %if RGB_PIXELSIZE == 3 ; --------------- |
| 215 |
| 216 ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) |
| 217 ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) |
| 218 ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) |
| 219 ; mmG=(** ** ** ** ** ** ** **), mmH=(** ** ** ** ** ** ** **) |
| 220 |
| 221 punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) |
| 222 punpcklbw mmE,mmB ; mmE=(20 01 22 03 24 05 26 07) |
| 223 punpcklbw mmD,mmF ; mmD=(11 21 13 23 15 25 17 27) |
| 224 |
| 225 movq mmG,mmA |
| 226 movq mmH,mmA |
| 227 punpcklwd mmA,mmE ; mmA=(00 10 20 01 02 12 22 03) |
| 228 punpckhwd mmG,mmE ; mmG=(04 14 24 05 06 16 26 07) |
| 229 |
| 230 psrlq mmH,2*BYTE_BIT ; mmH=(02 12 04 14 06 16 -- --) |
| 231 psrlq mmE,2*BYTE_BIT ; mmE=(22 03 24 05 26 07 -- --) |
| 232 |
| 233 movq mmC,mmD |
| 234 movq mmB,mmD |
| 235 punpcklwd mmD,mmH ; mmD=(11 21 02 12 13 23 04 14) |
| 236 punpckhwd mmC,mmH ; mmC=(15 25 06 16 17 27 -- --) |
| 237 |
| 238 psrlq mmB,2*BYTE_BIT ; mmB=(13 23 15 25 17 27 -- --) |
| 239 |
| 240 movq mmF,mmE |
| 241 punpcklwd mmE,mmB ; mmE=(22 03 13 23 24 05 15 25) |
| 242 punpckhwd mmF,mmB ; mmF=(26 07 17 27 -- -- -- --) |
| 243 |
| 244 punpckldq mmA,mmD ; mmA=(00 10 20 01 11 21 02 12) |
| 245 punpckldq mmE,mmG ; mmE=(22 03 13 23 04 14 24 05) |
| 246 punpckldq mmC,mmF ; mmC=(15 25 06 16 26 07 17 27) |
| 247 |
| 248 cmp ecx, byte SIZEOF_MMWORD |
| 249 jb short .column_st16 |
| 250 |
| 251 movq MMWORD [edi+0*SIZEOF_MMWORD], mmA |
| 252 movq MMWORD [edi+1*SIZEOF_MMWORD], mmE |
| 253 movq MMWORD [edi+2*SIZEOF_MMWORD], mmC |
| 254 |
| 255 sub ecx, byte SIZEOF_MMWORD |
| 256 jz near .endcolumn |
| 257 |
| 258 add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr |
| 259 add esi, byte SIZEOF_MMWORD ; inptr0 |
| 260 dec al ; Yctr |
| 261 jnz near .Yloop_2nd |
| 262 |
| 263 add ebx, byte SIZEOF_MMWORD ; inptr1 |
| 264 add edx, byte SIZEOF_MMWORD ; inptr2 |
| 265 jmp near .columnloop |
| 266 alignx 16,7 |
| 267 |
| 268 .column_st16: |
| 269 lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE |
| 270 cmp ecx, byte 2*SIZEOF_MMWORD |
| 271 jb short .column_st8 |
| 272 movq MMWORD [edi+0*SIZEOF_MMWORD], mmA |
| 273 movq MMWORD [edi+1*SIZEOF_MMWORD], mmE |
| 274 movq mmA,mmC |
| 275 sub ecx, byte 2*SIZEOF_MMWORD |
| 276 add edi, byte 2*SIZEOF_MMWORD |
| 277 jmp short .column_st4 |
| 278 .column_st8: |
| 279 cmp ecx, byte SIZEOF_MMWORD |
| 280 jb short .column_st4 |
| 281 movq MMWORD [edi+0*SIZEOF_MMWORD], mmA |
| 282 movq mmA,mmE |
| 283 sub ecx, byte SIZEOF_MMWORD |
| 284 add edi, byte SIZEOF_MMWORD |
| 285 .column_st4: |
| 286 movd eax,mmA |
| 287 cmp ecx, byte SIZEOF_DWORD |
| 288 jb short .column_st2 |
| 289 mov DWORD [edi+0*SIZEOF_DWORD], eax |
| 290 psrlq mmA,DWORD_BIT |
| 291 movd eax,mmA |
| 292 sub ecx, byte SIZEOF_DWORD |
| 293 add edi, byte SIZEOF_DWORD |
| 294 .column_st2: |
| 295 cmp ecx, byte SIZEOF_WORD |
| 296 jb short .column_st1 |
| 297 mov WORD [edi+0*SIZEOF_WORD], ax |
| 298 shr eax,WORD_BIT |
| 299 sub ecx, byte SIZEOF_WORD |
| 300 add edi, byte SIZEOF_WORD |
| 301 .column_st1: |
| 302 cmp ecx, byte SIZEOF_BYTE |
| 303 jb short .endcolumn |
| 304 mov BYTE [edi+0*SIZEOF_BYTE], al |
| 305 |
| 306 %else ; RGB_PIXELSIZE == 4 ; ----------- |
| 307 |
| 308 %ifdef RGBX_FILLER_0XFF |
| 309 pcmpeqb mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) |
| 310 pcmpeqb mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) |
| 311 %else |
| 312 pxor mm6,mm6 ; mm6=(X0 X2 X4 X6 ** ** ** **) |
| 313 pxor mm7,mm7 ; mm7=(X1 X3 X5 X7 ** ** ** **) |
| 314 %endif |
| 315 ; mmA=(00 02 04 06 ** ** ** **), mmB=(01 03 05 07 ** ** ** **) |
| 316 ; mmC=(10 12 14 16 ** ** ** **), mmD=(11 13 15 17 ** ** ** **) |
| 317 ; mmE=(20 22 24 26 ** ** ** **), mmF=(21 23 25 27 ** ** ** **) |
| 318 ; mmG=(30 32 34 36 ** ** ** **), mmH=(31 33 35 37 ** ** ** **) |
| 319 |
| 320 punpcklbw mmA,mmC ; mmA=(00 10 02 12 04 14 06 16) |
| 321 punpcklbw mmE,mmG ; mmE=(20 30 22 32 24 34 26 36) |
| 322 punpcklbw mmB,mmD ; mmB=(01 11 03 13 05 15 07 17) |
| 323 punpcklbw mmF,mmH ; mmF=(21 31 23 33 25 35 27 37) |
| 324 |
| 325 movq mmC,mmA |
| 326 punpcklwd mmA,mmE ; mmA=(00 10 20 30 02 12 22 32) |
| 327 punpckhwd mmC,mmE ; mmC=(04 14 24 34 06 16 26 36) |
| 328 movq mmG,mmB |
| 329 punpcklwd mmB,mmF ; mmB=(01 11 21 31 03 13 23 33) |
| 330 punpckhwd mmG,mmF ; mmG=(05 15 25 35 07 17 27 37) |
| 331 |
| 332 movq mmD,mmA |
| 333 punpckldq mmA,mmB ; mmA=(00 10 20 30 01 11 21 31) |
| 334 punpckhdq mmD,mmB ; mmD=(02 12 22 32 03 13 23 33) |
| 335 movq mmH,mmC |
| 336 punpckldq mmC,mmG ; mmC=(04 14 24 34 05 15 25 35) |
| 337 punpckhdq mmH,mmG ; mmH=(06 16 26 36 07 17 27 37) |
| 338 |
| 339 cmp ecx, byte SIZEOF_MMWORD |
| 340 jb short .column_st16 |
| 341 |
| 342 movq MMWORD [edi+0*SIZEOF_MMWORD], mmA |
| 343 movq MMWORD [edi+1*SIZEOF_MMWORD], mmD |
| 344 movq MMWORD [edi+2*SIZEOF_MMWORD], mmC |
| 345 movq MMWORD [edi+3*SIZEOF_MMWORD], mmH |
| 346 |
| 347 sub ecx, byte SIZEOF_MMWORD |
| 348 jz short .endcolumn |
| 349 |
| 350 add edi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; outptr |
| 351 add esi, byte SIZEOF_MMWORD ; inptr0 |
| 352 dec al ; Yctr |
| 353 jnz near .Yloop_2nd |
| 354 |
| 355 add ebx, byte SIZEOF_MMWORD ; inptr1 |
| 356 add edx, byte SIZEOF_MMWORD ; inptr2 |
| 357 jmp near .columnloop |
| 358 alignx 16,7 |
| 359 |
| 360 .column_st16: |
| 361 cmp ecx, byte SIZEOF_MMWORD/2 |
| 362 jb short .column_st8 |
| 363 movq MMWORD [edi+0*SIZEOF_MMWORD], mmA |
| 364 movq MMWORD [edi+1*SIZEOF_MMWORD], mmD |
| 365 movq mmA,mmC |
| 366 movq mmD,mmH |
| 367 sub ecx, byte SIZEOF_MMWORD/2 |
| 368 add edi, byte 2*SIZEOF_MMWORD |
| 369 .column_st8: |
| 370 cmp ecx, byte SIZEOF_MMWORD/4 |
| 371 jb short .column_st4 |
| 372 movq MMWORD [edi+0*SIZEOF_MMWORD], mmA |
| 373 movq mmA,mmD |
| 374 sub ecx, byte SIZEOF_MMWORD/4 |
| 375 add edi, byte 1*SIZEOF_MMWORD |
| 376 .column_st4: |
| 377 cmp ecx, byte SIZEOF_MMWORD/8 |
| 378 jb short .endcolumn |
| 379 movd DWORD [edi+0*SIZEOF_DWORD], mmA |
| 380 |
| 381 %endif ; RGB_PIXELSIZE ; --------------- |
| 382 |
| 383 .endcolumn: |
| 384 emms ; empty MMX state |
| 385 |
| 386 .return: |
| 387 pop edi |
| 388 pop esi |
| 389 ; pop edx ; need not be preserved |
| 390 ; pop ecx ; need not be preserved |
| 391 pop ebx |
| 392 mov esp,ebp ; esp <- aligned ebp |
| 393 pop esp ; esp <- original ebp |
| 394 pop ebp |
| 395 ret |
| 396 |
| 397 ; -------------------------------------------------------------------------- |
| 398 ; |
| 399 ; Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical. |
| 400 ; |
| 401 ; GLOBAL(void) |
| 402 ; jsimd_h2v2_merged_upsample_mmx (JDIMENSION output_width, |
| 403 ; JSAMPIMAGE input_buf, |
| 404 ; JDIMENSION in_row_group_ctr, |
| 405 ; JSAMPARRAY output_buf); |
| 406 ; |
| 407 |
| 408 %define output_width(b) (b)+8 ; JDIMENSION output_width |
| 409 %define input_buf(b) (b)+12 ; JSAMPIMAGE input_buf |
| 410 %define in_row_group_ctr(b) (b)+16 ; JDIMENSION in_row_group_ctr |
| 411 %define output_buf(b) (b)+20 ; JSAMPARRAY output_buf |
| 412 |
| 413 align 16 |
| 414 global EXTN(jsimd_h2v2_merged_upsample_mmx) |
| 415 |
| 416 EXTN(jsimd_h2v2_merged_upsample_mmx): |
| 417 push ebp |
| 418 mov ebp,esp |
| 419 push ebx |
| 420 ; push ecx ; need not be preserved |
| 421 ; push edx ; need not be preserved |
| 422 push esi |
| 423 push edi |
| 424 |
| 425 mov eax, JDIMENSION [output_width(ebp)] |
| 426 |
| 427 mov edi, JSAMPIMAGE [input_buf(ebp)] |
| 428 mov ecx, JDIMENSION [in_row_group_ctr(ebp)] |
| 429 mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY] |
| 430 mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY] |
| 431 mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY] |
| 432 mov edi, JSAMPARRAY [output_buf(ebp)] |
| 433 lea esi, [esi+ecx*SIZEOF_JSAMPROW] |
| 434 |
| 435 push edx ; inptr2 |
| 436 push ebx ; inptr1 |
| 437 push esi ; inptr00 |
| 438 mov ebx,esp |
| 439 |
| 440 push edi ; output_buf (outptr0) |
| 441 push ecx ; in_row_group_ctr |
| 442 push ebx ; input_buf |
| 443 push eax ; output_width |
| 444 |
| 445 call near EXTN(jsimd_h2v1_merged_upsample_mmx) |
| 446 |
| 447 add esi, byte SIZEOF_JSAMPROW ; inptr01 |
| 448 add edi, byte SIZEOF_JSAMPROW ; outptr1 |
| 449 mov POINTER [ebx+0*SIZEOF_POINTER], esi |
| 450 mov POINTER [ebx-1*SIZEOF_POINTER], edi |
| 451 |
| 452 call near EXTN(jsimd_h2v1_merged_upsample_mmx) |
| 453 |
| 454 add esp, byte 7*SIZEOF_DWORD |
| 455 |
| 456 pop edi |
| 457 pop esi |
| 458 ; pop edx ; need not be preserved |
| 459 ; pop ecx ; need not be preserved |
| 460 pop ebx |
| 461 pop ebp |
| 462 ret |
| 463 |
| 464 ; For some reason, the OS X linker does not honor the request to align the |
| 465 ; segment unless we do this. |
| 466 align 16 |
OLD | NEW |