12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376 |
- ;
- ; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- ;
- ; Use of this source code is governed by a BSD-style license
- ; that can be found in the LICENSE file in the root of the source
- ; tree. An additional intellectual property rights grant can be found
- ; in the file PATENTS. All contributing project authors may
- ; be found in the AUTHORS file in the root of the source tree.
- ;
- %include "vpx_ports/x86_abi_support.asm"
- extern sym(vp8_bilinear_filters_x86_8)
- %define BLOCK_HEIGHT_WIDTH 4
- %define VP8_FILTER_WEIGHT 128
- %define VP8_FILTER_SHIFT 7
- ;/************************************************************************************
- ; Notes: filter_block1d_h6 applies a 6 tap filter horizontally to the input pixels. The
- ; input pixel array has output_height rows. This routine assumes that output_height is an
- ; even number. This function handles 8 pixels in horizontal direction, calculating ONE
- ; rows each iteration to take advantage of the 128 bits operations.
- ;*************************************************************************************/
- ;void vp8_filter_block1d8_h6_sse2
- ;(
- ; unsigned char *src_ptr,
- ; unsigned short *output_ptr,
- ; unsigned int src_pixels_per_line,
- ; unsigned int pixel_step,
- ; unsigned int output_height,
- ; unsigned int output_width,
- ; short *vp8_filter
- ;)
- global sym(vp8_filter_block1d8_h6_sse2) PRIVATE
- sym(vp8_filter_block1d8_h6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- mov rdx, arg(6) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(1) ;output_ptr
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(5) ;output_width
- %endif
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- .filter_block1d8_h6_rowloop:
- movq xmm3, MMWORD PTR [rsi - 2]
- movq xmm1, MMWORD PTR [rsi + 6]
- prefetcht2 [rsi+rax-2]
- pslldq xmm1, 8
- por xmm1, xmm3
- movdqa xmm4, xmm1
- movdqa xmm5, xmm1
- movdqa xmm6, xmm1
- movdqa xmm7, xmm1
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
- punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
- paddsw xmm4, xmm1
- paddsw xmm4, [GLOBAL(rd)]
- psraw xmm4, 7
- packuswb xmm4, xmm0
- punpcklbw xmm4, xmm0
- movdqa XMMWORD Ptr [rdi], xmm4
- lea rsi, [rsi + rax]
- %if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(5) ;[output_width]
- %else
- add rdi, r8
- %endif
- dec rcx
- jnz .filter_block1d8_h6_rowloop ; next row
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_filter_block1d16_h6_sse2
- ;(
- ; unsigned char *src_ptr,
- ; unsigned short *output_ptr,
- ; unsigned int src_pixels_per_line,
- ; unsigned int pixel_step,
- ; unsigned int output_height,
- ; unsigned int output_width,
- ; short *vp8_filter
- ;)
- ;/************************************************************************************
- ; Notes: filter_block1d_h6 applies a 6 tap filter horizontally to the input pixels. The
- ; input pixel array has output_height rows. This routine assumes that output_height is an
- ; even number. This function handles 8 pixels in horizontal direction, calculating ONE
- ; rows each iteration to take advantage of the 128 bits operations.
- ;*************************************************************************************/
- global sym(vp8_filter_block1d16_h6_sse2) PRIVATE
- sym(vp8_filter_block1d16_h6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- mov rdx, arg(6) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(1) ;output_ptr
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(5) ;output_width
- %endif
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- .filter_block1d16_h6_sse2_rowloop:
- movq xmm3, MMWORD PTR [rsi - 2]
- movq xmm1, MMWORD PTR [rsi + 6]
- ; Load from 11 to avoid reading out of bounds.
- movq xmm2, MMWORD PTR [rsi +11]
- ; The lower bits are not cleared before 'or'ing with xmm1,
- ; but that is OK because the values in the overlapping positions
- ; are already equal to the ones in xmm1.
- pslldq xmm2, 5
- por xmm2, xmm1
- prefetcht2 [rsi+rax-2]
- pslldq xmm1, 8
- por xmm1, xmm3
- movdqa xmm4, xmm1
- movdqa xmm5, xmm1
- movdqa xmm6, xmm1
- movdqa xmm7, xmm1
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
- punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
- paddsw xmm4, xmm1
- paddsw xmm4, [GLOBAL(rd)]
- psraw xmm4, 7
- packuswb xmm4, xmm0
- punpcklbw xmm4, xmm0
- movdqa XMMWORD Ptr [rdi], xmm4
- movdqa xmm3, xmm2
- movdqa xmm4, xmm2
- movdqa xmm5, xmm2
- movdqa xmm6, xmm2
- movdqa xmm7, xmm2
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm2, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
- punpcklbw xmm2, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm2, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
- paddsw xmm4, xmm2
- paddsw xmm4, [GLOBAL(rd)]
- psraw xmm4, 7
- packuswb xmm4, xmm0
- punpcklbw xmm4, xmm0
- movdqa XMMWORD Ptr [rdi+16], xmm4
- lea rsi, [rsi + rax]
- %if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(5) ;[output_width]
- %else
- add rdi, r8
- %endif
- dec rcx
- jnz .filter_block1d16_h6_sse2_rowloop ; next row
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_filter_block1d8_v6_sse2
- ;(
- ; short *src_ptr,
- ; unsigned char *output_ptr,
- ; int dst_ptich,
- ; unsigned int pixels_per_line,
- ; unsigned int pixel_step,
- ; unsigned int output_height,
- ; unsigned int output_width,
- ; short * vp8_filter
- ;)
- ;/************************************************************************************
- ; Notes: filter_block1d8_v6 applies a 6 tap filter vertically to the input pixels. The
- ; input pixel array has output_height rows.
- ;*************************************************************************************/
- global sym(vp8_filter_block1d8_v6_sse2) PRIVATE
- sym(vp8_filter_block1d8_v6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- mov rax, arg(7) ;vp8_filter
- movsxd rdx, dword ptr arg(3) ;pixels_per_line
- mov rdi, arg(1) ;output_ptr
- mov rsi, arg(0) ;src_ptr
- sub rsi, rdx
- sub rsi, rdx
- movsxd rcx, DWORD PTR arg(5) ;[output_height]
- pxor xmm0, xmm0 ; clear xmm0
- movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(2) ; dst_ptich
- %endif
- .vp8_filter_block1d8_v6_sse2_loop:
- movdqa xmm1, XMMWORD PTR [rsi]
- pmullw xmm1, [rax]
- movdqa xmm2, XMMWORD PTR [rsi + rdx]
- pmullw xmm2, [rax + 16]
- movdqa xmm3, XMMWORD PTR [rsi + rdx * 2]
- pmullw xmm3, [rax + 32]
- movdqa xmm5, XMMWORD PTR [rsi + rdx * 4]
- pmullw xmm5, [rax + 64]
- add rsi, rdx
- movdqa xmm4, XMMWORD PTR [rsi + rdx * 2]
- pmullw xmm4, [rax + 48]
- movdqa xmm6, XMMWORD PTR [rsi + rdx * 4]
- pmullw xmm6, [rax + 80]
- paddsw xmm2, xmm5
- paddsw xmm2, xmm3
- paddsw xmm2, xmm1
- paddsw xmm2, xmm4
- paddsw xmm2, xmm6
- paddsw xmm2, xmm7
- psraw xmm2, 7
- packuswb xmm2, xmm0 ; pack and saturate
- movq QWORD PTR [rdi], xmm2 ; store the results in the destination
- %if ABI_IS_32BIT
- add rdi, DWORD PTR arg(2) ;[dst_ptich]
- %else
- add rdi, r8
- %endif
- dec rcx ; decrement count
- jnz .vp8_filter_block1d8_v6_sse2_loop ; next row
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_filter_block1d16_v6_sse2
- ;(
- ; unsigned short *src_ptr,
- ; unsigned char *output_ptr,
- ; int dst_ptich,
- ; unsigned int pixels_per_line,
- ; unsigned int pixel_step,
- ; unsigned int output_height,
- ; unsigned int output_width,
- ; const short *vp8_filter
- ;)
- ;/************************************************************************************
- ; Notes: filter_block1d16_v6 applies a 6 tap filter vertically to the input pixels. The
- ; input pixel array has output_height rows.
- ;*************************************************************************************/
- global sym(vp8_filter_block1d16_v6_sse2) PRIVATE
- sym(vp8_filter_block1d16_v6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- mov rax, arg(7) ;vp8_filter
- movsxd rdx, dword ptr arg(3) ;pixels_per_line
- mov rdi, arg(1) ;output_ptr
- mov rsi, arg(0) ;src_ptr
- sub rsi, rdx
- sub rsi, rdx
- movsxd rcx, DWORD PTR arg(5) ;[output_height]
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(2) ; dst_ptich
- %endif
- .vp8_filter_block1d16_v6_sse2_loop:
- ; The order for adding 6-tap is 2 5 3 1 4 6. Read in data in that order.
- movdqa xmm1, XMMWORD PTR [rsi + rdx] ; line 2
- movdqa xmm2, XMMWORD PTR [rsi + rdx + 16]
- pmullw xmm1, [rax + 16]
- pmullw xmm2, [rax + 16]
- movdqa xmm3, XMMWORD PTR [rsi + rdx * 4] ; line 5
- movdqa xmm4, XMMWORD PTR [rsi + rdx * 4 + 16]
- pmullw xmm3, [rax + 64]
- pmullw xmm4, [rax + 64]
- movdqa xmm5, XMMWORD PTR [rsi + rdx * 2] ; line 3
- movdqa xmm6, XMMWORD PTR [rsi + rdx * 2 + 16]
- pmullw xmm5, [rax + 32]
- pmullw xmm6, [rax + 32]
- movdqa xmm7, XMMWORD PTR [rsi] ; line 1
- movdqa xmm0, XMMWORD PTR [rsi + 16]
- pmullw xmm7, [rax]
- pmullw xmm0, [rax]
- paddsw xmm1, xmm3
- paddsw xmm2, xmm4
- paddsw xmm1, xmm5
- paddsw xmm2, xmm6
- paddsw xmm1, xmm7
- paddsw xmm2, xmm0
- add rsi, rdx
- movdqa xmm3, XMMWORD PTR [rsi + rdx * 2] ; line 4
- movdqa xmm4, XMMWORD PTR [rsi + rdx * 2 + 16]
- pmullw xmm3, [rax + 48]
- pmullw xmm4, [rax + 48]
- movdqa xmm5, XMMWORD PTR [rsi + rdx * 4] ; line 6
- movdqa xmm6, XMMWORD PTR [rsi + rdx * 4 + 16]
- pmullw xmm5, [rax + 80]
- pmullw xmm6, [rax + 80]
- movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
- pxor xmm0, xmm0 ; clear xmm0
- paddsw xmm1, xmm3
- paddsw xmm2, xmm4
- paddsw xmm1, xmm5
- paddsw xmm2, xmm6
- paddsw xmm1, xmm7
- paddsw xmm2, xmm7
- psraw xmm1, 7
- psraw xmm2, 7
- packuswb xmm1, xmm2 ; pack and saturate
- movdqa XMMWORD PTR [rdi], xmm1 ; store the results in the destination
- %if ABI_IS_32BIT
- add rdi, DWORD PTR arg(2) ;[dst_ptich]
- %else
- add rdi, r8
- %endif
- dec rcx ; decrement count
- jnz .vp8_filter_block1d16_v6_sse2_loop ; next row
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_filter_block1d8_h6_only_sse2
- ;(
- ; unsigned char *src_ptr,
- ; unsigned int src_pixels_per_line,
- ; unsigned char *output_ptr,
- ; int dst_ptich,
- ; unsigned int output_height,
- ; const short *vp8_filter
- ;)
- ; First-pass filter only when yoffset==0
- global sym(vp8_filter_block1d8_h6_only_sse2) PRIVATE
- sym(vp8_filter_block1d8_h6_only_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- mov rdx, arg(5) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(3) ;dst_ptich
- %endif
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- .filter_block1d8_h6_only_rowloop:
- movq xmm3, MMWORD PTR [rsi - 2]
- movq xmm1, MMWORD PTR [rsi + 6]
- prefetcht2 [rsi+rax-2]
- pslldq xmm1, 8
- por xmm1, xmm3
- movdqa xmm4, xmm1
- movdqa xmm5, xmm1
- movdqa xmm6, xmm1
- movdqa xmm7, xmm1
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
- punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
- paddsw xmm4, xmm1
- paddsw xmm4, [GLOBAL(rd)]
- psraw xmm4, 7
- packuswb xmm4, xmm0
- movq QWORD PTR [rdi], xmm4 ; store the results in the destination
- lea rsi, [rsi + rax]
- %if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(3) ;dst_ptich
- %else
- add rdi, r8
- %endif
- dec rcx
- jnz .filter_block1d8_h6_only_rowloop ; next row
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_filter_block1d16_h6_only_sse2
- ;(
- ; unsigned char *src_ptr,
- ; unsigned int src_pixels_per_line,
- ; unsigned char *output_ptr,
- ; int dst_ptich,
- ; unsigned int output_height,
- ; const short *vp8_filter
- ;)
- ; First-pass filter only when yoffset==0
- global sym(vp8_filter_block1d16_h6_only_sse2) PRIVATE
- sym(vp8_filter_block1d16_h6_only_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- mov rdx, arg(5) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(3) ;dst_ptich
- %endif
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- .filter_block1d16_h6_only_sse2_rowloop:
- movq xmm3, MMWORD PTR [rsi - 2]
- movq xmm1, MMWORD PTR [rsi + 6]
- movq xmm2, MMWORD PTR [rsi +14]
- pslldq xmm2, 8
- por xmm2, xmm1
- prefetcht2 [rsi+rax-2]
- pslldq xmm1, 8
- por xmm1, xmm3
- movdqa xmm4, xmm1
- movdqa xmm5, xmm1
- movdqa xmm6, xmm1
- movdqa xmm7, xmm1
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
- punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
- paddsw xmm4, xmm1
- paddsw xmm4, [GLOBAL(rd)]
- psraw xmm4, 7
- packuswb xmm4, xmm0 ; lower 8 bytes
- movq QWORD Ptr [rdi], xmm4 ; store the results in the destination
- movdqa xmm3, xmm2
- movdqa xmm4, xmm2
- movdqa xmm5, xmm2
- movdqa xmm6, xmm2
- movdqa xmm7, xmm2
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
- pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
- punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
- psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
- punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
- psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
- pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
- punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
- psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
- pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
- punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
- psrldq xmm2, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
- pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
- punpcklbw xmm2, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
- pmullw xmm2, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
- paddsw xmm4, xmm7
- paddsw xmm4, xmm5
- paddsw xmm4, xmm3
- paddsw xmm4, xmm6
- paddsw xmm4, xmm2
- paddsw xmm4, [GLOBAL(rd)]
- psraw xmm4, 7
- packuswb xmm4, xmm0 ; higher 8 bytes
- movq QWORD Ptr [rdi+8], xmm4 ; store the results in the destination
- lea rsi, [rsi + rax]
- %if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(3) ;dst_ptich
- %else
- add rdi, r8
- %endif
- dec rcx
- jnz .filter_block1d16_h6_only_sse2_rowloop ; next row
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_filter_block1d8_v6_only_sse2
- ;(
- ; unsigned char *src_ptr,
- ; unsigned int src_pixels_per_line,
- ; unsigned char *output_ptr,
- ; int dst_ptich,
- ; unsigned int output_height,
- ; const short *vp8_filter
- ;)
- ; Second-pass filter only when xoffset==0
- global sym(vp8_filter_block1d8_v6_only_sse2) PRIVATE
- sym(vp8_filter_block1d8_v6_only_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(2) ;output_ptr
- movsxd rcx, dword ptr arg(4) ;output_height
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
- mov rax, arg(5) ;vp8_filter
- pxor xmm0, xmm0 ; clear xmm0
- movdqa xmm7, XMMWORD PTR [GLOBAL(rd)]
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(3) ; dst_ptich
- %endif
- .vp8_filter_block1d8_v6_only_sse2_loop:
- movq xmm1, MMWORD PTR [rsi]
- movq xmm2, MMWORD PTR [rsi + rdx]
- movq xmm3, MMWORD PTR [rsi + rdx * 2]
- movq xmm5, MMWORD PTR [rsi + rdx * 4]
- add rsi, rdx
- movq xmm4, MMWORD PTR [rsi + rdx * 2]
- movq xmm6, MMWORD PTR [rsi + rdx * 4]
- punpcklbw xmm1, xmm0
- pmullw xmm1, [rax]
- punpcklbw xmm2, xmm0
- pmullw xmm2, [rax + 16]
- punpcklbw xmm3, xmm0
- pmullw xmm3, [rax + 32]
- punpcklbw xmm5, xmm0
- pmullw xmm5, [rax + 64]
- punpcklbw xmm4, xmm0
- pmullw xmm4, [rax + 48]
- punpcklbw xmm6, xmm0
- pmullw xmm6, [rax + 80]
- paddsw xmm2, xmm5
- paddsw xmm2, xmm3
- paddsw xmm2, xmm1
- paddsw xmm2, xmm4
- paddsw xmm2, xmm6
- paddsw xmm2, xmm7
- psraw xmm2, 7
- packuswb xmm2, xmm0 ; pack and saturate
- movq QWORD PTR [rdi], xmm2 ; store the results in the destination
- %if ABI_IS_32BIT
- add rdi, DWORD PTR arg(3) ;[dst_ptich]
- %else
- add rdi, r8
- %endif
- dec rcx ; decrement count
- jnz .vp8_filter_block1d8_v6_only_sse2_loop ; next row
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_unpack_block1d16_h6_sse2
- ;(
- ; unsigned char *src_ptr,
- ; unsigned short *output_ptr,
- ; unsigned int src_pixels_per_line,
- ; unsigned int output_height,
- ; unsigned int output_width
- ;)
- global sym(vp8_unpack_block1d16_h6_sse2) PRIVATE
- sym(vp8_unpack_block1d16_h6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- mov rsi, arg(0) ;src_ptr
- mov rdi, arg(1) ;output_ptr
- movsxd rcx, dword ptr arg(3) ;output_height
- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
- pxor xmm0, xmm0 ; clear xmm0 for unpack
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
- %endif
- .unpack_block1d16_h6_sse2_rowloop:
- movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
- movq xmm3, MMWORD PTR [rsi+8] ; make copy of xmm1
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
- punpcklbw xmm1, xmm0
- movdqa XMMWORD Ptr [rdi], xmm1
- movdqa XMMWORD Ptr [rdi + 16], xmm3
- lea rsi, [rsi + rax]
- %if ABI_IS_32BIT
- add rdi, DWORD Ptr arg(4) ;[output_width]
- %else
- add rdi, r8
- %endif
- dec rcx
- jnz .unpack_block1d16_h6_sse2_rowloop ; next row
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_bilinear_predict16x16_sse2
- ;(
- ; unsigned char *src_ptr,
- ; int src_pixels_per_line,
- ; int xoffset,
- ; int yoffset,
- ; unsigned char *dst_ptr,
- ; int dst_pitch
- ;)
- extern sym(vp8_bilinear_filters_x86_8)
- global sym(vp8_bilinear_predict16x16_sse2) PRIVATE
- sym(vp8_bilinear_predict16x16_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- ;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset]
- ;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset]
- lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
- movsxd rax, dword ptr arg(2) ;xoffset
- cmp rax, 0 ;skip first_pass filter if xoffset=0
- je .b16x16_sp_only
- shl rax, 5
- add rax, rcx ;HFilter
- mov rdi, arg(4) ;dst_ptr
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, dword ptr arg(5) ;dst_pitch
- movdqa xmm1, [rax]
- movdqa xmm2, [rax+16]
- movsxd rax, dword ptr arg(3) ;yoffset
- cmp rax, 0 ;skip second_pass filter if yoffset=0
- je .b16x16_fp_only
- shl rax, 5
- add rax, rcx ;VFilter
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
- pxor xmm0, xmm0
- %if ABI_IS_32BIT=0
- movsxd r8, dword ptr arg(5) ;dst_pitch
- %endif
- ; get the first horizontal line done
- movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movdqa xmm4, xmm3 ; make a copy of current line
- punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
- punpckhbw xmm4, xmm0
- pmullw xmm3, xmm1
- pmullw xmm4, xmm1
- movdqu xmm5, [rsi+1]
- movdqa xmm6, xmm5
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
- pmullw xmm5, xmm2
- pmullw xmm6, xmm2
- paddw xmm3, xmm5
- paddw xmm4, xmm6
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
- movdqa xmm7, xmm3
- packuswb xmm7, xmm4
- add rsi, rdx ; next line
- .next_row:
- movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movdqa xmm4, xmm3 ; make a copy of current line
- punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
- punpckhbw xmm4, xmm0
- pmullw xmm3, xmm1
- pmullw xmm4, xmm1
- movdqu xmm5, [rsi+1]
- movdqa xmm6, xmm5
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
- pmullw xmm5, xmm2
- pmullw xmm6, xmm2
- paddw xmm3, xmm5
- paddw xmm4, xmm6
- movdqa xmm5, xmm7
- movdqa xmm6, xmm7
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
- pmullw xmm5, [rax]
- pmullw xmm6, [rax]
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
- movdqa xmm7, xmm3
- packuswb xmm7, xmm4
- pmullw xmm3, [rax+16]
- pmullw xmm4, [rax+16]
- paddw xmm3, xmm5
- paddw xmm4, xmm6
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
- packuswb xmm3, xmm4
- movdqa [rdi], xmm3 ; store the results in the destination
- add rsi, rdx ; next line
- %if ABI_IS_32BIT
- add rdi, DWORD PTR arg(5) ;dst_pitch
- %else
- add rdi, r8
- %endif
- cmp rdi, rcx
- jne .next_row
- jmp .done
- .b16x16_sp_only:
- movsxd rax, dword ptr arg(3) ;yoffset
- shl rax, 5
- add rax, rcx ;VFilter
- mov rdi, arg(4) ;dst_ptr
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, dword ptr arg(5) ;dst_pitch
- movdqa xmm1, [rax]
- movdqa xmm2, [rax+16]
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- pxor xmm0, xmm0
- ; get the first horizontal line done
- movdqu xmm7, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- add rsi, rax ; next line
- .next_row_spo:
- movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movdqa xmm5, xmm7
- movdqa xmm6, xmm7
- movdqa xmm4, xmm3 ; make a copy of current line
- movdqa xmm7, xmm3
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
- punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
- punpckhbw xmm4, xmm0
- pmullw xmm5, xmm1
- pmullw xmm6, xmm1
- pmullw xmm3, xmm2
- pmullw xmm4, xmm2
- paddw xmm3, xmm5
- paddw xmm4, xmm6
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
- packuswb xmm3, xmm4
- movdqa [rdi], xmm3 ; store the results in the destination
- add rsi, rax ; next line
- add rdi, rdx ;dst_pitch
- cmp rdi, rcx
- jne .next_row_spo
- jmp .done
- .b16x16_fp_only:
- lea rcx, [rdi+rdx*8]
- lea rcx, [rcx+rdx*8]
- movsxd rax, dword ptr arg(1) ;src_pixels_per_line
- pxor xmm0, xmm0
- .next_row_fpo:
- movdqu xmm3, [rsi] ; xx 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14
- movdqa xmm4, xmm3 ; make a copy of current line
- punpcklbw xmm3, xmm0 ; xx 00 01 02 03 04 05 06
- punpckhbw xmm4, xmm0
- pmullw xmm3, xmm1
- pmullw xmm4, xmm1
- movdqu xmm5, [rsi+1]
- movdqa xmm6, xmm5
- punpcklbw xmm5, xmm0
- punpckhbw xmm6, xmm0
- pmullw xmm5, xmm2
- pmullw xmm6, xmm2
- paddw xmm3, xmm5
- paddw xmm4, xmm6
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- paddw xmm4, [GLOBAL(rd)]
- psraw xmm4, VP8_FILTER_SHIFT
- packuswb xmm3, xmm4
- movdqa [rdi], xmm3 ; store the results in the destination
- add rsi, rax ; next line
- add rdi, rdx ; dst_pitch
- cmp rdi, rcx
- jne .next_row_fpo
- .done:
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- ;void vp8_bilinear_predict8x8_sse2
- ;(
- ; unsigned char *src_ptr,
- ; int src_pixels_per_line,
- ; int xoffset,
- ; int yoffset,
- ; unsigned char *dst_ptr,
- ; int dst_pitch
- ;)
- global sym(vp8_bilinear_predict8x8_sse2) PRIVATE
- sym(vp8_bilinear_predict8x8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
- SAVE_XMM 7
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
- ALIGN_STACK 16, rax
- sub rsp, 144 ; reserve 144 bytes
- ;const short *HFilter = vp8_bilinear_filters_x86_8[xoffset]
- ;const short *VFilter = vp8_bilinear_filters_x86_8[yoffset]
- lea rcx, [GLOBAL(sym(vp8_bilinear_filters_x86_8))]
- mov rsi, arg(0) ;src_ptr
- movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
- ;Read 9-line unaligned data in and put them on stack. This gives a big
- ;performance boost.
- movdqu xmm0, [rsi]
- lea rax, [rdx + rdx*2]
- movdqu xmm1, [rsi+rdx]
- movdqu xmm2, [rsi+rdx*2]
- add rsi, rax
- movdqu xmm3, [rsi]
- movdqu xmm4, [rsi+rdx]
- movdqu xmm5, [rsi+rdx*2]
- add rsi, rax
- movdqu xmm6, [rsi]
- movdqu xmm7, [rsi+rdx]
- movdqa XMMWORD PTR [rsp], xmm0
- movdqu xmm0, [rsi+rdx*2]
- movdqa XMMWORD PTR [rsp+16], xmm1
- movdqa XMMWORD PTR [rsp+32], xmm2
- movdqa XMMWORD PTR [rsp+48], xmm3
- movdqa XMMWORD PTR [rsp+64], xmm4
- movdqa XMMWORD PTR [rsp+80], xmm5
- movdqa XMMWORD PTR [rsp+96], xmm6
- movdqa XMMWORD PTR [rsp+112], xmm7
- movdqa XMMWORD PTR [rsp+128], xmm0
- movsxd rax, dword ptr arg(2) ;xoffset
- shl rax, 5
- add rax, rcx ;HFilter
- mov rdi, arg(4) ;dst_ptr
- movsxd rdx, dword ptr arg(5) ;dst_pitch
- movdqa xmm1, [rax]
- movdqa xmm2, [rax+16]
- movsxd rax, dword ptr arg(3) ;yoffset
- shl rax, 5
- add rax, rcx ;VFilter
- lea rcx, [rdi+rdx*8]
- movdqa xmm5, [rax]
- movdqa xmm6, [rax+16]
- pxor xmm0, xmm0
- ; get the first horizontal line done
- movdqa xmm3, XMMWORD PTR [rsp]
- movdqa xmm4, xmm3 ; make a copy of current line
- psrldq xmm4, 1
- punpcklbw xmm3, xmm0 ; 00 01 02 03 04 05 06 07
- punpcklbw xmm4, xmm0 ; 01 02 03 04 05 06 07 08
- pmullw xmm3, xmm1
- pmullw xmm4, xmm2
- paddw xmm3, xmm4
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- movdqa xmm7, xmm3
- add rsp, 16 ; next line
- .next_row8x8:
- movdqa xmm3, XMMWORD PTR [rsp] ; 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
- movdqa xmm4, xmm3 ; make a copy of current line
- psrldq xmm4, 1
- punpcklbw xmm3, xmm0 ; 00 01 02 03 04 05 06 07
- punpcklbw xmm4, xmm0 ; 01 02 03 04 05 06 07 08
- pmullw xmm3, xmm1
- pmullw xmm4, xmm2
- paddw xmm3, xmm4
- pmullw xmm7, xmm5
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- movdqa xmm4, xmm3
- pmullw xmm3, xmm6
- paddw xmm3, xmm7
- movdqa xmm7, xmm4
- paddw xmm3, [GLOBAL(rd)] ; xmm3 += round value
- psraw xmm3, VP8_FILTER_SHIFT ; xmm3 /= 128
- packuswb xmm3, xmm0
- movq [rdi], xmm3 ; store the results in the destination
- add rsp, 16 ; next line
- add rdi, rdx
- cmp rdi, rcx
- jne .next_row8x8
- ;add rsp, 144
- pop rsp
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
- RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
- SECTION_RODATA
- align 16
- rd:
- times 8 dw 0x40
|