1; 2; jidctint.asm - accurate integer IDCT (AVX2) 3; 4; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB 5; Copyright (C) 2009, 2016, 2018, D. R. Commander. 6; 7; Based on the 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; This file contains a slow-but-accurate integer implementation of the 18; inverse DCT (Discrete Cosine Transform). The following code is based 19; directly on the IJG's original jidctint.c; see the jidctint.c for 20; more details. 21 22%include "jsimdext.inc" 23%include "jdct.inc" 24 25; -------------------------------------------------------------------------- 26 27%define CONST_BITS 13 28%define PASS1_BITS 2 29 30%define DESCALE_P1 (CONST_BITS - PASS1_BITS) 31%define DESCALE_P2 (CONST_BITS + PASS1_BITS + 3) 32 33%if CONST_BITS == 13 34F_0_298 equ 2446 ; FIX(0.298631336) 35F_0_390 equ 3196 ; FIX(0.390180644) 36F_0_541 equ 4433 ; FIX(0.541196100) 37F_0_765 equ 6270 ; FIX(0.765366865) 38F_0_899 equ 7373 ; FIX(0.899976223) 39F_1_175 equ 9633 ; FIX(1.175875602) 40F_1_501 equ 12299 ; FIX(1.501321110) 41F_1_847 equ 15137 ; FIX(1.847759065) 42F_1_961 equ 16069 ; FIX(1.961570560) 43F_2_053 equ 16819 ; FIX(2.053119869) 44F_2_562 equ 20995 ; FIX(2.562915447) 45F_3_072 equ 25172 ; FIX(3.072711026) 46%else 47; NASM cannot do compile-time arithmetic on floating-point constants. 48%define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n)) 49F_0_298 equ DESCALE( 320652955, 30 - CONST_BITS) ; FIX(0.298631336) 50F_0_390 equ DESCALE( 418953276, 30 - CONST_BITS) ; FIX(0.390180644) 51F_0_541 equ DESCALE( 581104887, 30 - CONST_BITS) ; FIX(0.541196100) 52F_0_765 equ DESCALE( 821806413, 30 - CONST_BITS) ; FIX(0.765366865) 53F_0_899 equ DESCALE( 966342111, 30 - CONST_BITS) ; FIX(0.899976223) 54F_1_175 equ DESCALE(1262586813, 30 - CONST_BITS) ; FIX(1.175875602) 55F_1_501 equ DESCALE(1612031267, 30 - CONST_BITS) ; FIX(1.501321110) 56F_1_847 equ DESCALE(1984016188, 30 - CONST_BITS) ; FIX(1.847759065) 57F_1_961 equ DESCALE(2106220350, 30 - CONST_BITS) ; FIX(1.961570560) 58F_2_053 equ DESCALE(2204520673, 30 - CONST_BITS) ; FIX(2.053119869) 59F_2_562 equ DESCALE(2751909506, 30 - CONST_BITS) ; FIX(2.562915447) 60F_3_072 equ DESCALE(3299298341, 30 - CONST_BITS) ; FIX(3.072711026) 61%endif 62 63; -------------------------------------------------------------------------- 64; In-place 8x8x16-bit inverse matrix transpose using AVX2 instructions 65; %1-%4: Input/output registers 66; %5-%8: Temp registers 67 68%macro dotranspose 8 69 ; %5=(00 10 20 30 40 50 60 70 01 11 21 31 41 51 61 71) 70 ; %6=(03 13 23 33 43 53 63 73 02 12 22 32 42 52 62 72) 71 ; %7=(04 14 24 34 44 54 64 74 05 15 25 35 45 55 65 75) 72 ; %8=(07 17 27 37 47 57 67 77 06 16 26 36 46 56 66 76) 73 74 vpermq %5, %1, 0xD8 75 vpermq %6, %2, 0x72 76 vpermq %7, %3, 0xD8 77 vpermq %8, %4, 0x72 78 ; transpose coefficients(phase 1) 79 ; %5=(00 10 20 30 01 11 21 31 40 50 60 70 41 51 61 71) 80 ; %6=(02 12 22 32 03 13 23 33 42 52 62 72 43 53 63 73) 81 ; %7=(04 14 24 34 05 15 25 35 44 54 64 74 45 55 65 75) 82 ; %8=(06 16 26 36 07 17 27 37 46 56 66 76 47 57 67 77) 83 84 vpunpcklwd %1, %5, %6 85 vpunpckhwd %2, %5, %6 86 vpunpcklwd %3, %7, %8 87 vpunpckhwd %4, %7, %8 88 ; transpose coefficients(phase 2) 89 ; %1=(00 02 10 12 20 22 30 32 40 42 50 52 60 62 70 72) 90 ; %2=(01 03 11 13 21 23 31 33 41 43 51 53 61 63 71 73) 91 ; %3=(04 06 14 16 24 26 34 36 44 46 54 56 64 66 74 76) 92 ; %4=(05 07 15 17 25 27 35 37 45 47 55 57 65 67 75 77) 93 94 vpunpcklwd %5, %1, %2 95 vpunpcklwd %6, %3, %4 96 vpunpckhwd %7, %1, %2 97 vpunpckhwd %8, %3, %4 98 ; transpose coefficients(phase 3) 99 ; %5=(00 01 02 03 10 11 12 13 40 41 42 43 50 51 52 53) 100 ; %6=(04 05 06 07 14 15 16 17 44 45 46 47 54 55 56 57) 101 ; %7=(20 21 22 23 30 31 32 33 60 61 62 63 70 71 72 73) 102 ; %8=(24 25 26 27 34 35 36 37 64 65 66 67 74 75 76 77) 103 104 vpunpcklqdq %1, %5, %6 105 vpunpckhqdq %2, %5, %6 106 vpunpcklqdq %3, %7, %8 107 vpunpckhqdq %4, %7, %8 108 ; transpose coefficients(phase 4) 109 ; %1=(00 01 02 03 04 05 06 07 40 41 42 43 44 45 46 47) 110 ; %2=(10 11 12 13 14 15 16 17 50 51 52 53 54 55 56 57) 111 ; %3=(20 21 22 23 24 25 26 27 60 61 62 63 64 65 66 67) 112 ; %4=(30 31 32 33 34 35 36 37 70 71 72 73 74 75 76 77) 113%endmacro 114 115; -------------------------------------------------------------------------- 116; In-place 8x8x16-bit slow integer inverse DCT using AVX2 instructions 117; %1-%4: Input/output registers 118; %5-%12: Temp registers 119; %9: Pass (1 or 2) 120 121%macro dodct 13 122 ; -- Even part 123 124 ; (Original) 125 ; z1 = (z2 + z3) * 0.541196100; 126 ; tmp2 = z1 + z3 * -1.847759065; 127 ; tmp3 = z1 + z2 * 0.765366865; 128 ; 129 ; (This implementation) 130 ; tmp2 = z2 * 0.541196100 + z3 * (0.541196100 - 1.847759065); 131 ; tmp3 = z2 * (0.541196100 + 0.765366865) + z3 * 0.541196100; 132 133 vperm2i128 %6, %3, %3, 0x01 ; %6=in6_2 134 vpunpcklwd %5, %3, %6 ; %5=in26_62L 135 vpunpckhwd %6, %3, %6 ; %6=in26_62H 136 vpmaddwd %5, %5, [GOTOFF(ebx,PW_F130_F054_MF130_F054)] ; %5=tmp3_2L 137 vpmaddwd %6, %6, [GOTOFF(ebx,PW_F130_F054_MF130_F054)] ; %6=tmp3_2H 138 139 vperm2i128 %7, %1, %1, 0x01 ; %7=in4_0 140 vpsignw %1, %1, [GOTOFF(ebx,PW_1_NEG1)] 141 vpaddw %7, %7, %1 ; %7=(in0+in4)_(in0-in4) 142 143 vpxor %1, %1, %1 144 vpunpcklwd %8, %1, %7 ; %8=tmp0_1L 145 vpunpckhwd %1, %1, %7 ; %1=tmp0_1H 146 vpsrad %8, %8, (16-CONST_BITS) ; vpsrad %8,16 & vpslld %8,CONST_BITS 147 vpsrad %1, %1, (16-CONST_BITS) ; vpsrad %1,16 & vpslld %1,CONST_BITS 148 149 vpsubd %3, %8, %5 150 vmovdqu %11, %3 ; %11=tmp0_1L-tmp3_2L=tmp13_12L 151 vpaddd %3, %8, %5 152 vmovdqu %9, %3 ; %9=tmp0_1L+tmp3_2L=tmp10_11L 153 vpsubd %3, %1, %6 154 vmovdqu %12, %3 ; %12=tmp0_1H-tmp3_2H=tmp13_12H 155 vpaddd %3, %1, %6 156 vmovdqu %10, %3 ; %10=tmp0_1H+tmp3_2H=tmp10_11H 157 158 ; -- Odd part 159 160 vpaddw %1, %4, %2 ; %1=in7_5+in3_1=z3_4 161 162 ; (Original) 163 ; z5 = (z3 + z4) * 1.175875602; 164 ; z3 = z3 * -1.961570560; z4 = z4 * -0.390180644; 165 ; z3 += z5; z4 += z5; 166 ; 167 ; (This implementation) 168 ; z3 = z3 * (1.175875602 - 1.961570560) + z4 * 1.175875602; 169 ; z4 = z3 * 1.175875602 + z4 * (1.175875602 - 0.390180644); 170 171 vperm2i128 %8, %1, %1, 0x01 ; %8=z4_3 172 vpunpcklwd %7, %1, %8 ; %7=z34_43L 173 vpunpckhwd %8, %1, %8 ; %8=z34_43H 174 vpmaddwd %7, %7, [GOTOFF(ebx,PW_MF078_F117_F078_F117)] ; %7=z3_4L 175 vpmaddwd %8, %8, [GOTOFF(ebx,PW_MF078_F117_F078_F117)] ; %8=z3_4H 176 177 ; (Original) 178 ; z1 = tmp0 + tmp3; z2 = tmp1 + tmp2; 179 ; tmp0 = tmp0 * 0.298631336; tmp1 = tmp1 * 2.053119869; 180 ; tmp2 = tmp2 * 3.072711026; tmp3 = tmp3 * 1.501321110; 181 ; z1 = z1 * -0.899976223; z2 = z2 * -2.562915447; 182 ; tmp0 += z1 + z3; tmp1 += z2 + z4; 183 ; tmp2 += z2 + z3; tmp3 += z1 + z4; 184 ; 185 ; (This implementation) 186 ; tmp0 = tmp0 * (0.298631336 - 0.899976223) + tmp3 * -0.899976223; 187 ; tmp1 = tmp1 * (2.053119869 - 2.562915447) + tmp2 * -2.562915447; 188 ; tmp2 = tmp1 * -2.562915447 + tmp2 * (3.072711026 - 2.562915447); 189 ; tmp3 = tmp0 * -0.899976223 + tmp3 * (1.501321110 - 0.899976223); 190 ; tmp0 += z3; tmp1 += z4; 191 ; tmp2 += z3; tmp3 += z4; 192 193 vperm2i128 %2, %2, %2, 0x01 ; %2=in1_3 194 vpunpcklwd %3, %4, %2 ; %3=in71_53L 195 vpunpckhwd %4, %4, %2 ; %4=in71_53H 196 197 vpmaddwd %5, %3, [GOTOFF(ebx,PW_MF060_MF089_MF050_MF256)] ; %5=tmp0_1L 198 vpmaddwd %6, %4, [GOTOFF(ebx,PW_MF060_MF089_MF050_MF256)] ; %6=tmp0_1H 199 vpaddd %5, %5, %7 ; %5=tmp0_1L+z3_4L=tmp0_1L 200 vpaddd %6, %6, %8 ; %6=tmp0_1H+z3_4H=tmp0_1H 201 202 vpmaddwd %3, %3, [GOTOFF(ebx,PW_MF089_F060_MF256_F050)] ; %3=tmp3_2L 203 vpmaddwd %4, %4, [GOTOFF(ebx,PW_MF089_F060_MF256_F050)] ; %4=tmp3_2H 204 vperm2i128 %7, %7, %7, 0x01 ; %7=z4_3L 205 vperm2i128 %8, %8, %8, 0x01 ; %8=z4_3H 206 vpaddd %7, %3, %7 ; %7=tmp3_2L+z4_3L=tmp3_2L 207 vpaddd %8, %4, %8 ; %8=tmp3_2H+z4_3H=tmp3_2H 208 209 ; -- Final output stage 210 211 vmovdqu %3, %9 212 vmovdqu %4, %10 213 214 vpaddd %1, %3, %7 ; %1=tmp10_11L+tmp3_2L=data0_1L 215 vpaddd %2, %4, %8 ; %2=tmp10_11H+tmp3_2H=data0_1H 216 vpaddd %1, %1, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] 217 vpaddd %2, %2, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] 218 vpsrad %1, %1, DESCALE_P %+ %13 219 vpsrad %2, %2, DESCALE_P %+ %13 220 vpackssdw %1, %1, %2 ; %1=data0_1 221 222 vpsubd %3, %3, %7 ; %3=tmp10_11L-tmp3_2L=data7_6L 223 vpsubd %4, %4, %8 ; %4=tmp10_11H-tmp3_2H=data7_6H 224 vpaddd %3, %3, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] 225 vpaddd %4, %4, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] 226 vpsrad %3, %3, DESCALE_P %+ %13 227 vpsrad %4, %4, DESCALE_P %+ %13 228 vpackssdw %4, %3, %4 ; %4=data7_6 229 230 vmovdqu %7, %11 231 vmovdqu %8, %12 232 233 vpaddd %2, %7, %5 ; %7=tmp13_12L+tmp0_1L=data3_2L 234 vpaddd %3, %8, %6 ; %8=tmp13_12H+tmp0_1H=data3_2H 235 vpaddd %2, %2, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] 236 vpaddd %3, %3, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] 237 vpsrad %2, %2, DESCALE_P %+ %13 238 vpsrad %3, %3, DESCALE_P %+ %13 239 vpackssdw %2, %2, %3 ; %2=data3_2 240 241 vpsubd %3, %7, %5 ; %7=tmp13_12L-tmp0_1L=data4_5L 242 vpsubd %6, %8, %6 ; %8=tmp13_12H-tmp0_1H=data4_5H 243 vpaddd %3, %3, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] 244 vpaddd %6, %6, [GOTOFF(ebx,PD_DESCALE_P %+ %13)] 245 vpsrad %3, %3, DESCALE_P %+ %13 246 vpsrad %6, %6, DESCALE_P %+ %13 247 vpackssdw %3, %3, %6 ; %3=data4_5 248%endmacro 249 250; -------------------------------------------------------------------------- 251 SECTION SEG_CONST 252 253 alignz 32 254 GLOBAL_DATA(jconst_idct_islow_avx2) 255 256EXTN(jconst_idct_islow_avx2): 257 258PW_F130_F054_MF130_F054 times 4 dw (F_0_541 + F_0_765), F_0_541 259 times 4 dw (F_0_541 - F_1_847), F_0_541 260PW_MF078_F117_F078_F117 times 4 dw (F_1_175 - F_1_961), F_1_175 261 times 4 dw (F_1_175 - F_0_390), F_1_175 262PW_MF060_MF089_MF050_MF256 times 4 dw (F_0_298 - F_0_899), -F_0_899 263 times 4 dw (F_2_053 - F_2_562), -F_2_562 264PW_MF089_F060_MF256_F050 times 4 dw -F_0_899, (F_1_501 - F_0_899) 265 times 4 dw -F_2_562, (F_3_072 - F_2_562) 266PD_DESCALE_P1 times 8 dd 1 << (DESCALE_P1 - 1) 267PD_DESCALE_P2 times 8 dd 1 << (DESCALE_P2 - 1) 268PB_CENTERJSAMP times 32 db CENTERJSAMPLE 269PW_1_NEG1 times 8 dw 1 270 times 8 dw -1 271 272 alignz 32 273 274; -------------------------------------------------------------------------- 275 SECTION SEG_TEXT 276 BITS 32 277; 278; Perform dequantization and inverse DCT on one block of coefficients. 279; 280; GLOBAL(void) 281; jsimd_idct_islow_avx2(void *dct_table, JCOEFPTR coef_block, 282; JSAMPARRAY output_buf, JDIMENSION output_col) 283; 284 285%define dct_table(b) (b) + 8 ; jpeg_component_info *compptr 286%define coef_block(b) (b) + 12 ; JCOEFPTR coef_block 287%define output_buf(b) (b) + 16 ; JSAMPARRAY output_buf 288%define output_col(b) (b) + 20 ; JDIMENSION output_col 289 290%define original_ebp ebp + 0 291%define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD 292 ; ymmword wk[WK_NUM] 293%define WK_NUM 4 294 295 align 32 296 GLOBAL_FUNCTION(jsimd_idct_islow_avx2) 297 298EXTN(jsimd_idct_islow_avx2): 299 push ebp 300 mov eax, esp ; eax = original ebp 301 sub esp, byte 4 302 and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits 303 mov [esp], eax 304 mov ebp, esp ; ebp = aligned ebp 305 lea esp, [wk(0)] 306 pushpic ebx 307; push ecx ; unused 308; push edx ; need not be preserved 309 push esi 310 push edi 311 312 get_GOT ebx ; get GOT address 313 314 ; ---- Pass 1: process columns. 315 316; mov eax, [original_ebp] 317 mov edx, POINTER [dct_table(eax)] ; quantptr 318 mov esi, JCOEFPTR [coef_block(eax)] ; inptr 319 320%ifndef NO_ZERO_COLUMN_TEST_ISLOW_AVX2 321 mov eax, dword [DWBLOCK(1,0,esi,SIZEOF_JCOEF)] 322 or eax, dword [DWBLOCK(2,0,esi,SIZEOF_JCOEF)] 323 jnz near .columnDCT 324 325 movdqa xmm0, XMMWORD [XMMBLOCK(1,0,esi,SIZEOF_JCOEF)] 326 movdqa xmm1, XMMWORD [XMMBLOCK(2,0,esi,SIZEOF_JCOEF)] 327 vpor xmm0, xmm0, XMMWORD [XMMBLOCK(3,0,esi,SIZEOF_JCOEF)] 328 vpor xmm1, xmm1, XMMWORD [XMMBLOCK(4,0,esi,SIZEOF_JCOEF)] 329 vpor xmm0, xmm0, XMMWORD [XMMBLOCK(5,0,esi,SIZEOF_JCOEF)] 330 vpor xmm1, xmm1, XMMWORD [XMMBLOCK(6,0,esi,SIZEOF_JCOEF)] 331 vpor xmm0, xmm0, XMMWORD [XMMBLOCK(7,0,esi,SIZEOF_JCOEF)] 332 vpor xmm1, xmm1, xmm0 333 vpacksswb xmm1, xmm1, xmm1 334 vpacksswb xmm1, xmm1, xmm1 335 movd eax, xmm1 336 test eax, eax 337 jnz short .columnDCT 338 339 ; -- AC terms all zero 340 341 movdqa xmm5, XMMWORD [XMMBLOCK(0,0,esi,SIZEOF_JCOEF)] 342 vpmullw xmm5, xmm5, XMMWORD [XMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] 343 344 vpsllw xmm5, xmm5, PASS1_BITS 345 346 vpunpcklwd xmm4, xmm5, xmm5 ; xmm4=(00 00 01 01 02 02 03 03) 347 vpunpckhwd xmm5, xmm5, xmm5 ; xmm5=(04 04 05 05 06 06 07 07) 348 vinserti128 ymm4, ymm4, xmm5, 1 349 350 vpshufd ymm0, ymm4, 0x00 ; ymm0=col0_4=(00 00 00 00 00 00 00 00 04 04 04 04 04 04 04 04) 351 vpshufd ymm1, ymm4, 0x55 ; ymm1=col1_5=(01 01 01 01 01 01 01 01 05 05 05 05 05 05 05 05) 352 vpshufd ymm2, ymm4, 0xAA ; ymm2=col2_6=(02 02 02 02 02 02 02 02 06 06 06 06 06 06 06 06) 353 vpshufd ymm3, ymm4, 0xFF ; ymm3=col3_7=(03 03 03 03 03 03 03 03 07 07 07 07 07 07 07 07) 354 355 jmp near .column_end 356 alignx 16, 7 357%endif 358.columnDCT: 359 360 vmovdqu ymm4, YMMWORD [YMMBLOCK(0,0,esi,SIZEOF_JCOEF)] ; ymm4=in0_1 361 vmovdqu ymm5, YMMWORD [YMMBLOCK(2,0,esi,SIZEOF_JCOEF)] ; ymm5=in2_3 362 vmovdqu ymm6, YMMWORD [YMMBLOCK(4,0,esi,SIZEOF_JCOEF)] ; ymm6=in4_5 363 vmovdqu ymm7, YMMWORD [YMMBLOCK(6,0,esi,SIZEOF_JCOEF)] ; ymm7=in6_7 364 vpmullw ymm4, ymm4, YMMWORD [YMMBLOCK(0,0,edx,SIZEOF_ISLOW_MULT_TYPE)] 365 vpmullw ymm5, ymm5, YMMWORD [YMMBLOCK(2,0,edx,SIZEOF_ISLOW_MULT_TYPE)] 366 vpmullw ymm6, ymm6, YMMWORD [YMMBLOCK(4,0,edx,SIZEOF_ISLOW_MULT_TYPE)] 367 vpmullw ymm7, ymm7, YMMWORD [YMMBLOCK(6,0,edx,SIZEOF_ISLOW_MULT_TYPE)] 368 369 vperm2i128 ymm0, ymm4, ymm6, 0x20 ; ymm0=in0_4 370 vperm2i128 ymm1, ymm5, ymm4, 0x31 ; ymm1=in3_1 371 vperm2i128 ymm2, ymm5, ymm7, 0x20 ; ymm2=in2_6 372 vperm2i128 ymm3, ymm7, ymm6, 0x31 ; ymm3=in7_5 373 374 dodct ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7, XMMWORD [wk(0)], XMMWORD [wk(1)], XMMWORD [wk(2)], XMMWORD [wk(3)], 1 375 ; ymm0=data0_1, ymm1=data3_2, ymm2=data4_5, ymm3=data7_6 376 377 dotranspose ymm0, ymm1, ymm2, ymm3, ymm4, ymm5, ymm6, ymm7 378 ; ymm0=data0_4, ymm1=data1_5, ymm2=data2_6, ymm3=data3_7 379 380.column_end: 381 382 ; -- Prefetch the next coefficient block 383 384 prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 0*32] 385 prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 1*32] 386 prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 2*32] 387 prefetchnta [esi + DCTSIZE2*SIZEOF_JCOEF + 3*32] 388 389 ; ---- Pass 2: process rows. 390 391 mov eax, [original_ebp] 392 mov edi, JSAMPARRAY [output_buf(eax)] ; (JSAMPROW *) 393 mov eax, JDIMENSION [output_col(eax)] 394 395 vperm2i128 ymm4, ymm3, ymm1, 0x31 ; ymm3=in7_5 396 vperm2i128 ymm1, ymm3, ymm1, 0x20 ; ymm1=in3_1 397 398 dodct ymm0, ymm1, ymm2, ymm4, ymm3, ymm5, ymm6, ymm7, XMMWORD [wk(0)], XMMWORD [wk(1)], XMMWORD [wk(2)], XMMWORD [wk(3)], 2 399 ; ymm0=data0_1, ymm1=data3_2, ymm2=data4_5, ymm4=data7_6 400 401 dotranspose ymm0, ymm1, ymm2, ymm4, ymm3, ymm5, ymm6, ymm7 402 ; ymm0=data0_4, ymm1=data1_5, ymm2=data2_6, ymm4=data3_7 403 404 vpacksswb ymm0, ymm0, ymm1 ; ymm0=data01_45 405 vpacksswb ymm1, ymm2, ymm4 ; ymm1=data23_67 406 vpaddb ymm0, ymm0, [GOTOFF(ebx,PB_CENTERJSAMP)] 407 vpaddb ymm1, ymm1, [GOTOFF(ebx,PB_CENTERJSAMP)] 408 409 vextracti128 xmm6, ymm1, 1 ; xmm3=data67 410 vextracti128 xmm4, ymm0, 1 ; xmm2=data45 411 vextracti128 xmm2, ymm1, 0 ; xmm1=data23 412 vextracti128 xmm0, ymm0, 0 ; xmm0=data01 413 414 vpshufd xmm1, xmm0, 0x4E ; xmm1=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) 415 vpshufd xmm3, xmm2, 0x4E ; xmm3=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) 416 vpshufd xmm5, xmm4, 0x4E ; xmm5=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) 417 vpshufd xmm7, xmm6, 0x4E ; xmm7=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) 418 419 vzeroupper 420 421 mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; (JSAMPLE *) 422 mov esi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; (JSAMPLE *) 423 movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm0 424 movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm1 425 426 mov edx, JSAMPROW [edi+2*SIZEOF_JSAMPROW] ; (JSAMPLE *) 427 mov esi, JSAMPROW [edi+3*SIZEOF_JSAMPROW] ; (JSAMPLE *) 428 movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm2 429 movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm3 430 431 mov edx, JSAMPROW [edi+4*SIZEOF_JSAMPROW] ; (JSAMPLE *) 432 mov esi, JSAMPROW [edi+5*SIZEOF_JSAMPROW] ; (JSAMPLE *) 433 movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm4 434 movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm5 435 436 mov edx, JSAMPROW [edi+6*SIZEOF_JSAMPROW] ; (JSAMPLE *) 437 mov esi, JSAMPROW [edi+7*SIZEOF_JSAMPROW] ; (JSAMPLE *) 438 movq XMM_MMWORD [edx+eax*SIZEOF_JSAMPLE], xmm6 439 movq XMM_MMWORD [esi+eax*SIZEOF_JSAMPLE], xmm7 440 441 pop edi 442 pop esi 443; pop edx ; need not be preserved 444; pop ecx ; unused 445 poppic ebx 446 mov esp, ebp ; esp <- aligned ebp 447 pop esp ; esp <- original ebp 448 pop ebp 449 ret 450 451; For some reason, the OS X linker does not honor the request to align the 452; segment unless we do this. 453 align 32 454