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

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)
}
#endif
// The commented functions need to be re-written for vpx.
#if HAVE_ARMV6
if (flags & HAS_MEDIA)
{
......@@ -46,10 +47,10 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx)
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_armv6;
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_armv6;
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_v6;
rtcd->idct.idct16 = vp8_short_idct4x4llm_v6_dual;
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_v6;
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_v6;
//rtcd->idct.idct1 = vp8_short_idct4x4llm_1_v6;
//rtcd->idct.idct16 = vp8_short_idct4x4llm_v6_dual;
//rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_v6;
//rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_v6;
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_armv6;
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_armv6;
......@@ -84,10 +85,10 @@ void vp8_arch_arm_common_init(VP8_COMMON *ctx)
rtcd->subpix.bilinear8x4 = vp8_bilinear_predict8x4_neon;
rtcd->subpix.bilinear4x4 = vp8_bilinear_predict4x4_neon;
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_neon;
rtcd->idct.idct16 = vp8_short_idct4x4llm_neon;
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_neon;
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_neon;
//rtcd->idct.idct1 = vp8_short_idct4x4llm_1_neon;
//rtcd->idct.idct16 = vp8_short_idct4x4llm_neon;
//rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_neon;
//rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_neon;
rtcd->loopfilter.normal_mb_v = vp8_loop_filter_mbv_neon;
rtcd->loopfilter.normal_b_v = vp8_loop_filter_bv_neon;
......
......@@ -139,10 +139,4 @@ void vp8_machine_specific_config(VP8_COMMON *ctx)
#if ARCH_ARM
vp8_arch_arm_common_init(ctx);
#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 @@
*/
#if HAVE_MMX
extern prototype_idct(vp8_short_idct4x4llm_1_mmx);
extern prototype_idct(vp8_short_idct4x4llm_mmx);
extern prototype_idct_scalar_add(vp8_dc_only_idct_add_mmx);
extern prototype_idct(vpx_short_idct4x4llm_1_mmx);
extern prototype_idct(vpx_short_idct4x4llm_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_1_mmx);
#if !CONFIG_RUNTIME_CPU_DETECT
#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
#define vp8_idct_idct16 vp8_short_idct4x4llm_mmx
#define vp8_idct_idct16 vpx_short_idct4x4llm_mmx
#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
#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
; that can be found in the LICENSE file in the root of the source
......@@ -8,8 +8,18 @@
; 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:
......@@ -31,262 +41,196 @@
; *
; **************************************************************************/
INIT_MMX
;void short_idct4x4llm_mmx(short *input, short *output, int pitch)
global sym(vp8_short_idct4x4llm_mmx)
sym(vp8_short_idct4x4llm_mmx):
push rbp
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]
cglobal short_idct4x4llm_mmx, 3,3,0, inp, out, pit
mova m0, [inpq +0]
mova m1, [inpq +8]
movq mm2, [rax+16]
movq mm3, [rax+24]
mova m2, [inpq+16]
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
paddw mm2, mm2 ;
mova m5, m1
paddw m2, m0 ; a1 =0+2
movq mm5, mm1
paddw mm2, mm0 ; a1 =0+2
pmulhw m5, [x_s1sqr2] ;
paddw m5, m1 ; ip1 * sin(pi/8) * sqrt(2)
pmulhw mm5, [GLOBAL(x_s1sqr2)] ;
paddw mm5, mm1 ; ip1 * sin(pi/8) * sqrt(2)
mova m7, m3 ;
pmulhw m7, [x_c1sqr2less1] ;
movq mm7, mm3 ;
pmulhw mm7, [GLOBAL(x_c1sqr2less1)] ;
paddw m7, m3 ; ip3 * cos(pi/8) * sqrt(2)
psubw m7, m5 ; c1
paddw mm7, mm3 ; ip3 * cos(pi/8) * sqrt(2)
psubw mm7, mm5 ; c1
mova m5, m1
mova m4, m3
movq mm5, mm1
movq mm4, mm3
pmulhw m5, [x_c1sqr2less1]
paddw m5, m1
pmulhw mm5, [GLOBAL(x_c1sqr2less1)]
paddw mm5, mm1
pmulhw m3, [x_s1sqr2]
paddw m3, m4
pmulhw mm3, [GLOBAL(x_s1sqr2)]
paddw mm3, mm4
paddw m3, m5 ; d1
mova m6, m2 ; a1
paddw mm3, mm5 ; d1
movq mm6, mm2 ; a1
mova m4, m0 ; b1
paddw m2, m3 ;0
movq mm4, mm0 ; b1
paddw mm2, mm3 ;0
paddw m4, m7 ;1
psubw m0, m7 ;2
paddw mm4, mm7 ;1
psubw mm0, mm7 ;2
psubw m6, m3 ;3
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
movq mm3, mm4 ; 23 22 21 20
punpcklwd m1, m0 ; 11 01 10 00
punpckhwd m2, m0 ; 13 03 12 02
punpcklwd mm1, mm0 ; 11 01 10 00
punpckhwd mm2, mm0 ; 13 03 12 02
punpcklwd m3, m6 ; 31 21 30 20
punpckhwd m4, m6 ; 33 23 32 22
punpcklwd mm3, mm6 ; 31 21 30 20
punpckhwd mm4, mm6 ; 33 23 32 22
mova m0, m1 ; 11 01 10 00
mova m5, m2 ; 13 03 12 02
movq mm0, mm1 ; 11 01 10 00
movq mm5, mm2 ; 13 03 12 02
punpckldq m0, m3 ; 30 20 10 00
punpckhdq m1, m3 ; 31 21 11 01
punpckldq mm0, mm3 ; 30 20 10 00
punpckhdq mm1, mm3 ; 31 21 11 01
punpckldq m2, m4 ; 32 22 12 02
punpckhdq m5, m4 ; 33 23 13 03
punpckldq mm2, mm4 ; 32 22 12 02
punpckhdq mm5, mm4 ; 33 23 13 03
mova m3, m5 ; 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
paddw mm2, mm2 ;
mova m5, m1
paddw m2, m0 ; a1 =0+2
movq mm5, mm1
paddw mm2, mm0 ; a1 =0+2
pmulhw m5, [x_s1sqr2] ;
paddw m5, m1 ; ip1 * sin(pi/8) * sqrt(2)
pmulhw mm5, [GLOBAL(x_s1sqr2)] ;
paddw mm5, mm1 ; ip1 * sin(pi/8) * sqrt(2)
mova m7, m3 ;
pmulhw m7, [x_c1sqr2less1] ;
movq mm7, mm3 ;
pmulhw mm7, [GLOBAL(x_c1sqr2less1)] ;
paddw m7, m3 ; ip3 * cos(pi/8) * sqrt(2)
psubw m7, m5 ; c1
paddw mm7, mm3 ; ip3 * cos(pi/8) * sqrt(2)
psubw mm7, mm5 ; c1
mova m5, m1
mova m4, m3
movq mm5, mm1
movq mm4, mm3
pmulhw m5, [x_c1sqr2less1]
paddw m5, m1
pmulhw mm5, [GLOBAL(x_c1sqr2less1)]
paddw mm5, mm1
pmulhw m3, [x_s1sqr2]
paddw m3, m4
pmulhw mm3, [GLOBAL(x_s1sqr2)]
paddw mm3, mm4
paddw m3, m5 ; d1
paddw m0, [pw_16]
paddw mm3, mm5 ; d1
paddw mm0, [GLOBAL(fours)]
paddw m2, [pw_16]
mova m6, m2 ; a1
paddw mm2, [GLOBAL(fours)]
movq mm6, mm2 ; a1
mova m4, m0 ; b1
paddw m2, m3 ;0
movq mm4, mm0 ; b1
paddw mm2, mm3 ;0
paddw m4, m7 ;1
psubw m0, m7 ;2
paddw mm4, mm7 ;1
psubw mm0, mm7 ;2
psubw m6, m3 ;3
psraw m2, 5
psubw mm6, mm3 ;3
psraw mm2, 3
psraw m0, 5
psraw m4, 5
psraw mm0, 3
psraw mm4, 3
psraw m6, 5
psraw mm6, 3
mova m1, m2 ; 03 02 01 00
mova m3, m4 ; 23 22 21 20
movq mm1, mm2 ; 03 02 01 00
movq mm3, mm4 ; 23 22 21 20
punpcklwd m1, m0 ; 11 01 10 00
punpckhwd m2, m0 ; 13 03 12 02
punpcklwd mm1, mm0 ; 11 01 10 00
punpckhwd mm2, mm0 ; 13 03 12 02
punpcklwd m3, m6 ; 31 21 30 20
punpckhwd m4, m6 ; 33 23 32 22
punpcklwd mm3, mm6 ; 31 21 30 20
punpckhwd mm4, mm6 ; 33 23 32 22
mova m0, m1 ; 11 01 10 00
mova m5, m2 ; 13 03 12 02
movq mm0, mm1 ; 11 01 10 00
movq mm5, mm2 ; 13 03 12 02
punpckldq m0, m3 ; 30 20 10 00
punpckhdq m1, m3 ; 31 21 11 01
punpckldq mm0, mm3 ; 30 20 10 00
punpckhdq mm1, mm3 ; 31 21 11 01
punpckldq m2, m4 ; 32 22 12 02
punpckhdq m5, m4 ; 33 23 13 03
punpckldq mm2, mm4 ; 32 22 12 02
punpckhdq mm5, mm4 ; 33 23 13 03
mova [outq], m0
movq [rdx], mm0
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
mova [outq+r2], m1
mova [outq+pitq*2], m2
add outq, pitq
mova [outq+pitq*2], m5
RET
;void short_idct4x4llm_1_mmx(short *input, short *output, int pitch)
global sym(vp8_short_idct4x4llm_1_mmx)
sym(vp8_short_idct4x4llm_1_mmx):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 3
GET_GOT rbx
; end prolog
mov rax, arg(0) ;input
movd mm0, [rax]
paddw mm0, [GLOBAL(fours)]
mov rdx, arg(1) ;output
psraw mm0, 3
movsxd rax, dword ptr arg(2) ;pitch
punpcklwd mm0, mm0
punpckldq mm0, mm0
movq [rdx], mm0
movq [rdx+rax], mm0
movq [rdx+rax*2], mm0
add rdx, rax
movq [rdx+rax*2], mm0
; begin epilog
RESTORE_GOT
UNSHADOW_ARGS
pop rbp
ret
;void vp8_dc_only_idct_add_mmx(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride)
global sym(vp8_dc_only_idct_add_mmx)
sym(vp8_dc_only_idct_add_mmx):
push rbp
mov rbp, rsp
SHADOW_ARGS_TO_STACK 5
GET_GOT rbx
push rsi
push rdi
; end prolog
mov rsi, arg(1) ;s -- prediction
mov rdi, arg(2) ;d -- destination
movsxd rax, dword ptr arg(4) ;stride
movsxd rdx, dword ptr arg(3) ;pitch
pxor mm0, mm0
movd mm5, arg(0) ;input_dc
paddw mm5, [GLOBAL(fours)]
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
cglobal short_idct4x4llm_1_mmx,3,3,0,inp,out,pit
movh m0, [inpq]
paddw m0, [pw_16]
psraw m0, 5
punpcklwd m0, m0
punpckldq m0, m0
mova [outq], m0
mova [outq+pitq], m0
mova [outq+pitq*2], m0
add r1, r2
mova [outq+pitq*2], m0
RET
;void dc_only_idct_add_mmx(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride)
cglobal dc_only_idct_add_mmx, 5,5,0,in_dc,pred,dst,pit,stride
pxor m0, m0
movh m5, in_dcq ; dc
paddw m5, [pw_16]
psraw m5, 5
punpcklwd m5, m5
punpckldq m5, m5
movh m1, [predq]
punpcklbw m1, m0
paddsw m1, m5
packuswb m1, m0 ; pack and unpack to saturate
movh [dstq], m1
movh m2, [predq+pitq]
punpcklbw m2, m0
paddsw m2, m5
packuswb m2, m0 ; pack and unpack to saturate
movh [dstq+strideq], m2
movh m3, [predq+2*pitq]
punpcklbw m3, m0
paddsw m3, m5
packuswb m3, m0 ; pack and unpack to saturate
movh [dstq+2*strideq], m3
add dstq, strideq
add predq, pitq
movh m4, [predq+2*pitq]
punpcklbw m4, m0
paddsw m4, m5
packuswb m4, m0 ; pack and unpack to saturate
movh [dstq+2*strideq], m4
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)
/* Override default functions with fastest ones for this CPU. */
#if HAVE_MMX
// The commented functions need to be re-written for vpx.
if (flags & HAS_MMX)
{
rtcd->idct.idct1 = vp8_short_idct4x4llm_1_mmx;
rtcd->idct.idct16 = vp8_short_idct4x4llm_mmx;
rtcd->idct.idct1_scalar_add = vp8_dc_only_idct_add_mmx;
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_mmx;
rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_mmx;
rtcd->idct.idct1 = vpx_short_idct4x4llm_1_mmx;
rtcd->idct.idct16 = vpx_short_idct4x4llm_mmx;
rtcd->idct.idct1_scalar_add = vpx_dc_only_idct_add_mmx;
//rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_mmx;
//rtcd->idct.iwalsh1 = vp8_short_inv_walsh4x4_1_mmx;
rtcd->recon.recon = vp8_recon_b_mmx;
rtcd->recon.copy8x8 = vp8_copy_mem8x8_mmx;
......@@ -91,7 +91,7 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx)
vp8_build_intra_predictors_mbuv_s_sse2;
#endif
rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_sse2;
//rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_sse2;
#if CONFIG_ENHANCED_INTERP == 0 && CONFIG_HIGH_PRECISION_MV == 0 && CONFIG_SIXTEENTH_SUBPEL_UV == 0
rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_sse2;
......
......@@ -27,15 +27,16 @@ void vp8_arch_arm_decode_init(VP8D_COMP *pbi)
}
#endif
//The commented functions need to be re-written for vpx.
#if HAVE_ARMV6
if (flags & HAS_MEDIA)
{
pbi->dequant.block = vp8_dequantize_b_v6;
pbi->dequant.idct_add = vp8_dequant_idct_add_v6;
/*pbi->dequant.idct_add = vp8_dequant_idct_add_v6;
pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_v6;
pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_v6;
pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_v6;
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_v6;
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_v6;*/
}
#endif
......@@ -43,12 +44,12 @@ void vp8_arch_arm_decode_init(VP8D_COMP *pbi)
if (flags & HAS_NEON)
{
pbi->dequant.block = vp8_dequantize_b_neon;
pbi->dequant.idct_add = vp8_dequant_idct_add_neon;
//pbi->dequant.idct_add = vp8_dequant_idct_add_neon;
/*This is not used: NEON always dequants two blocks at once.
pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_neon;*/
pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_neon;
/*pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_neon;
pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_neon;
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_neon;
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_neon;*/
}
#endif
#endif
......
......@@ -43,10 +43,4 @@ void vp8_dmachine_specific_config(VP8D_COMP *pbi)
#if ARCH_ARM
vp8_arch_arm_decode_init(pbi);
#endif
pbi->dequant.idct_add = vp8_dequant_idct_add_c;
pbi->dequant.dc_idct_add = vp8_dequant_dc_idct_add_c;
pbi->dequant.dc_idct_add_y_block = vp8_dequant_dc_idct_add_y_block_c;
pbi->dequant.idct_add_y_block = vp8_dequant_idct_add_y_block_c;
pbi->dequant.idct_add_uv_block = vp8_dequant_idct_add_uv_block_c;
}
This diff is collapsed.
......@@ -21,8 +21,8 @@
*/
#if HAVE_MMX
extern prototype_dequant_block(vp8_dequantize_b_mmx);
extern prototype_dequant_idct_add(vp8_dequant_idct_add_mmx);
extern prototype_dequant_dc_idct_add(vp8_dequant_dc_idct_add_mmx);
extern prototype_dequant_idct_add(vpx_dequant_idct_add_mmx);
extern prototype_dequant_dc_idct_add(vpx_dequant_dc_idct_add_mmx);
extern prototype_dequant_dc_idct_add_y_block(vp8_dequant_dc_idct_add_y_block_mmx);
extern prototype_dequant_idct_add_y_block(vp8_dequant_idct_add_y_block_mmx);
extern prototype_dequant_idct_add_uv_block(vp8_dequant_idct_add_uv_block_mmx);
......@@ -32,7 +32,7 @@ extern prototype_dequant_idct_add_uv_block(vp8_dequant_idct_add_uv_block_mmx);
#define vp8_dequant_block vp8_dequantize_b_mmx
#undef vp8_dequant_idct_add
#define vp8_dequant_idct_add vp8_dequant_idct_add_mmx
#define vp8_dequant_idct_add vpx_dequant_idct_add_mmx
#undef vp8_dequant_dc_idct_add
#define vp8_dequant_dc_idct_add vp8_dequant_dc_idct_add_mmx
......
......@@ -21,24 +21,24 @@ void vp8_dequant_dc_idct_add_y_block_mmx
for (i = 0; i < 4; i++)
{
if (eobs[0] > 1)
vp8_dequant_dc_idct_add_mmx (q, dq, pre, dst, 16, stride, dc[0]);