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" {
#define HAS_YUY2TOUV422ROW_MSA
#define HAS_YUY2TOUVROW_MSA
#define HAS_YUY2TOYROW_MSA
#define HAS_ARGBEXTRACTALPHAROW_MSA
#ifndef DISABLE_CLANG_MSA
#define HAS_ABGRTOUVROW_MSA
......@@ -463,6 +464,9 @@ extern "C" {
#define HAS_SOBELXYROW_MSA
#define HAS_UYVYTOARGBROW_MSA
#define HAS_YUY2TOARGBROW_MSA
#define HAS_ARGBBLENDROW_MSA
#define HAS_ARGBQUANTIZEROW_MSA
#define HAS_ARGBCOLORMATRIXROW_MSA
#endif
#endif
......@@ -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_AVX2(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,
uint8* dst_a,
int width);
......@@ -1476,6 +1481,9 @@ void ARGBExtractAlphaRow_Any_AVX2(const uint8* src_argb,
void ARGBExtractAlphaRow_Any_NEON(const uint8* src_argb,
uint8* dst_a,
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_SSE2(const uint8* src_y, uint8* dst_argb, int width);
......@@ -2135,6 +2143,10 @@ void ARGBBlendRow_NEON(const uint8* src_argb,
const uint8* src_argb1,
uint8* dst_argb,
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,
const uint8* src_argb1,
uint8* dst_argb,
......@@ -2848,6 +2860,10 @@ void ARGBColorMatrixRow_NEON(const uint8* src_argb,
uint8* dst_argb,
const int8* matrix_argb,
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_X86(uint8* dst_argb, const uint8* table_argb, int width);
......@@ -2870,6 +2886,11 @@ void ARGBQuantizeRow_NEON(uint8* dst_argb,
int interval_size,
int interval_offset,
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,
uint8* dst_argb,
......
......@@ -845,6 +845,11 @@ ARGBBlendRow GetARGBBlend() {
if (TestCpuFlag(kCpuHasNEON)) {
ARGBBlendRow = ARGBBlendRow_NEON;
}
#endif
#if defined(HAS_ARGBBLENDROW_MSA)
if (TestCpuFlag(kCpuHasMSA)) {
ARGBBlendRow = ARGBBlendRow_MSA;
}
#endif
return ARGBBlendRow;
}
......@@ -1973,6 +1978,11 @@ int ARGBColorMatrix(const uint8* src_argb,
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
ARGBColorMatrixRow = ARGBColorMatrixRow_NEON;
}
#endif
#if defined(HAS_ARGBCOLORMATRIXROW_MSA)
if (TestCpuFlag(kCpuHasMSA) && IS_ALIGNED(width, 8)) {
ARGBColorMatrixRow = ARGBColorMatrixRow_MSA;
}
#endif
for (y = 0; y < height; ++y) {
ARGBColorMatrixRow(src_argb, dst_argb, matrix_argb, width);
......@@ -2133,6 +2143,11 @@ int ARGBQuantize(uint8* dst_argb,
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
ARGBQuantizeRow = ARGBQuantizeRow_NEON;
}
#endif
#if defined(HAS_ARGBQUANTIZEROW_MSA)
if (TestCpuFlag(kCpuHasMSA) && IS_ALIGNED(width, 8)) {
ARGBQuantizeRow = ARGBQuantizeRow_MSA;
}
#endif
for (y = 0; y < height; ++y) {
ARGBQuantizeRow(dst, scale, interval_size, interval_offset, width);
......@@ -3048,6 +3063,12 @@ int ARGBExtractAlpha(const uint8* src_argb,
: ARGBExtractAlphaRow_Any_NEON;
}
#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) {
ARGBExtractAlphaRow(src_argb, dst_a, width);
......
......@@ -621,6 +621,9 @@ ANY11(ARGBExtractAlphaRow_Any_AVX2, ARGBExtractAlphaRow_AVX2, 0, 4, 1, 32)
#ifdef HAS_ARGBEXTRACTALPHAROW_NEON
ANY11(ARGBExtractAlphaRow_Any_NEON, ARGBExtractAlphaRow_NEON, 0, 4, 1, 15)
#endif
#ifdef HAS_ARGBEXTRACTALPHAROW_MSA
ANY11(ARGBExtractAlphaRow_Any_MSA, ARGBExtractAlphaRow_MSA, 0, 4, 1, 15)
#endif
#undef ANY11
// 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