aboutsummaryrefslogtreecommitdiff
path: root/source/convert.cc
diff options
context:
space:
mode:
authorBruce Lai <bruce.lai@sifive.com>2023-04-25 02:08:45 -0700
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-05-11 10:17:51 +0000
commit59eae49f17c345aa4949271dea2bb088130793af (patch)
treea89af6dad716978b1f9ad030a37a551807f9cad2 /source/convert.cc
parent497ea35688f997edb4c42ef1cdd9f2ab4efb9e29 (diff)
downloadlibyuv-59eae49f17c345aa4949271dea2bb088130793af.tar.gz
Enable ARGBToYMatrixRow_RVV/RGBAToYMatrixRow_RVV/RGBToYMatrixRow_RVV
Run on SiFive internal FPGA: ARGBToJ400_Opt (~6x vs scalar) RGBAToJ400_Opt (~6x vs scalar) RGB24ToJ400_Opt (~5.5x vs scalar) LIBYUV_WIDTH=1280 LIBYUV_HEIGHT=720 LIBYUV_REPEAT=10 Change-Id: Ia3ce8cea7962fbd8618cc23e850a7913c9cabf4f Signed-off-by: Bruce Lai <bruce.lai@sifive.com> Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4521783 Reviewed-by: Frank Barchard <fbarchard@chromium.org> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/convert.cc')
-rw-r--r--source/convert.cc55
1 files changed, 51 insertions, 4 deletions
diff --git a/source/convert.cc b/source/convert.cc
index ad679c59..140be1ab 100644
--- a/source/convert.cc
+++ b/source/convert.cc
@@ -1950,6 +1950,11 @@ int BGRAToI420(const uint8_t* src_bgra,
}
}
#endif
+#if defined(HAS_BGRATOYROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ BGRAToYRow = BGRAToYRow_RVV;
+ }
+#endif
for (y = 0; y < height - 1; y += 2) {
BGRAToUVRow(src_bgra, src_stride_bgra, dst_u, dst_v, width);
@@ -2070,6 +2075,11 @@ int ABGRToI420(const uint8_t* src_abgr,
}
}
#endif
+#if defined(HAS_ABGRTOYROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ ABGRToYRow = ABGRToYRow_RVV;
+ }
+#endif
for (y = 0; y < height - 1; y += 2) {
ABGRToUVRow(src_abgr, src_stride_abgr, dst_u, dst_v, width);
@@ -2174,6 +2184,11 @@ int RGBAToI420(const uint8_t* src_rgba,
}
}
#endif
+#if defined(HAS_RGBATOYROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ RGBAToYRow = RGBAToYRow_RVV;
+ }
+#endif
for (y = 0; y < height - 1; y += 2) {
RGBAToUVRow(src_rgba, src_stride_rgba, dst_u, dst_v, width);
@@ -2193,7 +2208,7 @@ int RGBAToI420(const uint8_t* src_rgba,
// Enabled if 1 pass is available
#if (defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_MSA) || \
- defined(HAS_RGB24TOYROW_LSX))
+ defined(HAS_RGB24TOYROW_LSX) || defined(HAS_RGB24TOYROW_RVV))
#define HAS_RGB24TOYROW
#endif
@@ -2278,6 +2293,11 @@ int RGB24ToI420(const uint8_t* src_rgb24,
}
}
#endif
+#if defined(HAS_RGB24TOYROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ RGB24ToYRow = RGB24ToYRow_RVV;
+ }
+#endif
// Other platforms do intermediate conversion from RGB24 to ARGB.
#else // HAS_RGB24TOYROW
@@ -2367,7 +2387,8 @@ int RGB24ToI420(const uint8_t* src_rgb24,
#undef HAS_RGB24TOYROW
// Enabled if 1 pass is available
-#if defined(HAS_RGB24TOYJROW_NEON) || defined(HAS_RGB24TOYJROW_MSA)
+#if defined(HAS_RGB24TOYJROW_NEON) || defined(HAS_RGB24TOYJROW_MSA) || \
+ defined(HAS_RGB24TOYJROW_RVV)
#define HAS_RGB24TOYJROW
#endif
@@ -2448,6 +2469,11 @@ int RGB24ToJ420(const uint8_t* src_rgb24,
}
}
#endif
+#if defined(HAS_RGB24TOYJROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ RGB24ToYJRow = RGB24ToYJRow_RVV;
+ }
+#endif
// Other platforms do intermediate conversion from RGB24 to ARGB.
#else // HAS_RGB24TOYJROW
@@ -2538,7 +2564,7 @@ int RGB24ToJ420(const uint8_t* src_rgb24,
// Enabled if 1 pass is available
#if (defined(HAS_RAWTOYROW_NEON) || defined(HAS_RAWTOYROW_MSA) || \
- defined(HAS_RAWTOYROW_LSX))
+ defined(HAS_RAWTOYROW_LSX) || defined(HAS_RAWTOYROW_RVV))
#define HAS_RAWTOYROW
#endif
@@ -2622,6 +2648,11 @@ int RAWToI420(const uint8_t* src_raw,
}
}
#endif
+#if defined(HAS_RAWTOYROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ RAWToYRow = RAWToYRow_RVV;
+ }
+#endif
// Other platforms do intermediate conversion from RAW to ARGB.
#else // HAS_RAWTOYROW
@@ -2711,7 +2742,8 @@ int RAWToI420(const uint8_t* src_raw,
#undef HAS_RAWTOYROW
// Enabled if 1 pass is available
-#if defined(HAS_RAWTOYJROW_NEON) || defined(HAS_RAWTOYJROW_MSA)
+#if defined(HAS_RAWTOYJROW_NEON) || defined(HAS_RAWTOYJROW_MSA) || \
+ defined(HAS_RAWTOYJROW_RVV)
#define HAS_RAWTOYJROW
#endif
@@ -2792,6 +2824,11 @@ int RAWToJ420(const uint8_t* src_raw,
}
}
#endif
+#if defined(HAS_RAWTOYJROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ RAWToYJRow = RAWToYJRow_RVV;
+ }
+#endif
// Other platforms do intermediate conversion from RAW to ARGB.
#else // HAS_RAWTOYJROW
@@ -3515,6 +3552,11 @@ int RGB24ToJ400(const uint8_t* src_rgb24,
}
}
#endif
+#if defined(HAS_RGB24TOYJROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ RGB24ToYJRow = RGB24ToYJRow_RVV;
+ }
+#endif
for (y = 0; y < height; ++y) {
RGB24ToYJRow(src_rgb24, dst_yj, width);
@@ -3599,6 +3641,11 @@ int RAWToJ400(const uint8_t* src_raw,
}
}
#endif
+#if defined(HAS_RAWTOYJROW_RVV)
+ if (TestCpuFlag(kCpuHasRVV)) {
+ RAWToYJRow = RAWToYJRow_RVV;
+ }
+#endif
for (y = 0; y < height; ++y) {
RAWToYJRow(src_raw, dst_yj, width);