mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
[AArch64] Add SVE2 implementation of ARGBToRGB565DitherRow
Observed performance improvements compared to the existing Neon implementation: Cortex-A510: -21.7% Cortex-A720: -49.2% Cortex-X2: -62.6% Bug: libyuv:973 Change-Id: I2c7ae483c0b488a122bb3b80a745412ed44622df Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5505539 Reviewed-by: Frank Barchard <fbarchard@chromium.org> Reviewed-by: Justin Green <greenjustin@google.com>
This commit is contained in:
parent
dff7bad43d
commit
250e1e1ba3
@ -575,6 +575,7 @@ extern "C" {
|
|||||||
#if !defined(LIBYUV_DISABLE_SVE) && defined(__aarch64__)
|
#if !defined(LIBYUV_DISABLE_SVE) && defined(__aarch64__)
|
||||||
#define HAS_ABGRTOUVJROW_SVE2
|
#define HAS_ABGRTOUVJROW_SVE2
|
||||||
#define HAS_ABGRTOUVROW_SVE2
|
#define HAS_ABGRTOUVROW_SVE2
|
||||||
|
#define HAS_ARGBTORGB565DITHERROW_SVE2
|
||||||
#define HAS_ARGBTORGB565ROW_SVE2
|
#define HAS_ARGBTORGB565ROW_SVE2
|
||||||
#define HAS_ARGBTOUVJROW_SVE2
|
#define HAS_ARGBTOUVJROW_SVE2
|
||||||
#define HAS_ARGBTOUVROW_SVE2
|
#define HAS_ARGBTOUVROW_SVE2
|
||||||
@ -3653,6 +3654,10 @@ void ARGBToRGB565DitherRow_NEON(const uint8_t* src_argb,
|
|||||||
uint8_t* dst_rgb,
|
uint8_t* dst_rgb,
|
||||||
uint32_t dither4,
|
uint32_t dither4,
|
||||||
int width);
|
int width);
|
||||||
|
void ARGBToRGB565DitherRow_SVE2(const uint8_t* src_argb,
|
||||||
|
uint8_t* dst_rgb,
|
||||||
|
uint32_t dither4,
|
||||||
|
int width);
|
||||||
void ARGBToRGB24Row_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width);
|
void ARGBToRGB24Row_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width);
|
||||||
void ARGBToRAWRow_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width);
|
void ARGBToRAWRow_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width);
|
||||||
void ARGBToRGB565Row_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width);
|
void ARGBToRGB565Row_MSA(const uint8_t* src_argb, uint8_t* dst_rgb, int width);
|
||||||
|
|||||||
@ -6088,6 +6088,11 @@ int I420ToRGB565Dither(const uint8_t* src_y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAS_ARGBTORGB565DITHERROW_SVE2)
|
||||||
|
if (TestCpuFlag(kCpuHasSVE2)) {
|
||||||
|
ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_SVE2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if defined(HAS_ARGBTORGB565DITHERROW_MSA)
|
#if defined(HAS_ARGBTORGB565DITHERROW_MSA)
|
||||||
if (TestCpuFlag(kCpuHasMSA)) {
|
if (TestCpuFlag(kCpuHasMSA)) {
|
||||||
ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_Any_MSA;
|
ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_Any_MSA;
|
||||||
|
|||||||
@ -1960,6 +1960,11 @@ int ARGBToRGB565Dither(const uint8_t* src_argb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAS_ARGBTORGB565DITHERROW_SVE2)
|
||||||
|
if (TestCpuFlag(kCpuHasSVE2)) {
|
||||||
|
ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_SVE2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if defined(HAS_ARGBTORGB565DITHERROW_MSA)
|
#if defined(HAS_ARGBTORGB565DITHERROW_MSA)
|
||||||
if (TestCpuFlag(kCpuHasMSA)) {
|
if (TestCpuFlag(kCpuHasMSA)) {
|
||||||
ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_Any_MSA;
|
ARGBToRGB565DitherRow = ARGBToRGB565DitherRow_Any_MSA;
|
||||||
|
|||||||
@ -550,6 +550,53 @@ void ARGBToRGB565Row_SVE2(const uint8_t* src_argb,
|
|||||||
: "cc", "memory", "z0", "z1", "z3", "z4", "p0");
|
: "cc", "memory", "z0", "z1", "z3", "z4", "p0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ARGBToRGB565DitherRow_SVE2(const uint8_t* src_argb,
|
||||||
|
uint8_t* dst_rgb,
|
||||||
|
uint32_t dither4,
|
||||||
|
int width) {
|
||||||
|
unsigned bsl_mask = 0x7e0;
|
||||||
|
uint64_t vl;
|
||||||
|
width *= 2;
|
||||||
|
asm("mov z3.h, #3 \n"
|
||||||
|
"dup z4.h, %w[bsl_mask] \n"
|
||||||
|
"dup z2.s, %w[dither4] \n"
|
||||||
|
"zip1 z2.b, z2.b, z2.b \n"
|
||||||
|
|
||||||
|
"cntb %[vl] \n"
|
||||||
|
"subs %w[width], %w[width], %w[vl] \n"
|
||||||
|
"b.lt 2f \n"
|
||||||
|
|
||||||
|
"ptrue p0.b \n"
|
||||||
|
"1: \n"
|
||||||
|
"ld2b {z0.b, z1.b}, p0/z, [%[src]] \n" // BR, GA
|
||||||
|
"incb %[src], all, mul #2 \n"
|
||||||
|
"uqadd z0.b, z0.b, z2.b \n"
|
||||||
|
"uqadd z1.b, z1.b, z2.b \n"
|
||||||
|
"subs %w[width], %w[width], %w[vl] \n" ARGBTORGB565_SVE
|
||||||
|
"st1b {z1.b}, p0, [%[dst]] \n"
|
||||||
|
"incb %[dst] \n"
|
||||||
|
"b.ge 1b \n"
|
||||||
|
|
||||||
|
"2: \n"
|
||||||
|
"adds %w[width], %w[width], %w[vl] \n"
|
||||||
|
"b.eq 99f \n"
|
||||||
|
|
||||||
|
"whilelt p0.b, wzr, %w[width] \n"
|
||||||
|
"ld2b {z0.b, z1.b}, p0/z, [%[src]] \n" // BR, GA
|
||||||
|
"uqadd z0.b, z0.b, z2.b \n"
|
||||||
|
"uqadd z1.b, z1.b, z2.b \n" ARGBTORGB565_SVE
|
||||||
|
"st1b {z1.b}, p0, [%[dst]] \n"
|
||||||
|
|
||||||
|
"99: \n"
|
||||||
|
: [src] "+r"(src_argb), // %[src]
|
||||||
|
[dst] "+r"(dst_rgb), // %[dst]
|
||||||
|
[width] "+r"(width), // %[width]
|
||||||
|
[vl] "=&r"(vl) // %[vl]
|
||||||
|
: [bsl_mask] "r"(bsl_mask), // %[bsl_mask]
|
||||||
|
[dither4] "r"(dither4) // %[dither4]
|
||||||
|
: "cc", "memory", "z0", "z1", "z3", "z4", "p0");
|
||||||
|
}
|
||||||
|
|
||||||
#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