aboutsummaryrefslogtreecommitdiff
path: root/source/rotate.cc
diff options
context:
space:
mode:
authorHao Chen <chenhao@loongson.cn>2021-12-20 20:20:26 +0800
committerFrank Barchard <fbarchard@chromium.org>2022-01-21 01:34:38 +0000
commitf8e2da48aed24a7b2608172aa5e59421f1f802d4 (patch)
tree9dc87821993ff629500bf1fc320d195efdaa6dbe /source/rotate.cc
parentdfe046d27255cff06fc4cfe42c6d373fd83bc2aa (diff)
downloadlibyuv-f8e2da48aed24a7b2608172aa5e59421f1f802d4.tar.gz
Add optimization functions in rotate_lsx.cc file.
Optimize two functions in source/rotate_lsx.cc file. All test cases passed on loongarch platform. Bug: libyuv:913 Change-Id: Idf670a1bc078f6284a499a292e0cb795f5b603b4 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3351468 Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/rotate.cc')
-rw-r--r--source/rotate.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/source/rotate.cc b/source/rotate.cc
index ddfaf5bb..e2601f1d 100644
--- a/source/rotate.cc
+++ b/source/rotate.cc
@@ -32,6 +32,9 @@ void TransposePlane(const uint8_t* src,
#if defined(HAS_TRANSPOSEWX16_MSA)
void (*TransposeWx16)(const uint8_t* src, int src_stride, uint8_t* dst,
int dst_stride, int width) = TransposeWx16_C;
+#elif defined(HAS_TRANSPOSEWX16_LSX)
+ void (*TransposeWx16)(const uint8_t* src, int src_stride, uint8_t* dst,
+ int dst_stride, int width) = TransposeWx16_C;
#else
void (*TransposeWx8)(const uint8_t* src, int src_stride, uint8_t* dst,
int dst_stride, int width) = TransposeWx8_C;
@@ -44,6 +47,13 @@ void TransposePlane(const uint8_t* src,
TransposeWx16 = TransposeWx16_MSA;
}
}
+#elif defined(HAS_TRANSPOSEWX16_LSX)
+ if (TestCpuFlag(kCpuHasLSX)) {
+ TransposeWx16 = TransposeWx16_Any_LSX;
+ if (IS_ALIGNED(width, 16)) {
+ TransposeWx16 = TransposeWx16_LSX;
+ }
+ }
#else
#if defined(HAS_TRANSPOSEWX8_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
@@ -81,6 +91,14 @@ void TransposePlane(const uint8_t* src,
dst += 16; // Move over 16 columns.
i -= 16;
}
+#elif defined(HAS_TRANSPOSEWX16_LSX)
+ // 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) {
@@ -181,6 +199,14 @@ void RotatePlane180(const uint8_t* src,
}
}
#endif
+#if defined(HAS_MIRRORROW_LASX)
+ if (TestCpuFlag(kCpuHasLASX)) {
+ MirrorRow = MirrorRow_Any_LASX;
+ if (IS_ALIGNED(width, 64)) {
+ MirrorRow = MirrorRow_LASX;
+ }
+ }
+#endif
#if defined(HAS_COPYROW_SSE2)
if (TestCpuFlag(kCpuHasSSE2)) {
CopyRow = IS_ALIGNED(width, 32) ? CopyRow_SSE2 : CopyRow_Any_SSE2;
@@ -234,6 +260,10 @@ void SplitTransposeUV(const uint8_t* src,
void (*TransposeUVWx16)(const uint8_t* src, int src_stride, uint8_t* dst_a,
int dst_stride_a, uint8_t* dst_b, int dst_stride_b,
int width) = TransposeUVWx16_C;
+#elif defined(HAS_TRANSPOSEUVWX16_LSX)
+ void (*TransposeUVWx16)(const uint8_t* src, int src_stride, uint8_t* dst_a,
+ int dst_stride_a, uint8_t* dst_b, int dst_stride_b,
+ int width) = TransposeUVWx16_C;
#else
void (*TransposeUVWx8)(const uint8_t* src, int src_stride, uint8_t* dst_a,
int dst_stride_a, uint8_t* dst_b, int dst_stride_b,
@@ -247,6 +277,13 @@ void SplitTransposeUV(const uint8_t* src,
TransposeUVWx16 = TransposeUVWx16_MSA;
}
}
+#elif defined(HAS_TRANSPOSEUVWX16_LSX)
+ if (TestCpuFlag(kCpuHasLSX)) {
+ TransposeUVWx16 = TransposeUVWx16_Any_LSX;
+ if (IS_ALIGNED(width, 8)) {
+ TransposeUVWx16 = TransposeUVWx16_LSX;
+ }
+ }
#else
#if defined(HAS_TRANSPOSEUVWX8_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
@@ -281,6 +318,16 @@ void SplitTransposeUV(const uint8_t* src,
dst_b += 16; // Move over 8 columns.
i -= 16;
}
+#elif defined(HAS_TRANSPOSEUVWX16_LSX)
+ // 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) {