From 1083fe499973fb363ab4325ec3b4a905cdb5c0e1 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 27 Apr 2011 10:05:10 -0700 Subject: [PATCH] SSE2/SSSE3 optimizations for build_predictors_mbuv{,_s}(). decoding before 10.425 10.432 10.423 =10.426 after: 10.405 10.416 10.398 =10.406, 0.2% faster encoding before 14.252 14.331 14.250 14.223 14.241 14.220 14.221 =14.248 after 14.095 14.090 14.085 14.095 14.064 14.081 14.089 =14.086, 1.1% faster Change-Id: I483d3d8f0deda8ad434cea76e16028380722aee2 --- vp8/common/generic/systemdependent.c | 6 + vp8/common/recon.h | 25 +++ vp8/common/reconintra.h | 5 - vp8/common/reconintra4x4.c | 2 +- vp8/common/x86/recon_sse2.asm | 408 +++++++++++++++++++++++++++++++++++ vp8/common/x86/recon_wrapper_sse2.c | 90 ++++++++ vp8/common/x86/recon_x86.h | 22 ++ vp8/common/x86/x86_systemdependent.c | 9 + vp8/decoder/decodframe.c | 7 +- vp8/encoder/encodeintra.c | 5 +- vp8/encoder/pickinter.c | 3 +- vp8/encoder/rdopt.c | 6 +- vp8/vp8_common.mk | 1 + 13 files changed, 575 insertions(+), 14 deletions(-) create mode 100644 vp8/common/x86/recon_wrapper_sse2.c diff --git a/vp8/common/generic/systemdependent.c b/vp8/common/generic/systemdependent.c index 5c64647..c36ae21 100644 --- a/vp8/common/generic/systemdependent.c +++ b/vp8/common/generic/systemdependent.c @@ -43,6 +43,12 @@ void vp8_machine_specific_config(VP8_COMMON *ctx) vp8_build_intra_predictors_mby; rtcd->recon.build_intra_predictors_mby_s = vp8_build_intra_predictors_mby_s; + rtcd->recon.build_intra_predictors_mbuv = + vp8_build_intra_predictors_mbuv; + rtcd->recon.build_intra_predictors_mbuv_s = + vp8_build_intra_predictors_mbuv_s; + rtcd->recon.intra4x4_predict = + vp8_intra4x4_predict; rtcd->subpix.sixtap16x16 = vp8_sixtap_predict16x16_c; rtcd->subpix.sixtap8x8 = vp8_sixtap_predict8x8_c; diff --git a/vp8/common/recon.h b/vp8/common/recon.h index e608f21..7cfc779 100644 --- a/vp8/common/recon.h +++ b/vp8/common/recon.h @@ -26,6 +26,9 @@ #define prototype_build_intra_predictors(sym) \ void sym(MACROBLOCKD *x) +#define prototype_intra4x4_predict(sym) \ + void sym(BLOCKD *x, int b_mode, unsigned char *predictor) + struct vp8_recon_rtcd_vtable; #if ARCH_X86 || ARCH_X86_64 @@ -88,11 +91,30 @@ extern prototype_build_intra_predictors\ extern prototype_build_intra_predictors\ (vp8_recon_build_intra_predictors_mby_s); +#ifndef vp8_recon_build_intra_predictors_mbuv +#define vp8_recon_build_intra_predictors_mbuv vp8_build_intra_predictors_mbuv +#endif +extern prototype_build_intra_predictors\ + (vp8_recon_build_intra_predictors_mbuv); + +#ifndef vp8_recon_build_intra_predictors_mbuv_s +#define vp8_recon_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s +#endif +extern prototype_build_intra_predictors\ + (vp8_recon_build_intra_predictors_mbuv_s); + +#ifndef vp8_recon_intra4x4_predict +#define vp8_recon_intra4x4_predict vp8_intra4x4_predict +#endif +extern prototype_intra4x4_predict\ + (vp8_recon_intra4x4_predict); + typedef prototype_copy_block((*vp8_copy_block_fn_t)); typedef prototype_recon_block((*vp8_recon_fn_t)); typedef prototype_recon_macroblock((*vp8_recon_mb_fn_t)); typedef prototype_build_intra_predictors((*vp8_build_intra_pred_fn_t)); +typedef prototype_intra4x4_predict((*vp8_intra4x4_pred_fn_t)); typedef struct vp8_recon_rtcd_vtable { vp8_copy_block_fn_t copy16x16; @@ -105,6 +127,9 @@ typedef struct vp8_recon_rtcd_vtable vp8_recon_mb_fn_t recon_mby; vp8_build_intra_pred_fn_t build_intra_predictors_mby_s; vp8_build_intra_pred_fn_t build_intra_predictors_mby; + vp8_build_intra_pred_fn_t build_intra_predictors_mbuv_s; + vp8_build_intra_pred_fn_t build_intra_predictors_mbuv; + vp8_intra4x4_pred_fn_t intra4x4_predict; } vp8_recon_rtcd_vtable_t; #if CONFIG_RUNTIME_CPU_DETECT diff --git a/vp8/common/reconintra.h b/vp8/common/reconintra.h index 4025a53..47e4792 100644 --- a/vp8/common/reconintra.h +++ b/vp8/common/reconintra.h @@ -14,9 +14,4 @@ extern void init_intra_left_above_pixels(MACROBLOCKD *x); -extern void vp8_build_intra_predictors_mbuv(MACROBLOCKD *x); -extern void vp8_build_intra_predictors_mbuv_s(MACROBLOCKD *x); - -extern void vp8_predict_intra4x4(BLOCKD *x, int b_mode, unsigned char *Predictor); - #endif diff --git a/vp8/common/reconintra4x4.c b/vp8/common/reconintra4x4.c index cd70dca..18c5145 100644 --- a/vp8/common/reconintra4x4.c +++ b/vp8/common/reconintra4x4.c @@ -14,7 +14,7 @@ #include "vpx_mem/vpx_mem.h" #include "reconintra.h" -void vp8_predict_intra4x4(BLOCKD *x, +void vp8_intra4x4_predict(BLOCKD *x, int b_mode, unsigned char *predictor) { diff --git a/vp8/common/x86/recon_sse2.asm b/vp8/common/x86/recon_sse2.asm index 67b6420..a1cc2b1 100644 --- a/vp8/common/x86/recon_sse2.asm +++ b/vp8/common/x86/recon_sse2.asm @@ -229,3 +229,411 @@ sym(vp8_copy_mem16x16_sse2): UNSHADOW_ARGS pop rbp ret + + +;void vp8_intra_pred_uv_dc_mmx2( +; unsigned char *dst, +; int dst_stride +; unsigned char *src, +; int src_stride, +; ) +global sym(vp8_intra_pred_uv_dc_mmx2) +sym(vp8_intra_pred_uv_dc_mmx2): + push rbp + mov rbp, rsp + SHADOW_ARGS_TO_STACK 4 + push rsi + push rdi + ; end prolog + + ; from top + mov rsi, arg(2) ;src; + movsxd rax, dword ptr arg(3) ;src_stride; + sub rsi, rax + pxor mm0, mm0 + movd mm1, [rsi] + movd mm2, [rsi+4] + punpcklbw mm1, mm0 + punpcklbw mm2, mm0 + paddw mm1, mm2 + pshufw mm2, mm1, 0x0e + paddw mm1, mm2 + pshufw mm2, mm1, 0x01 + paddw mm1, mm2 + + ; from left + dec rsi + lea rdi, [rax*3] + movzx ecx, byte [rsi+rax] + movzx edx, byte [rsi+rax*2] + add ecx, edx + movzx edx, byte [rsi+rdi] + add ecx, edx + lea rsi, [rsi+rax*4] + movzx edx, byte [rsi] + add ecx, edx + movzx edx, byte [rsi+rax] + add ecx, edx + movzx edx, byte [rsi+rax*2] + add ecx, edx + movzx edx, byte [rsi+rdi] + add ecx, edx + movzx edx, byte [rsi+rax*4] + add ecx, edx + + ; add up + pextrw edx, mm1, 0x0 + lea edx, [edx+ecx+8] + sar edx, 4 + movd mm1, edx + pshufw mm1, mm1, 0x0 + packuswb mm1, mm1 + + ; write out + mov rdi, arg(0) ;dst; + movsxd rcx, dword ptr arg(1) ;dst_stride + lea rax, [rcx*3] + + movq [rdi ], mm1 + movq [rdi+rcx ], mm1 + movq [rdi+rcx*2], mm1 + movq [rdi+rax ], mm1 + lea rdi, [rdi+rcx*4] + movq [rdi ], mm1 + movq [rdi+rcx ], mm1 + movq [rdi+rcx*2], mm1 + movq [rdi+rax ], mm1 + + ; begin epilog + pop rdi + pop rsi + UNSHADOW_ARGS + pop rbp + ret + +;void vp8_intra_pred_uv_dctop_mmx2( +; unsigned char *dst, +; int dst_stride +; unsigned char *src, +; int src_stride, +; ) +global sym(vp8_intra_pred_uv_dctop_mmx2) +sym(vp8_intra_pred_uv_dctop_mmx2): + push rbp + mov rbp, rsp + SHADOW_ARGS_TO_STACK 4 + push rsi + push rdi + ; end prolog + + ; from top + mov rsi, arg(2) ;src; + movsxd rax, dword ptr arg(3) ;src_stride; + sub rsi, rax + pxor mm0, mm0 + movd mm1, [rsi] + movd mm2, [rsi+4] + punpcklbw mm1, mm0 + punpcklbw mm2, mm0 + paddw mm1, mm2 + pshufw mm2, mm1, 0x0e + paddw mm1, mm2 + pshufw mm2, mm1, 0x01 + paddw mm1, mm2 + + ; add up + paddw mm1, [GLOBAL(dc_4)] + psraw mm1, 3 + pshufw mm1, mm1, 0x0 + packuswb mm1, mm1 + + ; write out + mov rdi, arg(0) ;dst; + movsxd rcx, dword ptr arg(1) ;dst_stride + lea rax, [rcx*3] + + movq [rdi ], mm1 + movq [rdi+rcx ], mm1 + movq [rdi+rcx*2], mm1 + movq [rdi+rax ], mm1 + lea rdi, [rdi+rcx*4] + movq [rdi ], mm1 + movq [rdi+rcx ], mm1 + movq [rdi+rcx*2], mm1 + movq [rdi+rax ], mm1 + + ; begin epilog + pop rdi + pop rsi + UNSHADOW_ARGS + pop rbp + ret + +;void vp8_intra_pred_uv_dcleft_mmx2( +; unsigned char *dst, +; int dst_stride +; unsigned char *src, +; int src_stride, +; ) +global sym(vp8_intra_pred_uv_dcleft_mmx2) +sym(vp8_intra_pred_uv_dcleft_mmx2): + push rbp + mov rbp, rsp + SHADOW_ARGS_TO_STACK 4 + push rsi + push rdi + ; end prolog + + ; from left + mov rsi, arg(2) ;src; + movsxd rax, dword ptr arg(3) ;src_stride; + dec rsi + lea rdi, [rax*3] + movzx ecx, byte [rsi] + movzx edx, byte [rsi+rax] + add ecx, edx + movzx edx, byte [rsi+rax*2] + add ecx, edx + movzx edx, byte [rsi+rdi] + add ecx, edx + lea rsi, [rsi+rax*4] + movzx edx, byte [rsi] + add ecx, edx + movzx edx, byte [rsi+rax] + add ecx, edx + movzx edx, byte [rsi+rax*2] + add ecx, edx + movzx edx, byte [rsi+rdi] + lea edx, [ecx+edx+4] + + ; add up + shr edx, 3 + movd mm1, edx + pshufw mm1, mm1, 0x0 + packuswb mm1, mm1 + + ; write out + mov rdi, arg(0) ;dst; + movsxd rcx, dword ptr arg(1) ;dst_stride + lea rax, [rcx*3] + + movq [rdi ], mm1 + movq [rdi+rcx ], mm1 + movq [rdi+rcx*2], mm1 + movq [rdi+rax ], mm1 + lea rdi, [rdi+rcx*4] + movq [rdi ], mm1 + movq [rdi+rcx ], mm1 + movq [rdi+rcx*2], mm1 + movq [rdi+rax ], mm1 + + ; begin epilog + pop rdi + pop rsi + UNSHADOW_ARGS + pop rbp + ret + +;void vp8_intra_pred_uv_dc128_mmx( +; unsigned char *dst, +; int dst_stride +; unsigned char *src, +; int src_stride, +; ) +global sym(vp8_intra_pred_uv_dc128_mmx) +sym(vp8_intra_pred_uv_dc128_mmx): + push rbp + mov rbp, rsp + SHADOW_ARGS_TO_STACK 4 + ; end prolog + + ; write out + movq mm1, [GLOBAL(dc_128)] + mov rax, arg(0) ;dst; + movsxd rdx, dword ptr arg(1) ;dst_stride + lea rcx, [rdx*3] + + movq [rax ], mm1 + movq [rax+rdx ], mm1 + movq [rax+rdx*2], mm1 + movq [rax+rcx ], mm1 + lea rax, [rax+rdx*4] + movq [rax ], mm1 + movq [rax+rdx ], mm1 + movq [rax+rdx*2], mm1 + movq [rax+rcx ], mm1 + + ; begin epilog + UNSHADOW_ARGS + pop rbp + ret + +;void vp8_intra_pred_uv_tm_sse2( +; unsigned char *dst, +; int dst_stride +; unsigned char *src, +; int src_stride, +; ) +%macro vp8_intra_pred_uv_tm 1 +global sym(vp8_intra_pred_uv_tm_%1) +sym(vp8_intra_pred_uv_tm_%1): + push rbp + mov rbp, rsp + SHADOW_ARGS_TO_STACK 4 + push rsi + push rdi + ; end prolog + + ; read top row + mov edx, 4 + mov rsi, arg(2) ;src; + movsxd rax, dword ptr arg(3) ;src_stride; + sub rsi, rax + pxor xmm0, xmm0 +%ifidn %1, ssse3 + movdqa xmm2, [GLOBAL(dc_1024)] +%endif + movq xmm1, [rsi] + punpcklbw xmm1, xmm0 + + ; set up left ptrs ans subtract topleft + movd xmm3, [rsi-1] + lea rsi, [rsi+rax-1] +%ifidn %1, sse2 + punpcklbw xmm3, xmm0 + pshuflw xmm3, xmm3, 0x0 + punpcklqdq xmm3, xmm3 +%else + pshufb xmm3, xmm2 +%endif + psubw xmm1, xmm3 + + ; set up dest ptrs + mov rdi, arg(0) ;dst; + movsxd rcx, dword ptr arg(1) ;dst_stride + +vp8_intra_pred_uv_tm_%1_loop: + movd xmm3, [rsi] + movd xmm5, [rsi+rax] +%ifidn %1, sse2 + punpcklbw xmm3, xmm0 + punpcklbw xmm5, xmm0 + pshuflw xmm3, xmm3, 0x0 + pshuflw xmm5, xmm5, 0x0 + punpcklqdq xmm3, xmm3 + punpcklqdq xmm5, xmm5 +%else + pshufb xmm3, xmm2 + pshufb xmm5, xmm2 +%endif + paddw xmm3, xmm1 + paddw xmm5, xmm1 + packuswb xmm3, xmm5 + movq [rdi ], xmm3 + movhps[rdi+rcx], xmm3 + lea rsi, [rsi+rax*2] + lea rdi, [rdi+rcx*2] + dec edx + jnz vp8_intra_pred_uv_tm_%1_loop + + ; begin epilog + pop rdi + pop rsi + UNSHADOW_ARGS + pop rbp + ret +%endmacro + +vp8_intra_pred_uv_tm sse2 +vp8_intra_pred_uv_tm ssse3 + +;void vp8_intra_pred_uv_ve_mmx( +; unsigned char *dst, +; int dst_stride +; unsigned char *src, +; int src_stride, +; ) +global sym(vp8_intra_pred_uv_ve_mmx) +sym(vp8_intra_pred_uv_ve_mmx): + push rbp + mov rbp, rsp + SHADOW_ARGS_TO_STACK 4 + ; end prolog + + ; read from top + mov rax, arg(2) ;src; + movsxd rdx, dword ptr arg(3) ;src_stride; + sub rax, rdx + movq mm1, [rax] + + ; write out + mov rax, arg(0) ;dst; + movsxd rdx, dword ptr arg(1) ;dst_stride + lea rcx, [rdx*3] + + movq [rax ], mm1 + movq [rax+rdx ], mm1 + movq [rax+rdx*2], mm1 + movq [rax+rcx ], mm1 + lea rax, [rax+rdx*4] + movq [rax ], mm1 + movq [rax+rdx ], mm1 + movq [rax+rdx*2], mm1 + movq [rax+rcx ], mm1 + + ; begin epilog + UNSHADOW_ARGS + pop rbp + ret + +;void vp8_intra_pred_uv_ho_mmx2( +; unsigned char *dst, +; int dst_stride +; unsigned char *src, +; int src_stride, +; ) +global sym(vp8_intra_pred_uv_ho_mmx2) +sym(vp8_intra_pred_uv_ho_mmx2): + push rbp + mov rbp, rsp + SHADOW_ARGS_TO_STACK 4 + push rsi + push rdi + ; end prolog + + ; read from left and write out + mov edx, 4 + mov rsi, arg(2) ;src; + movsxd rax, dword ptr arg(3) ;src_stride; + mov rdi, arg(0) ;dst; + movsxd rcx, dword ptr arg(1) ;dst_stride + dec rsi +vp8_intra_pred_uv_ho_mmx2_loop: + movd mm0, [rsi] + movd mm1, [rsi+rax] + punpcklbw mm0, mm0 + punpcklbw mm1, mm1 + pshufw mm0, mm0, 0x0 + pshufw mm1, mm1, 0x0 + movq [rdi ], mm0 + movq [rdi+rcx], mm1 + lea rsi, [rsi+rax*2] + lea rdi, [rdi+rcx*2] + dec edx + jnz vp8_intra_pred_uv_ho_mmx2_loop + + ; begin epilog + pop rdi + pop rsi + UNSHADOW_ARGS + pop rbp + ret + +SECTION_RODATA +dc_128: + times 8 db 128 +dc_4: + times 4 dw 4 +align 16 +dc_1024: + times 8 dw 0x400 diff --git a/vp8/common/x86/recon_wrapper_sse2.c b/vp8/common/x86/recon_wrapper_sse2.c new file mode 100644 index 0000000..7b17851 --- /dev/null +++ b/vp8/common/x86/recon_wrapper_sse2.c @@ -0,0 +1,90 @@ +/* + * 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/config.h" +#include "vp8/common/recon.h" +#include "recon_x86.h" +#include "vpx_mem/vpx_mem.h" + +#define build_intra_predictors_mbuv_prototype(sym) \ + void sym(unsigned char *dst, int dst_stride, \ + const unsigned char *src, int src_stride) +typedef build_intra_predictors_mbuv_prototype((*build_intra_predictors_mbuv_fn_t)); + +extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc_mmx2); +extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dctop_mmx2); +extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dcleft_mmx2); +extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc128_mmx); +extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ho_mmx2); +extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ve_mmx); +extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_tm_sse2); +extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_tm_ssse3); + +static inline void vp8_build_intra_predictors_mbuv_x86(MACROBLOCKD *x, + unsigned char *dst_u, + unsigned char *dst_v, + int dst_stride, + build_intra_predictors_mbuv_fn_t tm_func) +{ + int mode = x->mode_info_context->mbmi.uv_mode; + build_intra_predictors_mbuv_fn_t fn; + int src_stride = x->dst.uv_stride; + + switch (mode) { + case V_PRED: fn = vp8_intra_pred_uv_ve_mmx; break; + case H_PRED: fn = vp8_intra_pred_uv_ho_mmx2; break; + case TM_PRED: fn = tm_func; break; + case DC_PRED: + if (x->up_available) { + if (x->left_available) { + fn = vp8_intra_pred_uv_dc_mmx2; break; + } else { + fn = vp8_intra_pred_uv_dctop_mmx2; break; + } + } else if (x->left_available) { + fn = vp8_intra_pred_uv_dcleft_mmx2; break; + } else { + fn = vp8_intra_pred_uv_dc128_mmx; break; + } + break; + default: return; + } + + fn(dst_u, dst_stride, x->dst.u_buffer, src_stride); + fn(dst_v, dst_stride, x->dst.v_buffer, src_stride); +} + +void vp8_build_intra_predictors_mbuv_sse2(MACROBLOCKD *x) +{ + vp8_build_intra_predictors_mbuv_x86(x, &x->predictor[256], + &x->predictor[320], 8, + vp8_intra_pred_uv_tm_sse2); +} + +void vp8_build_intra_predictors_mbuv_ssse3(MACROBLOCKD *x) +{ + vp8_build_intra_predictors_mbuv_x86(x, &x->predictor[256], + &x->predictor[320], 8, + vp8_intra_pred_uv_tm_ssse3); +} + +void vp8_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD *x) +{ + vp8_build_intra_predictors_mbuv_x86(x, x->dst.u_buffer, + x->dst.v_buffer, x->dst.uv_stride, + vp8_intra_pred_uv_tm_sse2); +} + +void vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *x) +{ + vp8_build_intra_predictors_mbuv_x86(x, x->dst.u_buffer, + x->dst.v_buffer, x->dst.uv_stride, + vp8_intra_pred_uv_tm_ssse3); +} diff --git a/vp8/common/x86/recon_x86.h b/vp8/common/x86/recon_x86.h index 40ee65a..fe0f8f0 100644 --- a/vp8/common/x86/recon_x86.h +++ b/vp8/common/x86/recon_x86.h @@ -46,6 +46,8 @@ extern prototype_copy_block(vp8_copy_mem16x16_mmx); extern prototype_recon_block(vp8_recon2b_sse2); extern prototype_recon_block(vp8_recon4b_sse2); extern prototype_copy_block(vp8_copy_mem16x16_sse2); +extern prototype_build_intra_predictors(vp8_build_intra_predictors_mbuv_sse2); +extern prototype_build_intra_predictors(vp8_build_intra_predictors_mbuv_s_sse2); #if !CONFIG_RUNTIME_CPU_DETECT #undef vp8_recon_recon2 @@ -57,6 +59,26 @@ extern prototype_copy_block(vp8_copy_mem16x16_sse2); #undef vp8_recon_copy16x16 #define vp8_recon_copy16x16 vp8_copy_mem16x16_sse2 +#undef vp8_recon_build_intra_predictors_mbuv +#define vp8_recon_build_intra_predictors_mbuv vp8_build_intra_predictors_mbuv_sse2 + +#undef vp8_recon_build_intra_predictors_mbuv_s +#define vp8_recon_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s_sse2 + +#endif +#endif + +#if HAVE_SSSE3 +extern prototype_build_intra_predictors(vp8_build_intra_predictors_mbuv_ssse3); +extern prototype_build_intra_predictors(vp8_build_intra_predictors_mbuv_s_ssse3); + +#if !CONFIG_RUNTIME_CPU_DETECT +#undef vp8_recon_build_intra_predictors_mbuv +#define vp8_recon_build_intra_predictors_mbuv vp8_build_intra_predictors_mbuv_ssse3 + +#undef vp8_recon_build_intra_predictors_mbuv_s +#define vp8_recon_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s_ssse3 + #endif #endif #endif diff --git a/vp8/common/x86/x86_systemdependent.c b/vp8/common/x86/x86_systemdependent.c index e89c07a..1766733 100644 --- a/vp8/common/x86/x86_systemdependent.c +++ b/vp8/common/x86/x86_systemdependent.c @@ -88,6 +88,10 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx) rtcd->recon.recon2 = vp8_recon2b_sse2; rtcd->recon.recon4 = vp8_recon4b_sse2; rtcd->recon.copy16x16 = vp8_copy_mem16x16_sse2; + rtcd->recon.build_intra_predictors_mbuv = + vp8_build_intra_predictors_mbuv_sse2; + rtcd->recon.build_intra_predictors_mbuv_s = + vp8_build_intra_predictors_mbuv_s_sse2; rtcd->idct.iwalsh16 = vp8_short_inv_walsh4x4_sse2; @@ -126,6 +130,11 @@ void vp8_arch_x86_common_init(VP8_COMMON *ctx) rtcd->subpix.sixtap4x4 = vp8_sixtap_predict4x4_ssse3; rtcd->subpix.bilinear16x16 = vp8_bilinear_predict16x16_ssse3; rtcd->subpix.bilinear8x8 = vp8_bilinear_predict8x8_ssse3; + + rtcd->recon.build_intra_predictors_mbuv = + vp8_build_intra_predictors_mbuv_ssse3; + rtcd->recon.build_intra_predictors_mbuv_s = + vp8_build_intra_predictors_mbuv_s_ssse3; } #endif diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index aaee911..2c677ca 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -113,7 +113,7 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) { if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) { - vp8_build_intra_predictors_mbuv_s(xd); + RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mbuv_s)(xd); RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mby_s)(xd); } @@ -213,7 +213,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd) /* do prediction */ if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME) { - vp8_build_intra_predictors_mbuv(xd); + RECON_INVOKE(&pbi->common.rtcd.recon, build_intra_predictors_mbuv)(xd); if (xd->mode_info_context->mbmi.mode != B_PRED) { @@ -264,7 +264,8 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd) { BLOCKD *b = &xd->block[i]; - vp8_predict_intra4x4(b, b->bmi.mode, b->predictor); + RECON_INVOKE(RTCD_VTABLE(recon), intra4x4_predict) + (b, b->bmi.mode, b->predictor); if (xd->eobs[i] > 1) { diff --git a/vp8/encoder/encodeintra.c b/vp8/encoder/encodeintra.c index 7d835a1..9517a1d 100644 --- a/vp8/encoder/encodeintra.c +++ b/vp8/encoder/encodeintra.c @@ -32,7 +32,8 @@ #endif void vp8_encode_intra4x4block(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x, BLOCK *be, BLOCKD *b, int best_mode) { - vp8_predict_intra4x4(b, best_mode, b->predictor); + RECON_INVOKE(&rtcd->common->recon, intra4x4_predict) + (b, best_mode, b->predictor); ENCODEMB_INVOKE(&rtcd->encodemb, subb)(be, b, 16); @@ -113,7 +114,7 @@ void vp8_encode_intra16x16mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) void vp8_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) { - vp8_build_intra_predictors_mbuv(&x->e_mbd); + RECON_INVOKE(&rtcd->common->recon, build_intra_predictors_mbuv)(&x->e_mbd); ENCODEMB_INVOKE(&rtcd->encodemb, submbuv)(x->src_diff, x->src.u_buffer, x->src.v_buffer, x->e_mbd.predictor, x->src.uv_stride); diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c index 765ff26..ea4f01f 100644 --- a/vp8/encoder/pickinter.c +++ b/vp8/encoder/pickinter.c @@ -194,7 +194,8 @@ static int pick_intra4x4block( int this_rd; rate = mode_costs[mode]; - vp8_predict_intra4x4(b, mode, b->predictor); + RECON_INVOKE(&rtcd->common->recon, intra4x4_predict) + (b, mode, b->predictor); distortion = get_prediction_error(be, b, &rtcd->variance); this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion); diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index e99d6f0..fff181e 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -620,7 +620,8 @@ static int rd_pick_intra4x4block( rate = bmode_costs[mode]; - vp8_predict_intra4x4(b, mode, b->predictor); + RECON_INVOKE(&cpi->rtcd.common->recon, intra4x4_predict) + (b, mode, b->predictor); ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), subb)(be, b, 16); x->vp8_short_fdct4x4(be->src_diff, be->coeff, 32); x->quantize_b(be, b); @@ -809,7 +810,8 @@ void vp8_rd_pick_intra_mbuv_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *r int this_rd; x->e_mbd.mode_info_context->mbmi.uv_mode = mode; - vp8_build_intra_predictors_mbuv(&x->e_mbd); + RECON_INVOKE(&cpi->rtcd.common->recon, build_intra_predictors_mbuv) + (&x->e_mbd); ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), submbuv)(x->src_diff, x->src.u_buffer, x->src.v_buffer, x->e_mbd.predictor, x->src.uv_stride); diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk index 2a2f0cf..5f5ba3a 100644 --- a/vp8/vp8_common.mk +++ b/vp8/vp8_common.mk @@ -89,6 +89,7 @@ VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/subpixel_mmx.asm VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/loopfilter_mmx.asm VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/idctllm_sse2.asm VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/recon_sse2.asm +VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/recon_wrapper_sse2.c VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/subpixel_sse2.asm VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/loopfilter_sse2.asm VP8_COMMON_SRCS-$(HAVE_SSE2) += common/x86/iwalsh_sse2.asm -- 2.7.4