|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; jdcolext.asm - colorspace conversion (AVX2)
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; Copyright 2009, 2012 Pierre Ossman <ossman@cendio.se> for Cendio AB</ossman@cendio.se>
|
|
shun-iwasawa |
82a8f5 |
; Copyright (C) 2012, 2016, D. R. Commander.
|
|
shun-iwasawa |
82a8f5 |
; Copyright (C) 2015, Intel Corporation.
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; Based on the x86 SIMD extension for IJG JPEG library
|
|
shun-iwasawa |
82a8f5 |
; Copyright (C) 1999-2006, MIYASAKA Masaru.
|
|
shun-iwasawa |
82a8f5 |
; For conditions of distribution and use, see copyright notice in jsimdext.inc
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; This file should be assembled with NASM (Netwide Assembler),
|
|
shun-iwasawa |
82a8f5 |
; can *not* be assembled with Microsoft's MASM or any compatible
|
|
shun-iwasawa |
82a8f5 |
; assembler (including Borland's Turbo Assembler).
|
|
shun-iwasawa |
82a8f5 |
; NASM is available from http://nasm.sourceforge.net/ or
|
|
shun-iwasawa |
82a8f5 |
; http://sourceforge.net/project/showfiles.php?group_id=6208
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%include "jcolsamp.inc"
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; --------------------------------------------------------------------------
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; Convert some rows of samples to the output colorspace.
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; GLOBAL(void)
|
|
shun-iwasawa |
82a8f5 |
; jsimd_ycc_rgb_convert_avx2(JDIMENSION out_width, JSAMPIMAGE input_buf,
|
|
shun-iwasawa |
82a8f5 |
; JDIMENSION input_row, JSAMPARRAY output_buf,
|
|
shun-iwasawa |
82a8f5 |
; int num_rows)
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%define out_width(b) (b) + 8 ; JDIMENSION out_width
|
|
shun-iwasawa |
82a8f5 |
%define input_buf(b) (b) + 12 ; JSAMPIMAGE input_buf
|
|
shun-iwasawa |
82a8f5 |
%define input_row(b) (b) + 16 ; JDIMENSION input_row
|
|
shun-iwasawa |
82a8f5 |
%define output_buf(b) (b) + 20 ; JSAMPARRAY output_buf
|
|
shun-iwasawa |
82a8f5 |
%define num_rows(b) (b) + 24 ; int num_rows
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%define original_ebp ebp + 0
|
|
shun-iwasawa |
82a8f5 |
%define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
; ymmword wk[WK_NUM]
|
|
shun-iwasawa |
82a8f5 |
%define WK_NUM 2
|
|
shun-iwasawa |
82a8f5 |
%define gotptr wk(0) - SIZEOF_POINTER ; void * gotptr
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
align 32
|
|
shun-iwasawa |
82a8f5 |
GLOBAL_FUNCTION(jsimd_ycc_rgb_convert_avx2)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
EXTN(jsimd_ycc_rgb_convert_avx2):
|
|
shun-iwasawa |
82a8f5 |
push ebp
|
|
shun-iwasawa |
82a8f5 |
mov eax, esp ; eax = original ebp
|
|
shun-iwasawa |
82a8f5 |
sub esp, byte 4
|
|
shun-iwasawa |
82a8f5 |
and esp, byte (-SIZEOF_YMMWORD) ; align to 256 bits
|
|
shun-iwasawa |
82a8f5 |
mov [esp], eax
|
|
shun-iwasawa |
82a8f5 |
mov ebp, esp ; ebp = aligned ebp
|
|
shun-iwasawa |
82a8f5 |
lea esp, [wk(0)]
|
|
shun-iwasawa |
82a8f5 |
pushpic eax ; make a room for GOT address
|
|
shun-iwasawa |
82a8f5 |
push ebx
|
|
shun-iwasawa |
82a8f5 |
; push ecx ; need not be preserved
|
|
shun-iwasawa |
82a8f5 |
; push edx ; need not be preserved
|
|
shun-iwasawa |
82a8f5 |
push esi
|
|
shun-iwasawa |
82a8f5 |
push edi
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
get_GOT ebx ; get GOT address
|
|
shun-iwasawa |
82a8f5 |
movpic POINTER [gotptr], ebx ; save GOT address
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov ecx, JDIMENSION [out_width(eax)] ; num_cols
|
|
shun-iwasawa |
82a8f5 |
test ecx, ecx
|
|
shun-iwasawa |
82a8f5 |
jz near .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
push ecx
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPIMAGE [input_buf(eax)]
|
|
shun-iwasawa |
82a8f5 |
mov ecx, JDIMENSION [input_row(eax)]
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPARRAY [edi+0*SIZEOF_JSAMPARRAY]
|
|
shun-iwasawa |
82a8f5 |
mov ebx, JSAMPARRAY [edi+1*SIZEOF_JSAMPARRAY]
|
|
shun-iwasawa |
82a8f5 |
mov edx, JSAMPARRAY [edi+2*SIZEOF_JSAMPARRAY]
|
|
shun-iwasawa |
82a8f5 |
lea esi, [esi+ecx*SIZEOF_JSAMPROW]
|
|
shun-iwasawa |
82a8f5 |
lea ebx, [ebx+ecx*SIZEOF_JSAMPROW]
|
|
shun-iwasawa |
82a8f5 |
lea edx, [edx+ecx*SIZEOF_JSAMPROW]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pop ecx
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPARRAY [output_buf(eax)]
|
|
shun-iwasawa |
82a8f5 |
mov eax, INT [num_rows(eax)]
|
|
shun-iwasawa |
82a8f5 |
test eax, eax
|
|
shun-iwasawa |
82a8f5 |
jle near .return
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
.rowloop:
|
|
shun-iwasawa |
82a8f5 |
push eax
|
|
shun-iwasawa |
82a8f5 |
push edi
|
|
shun-iwasawa |
82a8f5 |
push edx
|
|
shun-iwasawa |
82a8f5 |
push ebx
|
|
shun-iwasawa |
82a8f5 |
push esi
|
|
shun-iwasawa |
82a8f5 |
push ecx ; col
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPROW [esi] ; inptr0
|
|
shun-iwasawa |
82a8f5 |
mov ebx, JSAMPROW [ebx] ; inptr1
|
|
shun-iwasawa |
82a8f5 |
mov edx, JSAMPROW [edx] ; inptr2
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPROW [edi] ; outptr
|
|
shun-iwasawa |
82a8f5 |
movpic eax, POINTER [gotptr] ; load GOT address (eax)
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
.columnloop:
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vmovdqu ymm5, YMMWORD [ebx] ; ymm5=Cb(0123456789ABCDEFGHIJKLMNOPQRSTUV)
|
|
shun-iwasawa |
82a8f5 |
vmovdqu ymm1, YMMWORD [edx] ; ymm1=Cr(0123456789ABCDEFGHIJKLMNOPQRSTUV)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpcmpeqw ymm0, ymm0, ymm0
|
|
shun-iwasawa |
82a8f5 |
vpcmpeqw ymm7, ymm7, ymm7
|
|
shun-iwasawa |
82a8f5 |
vpsrlw ymm0, ymm0, BYTE_BIT ; ymm0={0xFF 0x00 0xFF 0x00 ..}
|
|
shun-iwasawa |
82a8f5 |
vpsllw ymm7, ymm7, 7 ; ymm7={0xFF80 0xFF80 0xFF80 0xFF80 ..}
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpand ymm4, ymm0, ymm5 ; ymm4=Cb(02468ACEGIKMOQSU)=CbE
|
|
shun-iwasawa |
82a8f5 |
vpsrlw ymm5, ymm5, BYTE_BIT ; ymm5=Cb(13579BDFHJLNPRTV)=CbO
|
|
shun-iwasawa |
82a8f5 |
vpand ymm0, ymm0, ymm1 ; ymm0=Cr(02468ACEGIKMOQSU)=CrE
|
|
shun-iwasawa |
82a8f5 |
vpsrlw ymm1, ymm1, BYTE_BIT ; ymm1=Cr(13579BDFHJLNPRTV)=CrO
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm2, ymm4, ymm7
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm3, ymm5, ymm7
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm6, ymm0, ymm7
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm7, ymm1, ymm7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; (Original)
|
|
shun-iwasawa |
82a8f5 |
; R = Y + 1.40200 * Cr
|
|
shun-iwasawa |
82a8f5 |
; G = Y - 0.34414 * Cb - 0.71414 * Cr
|
|
shun-iwasawa |
82a8f5 |
; B = Y + 1.77200 * Cb
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; (This implementation)
|
|
shun-iwasawa |
82a8f5 |
; R = Y + 0.40200 * Cr + Cr
|
|
shun-iwasawa |
82a8f5 |
; G = Y - 0.34414 * Cb + 0.28586 * Cr - Cr
|
|
shun-iwasawa |
82a8f5 |
; B = Y - 0.22800 * Cb + Cb + Cb
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm4, ymm2, ymm2 ; ymm4=2*CbE
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm5, ymm3, ymm3 ; ymm5=2*CbO
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm0, ymm6, ymm6 ; ymm0=2*CrE
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm1, ymm7, ymm7 ; ymm1=2*CrO
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpmulhw ymm4, ymm4, [GOTOFF(eax,PW_MF0228)] ; ymm4=(2*CbE * -FIX(0.22800))
|
|
shun-iwasawa |
82a8f5 |
vpmulhw ymm5, ymm5, [GOTOFF(eax,PW_MF0228)] ; ymm5=(2*CbO * -FIX(0.22800))
|
|
shun-iwasawa |
82a8f5 |
vpmulhw ymm0, ymm0, [GOTOFF(eax,PW_F0402)] ; ymm0=(2*CrE * FIX(0.40200))
|
|
shun-iwasawa |
82a8f5 |
vpmulhw ymm1, ymm1, [GOTOFF(eax,PW_F0402)] ; ymm1=(2*CrO * FIX(0.40200))
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm4, ymm4, [GOTOFF(eax,PW_ONE)]
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm5, ymm5, [GOTOFF(eax,PW_ONE)]
|
|
shun-iwasawa |
82a8f5 |
vpsraw ymm4, ymm4, 1 ; ymm4=(CbE * -FIX(0.22800))
|
|
shun-iwasawa |
82a8f5 |
vpsraw ymm5, ymm5, 1 ; ymm5=(CbO * -FIX(0.22800))
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm0, ymm0, [GOTOFF(eax,PW_ONE)]
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm1, ymm1, [GOTOFF(eax,PW_ONE)]
|
|
shun-iwasawa |
82a8f5 |
vpsraw ymm0, ymm0, 1 ; ymm0=(CrE * FIX(0.40200))
|
|
shun-iwasawa |
82a8f5 |
vpsraw ymm1, ymm1, 1 ; ymm1=(CrO * FIX(0.40200))
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm4, ymm4, ymm2
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm5, ymm5, ymm3
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm4, ymm4, ymm2 ; ymm4=(CbE * FIX(1.77200))=(B-Y)E
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm5, ymm5, ymm3 ; ymm5=(CbO * FIX(1.77200))=(B-Y)O
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm0, ymm0, ymm6 ; ymm0=(CrE * FIX(1.40200))=(R-Y)E
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm1, ymm1, ymm7 ; ymm1=(CrO * FIX(1.40200))=(R-Y)O
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vmovdqa YMMWORD [wk(0)], ymm4 ; wk(0)=(B-Y)E
|
|
shun-iwasawa |
82a8f5 |
vmovdqa YMMWORD [wk(1)], ymm5 ; wk(1)=(B-Y)O
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpunpckhwd ymm4, ymm2, ymm6
|
|
shun-iwasawa |
82a8f5 |
vpunpcklwd ymm2, ymm2, ymm6
|
|
shun-iwasawa |
82a8f5 |
vpmaddwd ymm2, ymm2, [GOTOFF(eax,PW_MF0344_F0285)]
|
|
shun-iwasawa |
82a8f5 |
vpmaddwd ymm4, ymm4, [GOTOFF(eax,PW_MF0344_F0285)]
|
|
shun-iwasawa |
82a8f5 |
vpunpckhwd ymm5, ymm3, ymm7
|
|
shun-iwasawa |
82a8f5 |
vpunpcklwd ymm3, ymm3, ymm7
|
|
shun-iwasawa |
82a8f5 |
vpmaddwd ymm3, ymm3, [GOTOFF(eax,PW_MF0344_F0285)]
|
|
shun-iwasawa |
82a8f5 |
vpmaddwd ymm5, ymm5, [GOTOFF(eax,PW_MF0344_F0285)]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpaddd ymm2, ymm2, [GOTOFF(eax,PD_ONEHALF)]
|
|
shun-iwasawa |
82a8f5 |
vpaddd ymm4, ymm4, [GOTOFF(eax,PD_ONEHALF)]
|
|
shun-iwasawa |
82a8f5 |
vpsrad ymm2, ymm2, SCALEBITS
|
|
shun-iwasawa |
82a8f5 |
vpsrad ymm4, ymm4, SCALEBITS
|
|
shun-iwasawa |
82a8f5 |
vpaddd ymm3, ymm3, [GOTOFF(eax,PD_ONEHALF)]
|
|
shun-iwasawa |
82a8f5 |
vpaddd ymm5, ymm5, [GOTOFF(eax,PD_ONEHALF)]
|
|
shun-iwasawa |
82a8f5 |
vpsrad ymm3, ymm3, SCALEBITS
|
|
shun-iwasawa |
82a8f5 |
vpsrad ymm5, ymm5, SCALEBITS
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpackssdw ymm2, ymm2, ymm4 ; ymm2=CbE*-FIX(0.344)+CrE*FIX(0.285)
|
|
shun-iwasawa |
82a8f5 |
vpackssdw ymm3, ymm3, ymm5 ; ymm3=CbO*-FIX(0.344)+CrO*FIX(0.285)
|
|
shun-iwasawa |
82a8f5 |
vpsubw ymm2, ymm2, ymm6 ; ymm2=CbE*-FIX(0.344)+CrE*-FIX(0.714)=(G-Y)E
|
|
shun-iwasawa |
82a8f5 |
vpsubw ymm3, ymm3, ymm7 ; ymm3=CbO*-FIX(0.344)+CrO*-FIX(0.714)=(G-Y)O
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vmovdqu ymm5, YMMWORD [esi] ; ymm5=Y(0123456789ABCDEFGHIJKLMNOPQRSTUV)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpcmpeqw ymm4, ymm4, ymm4
|
|
shun-iwasawa |
82a8f5 |
vpsrlw ymm4, ymm4, BYTE_BIT ; ymm4={0xFF 0x00 0xFF 0x00 ..}
|
|
shun-iwasawa |
82a8f5 |
vpand ymm4, ymm4, ymm5 ; ymm4=Y(02468ACEGIKMOQSU)=YE
|
|
shun-iwasawa |
82a8f5 |
vpsrlw ymm5, ymm5, BYTE_BIT ; ymm5=Y(13579BDFHJLNPRTV)=YO
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm0, ymm0, ymm4 ; ymm0=((R-Y)E+YE)=RE=R(02468ACEGIKMOQSU)
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm1, ymm1, ymm5 ; ymm1=((R-Y)O+YO)=RO=R(13579BDFHJLNPRTV)
|
|
shun-iwasawa |
82a8f5 |
vpackuswb ymm0, ymm0, ymm0 ; ymm0=R(02468ACE********GIKMOQSU********)
|
|
shun-iwasawa |
82a8f5 |
vpackuswb ymm1, ymm1, ymm1 ; ymm1=R(13579BDF********HJLNPRTV********)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm2, ymm2, ymm4 ; ymm2=((G-Y)E+YE)=GE=G(02468ACEGIKMOQSU)
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm3, ymm3, ymm5 ; ymm3=((G-Y)O+YO)=GO=G(13579BDFHJLNPRTV)
|
|
shun-iwasawa |
82a8f5 |
vpackuswb ymm2, ymm2, ymm2 ; ymm2=G(02468ACE********GIKMOQSU********)
|
|
shun-iwasawa |
82a8f5 |
vpackuswb ymm3, ymm3, ymm3 ; ymm3=G(13579BDF********HJLNPRTV********)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm4, ymm4, YMMWORD [wk(0)] ; ymm4=(YE+(B-Y)E)=BE=B(02468ACEGIKMOQSU)
|
|
shun-iwasawa |
82a8f5 |
vpaddw ymm5, ymm5, YMMWORD [wk(1)] ; ymm5=(YO+(B-Y)O)=BO=B(13579BDFHJLNPRTV)
|
|
shun-iwasawa |
82a8f5 |
vpackuswb ymm4, ymm4, ymm4 ; ymm4=B(02468ACE********GIKMOQSU********)
|
|
shun-iwasawa |
82a8f5 |
vpackuswb ymm5, ymm5, ymm5 ; ymm5=B(13579BDF********HJLNPRTV********)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%if RGB_PIXELSIZE == 3 ; ---------------
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; ymmA=(00 02 04 06 08 0A 0C 0E ** 0G 0I 0K 0M 0O 0Q 0S 0U **)
|
|
shun-iwasawa |
82a8f5 |
; ymmB=(01 03 05 07 09 0B 0D 0F ** 0H 0J 0L 0N 0P 0R 0T 0V **)
|
|
shun-iwasawa |
82a8f5 |
; ymmC=(10 12 14 16 18 1A 1C 1E ** 1G 1I 1K 1M 1O 1Q 1S 1U **)
|
|
shun-iwasawa |
82a8f5 |
; ymmD=(11 13 15 17 19 1B 1D 1F ** 1H 1J 1L 1N 1P 1R 1T 1V **)
|
|
shun-iwasawa |
82a8f5 |
; ymmE=(20 22 24 26 28 2A 2C 2E ** 2G 2I 2K 2M 2O 2Q 2S 2U **)
|
|
shun-iwasawa |
82a8f5 |
; ymmF=(21 23 25 27 29 2B 2D 2F ** 2H 2J 2L 2N 2P 2R 2T 2V **)
|
|
shun-iwasawa |
82a8f5 |
; ymmG=(** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **)
|
|
shun-iwasawa |
82a8f5 |
; ymmH=(** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpunpcklbw ymmA, ymmA, ymmC ; ymmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E
|
|
shun-iwasawa |
82a8f5 |
; 0G 1G 0I 1I 0K 1K 0M 1M 0O 1O 0Q 1Q 0S 1S 0U 1U)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklbw ymmE, ymmE, ymmB ; ymmE=(20 01 22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F
|
|
shun-iwasawa |
82a8f5 |
; 2G 0H 2I 0J 2K 0L 2M 0N 2O 0P 2Q 0R 2S 0T 2U 0V)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklbw ymmD, ymmD, ymmF ; ymmD=(11 21 13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F
|
|
shun-iwasawa |
82a8f5 |
; 1H 2H 1J 2J 1L 2L 1N 2N 1P 2P 1R 2R 1T 2T 1V 2V)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpsrldq ymmH, ymmA, 2 ; ymmH=(02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E 0G 1G
|
|
shun-iwasawa |
82a8f5 |
; 0I 1I 0K 1K 0M 1M 0O 1O 0Q 1Q 0S 1S 0U 1U -- --)
|
|
shun-iwasawa |
82a8f5 |
vpunpckhwd ymmG, ymmA, ymmE ; ymmG=(08 18 28 09 0A 1A 2A 0B 0C 1C 2C 0D 0E 1E 2E 0F
|
|
shun-iwasawa |
82a8f5 |
; 0O 1O 2O 0P 0Q 1Q 2Q 0R 0S 1S 2S 0T 0U 1U 2U 0V)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklwd ymmA, ymmA, ymmE ; ymmA=(00 10 20 01 02 12 22 03 04 14 24 05 06 16 26 07
|
|
shun-iwasawa |
82a8f5 |
; 0G 1G 2G 0H 0I 1I 2I 0J 0K 1K 2K 0L 0M 1M 2M 0N)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpsrldq ymmE, ymmE, 2 ; ymmE=(22 03 24 05 26 07 28 09 2A 0B 2C 0D 2E 0F 2G 0H
|
|
shun-iwasawa |
82a8f5 |
; 2I 0J 2K 0L 2M 0N 2O 0P 2Q 0R 2S 0T 2U 0V -- --)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpsrldq ymmB, ymmD, 2 ; ymmB=(13 23 15 25 17 27 19 29 1B 2B 1D 2D 1F 2F 1H 2H
|
|
shun-iwasawa |
82a8f5 |
; 1J 2J 1L 2L 1N 2N 1P 2P 1R 2R 1T 2T 1V 2V -- --)
|
|
shun-iwasawa |
82a8f5 |
vpunpckhwd ymmC, ymmD, ymmH ; ymmC=(19 29 0A 1A 1B 2B 0C 1C 1D 2D 0E 1E 1F 2F 0G 1G
|
|
shun-iwasawa |
82a8f5 |
; 1P 2P 0Q 1Q 1R 2R 0S 1S 1T 2T 0U 1U 1V 2V -- --)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklwd ymmD, ymmD, ymmH ; ymmD=(11 21 02 12 13 23 04 14 15 25 06 16 17 27 08 18
|
|
shun-iwasawa |
82a8f5 |
; 1H 2H 0I 1I 1J 2J 0K 1K 1L 2L 0M 1M 1N 2N 0O 1O)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpunpckhwd ymmF, ymmE, ymmB ; ymmF=(2A 0B 1B 2B 2C 0D 1D 2D 2E 0F 1F 2F 2G 0H 1H 2H
|
|
shun-iwasawa |
82a8f5 |
; 2Q 0R 1R 2R 2S 0T 1T 2T 2U 0V 1V 2V -- -- -- --)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklwd ymmE, ymmE, ymmB ; ymmE=(22 03 13 23 24 05 15 25 26 07 17 27 28 09 19 29
|
|
shun-iwasawa |
82a8f5 |
; 2I 0J 1J 2J 2K 0L 1L 2L 2M 0N 1N 2N 2O 0P 1P 2P)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpshufd ymmH, ymmA, 0x4E ; ymmH=(04 14 24 05 06 16 26 07 00 10 20 01 02 12 22 03
|
|
shun-iwasawa |
82a8f5 |
; 0K 1K 2K 0L 0M 1M 2M 0N 0G 1G 2G 0H 0I 1I 2I 0J)
|
|
shun-iwasawa |
82a8f5 |
vpunpckldq ymmA, ymmA, ymmD ; ymmA=(00 10 20 01 11 21 02 12 02 12 22 03 13 23 04 14
|
|
shun-iwasawa |
82a8f5 |
; 0G 1G 2G 0H 1H 2H 0I 1I 0I 1I 2I 0J 1J 2J 0K 1K)
|
|
shun-iwasawa |
82a8f5 |
vpunpckhdq ymmD, ymmD, ymmE ; ymmD=(15 25 06 16 26 07 17 27 17 27 08 18 28 09 19 29
|
|
shun-iwasawa |
82a8f5 |
; 1L 2L 0M 1M 2M 0N 1N 2N 1N 2N 0O 1O 2O 0P 1P 2P)
|
|
shun-iwasawa |
82a8f5 |
vpunpckldq ymmE, ymmE, ymmH ; ymmE=(22 03 13 23 04 14 24 05 24 05 15 25 06 16 26 07
|
|
shun-iwasawa |
82a8f5 |
; 2I 0J 1J 2J 0K 1K 2K 0L 2K 0L 1L 2L 0M 1M 2M 0N)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpshufd ymmH, ymmG, 0x4E ; ymmH=(0C 1C 2C 0D 0E 1E 2E 0F 08 18 28 09 0A 1A 2A 0B
|
|
shun-iwasawa |
82a8f5 |
; 0S 1S 2S 0T 0U 1U 2U 0V 0O 1O 2O 0P 0Q 1Q 2Q 0R)
|
|
shun-iwasawa |
82a8f5 |
vpunpckldq ymmG, ymmG, ymmC ; ymmG=(08 18 28 09 19 29 0A 1A 0A 1A 2A 0B 1B 2B 0C 1C
|
|
shun-iwasawa |
82a8f5 |
; 0O 1O 2O 0P 1P 2P 0Q 1Q 0Q 1Q 2Q 0R 1R 2R 0S 1S)
|
|
shun-iwasawa |
82a8f5 |
vpunpckhdq ymmC, ymmC, ymmF ; ymmC=(1D 2D 0E 1E 2E 0F 1F 2F 1F 2F 0G 1G 2G 0H 1H 2H
|
|
shun-iwasawa |
82a8f5 |
; 1T 2T 0U 1U 2U 0V 1V 2V 1V 2V -- -- -- -- -- --)
|
|
shun-iwasawa |
82a8f5 |
vpunpckldq ymmF, ymmF, ymmH ; ymmF=(2A 0B 1B 2B 0C 1C 2C 0D 2C 0D 1D 2D 0E 1E 2E 0F
|
|
shun-iwasawa |
82a8f5 |
; 2Q 0R 1R 2R 0S 1S 2S 0T 2S 0T 1T 2T 0U 1U 2U 0V)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpunpcklqdq ymmH, ymmA, ymmE ; ymmH=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05
|
|
shun-iwasawa |
82a8f5 |
; 0G 1G 2G 0H 1H 2H 0I 1I 2I 0J 1J 2J 0K 1K 2K 0L)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklqdq ymmG, ymmD, ymmG ; ymmG=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A
|
|
shun-iwasawa |
82a8f5 |
; 1L 2L 0M 1M 2M 0N 1N 2N 0O 1O 2O 0P 1P 2P 0Q 1Q)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklqdq ymmC, ymmF, ymmC ; ymmC=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F
|
|
shun-iwasawa |
82a8f5 |
; 2Q 0R 1R 2R 0S 1S 2S 0T 1T 2T 0U 1U 2U 0V 1V 2V)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmA, ymmH, ymmG, 0x20 ; ymmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05
|
|
shun-iwasawa |
82a8f5 |
; 15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A)
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmD, ymmC, ymmH, 0x30 ; ymmD=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F
|
|
shun-iwasawa |
82a8f5 |
; 0G 1G 2G 0H 1H 2H 0I 1I 2I 0J 1J 2J 0K 1K 2K 0L)
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmF, ymmG, ymmC, 0x31 ; ymmF=(1L 2L 0M 1M 2M 0N 1N 2N 0O 1O 2O 0P 1P 2P 0Q 1Q
|
|
shun-iwasawa |
82a8f5 |
; 2Q 0R 1R 2R 0S 1S 2S 0T 1T 2T 0U 1U 2U 0V 1V 2V)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st64
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
test edi, SIZEOF_YMMWORD-1
|
|
shun-iwasawa |
82a8f5 |
jnz short .out1
|
|
shun-iwasawa |
82a8f5 |
; --(aligned)-------------------
|
|
shun-iwasawa |
82a8f5 |
vmovntdq YMMWORD [edi+0*SIZEOF_YMMWORD], ymmA
|
|
shun-iwasawa |
82a8f5 |
vmovntdq YMMWORD [edi+1*SIZEOF_YMMWORD], ymmD
|
|
shun-iwasawa |
82a8f5 |
vmovntdq YMMWORD [edi+2*SIZEOF_YMMWORD], ymmF
|
|
shun-iwasawa |
82a8f5 |
jmp short .out0
|
|
shun-iwasawa |
82a8f5 |
.out1: ; --(unaligned)-----------------
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+0*SIZEOF_YMMWORD], ymmA
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+1*SIZEOF_YMMWORD], ymmD
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+2*SIZEOF_YMMWORD], ymmF
|
|
shun-iwasawa |
82a8f5 |
.out0:
|
|
shun-iwasawa |
82a8f5 |
add edi, byte RGB_PIXELSIZE*SIZEOF_YMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
jz near .nextrow
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte SIZEOF_YMMWORD ; inptr0
|
|
shun-iwasawa |
82a8f5 |
add ebx, byte SIZEOF_YMMWORD ; inptr1
|
|
shun-iwasawa |
82a8f5 |
add edx, byte SIZEOF_YMMWORD ; inptr2
|
|
shun-iwasawa |
82a8f5 |
jmp near .columnloop
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.column_st64:
|
|
shun-iwasawa |
82a8f5 |
lea ecx, [ecx+ecx*2] ; imul ecx, RGB_PIXELSIZE
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte 2*SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st32
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+0*SIZEOF_YMMWORD], ymmA
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+1*SIZEOF_YMMWORD], ymmD
|
|
shun-iwasawa |
82a8f5 |
add edi, byte 2*SIZEOF_YMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
vmovdqa ymmA, ymmF
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte 2*SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
jmp short .column_st31
|
|
shun-iwasawa |
82a8f5 |
.column_st32:
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st31
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+0*SIZEOF_YMMWORD], ymmA
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_YMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
vmovdqa ymmA, ymmD
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
jmp short .column_st31
|
|
shun-iwasawa |
82a8f5 |
.column_st31:
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st15
|
|
shun-iwasawa |
82a8f5 |
vmovdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_XMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmA, ymmA, ymmA, 1
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
.column_st15:
|
|
shun-iwasawa |
82a8f5 |
; Store the lower 8 bytes of xmmA to the output when it has enough
|
|
shun-iwasawa |
82a8f5 |
; space.
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_MMWORD
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st7
|
|
shun-iwasawa |
82a8f5 |
vmovq XMM_MMWORD [edi], xmmA
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_MMWORD
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_MMWORD
|
|
shun-iwasawa |
82a8f5 |
vpsrldq xmmA, xmmA, SIZEOF_MMWORD
|
|
shun-iwasawa |
82a8f5 |
.column_st7:
|
|
shun-iwasawa |
82a8f5 |
; Store the lower 4 bytes of xmmA to the output when it has enough
|
|
shun-iwasawa |
82a8f5 |
; space.
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_DWORD
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st3
|
|
shun-iwasawa |
82a8f5 |
vmovd XMM_DWORD [edi], xmmA
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_DWORD
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_DWORD
|
|
shun-iwasawa |
82a8f5 |
vpsrldq xmmA, xmmA, SIZEOF_DWORD
|
|
shun-iwasawa |
82a8f5 |
.column_st3:
|
|
shun-iwasawa |
82a8f5 |
; Store the lower 2 bytes of eax to the output when it has enough
|
|
shun-iwasawa |
82a8f5 |
; space.
|
|
shun-iwasawa |
82a8f5 |
vmovd eax, xmmA
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_WORD
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st1
|
|
shun-iwasawa |
82a8f5 |
mov word [edi], ax
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_WORD
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_WORD
|
|
shun-iwasawa |
82a8f5 |
shr eax, 16
|
|
shun-iwasawa |
82a8f5 |
.column_st1:
|
|
shun-iwasawa |
82a8f5 |
; Store the lower 1 byte of eax to the output when it has enough
|
|
shun-iwasawa |
82a8f5 |
; space.
|
|
shun-iwasawa |
82a8f5 |
test ecx, ecx
|
|
shun-iwasawa |
82a8f5 |
jz short .nextrow
|
|
shun-iwasawa |
82a8f5 |
mov byte [edi], al
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%else ; RGB_PIXELSIZE == 4 ; -----------
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%ifdef RGBX_FILLER_0XFF
|
|
shun-iwasawa |
82a8f5 |
vpcmpeqb ymm6, ymm6, ymm6 ; ymm6=XE=X(02468ACE********GIKMOQSU********)
|
|
shun-iwasawa |
82a8f5 |
vpcmpeqb ymm7, ymm7, ymm7 ; ymm7=XO=X(13579BDF********HJLNPRTV********)
|
|
shun-iwasawa |
82a8f5 |
%else
|
|
shun-iwasawa |
82a8f5 |
vpxor ymm6, ymm6, ymm6 ; ymm6=XE=X(02468ACE********GIKMOQSU********)
|
|
shun-iwasawa |
82a8f5 |
vpxor ymm7, ymm7, ymm7 ; ymm7=XO=X(13579BDF********HJLNPRTV********)
|
|
shun-iwasawa |
82a8f5 |
%endif
|
|
shun-iwasawa |
82a8f5 |
; ymmA=(00 02 04 06 08 0A 0C 0E ** 0G 0I 0K 0M 0O 0Q 0S 0U **)
|
|
shun-iwasawa |
82a8f5 |
; ymmB=(01 03 05 07 09 0B 0D 0F ** 0H 0J 0L 0N 0P 0R 0T 0V **)
|
|
shun-iwasawa |
82a8f5 |
; ymmC=(10 12 14 16 18 1A 1C 1E ** 1G 1I 1K 1M 1O 1Q 1S 1U **)
|
|
shun-iwasawa |
82a8f5 |
; ymmD=(11 13 15 17 19 1B 1D 1F ** 1H 1J 1L 1N 1P 1R 1T 1V **)
|
|
shun-iwasawa |
82a8f5 |
; ymmE=(20 22 24 26 28 2A 2C 2E ** 2G 2I 2K 2M 2O 2Q 2S 2U **)
|
|
shun-iwasawa |
82a8f5 |
; ymmF=(21 23 25 27 29 2B 2D 2F ** 2H 2J 2L 2N 2P 2R 2T 2V **)
|
|
shun-iwasawa |
82a8f5 |
; ymmG=(30 32 34 36 38 3A 3C 3E ** 3G 3I 3K 3M 3O 3Q 3S 3U **)
|
|
shun-iwasawa |
82a8f5 |
; ymmH=(31 33 35 37 39 3B 3D 3F ** 3H 3J 3L 3N 3P 3R 3T 3V **)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpunpcklbw ymmA, ymmA, ymmC ; ymmA=(00 10 02 12 04 14 06 16 08 18 0A 1A 0C 1C 0E 1E
|
|
shun-iwasawa |
82a8f5 |
; 0G 1G 0I 1I 0K 1K 0M 1M 0O 1O 0Q 1Q 0S 1S 0U 1U)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklbw ymmE, ymmE, ymmG ; ymmE=(20 30 22 32 24 34 26 36 28 38 2A 3A 2C 3C 2E 3E
|
|
shun-iwasawa |
82a8f5 |
; 2G 3G 2I 3I 2K 3K 2M 3M 2O 3O 2Q 3Q 2S 3S 2U 3U)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklbw ymmB, ymmB, ymmD ; ymmB=(01 11 03 13 05 15 07 17 09 19 0B 1B 0D 1D 0F 1F
|
|
shun-iwasawa |
82a8f5 |
; 0H 1H 0J 1J 0L 1L 0N 1N 0P 1P 0R 1R 0T 1T 0V 1V)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklbw ymmF, ymmF, ymmH ; ymmF=(21 31 23 33 25 35 27 37 29 39 2B 3B 2D 3D 2F 3F
|
|
shun-iwasawa |
82a8f5 |
; 2H 3H 2J 3J 2L 3L 2N 3N 2P 3P 2R 3R 2T 3T 2V 3V)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpunpckhwd ymmC, ymmA, ymmE ; ymmC=(08 18 28 38 0A 1A 2A 3A 0C 1C 2C 3C 0E 1E 2E 3E
|
|
shun-iwasawa |
82a8f5 |
; 0O 1O 2O 3O 0Q 1Q 2Q 3Q 0S 1S 2S 3S 0U 1U 2U 3U)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklwd ymmA, ymmA, ymmE ; ymmA=(00 10 20 30 02 12 22 32 04 14 24 34 06 16 26 36
|
|
shun-iwasawa |
82a8f5 |
; 0G 1G 2G 3G 0I 1I 2I 3I 0K 1K 2K 3K 0M 1M 2M 3M)
|
|
shun-iwasawa |
82a8f5 |
vpunpckhwd ymmG, ymmB, ymmF ; ymmG=(09 19 29 39 0B 1B 2B 3B 0D 1D 2D 3D 0F 1F 2F 3F
|
|
shun-iwasawa |
82a8f5 |
; 0P 1P 2P 3P 0R 1R 2R 3R 0T 1T 2T 3T 0V 1V 2V 3V)
|
|
shun-iwasawa |
82a8f5 |
vpunpcklwd ymmB, ymmB, ymmF ; ymmB=(01 11 21 31 03 13 23 33 05 15 25 35 07 17 27 37
|
|
shun-iwasawa |
82a8f5 |
; 0H 1H 2H 3H 0J 1J 2J 3J 0L 1L 2L 3L 0N 1N 2N 3N)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vpunpckhdq ymmE, ymmA, ymmB ; ymmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37
|
|
shun-iwasawa |
82a8f5 |
; 0K 1K 2K 3K 0L 1L 2L 3L 0M 1M 2M 3M 0N 1N 2N 3N)
|
|
shun-iwasawa |
82a8f5 |
vpunpckldq ymmB, ymmA, ymmB ; ymmB=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33
|
|
shun-iwasawa |
82a8f5 |
; 0G 1G 2G 3G 0H 1H 2H 3H 0I 1I 2I 3I 0J 1J 2J 3J)
|
|
shun-iwasawa |
82a8f5 |
vpunpckhdq ymmF, ymmC, ymmG ; ymmF=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F
|
|
shun-iwasawa |
82a8f5 |
; 0S 1S 2S 3S 0T 1T 2T 3T 0U 1U 2U 3U 0V 1V 2V 3V)
|
|
shun-iwasawa |
82a8f5 |
vpunpckldq ymmG, ymmC, ymmG ; ymmG=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B
|
|
shun-iwasawa |
82a8f5 |
; 0O 1O 2O 3O 0P 1P 2P 3P 0Q 1Q 2Q 3Q 0R 1R 2R 3R)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmA, ymmB, ymmE, 0x20 ; ymmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33
|
|
shun-iwasawa |
82a8f5 |
; 04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37)
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmD, ymmG, ymmF, 0x20 ; ymmD=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B
|
|
shun-iwasawa |
82a8f5 |
; 0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F)
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmC, ymmB, ymmE, 0x31 ; ymmC=(0G 1G 2G 3G 0H 1H 2H 3H 0I 1I 2I 3I 0J 1J 2J 3J
|
|
shun-iwasawa |
82a8f5 |
; 0K 1K 2K 3K 0L 1L 2L 3L 0M 1M 2M 3M 0N 1N 2N 3N)
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmH, ymmG, ymmF, 0x31 ; ymmH=(0O 1O 2O 3O 0P 1P 2P 3P 0Q 1Q 2Q 3Q 0R 1R 2R 3R
|
|
shun-iwasawa |
82a8f5 |
; 0S 1S 2S 3S 0T 1T 2T 3T 0U 1U 2U 3U 0V 1V 2V 3V)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st64
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
test edi, SIZEOF_YMMWORD-1
|
|
shun-iwasawa |
82a8f5 |
jnz short .out1
|
|
shun-iwasawa |
82a8f5 |
; --(aligned)-------------------
|
|
shun-iwasawa |
82a8f5 |
vmovntdq YMMWORD [edi+0*SIZEOF_YMMWORD], ymmA
|
|
shun-iwasawa |
82a8f5 |
vmovntdq YMMWORD [edi+1*SIZEOF_YMMWORD], ymmD
|
|
shun-iwasawa |
82a8f5 |
vmovntdq YMMWORD [edi+2*SIZEOF_YMMWORD], ymmC
|
|
shun-iwasawa |
82a8f5 |
vmovntdq YMMWORD [edi+3*SIZEOF_YMMWORD], ymmH
|
|
shun-iwasawa |
82a8f5 |
jmp short .out0
|
|
shun-iwasawa |
82a8f5 |
.out1: ; --(unaligned)-----------------
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+0*SIZEOF_YMMWORD], ymmA
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+1*SIZEOF_YMMWORD], ymmD
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+2*SIZEOF_YMMWORD], ymmC
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+3*SIZEOF_YMMWORD], ymmH
|
|
shun-iwasawa |
82a8f5 |
.out0:
|
|
shun-iwasawa |
82a8f5 |
add edi, RGB_PIXELSIZE*SIZEOF_YMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_YMMWORD
|
|
shun-iwasawa |
82a8f5 |
jz near .nextrow
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte SIZEOF_YMMWORD ; inptr0
|
|
shun-iwasawa |
82a8f5 |
add ebx, byte SIZEOF_YMMWORD ; inptr1
|
|
shun-iwasawa |
82a8f5 |
add edx, byte SIZEOF_YMMWORD ; inptr2
|
|
shun-iwasawa |
82a8f5 |
jmp near .columnloop
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.column_st64:
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_YMMWORD/2
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st32
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+0*SIZEOF_YMMWORD], ymmA
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+1*SIZEOF_YMMWORD], ymmD
|
|
shun-iwasawa |
82a8f5 |
add edi, byte 2*SIZEOF_YMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
vmovdqa ymmA, ymmC
|
|
shun-iwasawa |
82a8f5 |
vmovdqa ymmD, ymmH
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_YMMWORD/2
|
|
shun-iwasawa |
82a8f5 |
.column_st32:
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_YMMWORD/4
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st16
|
|
shun-iwasawa |
82a8f5 |
vmovdqu YMMWORD [edi+0*SIZEOF_YMMWORD], ymmA
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_YMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
vmovdqa ymmA, ymmD
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_YMMWORD/4
|
|
shun-iwasawa |
82a8f5 |
.column_st16:
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_YMMWORD/8
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st15
|
|
shun-iwasawa |
82a8f5 |
vmovdqu XMMWORD [edi+0*SIZEOF_XMMWORD], xmmA
|
|
shun-iwasawa |
82a8f5 |
vperm2i128 ymmA, ymmA, ymmA, 1
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_XMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_YMMWORD/8
|
|
shun-iwasawa |
82a8f5 |
.column_st15:
|
|
shun-iwasawa |
82a8f5 |
; Store two pixels (8 bytes) of ymmA to the output when it has enough
|
|
shun-iwasawa |
82a8f5 |
; space.
|
|
shun-iwasawa |
82a8f5 |
cmp ecx, byte SIZEOF_YMMWORD/16
|
|
shun-iwasawa |
82a8f5 |
jb short .column_st7
|
|
shun-iwasawa |
82a8f5 |
vmovq MMWORD [edi], xmmA
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_YMMWORD/16*4
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte SIZEOF_YMMWORD/16
|
|
shun-iwasawa |
82a8f5 |
vpsrldq xmmA, SIZEOF_YMMWORD/16*4
|
|
shun-iwasawa |
82a8f5 |
.column_st7:
|
|
shun-iwasawa |
82a8f5 |
; Store one pixel (4 bytes) of ymmA to the output when it has enough
|
|
shun-iwasawa |
82a8f5 |
; space.
|
|
shun-iwasawa |
82a8f5 |
test ecx, ecx
|
|
shun-iwasawa |
82a8f5 |
jz short .nextrow
|
|
shun-iwasawa |
82a8f5 |
vmovd XMM_DWORD [edi], xmmA
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%endif ; RGB_PIXELSIZE ; ---------------
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.nextrow:
|
|
shun-iwasawa |
82a8f5 |
pop ecx
|
|
shun-iwasawa |
82a8f5 |
pop esi
|
|
shun-iwasawa |
82a8f5 |
pop ebx
|
|
shun-iwasawa |
82a8f5 |
pop edx
|
|
shun-iwasawa |
82a8f5 |
pop edi
|
|
shun-iwasawa |
82a8f5 |
pop eax
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte SIZEOF_JSAMPROW
|
|
shun-iwasawa |
82a8f5 |
add ebx, byte SIZEOF_JSAMPROW
|
|
shun-iwasawa |
82a8f5 |
add edx, byte SIZEOF_JSAMPROW
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_JSAMPROW ; output_buf
|
|
shun-iwasawa |
82a8f5 |
dec eax ; num_rows
|
|
shun-iwasawa |
82a8f5 |
jg near .rowloop
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
sfence ; flush the write buffer
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.return:
|
|
shun-iwasawa |
82a8f5 |
vzeroupper
|
|
shun-iwasawa |
82a8f5 |
pop edi
|
|
shun-iwasawa |
82a8f5 |
pop esi
|
|
shun-iwasawa |
82a8f5 |
; pop edx ; need not be preserved
|
|
shun-iwasawa |
82a8f5 |
; pop ecx ; need not be preserved
|
|
shun-iwasawa |
82a8f5 |
pop ebx
|
|
shun-iwasawa |
82a8f5 |
mov esp, ebp ; esp <- aligned ebp
|
|
shun-iwasawa |
82a8f5 |
pop esp ; esp <- original ebp
|
|
shun-iwasawa |
82a8f5 |
pop ebp
|
|
shun-iwasawa |
82a8f5 |
ret
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; For some reason, the OS X linker does not honor the request to align the
|
|
shun-iwasawa |
82a8f5 |
; segment unless we do this.
|
|
shun-iwasawa |
82a8f5 |
align 32
|