2010-11-01 21:24:15 +01:00
|
|
|
;
|
|
|
|
; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
|
|
|
;
|
|
|
|
; Use of this source code is governed by a BSD-style license and patent
|
|
|
|
; grant that can be found in the LICENSE file in the root of the source
|
|
|
|
; tree. 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"
|
2012-11-07 01:59:01 +01:00
|
|
|
%include "vp8_asm_enc_offsets.asm"
|
2010-11-01 21:24:15 +01:00
|
|
|
|
|
|
|
|
2011-04-07 22:40:05 +02:00
|
|
|
; void vp8_fast_quantize_b_ssse3 | arg
|
|
|
|
; (BLOCK *b, | 0
|
|
|
|
; BLOCKD *d) | 1
|
2010-11-01 21:24:15 +01:00
|
|
|
;
|
2011-04-07 22:40:05 +02:00
|
|
|
|
2012-05-24 00:52:34 +02:00
|
|
|
global sym(vp8_fast_quantize_b_ssse3) PRIVATE
|
2011-04-07 22:40:05 +02:00
|
|
|
sym(vp8_fast_quantize_b_ssse3):
|
2010-11-01 21:24:15 +01:00
|
|
|
push rbp
|
|
|
|
mov rbp, rsp
|
|
|
|
GET_GOT rbx
|
2011-04-07 22:40:05 +02:00
|
|
|
|
|
|
|
%if ABI_IS_32BIT
|
|
|
|
push rdi
|
2010-11-01 21:24:15 +01:00
|
|
|
push rsi
|
2011-04-07 22:40:05 +02:00
|
|
|
%else
|
2013-02-01 00:36:55 +01:00
|
|
|
%if LIBVPX_YASM_WIN64
|
2010-11-01 21:24:15 +01:00
|
|
|
push rdi
|
2011-04-07 22:40:05 +02:00
|
|
|
push rsi
|
|
|
|
%endif
|
|
|
|
%endif
|
2010-11-01 21:24:15 +01:00
|
|
|
; end prolog
|
|
|
|
|
2011-04-07 22:40:05 +02:00
|
|
|
%if ABI_IS_32BIT
|
|
|
|
mov rdi, arg(0) ; BLOCK *b
|
|
|
|
mov rsi, arg(1) ; BLOCKD *d
|
|
|
|
%else
|
2013-02-01 00:36:55 +01:00
|
|
|
%if LIBVPX_YASM_WIN64
|
2011-04-07 22:40:05 +02:00
|
|
|
mov rdi, rcx ; BLOCK *b
|
|
|
|
mov rsi, rdx ; BLOCKD *d
|
|
|
|
%else
|
|
|
|
;mov rdi, rdi ; BLOCK *b
|
|
|
|
;mov rsi, rsi ; BLOCKD *d
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
|
|
|
|
mov rax, [rdi + vp8_block_coeff]
|
|
|
|
mov rcx, [rdi + vp8_block_round]
|
|
|
|
mov rdx, [rdi + vp8_block_quant_fast]
|
|
|
|
|
|
|
|
; coeff
|
|
|
|
movdqa xmm0, [rax]
|
|
|
|
movdqa xmm4, [rax + 16]
|
|
|
|
|
|
|
|
; round
|
|
|
|
movdqa xmm2, [rcx]
|
|
|
|
movdqa xmm3, [rcx + 16]
|
2010-11-01 21:24:15 +01:00
|
|
|
|
|
|
|
movdqa xmm1, xmm0
|
|
|
|
movdqa xmm5, xmm4
|
|
|
|
|
2011-04-07 22:40:05 +02:00
|
|
|
; sz = z >> 15
|
|
|
|
psraw xmm0, 15
|
|
|
|
psraw xmm4, 15
|
2010-11-01 21:24:15 +01:00
|
|
|
|
|
|
|
pabsw xmm1, xmm1
|
|
|
|
pabsw xmm5, xmm5
|
|
|
|
|
|
|
|
paddw xmm1, xmm2
|
|
|
|
paddw xmm5, xmm3
|
|
|
|
|
2011-04-07 22:40:05 +02:00
|
|
|
; quant_fast
|
|
|
|
pmulhw xmm1, [rdx]
|
|
|
|
pmulhw xmm5, [rdx + 16]
|
2010-11-01 21:24:15 +01:00
|
|
|
|
2011-04-07 22:40:05 +02:00
|
|
|
mov rax, [rsi + vp8_blockd_qcoeff]
|
|
|
|
mov rdi, [rsi + vp8_blockd_dequant]
|
|
|
|
mov rcx, [rsi + vp8_blockd_dqcoeff]
|
2010-11-01 21:24:15 +01:00
|
|
|
|
2011-12-29 18:05:50 +01:00
|
|
|
movdqa xmm2, xmm1 ;store y for getting eob
|
|
|
|
movdqa xmm3, xmm5
|
|
|
|
|
2010-11-01 21:24:15 +01:00
|
|
|
pxor xmm1, xmm0
|
|
|
|
pxor xmm5, xmm4
|
|
|
|
psubw xmm1, xmm0
|
|
|
|
psubw xmm5, xmm4
|
|
|
|
|
2011-04-07 22:40:05 +02:00
|
|
|
movdqa [rax], xmm1
|
|
|
|
movdqa [rax + 16], xmm5
|
2010-11-01 21:24:15 +01:00
|
|
|
|
2011-12-29 18:05:50 +01:00
|
|
|
movdqa xmm0, [rdi]
|
|
|
|
movdqa xmm4, [rdi + 16]
|
2010-11-01 21:24:15 +01:00
|
|
|
|
2011-12-29 18:05:50 +01:00
|
|
|
pmullw xmm0, xmm1
|
|
|
|
pmullw xmm4, xmm5
|
|
|
|
pxor xmm1, xmm1
|
2010-11-01 21:24:15 +01:00
|
|
|
|
2011-12-29 18:05:50 +01:00
|
|
|
pcmpgtw xmm2, xmm1 ;calculate eob
|
|
|
|
pcmpgtw xmm3, xmm1
|
|
|
|
packsswb xmm2, xmm3
|
|
|
|
pshufb xmm2, [GLOBAL(zz_shuf)]
|
2010-11-01 21:24:15 +01:00
|
|
|
|
2011-12-29 18:05:50 +01:00
|
|
|
pmovmskb edx, xmm2
|
2010-11-01 21:24:15 +01:00
|
|
|
|
2011-12-29 18:05:50 +01:00
|
|
|
movdqa [rcx], xmm0 ;store dqcoeff
|
|
|
|
movdqa [rcx + 16], xmm4 ;store dqcoeff
|
2011-10-25 13:25:11 +02:00
|
|
|
mov rcx, [rsi + vp8_blockd_eob]
|
|
|
|
|
2011-12-29 18:05:50 +01:00
|
|
|
bsr eax, edx ;count 0
|
2010-11-01 21:24:15 +01:00
|
|
|
add eax, 1
|
2011-12-29 18:05:50 +01:00
|
|
|
|
|
|
|
cmp edx, 0 ;if all 0, eob=0
|
|
|
|
cmove eax, edx
|
|
|
|
|
2011-10-25 13:25:11 +02:00
|
|
|
mov BYTE PTR [rcx], al ;store eob
|
2011-04-07 22:40:05 +02:00
|
|
|
|
2010-11-01 21:24:15 +01:00
|
|
|
; begin epilog
|
2011-04-07 22:40:05 +02:00
|
|
|
%if ABI_IS_32BIT
|
|
|
|
pop rsi
|
2010-11-01 21:24:15 +01:00
|
|
|
pop rdi
|
2011-04-07 22:40:05 +02:00
|
|
|
%else
|
2013-02-01 00:36:55 +01:00
|
|
|
%if LIBVPX_YASM_WIN64
|
2010-11-01 21:24:15 +01:00
|
|
|
pop rsi
|
2011-04-07 22:40:05 +02:00
|
|
|
pop rdi
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
|
2010-11-01 21:24:15 +01:00
|
|
|
RESTORE_GOT
|
|
|
|
pop rbp
|
|
|
|
ret
|
|
|
|
|
|
|
|
SECTION_RODATA
|
|
|
|
align 16
|
|
|
|
zz_shuf:
|
|
|
|
db 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
|