1*dfc6aa5cSAndroid Build Coastguard Worker; 2*dfc6aa5cSAndroid Build Coastguard Worker; jcgryext.asm - grayscale colorspace conversion (AVX2) 3*dfc6aa5cSAndroid Build Coastguard Worker; 4*dfc6aa5cSAndroid Build Coastguard Worker; Copyright (C) 2011, 2016, D. R. Commander. 5*dfc6aa5cSAndroid Build Coastguard Worker; Copyright (C) 2015, Intel Corporation. 6*dfc6aa5cSAndroid Build Coastguard Worker; 7*dfc6aa5cSAndroid Build Coastguard Worker; Based on the x86 SIMD extension for IJG JPEG library 8*dfc6aa5cSAndroid Build Coastguard Worker; Copyright (C) 1999-2006, MIYASAKA Masaru. 9*dfc6aa5cSAndroid Build Coastguard Worker; For conditions of distribution and use, see copyright notice in jsimdext.inc 10*dfc6aa5cSAndroid Build Coastguard Worker; 11*dfc6aa5cSAndroid Build Coastguard Worker; This file should be assembled with NASM (Netwide Assembler), 12*dfc6aa5cSAndroid Build Coastguard Worker; can *not* be assembled with Microsoft's MASM or any compatible 13*dfc6aa5cSAndroid Build Coastguard Worker; assembler (including Borland's Turbo Assembler). 14*dfc6aa5cSAndroid Build Coastguard Worker; NASM is available from http://nasm.sourceforge.net/ or 15*dfc6aa5cSAndroid Build Coastguard Worker; http://sourceforge.net/project/showfiles.php?group_id=6208 16*dfc6aa5cSAndroid Build Coastguard Worker 17*dfc6aa5cSAndroid Build Coastguard Worker%include "jcolsamp.inc" 18*dfc6aa5cSAndroid Build Coastguard Worker 19*dfc6aa5cSAndroid Build Coastguard Worker; -------------------------------------------------------------------------- 20*dfc6aa5cSAndroid Build Coastguard Worker; 21*dfc6aa5cSAndroid Build Coastguard Worker; Convert some rows of samples to the output colorspace. 22*dfc6aa5cSAndroid Build Coastguard Worker; 23*dfc6aa5cSAndroid Build Coastguard Worker; GLOBAL(void) 24*dfc6aa5cSAndroid Build Coastguard Worker; jsimd_rgb_gray_convert_avx2(JDIMENSION img_width, JSAMPARRAY input_buf, 25*dfc6aa5cSAndroid Build Coastguard Worker; JSAMPIMAGE output_buf, JDIMENSION output_row, 26*dfc6aa5cSAndroid Build Coastguard Worker; int num_rows); 27*dfc6aa5cSAndroid Build Coastguard Worker; 28*dfc6aa5cSAndroid Build Coastguard Worker 29*dfc6aa5cSAndroid Build Coastguard Worker%define img_width(b) (b) + 8 ; JDIMENSION img_width 30*dfc6aa5cSAndroid Build Coastguard Worker%define input_buf(b) (b) + 12 ; JSAMPARRAY input_buf 31*dfc6aa5cSAndroid Build Coastguard Worker%define output_buf(b) (b) + 16 ; JSAMPIMAGE output_buf 32*dfc6aa5cSAndroid Build Coastguard Worker%define output_row(b) (b) + 20 ; JDIMENSION output_row 33*dfc6aa5cSAndroid Build Coastguard Worker%define num_rows(b) (b) + 24 ; int num_rows 34*dfc6aa5cSAndroid Build Coastguard Worker 35*dfc6aa5cSAndroid Build Coastguard Worker%define original_ebp ebp + 0 36*dfc6aa5cSAndroid Build Coastguard Worker%define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD 37*dfc6aa5cSAndroid Build Coastguard Worker ; ymmword wk[WK_NUM] 38*dfc6aa5cSAndroid Build Coastguard Worker%define WK_NUM 2 39*dfc6aa5cSAndroid Build Coastguard Worker%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr 40*dfc6aa5cSAndroid Build Coastguard Worker 41*dfc6aa5cSAndroid Build Coastguard Worker align 32 42*dfc6aa5cSAndroid Build Coastguard Worker GLOBAL_FUNCTION(jsimd_rgb_gray_convert_avx2) 43*dfc6aa5cSAndroid Build Coastguard Worker 44*dfc6aa5cSAndroid Build Coastguard WorkerEXTN(jsimd_rgb_gray_convert_avx2): 45*dfc6aa5cSAndroid Build Coastguard Worker push ebp 46*dfc6aa5cSAndroid Build Coastguard Worker mov eax, esp ; eax = original ebp 47*dfc6aa5cSAndroid Build Coastguard Worker sub esp, byte 4 48*dfc6aa5cSAndroid Build Coastguard Worker and esp, byte (-SIZEOF_YMMWORD) ; align to 256 bits 49*dfc6aa5cSAndroid Build Coastguard Worker mov [esp], eax 50*dfc6aa5cSAndroid Build Coastguard Worker mov ebp, esp ; ebp = aligned ebp 51*dfc6aa5cSAndroid Build Coastguard Worker lea esp, [wk(0)] 52*dfc6aa5cSAndroid Build Coastguard Worker pushpic eax ; make a room for GOT address 53*dfc6aa5cSAndroid Build Coastguard Worker push ebx 54*dfc6aa5cSAndroid Build Coastguard Worker; push ecx ; need not be preserved 55*dfc6aa5cSAndroid Build Coastguard Worker; push edx ; need not be preserved 56*dfc6aa5cSAndroid Build Coastguard Worker push esi 57*dfc6aa5cSAndroid Build Coastguard Worker push edi 58*dfc6aa5cSAndroid Build Coastguard Worker 59*dfc6aa5cSAndroid Build Coastguard Worker get_GOT ebx ; get GOT address 60*dfc6aa5cSAndroid Build Coastguard Worker movpic POINTER [gotptr], ebx ; save GOT address 61*dfc6aa5cSAndroid Build Coastguard Worker 62*dfc6aa5cSAndroid Build Coastguard Worker mov ecx, JDIMENSION [img_width(eax)] 63*dfc6aa5cSAndroid Build Coastguard Worker test ecx, ecx 64*dfc6aa5cSAndroid Build Coastguard Worker jz near .return 65*dfc6aa5cSAndroid Build Coastguard Worker 66*dfc6aa5cSAndroid Build Coastguard Worker push ecx 67*dfc6aa5cSAndroid Build Coastguard Worker 68*dfc6aa5cSAndroid Build Coastguard Worker mov esi, JSAMPIMAGE [output_buf(eax)] 69*dfc6aa5cSAndroid Build Coastguard Worker mov ecx, JDIMENSION [output_row(eax)] 70*dfc6aa5cSAndroid Build Coastguard Worker mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY] 71*dfc6aa5cSAndroid Build Coastguard Worker lea edi, [edi+ecx*SIZEOF_JSAMPROW] 72*dfc6aa5cSAndroid Build Coastguard Worker 73*dfc6aa5cSAndroid Build Coastguard Worker pop ecx 74*dfc6aa5cSAndroid Build Coastguard Worker 75*dfc6aa5cSAndroid Build Coastguard Worker mov esi, JSAMPARRAY [input_buf(eax)] 76*dfc6aa5cSAndroid Build Coastguard Worker mov eax, INT [num_rows(eax)] 77*dfc6aa5cSAndroid Build Coastguard Worker test eax, eax 78*dfc6aa5cSAndroid Build Coastguard Worker jle near .return 79*dfc6aa5cSAndroid Build Coastguard Worker alignx 16, 7 80*dfc6aa5cSAndroid Build Coastguard Worker.rowloop: 81*dfc6aa5cSAndroid Build Coastguard Worker pushpic eax 82*dfc6aa5cSAndroid Build Coastguard Worker push edi 83*dfc6aa5cSAndroid Build Coastguard Worker push esi 84*dfc6aa5cSAndroid Build Coastguard Worker push ecx ; col 85*dfc6aa5cSAndroid Build Coastguard Worker 86*dfc6aa5cSAndroid Build Coastguard Worker mov esi, JSAMPROW [esi] ; inptr 87*dfc6aa5cSAndroid Build Coastguard Worker mov edi, JSAMPROW [edi] ; outptr0 88*dfc6aa5cSAndroid Build Coastguard Worker movpic eax, POINTER [gotptr] ; load GOT address (eax) 89*dfc6aa5cSAndroid Build Coastguard Worker 90*dfc6aa5cSAndroid Build Coastguard Worker cmp ecx, byte SIZEOF_YMMWORD 91*dfc6aa5cSAndroid Build Coastguard Worker jae near .columnloop 92*dfc6aa5cSAndroid Build Coastguard Worker alignx 16, 7 93*dfc6aa5cSAndroid Build Coastguard Worker 94*dfc6aa5cSAndroid Build Coastguard Worker%if RGB_PIXELSIZE == 3 ; --------------- 95*dfc6aa5cSAndroid Build Coastguard Worker 96*dfc6aa5cSAndroid Build Coastguard Worker.column_ld1: 97*dfc6aa5cSAndroid Build Coastguard Worker push eax 98*dfc6aa5cSAndroid Build Coastguard Worker push edx 99*dfc6aa5cSAndroid Build Coastguard Worker lea ecx, [ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE 100*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_BYTE 101*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld2 102*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_BYTE 103*dfc6aa5cSAndroid Build Coastguard Worker movzx eax, byte [esi+ecx] 104*dfc6aa5cSAndroid Build Coastguard Worker.column_ld2: 105*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_WORD 106*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld4 107*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_WORD 108*dfc6aa5cSAndroid Build Coastguard Worker movzx edx, word [esi+ecx] 109*dfc6aa5cSAndroid Build Coastguard Worker shl eax, WORD_BIT 110*dfc6aa5cSAndroid Build Coastguard Worker or eax, edx 111*dfc6aa5cSAndroid Build Coastguard Worker.column_ld4: 112*dfc6aa5cSAndroid Build Coastguard Worker vmovd xmmA, eax 113*dfc6aa5cSAndroid Build Coastguard Worker pop edx 114*dfc6aa5cSAndroid Build Coastguard Worker pop eax 115*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_DWORD 116*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld8 117*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_DWORD 118*dfc6aa5cSAndroid Build Coastguard Worker vmovd xmmF, XMM_DWORD [esi+ecx] 119*dfc6aa5cSAndroid Build Coastguard Worker vpslldq xmmA, xmmA, SIZEOF_DWORD 120*dfc6aa5cSAndroid Build Coastguard Worker vpor xmmA, xmmA, xmmF 121*dfc6aa5cSAndroid Build Coastguard Worker.column_ld8: 122*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_MMWORD 123*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld16 124*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_MMWORD 125*dfc6aa5cSAndroid Build Coastguard Worker vmovq xmmB, XMM_MMWORD [esi+ecx] 126*dfc6aa5cSAndroid Build Coastguard Worker vpslldq xmmA, xmmA, SIZEOF_MMWORD 127*dfc6aa5cSAndroid Build Coastguard Worker vpor xmmA, xmmA, xmmB 128*dfc6aa5cSAndroid Build Coastguard Worker.column_ld16: 129*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_XMMWORD 130*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld32 131*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_XMMWORD 132*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu xmmB, XMM_MMWORD [esi+ecx] 133*dfc6aa5cSAndroid Build Coastguard Worker vperm2i128 ymmA, ymmA, ymmA, 1 134*dfc6aa5cSAndroid Build Coastguard Worker vpor ymmA, ymmB 135*dfc6aa5cSAndroid Build Coastguard Worker.column_ld32: 136*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_YMMWORD 137*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld64 138*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_YMMWORD 139*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmF, ymmA 140*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmA, YMMWORD [esi+0*SIZEOF_YMMWORD] 141*dfc6aa5cSAndroid Build Coastguard Worker.column_ld64: 142*dfc6aa5cSAndroid Build Coastguard Worker test cl, 2*SIZEOF_YMMWORD 143*dfc6aa5cSAndroid Build Coastguard Worker mov ecx, SIZEOF_YMMWORD 144*dfc6aa5cSAndroid Build Coastguard Worker jz short .rgb_gray_cnv 145*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmB, ymmA 146*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmA, YMMWORD [esi+0*SIZEOF_YMMWORD] 147*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmF, YMMWORD [esi+1*SIZEOF_YMMWORD] 148*dfc6aa5cSAndroid Build Coastguard Worker jmp short .rgb_gray_cnv 149*dfc6aa5cSAndroid Build Coastguard Worker alignx 16, 7 150*dfc6aa5cSAndroid Build Coastguard Worker 151*dfc6aa5cSAndroid Build Coastguard Worker.columnloop: 152*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmA, YMMWORD [esi+0*SIZEOF_YMMWORD] 153*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmF, YMMWORD [esi+1*SIZEOF_YMMWORD] 154*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmB, YMMWORD [esi+2*SIZEOF_YMMWORD] 155*dfc6aa5cSAndroid Build Coastguard Worker 156*dfc6aa5cSAndroid Build Coastguard Worker.rgb_gray_cnv: 157*dfc6aa5cSAndroid Build Coastguard Worker ; ymmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05 158*dfc6aa5cSAndroid Build Coastguard Worker ; 15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) 159*dfc6aa5cSAndroid Build Coastguard Worker ; ymmF=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F 160*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 1G 2G 0H 1H 2H 0I 1I 2I 0J 1J 2J 0K 1K 2K 0L) 161*dfc6aa5cSAndroid Build Coastguard Worker ; ymmB=(1L 2L 0M 1M 2M 0N 1N 2N 0O 1O 2O 0P 1P 2P 0Q 1Q 162*dfc6aa5cSAndroid Build Coastguard Worker ; 2Q 0R 1R 2R 0S 1S 2S 0T 1T 2T 0U 1U 2U 0V 1V 2V) 163*dfc6aa5cSAndroid Build Coastguard Worker 164*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmC, ymmA 165*dfc6aa5cSAndroid Build Coastguard Worker vinserti128 ymmA, ymmF, xmmA, 0 ; ymmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05 166*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 1G 2G 0H 1H 2H 0I 1I 2I 0J 1J 2J 0K 1K 2K 0L) 167*dfc6aa5cSAndroid Build Coastguard Worker vinserti128 ymmC, ymmC, xmmB, 0 ; ymmC=(1L 2L 0M 1M 2M 0N 1N 2N 0O 1O 2O 0P 1P 2P 0Q 1Q 168*dfc6aa5cSAndroid Build Coastguard Worker ; 15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A) 169*dfc6aa5cSAndroid Build Coastguard Worker vinserti128 ymmB, ymmB, xmmF, 0 ; ymmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F 170*dfc6aa5cSAndroid Build Coastguard Worker ; 2Q 0R 1R 2R 0S 1S 2S 0T 1T 2T 0U 1U 2U 0V 1V 2V) 171*dfc6aa5cSAndroid Build Coastguard Worker vperm2i128 ymmF, ymmC, ymmC, 1 ; ymmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A 172*dfc6aa5cSAndroid Build Coastguard Worker ; 1L 2L 0M 1M 2M 0N 1N 2N 0O 1O 2O 0P 1P 2P 0Q 1Q) 173*dfc6aa5cSAndroid Build Coastguard Worker 174*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmG, ymmA 175*dfc6aa5cSAndroid Build Coastguard Worker vpslldq ymmA, ymmA, 8 ; ymmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12 176*dfc6aa5cSAndroid Build Coastguard Worker ; 22 03 13 23 04 14 24 05 0G 1G 2G 0H 1H 2H 0I 1I) 177*dfc6aa5cSAndroid Build Coastguard Worker vpsrldq ymmG, ymmG, 8 ; ymmG=(22 03 13 23 04 14 24 05 0G 1G 2G 0H 1H 2H 0I 1I 178*dfc6aa5cSAndroid Build Coastguard Worker ; 2I 0J 1J 2J 0K 1K 2K 0L -- -- -- -- -- -- -- --) 179*dfc6aa5cSAndroid Build Coastguard Worker 180*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmA, ymmA, ymmF ; ymmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A 181*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 0O 1G 1O 2G 2O 0H 0P 1H 1P 2H 2P 0I 0Q 1I 1Q) 182*dfc6aa5cSAndroid Build Coastguard Worker vpslldq ymmF, ymmF, 8 ; ymmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27 183*dfc6aa5cSAndroid Build Coastguard Worker ; 08 18 28 09 19 29 0A 1A 1L 2L 0M 1M 2M 0N 1N 2N) 184*dfc6aa5cSAndroid Build Coastguard Worker 185*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmG, ymmG, ymmB ; ymmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D 186*dfc6aa5cSAndroid Build Coastguard Worker ; 2I 2Q 0J 0R 1J 1R 2J 2R 0K 0S 1K 1S 2K 2S 0L 0T) 187*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmF, ymmF, ymmB ; ymmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F 188*dfc6aa5cSAndroid Build Coastguard Worker ; 1L 1T 2L 2T 0M 0U 1M 1U 2M 2U 0N 0V 1N 1V 2N 2V) 189*dfc6aa5cSAndroid Build Coastguard Worker 190*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmD, ymmA 191*dfc6aa5cSAndroid Build Coastguard Worker vpslldq ymmA, ymmA, 8 ; ymmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09 192*dfc6aa5cSAndroid Build Coastguard Worker ; 11 19 21 29 02 0A 12 1A 0G 0O 1G 1O 2G 2O 0H 0P) 193*dfc6aa5cSAndroid Build Coastguard Worker vpsrldq ymmD, ymmD, 8 ; ymmD=(11 19 21 29 02 0A 12 1A 0G 0O 1G 1O 2G 2O 0H 0P 194*dfc6aa5cSAndroid Build Coastguard Worker ; 1H 1P 2H 2P 0I 0Q 1I 1Q -- -- -- -- -- -- -- --) 195*dfc6aa5cSAndroid Build Coastguard Worker 196*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmA, ymmA, ymmG ; ymmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D 197*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 0K 0O 0S 1G 1K 1O 1S 2G 2K 2O 2S 0H 0L 0P 0T) 198*dfc6aa5cSAndroid Build Coastguard Worker vpslldq ymmG, ymmG, 8 ; ymmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B 199*dfc6aa5cSAndroid Build Coastguard Worker ; 04 0C 14 1C 24 2C 05 0D 2I 2Q 0J 0R 1J 1R 2J 2R) 200*dfc6aa5cSAndroid Build Coastguard Worker 201*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmD, ymmD, ymmF ; ymmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E 202*dfc6aa5cSAndroid Build Coastguard Worker ; 1H 1L 1P 1T 2H 2L 2P 2T 0I 0M 0Q 0U 1I 1M 1Q 1U) 203*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmG, ymmG, ymmF ; ymmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 204*dfc6aa5cSAndroid Build Coastguard Worker ; 2I 2M 2Q 2U 0J 0N 0R 0V 1J 1N 1R 1V 2J 2N 2R 2V) 205*dfc6aa5cSAndroid Build Coastguard Worker 206*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmE, ymmA 207*dfc6aa5cSAndroid Build Coastguard Worker vpslldq ymmA, ymmA, 8 ; ymmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C 208*dfc6aa5cSAndroid Build Coastguard Worker ; 20 24 28 2C 01 05 09 0D 0G 0K 0O 0S 1G 1K 1O 1S) 209*dfc6aa5cSAndroid Build Coastguard Worker vpsrldq ymmE, ymmE, 8 ; ymmE=(20 24 28 2C 01 05 09 0D 0G 0K 0O 0S 1G 1K 1O 1S 210*dfc6aa5cSAndroid Build Coastguard Worker ; 2G 2K 2O 2S 0H 0L 0P 0T -- -- -- -- -- -- -- --) 211*dfc6aa5cSAndroid Build Coastguard Worker 212*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmA, ymmA, ymmD ; ymmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E 213*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 0I 0K 0M 0O 0Q 0S 0U 1G 1I 1K 1M 1O 1Q 1S 1U) 214*dfc6aa5cSAndroid Build Coastguard Worker vpslldq ymmD, ymmD, 8 ; ymmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D 215*dfc6aa5cSAndroid Build Coastguard Worker ; 02 06 0A 0E 12 16 1A 1E 1H 1L 1P 1T 2H 2L 2P 2T) 216*dfc6aa5cSAndroid Build Coastguard Worker 217*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmE, ymmE, ymmG ; ymmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F 218*dfc6aa5cSAndroid Build Coastguard Worker ; 2G 2I 2K 2M 2O 2Q 2S 2U 0H 0J 0L 0N 0P 0R 0T 0V) 219*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmD, ymmD, ymmG ; ymmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F 220*dfc6aa5cSAndroid Build Coastguard Worker ; 1H 1J 1L 1N 1P 1R 1T 1V 2H 2J 2L 2N 2P 2R 2T 2V) 221*dfc6aa5cSAndroid Build Coastguard Worker 222*dfc6aa5cSAndroid Build Coastguard Worker vpxor ymmH, ymmH, ymmH 223*dfc6aa5cSAndroid Build Coastguard Worker 224*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmC, ymmA 225*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmA, ymmA, ymmH ; ymmA=(00 02 04 06 08 0A 0C 0E 0G 0I 0K 0M 0O 0Q 0S 0U) 226*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmC, ymmC, ymmH ; ymmC=(10 12 14 16 18 1A 1C 1E 1G 1I 1K 1M 1O 1Q 1S 1U) 227*dfc6aa5cSAndroid Build Coastguard Worker 228*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmB, ymmE 229*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmE, ymmE, ymmH ; ymmE=(20 22 24 26 28 2A 2C 2E 2G 2I 2K 2M 2O 2Q 2S 2U) 230*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmB, ymmB, ymmH ; ymmB=(01 03 05 07 09 0B 0D 0F 0H 0J 0L 0N 0P 0R 0T 0V) 231*dfc6aa5cSAndroid Build Coastguard Worker 232*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmF, ymmD 233*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmD, ymmD, ymmH ; ymmD=(11 13 15 17 19 1B 1D 1F 1H 1J 1L 1N 1P 1R 1T 1V) 234*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmF, ymmF, ymmH ; ymmF=(21 23 25 27 29 2B 2D 2F 2H 2J 2L 2N 2P 2R 2T 2V) 235*dfc6aa5cSAndroid Build Coastguard Worker 236*dfc6aa5cSAndroid Build Coastguard Worker%else ; RGB_PIXELSIZE == 4 ; ----------- 237*dfc6aa5cSAndroid Build Coastguard Worker 238*dfc6aa5cSAndroid Build Coastguard Worker.column_ld1: 239*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_XMMWORD/16 240*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld2 241*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_XMMWORD/16 242*dfc6aa5cSAndroid Build Coastguard Worker vmovd xmmA, XMM_DWORD [esi+ecx*RGB_PIXELSIZE] 243*dfc6aa5cSAndroid Build Coastguard Worker.column_ld2: 244*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_XMMWORD/8 245*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld4 246*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_XMMWORD/8 247*dfc6aa5cSAndroid Build Coastguard Worker vmovq xmmF, XMM_MMWORD [esi+ecx*RGB_PIXELSIZE] 248*dfc6aa5cSAndroid Build Coastguard Worker vpslldq xmmA, xmmA, SIZEOF_MMWORD 249*dfc6aa5cSAndroid Build Coastguard Worker vpor xmmA, xmmA, xmmF 250*dfc6aa5cSAndroid Build Coastguard Worker.column_ld4: 251*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_XMMWORD/4 252*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld8 253*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_XMMWORD/4 254*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa xmmF, xmmA 255*dfc6aa5cSAndroid Build Coastguard Worker vperm2i128 ymmF, ymmF, ymmF, 1 256*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE] 257*dfc6aa5cSAndroid Build Coastguard Worker vpor ymmA, ymmA, ymmF 258*dfc6aa5cSAndroid Build Coastguard Worker.column_ld8: 259*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_XMMWORD/2 260*dfc6aa5cSAndroid Build Coastguard Worker jz short .column_ld16 261*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_XMMWORD/2 262*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmF, ymmA 263*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmA, YMMWORD [esi+ecx*RGB_PIXELSIZE] 264*dfc6aa5cSAndroid Build Coastguard Worker.column_ld16: 265*dfc6aa5cSAndroid Build Coastguard Worker test cl, SIZEOF_XMMWORD 266*dfc6aa5cSAndroid Build Coastguard Worker mov ecx, SIZEOF_YMMWORD 267*dfc6aa5cSAndroid Build Coastguard Worker jz short .rgb_gray_cnv 268*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmE, ymmA 269*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmH, ymmF 270*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmA, YMMWORD [esi+0*SIZEOF_YMMWORD] 271*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmF, YMMWORD [esi+1*SIZEOF_YMMWORD] 272*dfc6aa5cSAndroid Build Coastguard Worker jmp short .rgb_gray_cnv 273*dfc6aa5cSAndroid Build Coastguard Worker alignx 16, 7 274*dfc6aa5cSAndroid Build Coastguard Worker 275*dfc6aa5cSAndroid Build Coastguard Worker.columnloop: 276*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmA, YMMWORD [esi+0*SIZEOF_YMMWORD] 277*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmF, YMMWORD [esi+1*SIZEOF_YMMWORD] 278*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmE, YMMWORD [esi+2*SIZEOF_YMMWORD] 279*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu ymmH, YMMWORD [esi+3*SIZEOF_YMMWORD] 280*dfc6aa5cSAndroid Build Coastguard Worker 281*dfc6aa5cSAndroid Build Coastguard Worker.rgb_gray_cnv: 282*dfc6aa5cSAndroid Build Coastguard Worker ; ymmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33 283*dfc6aa5cSAndroid Build Coastguard Worker ; 04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37) 284*dfc6aa5cSAndroid Build Coastguard Worker ; ymmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B 285*dfc6aa5cSAndroid Build Coastguard Worker ; 0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F) 286*dfc6aa5cSAndroid Build Coastguard Worker ; ymmE=(0G 1G 2G 3G 0H 1H 2H 3H 0I 1I 2I 3I 0J 1J 2J 3J 287*dfc6aa5cSAndroid Build Coastguard Worker ; 0K 1K 2K 3K 0L 1L 2L 3L 0M 1M 2M 3M 0N 1N 2N 3N) 288*dfc6aa5cSAndroid Build Coastguard Worker ; ymmH=(0O 1O 2O 3O 0P 1P 2P 3P 0Q 1Q 2Q 3Q 0R 1R 2R 3R 289*dfc6aa5cSAndroid Build Coastguard Worker ; 0S 1S 2S 3S 0T 1T 2T 3T 0U 1U 2U 3U 0V 1V 2V 3V) 290*dfc6aa5cSAndroid Build Coastguard Worker 291*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmB, ymmA 292*dfc6aa5cSAndroid Build Coastguard Worker vinserti128 ymmA, ymmA, xmmE, 1 ; ymmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33 293*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 1G 2G 3G 0H 1H 2H 3H 0I 1I 2I 3I 0J 1J 2J 3J) 294*dfc6aa5cSAndroid Build Coastguard Worker vperm2i128 ymmE, ymmB, ymmE, 0x31 ; ymmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37 295*dfc6aa5cSAndroid Build Coastguard Worker ; 0K 1K 2K 3K 0L 1L 2L 3L 0M 1M 2M 3M 0N 1N 2N 3N) 296*dfc6aa5cSAndroid Build Coastguard Worker 297*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmB, ymmF 298*dfc6aa5cSAndroid Build Coastguard Worker vinserti128 ymmF, ymmF, xmmH, 1 ; ymmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B 299*dfc6aa5cSAndroid Build Coastguard Worker ; 0O 1O 2O 3O 0P 1P 2P 3P 0Q 1Q 2Q 3Q 0R 1R 2R 3R) 300*dfc6aa5cSAndroid Build Coastguard Worker vperm2i128 ymmH, ymmB, ymmH, 0x31 ; ymmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F 301*dfc6aa5cSAndroid Build Coastguard Worker ; 0S 1S 2S 3S 0T 1T 2T 3T 0U 1U 2U 3U 0V 1V 2V 3V) 302*dfc6aa5cSAndroid Build Coastguard Worker 303*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmD, ymmA 304*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmA, ymmA, ymmE ; ymmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35 305*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 0K 1G 1K 2G 2K 3G 3K 0H 0L 1H 1L 2H 2L 3H 3L) 306*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmD, ymmD, ymmE ; ymmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37 307*dfc6aa5cSAndroid Build Coastguard Worker ; 0I 0M 1I 1M 2I 2M 3I 3M 0J 0N 1J 1N 2J 2N 3J 3N) 308*dfc6aa5cSAndroid Build Coastguard Worker 309*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmC, ymmF 310*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmF, ymmF, ymmH ; ymmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D 311*dfc6aa5cSAndroid Build Coastguard Worker ; 0O 0S 1O 1S 2O 2S 3O 3S 0P 0T 1P 1T 2P 2T 3P 3T) 312*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmC, ymmC, ymmH ; ymmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F 313*dfc6aa5cSAndroid Build Coastguard Worker ; 0Q 0U 1Q 1U 2Q 2U 3Q 3U 0R 0V 1R 1V 2R 2V 3R 3V) 314*dfc6aa5cSAndroid Build Coastguard Worker 315*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmB, ymmA 316*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklwd ymmA, ymmA, ymmF ; ymmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C 317*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 0K 0O 0S 1G 1K 1O 1S 2G 2K 2O 2S 3G 3K 3O 3S) 318*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhwd ymmB, ymmB, ymmF ; ymmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D 319*dfc6aa5cSAndroid Build Coastguard Worker ; 0H 0L 0P 0T 1H 1L 1P 1T 2H 2L 2P 2T 3H 3L 3P 3T) 320*dfc6aa5cSAndroid Build Coastguard Worker 321*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmG, ymmD 322*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklwd ymmD, ymmD, ymmC ; ymmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E 323*dfc6aa5cSAndroid Build Coastguard Worker ; 0I 0M 0Q 0U 1I 1M 1Q 1U 2I 2M 2Q 2U 3I 3M 3Q 3U) 324*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhwd ymmG, ymmG, ymmC ; ymmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F 325*dfc6aa5cSAndroid Build Coastguard Worker ; 0J 0N 0R 0V 1J 1N 1R 1V 2J 2N 2R 2V 3J 3N 3R 3V) 326*dfc6aa5cSAndroid Build Coastguard Worker 327*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmE, ymmA 328*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmA, ymmA, ymmD ; ymmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E 329*dfc6aa5cSAndroid Build Coastguard Worker ; 0G 0I 0K 0M 0O 0Q 0S 0U 1G 1I 1K 1M 1O 1Q 1S 1U) 330*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmE, ymmE, ymmD ; ymmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E 331*dfc6aa5cSAndroid Build Coastguard Worker ; 2G 2I 2K 2M 2O 2Q 2S 2U 3G 3I 3K 3M 3O 3Q 3S 3U) 332*dfc6aa5cSAndroid Build Coastguard Worker 333*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmH, ymmB 334*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmB, ymmB, ymmG ; ymmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F 335*dfc6aa5cSAndroid Build Coastguard Worker ; 0H 0J 0L 0N 0P 0R 0T 0V 1H 1J 1L 1N 1P 1R 1T 1V) 336*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmH, ymmH, ymmG ; ymmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F 337*dfc6aa5cSAndroid Build Coastguard Worker ; 2H 2J 2L 2N 2P 2R 2T 2V 3H 3J 3L 3N 3P 3R 3T 3V) 338*dfc6aa5cSAndroid Build Coastguard Worker 339*dfc6aa5cSAndroid Build Coastguard Worker vpxor ymmF, ymmF, ymmF 340*dfc6aa5cSAndroid Build Coastguard Worker 341*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmC, ymmA 342*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmA, ymmA, ymmF ; ymmA=(00 02 04 06 08 0A 0C 0E 0G 0I 0K 0M 0O 0Q 0S 0U) 343*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmC, ymmC, ymmF ; ymmC=(10 12 14 16 18 1A 1C 1E 1G 1I 1K 1M 1O 1Q 1S 1U) 344*dfc6aa5cSAndroid Build Coastguard Worker 345*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmD, ymmB 346*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmB, ymmB, ymmF ; ymmB=(01 03 05 07 09 0B 0D 0F 0H 0J 0L 0N 0P 0R 0T 0V) 347*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmD, ymmD, ymmF ; ymmD=(11 13 15 17 19 1B 1D 1F 1H 1J 1L 1N 1P 1R 1T 1V) 348*dfc6aa5cSAndroid Build Coastguard Worker 349*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymmG, ymmE 350*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmE, ymmE, ymmF ; ymmE=(20 22 24 26 28 2A 2C 2E 2G 2I 2K 2M 2O 2Q 2S 2U) 351*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmG, ymmG, ymmF ; ymmG=(30 32 34 36 38 3A 3C 3E 3G 3I 3K 3M 3O 3Q 3S 3U) 352*dfc6aa5cSAndroid Build Coastguard Worker 353*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklbw ymmF, ymmF, ymmH 354*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhbw ymmH, ymmH, ymmH 355*dfc6aa5cSAndroid Build Coastguard Worker vpsrlw ymmF, ymmF, BYTE_BIT ; ymmF=(21 23 25 27 29 2B 2D 2F 2H 2J 2L 2N 2P 2R 2T 2V) 356*dfc6aa5cSAndroid Build Coastguard Worker vpsrlw ymmH, ymmH, BYTE_BIT ; ymmH=(31 33 35 37 39 3B 3D 3F 3H 3J 3L 3N 3P 3R 3T 3V) 357*dfc6aa5cSAndroid Build Coastguard Worker 358*dfc6aa5cSAndroid Build Coastguard Worker%endif ; RGB_PIXELSIZE ; --------------- 359*dfc6aa5cSAndroid Build Coastguard Worker 360*dfc6aa5cSAndroid Build Coastguard Worker ; ymm0=R(02468ACEGIKMOQSU)=RE, ymm2=G(02468ACEGIKMOQSU)=GE, ymm4=B(02468ACEGIKMOQSU)=BE 361*dfc6aa5cSAndroid Build Coastguard Worker ; ymm1=R(13579BDFHJLNPRTV)=RO, ymm3=G(13579BDFHJLNPRTV)=GO, ymm5=B(13579BDFHJLNPRTV)=BO 362*dfc6aa5cSAndroid Build Coastguard Worker 363*dfc6aa5cSAndroid Build Coastguard Worker ; (Original) 364*dfc6aa5cSAndroid Build Coastguard Worker ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B 365*dfc6aa5cSAndroid Build Coastguard Worker ; 366*dfc6aa5cSAndroid Build Coastguard Worker ; (This implementation) 367*dfc6aa5cSAndroid Build Coastguard Worker ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G 368*dfc6aa5cSAndroid Build Coastguard Worker 369*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm6, ymm1 370*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklwd ymm1, ymm1, ymm3 371*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhwd ymm6, ymm6, ymm3 372*dfc6aa5cSAndroid Build Coastguard Worker vpmaddwd ymm1, ymm1, [GOTOFF(eax,PW_F0299_F0337)] ; ymm1=ROL*FIX(0.299)+GOL*FIX(0.337) 373*dfc6aa5cSAndroid Build Coastguard Worker vpmaddwd ymm6, ymm6, [GOTOFF(eax,PW_F0299_F0337)] ; ymm6=ROH*FIX(0.299)+GOH*FIX(0.337) 374*dfc6aa5cSAndroid Build Coastguard Worker 375*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm7, ymm6 ; ymm7=ROH*FIX(0.299)+GOH*FIX(0.337) 376*dfc6aa5cSAndroid Build Coastguard Worker 377*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm6, ymm0 378*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklwd ymm0, ymm0, ymm2 379*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhwd ymm6, ymm6, ymm2 380*dfc6aa5cSAndroid Build Coastguard Worker vpmaddwd ymm0, ymm0, [GOTOFF(eax,PW_F0299_F0337)] ; ymm0=REL*FIX(0.299)+GEL*FIX(0.337) 381*dfc6aa5cSAndroid Build Coastguard Worker vpmaddwd ymm6, ymm6, [GOTOFF(eax,PW_F0299_F0337)] ; ymm6=REH*FIX(0.299)+GEH*FIX(0.337) 382*dfc6aa5cSAndroid Build Coastguard Worker 383*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa YMMWORD [wk(0)], ymm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337) 384*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa YMMWORD [wk(1)], ymm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337) 385*dfc6aa5cSAndroid Build Coastguard Worker 386*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm0, ymm5 ; ymm0=BO 387*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm6, ymm4 ; ymm6=BE 388*dfc6aa5cSAndroid Build Coastguard Worker 389*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm4, ymm0 390*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklwd ymm0, ymm0, ymm3 391*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhwd ymm4, ymm4, ymm3 392*dfc6aa5cSAndroid Build Coastguard Worker vpmaddwd ymm0, ymm0, [GOTOFF(eax,PW_F0114_F0250)] ; ymm0=BOL*FIX(0.114)+GOL*FIX(0.250) 393*dfc6aa5cSAndroid Build Coastguard Worker vpmaddwd ymm4, ymm4, [GOTOFF(eax,PW_F0114_F0250)] ; ymm4=BOH*FIX(0.114)+GOH*FIX(0.250) 394*dfc6aa5cSAndroid Build Coastguard Worker 395*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm3, [GOTOFF(eax,PD_ONEHALF)] ; ymm3=[PD_ONEHALF] 396*dfc6aa5cSAndroid Build Coastguard Worker 397*dfc6aa5cSAndroid Build Coastguard Worker vpaddd ymm0, ymm0, ymm1 398*dfc6aa5cSAndroid Build Coastguard Worker vpaddd ymm4, ymm4, ymm7 399*dfc6aa5cSAndroid Build Coastguard Worker vpaddd ymm0, ymm0, ymm3 400*dfc6aa5cSAndroid Build Coastguard Worker vpaddd ymm4, ymm4, ymm3 401*dfc6aa5cSAndroid Build Coastguard Worker vpsrld ymm0, ymm0, SCALEBITS ; ymm0=YOL 402*dfc6aa5cSAndroid Build Coastguard Worker vpsrld ymm4, ymm4, SCALEBITS ; ymm4=YOH 403*dfc6aa5cSAndroid Build Coastguard Worker vpackssdw ymm0, ymm0, ymm4 ; ymm0=YO 404*dfc6aa5cSAndroid Build Coastguard Worker 405*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm4, ymm6 406*dfc6aa5cSAndroid Build Coastguard Worker vpunpcklwd ymm6, ymm6, ymm2 407*dfc6aa5cSAndroid Build Coastguard Worker vpunpckhwd ymm4, ymm4, ymm2 408*dfc6aa5cSAndroid Build Coastguard Worker vpmaddwd ymm6, ymm6, [GOTOFF(eax,PW_F0114_F0250)] ; ymm6=BEL*FIX(0.114)+GEL*FIX(0.250) 409*dfc6aa5cSAndroid Build Coastguard Worker vpmaddwd ymm4, ymm4, [GOTOFF(eax,PW_F0114_F0250)] ; ymm4=BEH*FIX(0.114)+GEH*FIX(0.250) 410*dfc6aa5cSAndroid Build Coastguard Worker 411*dfc6aa5cSAndroid Build Coastguard Worker vmovdqa ymm2, [GOTOFF(eax,PD_ONEHALF)] ; ymm2=[PD_ONEHALF] 412*dfc6aa5cSAndroid Build Coastguard Worker 413*dfc6aa5cSAndroid Build Coastguard Worker vpaddd ymm6, ymm6, YMMWORD [wk(0)] 414*dfc6aa5cSAndroid Build Coastguard Worker vpaddd ymm4, ymm4, YMMWORD [wk(1)] 415*dfc6aa5cSAndroid Build Coastguard Worker vpaddd ymm6, ymm6, ymm2 416*dfc6aa5cSAndroid Build Coastguard Worker vpaddd ymm4, ymm4, ymm2 417*dfc6aa5cSAndroid Build Coastguard Worker vpsrld ymm6, ymm6, SCALEBITS ; ymm6=YEL 418*dfc6aa5cSAndroid Build Coastguard Worker vpsrld ymm4, ymm4, SCALEBITS ; ymm4=YEH 419*dfc6aa5cSAndroid Build Coastguard Worker vpackssdw ymm6, ymm6, ymm4 ; ymm6=YE 420*dfc6aa5cSAndroid Build Coastguard Worker 421*dfc6aa5cSAndroid Build Coastguard Worker vpsllw ymm0, ymm0, BYTE_BIT 422*dfc6aa5cSAndroid Build Coastguard Worker vpor ymm6, ymm6, ymm0 ; ymm6=Y 423*dfc6aa5cSAndroid Build Coastguard Worker vmovdqu YMMWORD [edi], ymm6 ; Save Y 424*dfc6aa5cSAndroid Build Coastguard Worker 425*dfc6aa5cSAndroid Build Coastguard Worker sub ecx, byte SIZEOF_YMMWORD 426*dfc6aa5cSAndroid Build Coastguard Worker add esi, RGB_PIXELSIZE*SIZEOF_YMMWORD ; inptr 427*dfc6aa5cSAndroid Build Coastguard Worker add edi, byte SIZEOF_YMMWORD ; outptr0 428*dfc6aa5cSAndroid Build Coastguard Worker cmp ecx, byte SIZEOF_YMMWORD 429*dfc6aa5cSAndroid Build Coastguard Worker jae near .columnloop 430*dfc6aa5cSAndroid Build Coastguard Worker test ecx, ecx 431*dfc6aa5cSAndroid Build Coastguard Worker jnz near .column_ld1 432*dfc6aa5cSAndroid Build Coastguard Worker 433*dfc6aa5cSAndroid Build Coastguard Worker pop ecx ; col 434*dfc6aa5cSAndroid Build Coastguard Worker pop esi 435*dfc6aa5cSAndroid Build Coastguard Worker pop edi 436*dfc6aa5cSAndroid Build Coastguard Worker poppic eax 437*dfc6aa5cSAndroid Build Coastguard Worker 438*dfc6aa5cSAndroid Build Coastguard Worker add esi, byte SIZEOF_JSAMPROW ; input_buf 439*dfc6aa5cSAndroid Build Coastguard Worker add edi, byte SIZEOF_JSAMPROW 440*dfc6aa5cSAndroid Build Coastguard Worker dec eax ; num_rows 441*dfc6aa5cSAndroid Build Coastguard Worker jg near .rowloop 442*dfc6aa5cSAndroid Build Coastguard Worker 443*dfc6aa5cSAndroid Build Coastguard Worker.return: 444*dfc6aa5cSAndroid Build Coastguard Worker vzeroupper 445*dfc6aa5cSAndroid Build Coastguard Worker pop edi 446*dfc6aa5cSAndroid Build Coastguard Worker pop esi 447*dfc6aa5cSAndroid Build Coastguard Worker; pop edx ; need not be preserved 448*dfc6aa5cSAndroid Build Coastguard Worker; pop ecx ; need not be preserved 449*dfc6aa5cSAndroid Build Coastguard Worker pop ebx 450*dfc6aa5cSAndroid Build Coastguard Worker mov esp, ebp ; esp <- aligned ebp 451*dfc6aa5cSAndroid Build Coastguard Worker pop esp ; esp <- original ebp 452*dfc6aa5cSAndroid Build Coastguard Worker pop ebp 453*dfc6aa5cSAndroid Build Coastguard Worker ret 454*dfc6aa5cSAndroid Build Coastguard Worker 455*dfc6aa5cSAndroid Build Coastguard Worker; For some reason, the OS X linker does not honor the request to align the 456*dfc6aa5cSAndroid Build Coastguard Worker; segment unless we do this. 457*dfc6aa5cSAndroid Build Coastguard Worker align 32 458