mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
[AArch64] Add SVE2 implementation of I212ToAR30Row
Observed reduction in runtime compared to the existing Neon code: Cortex-A510: -15.4% Cortex-A520: -3.8% Cortex-A715: -15.7% Cortex-A720: -15.6% Cortex-X2: -7.9% Cortex-X3: -5.7% Cortex-X4: -5.3% Cortex-X925: -4.8% Bug: b/42280942 Change-Id: I99846820682687c8e0f52d05f5aa3d50369fe0a2 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/6025829 Reviewed-by: Justin Green <greenjustin@google.com> Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
305a7a4ede
commit
50108f29fb
@ -554,6 +554,7 @@ extern "C" {
|
|||||||
#define HAS_DIVIDEROW_16_SVE2
|
#define HAS_DIVIDEROW_16_SVE2
|
||||||
#define HAS_HALFFLOATROW_SVE2
|
#define HAS_HALFFLOATROW_SVE2
|
||||||
#define HAS_I210TOARGBROW_SVE2
|
#define HAS_I210TOARGBROW_SVE2
|
||||||
|
#define HAS_I212TOAR30ROW_SVE2
|
||||||
#define HAS_I212TOARGBROW_SVE2
|
#define HAS_I212TOARGBROW_SVE2
|
||||||
#define HAS_I400TOARGBROW_SVE2
|
#define HAS_I400TOARGBROW_SVE2
|
||||||
#define HAS_I422ALPHATOARGBROW_SVE2
|
#define HAS_I422ALPHATOARGBROW_SVE2
|
||||||
@ -1144,6 +1145,12 @@ void I212ToAR30Row_NEON(const uint16_t* src_y,
|
|||||||
uint8_t* rgb_buf,
|
uint8_t* rgb_buf,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
|
void I212ToAR30Row_SVE2(const uint16_t* src_y,
|
||||||
|
const uint16_t* src_u,
|
||||||
|
const uint16_t* src_v,
|
||||||
|
uint8_t* rgb_buf,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
void I422ToARGBRow_NEON(const uint8_t* src_y,
|
void I422ToARGBRow_NEON(const uint8_t* src_y,
|
||||||
const uint8_t* src_u,
|
const uint8_t* src_u,
|
||||||
const uint8_t* src_v,
|
const uint8_t* src_v,
|
||||||
|
|||||||
@ -1160,6 +1160,11 @@ int I012ToAR30Matrix(const uint16_t* src_y,
|
|||||||
I212ToAR30Row = I212ToAR30Row_NEON;
|
I212ToAR30Row = I212ToAR30Row_NEON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(HAS_I212TOAR30ROW_SVE2)
|
||||||
|
if (TestCpuFlag(kCpuHasSVE2)) {
|
||||||
|
I212ToAR30Row = I212ToAR30Row_SVE2;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
for (y = 0; y < height; ++y) {
|
for (y = 0; y < height; ++y) {
|
||||||
I212ToAR30Row(src_y, src_u, src_v, dst_ar30, yuvconstants, width);
|
I212ToAR30Row(src_y, src_u, src_v, dst_ar30, yuvconstants, width);
|
||||||
|
|||||||
@ -2117,6 +2117,53 @@ void P410ToAR30Row_SVE2(const uint16_t* src_y,
|
|||||||
: "cc", "memory", YUVTORGB_SVE_REGS);
|
: "cc", "memory", YUVTORGB_SVE_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I212ToAR30Row_SVE2(const uint16_t* src_y,
|
||||||
|
const uint16_t* src_u,
|
||||||
|
const uint16_t* src_v,
|
||||||
|
uint8_t* dst_ar30,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
uint64_t vl;
|
||||||
|
asm("cnth %0" : "=r"(vl));
|
||||||
|
int width_last_y = width & (vl - 1);
|
||||||
|
width_last_y = width_last_y == 0 ? vl : width_last_y;
|
||||||
|
uint16_t limit = 0x3ff0;
|
||||||
|
asm volatile(
|
||||||
|
"ptrue p0.b \n" YUVTORGB_SVE_SETUP
|
||||||
|
"dup z23.h, %w[limit] \n"
|
||||||
|
"subs %w[width], %w[width], %w[vl] \n"
|
||||||
|
"b.lt 2f \n"
|
||||||
|
|
||||||
|
// Run bulk of computation with an all-true predicate to avoid predicate
|
||||||
|
// generation overhead.
|
||||||
|
"ptrue p1.h \n"
|
||||||
|
"1: \n" //
|
||||||
|
READI212_SVE I4XXTORGB_SVE STOREAR30_SVE
|
||||||
|
"subs %w[width], %w[width], %w[vl] \n"
|
||||||
|
"b.ge 1b \n"
|
||||||
|
|
||||||
|
"2: \n"
|
||||||
|
"adds %w[width], %w[width], %w[vl] \n"
|
||||||
|
"b.eq 99f \n"
|
||||||
|
|
||||||
|
// Calculate a predicate for the final iteration to deal with the tail.
|
||||||
|
"whilelt p1.h, wzr, %w[width_last_y] \n" //
|
||||||
|
READI212_SVE I4XXTORGB_SVE STOREAR30_SVE
|
||||||
|
|
||||||
|
"99: \n"
|
||||||
|
: [src_y] "+r"(src_y), // %[src_y]
|
||||||
|
[src_u] "+r"(src_u), // %[src_u]
|
||||||
|
[src_v] "+r"(src_v), // %[src_v]
|
||||||
|
[dst_ar30] "+r"(dst_ar30), // %[dst_ar30]
|
||||||
|
[width] "+r"(width) // %[width]
|
||||||
|
: [vl] "r"(vl), // %[vl]
|
||||||
|
[kUVCoeff] "r"(&yuvconstants->kUVCoeff), // %[kUVCoeff]
|
||||||
|
[kRGBCoeffBias] "r"(&yuvconstants->kRGBCoeffBias), // %[kRGBCoeffBias]
|
||||||
|
[width_last_y] "r"(width_last_y), // %[width_last_y]
|
||||||
|
[limit] "r"(limit) // %[limit]
|
||||||
|
: "cc", "memory", YUVTORGB_SVE_REGS);
|
||||||
|
}
|
||||||
|
|
||||||
void I212ToARGBRow_SVE2(const uint16_t* src_y,
|
void I212ToARGBRow_SVE2(const uint16_t* src_y,
|
||||||
const uint16_t* src_u,
|
const uint16_t* src_u,
|
||||||
const uint16_t* src_v,
|
const uint16_t* src_v,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user