Commit 8c4e5e28 authored by fbarchard@google.com's avatar fbarchard@google.com

Specialize SSE2 filter

BUG=177
TEST=unittest scale*
Review URL: https://webrtc-codereview.appspot.com/1069005

git-svn-id: http://libyuv.googlecode.com/svn/trunk@550 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 8811289b
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 549 Version: 550
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -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 549 #define LIBYUV_VERSION 550
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -4642,14 +4642,15 @@ void ARGBInterpolateRow_SSSE3(uint8* dst_argb, const uint8* src_argb, ...@@ -4642,14 +4642,15 @@ void ARGBInterpolateRow_SSSE3(uint8* dst_argb, const uint8* src_argb,
mov eax, [esp + 8 + 20] // source_y_fraction (0..255) mov eax, [esp + 8 + 20] // source_y_fraction (0..255)
sub edi, esi sub edi, esi
shr eax, 1 shr eax, 1
cmp eax, 0 // dispatch to specialized filters if applicable. // Dispatch to specialized filters if applicable.
je xloop100 cmp eax, 0
je xloop100 // 0 / 128. Blend 100 / 0.
cmp eax, 32 cmp eax, 32
je xloop75 je xloop75 // 32 / 128 is 0.25. Blend 75 / 25.
cmp eax, 64 cmp eax, 64
je xloop50 je xloop50 // 64 / 128 is 0.50. Blend 50 / 50.
cmp eax, 96 cmp eax, 96
je xloop25 je xloop25 // 96 / 128 is 0.75. Blend 25 / 75.
movd xmm0, eax // high fraction 0..127 movd xmm0, eax // high fraction 0..127
neg eax neg eax
...@@ -4746,14 +4747,15 @@ void ARGBInterpolateRow_SSE2(uint8* dst_argb, const uint8* src_argb, ...@@ -4746,14 +4747,15 @@ void ARGBInterpolateRow_SSE2(uint8* dst_argb, const uint8* src_argb,
mov ecx, [esp + 8 + 16] // dst_width mov ecx, [esp + 8 + 16] // dst_width
mov eax, [esp + 8 + 20] // source_y_fraction (0..255) mov eax, [esp + 8 + 20] // source_y_fraction (0..255)
sub edi, esi sub edi, esi
cmp eax, 0 // dispatch to specialized filters if applicable. // Dispatch to specialized filters if applicable.
je xloop100 cmp eax, 0
je xloop100 // 0 / 256. Blend 100 / 0.
cmp eax, 64 cmp eax, 64
je xloop75 je xloop75 // 64 / 256 is 0.25. Blend 75 / 25.
cmp eax, 128 cmp eax, 128
je xloop50 je xloop50 // 128 / 256 is 0.50. Blend 50 / 50.
cmp eax, 192 cmp eax, 192
je xloop25 je xloop25 // 192 / 256 is 0.75. Blend 25 / 75.
movd xmm5, eax // xmm5 = y fraction movd xmm5, eax // xmm5 = y fraction
punpcklbw xmm5, xmm5 punpcklbw xmm5, xmm5
......
...@@ -947,10 +947,15 @@ static void ScaleFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr, ...@@ -947,10 +947,15 @@ static void ScaleFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr,
mov ecx, [esp + 8 + 16] // dst_width mov ecx, [esp + 8 + 16] // dst_width
mov eax, [esp + 8 + 20] // source_y_fraction (0..255) mov eax, [esp + 8 + 20] // source_y_fraction (0..255)
sub edi, esi sub edi, esi
// Dispatch to specialized filters if applicable.
cmp eax, 0 cmp eax, 0
je xloop1 je xloop100 // 0 / 256. Blend 100 / 0.
cmp eax, 128 // 50%? cmp eax, 64
je xloop2 je xloop75 // 64 / 256 is 0.25. Blend 75 / 25.
cmp eax, 128
je xloop50 // 128 / 256 is 0.50. Blend 50 / 50.
cmp eax, 192
je xloop25 // 192 / 256 is 0.75. Blend 25 / 75.
movd xmm5, eax // xmm5 = y fraction movd xmm5, eax // xmm5 = y fraction
punpcklbw xmm5, xmm5 punpcklbw xmm5, xmm5
...@@ -983,41 +988,58 @@ static void ScaleFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr, ...@@ -983,41 +988,58 @@ static void ScaleFilterRows_SSE2(uint8* dst_ptr, const uint8* src_ptr,
movdqa [esi + edi], xmm0 movdqa [esi + edi], xmm0
lea esi, [esi + 16] lea esi, [esi + 16]
jg xloop jg xloop
jmp xloop99
punpckhbw xmm0, xmm0 // duplicate last pixel for filtering // Blend 25 / 75.
pshufhw xmm0, xmm0, 0xff align 16
punpckhqdq xmm0, xmm0 xloop25:
movdqa xmm0, [esi]
movdqa xmm1, [esi + edx]
pavgb xmm0, xmm1
pavgb xmm0, xmm1
sub ecx, 16
movdqa [esi + edi], xmm0 movdqa [esi + edi], xmm0
pop edi lea esi, [esi + 16]
pop esi jg xloop25
ret jmp xloop99
// Blend 50 / 50.
align 16 align 16
xloop1: xloop50:
movdqa xmm0, [esi] movdqa xmm0, [esi]
movdqa xmm1, [esi + edx]
pavgb xmm0, xmm1
sub ecx, 16 sub ecx, 16
movdqa [esi + edi], xmm0 movdqa [esi + edi], xmm0
lea esi, [esi + 16] lea esi, [esi + 16]
jg xloop1 jg xloop50
jmp xloop99
punpckhbw xmm0, xmm0 // duplicate last pixel for filtering // Blend 75 / 25.
pshufhw xmm0, xmm0, 0xff align 16
punpckhqdq xmm0, xmm0 xloop75:
movdqa xmm1, [esi]
movdqa xmm0, [esi + edx]
pavgb xmm0, xmm1
pavgb xmm0, xmm1
sub ecx, 16
movdqa [esi + edi], xmm0 movdqa [esi + edi], xmm0
pop edi lea esi, [esi + 16]
pop esi jg xloop75
ret jmp xloop99
// Blend 100 / 0 - Copy row unchanged.
align 16 align 16
xloop2: xloop100:
movdqa xmm0, [esi] movdqa xmm0, [esi]
pavgb xmm0, [esi + edx]
sub ecx, 16 sub ecx, 16
movdqa [esi + edi], xmm0 movdqa [esi + edi], xmm0
lea esi, [esi + 16] lea esi, [esi + 16]
jg xloop2 jg xloop100
punpckhbw xmm0, xmm0 // duplicate last pixel for filtering // Extrude last pixel.
xloop99:
punpckhbw xmm0, xmm0
pshufhw xmm0, xmm0, 0xff pshufhw xmm0, xmm0, 0xff
punpckhqdq xmm0, xmm0 punpckhqdq xmm0, xmm0
movdqa [esi + edi], xmm0 movdqa [esi + edi], xmm0
...@@ -1043,14 +1065,15 @@ static void ScaleFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr, ...@@ -1043,14 +1065,15 @@ static void ScaleFilterRows_SSSE3(uint8* dst_ptr, const uint8* src_ptr,
mov eax, [esp + 8 + 20] // source_y_fraction (0..255) mov eax, [esp + 8 + 20] // source_y_fraction (0..255)
sub edi, esi sub edi, esi
shr eax, 1 shr eax, 1
cmp eax, 0 // dispatch to specialized filters if applicable. // Dispatch to specialized filters if applicable.
je xloop100 cmp eax, 0
je xloop100 // 0 / 128. Blend 100 / 0.
cmp eax, 32 cmp eax, 32
je xloop75 je xloop75 // 32 / 128 is 0.25. Blend 75 / 25.
cmp eax, 64 cmp eax, 64
je xloop50 je xloop50 // 64 / 128 is 0.50. Blend 50 / 50.
cmp eax, 96 cmp eax, 96
je xloop25 je xloop25 // 96 / 128 is 0.75. Blend 25 / 75.
movd xmm0, eax // high fraction 1..127. movd xmm0, eax // high fraction 1..127.
neg eax neg eax
......
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