mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-02-08 10:46:50 +08:00
Port I444ToARGB to AVX2.
BUG=403 TESTED=I444ToARGB unittests R=tpsiaki@google.com Review URL: https://webrtc-codereview.appspot.com/45589004 git-svn-id: http://libyuv.googlecode.com/svn/trunk@1314 16f28f9a-4ce2-e073-06de-1de4eb20be90
This commit is contained in:
parent
7c55ae4ada
commit
cdd80e04c9
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 1313
|
Version: 1314
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -198,7 +198,7 @@ extern "C" {
|
|||||||
#define HAS_I422TORGB565ROW_AVX2
|
#define HAS_I422TORGB565ROW_AVX2
|
||||||
#define HAS_I422TOARGB1555ROW_AVX2
|
#define HAS_I422TOARGB1555ROW_AVX2
|
||||||
#define HAS_I422TOARGB4444ROW_AVX2
|
#define HAS_I422TOARGB4444ROW_AVX2
|
||||||
|
#define HAS_I444TOARGBROW_AVX2
|
||||||
// TODO(fbarchard): Port to Neon
|
// TODO(fbarchard): Port to Neon
|
||||||
#define HAS_ARGBTORGB565DITHERROW_SSE2
|
#define HAS_ARGBTORGB565DITHERROW_SSE2
|
||||||
#define HAS_ARGBTORGB565DITHERROW_AVX2
|
#define HAS_ARGBTORGB565DITHERROW_AVX2
|
||||||
@ -1046,6 +1046,11 @@ void I444ToARGBRow_SSSE3(const uint8* src_y,
|
|||||||
const uint8* src_v,
|
const uint8* src_v,
|
||||||
uint8* dst_argb,
|
uint8* dst_argb,
|
||||||
int width);
|
int width);
|
||||||
|
void I444ToARGBRow_AVX2(const uint8* src_y,
|
||||||
|
const uint8* src_u,
|
||||||
|
const uint8* src_v,
|
||||||
|
uint8* dst_argb,
|
||||||
|
int width);
|
||||||
void I422ToARGBRow_SSSE3(const uint8* src_y,
|
void I422ToARGBRow_SSSE3(const uint8* src_y,
|
||||||
const uint8* src_u,
|
const uint8* src_u,
|
||||||
const uint8* src_v,
|
const uint8* src_v,
|
||||||
@ -1185,6 +1190,11 @@ void I444ToARGBRow_Any_SSSE3(const uint8* src_y,
|
|||||||
const uint8* src_v,
|
const uint8* src_v,
|
||||||
uint8* dst_argb,
|
uint8* dst_argb,
|
||||||
int width);
|
int width);
|
||||||
|
void I444ToARGBRow_Any_AVX2(const uint8* src_y,
|
||||||
|
const uint8* src_u,
|
||||||
|
const uint8* src_v,
|
||||||
|
uint8* dst_argb,
|
||||||
|
int width);
|
||||||
void I422ToARGBRow_Any_SSSE3(const uint8* src_y,
|
void I422ToARGBRow_Any_SSSE3(const uint8* src_y,
|
||||||
const uint8* src_u,
|
const uint8* src_u,
|
||||||
const uint8* src_v,
|
const uint8* src_v,
|
||||||
|
|||||||
@ -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 1313
|
#define LIBYUV_VERSION 1314
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
||||||
|
|||||||
@ -85,6 +85,14 @@ int I444ToARGB(const uint8* src_y, int src_stride_y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAS_I444TOARGBROW_AVX2)
|
||||||
|
if (TestCpuFlag(kCpuHasAVX2)) {
|
||||||
|
I444ToARGBRow = I444ToARGBRow_Any_AVX2;
|
||||||
|
if (IS_ALIGNED(width, 16)) {
|
||||||
|
I444ToARGBRow = I444ToARGBRow_AVX2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if defined(HAS_I444TOARGBROW_NEON)
|
#if defined(HAS_I444TOARGBROW_NEON)
|
||||||
if (TestCpuFlag(kCpuHasNEON)) {
|
if (TestCpuFlag(kCpuHasNEON)) {
|
||||||
I444ToARGBRow = I444ToARGBRow_Any_NEON;
|
I444ToARGBRow = I444ToARGBRow_Any_NEON;
|
||||||
|
|||||||
@ -73,6 +73,9 @@ YANY(I422ToRGBARow_Any_AVX2, I422ToRGBARow_AVX2, I422ToRGBARow_C, 1, 4, 15)
|
|||||||
#ifdef HAS_I422TOABGRROW_AVX2
|
#ifdef HAS_I422TOABGRROW_AVX2
|
||||||
YANY(I422ToABGRRow_Any_AVX2, I422ToABGRRow_AVX2, I422ToABGRRow_C, 1, 4, 15)
|
YANY(I422ToABGRRow_Any_AVX2, I422ToABGRRow_AVX2, I422ToABGRRow_C, 1, 4, 15)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAS_I444TOARGBROW_AVX2
|
||||||
|
YANY(I444ToARGBRow_Any_AVX2, I444ToARGBRow_AVX2, I444ToARGBRow_C, 0, 4, 15)
|
||||||
|
#endif
|
||||||
#ifdef HAS_I422TOARGB4444ROW_AVX2
|
#ifdef HAS_I422TOARGB4444ROW_AVX2
|
||||||
YANY(I422ToARGB4444Row_Any_AVX2, I422ToARGB4444Row_AVX2, I422ToARGB4444Row_C,
|
YANY(I422ToARGB4444Row_Any_AVX2, I422ToARGB4444Row_AVX2, I422ToARGB4444Row_C,
|
||||||
1, 2, 7)
|
1, 2, 7)
|
||||||
|
|||||||
@ -1678,6 +1678,16 @@ void RGBAToUVRow_SSSE3(const uint8* src_argb0, int src_stride_argb,
|
|||||||
}
|
}
|
||||||
#endif // HAS_ARGBTOYROW_SSSE3
|
#endif // HAS_ARGBTOYROW_SSSE3
|
||||||
|
|
||||||
|
// Read 16 UV from 444
|
||||||
|
#define READYUV444_AVX2 __asm { \
|
||||||
|
__asm vmovdqu xmm0, [esi] /* U */ /* NOLINT */ \
|
||||||
|
__asm vmovdqu xmm1, [esi + edi] /* V */ /* NOLINT */ \
|
||||||
|
__asm lea esi, [esi + 16] \
|
||||||
|
__asm vpermq ymm0, ymm0, 0xd8 \
|
||||||
|
__asm vpermq ymm1, ymm1, 0xd8 \
|
||||||
|
__asm vpunpcklbw ymm0, ymm0, ymm1 /* UV */ \
|
||||||
|
}
|
||||||
|
|
||||||
// Read 8 UV from 422, upsample to 16 UV.
|
// Read 8 UV from 422, upsample to 16 UV.
|
||||||
#define READYUV422_AVX2 __asm { \
|
#define READYUV422_AVX2 __asm { \
|
||||||
__asm vmovq xmm0, qword ptr [esi] /* U */ /* NOLINT */ \
|
__asm vmovq xmm0, qword ptr [esi] /* U */ /* NOLINT */ \
|
||||||
@ -1775,6 +1785,44 @@ void I422ToARGBRow_AVX2(const uint8* y_buf,
|
|||||||
}
|
}
|
||||||
#endif // HAS_I422TOARGBROW_AVX2
|
#endif // HAS_I422TOARGBROW_AVX2
|
||||||
|
|
||||||
|
#ifdef HAS_I444TOARGBROW_AVX2
|
||||||
|
// 16 pixels
|
||||||
|
// 16 UV values with 16 Y producing 16 ARGB (64 bytes).
|
||||||
|
__declspec(naked) __declspec(align(16))
|
||||||
|
void I444ToARGBRow_AVX2(const uint8* y_buf,
|
||||||
|
const uint8* u_buf,
|
||||||
|
const uint8* v_buf,
|
||||||
|
uint8* dst_argb,
|
||||||
|
int width) {
|
||||||
|
__asm {
|
||||||
|
push esi
|
||||||
|
push edi
|
||||||
|
mov eax, [esp + 8 + 4] // Y
|
||||||
|
mov esi, [esp + 8 + 8] // U
|
||||||
|
mov edi, [esp + 8 + 12] // V
|
||||||
|
mov edx, [esp + 8 + 16] // argb
|
||||||
|
mov ecx, [esp + 8 + 20] // width
|
||||||
|
sub edi, esi
|
||||||
|
vpcmpeqb ymm5, ymm5, ymm5 // generate 0xffffffffffffffff for alpha
|
||||||
|
|
||||||
|
convertloop:
|
||||||
|
READYUV444_AVX2
|
||||||
|
YUVTORGB_AVX2(kYuvConstants)
|
||||||
|
STOREARGB_AVX2
|
||||||
|
|
||||||
|
sub ecx, 16
|
||||||
|
jg convertloop
|
||||||
|
|
||||||
|
pop edi
|
||||||
|
pop esi
|
||||||
|
vzeroupper
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // HAS_I444TOARGBROW_AVX2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_NV12TOARGBROW_AVX2
|
#ifdef HAS_NV12TOARGBROW_AVX2
|
||||||
// 16 pixels.
|
// 16 pixels.
|
||||||
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 ARGB (64 bytes).
|
// 8 UV values upsampled to 16 UV, mixed with 16 Y producing 16 ARGB (64 bytes).
|
||||||
|
|||||||
@ -185,13 +185,7 @@ static void YToRGB(int y, int* r, int* g, int* b) {
|
|||||||
|
|
||||||
static int RoundToByte(double f) {
|
static int RoundToByte(double f) {
|
||||||
int i = static_cast<int>(f + 0.5);
|
int i = static_cast<int>(f + 0.5);
|
||||||
if (i < 0) {
|
return (i & ~0xff) ? (int)(((int32)(-i) >> 31) & 0xff) : i;
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
if (i > 255) {
|
|
||||||
i = 255;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void YUVToRGBReference(int y, int u, int v, int* r, int* g, int* b) {
|
static void YUVToRGBReference(int y, int u, int v, int* r, int* g, int* b) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user