Commit 9b0f0da0 authored by nfullagar@google.com's avatar nfullagar@google.com

InterpolateRow SSSE3 for Native Client

Fix bug in CumulativeSumToAverageRow
BUG=253
TEST=ncval,trybots
R=fbarchard@google.com

Review URL: https://webrtc-codereview.appspot.com/2004004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@759 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent d459f382
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 758 Version: 759
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -62,6 +62,7 @@ extern "C" { ...@@ -62,6 +62,7 @@ extern "C" {
#define HAS_COPYROW_X86 #define HAS_COPYROW_X86
#define HAS_FIXEDDIV_X86 #define HAS_FIXEDDIV_X86
#define HAS_I400TOARGBROW_SSE2 #define HAS_I400TOARGBROW_SSE2
#define HAS_INTERPOLATEROW_SSSE3
#define HAS_SETROW_X86 #define HAS_SETROW_X86
#endif #endif
...@@ -130,7 +131,6 @@ extern "C" { ...@@ -130,7 +131,6 @@ extern "C" {
#define HAS_ARGBAFFINEROW_SSE2 #define HAS_ARGBAFFINEROW_SSE2
#define HAS_ARGBUNATTENUATEROW_SSE2 #define HAS_ARGBUNATTENUATEROW_SSE2
#define HAS_INTERPOLATEROW_SSE2 #define HAS_INTERPOLATEROW_SSE2
#define HAS_INTERPOLATEROW_SSSE3
#define HAS_SOBELROW_SSE2 #define HAS_SOBELROW_SSE2
#define HAS_SOBELXROW_SSSE3 #define HAS_SOBELXROW_SSSE3
#define HAS_SOBELXYROW_SSE2 #define HAS_SOBELXYROW_SSE2
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 758 #define LIBYUV_VERSION 759
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -35,7 +35,10 @@ extern "C" { ...@@ -35,7 +35,10 @@ extern "C" {
#define MEMSTORESTRING(reg, d) "%%" #reg ",%%nacl:(%q" #d "), %%r15" #define MEMSTORESTRING(reg, d) "%%" #reg ",%%nacl:(%q" #d "), %%r15"
#define MEMOPREG(opcode, offset, base, index, scale, reg) \ #define MEMOPREG(opcode, offset, base, index, scale, reg) \
"lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \ "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \
#opcode " (%%r15,%%r14),%%" #reg " \n" #opcode " (%%r15,%%r14),%%" #reg "\n"
#define MEMOPMEM(opcode, reg, offset, base, index, scale) \
"lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" \
#opcode " %%" #reg ",(%%r15,%%r14)\n"
#define BUNDLEALIGN ".p2align 5 \n" #define BUNDLEALIGN ".p2align 5 \n"
#else #else
#define MEMACCESS(base) "(%" #base ")" #define MEMACCESS(base) "(%" #base ")"
...@@ -46,7 +49,9 @@ extern "C" { ...@@ -46,7 +49,9 @@ extern "C" {
#define MEMMOVESTRING(s, d) #define MEMMOVESTRING(s, d)
#define MEMSTORESTRING(reg, d) #define MEMSTORESTRING(reg, d)
#define MEMOPREG(opcode, offset, base, index, scale, reg) \ #define MEMOPREG(opcode, offset, base, index, scale, reg) \
#opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg " \n" #opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg "\n"
#define MEMOPMEM(opcode, reg, offset, base, index, scale) \
#opcode " %%" #reg ","#offset "(%" #base ",%" #index "," #scale ")\n"
#define BUNDLEALIGN #define BUNDLEALIGN
#endif #endif
...@@ -4868,9 +4873,10 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ...@@ -4868,9 +4873,10 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
// General purpose row blend. // General purpose row blend.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"1: \n" "1: \n"
"movdqa (%1),%%xmm0 \n" "movdqa "MEMACCESS(1)",%%xmm0 \n"
"movdqa (%1,%4,1),%%xmm2 \n" MEMOPREG(movdqa,0x00,1,4,1,xmm2)
"movdqa %%xmm0,%%xmm1 \n" "movdqa %%xmm0,%%xmm1 \n"
"punpcklbw %%xmm2,%%xmm0 \n" "punpcklbw %%xmm2,%%xmm0 \n"
"punpckhbw %%xmm2,%%xmm1 \n" "punpckhbw %%xmm2,%%xmm1 \n"
...@@ -4880,56 +4886,64 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ...@@ -4880,56 +4886,64 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
"psrlw $0x7,%%xmm1 \n" "psrlw $0x7,%%xmm1 \n"
"packuswb %%xmm1,%%xmm0 \n" "packuswb %%xmm1,%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqa %%xmm0,(%1,%0,1) \n" BUNDLEALIGN
"lea 0x10(%1),%1 \n" MEMOPMEM(movdqa,xmm0,0x00,1,0,1)
"lea "MEMLEA(0x10,1)",%1 \n"
"jg 1b \n" "jg 1b \n"
"jmp 99f \n" "jmp 99f \n"
// Blend 25 / 75. // Blend 25 / 75.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"25: \n" "25: \n"
"movdqa (%1),%%xmm0 \n" "movdqa "MEMACCESS(1)",%%xmm0 \n"
"movdqa (%1,%4,1),%%xmm1 \n" MEMOPREG(movdqa,0x00,1,4,1,xmm1)
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqa %%xmm0,(%1,%0,1) \n" BUNDLEALIGN
"lea 0x10(%1),%1 \n" MEMOPMEM(movdqa,xmm0,0x00,1,0,1)
"lea "MEMLEA(0x10,1)",%1 \n"
"jg 25b \n" "jg 25b \n"
"jmp 99f \n" "jmp 99f \n"
// Blend 50 / 50. // Blend 50 / 50.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"50: \n" "50: \n"
"movdqa (%1),%%xmm0 \n" "movdqa "MEMACCESS(1)",%%xmm0 \n"
"movdqa (%1,%4,1),%%xmm1 \n" MEMOPREG(movdqa,0x00,1,4,1,xmm1)
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqa %%xmm0,(%1,%0,1) \n" BUNDLEALIGN
"lea 0x10(%1),%1 \n" MEMOPMEM(movdqa,xmm0,0x00,1,0,1)
"lea "MEMLEA(0x10,1)",%1 \n"
"jg 50b \n" "jg 50b \n"
"jmp 99f \n" "jmp 99f \n"
// Blend 75 / 25. // Blend 75 / 25.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"75: \n" "75: \n"
"movdqa (%1),%%xmm1 \n" "movdqa "MEMACCESS(1)",%%xmm1 \n"
"movdqa (%1,%4,1),%%xmm0 \n" MEMOPREG(movdqa,0x00,1,4,1,xmm0)
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqa %%xmm0,(%1,%0,1) \n" BUNDLEALIGN
"lea 0x10(%1),%1 \n" MEMOPMEM(movdqa,xmm0,0x00,1,0,1)
"lea "MEMLEA(0x10,1)",%1 \n"
"jg 75b \n" "jg 75b \n"
"jmp 99f \n" "jmp 99f \n"
// Blend 100 / 0 - Copy row unchanged. // Blend 100 / 0 - Copy row unchanged.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"100: \n" "100: \n"
"movdqa (%1),%%xmm0 \n" "movdqa "MEMACCESS(1)",%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqa %%xmm0,(%1,%0,1) \n" MEMOPMEM(movdqa,xmm0,0x00,1,0,1)
"lea 0x10(%1),%1 \n" "lea "MEMLEA(0x10,1)",%1 \n"
"jg 100b \n" "jg 100b \n"
"99: \n" "99: \n"
...@@ -4939,6 +4953,9 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ...@@ -4939,6 +4953,9 @@ void InterpolateRow_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
"+r"(source_y_fraction) // %3 "+r"(source_y_fraction) // %3
: "r"(static_cast<intptr_t>(src_stride)) // %4 : "r"(static_cast<intptr_t>(src_stride)) // %4
: "memory", "cc" : "memory", "cc"
#if defined(__native_client__) && defined(__x86_64__)
, "r14"
#endif
#if defined(__SSE2__) #if defined(__SSE2__)
, "xmm0", "xmm1", "xmm2", "xmm5" , "xmm0", "xmm1", "xmm2", "xmm5"
#endif #endif
...@@ -5086,9 +5103,10 @@ void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ...@@ -5086,9 +5103,10 @@ void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
// General purpose row blend. // General purpose row blend.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"1: \n" "1: \n"
"movdqu (%1),%%xmm0 \n" "movdqu "MEMACCESS(1)",%%xmm0 \n"
"movdqu (%1,%4,1),%%xmm2 \n" MEMOPREG(movdqu,0x00,1,4,1,xmm2)
"movdqu %%xmm0,%%xmm1 \n" "movdqu %%xmm0,%%xmm1 \n"
"punpcklbw %%xmm2,%%xmm0 \n" "punpcklbw %%xmm2,%%xmm0 \n"
"punpckhbw %%xmm2,%%xmm1 \n" "punpckhbw %%xmm2,%%xmm1 \n"
...@@ -5098,56 +5116,64 @@ void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ...@@ -5098,56 +5116,64 @@ void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
"psrlw $0x7,%%xmm1 \n" "psrlw $0x7,%%xmm1 \n"
"packuswb %%xmm1,%%xmm0 \n" "packuswb %%xmm1,%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqu %%xmm0,(%1,%0,1) \n" BUNDLEALIGN
"lea 0x10(%1),%1 \n" MEMOPMEM(movdqu,xmm0,0x00,1,0,1)
"lea "MEMLEA(0x10,1)",%1 \n"
"jg 1b \n" "jg 1b \n"
"jmp 99f \n" "jmp 99f \n"
// Blend 25 / 75. // Blend 25 / 75.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"25: \n" "25: \n"
"movdqu (%1),%%xmm0 \n" "movdqu "MEMACCESS(1)",%%xmm0 \n"
"movdqu (%1,%4,1),%%xmm1 \n" MEMOPREG(movdqu,0x00,1,4,1,xmm1)
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqu %%xmm0,(%1,%0,1) \n" BUNDLEALIGN
"lea 0x10(%1),%1 \n" MEMOPMEM(movdqu,xmm0,0x00,1,0,1)
"lea "MEMLEA(0x10,1)",%1 \n"
"jg 25b \n" "jg 25b \n"
"jmp 99f \n" "jmp 99f \n"
// Blend 50 / 50. // Blend 50 / 50.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"50: \n" "50: \n"
"movdqu (%1),%%xmm0 \n" "movdqu "MEMACCESS(1)",%%xmm0 \n"
"movdqu (%1,%4,1),%%xmm1 \n" MEMOPREG(movdqu,0x00,1,4,1,xmm1)
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqu %%xmm0,(%1,%0,1) \n" BUNDLEALIGN
"lea 0x10(%1),%1 \n" MEMOPMEM(movdqu,xmm0,0x00,1,0,1)
"lea "MEMLEA(0x10,1)",%1 \n"
"jg 50b \n" "jg 50b \n"
"jmp 99f \n" "jmp 99f \n"
// Blend 75 / 25. // Blend 75 / 25.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"75: \n" "75: \n"
"movdqu (%1),%%xmm1 \n" "movdqu "MEMACCESS(1)",%%xmm1 \n"
"movdqu (%1,%4,1),%%xmm0 \n" MEMOPREG(movdqu,0x00,1,4,1,xmm0)
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"pavgb %%xmm1,%%xmm0 \n" "pavgb %%xmm1,%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqu %%xmm0,(%1,%0,1) \n" BUNDLEALIGN
"lea 0x10(%1),%1 \n" MEMOPMEM(movdqu,xmm0,0x00,1,0,1)
"lea "MEMLEA(0x10,1)",%1 \n"
"jg 75b \n" "jg 75b \n"
"jmp 99f \n" "jmp 99f \n"
// Blend 100 / 0 - Copy row unchanged. // Blend 100 / 0 - Copy row unchanged.
".p2align 4 \n" ".p2align 4 \n"
BUNDLEALIGN
"100: \n" "100: \n"
"movdqu (%1),%%xmm0 \n" "movdqu "MEMACCESS(1)",%%xmm0 \n"
"sub $0x10,%2 \n" "sub $0x10,%2 \n"
"movdqu %%xmm0,(%1,%0,1) \n" MEMOPMEM(movdqu,xmm0,0x00,1,0,1)
"lea 0x10(%1),%1 \n" "lea "MEMLEA(0x10,1)",%1 \n"
"jg 100b \n" "jg 100b \n"
"99: \n" "99: \n"
...@@ -5157,6 +5183,9 @@ void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ...@@ -5157,6 +5183,9 @@ void InterpolateRow_Unaligned_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
"+r"(source_y_fraction) // %3 "+r"(source_y_fraction) // %3
: "r"(static_cast<intptr_t>(src_stride)) // %4 : "r"(static_cast<intptr_t>(src_stride)) // %4
: "memory", "cc" : "memory", "cc"
#if defined(__native_client__) && defined(__x86_64__)
, "r14"
#endif
#if defined(__SSE2__) #if defined(__SSE2__)
, "xmm0", "xmm1", "xmm2", "xmm5" , "xmm0", "xmm1", "xmm2", "xmm5"
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment