|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; jdsample.asm - upsampling (SSE2)
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB</ossman@cendio.se>
|
|
shun-iwasawa |
82a8f5 |
; Copyright (C) 2016, D. R. Commander.
|
|
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 "jsimdext.inc"
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; --------------------------------------------------------------------------
|
|
shun-iwasawa |
82a8f5 |
SECTION SEG_CONST
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
alignz 32
|
|
shun-iwasawa |
82a8f5 |
GLOBAL_DATA(jconst_fancy_upsample_sse2)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
EXTN(jconst_fancy_upsample_sse2):
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
PW_ONE times 8 dw 1
|
|
shun-iwasawa |
82a8f5 |
PW_TWO times 8 dw 2
|
|
shun-iwasawa |
82a8f5 |
PW_THREE times 8 dw 3
|
|
shun-iwasawa |
82a8f5 |
PW_SEVEN times 8 dw 7
|
|
shun-iwasawa |
82a8f5 |
PW_EIGHT times 8 dw 8
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
alignz 32
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; --------------------------------------------------------------------------
|
|
shun-iwasawa |
82a8f5 |
SECTION SEG_TEXT
|
|
shun-iwasawa |
82a8f5 |
BITS 32
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; Fancy processing for the common case of 2:1 horizontal and 1:1 vertical.
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; The upsampling algorithm is linear interpolation between pixel centers,
|
|
shun-iwasawa |
82a8f5 |
; also known as a "triangle filter". This is a good compromise between
|
|
shun-iwasawa |
82a8f5 |
; speed and visual quality. The centers of the output pixels are 1/4 and 3/4
|
|
shun-iwasawa |
82a8f5 |
; of the way between input pixel centers.
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; GLOBAL(void)
|
|
shun-iwasawa |
82a8f5 |
; jsimd_h2v1_fancy_upsample_sse2(int max_v_samp_factor,
|
|
shun-iwasawa |
82a8f5 |
; JDIMENSION downsampled_width,
|
|
shun-iwasawa |
82a8f5 |
; JSAMPARRAY input_data,
|
|
shun-iwasawa |
82a8f5 |
; JSAMPARRAY *output_data_ptr);
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor
|
|
shun-iwasawa |
82a8f5 |
%define downsamp_width(b) (b) + 12 ; JDIMENSION downsampled_width
|
|
shun-iwasawa |
82a8f5 |
%define input_data(b) (b) + 16 ; JSAMPARRAY input_data
|
|
shun-iwasawa |
82a8f5 |
%define output_data_ptr(b) (b) + 20 ; JSAMPARRAY *output_data_ptr
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
align 32
|
|
shun-iwasawa |
82a8f5 |
GLOBAL_FUNCTION(jsimd_h2v1_fancy_upsample_sse2)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
EXTN(jsimd_h2v1_fancy_upsample_sse2):
|
|
shun-iwasawa |
82a8f5 |
push ebp
|
|
shun-iwasawa |
82a8f5 |
mov ebp, esp
|
|
shun-iwasawa |
82a8f5 |
pushpic 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 |
|
|
shun-iwasawa |
82a8f5 |
mov eax, JDIMENSION [downsamp_width(ebp)] ; colctr
|
|
shun-iwasawa |
82a8f5 |
test eax, eax
|
|
shun-iwasawa |
82a8f5 |
jz near .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov ecx, INT [max_v_samp(ebp)] ; rowctr
|
|
shun-iwasawa |
82a8f5 |
test ecx, ecx
|
|
shun-iwasawa |
82a8f5 |
jz near .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPARRAY [input_data(ebp)] ; input_data
|
|
shun-iwasawa |
82a8f5 |
mov edi, POINTER [output_data_ptr(ebp)]
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPARRAY [edi] ; output_data
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
.rowloop:
|
|
shun-iwasawa |
82a8f5 |
push eax ; colctr
|
|
shun-iwasawa |
82a8f5 |
push edi
|
|
shun-iwasawa |
82a8f5 |
push esi
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPROW [esi] ; inptr
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPROW [edi] ; outptr
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
test eax, SIZEOF_XMMWORD-1
|
|
shun-iwasawa |
82a8f5 |
jz short .skip
|
|
shun-iwasawa |
82a8f5 |
mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE]
|
|
shun-iwasawa |
82a8f5 |
mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample
|
|
shun-iwasawa |
82a8f5 |
.skip:
|
|
shun-iwasawa |
82a8f5 |
pxor xmm0, xmm0 ; xmm0=(all 0's)
|
|
shun-iwasawa |
82a8f5 |
pcmpeqb xmm7, xmm7
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm7, (SIZEOF_XMMWORD-1)
|
|
shun-iwasawa |
82a8f5 |
pand xmm7, XMMWORD [esi+0*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add eax, byte SIZEOF_XMMWORD-1
|
|
shun-iwasawa |
82a8f5 |
and eax, byte -SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
cmp eax, byte SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
ja short .columnloop
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.columnloop_last:
|
|
shun-iwasawa |
82a8f5 |
pcmpeqb xmm6, xmm6
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm6, (SIZEOF_XMMWORD-1)
|
|
shun-iwasawa |
82a8f5 |
pand xmm6, XMMWORD [esi+0*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
jmp short .upsample
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.columnloop:
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm6, XMMWORD [esi+1*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm6, (SIZEOF_XMMWORD-1)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.upsample:
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm1, XMMWORD [esi+0*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm2, xmm1
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm3, xmm1 ; xmm1=( 0 1 2 ... 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm2, 1 ; xmm2=(-- 0 1 ... 12 13 14)
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm3, 1 ; xmm3=( 1 2 3 ... 14 15 --)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
por xmm2, xmm7 ; xmm2=(-1 0 1 ... 12 13 14)
|
|
shun-iwasawa |
82a8f5 |
por xmm3, xmm6 ; xmm3=( 1 2 3 ... 14 15 16)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm7, xmm1
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm7, (SIZEOF_XMMWORD-1) ; xmm7=(15 -- -- ... -- -- --)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm4, xmm1
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm1, xmm0 ; xmm1=( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm4, xmm0 ; xmm4=( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm5, xmm2
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm2, xmm0 ; xmm2=(-1 0 1 2 3 4 5 6)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm5, xmm0 ; xmm5=( 7 8 9 10 11 12 13 14)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm6, xmm3
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm3, xmm0 ; xmm3=( 1 2 3 4 5 6 7 8)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm6, xmm0 ; xmm6=( 9 10 11 12 13 14 15 16)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm1, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm4, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm2, [GOTOFF(ebx,PW_ONE)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm5, [GOTOFF(ebx,PW_ONE)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm3, [GOTOFF(ebx,PW_TWO)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm6, [GOTOFF(ebx,PW_TWO)]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
paddw xmm2, xmm1
|
|
shun-iwasawa |
82a8f5 |
paddw xmm5, xmm4
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm2, 2 ; xmm2=OutLE=( 0 2 4 6 8 10 12 14)
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm5, 2 ; xmm5=OutHE=(16 18 20 22 24 26 28 30)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm3, xmm1
|
|
shun-iwasawa |
82a8f5 |
paddw xmm6, xmm4
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm3, 2 ; xmm3=OutLO=( 1 3 5 7 9 11 13 15)
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm6, 2 ; xmm6=OutHO=(17 19 21 23 25 27 29 31)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
psllw xmm3, BYTE_BIT
|
|
shun-iwasawa |
82a8f5 |
psllw xmm6, BYTE_BIT
|
|
shun-iwasawa |
82a8f5 |
por xmm2, xmm3 ; xmm2=OutL=( 0 1 2 ... 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
por xmm5, xmm6 ; xmm5=OutH=(16 17 18 ... 29 30 31)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm5
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
sub eax, byte SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
add esi, byte 1*SIZEOF_XMMWORD ; inptr
|
|
shun-iwasawa |
82a8f5 |
add edi, byte 2*SIZEOF_XMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
cmp eax, byte SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
ja near .columnloop
|
|
shun-iwasawa |
82a8f5 |
test eax, eax
|
|
shun-iwasawa |
82a8f5 |
jnz near .columnloop_last
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pop esi
|
|
shun-iwasawa |
82a8f5 |
pop edi
|
|
shun-iwasawa |
82a8f5 |
pop eax
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte SIZEOF_JSAMPROW ; input_data
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_JSAMPROW ; output_data
|
|
shun-iwasawa |
82a8f5 |
dec ecx ; rowctr
|
|
shun-iwasawa |
82a8f5 |
jg near .rowloop
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.return:
|
|
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 |
poppic ebx
|
|
shun-iwasawa |
82a8f5 |
pop ebp
|
|
shun-iwasawa |
82a8f5 |
ret
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; --------------------------------------------------------------------------
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; Fancy processing for the common case of 2:1 horizontal and 2:1 vertical.
|
|
shun-iwasawa |
82a8f5 |
; Again a triangle filter; see comments for h2v1 case, above.
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; GLOBAL(void)
|
|
shun-iwasawa |
82a8f5 |
; jsimd_h2v2_fancy_upsample_sse2(int max_v_samp_factor,
|
|
shun-iwasawa |
82a8f5 |
; JDIMENSION downsampled_width,
|
|
shun-iwasawa |
82a8f5 |
; JSAMPARRAY input_data,
|
|
shun-iwasawa |
82a8f5 |
; JSAMPARRAY *output_data_ptr);
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor
|
|
shun-iwasawa |
82a8f5 |
%define downsamp_width(b) (b) + 12 ; JDIMENSION downsampled_width
|
|
shun-iwasawa |
82a8f5 |
%define input_data(b) (b) + 16 ; JSAMPARRAY input_data
|
|
shun-iwasawa |
82a8f5 |
%define output_data_ptr(b) (b) + 20 ; JSAMPARRAY *output_data_ptr
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%define original_ebp ebp + 0
|
|
shun-iwasawa |
82a8f5 |
%define wk(i) ebp - (WK_NUM - (i)) * SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
; xmmword wk[WK_NUM]
|
|
shun-iwasawa |
82a8f5 |
%define WK_NUM 4
|
|
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_h2v2_fancy_upsample_sse2)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
EXTN(jsimd_h2v2_fancy_upsample_sse2):
|
|
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_XMMWORD) ; align to 128 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 edx, eax ; edx = original ebp
|
|
shun-iwasawa |
82a8f5 |
mov eax, JDIMENSION [downsamp_width(edx)] ; colctr
|
|
shun-iwasawa |
82a8f5 |
test eax, eax
|
|
shun-iwasawa |
82a8f5 |
jz near .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov ecx, INT [max_v_samp(edx)] ; rowctr
|
|
shun-iwasawa |
82a8f5 |
test ecx, ecx
|
|
shun-iwasawa |
82a8f5 |
jz near .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPARRAY [input_data(edx)] ; input_data
|
|
shun-iwasawa |
82a8f5 |
mov edi, POINTER [output_data_ptr(edx)]
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPARRAY [edi] ; output_data
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
.rowloop:
|
|
shun-iwasawa |
82a8f5 |
push eax ; colctr
|
|
shun-iwasawa |
82a8f5 |
push ecx
|
|
shun-iwasawa |
82a8f5 |
push edi
|
|
shun-iwasawa |
82a8f5 |
push esi
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov ecx, JSAMPROW [esi-1*SIZEOF_JSAMPROW] ; inptr1(above)
|
|
shun-iwasawa |
82a8f5 |
mov ebx, JSAMPROW [esi+0*SIZEOF_JSAMPROW] ; inptr0
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPROW [esi+1*SIZEOF_JSAMPROW] ; inptr1(below)
|
|
shun-iwasawa |
82a8f5 |
mov edx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
test eax, SIZEOF_XMMWORD-1
|
|
shun-iwasawa |
82a8f5 |
jz short .skip
|
|
shun-iwasawa |
82a8f5 |
push edx
|
|
shun-iwasawa |
82a8f5 |
mov dl, JSAMPLE [ecx+(eax-1)*SIZEOF_JSAMPLE]
|
|
shun-iwasawa |
82a8f5 |
mov JSAMPLE [ecx+eax*SIZEOF_JSAMPLE], dl
|
|
shun-iwasawa |
82a8f5 |
mov dl, JSAMPLE [ebx+(eax-1)*SIZEOF_JSAMPLE]
|
|
shun-iwasawa |
82a8f5 |
mov JSAMPLE [ebx+eax*SIZEOF_JSAMPLE], dl
|
|
shun-iwasawa |
82a8f5 |
mov dl, JSAMPLE [esi+(eax-1)*SIZEOF_JSAMPLE]
|
|
shun-iwasawa |
82a8f5 |
mov JSAMPLE [esi+eax*SIZEOF_JSAMPLE], dl ; insert a dummy sample
|
|
shun-iwasawa |
82a8f5 |
pop edx
|
|
shun-iwasawa |
82a8f5 |
.skip:
|
|
shun-iwasawa |
82a8f5 |
; -- process the first column block
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm0, XMMWORD [ebx+0*SIZEOF_XMMWORD] ; xmm0=row[ 0][0]
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm1, XMMWORD [ecx+0*SIZEOF_XMMWORD] ; xmm1=row[-1][0]
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm2, XMMWORD [esi+0*SIZEOF_XMMWORD] ; xmm2=row[+1][0]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pushpic ebx
|
|
shun-iwasawa |
82a8f5 |
movpic ebx, POINTER [gotptr] ; load GOT address
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pxor xmm3, xmm3 ; xmm3=(all 0's)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm4, xmm0
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm0, xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm4, xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm5, xmm1
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm1, xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm5, xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm6, xmm2
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm2, xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm6, xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm0, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm4, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pcmpeqb xmm7, xmm7
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm7, (SIZEOF_XMMWORD-2)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
paddw xmm1, xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm5, xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm2, xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm6, xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1 ; temporarily save
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5 ; the intermediate data
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm2
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm6
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pand xmm1, xmm7 ; xmm1=( 0 -- -- -- -- -- -- --)
|
|
shun-iwasawa |
82a8f5 |
pand xmm2, xmm7 ; xmm2=( 0 -- -- -- -- -- -- --)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [wk(0)], xmm1
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [wk(1)], xmm2
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
poppic ebx
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add eax, byte SIZEOF_XMMWORD-1
|
|
shun-iwasawa |
82a8f5 |
and eax, byte -SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
cmp eax, byte SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
ja short .columnloop
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.columnloop_last:
|
|
shun-iwasawa |
82a8f5 |
; -- process the last column block
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pushpic ebx
|
|
shun-iwasawa |
82a8f5 |
movpic ebx, POINTER [gotptr] ; load GOT address
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pcmpeqb xmm1, xmm1
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm1, (SIZEOF_XMMWORD-2)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm2, xmm1
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pand xmm1, XMMWORD [edx+1*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
pand xmm2, XMMWORD [edi+1*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [wk(2)], xmm1 ; xmm1=(-- -- -- -- -- -- -- 15)
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [wk(3)], xmm2 ; xmm2=(-- -- -- -- -- -- -- 15)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
jmp near .upsample
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.columnloop:
|
|
shun-iwasawa |
82a8f5 |
; -- process the next column block
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm0, XMMWORD [ebx+1*SIZEOF_XMMWORD] ; xmm0=row[ 0][1]
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm1, XMMWORD [ecx+1*SIZEOF_XMMWORD] ; xmm1=row[-1][1]
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD] ; xmm2=row[+1][1]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pushpic ebx
|
|
shun-iwasawa |
82a8f5 |
movpic ebx, POINTER [gotptr] ; load GOT address
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pxor xmm3, xmm3 ; xmm3=(all 0's)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm4, xmm0
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm0, xmm3 ; xmm0=row[ 0]( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm4, xmm3 ; xmm4=row[ 0]( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm5, xmm1
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm1, xmm3 ; xmm1=row[-1]( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm5, xmm3 ; xmm5=row[-1]( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm6, xmm2
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm2, xmm3 ; xmm2=row[+1]( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm6, xmm3 ; xmm6=row[+1]( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm0, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm4, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
paddw xmm1, xmm0 ; xmm1=Int0L=( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm5, xmm4 ; xmm5=Int0H=( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm2, xmm0 ; xmm2=Int1L=( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm6, xmm4 ; xmm6=Int1H=( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edx+2*SIZEOF_XMMWORD], xmm1 ; temporarily save
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edx+3*SIZEOF_XMMWORD], xmm5 ; the intermediate data
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm6
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm1, (SIZEOF_XMMWORD-2) ; xmm1=(-- -- -- -- -- -- -- 0)
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm2, (SIZEOF_XMMWORD-2) ; xmm2=(-- -- -- -- -- -- -- 0)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [wk(2)], xmm1
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [wk(3)], xmm2
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.upsample:
|
|
shun-iwasawa |
82a8f5 |
; -- process the upper row
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm7, XMMWORD [edx+0*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm3, XMMWORD [edx+1*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm0, xmm7 ; xmm7=Int0L=( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm4, xmm3 ; xmm3=Int0H=( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm0, 2 ; xmm0=( 1 2 3 4 5 6 7 --)
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm4, (SIZEOF_XMMWORD-2) ; xmm4=(-- -- -- -- -- -- -- 8)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm5, xmm7
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm6, xmm3
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm5, (SIZEOF_XMMWORD-2) ; xmm5=( 7 -- -- -- -- -- -- --)
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm6, 2 ; xmm6=(-- 8 9 10 11 12 13 14)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
por xmm0, xmm4 ; xmm0=( 1 2 3 4 5 6 7 8)
|
|
shun-iwasawa |
82a8f5 |
por xmm5, xmm6 ; xmm5=( 7 8 9 10 11 12 13 14)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm1, xmm7
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm2, xmm3
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm1, 2 ; xmm1=(-- 0 1 2 3 4 5 6)
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm2, 2 ; xmm2=( 9 10 11 12 13 14 15 --)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm4, xmm3
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm4, (SIZEOF_XMMWORD-2) ; xmm4=(15 -- -- -- -- -- -- --)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
por xmm1, XMMWORD [wk(0)] ; xmm1=(-1 0 1 2 3 4 5 6)
|
|
shun-iwasawa |
82a8f5 |
por xmm2, XMMWORD [wk(2)] ; xmm2=( 9 10 11 12 13 14 15 16)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [wk(0)], xmm4
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm7, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm3, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm1, [GOTOFF(ebx,PW_EIGHT)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm5, [GOTOFF(ebx,PW_EIGHT)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm0, [GOTOFF(ebx,PW_SEVEN)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm2, [GOTOFF(ebx,PW_SEVEN)]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
paddw xmm1, xmm7
|
|
shun-iwasawa |
82a8f5 |
paddw xmm5, xmm3
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm1, 4 ; xmm1=Out0LE=( 0 2 4 6 8 10 12 14)
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm5, 4 ; xmm5=Out0HE=(16 18 20 22 24 26 28 30)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm0, xmm7
|
|
shun-iwasawa |
82a8f5 |
paddw xmm2, xmm3
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm0, 4 ; xmm0=Out0LO=( 1 3 5 7 9 11 13 15)
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm2, 4 ; xmm2=Out0HO=(17 19 21 23 25 27 29 31)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
psllw xmm0, BYTE_BIT
|
|
shun-iwasawa |
82a8f5 |
psllw xmm2, BYTE_BIT
|
|
shun-iwasawa |
82a8f5 |
por xmm1, xmm0 ; xmm1=Out0L=( 0 1 2 ... 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
por xmm5, xmm2 ; xmm5=Out0H=(16 17 18 ... 29 30 31)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edx+0*SIZEOF_XMMWORD], xmm1
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edx+1*SIZEOF_XMMWORD], xmm5
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; -- process the lower row
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm6, XMMWORD [edi+0*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm4, XMMWORD [edi+1*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm7, xmm6 ; xmm6=Int1L=( 0 1 2 3 4 5 6 7)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm3, xmm4 ; xmm4=Int1H=( 8 9 10 11 12 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm7, 2 ; xmm7=( 1 2 3 4 5 6 7 --)
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm3, (SIZEOF_XMMWORD-2) ; xmm3=(-- -- -- -- -- -- -- 8)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm0, xmm6
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm2, xmm4
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm0, (SIZEOF_XMMWORD-2) ; xmm0=( 7 -- -- -- -- -- -- --)
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm2, 2 ; xmm2=(-- 8 9 10 11 12 13 14)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
por xmm7, xmm3 ; xmm7=( 1 2 3 4 5 6 7 8)
|
|
shun-iwasawa |
82a8f5 |
por xmm0, xmm2 ; xmm0=( 7 8 9 10 11 12 13 14)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm1, xmm6
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm5, xmm4
|
|
shun-iwasawa |
82a8f5 |
pslldq xmm1, 2 ; xmm1=(-- 0 1 2 3 4 5 6)
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm5, 2 ; xmm5=( 9 10 11 12 13 14 15 --)
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm3, xmm4
|
|
shun-iwasawa |
82a8f5 |
psrldq xmm3, (SIZEOF_XMMWORD-2) ; xmm3=(15 -- -- -- -- -- -- --)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
por xmm1, XMMWORD [wk(1)] ; xmm1=(-1 0 1 2 3 4 5 6)
|
|
shun-iwasawa |
82a8f5 |
por xmm5, XMMWORD [wk(3)] ; xmm5=( 9 10 11 12 13 14 15 16)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [wk(1)], xmm3
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm6, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
pmullw xmm4, [GOTOFF(ebx,PW_THREE)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm1, [GOTOFF(ebx,PW_EIGHT)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm0, [GOTOFF(ebx,PW_EIGHT)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm7, [GOTOFF(ebx,PW_SEVEN)]
|
|
shun-iwasawa |
82a8f5 |
paddw xmm5, [GOTOFF(ebx,PW_SEVEN)]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
paddw xmm1, xmm6
|
|
shun-iwasawa |
82a8f5 |
paddw xmm0, xmm4
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm1, 4 ; xmm1=Out1LE=( 0 2 4 6 8 10 12 14)
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm0, 4 ; xmm0=Out1HE=(16 18 20 22 24 26 28 30)
|
|
shun-iwasawa |
82a8f5 |
paddw xmm7, xmm6
|
|
shun-iwasawa |
82a8f5 |
paddw xmm5, xmm4
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm7, 4 ; xmm7=Out1LO=( 1 3 5 7 9 11 13 15)
|
|
shun-iwasawa |
82a8f5 |
psrlw xmm5, 4 ; xmm5=Out1HO=(17 19 21 23 25 27 29 31)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
psllw xmm7, BYTE_BIT
|
|
shun-iwasawa |
82a8f5 |
psllw xmm5, BYTE_BIT
|
|
shun-iwasawa |
82a8f5 |
por xmm1, xmm7 ; xmm1=Out1L=( 0 1 2 ... 13 14 15)
|
|
shun-iwasawa |
82a8f5 |
por xmm0, xmm5 ; xmm0=Out1H=(16 17 18 ... 29 30 31)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm1
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm0
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
poppic ebx
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
sub eax, byte SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
add ecx, byte 1*SIZEOF_XMMWORD ; inptr1(above)
|
|
shun-iwasawa |
82a8f5 |
add ebx, byte 1*SIZEOF_XMMWORD ; inptr0
|
|
shun-iwasawa |
82a8f5 |
add esi, byte 1*SIZEOF_XMMWORD ; inptr1(below)
|
|
shun-iwasawa |
82a8f5 |
add edx, byte 2*SIZEOF_XMMWORD ; outptr0
|
|
shun-iwasawa |
82a8f5 |
add edi, byte 2*SIZEOF_XMMWORD ; outptr1
|
|
shun-iwasawa |
82a8f5 |
cmp eax, byte SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
ja near .columnloop
|
|
shun-iwasawa |
82a8f5 |
test eax, eax
|
|
shun-iwasawa |
82a8f5 |
jnz near .columnloop_last
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
pop esi
|
|
shun-iwasawa |
82a8f5 |
pop edi
|
|
shun-iwasawa |
82a8f5 |
pop ecx
|
|
shun-iwasawa |
82a8f5 |
pop eax
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte 1*SIZEOF_JSAMPROW ; input_data
|
|
shun-iwasawa |
82a8f5 |
add edi, byte 2*SIZEOF_JSAMPROW ; output_data
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte 2 ; rowctr
|
|
shun-iwasawa |
82a8f5 |
jg near .rowloop
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.return:
|
|
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 |
; --------------------------------------------------------------------------
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; Fast processing for the common case of 2:1 horizontal and 1:1 vertical.
|
|
shun-iwasawa |
82a8f5 |
; It's still a box filter.
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; GLOBAL(void)
|
|
shun-iwasawa |
82a8f5 |
; jsimd_h2v1_upsample_sse2(int max_v_samp_factor, JDIMENSION output_width,
|
|
shun-iwasawa |
82a8f5 |
; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor
|
|
shun-iwasawa |
82a8f5 |
%define output_width(b) (b) + 12 ; JDIMENSION output_width
|
|
shun-iwasawa |
82a8f5 |
%define input_data(b) (b) + 16 ; JSAMPARRAY input_data
|
|
shun-iwasawa |
82a8f5 |
%define output_data_ptr(b) (b) + 20 ; JSAMPARRAY *output_data_ptr
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
align 32
|
|
shun-iwasawa |
82a8f5 |
GLOBAL_FUNCTION(jsimd_h2v1_upsample_sse2)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
EXTN(jsimd_h2v1_upsample_sse2):
|
|
shun-iwasawa |
82a8f5 |
push ebp
|
|
shun-iwasawa |
82a8f5 |
mov ebp, esp
|
|
shun-iwasawa |
82a8f5 |
; push ebx ; unused
|
|
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 |
mov edx, JDIMENSION [output_width(ebp)]
|
|
shun-iwasawa |
82a8f5 |
add edx, byte (2*SIZEOF_XMMWORD)-1
|
|
shun-iwasawa |
82a8f5 |
and edx, byte -(2*SIZEOF_XMMWORD)
|
|
shun-iwasawa |
82a8f5 |
jz short .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov ecx, INT [max_v_samp(ebp)] ; rowctr
|
|
shun-iwasawa |
82a8f5 |
test ecx, ecx
|
|
shun-iwasawa |
82a8f5 |
jz short .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPARRAY [input_data(ebp)] ; input_data
|
|
shun-iwasawa |
82a8f5 |
mov edi, POINTER [output_data_ptr(ebp)]
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPARRAY [edi] ; output_data
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
.rowloop:
|
|
shun-iwasawa |
82a8f5 |
push edi
|
|
shun-iwasawa |
82a8f5 |
push esi
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPROW [esi] ; inptr
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPROW [edi] ; outptr
|
|
shun-iwasawa |
82a8f5 |
mov eax, edx ; colctr
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
.columnloop:
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm1, xmm0
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm0, xmm0
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm1, xmm1
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
sub eax, byte 2*SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
jz short .nextrow
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm3, xmm2
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm2, xmm2
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm3, xmm3
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
sub eax, byte 2*SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
jz short .nextrow
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte 2*SIZEOF_XMMWORD ; inptr
|
|
shun-iwasawa |
82a8f5 |
add edi, byte 4*SIZEOF_XMMWORD ; outptr
|
|
shun-iwasawa |
82a8f5 |
jmp short .columnloop
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.nextrow:
|
|
shun-iwasawa |
82a8f5 |
pop esi
|
|
shun-iwasawa |
82a8f5 |
pop edi
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte SIZEOF_JSAMPROW ; input_data
|
|
shun-iwasawa |
82a8f5 |
add edi, byte SIZEOF_JSAMPROW ; output_data
|
|
shun-iwasawa |
82a8f5 |
dec ecx ; rowctr
|
|
shun-iwasawa |
82a8f5 |
jg short .rowloop
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.return:
|
|
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 ; unused
|
|
shun-iwasawa |
82a8f5 |
pop ebp
|
|
shun-iwasawa |
82a8f5 |
ret
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
; --------------------------------------------------------------------------
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; Fast processing for the common case of 2:1 horizontal and 2:1 vertical.
|
|
shun-iwasawa |
82a8f5 |
; It's still a box filter.
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
; GLOBAL(void)
|
|
shun-iwasawa |
82a8f5 |
; jsimd_h2v2_upsample_sse2(int max_v_samp_factor, JDIMENSION output_width,
|
|
shun-iwasawa |
82a8f5 |
; JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr);
|
|
shun-iwasawa |
82a8f5 |
;
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
%define max_v_samp(b) (b) + 8 ; int max_v_samp_factor
|
|
shun-iwasawa |
82a8f5 |
%define output_width(b) (b) + 12 ; JDIMENSION output_width
|
|
shun-iwasawa |
82a8f5 |
%define input_data(b) (b) + 16 ; JSAMPARRAY input_data
|
|
shun-iwasawa |
82a8f5 |
%define output_data_ptr(b) (b) + 20 ; JSAMPARRAY *output_data_ptr
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
align 32
|
|
shun-iwasawa |
82a8f5 |
GLOBAL_FUNCTION(jsimd_h2v2_upsample_sse2)
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
EXTN(jsimd_h2v2_upsample_sse2):
|
|
shun-iwasawa |
82a8f5 |
push ebp
|
|
shun-iwasawa |
82a8f5 |
mov ebp, esp
|
|
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 |
mov edx, JDIMENSION [output_width(ebp)]
|
|
shun-iwasawa |
82a8f5 |
add edx, byte (2*SIZEOF_XMMWORD)-1
|
|
shun-iwasawa |
82a8f5 |
and edx, byte -(2*SIZEOF_XMMWORD)
|
|
shun-iwasawa |
82a8f5 |
jz near .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov ecx, INT [max_v_samp(ebp)] ; rowctr
|
|
shun-iwasawa |
82a8f5 |
test ecx, ecx
|
|
shun-iwasawa |
82a8f5 |
jz near .return
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPARRAY [input_data(ebp)] ; input_data
|
|
shun-iwasawa |
82a8f5 |
mov edi, POINTER [output_data_ptr(ebp)]
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPARRAY [edi] ; output_data
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
.rowloop:
|
|
shun-iwasawa |
82a8f5 |
push edi
|
|
shun-iwasawa |
82a8f5 |
push esi
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
mov esi, JSAMPROW [esi] ; inptr
|
|
shun-iwasawa |
82a8f5 |
mov ebx, JSAMPROW [edi+0*SIZEOF_JSAMPROW] ; outptr0
|
|
shun-iwasawa |
82a8f5 |
mov edi, JSAMPROW [edi+1*SIZEOF_JSAMPROW] ; outptr1
|
|
shun-iwasawa |
82a8f5 |
mov eax, edx ; colctr
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
.columnloop:
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm0, XMMWORD [esi+0*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm1, xmm0
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm0, xmm0
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm1, xmm1
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [ebx+0*SIZEOF_XMMWORD], xmm0
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [ebx+1*SIZEOF_XMMWORD], xmm1
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+0*SIZEOF_XMMWORD], xmm0
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+1*SIZEOF_XMMWORD], xmm1
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
sub eax, byte 2*SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
jz short .nextrow
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm2, XMMWORD [esi+1*SIZEOF_XMMWORD]
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa xmm3, xmm2
|
|
shun-iwasawa |
82a8f5 |
punpcklbw xmm2, xmm2
|
|
shun-iwasawa |
82a8f5 |
punpckhbw xmm3, xmm3
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [ebx+2*SIZEOF_XMMWORD], xmm2
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [ebx+3*SIZEOF_XMMWORD], xmm3
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+2*SIZEOF_XMMWORD], xmm2
|
|
shun-iwasawa |
82a8f5 |
movdqa XMMWORD [edi+3*SIZEOF_XMMWORD], xmm3
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
sub eax, byte 2*SIZEOF_XMMWORD
|
|
shun-iwasawa |
82a8f5 |
jz short .nextrow
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte 2*SIZEOF_XMMWORD ; inptr
|
|
shun-iwasawa |
82a8f5 |
add ebx, byte 4*SIZEOF_XMMWORD ; outptr0
|
|
shun-iwasawa |
82a8f5 |
add edi, byte 4*SIZEOF_XMMWORD ; outptr1
|
|
shun-iwasawa |
82a8f5 |
jmp short .columnloop
|
|
shun-iwasawa |
82a8f5 |
alignx 16, 7
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.nextrow:
|
|
shun-iwasawa |
82a8f5 |
pop esi
|
|
shun-iwasawa |
82a8f5 |
pop edi
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
add esi, byte 1*SIZEOF_JSAMPROW ; input_data
|
|
shun-iwasawa |
82a8f5 |
add edi, byte 2*SIZEOF_JSAMPROW ; output_data
|
|
shun-iwasawa |
82a8f5 |
sub ecx, byte 2 ; rowctr
|
|
shun-iwasawa |
82a8f5 |
jg short .rowloop
|
|
shun-iwasawa |
82a8f5 |
|
|
shun-iwasawa |
82a8f5 |
.return:
|
|
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 |
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
|