1*dfc6aa5cSAndroid Build Coastguard Worker; 2*dfc6aa5cSAndroid Build Coastguard Worker; jidctfst.asm - fast integer IDCT (64-bit SSE2) 3*dfc6aa5cSAndroid Build Coastguard Worker; 4*dfc6aa5cSAndroid Build Coastguard Worker; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB 5*dfc6aa5cSAndroid Build Coastguard Worker; Copyright (C) 2009, 2016, D. R. Commander. 6*dfc6aa5cSAndroid Build Coastguard Worker; Copyright (C) 2018, Matthias Räncker. 7*dfc6aa5cSAndroid Build Coastguard Worker; 8*dfc6aa5cSAndroid Build Coastguard Worker; Based on the x86 SIMD extension for IJG JPEG library 9*dfc6aa5cSAndroid Build Coastguard Worker; Copyright (C) 1999-2006, MIYASAKA Masaru. 10*dfc6aa5cSAndroid Build Coastguard Worker; For conditions of distribution and use, see copyright notice in jsimdext.inc 11*dfc6aa5cSAndroid Build Coastguard Worker; 12*dfc6aa5cSAndroid Build Coastguard Worker; This file should be assembled with NASM (Netwide Assembler), 13*dfc6aa5cSAndroid Build Coastguard Worker; can *not* be assembled with Microsoft's MASM or any compatible 14*dfc6aa5cSAndroid Build Coastguard Worker; assembler (including Borland's Turbo Assembler). 15*dfc6aa5cSAndroid Build Coastguard Worker; NASM is available from http://nasm.sourceforge.net/ or 16*dfc6aa5cSAndroid Build Coastguard Worker; http://sourceforge.net/project/showfiles.php?group_id=6208 17*dfc6aa5cSAndroid Build Coastguard Worker; 18*dfc6aa5cSAndroid Build Coastguard Worker; This file contains a fast, not so accurate integer implementation of 19*dfc6aa5cSAndroid Build Coastguard Worker; the inverse DCT (Discrete Cosine Transform). The following code is 20*dfc6aa5cSAndroid Build Coastguard Worker; based directly on the IJG's original jidctfst.c; see the jidctfst.c 21*dfc6aa5cSAndroid Build Coastguard Worker; for more details. 22*dfc6aa5cSAndroid Build Coastguard Worker 23*dfc6aa5cSAndroid Build Coastguard Worker%include "jsimdext.inc" 24*dfc6aa5cSAndroid Build Coastguard Worker%include "jdct.inc" 25*dfc6aa5cSAndroid Build Coastguard Worker 26*dfc6aa5cSAndroid Build Coastguard Worker; -------------------------------------------------------------------------- 27*dfc6aa5cSAndroid Build Coastguard Worker 28*dfc6aa5cSAndroid Build Coastguard Worker%define CONST_BITS 8 ; 14 is also OK. 29*dfc6aa5cSAndroid Build Coastguard Worker%define PASS1_BITS 2 30*dfc6aa5cSAndroid Build Coastguard Worker 31*dfc6aa5cSAndroid Build Coastguard Worker%if IFAST_SCALE_BITS != PASS1_BITS 32*dfc6aa5cSAndroid Build Coastguard Worker%error "'IFAST_SCALE_BITS' must be equal to 'PASS1_BITS'." 33*dfc6aa5cSAndroid Build Coastguard Worker%endif 34*dfc6aa5cSAndroid Build Coastguard Worker 35*dfc6aa5cSAndroid Build Coastguard Worker%if CONST_BITS == 8 36*dfc6aa5cSAndroid Build Coastguard WorkerF_1_082 equ 277 ; FIX(1.082392200) 37*dfc6aa5cSAndroid Build Coastguard WorkerF_1_414 equ 362 ; FIX(1.414213562) 38*dfc6aa5cSAndroid Build Coastguard WorkerF_1_847 equ 473 ; FIX(1.847759065) 39*dfc6aa5cSAndroid Build Coastguard WorkerF_2_613 equ 669 ; FIX(2.613125930) 40*dfc6aa5cSAndroid Build Coastguard WorkerF_1_613 equ (F_2_613 - 256) ; FIX(2.613125930) - FIX(1) 41*dfc6aa5cSAndroid Build Coastguard Worker%else 42*dfc6aa5cSAndroid Build Coastguard Worker; NASM cannot do compile-time arithmetic on floating-point constants. 43*dfc6aa5cSAndroid Build Coastguard Worker%define DESCALE(x, n) (((x) + (1 << ((n) - 1))) >> (n)) 44*dfc6aa5cSAndroid Build Coastguard WorkerF_1_082 equ DESCALE(1162209775, 30 - CONST_BITS) ; FIX(1.082392200) 45*dfc6aa5cSAndroid Build Coastguard WorkerF_1_414 equ DESCALE(1518500249, 30 - CONST_BITS) ; FIX(1.414213562) 46*dfc6aa5cSAndroid Build Coastguard WorkerF_1_847 equ DESCALE(1984016188, 30 - CONST_BITS) ; FIX(1.847759065) 47*dfc6aa5cSAndroid Build Coastguard WorkerF_2_613 equ DESCALE(2805822602, 30 - CONST_BITS) ; FIX(2.613125930) 48*dfc6aa5cSAndroid Build Coastguard WorkerF_1_613 equ (F_2_613 - (1 << CONST_BITS)) ; FIX(2.613125930) - FIX(1) 49*dfc6aa5cSAndroid Build Coastguard Worker%endif 50*dfc6aa5cSAndroid Build Coastguard Worker 51*dfc6aa5cSAndroid Build Coastguard Worker; -------------------------------------------------------------------------- 52*dfc6aa5cSAndroid Build Coastguard Worker SECTION SEG_CONST 53*dfc6aa5cSAndroid Build Coastguard Worker 54*dfc6aa5cSAndroid Build Coastguard Worker; PRE_MULTIPLY_SCALE_BITS <= 2 (to avoid overflow) 55*dfc6aa5cSAndroid Build Coastguard Worker; CONST_BITS + CONST_SHIFT + PRE_MULTIPLY_SCALE_BITS == 16 (for pmulhw) 56*dfc6aa5cSAndroid Build Coastguard Worker 57*dfc6aa5cSAndroid Build Coastguard Worker%define PRE_MULTIPLY_SCALE_BITS 2 58*dfc6aa5cSAndroid Build Coastguard Worker%define CONST_SHIFT (16 - PRE_MULTIPLY_SCALE_BITS - CONST_BITS) 59*dfc6aa5cSAndroid Build Coastguard Worker 60*dfc6aa5cSAndroid Build Coastguard Worker alignz 32 61*dfc6aa5cSAndroid Build Coastguard Worker GLOBAL_DATA(jconst_idct_ifast_sse2) 62*dfc6aa5cSAndroid Build Coastguard Worker 63*dfc6aa5cSAndroid Build Coastguard WorkerEXTN(jconst_idct_ifast_sse2): 64*dfc6aa5cSAndroid Build Coastguard Worker 65*dfc6aa5cSAndroid Build Coastguard WorkerPW_F1414 times 8 dw F_1_414 << CONST_SHIFT 66*dfc6aa5cSAndroid Build Coastguard WorkerPW_F1847 times 8 dw F_1_847 << CONST_SHIFT 67*dfc6aa5cSAndroid Build Coastguard WorkerPW_MF1613 times 8 dw -F_1_613 << CONST_SHIFT 68*dfc6aa5cSAndroid Build Coastguard WorkerPW_F1082 times 8 dw F_1_082 << CONST_SHIFT 69*dfc6aa5cSAndroid Build Coastguard WorkerPB_CENTERJSAMP times 16 db CENTERJSAMPLE 70*dfc6aa5cSAndroid Build Coastguard Worker 71*dfc6aa5cSAndroid Build Coastguard Worker alignz 32 72*dfc6aa5cSAndroid Build Coastguard Worker 73*dfc6aa5cSAndroid Build Coastguard Worker; -------------------------------------------------------------------------- 74*dfc6aa5cSAndroid Build Coastguard Worker SECTION SEG_TEXT 75*dfc6aa5cSAndroid Build Coastguard Worker BITS 64 76*dfc6aa5cSAndroid Build Coastguard Worker; 77*dfc6aa5cSAndroid Build Coastguard Worker; Perform dequantization and inverse DCT on one block of coefficients. 78*dfc6aa5cSAndroid Build Coastguard Worker; 79*dfc6aa5cSAndroid Build Coastguard Worker; GLOBAL(void) 80*dfc6aa5cSAndroid Build Coastguard Worker; jsimd_idct_ifast_sse2(void *dct_table, JCOEFPTR coef_block, 81*dfc6aa5cSAndroid Build Coastguard Worker; JSAMPARRAY output_buf, JDIMENSION output_col) 82*dfc6aa5cSAndroid Build Coastguard Worker; 83*dfc6aa5cSAndroid Build Coastguard Worker 84*dfc6aa5cSAndroid Build Coastguard Worker; r10 = jpeg_component_info *compptr 85*dfc6aa5cSAndroid Build Coastguard Worker; r11 = JCOEFPTR coef_block 86*dfc6aa5cSAndroid Build Coastguard Worker; r12 = JSAMPARRAY output_buf 87*dfc6aa5cSAndroid Build Coastguard Worker; r13d = JDIMENSION output_col 88*dfc6aa5cSAndroid Build Coastguard Worker 89*dfc6aa5cSAndroid Build Coastguard Worker%define original_rbp rbp + 0 90*dfc6aa5cSAndroid Build Coastguard Worker%define wk(i) rbp - (WK_NUM - (i)) * SIZEOF_XMMWORD 91*dfc6aa5cSAndroid Build Coastguard Worker ; xmmword wk[WK_NUM] 92*dfc6aa5cSAndroid Build Coastguard Worker%define WK_NUM 2 93*dfc6aa5cSAndroid Build Coastguard Worker 94*dfc6aa5cSAndroid Build Coastguard Worker align 32 95*dfc6aa5cSAndroid Build Coastguard Worker GLOBAL_FUNCTION(jsimd_idct_ifast_sse2) 96*dfc6aa5cSAndroid Build Coastguard Worker 97*dfc6aa5cSAndroid Build Coastguard WorkerEXTN(jsimd_idct_ifast_sse2): 98*dfc6aa5cSAndroid Build Coastguard Worker push rbp 99*dfc6aa5cSAndroid Build Coastguard Worker mov rax, rsp ; rax = original rbp 100*dfc6aa5cSAndroid Build Coastguard Worker sub rsp, byte 4 101*dfc6aa5cSAndroid Build Coastguard Worker and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits 102*dfc6aa5cSAndroid Build Coastguard Worker mov [rsp], rax 103*dfc6aa5cSAndroid Build Coastguard Worker mov rbp, rsp ; rbp = aligned rbp 104*dfc6aa5cSAndroid Build Coastguard Worker lea rsp, [wk(0)] 105*dfc6aa5cSAndroid Build Coastguard Worker collect_args 4 106*dfc6aa5cSAndroid Build Coastguard Worker 107*dfc6aa5cSAndroid Build Coastguard Worker ; ---- Pass 1: process columns from input. 108*dfc6aa5cSAndroid Build Coastguard Worker 109*dfc6aa5cSAndroid Build Coastguard Worker mov rdx, r10 ; quantptr 110*dfc6aa5cSAndroid Build Coastguard Worker mov rsi, r11 ; inptr 111*dfc6aa5cSAndroid Build Coastguard Worker 112*dfc6aa5cSAndroid Build Coastguard Worker%ifndef NO_ZERO_COLUMN_TEST_IFAST_SSE2 113*dfc6aa5cSAndroid Build Coastguard Worker mov eax, dword [DWBLOCK(1,0,rsi,SIZEOF_JCOEF)] 114*dfc6aa5cSAndroid Build Coastguard Worker or eax, dword [DWBLOCK(2,0,rsi,SIZEOF_JCOEF)] 115*dfc6aa5cSAndroid Build Coastguard Worker jnz near .columnDCT 116*dfc6aa5cSAndroid Build Coastguard Worker 117*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] 118*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] 119*dfc6aa5cSAndroid Build Coastguard Worker por xmm0, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] 120*dfc6aa5cSAndroid Build Coastguard Worker por xmm1, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] 121*dfc6aa5cSAndroid Build Coastguard Worker por xmm0, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] 122*dfc6aa5cSAndroid Build Coastguard Worker por xmm1, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] 123*dfc6aa5cSAndroid Build Coastguard Worker por xmm0, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] 124*dfc6aa5cSAndroid Build Coastguard Worker por xmm1, xmm0 125*dfc6aa5cSAndroid Build Coastguard Worker packsswb xmm1, xmm1 126*dfc6aa5cSAndroid Build Coastguard Worker packsswb xmm1, xmm1 127*dfc6aa5cSAndroid Build Coastguard Worker movd eax, xmm1 128*dfc6aa5cSAndroid Build Coastguard Worker test rax, rax 129*dfc6aa5cSAndroid Build Coastguard Worker jnz short .columnDCT 130*dfc6aa5cSAndroid Build Coastguard Worker 131*dfc6aa5cSAndroid Build Coastguard Worker ; -- AC terms all zero 132*dfc6aa5cSAndroid Build Coastguard Worker 133*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] 134*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_ISLOW_MULT_TYPE)] 135*dfc6aa5cSAndroid Build Coastguard Worker 136*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, xmm0 ; xmm0=in0=(00 01 02 03 04 05 06 07) 137*dfc6aa5cSAndroid Build Coastguard Worker punpcklwd xmm0, xmm0 ; xmm0=(00 00 01 01 02 02 03 03) 138*dfc6aa5cSAndroid Build Coastguard Worker punpckhwd xmm7, xmm7 ; xmm7=(04 04 05 05 06 06 07 07) 139*dfc6aa5cSAndroid Build Coastguard Worker 140*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm6, xmm0, 0x00 ; xmm6=col0=(00 00 00 00 00 00 00 00) 141*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm2, xmm0, 0x55 ; xmm2=col1=(01 01 01 01 01 01 01 01) 142*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm5, xmm0, 0xAA ; xmm5=col2=(02 02 02 02 02 02 02 02) 143*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm0, xmm0, 0xFF ; xmm0=col3=(03 03 03 03 03 03 03 03) 144*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm1, xmm7, 0x00 ; xmm1=col4=(04 04 04 04 04 04 04 04) 145*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm4, xmm7, 0x55 ; xmm4=col5=(05 05 05 05 05 05 05 05) 146*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm3, xmm7, 0xAA ; xmm3=col6=(06 06 06 06 06 06 06 06) 147*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm7, xmm7, 0xFF ; xmm7=col7=(07 07 07 07 07 07 07 07) 148*dfc6aa5cSAndroid Build Coastguard Worker 149*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=col1 150*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=col3 151*dfc6aa5cSAndroid Build Coastguard Worker jmp near .column_end 152*dfc6aa5cSAndroid Build Coastguard Worker%endif 153*dfc6aa5cSAndroid Build Coastguard Worker.columnDCT: 154*dfc6aa5cSAndroid Build Coastguard Worker 155*dfc6aa5cSAndroid Build Coastguard Worker ; -- Even part 156*dfc6aa5cSAndroid Build Coastguard Worker 157*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, XMMWORD [XMMBLOCK(0,0,rsi,SIZEOF_JCOEF)] 158*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm1, XMMWORD [XMMBLOCK(2,0,rsi,SIZEOF_JCOEF)] 159*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm0, XMMWORD [XMMBLOCK(0,0,rdx,SIZEOF_IFAST_MULT_TYPE)] 160*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm1, XMMWORD [XMMBLOCK(2,0,rdx,SIZEOF_IFAST_MULT_TYPE)] 161*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm2, XMMWORD [XMMBLOCK(4,0,rsi,SIZEOF_JCOEF)] 162*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm3, XMMWORD [XMMBLOCK(6,0,rsi,SIZEOF_JCOEF)] 163*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm2, XMMWORD [XMMBLOCK(4,0,rdx,SIZEOF_IFAST_MULT_TYPE)] 164*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm3, XMMWORD [XMMBLOCK(6,0,rdx,SIZEOF_IFAST_MULT_TYPE)] 165*dfc6aa5cSAndroid Build Coastguard Worker 166*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, xmm0 167*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm5, xmm1 168*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm0, xmm2 ; xmm0=tmp11 169*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm1, xmm3 170*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm4, xmm2 ; xmm4=tmp10 171*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm5, xmm3 ; xmm5=tmp13 172*dfc6aa5cSAndroid Build Coastguard Worker 173*dfc6aa5cSAndroid Build Coastguard Worker psllw xmm1, PRE_MULTIPLY_SCALE_BITS 174*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm1, [rel PW_F1414] 175*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm1, xmm5 ; xmm1=tmp12 176*dfc6aa5cSAndroid Build Coastguard Worker 177*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm6, xmm4 178*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, xmm0 179*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm4, xmm5 ; xmm4=tmp3 180*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm0, xmm1 ; xmm0=tmp2 181*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm6, xmm5 ; xmm6=tmp0 182*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm7, xmm1 ; xmm7=tmp1 183*dfc6aa5cSAndroid Build Coastguard Worker 184*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(1)], xmm4 ; wk(1)=tmp3 185*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=tmp2 186*dfc6aa5cSAndroid Build Coastguard Worker 187*dfc6aa5cSAndroid Build Coastguard Worker ; -- Odd part 188*dfc6aa5cSAndroid Build Coastguard Worker 189*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm2, XMMWORD [XMMBLOCK(1,0,rsi,SIZEOF_JCOEF)] 190*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm3, XMMWORD [XMMBLOCK(3,0,rsi,SIZEOF_JCOEF)] 191*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm2, XMMWORD [XMMBLOCK(1,0,rdx,SIZEOF_IFAST_MULT_TYPE)] 192*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm3, XMMWORD [XMMBLOCK(3,0,rdx,SIZEOF_IFAST_MULT_TYPE)] 193*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm5, XMMWORD [XMMBLOCK(5,0,rsi,SIZEOF_JCOEF)] 194*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm1, XMMWORD [XMMBLOCK(7,0,rsi,SIZEOF_JCOEF)] 195*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm5, XMMWORD [XMMBLOCK(5,0,rdx,SIZEOF_IFAST_MULT_TYPE)] 196*dfc6aa5cSAndroid Build Coastguard Worker pmullw xmm1, XMMWORD [XMMBLOCK(7,0,rdx,SIZEOF_IFAST_MULT_TYPE)] 197*dfc6aa5cSAndroid Build Coastguard Worker 198*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, xmm2 199*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, xmm5 200*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm2, xmm1 ; xmm2=z12 201*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm5, xmm3 ; xmm5=z10 202*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm4, xmm1 ; xmm4=z11 203*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm0, xmm3 ; xmm0=z13 204*dfc6aa5cSAndroid Build Coastguard Worker 205*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm1, xmm5 ; xmm1=z10(unscaled) 206*dfc6aa5cSAndroid Build Coastguard Worker psllw xmm2, PRE_MULTIPLY_SCALE_BITS 207*dfc6aa5cSAndroid Build Coastguard Worker psllw xmm5, PRE_MULTIPLY_SCALE_BITS 208*dfc6aa5cSAndroid Build Coastguard Worker 209*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm3, xmm4 210*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm4, xmm0 211*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm3, xmm0 ; xmm3=tmp7 212*dfc6aa5cSAndroid Build Coastguard Worker 213*dfc6aa5cSAndroid Build Coastguard Worker psllw xmm4, PRE_MULTIPLY_SCALE_BITS 214*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm4, [rel PW_F1414] ; xmm4=tmp11 215*dfc6aa5cSAndroid Build Coastguard Worker 216*dfc6aa5cSAndroid Build Coastguard Worker ; To avoid overflow... 217*dfc6aa5cSAndroid Build Coastguard Worker ; 218*dfc6aa5cSAndroid Build Coastguard Worker ; (Original) 219*dfc6aa5cSAndroid Build Coastguard Worker ; tmp12 = -2.613125930 * z10 + z5; 220*dfc6aa5cSAndroid Build Coastguard Worker ; 221*dfc6aa5cSAndroid Build Coastguard Worker ; (This implementation) 222*dfc6aa5cSAndroid Build Coastguard Worker ; tmp12 = (-1.613125930 - 1) * z10 + z5; 223*dfc6aa5cSAndroid Build Coastguard Worker ; = -1.613125930 * z10 - z10 + z5; 224*dfc6aa5cSAndroid Build Coastguard Worker 225*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, xmm5 226*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm5, xmm2 227*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm5, [rel PW_F1847] ; xmm5=z5 228*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm0, [rel PW_MF1613] 229*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm2, [rel PW_F1082] 230*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm0, xmm1 231*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm2, xmm5 ; xmm2=tmp10 232*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm0, xmm5 ; xmm0=tmp12 233*dfc6aa5cSAndroid Build Coastguard Worker 234*dfc6aa5cSAndroid Build Coastguard Worker ; -- Final output stage 235*dfc6aa5cSAndroid Build Coastguard Worker 236*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm0, xmm3 ; xmm0=tmp6 237*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm1, xmm6 238*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm5, xmm7 239*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm6, xmm3 ; xmm6=data0=(00 01 02 03 04 05 06 07) 240*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm7, xmm0 ; xmm7=data1=(10 11 12 13 14 15 16 17) 241*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm1, xmm3 ; xmm1=data7=(70 71 72 73 74 75 76 77) 242*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm5, xmm0 ; xmm5=data6=(60 61 62 63 64 65 66 67) 243*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm4, xmm0 ; xmm4=tmp5 244*dfc6aa5cSAndroid Build Coastguard Worker 245*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm3, xmm6 ; transpose coefficients(phase 1) 246*dfc6aa5cSAndroid Build Coastguard Worker punpcklwd xmm6, xmm7 ; xmm6=(00 10 01 11 02 12 03 13) 247*dfc6aa5cSAndroid Build Coastguard Worker punpckhwd xmm3, xmm7 ; xmm3=(04 14 05 15 06 16 07 17) 248*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, xmm5 ; transpose coefficients(phase 1) 249*dfc6aa5cSAndroid Build Coastguard Worker punpcklwd xmm5, xmm1 ; xmm5=(60 70 61 71 62 72 63 73) 250*dfc6aa5cSAndroid Build Coastguard Worker punpckhwd xmm0, xmm1 ; xmm0=(64 74 65 75 66 76 67 77) 251*dfc6aa5cSAndroid Build Coastguard Worker 252*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, XMMWORD [wk(0)] ; xmm7=tmp2 253*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm1, XMMWORD [wk(1)] ; xmm1=tmp3 254*dfc6aa5cSAndroid Build Coastguard Worker 255*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(0)], xmm5 ; wk(0)=(60 70 61 71 62 72 63 73) 256*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(64 74 65 75 66 76 67 77) 257*dfc6aa5cSAndroid Build Coastguard Worker 258*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm2, xmm4 ; xmm2=tmp4 259*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm5, xmm7 260*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, xmm1 261*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm7, xmm4 ; xmm7=data2=(20 21 22 23 24 25 26 27) 262*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm1, xmm2 ; xmm1=data4=(40 41 42 43 44 45 46 47) 263*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm5, xmm4 ; xmm5=data5=(50 51 52 53 54 55 56 57) 264*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm0, xmm2 ; xmm0=data3=(30 31 32 33 34 35 36 37) 265*dfc6aa5cSAndroid Build Coastguard Worker 266*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, xmm7 ; transpose coefficients(phase 1) 267*dfc6aa5cSAndroid Build Coastguard Worker punpcklwd xmm7, xmm0 ; xmm7=(20 30 21 31 22 32 23 33) 268*dfc6aa5cSAndroid Build Coastguard Worker punpckhwd xmm4, xmm0 ; xmm4=(24 34 25 35 26 36 27 37) 269*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm2, xmm1 ; transpose coefficients(phase 1) 270*dfc6aa5cSAndroid Build Coastguard Worker punpcklwd xmm1, xmm5 ; xmm1=(40 50 41 51 42 52 43 53) 271*dfc6aa5cSAndroid Build Coastguard Worker punpckhwd xmm2, xmm5 ; xmm2=(44 54 45 55 46 56 47 57) 272*dfc6aa5cSAndroid Build Coastguard Worker 273*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, xmm3 ; transpose coefficients(phase 2) 274*dfc6aa5cSAndroid Build Coastguard Worker punpckldq xmm3, xmm4 ; xmm3=(04 14 24 34 05 15 25 35) 275*dfc6aa5cSAndroid Build Coastguard Worker punpckhdq xmm0, xmm4 ; xmm0=(06 16 26 36 07 17 27 37) 276*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm5, xmm6 ; transpose coefficients(phase 2) 277*dfc6aa5cSAndroid Build Coastguard Worker punpckldq xmm6, xmm7 ; xmm6=(00 10 20 30 01 11 21 31) 278*dfc6aa5cSAndroid Build Coastguard Worker punpckhdq xmm5, xmm7 ; xmm5=(02 12 22 32 03 13 23 33) 279*dfc6aa5cSAndroid Build Coastguard Worker 280*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, XMMWORD [wk(0)] ; xmm4=(60 70 61 71 62 72 63 73) 281*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, XMMWORD [wk(1)] ; xmm7=(64 74 65 75 66 76 67 77) 282*dfc6aa5cSAndroid Build Coastguard Worker 283*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(0)], xmm3 ; wk(0)=(04 14 24 34 05 15 25 35) 284*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(1)], xmm0 ; wk(1)=(06 16 26 36 07 17 27 37) 285*dfc6aa5cSAndroid Build Coastguard Worker 286*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm3, xmm1 ; transpose coefficients(phase 2) 287*dfc6aa5cSAndroid Build Coastguard Worker punpckldq xmm1, xmm4 ; xmm1=(40 50 60 70 41 51 61 71) 288*dfc6aa5cSAndroid Build Coastguard Worker punpckhdq xmm3, xmm4 ; xmm3=(42 52 62 72 43 53 63 73) 289*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, xmm2 ; transpose coefficients(phase 2) 290*dfc6aa5cSAndroid Build Coastguard Worker punpckldq xmm2, xmm7 ; xmm2=(44 54 64 74 45 55 65 75) 291*dfc6aa5cSAndroid Build Coastguard Worker punpckhdq xmm0, xmm7 ; xmm0=(46 56 66 76 47 57 67 77) 292*dfc6aa5cSAndroid Build Coastguard Worker 293*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, xmm6 ; transpose coefficients(phase 3) 294*dfc6aa5cSAndroid Build Coastguard Worker punpcklqdq xmm6, xmm1 ; xmm6=col0=(00 10 20 30 40 50 60 70) 295*dfc6aa5cSAndroid Build Coastguard Worker punpckhqdq xmm4, xmm1 ; xmm4=col1=(01 11 21 31 41 51 61 71) 296*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, xmm5 ; transpose coefficients(phase 3) 297*dfc6aa5cSAndroid Build Coastguard Worker punpcklqdq xmm5, xmm3 ; xmm5=col2=(02 12 22 32 42 52 62 72) 298*dfc6aa5cSAndroid Build Coastguard Worker punpckhqdq xmm7, xmm3 ; xmm7=col3=(03 13 23 33 43 53 63 73) 299*dfc6aa5cSAndroid Build Coastguard Worker 300*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm1, XMMWORD [wk(0)] ; xmm1=(04 14 24 34 05 15 25 35) 301*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm3, XMMWORD [wk(1)] ; xmm3=(06 16 26 36 07 17 27 37) 302*dfc6aa5cSAndroid Build Coastguard Worker 303*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(0)], xmm4 ; wk(0)=col1 304*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(1)], xmm7 ; wk(1)=col3 305*dfc6aa5cSAndroid Build Coastguard Worker 306*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, xmm1 ; transpose coefficients(phase 3) 307*dfc6aa5cSAndroid Build Coastguard Worker punpcklqdq xmm1, xmm2 ; xmm1=col4=(04 14 24 34 44 54 64 74) 308*dfc6aa5cSAndroid Build Coastguard Worker punpckhqdq xmm4, xmm2 ; xmm4=col5=(05 15 25 35 45 55 65 75) 309*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, xmm3 ; transpose coefficients(phase 3) 310*dfc6aa5cSAndroid Build Coastguard Worker punpcklqdq xmm3, xmm0 ; xmm3=col6=(06 16 26 36 46 56 66 76) 311*dfc6aa5cSAndroid Build Coastguard Worker punpckhqdq xmm7, xmm0 ; xmm7=col7=(07 17 27 37 47 57 67 77) 312*dfc6aa5cSAndroid Build Coastguard Worker.column_end: 313*dfc6aa5cSAndroid Build Coastguard Worker 314*dfc6aa5cSAndroid Build Coastguard Worker ; -- Prefetch the next coefficient block 315*dfc6aa5cSAndroid Build Coastguard Worker 316*dfc6aa5cSAndroid Build Coastguard Worker prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 0*32] 317*dfc6aa5cSAndroid Build Coastguard Worker prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 1*32] 318*dfc6aa5cSAndroid Build Coastguard Worker prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 2*32] 319*dfc6aa5cSAndroid Build Coastguard Worker prefetchnta [rsi + DCTSIZE2*SIZEOF_JCOEF + 3*32] 320*dfc6aa5cSAndroid Build Coastguard Worker 321*dfc6aa5cSAndroid Build Coastguard Worker ; ---- Pass 2: process rows from work array, store into output array. 322*dfc6aa5cSAndroid Build Coastguard Worker 323*dfc6aa5cSAndroid Build Coastguard Worker mov rax, [original_rbp] 324*dfc6aa5cSAndroid Build Coastguard Worker mov rdi, r12 ; (JSAMPROW *) 325*dfc6aa5cSAndroid Build Coastguard Worker mov eax, r13d 326*dfc6aa5cSAndroid Build Coastguard Worker 327*dfc6aa5cSAndroid Build Coastguard Worker ; -- Even part 328*dfc6aa5cSAndroid Build Coastguard Worker 329*dfc6aa5cSAndroid Build Coastguard Worker ; xmm6=col0, xmm5=col2, xmm1=col4, xmm3=col6 330*dfc6aa5cSAndroid Build Coastguard Worker 331*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm2, xmm6 332*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, xmm5 333*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm6, xmm1 ; xmm6=tmp11 334*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm5, xmm3 335*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm2, xmm1 ; xmm2=tmp10 336*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm0, xmm3 ; xmm0=tmp13 337*dfc6aa5cSAndroid Build Coastguard Worker 338*dfc6aa5cSAndroid Build Coastguard Worker psllw xmm5, PRE_MULTIPLY_SCALE_BITS 339*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm5, [rel PW_F1414] 340*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm5, xmm0 ; xmm5=tmp12 341*dfc6aa5cSAndroid Build Coastguard Worker 342*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm1, xmm2 343*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm3, xmm6 344*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm2, xmm0 ; xmm2=tmp3 345*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm6, xmm5 ; xmm6=tmp2 346*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm1, xmm0 ; xmm1=tmp0 347*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm3, xmm5 ; xmm3=tmp1 348*dfc6aa5cSAndroid Build Coastguard Worker 349*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, XMMWORD [wk(0)] ; xmm0=col1 350*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm5, XMMWORD [wk(1)] ; xmm5=col3 351*dfc6aa5cSAndroid Build Coastguard Worker 352*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(0)], xmm2 ; wk(0)=tmp3 353*dfc6aa5cSAndroid Build Coastguard Worker movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=tmp2 354*dfc6aa5cSAndroid Build Coastguard Worker 355*dfc6aa5cSAndroid Build Coastguard Worker ; -- Odd part 356*dfc6aa5cSAndroid Build Coastguard Worker 357*dfc6aa5cSAndroid Build Coastguard Worker ; xmm0=col1, xmm5=col3, xmm4=col5, xmm7=col7 358*dfc6aa5cSAndroid Build Coastguard Worker 359*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm2, xmm0 360*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm6, xmm4 361*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm0, xmm7 ; xmm0=z12 362*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm4, xmm5 ; xmm4=z10 363*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm2, xmm7 ; xmm2=z11 364*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm6, xmm5 ; xmm6=z13 365*dfc6aa5cSAndroid Build Coastguard Worker 366*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, xmm4 ; xmm7=z10(unscaled) 367*dfc6aa5cSAndroid Build Coastguard Worker psllw xmm0, PRE_MULTIPLY_SCALE_BITS 368*dfc6aa5cSAndroid Build Coastguard Worker psllw xmm4, PRE_MULTIPLY_SCALE_BITS 369*dfc6aa5cSAndroid Build Coastguard Worker 370*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm5, xmm2 371*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm2, xmm6 372*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm5, xmm6 ; xmm5=tmp7 373*dfc6aa5cSAndroid Build Coastguard Worker 374*dfc6aa5cSAndroid Build Coastguard Worker psllw xmm2, PRE_MULTIPLY_SCALE_BITS 375*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm2, [rel PW_F1414] ; xmm2=tmp11 376*dfc6aa5cSAndroid Build Coastguard Worker 377*dfc6aa5cSAndroid Build Coastguard Worker ; To avoid overflow... 378*dfc6aa5cSAndroid Build Coastguard Worker ; 379*dfc6aa5cSAndroid Build Coastguard Worker ; (Original) 380*dfc6aa5cSAndroid Build Coastguard Worker ; tmp12 = -2.613125930 * z10 + z5; 381*dfc6aa5cSAndroid Build Coastguard Worker ; 382*dfc6aa5cSAndroid Build Coastguard Worker ; (This implementation) 383*dfc6aa5cSAndroid Build Coastguard Worker ; tmp12 = (-1.613125930 - 1) * z10 + z5; 384*dfc6aa5cSAndroid Build Coastguard Worker ; = -1.613125930 * z10 - z10 + z5; 385*dfc6aa5cSAndroid Build Coastguard Worker 386*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm6, xmm4 387*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm4, xmm0 388*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm4, [rel PW_F1847] ; xmm4=z5 389*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm6, [rel PW_MF1613] 390*dfc6aa5cSAndroid Build Coastguard Worker pmulhw xmm0, [rel PW_F1082] 391*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm6, xmm7 392*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm0, xmm4 ; xmm0=tmp10 393*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm6, xmm4 ; xmm6=tmp12 394*dfc6aa5cSAndroid Build Coastguard Worker 395*dfc6aa5cSAndroid Build Coastguard Worker ; -- Final output stage 396*dfc6aa5cSAndroid Build Coastguard Worker 397*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm6, xmm5 ; xmm6=tmp6 398*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, xmm1 399*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, xmm3 400*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm1, xmm5 ; xmm1=data0=(00 10 20 30 40 50 60 70) 401*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm3, xmm6 ; xmm3=data1=(01 11 21 31 41 51 61 71) 402*dfc6aa5cSAndroid Build Coastguard Worker psraw xmm1, (PASS1_BITS+3) ; descale 403*dfc6aa5cSAndroid Build Coastguard Worker psraw xmm3, (PASS1_BITS+3) ; descale 404*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm7, xmm5 ; xmm7=data7=(07 17 27 37 47 57 67 77) 405*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm4, xmm6 ; xmm4=data6=(06 16 26 36 46 56 66 76) 406*dfc6aa5cSAndroid Build Coastguard Worker psraw xmm7, (PASS1_BITS+3) ; descale 407*dfc6aa5cSAndroid Build Coastguard Worker psraw xmm4, (PASS1_BITS+3) ; descale 408*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm2, xmm6 ; xmm2=tmp5 409*dfc6aa5cSAndroid Build Coastguard Worker 410*dfc6aa5cSAndroid Build Coastguard Worker packsswb xmm1, xmm4 ; xmm1=(00 10 20 30 40 50 60 70 06 16 26 36 46 56 66 76) 411*dfc6aa5cSAndroid Build Coastguard Worker packsswb xmm3, xmm7 ; xmm3=(01 11 21 31 41 51 61 71 07 17 27 37 47 57 67 77) 412*dfc6aa5cSAndroid Build Coastguard Worker 413*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm5, XMMWORD [wk(1)] ; xmm5=tmp2 414*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm6, XMMWORD [wk(0)] ; xmm6=tmp3 415*dfc6aa5cSAndroid Build Coastguard Worker 416*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm0, xmm2 ; xmm0=tmp4 417*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, xmm5 418*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, xmm6 419*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm5, xmm2 ; xmm5=data2=(02 12 22 32 42 52 62 72) 420*dfc6aa5cSAndroid Build Coastguard Worker paddw xmm6, xmm0 ; xmm6=data4=(04 14 24 34 44 54 64 74) 421*dfc6aa5cSAndroid Build Coastguard Worker psraw xmm5, (PASS1_BITS+3) ; descale 422*dfc6aa5cSAndroid Build Coastguard Worker psraw xmm6, (PASS1_BITS+3) ; descale 423*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm4, xmm2 ; xmm4=data5=(05 15 25 35 45 55 65 75) 424*dfc6aa5cSAndroid Build Coastguard Worker psubw xmm7, xmm0 ; xmm7=data3=(03 13 23 33 43 53 63 73) 425*dfc6aa5cSAndroid Build Coastguard Worker psraw xmm4, (PASS1_BITS+3) ; descale 426*dfc6aa5cSAndroid Build Coastguard Worker psraw xmm7, (PASS1_BITS+3) ; descale 427*dfc6aa5cSAndroid Build Coastguard Worker 428*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm2, [rel PB_CENTERJSAMP] ; xmm2=[rel PB_CENTERJSAMP] 429*dfc6aa5cSAndroid Build Coastguard Worker 430*dfc6aa5cSAndroid Build Coastguard Worker packsswb xmm5, xmm6 ; xmm5=(02 12 22 32 42 52 62 72 04 14 24 34 44 54 64 74) 431*dfc6aa5cSAndroid Build Coastguard Worker packsswb xmm7, xmm4 ; xmm7=(03 13 23 33 43 53 63 73 05 15 25 35 45 55 65 75) 432*dfc6aa5cSAndroid Build Coastguard Worker 433*dfc6aa5cSAndroid Build Coastguard Worker paddb xmm1, xmm2 434*dfc6aa5cSAndroid Build Coastguard Worker paddb xmm3, xmm2 435*dfc6aa5cSAndroid Build Coastguard Worker paddb xmm5, xmm2 436*dfc6aa5cSAndroid Build Coastguard Worker paddb xmm7, xmm2 437*dfc6aa5cSAndroid Build Coastguard Worker 438*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm0, xmm1 ; transpose coefficients(phase 1) 439*dfc6aa5cSAndroid Build Coastguard Worker punpcklbw xmm1, xmm3 ; xmm1=(00 01 10 11 20 21 30 31 40 41 50 51 60 61 70 71) 440*dfc6aa5cSAndroid Build Coastguard Worker punpckhbw xmm0, xmm3 ; xmm0=(06 07 16 17 26 27 36 37 46 47 56 57 66 67 76 77) 441*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm6, xmm5 ; transpose coefficients(phase 1) 442*dfc6aa5cSAndroid Build Coastguard Worker punpcklbw xmm5, xmm7 ; xmm5=(02 03 12 13 22 23 32 33 42 43 52 53 62 63 72 73) 443*dfc6aa5cSAndroid Build Coastguard Worker punpckhbw xmm6, xmm7 ; xmm6=(04 05 14 15 24 25 34 35 44 45 54 55 64 65 74 75) 444*dfc6aa5cSAndroid Build Coastguard Worker 445*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm4, xmm1 ; transpose coefficients(phase 2) 446*dfc6aa5cSAndroid Build Coastguard Worker punpcklwd xmm1, xmm5 ; xmm1=(00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33) 447*dfc6aa5cSAndroid Build Coastguard Worker punpckhwd xmm4, xmm5 ; xmm4=(40 41 42 43 50 51 52 53 60 61 62 63 70 71 72 73) 448*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm2, xmm6 ; transpose coefficients(phase 2) 449*dfc6aa5cSAndroid Build Coastguard Worker punpcklwd xmm6, xmm0 ; xmm6=(04 05 06 07 14 15 16 17 24 25 26 27 34 35 36 37) 450*dfc6aa5cSAndroid Build Coastguard Worker punpckhwd xmm2, xmm0 ; xmm2=(44 45 46 47 54 55 56 57 64 65 66 67 74 75 76 77) 451*dfc6aa5cSAndroid Build Coastguard Worker 452*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm3, xmm1 ; transpose coefficients(phase 3) 453*dfc6aa5cSAndroid Build Coastguard Worker punpckldq xmm1, xmm6 ; xmm1=(00 01 02 03 04 05 06 07 10 11 12 13 14 15 16 17) 454*dfc6aa5cSAndroid Build Coastguard Worker punpckhdq xmm3, xmm6 ; xmm3=(20 21 22 23 24 25 26 27 30 31 32 33 34 35 36 37) 455*dfc6aa5cSAndroid Build Coastguard Worker movdqa xmm7, xmm4 ; transpose coefficients(phase 3) 456*dfc6aa5cSAndroid Build Coastguard Worker punpckldq xmm4, xmm2 ; xmm4=(40 41 42 43 44 45 46 47 50 51 52 53 54 55 56 57) 457*dfc6aa5cSAndroid Build Coastguard Worker punpckhdq xmm7, xmm2 ; xmm7=(60 61 62 63 64 65 66 67 70 71 72 73 74 75 76 77) 458*dfc6aa5cSAndroid Build Coastguard Worker 459*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm5, xmm1, 0x4E ; xmm5=(10 11 12 13 14 15 16 17 00 01 02 03 04 05 06 07) 460*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm0, xmm3, 0x4E ; xmm0=(30 31 32 33 34 35 36 37 20 21 22 23 24 25 26 27) 461*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm6, xmm4, 0x4E ; xmm6=(50 51 52 53 54 55 56 57 40 41 42 43 44 45 46 47) 462*dfc6aa5cSAndroid Build Coastguard Worker pshufd xmm2, xmm7, 0x4E ; xmm2=(70 71 72 73 74 75 76 77 60 61 62 63 64 65 66 67) 463*dfc6aa5cSAndroid Build Coastguard Worker 464*dfc6aa5cSAndroid Build Coastguard Worker mov rdxp, JSAMPROW [rdi+0*SIZEOF_JSAMPROW] 465*dfc6aa5cSAndroid Build Coastguard Worker mov rsip, JSAMPROW [rdi+2*SIZEOF_JSAMPROW] 466*dfc6aa5cSAndroid Build Coastguard Worker movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm1 467*dfc6aa5cSAndroid Build Coastguard Worker movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm3 468*dfc6aa5cSAndroid Build Coastguard Worker mov rdxp, JSAMPROW [rdi+4*SIZEOF_JSAMPROW] 469*dfc6aa5cSAndroid Build Coastguard Worker mov rsip, JSAMPROW [rdi+6*SIZEOF_JSAMPROW] 470*dfc6aa5cSAndroid Build Coastguard Worker movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm4 471*dfc6aa5cSAndroid Build Coastguard Worker movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm7 472*dfc6aa5cSAndroid Build Coastguard Worker 473*dfc6aa5cSAndroid Build Coastguard Worker mov rdxp, JSAMPROW [rdi+1*SIZEOF_JSAMPROW] 474*dfc6aa5cSAndroid Build Coastguard Worker mov rsip, JSAMPROW [rdi+3*SIZEOF_JSAMPROW] 475*dfc6aa5cSAndroid Build Coastguard Worker movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm5 476*dfc6aa5cSAndroid Build Coastguard Worker movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm0 477*dfc6aa5cSAndroid Build Coastguard Worker mov rdxp, JSAMPROW [rdi+5*SIZEOF_JSAMPROW] 478*dfc6aa5cSAndroid Build Coastguard Worker mov rsip, JSAMPROW [rdi+7*SIZEOF_JSAMPROW] 479*dfc6aa5cSAndroid Build Coastguard Worker movq XMM_MMWORD [rdx+rax*SIZEOF_JSAMPLE], xmm6 480*dfc6aa5cSAndroid Build Coastguard Worker movq XMM_MMWORD [rsi+rax*SIZEOF_JSAMPLE], xmm2 481*dfc6aa5cSAndroid Build Coastguard Worker 482*dfc6aa5cSAndroid Build Coastguard Worker uncollect_args 4 483*dfc6aa5cSAndroid Build Coastguard Worker mov rsp, rbp ; rsp <- aligned rbp 484*dfc6aa5cSAndroid Build Coastguard Worker pop rsp ; rsp <- original rbp 485*dfc6aa5cSAndroid Build Coastguard Worker pop rbp 486*dfc6aa5cSAndroid Build Coastguard Worker ret 487*dfc6aa5cSAndroid Build Coastguard Worker ret 488*dfc6aa5cSAndroid Build Coastguard Worker 489*dfc6aa5cSAndroid Build Coastguard Worker; For some reason, the OS X linker does not honor the request to align the 490*dfc6aa5cSAndroid Build Coastguard Worker; segment unless we do this. 491*dfc6aa5cSAndroid Build Coastguard Worker align 32 492