Commit 22eb5965 authored by fbarchard@google.com's avatar fbarchard@google.com

Optimize I422ToRGBA for AVX2 by hoisting ymm5 initialization and using different…

Optimize I422ToRGBA for AVX2 by hoisting ymm5 initialization and using different register for output of unpack.
BUG=269
TESTED=intelsde on I422ToABGR
R=harryjin@google.com

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

git-svn-id: http://libyuv.googlecode.com/svn/trunk@1137 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent c000955b
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 1136 Version: 1137
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 1136 #define LIBYUV_VERSION 1137
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -1613,7 +1613,6 @@ void I422ToARGBRow_AVX2(const uint8* y_buf, ...@@ -1613,7 +1613,6 @@ void I422ToARGBRow_AVX2(const uint8* y_buf,
// 16 pixels // 16 pixels
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 BGRA (64 bytes). // 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 BGRA (64 bytes).
// TODO(fbarchard): Use macros to reduce duplicate code. See SSSE3.
__declspec(naked) __declspec(align(16)) __declspec(naked) __declspec(align(16))
void I422ToBGRARow_AVX2(const uint8* y_buf, void I422ToBGRARow_AVX2(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
...@@ -1659,7 +1658,6 @@ void I422ToBGRARow_AVX2(const uint8* y_buf, ...@@ -1659,7 +1658,6 @@ void I422ToBGRARow_AVX2(const uint8* y_buf,
// 16 pixels // 16 pixels
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 RGBA (64 bytes). // 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 RGBA (64 bytes).
// TODO(fbarchard): Use macros to reduce duplicate code. See SSSE3.
__declspec(naked) __declspec(align(16)) __declspec(naked) __declspec(align(16))
void I422ToRGBARow_AVX2(const uint8* y_buf, void I422ToRGBARow_AVX2(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
...@@ -1675,6 +1673,7 @@ void I422ToRGBARow_AVX2(const uint8* y_buf, ...@@ -1675,6 +1673,7 @@ void I422ToRGBARow_AVX2(const uint8* y_buf,
mov edx, [esp + 8 + 16] // argb mov edx, [esp + 8 + 16] // argb
mov ecx, [esp + 8 + 20] // width mov ecx, [esp + 8 + 20] // width
sub edi, esi sub edi, esi
vpcmpeqb ymm5, ymm5, ymm5 // generate 0xffffffffffffffff for alpha
vpxor ymm4, ymm4, ymm4 vpxor ymm4, ymm4, ymm4
align 4 align 4
...@@ -1683,13 +1682,12 @@ void I422ToRGBARow_AVX2(const uint8* y_buf, ...@@ -1683,13 +1682,12 @@ void I422ToRGBARow_AVX2(const uint8* y_buf,
YUVTORGB_AVX2 YUVTORGB_AVX2
// Step 3: Weave into RGBA // Step 3: Weave into RGBA
vpcmpeqb ymm5, ymm5, ymm5 // generate 0xffffffffffffffff for alpha
vpunpcklbw ymm1, ymm1, ymm2 // GR vpunpcklbw ymm1, ymm1, ymm2 // GR
vpermq ymm1, ymm1, 0xd8 vpermq ymm1, ymm1, 0xd8
vpunpcklbw ymm5, ymm5, ymm0 // AB vpunpcklbw ymm2, ymm5, ymm0 // AB
vpermq ymm5, ymm5, 0xd8 vpermq ymm2, ymm2, 0xd8
vpunpcklwd ymm0, ymm5, ymm1 // ABGR first 8 pixels vpunpcklwd ymm0, ymm2, ymm1 // ABGR first 8 pixels
vpunpckhwd ymm1, ymm5, ymm1 // ABGR next 8 pixels vpunpckhwd ymm1, ymm2, ymm1 // ABGR next 8 pixels
vmovdqu [edx], ymm0 vmovdqu [edx], ymm0
vmovdqu [edx + 32], ymm1 vmovdqu [edx + 32], ymm1
lea edx, [edx + 64] lea edx, [edx + 64]
...@@ -1702,6 +1700,7 @@ void I422ToRGBARow_AVX2(const uint8* y_buf, ...@@ -1702,6 +1700,7 @@ void I422ToRGBARow_AVX2(const uint8* y_buf,
ret ret
} }
} }
#endif // HAS_I422TOARGBROW_AVX2 #endif // HAS_I422TOARGBROW_AVX2
#ifdef HAS_I422TOARGBROW_SSSE3 #ifdef HAS_I422TOARGBROW_SSSE3
......
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