Commit 73a6f100 authored by Manojkumar Bhosale's avatar Manojkumar Bhosale

Add MSA optimized rotate functions (used 16x16 transpose)

R=fbarchard@google.com
BUG=libyuv:634

Performance Gain (vs C vectorized)
TransposeWx16_MSA        - ~6.0x
TransposeWx16_Any_MSA    - ~4.7x
TransposeUVWx16_MSA      - ~6.3x
TransposeUVWx16_Any_MSA  - ~5.4x

Performance Gain (vs C non-vectorized)
TransposeWx16_MSA        - ~6.0x
TransposeWx16_Any_MSA    - ~4.8x
TransposeUVWx16_MSA      - ~6.3x
TransposeUVWx16_Any_MSA  - ~5.4x

Review-Url: https://codereview.chromium.org/2617703002 .
parent 7c64163f
......@@ -61,8 +61,8 @@ extern "C" {
#endif // defined(__mips__)
#if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
#define HAS_TRANSPOSEWX8_MSA
#define HAS_TRANSPOSEUVWX8_MSA
#define HAS_TRANSPOSEWX16_MSA
#define HAS_TRANSPOSEUVWX16_MSA
#endif
void TransposeWxH_C(const uint8* src,
......@@ -77,6 +77,11 @@ void TransposeWx8_C(const uint8* src,
uint8* dst,
int dst_stride,
int width);
void TransposeWx16_C(const uint8* src,
int src_stride,
uint8* dst,
int dst_stride,
int width);
void TransposeWx8_NEON(const uint8* src,
int src_stride,
uint8* dst,
......@@ -102,11 +107,11 @@ void TransposeWx8_Fast_DSPR2(const uint8* src,
uint8* dst,
int dst_stride,
int width);
void TransposeWx8_MSA(const uint8* src,
int src_stride,
uint8* dst,
int dst_stride,
int width);
void TransposeWx16_MSA(const uint8* src,
int src_stride,
uint8* dst,
int dst_stride,
int width);
void TransposeWx8_Any_NEON(const uint8* src,
int src_stride,
......@@ -128,11 +133,11 @@ void TransposeWx8_Any_DSPR2(const uint8* src,
uint8* dst,
int dst_stride,
int width);
void TransposeWx8_Any_MSA(const uint8* src,
int src_stride,
uint8* dst,
int dst_stride,
int width);
void TransposeWx16_Any_MSA(const uint8* src,
int src_stride,
uint8* dst,
int dst_stride,
int width);
void TransposeUVWxH_C(const uint8* src,
int src_stride,
......@@ -150,6 +155,13 @@ void TransposeUVWx8_C(const uint8* src,
uint8* dst_b,
int dst_stride_b,
int width);
void TransposeUVWx16_C(const uint8* src,
int src_stride,
uint8* dst_a,
int dst_stride_a,
uint8* dst_b,
int dst_stride_b,
int width);
void TransposeUVWx8_SSE2(const uint8* src,
int src_stride,
uint8* dst_a,
......@@ -171,13 +183,13 @@ void TransposeUVWx8_DSPR2(const uint8* src,
uint8* dst_b,
int dst_stride_b,
int width);
void TransposeUVWx8_MSA(const uint8* src,
int src_stride,
uint8* dst_a,
int dst_stride_a,
uint8* dst_b,
int dst_stride_b,
int width);
void TransposeUVWx16_MSA(const uint8* src,
int src_stride,
uint8* dst_a,
int dst_stride_a,
uint8* dst_b,
int dst_stride_b,
int width);
void TransposeUVWx8_Any_SSE2(const uint8* src,
int src_stride,
......@@ -200,13 +212,13 @@ void TransposeUVWx8_Any_DSPR2(const uint8* src,
uint8* dst_b,
int dst_stride_b,
int width);
void TransposeUVWx8_Any_MSA(const uint8* src,
int src_stride,
uint8* dst_a,
int dst_stride_a,
uint8* dst_b,
int dst_stride_b,
int width);
void TransposeUVWx16_Any_MSA(const uint8* src,
int src_stride,
uint8* dst_a,
int dst_stride_a,
uint8* dst_b,
int dst_stride_b,
int width);
#ifdef __cplusplus
} // extern "C"
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -29,8 +29,13 @@ void TransposePlane(const uint8* src,
int width,
int height) {
int i = height;
#if defined(HAS_TRANSPOSEWX16_MSA)
void (*TransposeWx16)(const uint8* src, int src_stride, uint8* dst,
int dst_stride, int width) = TransposeWx16_C;
#else
void (*TransposeWx8)(const uint8* src, int src_stride, uint8* dst,
int dst_stride, int width) = TransposeWx8_C;
#endif
#if defined(HAS_TRANSPOSEWX8_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
TransposeWx8 = TransposeWx8_NEON;
......@@ -62,15 +67,24 @@ void TransposePlane(const uint8* src,
}
}
#endif
#if defined(HAS_TRANSPOSEWX8_MSA)
#if defined(HAS_TRANSPOSEWX16_MSA)
if (TestCpuFlag(kCpuHasMSA)) {
TransposeWx8 = TransposeWx8_Any_MSA;
TransposeWx16 = TransposeWx16_Any_MSA;
if (IS_ALIGNED(width, 16)) {
TransposeWx8 = TransposeWx8_MSA;
TransposeWx16 = TransposeWx16_MSA;
}
}
#endif
#if defined(HAS_TRANSPOSEWX16_MSA)
// Work across the source in 16x16 tiles
while (i >= 16) {
TransposeWx16(src, src_stride, dst, dst_stride, width);
src += 16 * src_stride; // Go down 16 rows.
dst += 16; // Move over 16 columns.
i -= 16;
}
#else
// Work across the source in 8x8 tiles
while (i >= 8) {
TransposeWx8(src, src_stride, dst, dst_stride, width);
......@@ -78,6 +92,7 @@ void TransposePlane(const uint8* src,
dst += 8; // Move over 8 columns.
i -= 8;
}
#endif
if (i > 0) {
TransposeWxH_C(src, src_stride, dst, dst_stride, width, i);
......@@ -218,9 +233,15 @@ void TransposeUV(const uint8* src,
int width,
int height) {
int i = height;
#if defined(HAS_TRANSPOSEUVWX16_MSA)
void (*TransposeUVWx16)(const uint8* src, int src_stride, uint8* dst_a,
int dst_stride_a, uint8* dst_b, int dst_stride_b,
int width) = TransposeUVWx16_C;
#else
void (*TransposeUVWx8)(const uint8* src, int src_stride, uint8* dst_a,
int dst_stride_a, uint8* dst_b, int dst_stride_b,
int width) = TransposeUVWx8_C;
#endif
#if defined(HAS_TRANSPOSEUVWX8_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
TransposeUVWx8 = TransposeUVWx8_NEON;
......@@ -240,15 +261,26 @@ void TransposeUV(const uint8* src,
TransposeUVWx8 = TransposeUVWx8_DSPR2;
}
#endif
#if defined(HAS_TRANSPOSEUVWX8_MSA)
#if defined(HAS_TRANSPOSEUVWX16_MSA)
if (TestCpuFlag(kCpuHasMSA)) {
TransposeUVWx8 = TransposeUVWx8_Any_MSA;
TransposeUVWx16 = TransposeUVWx16_Any_MSA;
if (IS_ALIGNED(width, 8)) {
TransposeUVWx8 = TransposeUVWx8_MSA;
TransposeUVWx16 = TransposeUVWx16_MSA;
}
}
#endif
#if defined(HAS_TRANSPOSEUVWX16_MSA)
// Work through the source in 8x8 tiles.
while (i >= 16) {
TransposeUVWx16(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b,
width);
src += 16 * src_stride; // Go down 16 rows.
dst_a += 16; // Move over 8 columns.
dst_b += 16; // Move over 8 columns.
i -= 16;
}
#else
// Work through the source in 8x8 tiles.
while (i >= 8) {
TransposeUVWx8(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b,
......@@ -258,6 +290,7 @@ void TransposeUV(const uint8* src,
dst_b += 8; // Move over 8 columns.
i -= 8;
}
#endif
if (i > 0) {
TransposeUVWxH_C(src, src_stride, dst_a, dst_stride_a, dst_b, dst_stride_b,
......
......@@ -41,8 +41,8 @@ TANY(TransposeWx8_Fast_Any_SSSE3, TransposeWx8_Fast_SSSE3, 15)
#ifdef HAS_TRANSPOSEWX8_DSPR2
TANY(TransposeWx8_Any_DSPR2, TransposeWx8_DSPR2, 7)
#endif
#ifdef HAS_TRANSPOSEWX8_MSA
TANY(TransposeWx8_Any_MSA, TransposeWx8_MSA, 15)
#ifdef HAS_TRANSPOSEWX16_MSA
TANY(TransposeWx16_Any_MSA, TransposeWx16_MSA, 15)
#endif
#undef TANY
......@@ -67,8 +67,8 @@ TUVANY(TransposeUVWx8_Any_SSE2, TransposeUVWx8_SSE2, 7)
#ifdef HAS_TRANSPOSEUVWX8_DSPR2
TUVANY(TransposeUVWx8_Any_DSPR2, TransposeUVWx8_DSPR2, 7)
#endif
#ifdef HAS_TRANSPOSEUVWX8_MSA
TUVANY(TransposeUVWx8_Any_MSA, TransposeUVWx8_MSA, 7)
#ifdef HAS_TRANSPOSEUVWX16_MSA
TUVANY(TransposeUVWx16_Any_MSA, TransposeUVWx16_MSA, 7)
#endif
#undef TUVANY
......
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