Commit 7a000715 authored by Daniel Kang's avatar Daniel Kang
Browse files

Adds x86inc.asm and update idct/dequant mmx

Updates idct/dequant mmx assembly to work with vpnext instead of vp8.

Also adds x86inc.asm

Change-Id: I6e147d5e89177ae449271e97e50d082eb11b078e
parent 04fa2ecd
...@@ -33,6 +33,7 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx) ...@@ -33,6 +33,7 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx)
} }
#endif #endif
// The commented functions need to be re-written for vpx.
#if HAVE_ARMV6 #if HAVE_ARMV6
if (flags & HAS_MEDIA) if (flags & HAS_MEDIA)
{ {
...@@ -46,10 +47,10 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx) ...@@ -46,10 +47,10 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx)
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6; rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6;
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_armv6; rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_armv6;
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_v6; //rtcd->idct.idct1 = vp8_short_idct4x4llm_1_v6;
rtcd->idct.idct16 = vp8_short_idct4x4llm_v6_dual; //rtcd->idct.idct16 = vp8_short_idct4x4llm_v6_dual;
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_v6; //rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_v6;
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_v6; //rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_v6;
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6; rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_armv6; rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_armv6;
...@@ -84,10 +85,10 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx) ...@@ -84,10 +85,10 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx)
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon; rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon;
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_neon; rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_neon;
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_neon; //rtcd->idct.idct1 = vp8_short_idct4x4llm_1_neon;
rtcd->idct.idct16 = vp8_short_idct4x4llm_neon; //rtcd->idct.idct16 = vp8_short_idct4x4llm_neon;
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_neon; //rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_neon;
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_neon; //rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_neon;
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon; rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_neon; rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_neon;
......
...@@ -139,10 +139,4 @@ void vp8_machine_specific_config(VP8_COMMON *ctx) ...@@ -139,10 +139,4 @@ void vp8_machine_specific_config(VP8_COMMON *ctx)
#if ARCH_ARM #if ARCH_ARM
vp8_arch_arm_common_init(ctx); vp8_arch_arm_common_init(ctx);
#endif #endif
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_c;
rtcd->idct.idct16 = vp8_short_idct4x4llm_c;
rtcd->idct.idct1_scalar_add = vp8_dc_only_idct_add_c;
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_c;
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_c;
} }
...@@ -20,22 +20,22 @@ ...@@ -20,22 +20,22 @@
*/ */
#if HAVE_MMX #if HAVE_MMX
extern prototype_idct(vp8_short_idct4x4llm_1_mmx); extern prototype_idct(vpx_short_idct4x4llm_1_mmx);
extern prototype_idct(vp8_short_idct4x4llm_mmx); extern prototype_idct(vpx_short_idct4x4llm_mmx);
extern prototype_idct_scalar_add(vp8_dc_only_idct_add_mmx); extern prototype_idct_scalar_add(vpx_dc_only_idct_add_mmx);
extern prototype_second_order(vp8_short_inv_walsh4x4_mmx); extern prototype_second_order(vp8_short_inv_walsh4x4_mmx);
extern prototype_second_order(vp8_short_inv_walsh4x4_1_mmx); extern prototype_second_order(vp8_short_inv_walsh4x4_1_mmx);
#if !CONFIG_RUNTIME_CPU_DETECT #if !CONFIG_RUNTIME_CPU_DETECT
#undef vp8_idct_idct1 #undef vp8_idct_idct1
#define vp8_idct_idct1 vp8_short_idct4x4llm_1_mmx #define vp8_idct_idct1 vpx_short_idct4x4llm_1_mmx
#undef vp8_idct_idct16 #undef vp8_idct_idct16
#define vp8_idct_idct16 vp8_short_idct4x4llm_mmx #define vp8_idct_idct16 vpx_short_idct4x4llm_mmx
#undef vp8_idct_idct1_scalar_add #undef vp8_idct_idct1_scalar_add
#define vp8_idct_idct1_scalar_add vp8_dc_only_idct_add_mmx #define vp8_idct_idct1_scalar_add vpx_dc_only_idct_add_mmx
#undef vp8_idct_iwalsh16 #undef vp8_idct_iwalsh16
#define vp8_idct_iwalsh16 vp8_short_inv_walsh4x4_mmx #define vp8_idct_iwalsh16 vp8_short_inv_walsh4x4_mmx
......
; ;
; Copyright (c) 2010 The WebM project authors. All Rights Reserved. ; Copyright (c) 2012 The WebM project authors. All Rights Reserved.
; ;
; Use of this source code is governed by a BSD-style license ; 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 ; that can be found in the LICENSE file in the root of the source
...@@ -8,8 +8,18 @@ ...@@ -8,8 +8,18 @@
; be found in the AUTHORS file in the root of the source tree. ; be found in the AUTHORS file in the root of the source tree.
; ;
%include "vpx_ports/x86inc.asm"
SECTION_RODATA
align 16
x_s1sqr2: times 4 dw 0x8A8C
align 16
x_c1sqr2less1: times 4 dw 0x4E7B
align 16
pw_16: times 4 dw 16
SECTION .text
%include "vpx_ports/x86_abi_support.asm"
; /**************************************************************************** ; /****************************************************************************
; * Notes: ; * Notes:
...@@ -31,262 +41,196 @@ ...@@ -31,262 +41,196 @@
; * ; *
; **************************************************************************/ ; **************************************************************************/
INIT_MMX
;void short_idct4x4llm_mmx(short *input, short *output, int pitch) ;void short_idct4x4llm_mmx(short *input, short *output, int pitch)
global sym(vp8_short_idct4x4llm_mmx) cglobal short_idct4x4llm_mmx, 3,3,0, inp, out, pit
sym(vp8_short_idct4x4llm_mmx): mova m0, [inpq +0]
push rbp mova m1, [inpq +8]
mov rbp, rsp
SHADOW_ARGS_TO_STACK 3
GET_GOT rbx
; end prolog
mov rax, arg(0) ;input
mov rdx, arg(1) ;output
movq mm0, [rax ]
movq mm1, [rax+ 8]
movq mm2, [rax+16] mova m2, [inpq+16]
movq mm3, [rax+24] mova m3, [inpq+24]
movsxd rax, dword ptr arg(2) ;pitch psubw m0, m2 ; b1= 0-2
paddw m2, m2 ;
psubw mm0, mm2 ; b1= 0-2 mova m5, m1
paddw mm2, mm2 ; paddw m2, m0 ; a1 =0+2
movq mm5, mm1 pmulhw m5, [x_s1sqr2] ;
paddw mm2, mm0 ; a1 =0+2 paddw m5, m1 ; ip1 * sin(pi/8) * sqrt(2)
pmulhw mm5, [GLOBAL(x_s1sqr2)] ; mova m7, m3 ;
paddw mm5, mm1 ; ip1 * sin(pi/8) * sqrt(2) pmulhw m7, [x_c1sqr2less1] ;
movq mm7, mm3 ; paddw m7, m3 ; ip3 * cos(pi/8) * sqrt(2)
pmulhw mm7, [GLOBAL(x_c1sqr2less1)] ; psubw m7, m5 ; c1
paddw mm7, mm3 ; ip3 * cos(pi/8) * sqrt(2) mova m5, m1
psubw mm7, mm5 ; c1 mova m4, m3
movq mm5, mm1 pmulhw m5, [x_c1sqr2less1]
movq mm4, mm3 paddw m5, m1
pmulhw mm5, [GLOBAL(x_c1sqr2less1)] pmulhw m3, [x_s1sqr2]
paddw mm5, mm1 paddw m3, m4
pmulhw mm3, [GLOBAL(x_s1sqr2)] paddw m3, m5 ; d1
paddw mm3, mm4 mova m6, m2 ; a1
paddw mm3, mm5 ; d1 mova m4, m0 ; b1
movq mm6, mm2 ; a1 paddw m2, m3 ;0
movq mm4, mm0 ; b1 paddw m4, m7 ;1
paddw mm2, mm3 ;0 psubw m0, m7 ;2
paddw mm4, mm7 ;1 psubw m6, m3 ;3
psubw mm0, mm7 ;2
psubw mm6, mm3 ;3 mova m1, m2 ; 03 02 01 00
mova m3, m4 ; 23 22 21 20
movq mm1, mm2 ; 03 02 01 00 punpcklwd m1, m0 ; 11 01 10 00
movq mm3, mm4 ; 23 22 21 20 punpckhwd m2, m0 ; 13 03 12 02
punpcklwd mm1, mm0 ; 11 01 10 00 punpcklwd m3, m6 ; 31 21 30 20
punpckhwd mm2, mm0 ; 13 03 12 02 punpckhwd m4, m6 ; 33 23 32 22
punpcklwd mm3, mm6 ; 31 21 30 20 mova m0, m1 ; 11 01 10 00
punpckhwd mm4, mm6 ; 33 23 32 22 mova m5, m2 ; 13 03 12 02
movq mm0, mm1 ; 11 01 10 00 punpckldq m0, m3 ; 30 20 10 00
movq mm5, mm2 ; 13 03 12 02 punpckhdq m1, m3 ; 31 21 11 01
punpckldq mm0, mm3 ; 30 20 10 00 punpckldq m2, m4 ; 32 22 12 02
punpckhdq mm1, mm3 ; 31 21 11 01 punpckhdq m5, m4 ; 33 23 13 03
punpckldq mm2, mm4 ; 32 22 12 02 mova m3, m5 ; 33 23 13 03
punpckhdq mm5, mm4 ; 33 23 13 03
movq mm3, mm5 ; 33 23 13 03 psubw m0, m2 ; b1= 0-2
paddw m2, m2 ;
psubw mm0, mm2 ; b1= 0-2 mova m5, m1
paddw mm2, mm2 ; paddw m2, m0 ; a1 =0+2
movq mm5, mm1 pmulhw m5, [x_s1sqr2] ;
paddw mm2, mm0 ; a1 =0+2 paddw m5, m1 ; ip1 * sin(pi/8) * sqrt(2)
pmulhw mm5, [GLOBAL(x_s1sqr2)] ; mova m7, m3 ;
paddw mm5, mm1 ; ip1 * sin(pi/8) * sqrt(2) pmulhw m7, [x_c1sqr2less1] ;
movq mm7, mm3 ; paddw m7, m3 ; ip3 * cos(pi/8) * sqrt(2)
pmulhw mm7, [GLOBAL(x_c1sqr2less1)] ; psubw m7, m5 ; c1
paddw mm7, mm3 ; ip3 * cos(pi/8) * sqrt(2) mova m5, m1
psubw mm7, mm5 ; c1 mova m4, m3
movq mm5, mm1 pmulhw m5, [x_c1sqr2less1]
movq mm4, mm3 paddw m5, m1
pmulhw mm5, [GLOBAL(x_c1sqr2less1)] pmulhw m3, [x_s1sqr2]
paddw mm5, mm1 paddw m3, m4
pmulhw mm3, [GLOBAL(x_s1sqr2)] paddw m3, m5 ; d1
paddw mm3, mm4 paddw m0, [pw_16]
paddw mm3, mm5 ; d1 paddw m2, [pw_16]
paddw mm0, [GLOBAL(fours)] mova m6, m2 ; a1
paddw mm2, [GLOBAL(fours)] mova m4, m0 ; b1
movq mm6, mm2 ; a1 paddw m2, m3 ;0
movq mm4, mm0 ; b1 paddw m4, m7 ;1
paddw mm2, mm3 ;0 psubw m0, m7 ;2
paddw mm4, mm7 ;1 psubw m6, m3 ;3
psubw mm0, mm7 ;2 psraw m2, 5
psubw mm6, mm3 ;3 psraw m0, 5
psraw mm2, 3 psraw m4, 5
psraw mm0, 3 psraw m6, 5
psraw mm4, 3
psraw mm6, 3 mova m1, m2 ; 03 02 01 00
mova m3, m4 ; 23 22 21 20
movq mm1, mm2 ; 03 02 01 00 punpcklwd m1, m0 ; 11 01 10 00
movq mm3, mm4 ; 23 22 21 20 punpckhwd m2, m0 ; 13 03 12 02
punpcklwd mm1, mm0 ; 11 01 10 00 punpcklwd m3, m6 ; 31 21 30 20
punpckhwd mm2, mm0 ; 13 03 12 02 punpckhwd m4, m6 ; 33 23 32 22
punpcklwd mm3, mm6 ; 31 21 30 20 mova m0, m1 ; 11 01 10 00
punpckhwd mm4, mm6 ; 33 23 32 22 mova m5, m2 ; 13 03 12 02
movq mm0, mm1 ; 11 01 10 00 punpckldq m0, m3 ; 30 20 10 00
movq mm5, mm2 ; 13 03 12 02 punpckhdq m1, m3 ; 31 21 11 01
punpckldq mm0, mm3 ; 30 20 10 00 punpckldq m2, m4 ; 32 22 12 02
punpckhdq mm1, mm3 ; 31 21 11 01 punpckhdq m5, m4 ; 33 23 13 03
punpckldq mm2, mm4 ; 32 22 12 02 mova [outq], m0
punpckhdq mm5, mm4 ; 33 23 13 03
movq [rdx], mm0 mova [outq+r2], m1
mova [outq+pitq*2], m2
movq [rdx+rax], mm1
movq [rdx+rax*2], mm2
add rdx, rax
movq [rdx+rax*2], mm5
; begin epilog
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
add outq, pitq
mova [outq+pitq*2], m5
RET
;void short_idct4x4llm_1_mmx(short *input, short *output, int pitch) ;void short_idct4x4llm_1_mmx(short *input, short *output, int pitch)
global sym(vp8_short_idct4x4llm_1_mmx) cglobal short_idct4x4llm_1_mmx,3,3,0,inp,out,pit
sym(vp8_short_idct4x4llm_1_mmx): movh m0, [inpq]
push rbp paddw m0, [pw_16]
mov rbp, rsp psraw m0, 5
SHADOW_ARGS_TO_STACK 3 punpcklwd m0, m0
GET_GOT rbx punpckldq m0, m0
; end prolog
mova [outq], m0
mov rax, arg(0) ;input mova [outq+pitq], m0
movd mm0, [rax]
mova [outq+pitq*2], m0
paddw mm0, [GLOBAL(fours)] add r1, r2
mov rdx, arg(1) ;output
mova [outq+pitq*2], m0
psraw mm0, 3 RET
movsxd rax, dword ptr arg(2) ;pitch
punpcklwd mm0, mm0 ;void dc_only_idct_add_mmx(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride)
punpckldq mm0, mm0 cglobal dc_only_idct_add_mmx, 5,5,0,in_dc,pred,dst,pit,stride
pxor m0, m0
movq [rdx], mm0
movq [rdx+rax], mm0 movh m5, in_dcq ; dc
paddw m5, [pw_16]
movq [rdx+rax*2], mm0
add rdx, rax psraw m5, 5
movq [rdx+rax*2], mm0 punpcklwd m5, m5
punpckldq m5, m5
; begin epilog movh m1, [predq]
RESTORE_GOT punpcklbw m1, m0
UNSHADOW_ARGS paddsw m1, m5
pop rbp packuswb m1, m0 ; pack and unpack to saturate
ret movh [dstq], m1
;void vp8_dc_only_idct_add_mmx(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride) movh m2, [predq+pitq]
global sym(vp8_dc_only_idct_add_mmx) punpcklbw m2, m0
sym(vp8_dc_only_idct_add_mmx): paddsw m2, m5
push rbp packuswb m2, m0 ; pack and unpack to saturate
mov rbp, rsp movh [dstq+strideq], m2
SHADOW_ARGS_TO_STACK 5
GET_GOT rbx movh m3, [predq+2*pitq]
push rsi punpcklbw m3, m0
push rdi paddsw m3, m5
; end prolog packuswb m3, m0 ; pack and unpack to saturate
movh [dstq+2*strideq], m3
mov rsi, arg(1) ;s -- prediction
mov rdi, arg(2) ;d -- destination add dstq, strideq
movsxd rax, dword ptr arg(4) ;stride add predq, pitq
movsxd rdx, dword ptr arg(3) ;pitch movh m4, [predq+2*pitq]
pxor mm0, mm0 punpcklbw m4, m0
paddsw m4, m5
movd mm5, arg(0) ;input_dc packuswb m4, m0 ; pack and unpack to saturate
movh [dstq+2*strideq], m4
paddw mm5, [GLOBAL(fours)] RET
psraw mm5, 3
punpcklwd mm5, mm5
punpckldq mm5, mm5
movd mm1, [rsi]
punpcklbw mm1, mm0
paddsw mm1, mm5
packuswb mm1, mm0 ; pack and unpack to saturate
movd [rdi], mm1
movd mm2, [rsi+rdx]
punpcklbw mm2, mm0
paddsw mm2, mm5
packuswb mm2, mm0 ; pack and unpack to saturate
movd [rdi+rax], mm2
movd mm3, [rsi+2*rdx]
punpcklbw mm3, mm0
paddsw mm3, mm5
packuswb mm3, mm0 ; pack and unpack to saturate
movd [rdi+2*rax], mm3
add rdi, rax
add rsi, rdx
movd mm4, [rsi+2*rdx]
punpcklbw mm4, mm0
paddsw mm4, mm5
packuswb mm4, mm0 ; pack and unpack to saturate
movd [rdi+2*rax], mm4
; begin epilog
pop rdi
pop rsi
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
SECTION_RODATA
align 16
x_s1sqr2:
times 4 dw 0x8A8C
align 16
x_c1sqr2less1:
times 4 dw 0x4E7B
align 16
fours:
times 4 dw 0x0004
...@@ -34,14 +34,14 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx) ...@@ -34,14 +34,14 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx)
/* Override default functions with fastest ones for this CPU. */ /* Override default functions with fastest ones for this CPU. */
#if HAVE_MMX #if HAVE_MMX
// The commented functions need to be re-written for vpx.
if (flags & HAS_MMX) if (flags & HAS_MMX)
{ {
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_mmx; rtcd->idct.idct1 = vpx_short_idct4x4llm_1_mmx;
rtcd->idct.idct16 = vp8_short_idct4x4llm_mmx; rtcd->idct.idct16 = vpx_short_idct4x4llm_mmx;
rtcd->idct.idct1_scalar_add = vp8_dc_only_idct_add_mmx; rtcd->idct.idct1_scalar_add = vpx_dc_only_idct_add_mmx;
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_mmx; //rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_mmx;
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_mmx; //rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_mmx;
rtcd->recon.recon = vp8_recon_b_mmx; rtcd->recon.recon = vp8_recon_b_mmx;
rtcd->recon.copy8x8 = vp8_copy_mem8x8_mmx; rtcd->recon.copy8x8 = vp8_copy_mem8x8_mmx;
...@@ -91,7 +91,7 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx) ...@@ -91,7 +91,7 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx)
vp8_build_intra_predictors_mbuv_s_sse2; vp8_build_intra_predictors_mbuv_s_sse2;
#endif #endif
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_sse2; //rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_sse2;