mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
[AArch64] Add SVE implementation for I422AlphaToARGBRow
This is mostly identical to the existing I422ToARGBRow_SVE implementation, we just need to make sure to load the alpha component rather than hard-coding it to 255. Reduction in runtimes observed compared to the existing Neon code: Cortex-A510: -32.1% Cortex-A720: -5.1% Cortex-X2: -10.1% Bug: libyuv:973 Change-Id: I6f800f3ef59f1dc82b409233017b3cb108da0257 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5444426 Reviewed-by: Frank Barchard <fbarchard@chromium.org> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
b53b27d6bf
commit
f483007b9a
@ -567,6 +567,7 @@ extern "C" {
|
|||||||
#define HAS_I444TOARGBROW_SVE2
|
#define HAS_I444TOARGBROW_SVE2
|
||||||
#define HAS_I422TOARGBROW_SVE2
|
#define HAS_I422TOARGBROW_SVE2
|
||||||
#define HAS_I444ALPHATOARGBROW_SVE2
|
#define HAS_I444ALPHATOARGBROW_SVE2
|
||||||
|
#define HAS_I422ALPHATOARGBROW_SVE2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The following are available on AArch64 platforms:
|
// The following are available on AArch64 platforms:
|
||||||
@ -1082,6 +1083,13 @@ void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
|
|||||||
uint8_t* dst_argb,
|
uint8_t* dst_argb,
|
||||||
const struct YuvConstants* yuvconstants,
|
const struct YuvConstants* yuvconstants,
|
||||||
int width);
|
int width);
|
||||||
|
void I422AlphaToARGBRow_SVE2(const uint8_t* src_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width);
|
||||||
void I422ToRGBARow_NEON(const uint8_t* src_y,
|
void I422ToRGBARow_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,
|
||||||
|
|||||||
@ -2050,6 +2050,11 @@ int I420AlphaToARGBMatrix(const uint8_t* src_y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAS_I422ALPHATOARGBROW_SVE2)
|
||||||
|
if (TestCpuFlag(kCpuHasSVE2)) {
|
||||||
|
I422AlphaToARGBRow = I422AlphaToARGBRow_SVE2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if defined(HAS_I422ALPHATOARGBROW_MSA)
|
#if defined(HAS_I422ALPHATOARGBROW_MSA)
|
||||||
if (TestCpuFlag(kCpuHasMSA)) {
|
if (TestCpuFlag(kCpuHasMSA)) {
|
||||||
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_MSA;
|
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_MSA;
|
||||||
@ -2193,6 +2198,11 @@ int I422AlphaToARGBMatrix(const uint8_t* src_y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAS_I422ALPHATOARGBROW_SVE2)
|
||||||
|
if (TestCpuFlag(kCpuHasSVE2)) {
|
||||||
|
I422AlphaToARGBRow = I422AlphaToARGBRow_SVE2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if defined(HAS_I422ALPHATOARGBROW_MSA)
|
#if defined(HAS_I422ALPHATOARGBROW_MSA)
|
||||||
if (TestCpuFlag(kCpuHasMSA)) {
|
if (TestCpuFlag(kCpuHasMSA)) {
|
||||||
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_MSA;
|
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_MSA;
|
||||||
|
|||||||
@ -209,6 +209,54 @@ void I444AlphaToARGBRow_SVE2(const uint8_t* src_y,
|
|||||||
: "cc", "memory", YUVTORGB_SVE_REGS);
|
: "cc", "memory", YUVTORGB_SVE_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I422AlphaToARGBRow_SVE2(const uint8_t* src_y,
|
||||||
|
const uint8_t* src_u,
|
||||||
|
const uint8_t* src_v,
|
||||||
|
const uint8_t* src_a,
|
||||||
|
uint8_t* dst_argb,
|
||||||
|
const struct YuvConstants* yuvconstants,
|
||||||
|
int width) {
|
||||||
|
uint64_t vl;
|
||||||
|
asm("cnth %[vl] \n"
|
||||||
|
"ptrue p0.b \n" YUVTORGB_SVE_SETUP
|
||||||
|
"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" READYUV422_SVE
|
||||||
|
"ld1b {z19.h}, p1/z, [%[src_a]] \n" // A
|
||||||
|
"add %[src_a], %[src_a], %[vl] \n" I4XXTORGB_SVE
|
||||||
|
RGBTORGBA8_SVE
|
||||||
|
"subs %w[width], %w[width], %w[vl] \n"
|
||||||
|
"st2h {z16.h, z17.h}, p1, [%[dst_argb]] \n"
|
||||||
|
"add %[dst_argb], %[dst_argb], %[vl], lsl #2 \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] \n" READYUV422_SVE
|
||||||
|
"ld1b {z19.h}, p1/z, [%[src_a]] \n" // A
|
||||||
|
I4XXTORGB_SVE RGBTORGBA8_SVE
|
||||||
|
"st2h {z16.h, z17.h}, p1, [%[dst_argb]] \n"
|
||||||
|
|
||||||
|
"99: \n"
|
||||||
|
: [src_y] "+r"(src_y), // %[src_y]
|
||||||
|
[src_u] "+r"(src_u), // %[src_u]
|
||||||
|
[src_v] "+r"(src_v), // %[src_v]
|
||||||
|
[src_a] "+r"(src_a), // %[src_a]
|
||||||
|
[dst_argb] "+r"(dst_argb), // %[dst_argb]
|
||||||
|
[width] "+r"(width), // %[width]
|
||||||
|
[vl] "=&r"(vl) // %[vl]
|
||||||
|
: [kUVCoeff] "r"(&yuvconstants->kUVCoeff), // %[kUVCoeff]
|
||||||
|
[kRGBCoeffBias] "r"(&yuvconstants->kRGBCoeffBias) // %[kRGBCoeffBias]
|
||||||
|
: "cc", "memory", YUVTORGB_SVE_REGS);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !defined(LIBYUV_DISABLE_SVE) && defined(__aarch64__)
|
#endif // !defined(LIBYUV_DISABLE_SVE) && defined(__aarch64__)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user