Commit dbd7c1a9 authored by Manojkumar Bhosale's avatar Manojkumar Bhosale Committed by Frank Barchard

Add MSA optimized ARGBExtractAlpha, ARGBBlend, ARGBQuantize and ARGBColorMatrix row functions

TBR=kjellander@chromium.org
R=fbarchard@google.com

Bug:libyuv:634
Change-Id: I17bd3f87336f613ad363af7d7b9d7af49d725e56
Reviewed-on: https://chromium-review.googlesource.com/613100Reviewed-by: 's avatarFrank Barchard <fbarchard@google.com>
parent 83ca1abe
...@@ -421,6 +421,7 @@ extern "C" { ...@@ -421,6 +421,7 @@ extern "C" {
#define HAS_YUY2TOUV422ROW_MSA #define HAS_YUY2TOUV422ROW_MSA
#define HAS_YUY2TOUVROW_MSA #define HAS_YUY2TOUVROW_MSA
#define HAS_YUY2TOYROW_MSA #define HAS_YUY2TOYROW_MSA
#define HAS_ARGBEXTRACTALPHAROW_MSA
#ifndef DISABLE_CLANG_MSA #ifndef DISABLE_CLANG_MSA
#define HAS_ABGRTOUVROW_MSA #define HAS_ABGRTOUVROW_MSA
...@@ -463,6 +464,9 @@ extern "C" { ...@@ -463,6 +464,9 @@ extern "C" {
#define HAS_SOBELXYROW_MSA #define HAS_SOBELXYROW_MSA
#define HAS_UYVYTOARGBROW_MSA #define HAS_UYVYTOARGBROW_MSA
#define HAS_YUY2TOARGBROW_MSA #define HAS_YUY2TOARGBROW_MSA
#define HAS_ARGBBLENDROW_MSA
#define HAS_ARGBQUANTIZEROW_MSA
#define HAS_ARGBCOLORMATRIXROW_MSA
#endif #endif
#endif #endif
...@@ -1467,6 +1471,7 @@ void ARGBExtractAlphaRow_C(const uint8* src_argb, uint8* dst_a, int width); ...@@ -1467,6 +1471,7 @@ void ARGBExtractAlphaRow_C(const uint8* src_argb, uint8* dst_a, int width);
void ARGBExtractAlphaRow_SSE2(const uint8* src_argb, uint8* dst_a, int width); void ARGBExtractAlphaRow_SSE2(const uint8* src_argb, uint8* dst_a, int width);
void ARGBExtractAlphaRow_AVX2(const uint8* src_argb, uint8* dst_a, int width); void ARGBExtractAlphaRow_AVX2(const uint8* src_argb, uint8* dst_a, int width);
void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width); void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width);
void ARGBExtractAlphaRow_MSA(const uint8* src_argb, uint8* dst_a, int width);
void ARGBExtractAlphaRow_Any_SSE2(const uint8* src_argb, void ARGBExtractAlphaRow_Any_SSE2(const uint8* src_argb,
uint8* dst_a, uint8* dst_a,
int width); int width);
...@@ -1476,6 +1481,9 @@ void ARGBExtractAlphaRow_Any_AVX2(const uint8* src_argb, ...@@ -1476,6 +1481,9 @@ void ARGBExtractAlphaRow_Any_AVX2(const uint8* src_argb,
void ARGBExtractAlphaRow_Any_NEON(const uint8* src_argb, void ARGBExtractAlphaRow_Any_NEON(const uint8* src_argb,
uint8* dst_a, uint8* dst_a,
int width); int width);
void ARGBExtractAlphaRow_Any_MSA(const uint8* src_argb,
uint8* dst_a,
int width);
void ARGBCopyYToAlphaRow_C(const uint8* src_y, uint8* dst_argb, int width); void ARGBCopyYToAlphaRow_C(const uint8* src_y, uint8* dst_argb, int width);
void ARGBCopyYToAlphaRow_SSE2(const uint8* src_y, uint8* dst_argb, int width); void ARGBCopyYToAlphaRow_SSE2(const uint8* src_y, uint8* dst_argb, int width);
...@@ -2135,6 +2143,10 @@ void ARGBBlendRow_NEON(const uint8* src_argb, ...@@ -2135,6 +2143,10 @@ void ARGBBlendRow_NEON(const uint8* src_argb,
const uint8* src_argb1, const uint8* src_argb1,
uint8* dst_argb, uint8* dst_argb,
int width); int width);
void ARGBBlendRow_MSA(const uint8* src_argb,
const uint8* src_argb1,
uint8* dst_argb,
int width);
void ARGBBlendRow_C(const uint8* src_argb, void ARGBBlendRow_C(const uint8* src_argb,
const uint8* src_argb1, const uint8* src_argb1,
uint8* dst_argb, uint8* dst_argb,
...@@ -2848,6 +2860,10 @@ void ARGBColorMatrixRow_NEON(const uint8* src_argb, ...@@ -2848,6 +2860,10 @@ void ARGBColorMatrixRow_NEON(const uint8* src_argb,
uint8* dst_argb, uint8* dst_argb,
const int8* matrix_argb, const int8* matrix_argb,
int width); int width);
void ARGBColorMatrixRow_MSA(const uint8* src_argb,
uint8* dst_argb,
const int8* matrix_argb,
int width);
void ARGBColorTableRow_C(uint8* dst_argb, const uint8* table_argb, int width); void ARGBColorTableRow_C(uint8* dst_argb, const uint8* table_argb, int width);
void ARGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb, int width); void ARGBColorTableRow_X86(uint8* dst_argb, const uint8* table_argb, int width);
...@@ -2870,6 +2886,11 @@ void ARGBQuantizeRow_NEON(uint8* dst_argb, ...@@ -2870,6 +2886,11 @@ void ARGBQuantizeRow_NEON(uint8* dst_argb,
int interval_size, int interval_size,
int interval_offset, int interval_offset,
int width); int width);
void ARGBQuantizeRow_MSA(uint8* dst_argb,
int scale,
int interval_size,
int interval_offset,
int width);
void ARGBShadeRow_C(const uint8* src_argb, void ARGBShadeRow_C(const uint8* src_argb,
uint8* dst_argb, uint8* dst_argb,
......
...@@ -845,6 +845,11 @@ ARGBBlendRow GetARGBBlend() { ...@@ -845,6 +845,11 @@ ARGBBlendRow GetARGBBlend() {
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBBlendRow = ARGBBlendRow_NEON; ARGBBlendRow = ARGBBlendRow_NEON;
} }
#endif
#if defined(HAS_ARGBBLENDROW_MSA)
if (TestCpuFlag(kCpuHasMSA)) {
ARGBBlendRow = ARGBBlendRow_MSA;
}
#endif #endif
return ARGBBlendRow; return ARGBBlendRow;
} }
...@@ -1973,6 +1978,11 @@ int ARGBColorMatrix(const uint8* src_argb, ...@@ -1973,6 +1978,11 @@ int ARGBColorMatrix(const uint8* src_argb,
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
ARGBColorMatrixRow = ARGBColorMatrixRow_NEON; ARGBColorMatrixRow = ARGBColorMatrixRow_NEON;
} }
#endif
#if defined(HAS_ARGBCOLORMATRIXROW_MSA)
if (TestCpuFlag(kCpuHasMSA) && IS_ALIGNED(width, 8)) {
ARGBColorMatrixRow = ARGBColorMatrixRow_MSA;
}
#endif #endif
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
ARGBColorMatrixRow(src_argb, dst_argb, matrix_argb, width); ARGBColorMatrixRow(src_argb, dst_argb, matrix_argb, width);
...@@ -2133,6 +2143,11 @@ int ARGBQuantize(uint8* dst_argb, ...@@ -2133,6 +2143,11 @@ int ARGBQuantize(uint8* dst_argb,
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
ARGBQuantizeRow = ARGBQuantizeRow_NEON; ARGBQuantizeRow = ARGBQuantizeRow_NEON;
} }
#endif
#if defined(HAS_ARGBQUANTIZEROW_MSA)
if (TestCpuFlag(kCpuHasMSA) && IS_ALIGNED(width, 8)) {
ARGBQuantizeRow = ARGBQuantizeRow_MSA;
}
#endif #endif
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
ARGBQuantizeRow(dst, scale, interval_size, interval_offset, width); ARGBQuantizeRow(dst, scale, interval_size, interval_offset, width);
...@@ -3048,6 +3063,12 @@ int ARGBExtractAlpha(const uint8* src_argb, ...@@ -3048,6 +3063,12 @@ int ARGBExtractAlpha(const uint8* src_argb,
: ARGBExtractAlphaRow_Any_NEON; : ARGBExtractAlphaRow_Any_NEON;
} }
#endif #endif
#if defined(HAS_ARGBEXTRACTALPHAROW_MSA)
if (TestCpuFlag(kCpuHasMSA)) {
ARGBExtractAlphaRow = IS_ALIGNED(width, 16) ? ARGBExtractAlphaRow_MSA
: ARGBExtractAlphaRow_Any_MSA;
}
#endif
for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
ARGBExtractAlphaRow(src_argb, dst_a, width); ARGBExtractAlphaRow(src_argb, dst_a, width);
......
...@@ -621,6 +621,9 @@ ANY11(ARGBExtractAlphaRow_Any_AVX2, ARGBExtractAlphaRow_AVX2, 0, 4, 1, 32) ...@@ -621,6 +621,9 @@ ANY11(ARGBExtractAlphaRow_Any_AVX2, ARGBExtractAlphaRow_AVX2, 0, 4, 1, 32)
#ifdef HAS_ARGBEXTRACTALPHAROW_NEON #ifdef HAS_ARGBEXTRACTALPHAROW_NEON
ANY11(ARGBExtractAlphaRow_Any_NEON, ARGBExtractAlphaRow_NEON, 0, 4, 1, 15) ANY11(ARGBExtractAlphaRow_Any_NEON, ARGBExtractAlphaRow_NEON, 0, 4, 1, 15)
#endif #endif
#ifdef HAS_ARGBEXTRACTALPHAROW_MSA
ANY11(ARGBExtractAlphaRow_Any_MSA, ARGBExtractAlphaRow_MSA, 0, 4, 1, 15)
#endif
#undef ANY11 #undef ANY11
// Any 1 to 1 blended. Destination is read, modify, write. // Any 1 to 1 blended. Destination is read, modify, write.
......
This diff is collapsed.
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