Commit a3377256 authored by Scott LaVarnway's avatar Scott LaVarnway
Browse files

Updated vp8_build_intra_predictors_mby_s(sse2/ssse3)

to work with the latest code.

Patch Set 2: aligned the above_row buffers to fix crash

Change-Id: I7a6992a20ed079ccd302f8c26215cf3057f8b70c
parent b3151c80
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "vpx_mem/vpx_mem.h" #include "vpx_mem/vpx_mem.h"
#include "blockd.h" #include "blockd.h"
void vp8_build_intra_predictors_mby_s(MACROBLOCKD *x, void vp8_build_intra_predictors_mby_s_c(MACROBLOCKD *x,
unsigned char * yabove_row, unsigned char * yabove_row,
unsigned char * yleft, unsigned char * yleft,
int left_stride, int left_stride,
......
...@@ -123,7 +123,8 @@ specialize vp8_copy_mem8x4 mmx media neon ...@@ -123,7 +123,8 @@ specialize vp8_copy_mem8x4 mmx media neon
vp8_copy_mem8x4_media=vp8_copy_mem8x4_v6 vp8_copy_mem8x4_media=vp8_copy_mem8x4_v6
prototype void vp8_build_intra_predictors_mby_s "struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride" prototype void vp8_build_intra_predictors_mby_s "struct macroblockd *x, unsigned char * yabove_row, unsigned char * yleft, int left_stride, unsigned char * ypred_ptr, int y_stride"
#TODO: fix assembly --- specialize vp8_build_intra_predictors_mby_s sse2 ssse3 neon specialize vp8_build_intra_predictors_mby_s sse2 ssse3
#TODO: fix assembly for neon
prototype void vp8_build_intra_predictors_mbuv_s "struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride" prototype void vp8_build_intra_predictors_mbuv_s "struct macroblockd *x, unsigned char * uabove_row, unsigned char * vabove_row, unsigned char *uleft, unsigned char *vleft, int left_stride, unsigned char * upred_ptr, unsigned char * vpred_ptr, int pred_stride"
specialize vp8_build_intra_predictors_mbuv_s sse2 ssse3 specialize vp8_build_intra_predictors_mbuv_s sse2 ssse3
......
...@@ -133,22 +133,20 @@ sym(vp8_intra_pred_uv_dc_mmx2): ...@@ -133,22 +133,20 @@ sym(vp8_intra_pred_uv_dc_mmx2):
; end prolog ; end prolog
; from top ; from top
mov rsi, arg(2) ;above; mov rdi, arg(2) ;above;
pxor mm0, mm0
movq mm1, [rsi]
psadbw mm1, mm0
; from left
mov rsi, arg(3) ;left; mov rsi, arg(3) ;left;
movsxd rax, dword ptr arg(4) ;left_stride; movsxd rax, dword ptr arg(4) ;left_stride;
pxor mm0, mm0
movq mm1, [rdi]
lea rdi, [rax*3] lea rdi, [rax*3]
psadbw mm1, mm0
; from left
movzx ecx, byte [rsi] movzx ecx, byte [rsi]
movzx edx, byte [rsi+rax*1] movzx edx, byte [rsi+rax*1]
add ecx, edx add ecx, edx
movzx edx, byte [rsi+rax*2] movzx edx, byte [rsi+rax*2]
add ecx, edx add ecx, edx
movzx edx, byte [rsi+rdi] movzx edx, byte [rsi+rdi]
lea rsi, [rsi+rax*4] lea rsi, [rsi+rax*4]
add ecx, edx add ecx, edx
...@@ -166,23 +164,23 @@ sym(vp8_intra_pred_uv_dc_mmx2): ...@@ -166,23 +164,23 @@ sym(vp8_intra_pred_uv_dc_mmx2):
lea edx, [edx+ecx+8] lea edx, [edx+ecx+8]
sar edx, 4 sar edx, 4
movd mm1, edx movd mm1, edx
movsxd rcx, dword ptr arg(1) ;dst_stride
pshufw mm1, mm1, 0x0 pshufw mm1, mm1, 0x0
mov rdi, arg(0) ;dst;
packuswb mm1, mm1 packuswb mm1, mm1
; write out ; write out
mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride
lea rax, [rcx*3] lea rax, [rcx*3]
lea rdx, [rdi+rcx*4]
movq [rdi ], mm1 movq [rdi ], mm1
movq [rdi+rcx ], mm1 movq [rdi+rcx ], mm1
movq [rdi+rcx*2], mm1 movq [rdi+rcx*2], mm1
movq [rdi+rax ], mm1 movq [rdi+rax ], mm1
lea rdi, [rdi+rcx*4] movq [rdx ], mm1
movq [rdi ], mm1 movq [rdx+rcx ], mm1
movq [rdi+rcx ], mm1 movq [rdx+rcx*2], mm1
movq [rdi+rcx*2], mm1 movq [rdx+rax ], mm1
movq [rdi+rax ], mm1
; begin epilog ; begin epilog
pop rdi pop rdi
...@@ -478,7 +476,7 @@ sym(vp8_intra_pred_uv_ve_mmx): ...@@ -478,7 +476,7 @@ sym(vp8_intra_pred_uv_ve_mmx):
; int dst_stride ; int dst_stride
; unsigned char *above, ; unsigned char *above,
; unsigned char *left, ; unsigned char *left,
; int left_stride, ; int left_stride
; ) ; )
%macro vp8_intra_pred_uv_ho 1 %macro vp8_intra_pred_uv_ho 1
global sym(vp8_intra_pred_uv_ho_%1) global sym(vp8_intra_pred_uv_ho_%1)
...@@ -575,38 +573,43 @@ vp8_intra_pred_uv_ho ssse3 ...@@ -575,38 +573,43 @@ vp8_intra_pred_uv_ho ssse3
;void vp8_intra_pred_y_dc_sse2( ;void vp8_intra_pred_y_dc_sse2(
; unsigned char *dst, ; unsigned char *dst,
; int dst_stride ; int dst_stride
; unsigned char *src, ; unsigned char *above,
; int src_stride, ; unsigned char *left,
; int left_stride
; ) ; )
global sym(vp8_intra_pred_y_dc_sse2) global sym(vp8_intra_pred_y_dc_sse2)
sym(vp8_intra_pred_y_dc_sse2): sym(vp8_intra_pred_y_dc_sse2):
push rbp push rbp
mov rbp, rsp mov rbp, rsp
SHADOW_ARGS_TO_STACK 4 SHADOW_ARGS_TO_STACK 5
push rsi push rsi
push rdi push rdi
; end prolog ; end prolog
; from top ; from top
mov rsi, arg(2) ;src; mov rdi, arg(2) ;above
movsxd rax, dword ptr arg(3) ;src_stride; mov rsi, arg(3) ;left
sub rsi, rax movsxd rax, dword ptr arg(4) ;left_stride;
pxor xmm0, xmm0 pxor xmm0, xmm0
movdqa xmm1, [rsi] movdqa xmm1, [rdi]
psadbw xmm1, xmm0 psadbw xmm1, xmm0
movq xmm2, xmm1 movq xmm2, xmm1
punpckhqdq xmm1, xmm1 punpckhqdq xmm1, xmm1
paddw xmm1, xmm2 paddw xmm1, xmm2
; from left ; from left
dec rsi
lea rdi, [rax*3] lea rdi, [rax*3]
movzx ecx, byte [rsi+rax]
movzx ecx, byte [rsi]
movzx edx, byte [rsi+rax]
add ecx, edx
movzx edx, byte [rsi+rax*2] movzx edx, byte [rsi+rax*2]
add ecx, edx add ecx, edx
movzx edx, byte [rsi+rdi] movzx edx, byte [rsi+rdi]
add ecx, edx add ecx, edx
lea rsi, [rsi+rax*4] lea rsi, [rsi+rax*4]
movzx edx, byte [rsi] movzx edx, byte [rsi]
add ecx, edx add ecx, edx
movzx edx, byte [rsi+rax] movzx edx, byte [rsi+rax]
...@@ -616,6 +619,7 @@ sym(vp8_intra_pred_y_dc_sse2): ...@@ -616,6 +619,7 @@ sym(vp8_intra_pred_y_dc_sse2):
movzx edx, byte [rsi+rdi] movzx edx, byte [rsi+rdi]
add ecx, edx add ecx, edx
lea rsi, [rsi+rax*4] lea rsi, [rsi+rax*4]
movzx edx, byte [rsi] movzx edx, byte [rsi]
add ecx, edx add ecx, edx
movzx edx, byte [rsi+rax] movzx edx, byte [rsi+rax]
...@@ -625,6 +629,7 @@ sym(vp8_intra_pred_y_dc_sse2): ...@@ -625,6 +629,7 @@ sym(vp8_intra_pred_y_dc_sse2):
movzx edx, byte [rsi+rdi] movzx edx, byte [rsi+rdi]
add ecx, edx add ecx, edx
lea rsi, [rsi+rax*4] lea rsi, [rsi+rax*4]
movzx edx, byte [rsi] movzx edx, byte [rsi]
add ecx, edx add ecx, edx
movzx edx, byte [rsi+rax] movzx edx, byte [rsi+rax]
...@@ -633,8 +638,6 @@ sym(vp8_intra_pred_y_dc_sse2): ...@@ -633,8 +638,6 @@ sym(vp8_intra_pred_y_dc_sse2):
add ecx, edx add ecx, edx
movzx edx, byte [rsi+rdi] movzx edx, byte [rsi+rdi]
add ecx, edx add ecx, edx
movzx edx, byte [rsi+rax*4]
add ecx, edx
; add up ; add up
pextrw edx, xmm1, 0x0 pextrw edx, xmm1, 0x0
...@@ -676,22 +679,23 @@ sym(vp8_intra_pred_y_dc_sse2): ...@@ -676,22 +679,23 @@ sym(vp8_intra_pred_y_dc_sse2):
;void vp8_intra_pred_y_dctop_sse2( ;void vp8_intra_pred_y_dctop_sse2(
; unsigned char *dst, ; unsigned char *dst,
; int dst_stride ; int dst_stride
; unsigned char *src, ; unsigned char *above,
; int src_stride, ; unsigned char *left,
; int left_stride
; ) ; )
global sym(vp8_intra_pred_y_dctop_sse2) global sym(vp8_intra_pred_y_dctop_sse2)
sym(vp8_intra_pred_y_dctop_sse2): sym(vp8_intra_pred_y_dctop_sse2):
push rbp push rbp
mov rbp, rsp mov rbp, rsp
SHADOW_ARGS_TO_STACK 4 SHADOW_ARGS_TO_STACK 5
push rsi push rsi
GET_GOT rbx GET_GOT rbx
; end prolog ; end prolog
;arg(3), arg(4) not used
; from top ; from top
mov rcx, arg(2) ;src; mov rcx, arg(2) ;above;
movsxd rax, dword ptr arg(3) ;src_stride;
sub rcx, rax
pxor xmm0, xmm0 pxor xmm0, xmm0
movdqa xmm1, [rcx] movdqa xmm1, [rcx]
psadbw xmm1, xmm0 psadbw xmm1, xmm0
...@@ -737,22 +741,25 @@ sym(vp8_intra_pred_y_dctop_sse2): ...@@ -737,22 +741,25 @@ sym(vp8_intra_pred_y_dctop_sse2):
;void vp8_intra_pred_y_dcleft_sse2( ;void vp8_intra_pred_y_dcleft_sse2(
; unsigned char *dst, ; unsigned char *dst,
; int dst_stride ; int dst_stride
; unsigned char *src, ; unsigned char *above,
; int src_stride, ; unsigned char *left,
; int left_stride
; ) ; )
global sym(vp8_intra_pred_y_dcleft_sse2) global sym(vp8_intra_pred_y_dcleft_sse2)
sym(vp8_intra_pred_y_dcleft_sse2): sym(vp8_intra_pred_y_dcleft_sse2):
push rbp push rbp
mov rbp, rsp mov rbp, rsp
SHADOW_ARGS_TO_STACK 4 SHADOW_ARGS_TO_STACK 5
push rsi push rsi
push rdi push rdi
; end prolog ; end prolog
;arg(2) not used
; from left ; from left
mov rsi, arg(2) ;src; mov rsi, arg(3) ;left;
movsxd rax, dword ptr arg(3) ;src_stride; movsxd rax, dword ptr arg(4) ;left_stride;
dec rsi
lea rdi, [rax*3] lea rdi, [rax*3]
movzx ecx, byte [rsi] movzx ecx, byte [rsi]
movzx edx, byte [rsi+rax] movzx edx, byte [rsi+rax]
...@@ -827,18 +834,21 @@ sym(vp8_intra_pred_y_dcleft_sse2): ...@@ -827,18 +834,21 @@ sym(vp8_intra_pred_y_dcleft_sse2):
;void vp8_intra_pred_y_dc128_sse2( ;void vp8_intra_pred_y_dc128_sse2(
; unsigned char *dst, ; unsigned char *dst,
; int dst_stride ; int dst_stride
; unsigned char *src, ; unsigned char *above,
; int src_stride, ; unsigned char *left,
; int left_stride
; ) ; )
global sym(vp8_intra_pred_y_dc128_sse2) global sym(vp8_intra_pred_y_dc128_sse2)
sym(vp8_intra_pred_y_dc128_sse2): sym(vp8_intra_pred_y_dc128_sse2):
push rbp push rbp
mov rbp, rsp mov rbp, rsp
SHADOW_ARGS_TO_STACK 4 SHADOW_ARGS_TO_STACK 5
push rsi push rsi
GET_GOT rbx GET_GOT rbx
; end prolog ; end prolog
;arg(2), arg(3), arg(4) not used
; write out ; write out
mov rsi, 2 mov rsi, 2
movdqa xmm1, [GLOBAL(dc_128)] movdqa xmm1, [GLOBAL(dc_128)]
...@@ -870,15 +880,16 @@ sym(vp8_intra_pred_y_dc128_sse2): ...@@ -870,15 +880,16 @@ sym(vp8_intra_pred_y_dc128_sse2):
;void vp8_intra_pred_y_tm_sse2( ;void vp8_intra_pred_y_tm_sse2(
; unsigned char *dst, ; unsigned char *dst,
; int dst_stride ; int dst_stride
; unsigned char *src, ; unsigned char *above,
; int src_stride, ; unsigned char *left,
; int left_stride
; ) ; )
%macro vp8_intra_pred_y_tm 1 %macro vp8_intra_pred_y_tm 1
global sym(vp8_intra_pred_y_tm_%1) global sym(vp8_intra_pred_y_tm_%1)
sym(vp8_intra_pred_y_tm_%1): sym(vp8_intra_pred_y_tm_%1):
push rbp push rbp
mov rbp, rsp mov rbp, rsp
SHADOW_ARGS_TO_STACK 4 SHADOW_ARGS_TO_STACK 5
push rsi push rsi
push rdi push rdi
GET_GOT rbx GET_GOT rbx
...@@ -886,9 +897,8 @@ sym(vp8_intra_pred_y_tm_%1): ...@@ -886,9 +897,8 @@ sym(vp8_intra_pred_y_tm_%1):
; read top row ; read top row
mov edx, 8 mov edx, 8
mov rsi, arg(2) ;src; mov rsi, arg(2) ;above
movsxd rax, dword ptr arg(3) ;src_stride; movsxd rax, dword ptr arg(4) ;left_stride;
sub rsi, rax
pxor xmm0, xmm0 pxor xmm0, xmm0
%ifidn %1, ssse3 %ifidn %1, ssse3
movdqa xmm3, [GLOBAL(dc_1024)] movdqa xmm3, [GLOBAL(dc_1024)]
...@@ -900,7 +910,7 @@ sym(vp8_intra_pred_y_tm_%1): ...@@ -900,7 +910,7 @@ sym(vp8_intra_pred_y_tm_%1):
; set up left ptrs ans subtract topleft ; set up left ptrs ans subtract topleft
movd xmm4, [rsi-1] movd xmm4, [rsi-1]
lea rsi, [rsi+rax-1] mov rsi, arg(3) ;left
%ifidn %1, sse2 %ifidn %1, sse2
punpcklbw xmm4, xmm0 punpcklbw xmm4, xmm0
pshuflw xmm4, xmm4, 0x0 pshuflw xmm4, xmm4, 0x0
...@@ -958,27 +968,29 @@ vp8_intra_pred_y_tm ssse3 ...@@ -958,27 +968,29 @@ vp8_intra_pred_y_tm ssse3
;void vp8_intra_pred_y_ve_sse2( ;void vp8_intra_pred_y_ve_sse2(
; unsigned char *dst, ; unsigned char *dst,
; int dst_stride ; int dst_stride
; unsigned char *src, ; unsigned char *above,
; int src_stride, ; unsigned char *left,
; int left_stride
; ) ; )
global sym(vp8_intra_pred_y_ve_sse2) global sym(vp8_intra_pred_y_ve_sse2)
sym(vp8_intra_pred_y_ve_sse2): sym(vp8_intra_pred_y_ve_sse2):
push rbp push rbp
mov rbp, rsp mov rbp, rsp
SHADOW_ARGS_TO_STACK 4 SHADOW_ARGS_TO_STACK 5
push rsi push rsi
; end prolog ; end prolog
;arg(3), arg(4) not used
mov rax, arg(2) ;above;
mov rsi, 2
movsxd rdx, dword ptr arg(1) ;dst_stride
; read from top ; read from top
mov rax, arg(2) ;src;
movsxd rdx, dword ptr arg(3) ;src_stride;
sub rax, rdx
movdqa xmm1, [rax] movdqa xmm1, [rax]
; write out ; write out
mov rsi, 2
mov rax, arg(0) ;dst; mov rax, arg(0) ;dst;
movsxd rdx, dword ptr arg(1) ;dst_stride
lea rcx, [rdx*3] lea rcx, [rdx*3]
.label .label
...@@ -1004,25 +1016,27 @@ sym(vp8_intra_pred_y_ve_sse2): ...@@ -1004,25 +1016,27 @@ sym(vp8_intra_pred_y_ve_sse2):
;void vp8_intra_pred_y_ho_sse2( ;void vp8_intra_pred_y_ho_sse2(
; unsigned char *dst, ; unsigned char *dst,
; int dst_stride ; int dst_stride
; unsigned char *src, ; unsigned char *above,
; int src_stride, ; unsigned char *left,
; int left_stride,
; ) ; )
global sym(vp8_intra_pred_y_ho_sse2) global sym(vp8_intra_pred_y_ho_sse2)
sym(vp8_intra_pred_y_ho_sse2): sym(vp8_intra_pred_y_ho_sse2):
push rbp push rbp
mov rbp, rsp mov rbp, rsp
SHADOW_ARGS_TO_STACK 4 SHADOW_ARGS_TO_STACK 5
push rsi push rsi
push rdi push rdi
; end prolog ; end prolog
;arg(2) not used
; read from left and write out ; read from left and write out
mov edx, 8 mov edx, 8
mov rsi, arg(2) ;src; mov rsi, arg(3) ;left;
movsxd rax, dword ptr arg(3) ;src_stride; movsxd rax, dword ptr arg(4) ;left_stride;
mov rdi, arg(0) ;dst; mov rdi, arg(0) ;dst;
movsxd rcx, dword ptr arg(1) ;dst_stride movsxd rcx, dword ptr arg(1) ;dst_stride
dec rsi
vp8_intra_pred_y_ho_sse2_loop: vp8_intra_pred_y_ho_sse2_loop:
movd xmm0, [rsi] movd xmm0, [rsi]
......
...@@ -110,23 +110,32 @@ void vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *x, ...@@ -110,23 +110,32 @@ void vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *x,
vp8_intra_pred_uv_ho_ssse3); vp8_intra_pred_uv_ho_ssse3);
} }
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_y_dc_sse2); #define build_intra_predictors_mby_prototype(sym) \
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_y_dctop_sse2); void sym(unsigned char *dst, int dst_stride, \
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_y_dcleft_sse2); const unsigned char *above, \
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_y_dc128_sse2); const unsigned char *left, int left_stride)
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_y_ho_sse2); typedef build_intra_predictors_mby_prototype((*build_intra_predictors_mby_fn_t));
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_y_ve_sse2);
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_y_tm_sse2); extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dc_sse2);
extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_y_tm_ssse3); extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dctop_sse2);
extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dcleft_sse2);
extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dc128_sse2);
extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_ho_sse2);
extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_ve_sse2);
extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_tm_sse2);
extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_tm_ssse3);
static void vp8_build_intra_predictors_mby_x86(MACROBLOCKD *x, static void vp8_build_intra_predictors_mby_x86(MACROBLOCKD *x,
unsigned char * yabove_row,
unsigned char *dst_y, unsigned char *dst_y,
int dst_stride, int dst_stride,
build_intra_predictors_mbuv_fn_t tm_func) unsigned char * yleft,
int left_stride,
build_intra_predictors_mby_fn_t tm_func)
{ {
int mode = x->mode_info_context->mbmi.mode; int mode = x->mode_info_context->mbmi.mode;
build_intra_predictors_mbuv_fn_t fn; build_intra_predictors_mbuv_fn_t fn;
int src_stride = x->dst.y_stride;
switch (mode) { switch (mode) {
case V_PRED: fn = vp8_intra_pred_y_ve_sse2; break; case V_PRED: fn = vp8_intra_pred_y_ve_sse2; break;
case H_PRED: fn = vp8_intra_pred_y_ho_sse2; break; case H_PRED: fn = vp8_intra_pred_y_ho_sse2; break;
...@@ -147,19 +156,31 @@ static void vp8_build_intra_predictors_mby_x86(MACROBLOCKD *x, ...@@ -147,19 +156,31 @@ static void vp8_build_intra_predictors_mby_x86(MACROBLOCKD *x,
default: return; default: return;
} }
// fn(dst_y, dst_stride, x->dst.y_buffer, src_stride); fn(dst_y, dst_stride, yabove_row, yleft, left_stride);
return; return;
} }
void vp8_build_intra_predictors_mby_s_sse2(MACROBLOCKD *x) void vp8_build_intra_predictors_mby_s_sse2(MACROBLOCKD *x,
unsigned char * yabove_row,
unsigned char * yleft,
int left_stride,
unsigned char * ypred_ptr,
int y_stride)
{ {
vp8_build_intra_predictors_mby_x86(x, x->dst.y_buffer, x->dst.y_stride, vp8_build_intra_predictors_mby_x86(x, yabove_row, ypred_ptr,
y_stride, yleft, left_stride,
vp8_intra_pred_y_tm_sse2); vp8_intra_pred_y_tm_sse2);
} }
void vp8_build_intra_predictors_mby_s_ssse3(MACROBLOCKD *x) void vp8_build_intra_predictors_mby_s_ssse3(MACROBLOCKD *x,
unsigned char * yabove_row,
unsigned char * yleft,
int left_stride,
unsigned char * ypred_ptr,
int y_stride)
{ {
vp8_build_intra_predictors_mby_x86(x, x->dst.y_buffer, x->dst.y_stride, vp8_build_intra_predictors_mby_x86(x, yabove_row, ypred_ptr,
y_stride, yleft, left_stride,
vp8_intra_pred_y_tm_ssse3); vp8_intra_pred_y_tm_ssse3);
} }