aboutsummaryrefslogtreecommitdiff
path: root/source/rotate.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2022-02-23 00:46:55 -0800
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-02-23 19:16:53 +0000
commite77531f6f149340428d8a1076d0a1473bdec8c09 (patch)
tree2745e956c547d6fc20b30c17651740f51f2ff366 /source/rotate.cc
parent3b8c86d23a2dfca026c42fa6d93ea89c6c5beda4 (diff)
downloadlibyuv-e77531f6f149340428d8a1076d0a1473bdec8c09.tar.gz
Fix RotatePlane by 90 on Neon when source width is not a multiple of 8
Bug: b/220888716, b/218875554, b/220205245 Change-Id: I17e118ac9b9a7013386a5f0ad27a2dd249474ae5 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3483576 Reviewed-by: Mirko Bonadei <mbonadei@chromium.org> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/rotate.cc')
-rw-r--r--source/rotate.cc50
1 files changed, 21 insertions, 29 deletions
diff --git a/source/rotate.cc b/source/rotate.cc
index 939e305c..b274e8db 100644
--- a/source/rotate.cc
+++ b/source/rotate.cc
@@ -29,10 +29,7 @@ void TransposePlane(const uint8_t* src,
int width,
int height) {
int i = height;
-#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)
+#if defined(HAS_TRANSPOSEWX16_MSA) || defined(HAS_TRANSPOSEWX16_LSX)
void (*TransposeWx16)(const uint8_t* src, int src_stride, uint8_t* dst,
int dst_stride, int width) = TransposeWx16_C;
#else
@@ -40,24 +37,12 @@ void TransposePlane(const uint8_t* src,
int dst_stride, int width) = TransposeWx8_C;
#endif
-#if defined(HAS_TRANSPOSEWX16_MSA)
- if (TestCpuFlag(kCpuHasMSA)) {
- TransposeWx16 = TransposeWx16_Any_MSA;
- if (IS_ALIGNED(width, 16)) {
- 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)) {
- TransposeWx8 = TransposeWx8_NEON;
+ TransposeWx8 = TransposeWx8_Any_NEON;
+ if (IS_ALIGNED(width, 8)) {
+ TransposeWx8 = TransposeWx8_NEON;
+ }
}
#endif
#if defined(HAS_TRANSPOSEWX8_SSSE3)
@@ -76,17 +61,24 @@ void TransposePlane(const uint8_t* src,
}
}
#endif
-#endif /* defined(HAS_TRANSPOSEWX16_MSA) */
-
#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;
+ if (TestCpuFlag(kCpuHasMSA)) {
+ TransposeWx16 = TransposeWx16_Any_MSA;
+ if (IS_ALIGNED(width, 16)) {
+ TransposeWx16 = TransposeWx16_MSA;
+ }
+ }
+#endif
+#if defined(HAS_TRANSPOSEWX16_LSX)
+ if (TestCpuFlag(kCpuHasLSX)) {
+ TransposeWx16 = TransposeWx16_Any_LSX;
+ if (IS_ALIGNED(width, 16)) {
+ TransposeWx16 = TransposeWx16_LSX;
+ }
}
-#elif defined(HAS_TRANSPOSEWX16_LSX)
+#endif
+
+#if defined(HAS_TRANSPOSEWX16_MSA) || defined(HAS_TRANSPOSEWX16_LSX)
// Work across the source in 16x16 tiles
while (i >= 16) {
TransposeWx16(src, src_stride, dst, dst_stride, width);