Add 25 native k-masked AVX-512 row kernels

R=rrwinterton@gmail.com

Bug: None
Change-Id: I2ee9b2c2d939f63f49d2f951f2d552ca6863d78b
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8564927
Commit-Queue: Frank Barchard <fbarchard@google.com>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
This commit is contained in:
Frank Barchard 2026-10-12 17:12:52 -07:00 committed by libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 63b56324de
commit b9d572cc63
16 changed files with 4002 additions and 7 deletions

View File

@ -996,6 +996,32 @@ int ABGRToI420(const uint8_t* src_abgr,
int width, int width,
int height); int height);
// Convert AR30 to I420.
LIBYUV_API
int AR30ToI420(const uint8_t* src_ar30,
int src_stride_ar30,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_u,
int dst_stride_u,
uint8_t* dst_v,
int dst_stride_v,
int width,
int height);
// Convert AB30 to I420.
LIBYUV_API
int AB30ToI420(const uint8_t* src_ab30,
int src_stride_ab30,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_u,
int dst_stride_u,
uint8_t* dst_v,
int dst_stride_v,
int width,
int height);
// BGRA little endian (argb in memory) to I422. // BGRA little endian (argb in memory) to I422.
LIBYUV_API LIBYUV_API
int BGRAToI422(const uint8_t* src_bgra, int BGRAToI422(const uint8_t* src_bgra,

View File

@ -609,6 +609,15 @@ void MirrorPlane(const uint8_t* src_y,
int width, int width,
int height); int height);
// Mirror a plane of 16-bit data.
LIBYUV_API
void MirrorPlane_16(const uint16_t* src_y,
int src_stride_y,
uint16_t* dst_y,
int dst_stride_y,
int width,
int height);
// Mirror a plane of UV data. // Mirror a plane of UV data.
LIBYUV_API LIBYUV_API
void MirrorUVPlane(const uint8_t* src_uv, void MirrorUVPlane(const uint8_t* src_uv,

View File

@ -389,6 +389,31 @@ extern "C" {
#define HAS_ARGBCOPYYTOALPHAROW_AVX512BW #define HAS_ARGBCOPYYTOALPHAROW_AVX512BW
#define HAS_ARGBMIRRORROW_AVX512BW #define HAS_ARGBMIRRORROW_AVX512BW
#define HAS_RGB24MIRRORROW_AVX512VBMI #define HAS_RGB24MIRRORROW_AVX512VBMI
#define HAS_AYUVTOYROW_AVX512VBMI
#define HAS_AYUVTOUVROW_AVX512VBMI
#define HAS_AYUVTOVUROW_AVX512VBMI
#define HAS_AR30TOARGBROW_AVX512BW
#define HAS_AR30TOABGRROW_AVX512BW
#define HAS_AR30TOAB30ROW_AVX512BW
#define HAS_MERGEXR30ROW_10_AVX512BW
#define HAS_MIRRORROW_16_AVX512BW
#define HAS_MERGERGBROW_AVX512VBMI
#define HAS_RAWTORGBAROW_AVX512VBMI
#define HAS_NV12TOARGBROW_AVX512BW
#define HAS_NV21TOARGBROW_AVX512BW
#define HAS_NV12TORGB24ROW_AVX512VBMI
#define HAS_NV21TORGB24ROW_AVX512VBMI
#define HAS_I422ALPHATOARGBROW_AVX512BW
#define HAS_SWAPUVROW_AVX512BW
#define HAS_HALFMERGEUVROW_AVX512BW
#define HAS_INTERPOLATEROW_16_AVX512BW
#define HAS_ARGBATTENUATEROW_AVX512BW
#define HAS_ARGBMULTIPLYROW_AVX512BW
#define HAS_ARGBTOAR30ROW_AVX512BW
#define HAS_ABGRTOAR30ROW_AVX512BW
#define HAS_I400TOARGBROW_AVX512BW
#define HAS_ARGBGRAYROW_AVX512BW
#define HAS_ARGBBLENDROW_AVX512BW
#endif #endif
#define HAS_ARGBTOYMATRIXROW_AVX2 #define HAS_ARGBTOYMATRIXROW_AVX2
#define HAS_RGBTOYMATRIXROW_AVX2 #define HAS_RGBTOYMATRIXROW_AVX2
@ -464,6 +489,31 @@ extern "C" {
#define HAS_ARGBCOPYYTOALPHAROW_AVX512BW #define HAS_ARGBCOPYYTOALPHAROW_AVX512BW
#define HAS_ARGBMIRRORROW_AVX512BW #define HAS_ARGBMIRRORROW_AVX512BW
#define HAS_RGB24MIRRORROW_AVX512VBMI #define HAS_RGB24MIRRORROW_AVX512VBMI
#define HAS_AYUVTOYROW_AVX512VBMI
#define HAS_AYUVTOUVROW_AVX512VBMI
#define HAS_AYUVTOVUROW_AVX512VBMI
#define HAS_AR30TOARGBROW_AVX512BW
#define HAS_AR30TOABGRROW_AVX512BW
#define HAS_AR30TOAB30ROW_AVX512BW
#define HAS_MERGEXR30ROW_10_AVX512BW
#define HAS_MIRRORROW_16_AVX512BW
#define HAS_MERGERGBROW_AVX512VBMI
#define HAS_RAWTORGBAROW_AVX512VBMI
#define HAS_NV12TOARGBROW_AVX512BW
#define HAS_NV21TOARGBROW_AVX512BW
#define HAS_NV12TORGB24ROW_AVX512VBMI
#define HAS_NV21TORGB24ROW_AVX512VBMI
#define HAS_I422ALPHATOARGBROW_AVX512BW
#define HAS_SWAPUVROW_AVX512BW
#define HAS_HALFMERGEUVROW_AVX512BW
#define HAS_INTERPOLATEROW_16_AVX512BW
#define HAS_ARGBATTENUATEROW_AVX512BW
#define HAS_ARGBMULTIPLYROW_AVX512BW
#define HAS_ARGBTOAR30ROW_AVX512BW
#define HAS_ABGRTOAR30ROW_AVX512BW
#define HAS_I400TOARGBROW_AVX512BW
#define HAS_ARGBGRAYROW_AVX512BW
#define HAS_ARGBBLENDROW_AVX512BW
#endif #endif
// The following are available on Neon platforms: // The following are available on Neon platforms:
@ -2781,6 +2831,7 @@ void MirrorSplitUVRow_C(const uint8_t* src_uv,
int width); int width);
void MirrorRow_16_C(const uint16_t* src, uint16_t* dst, int width); void MirrorRow_16_C(const uint16_t* src, uint16_t* dst, int width);
void MirrorRow_16_AVX512BW(const uint16_t* src, uint16_t* dst, int width);
void ARGBMirrorRow_AVX2(const uint8_t* src, uint8_t* dst, int width); void ARGBMirrorRow_AVX2(const uint8_t* src, uint8_t* dst, int width);
void ARGBMirrorRow_AVX512BW(const uint8_t* src, uint8_t* dst, int width); void ARGBMirrorRow_AVX512BW(const uint8_t* src, uint8_t* dst, int width);
@ -3078,6 +3129,12 @@ void HalfMergeUVRow_AVX2(const uint8_t* src_u,
int src_stride_v, int src_stride_v,
uint8_t* dst_uv, uint8_t* dst_uv,
int width); int width);
void HalfMergeUVRow_AVX512BW(const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* dst_uv,
int width);
void SplitRGBRow_C(const uint8_t* src_rgb, void SplitRGBRow_C(const uint8_t* src_rgb,
uint8_t* dst_r, uint8_t* dst_r,
@ -3150,6 +3207,11 @@ void MergeRGBRow_RVV(const uint8_t* src_r,
const uint8_t* src_b, const uint8_t* src_b,
uint8_t* dst_rgb, uint8_t* dst_rgb,
int width); int width);
void MergeRGBRow_AVX512VBMI(const uint8_t* src_r,
const uint8_t* src_g,
const uint8_t* src_b,
uint8_t* dst_rgb,
int width);
void MergeRGBRow_Any_SSSE3(const uint8_t* y_buf, void MergeRGBRow_Any_SSSE3(const uint8_t* y_buf,
const uint8_t* u_buf, const uint8_t* u_buf,
const uint8_t* v_buf, const uint8_t* v_buf,
@ -3397,6 +3459,12 @@ void MergeXR30Row_AVX2(const uint16_t* src_r,
uint8_t* dst_ar30, uint8_t* dst_ar30,
int depth, int depth,
int width); int width);
void MergeXR30Row_10_AVX512BW(const uint16_t* src_r,
const uint16_t* src_g,
const uint16_t* src_b,
uint8_t* dst_ar30,
int depth,
int width);
void MergeAR64Row_AVX2(const uint16_t* src_r, void MergeAR64Row_AVX2(const uint16_t* src_r,
const uint16_t* src_g, const uint16_t* src_g,
const uint16_t* src_b, const uint16_t* src_b,
@ -4152,6 +4220,9 @@ void ARGB4444ToARGBRow_LASX(const uint8_t* src_argb4444,
void RGB24ToARGBRow_C(const uint8_t* src_rgb24, uint8_t* dst_argb, int width); void RGB24ToARGBRow_C(const uint8_t* src_rgb24, uint8_t* dst_argb, int width);
void RAWToARGBRow_C(const uint8_t* src_raw, uint8_t* dst_argb, int width); void RAWToARGBRow_C(const uint8_t* src_raw, uint8_t* dst_argb, int width);
void RAWToRGBARow_C(const uint8_t* src_raw, uint8_t* dst_rgba, int width); void RAWToRGBARow_C(const uint8_t* src_raw, uint8_t* dst_rgba, int width);
void RAWToRGBARow_AVX512VBMI(const uint8_t* src_raw,
uint8_t* dst_rgba,
int width);
void RAWToRGB24Row_C(const uint8_t* src_raw, uint8_t* dst_rgb24, int width); void RAWToRGB24Row_C(const uint8_t* src_raw, uint8_t* dst_rgb24, int width);
void RGB565ToARGBRow_C(const uint8_t* src_rgb565, uint8_t* dst_argb, int width); void RGB565ToARGBRow_C(const uint8_t* src_rgb565, uint8_t* dst_argb, int width);
void ARGB1555ToARGBRow_C(const uint8_t* src_argb1555, void ARGB1555ToARGBRow_C(const uint8_t* src_argb1555,
@ -4161,9 +4232,18 @@ void ARGB4444ToARGBRow_C(const uint8_t* src_argb4444,
uint8_t* dst_argb, uint8_t* dst_argb,
int width); int width);
void AR30ToARGBRow_C(const uint8_t* src_ar30, uint8_t* dst_argb, int width); void AR30ToARGBRow_C(const uint8_t* src_ar30, uint8_t* dst_argb, int width);
void AR30ToARGBRow_AVX512BW(const uint8_t* src_ar30,
uint8_t* dst_argb,
int width);
void AR30ToABGRRow_C(const uint8_t* src_ar30, uint8_t* dst_abgr, int width); void AR30ToABGRRow_C(const uint8_t* src_ar30, uint8_t* dst_abgr, int width);
void AR30ToABGRRow_AVX512BW(const uint8_t* src_ar30,
uint8_t* dst_abgr,
int width);
void ARGBToAR30Row_C(const uint8_t* src_argb, uint8_t* dst_ar30, int width); void ARGBToAR30Row_C(const uint8_t* src_argb, uint8_t* dst_ar30, int width);
void AR30ToAB30Row_C(const uint8_t* src_ar30, uint8_t* dst_ab30, int width); void AR30ToAB30Row_C(const uint8_t* src_ar30, uint8_t* dst_ab30, int width);
void AR30ToAB30Row_AVX512BW(const uint8_t* src_ar30,
uint8_t* dst_ab30,
int width);
void RGB24ToARGBRow_Any_SSSE3(const uint8_t* src_ptr, void RGB24ToARGBRow_Any_SSSE3(const uint8_t* src_ptr,
uint8_t* dst_ptr, uint8_t* dst_ptr,
@ -4286,7 +4366,9 @@ void ARGBToARGB4444Row_AVX2(const uint8_t* src_argb,
uint8_t* dst_rgb, uint8_t* dst_rgb,
int width); int width);
void ABGRToAR30Row_AVX2(const uint8_t* src, uint8_t* dst, int width); void ABGRToAR30Row_AVX2(const uint8_t* src, uint8_t* dst, int width);
void ABGRToAR30Row_AVX512BW(const uint8_t* src, uint8_t* dst, int width);
void ARGBToAR30Row_AVX2(const uint8_t* src, uint8_t* dst, int width); void ARGBToAR30Row_AVX2(const uint8_t* src, uint8_t* dst, int width);
void ARGBToAR30Row_AVX512BW(const uint8_t* src, uint8_t* dst, int width);
void ARGBToRGB24Row_NEON(const uint8_t* src_argb, void ARGBToRGB24Row_NEON(const uint8_t* src_argb,
uint8_t* dst_rgb24, uint8_t* dst_rgb24,
@ -4864,6 +4946,13 @@ void I422AlphaToARGBRow_AVX2(const uint8_t* y_buf,
uint8_t* dst_argb, uint8_t* dst_argb,
const struct YuvConstants* yuvconstants, const struct YuvConstants* yuvconstants,
int width); int width);
void I422AlphaToARGBRow_AVX512BW(const uint8_t* y_buf,
const uint8_t* u_buf,
const uint8_t* v_buf,
const uint8_t* a_buf,
uint8_t* dst_argb,
const struct YuvConstants* yuvconstants,
int width);
void NV12ToARGBRow_SSSE3(const uint8_t* y_buf, void NV12ToARGBRow_SSSE3(const uint8_t* y_buf,
const uint8_t* uv_buf, const uint8_t* uv_buf,
uint8_t* dst_argb, uint8_t* dst_argb,
@ -4874,6 +4963,11 @@ void NV12ToARGBRow_AVX2(const uint8_t* y_buf,
uint8_t* dst_argb, uint8_t* dst_argb,
const struct YuvConstants* yuvconstants, const struct YuvConstants* yuvconstants,
int width); int width);
void NV12ToARGBRow_AVX512BW(const uint8_t* y_buf,
const uint8_t* uv_buf,
uint8_t* dst_argb,
const struct YuvConstants* yuvconstants,
int width);
void NV12ToRGB24Row_SSSE3(const uint8_t* src_y, void NV12ToRGB24Row_SSSE3(const uint8_t* src_y,
const uint8_t* src_uv, const uint8_t* src_uv,
uint8_t* dst_rgb24, uint8_t* dst_rgb24,
@ -4890,11 +4984,21 @@ void NV12ToRGB24Row_AVX2(const uint8_t* src_y,
uint8_t* dst_rgb24, uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants, const struct YuvConstants* yuvconstants,
int width); int width);
void NV12ToRGB24Row_AVX512VBMI(const uint8_t* src_y,
const uint8_t* src_uv,
uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants,
int width);
void NV21ToRGB24Row_AVX2(const uint8_t* src_y, void NV21ToRGB24Row_AVX2(const uint8_t* src_y,
const uint8_t* src_vu, const uint8_t* src_vu,
uint8_t* dst_rgb24, uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants, const struct YuvConstants* yuvconstants,
int width); int width);
void NV21ToRGB24Row_AVX512VBMI(const uint8_t* src_y,
const uint8_t* src_vu,
uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants,
int width);
void NV12ToRGB565Row_SSSE3(const uint8_t* src_y, void NV12ToRGB565Row_SSSE3(const uint8_t* src_y,
const uint8_t* src_uv, const uint8_t* src_uv,
uint8_t* dst_rgb565, uint8_t* dst_rgb565,
@ -4924,6 +5028,11 @@ void NV21ToARGBRow_AVX2(const uint8_t* y_buf,
uint8_t* dst_argb, uint8_t* dst_argb,
const struct YuvConstants* yuvconstants, const struct YuvConstants* yuvconstants,
int width); int width);
void NV21ToARGBRow_AVX512BW(const uint8_t* y_buf,
const uint8_t* vu_buf,
uint8_t* dst_argb,
const struct YuvConstants* yuvconstants,
int width);
void YUY2ToARGBRow_SSSE3(const uint8_t* yuy2_buf, void YUY2ToARGBRow_SSSE3(const uint8_t* yuy2_buf,
uint8_t* dst_argb, uint8_t* dst_argb,
const struct YuvConstants* yuvconstants, const struct YuvConstants* yuvconstants,
@ -5384,6 +5493,10 @@ void I400ToARGBRow_AVX2(const uint8_t* y_buf,
uint8_t* dst_argb, uint8_t* dst_argb,
const struct YuvConstants* yuvconstants, const struct YuvConstants* yuvconstants,
int width); int width);
void I400ToARGBRow_AVX512BW(const uint8_t* y_buf,
uint8_t* dst_argb,
const struct YuvConstants* yuvconstants,
int width);
void I400ToARGBRow_NEON(const uint8_t* src_y, void I400ToARGBRow_NEON(const uint8_t* src_y,
uint8_t* dst_argb, uint8_t* dst_argb,
const struct YuvConstants* yuvconstants, const struct YuvConstants* yuvconstants,
@ -5426,6 +5539,10 @@ void ARGBBlendRow_SSSE3(const uint8_t* src_argb,
const uint8_t* src_argb1, const uint8_t* src_argb1,
uint8_t* dst_argb, uint8_t* dst_argb,
int width); int width);
void ARGBBlendRow_AVX512BW(const uint8_t* src_argb,
const uint8_t* src_argb1,
uint8_t* dst_argb,
int width);
void ARGBBlendRow_NEON(const uint8_t* src_argb, void ARGBBlendRow_NEON(const uint8_t* src_argb,
const uint8_t* src_argb1, const uint8_t* src_argb1,
uint8_t* dst_argb, uint8_t* dst_argb,
@ -5516,6 +5633,10 @@ void ARGBMultiplyRow_Any_AVX2(const uint8_t* y_buf,
const uint8_t* uv_buf, const uint8_t* uv_buf,
uint8_t* dst_ptr, uint8_t* dst_ptr,
int width); int width);
void ARGBMultiplyRow_AVX512BW(const uint8_t* src_argb,
const uint8_t* src_argb1,
uint8_t* dst_argb,
int width);
void ARGBMultiplyRow_NEON(const uint8_t* src_argb, void ARGBMultiplyRow_NEON(const uint8_t* src_argb,
const uint8_t* src_argb1, const uint8_t* src_argb1,
uint8_t* dst_argb, uint8_t* dst_argb,
@ -6386,16 +6507,26 @@ void SwapUVRow_SSSE3(const uint8_t* src_uv, uint8_t* dst_vu, int width);
void SwapUVRow_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int width); void SwapUVRow_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
void SwapUVRow_AVX2(const uint8_t* src_uv, uint8_t* dst_vu, int width); void SwapUVRow_AVX2(const uint8_t* src_uv, uint8_t* dst_vu, int width);
void SwapUVRow_Any_AVX2(const uint8_t* src_ptr, uint8_t* dst_ptr, int width); void SwapUVRow_Any_AVX2(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
void SwapUVRow_AVX512BW(const uint8_t* src_uv, uint8_t* dst_vu, int width);
void SwapUVRow_RVV(const uint8_t* src_uv, uint8_t* dst_vu, int width); void SwapUVRow_RVV(const uint8_t* src_uv, uint8_t* dst_vu, int width);
void AYUVToYRow_C(const uint8_t* src_ayuv, uint8_t* dst_y, int width); void AYUVToYRow_C(const uint8_t* src_ayuv, uint8_t* dst_y, int width);
void AYUVToYRow_AVX512VBMI(const uint8_t* src_ayuv, uint8_t* dst_y, int width);
void AYUVToUVRow_C(const uint8_t* src_ayuv, void AYUVToUVRow_C(const uint8_t* src_ayuv,
int src_stride_ayuv, int src_stride_ayuv,
uint8_t* dst_uv, uint8_t* dst_uv,
int width); int width);
void AYUVToUVRow_AVX512VBMI(const uint8_t* src_ayuv,
int src_stride_ayuv,
uint8_t* dst_uv,
int width);
void AYUVToVURow_C(const uint8_t* src_ayuv, void AYUVToVURow_C(const uint8_t* src_ayuv,
int src_stride_ayuv, int src_stride_ayuv,
uint8_t* dst_vu, uint8_t* dst_vu,
int width); int width);
void AYUVToVURow_AVX512VBMI(const uint8_t* src_ayuv,
int src_stride_ayuv,
uint8_t* dst_vu,
int width);
void AYUVToYRow_NEON(const uint8_t* src_ayuv, uint8_t* dst_y, int width); void AYUVToYRow_NEON(const uint8_t* src_ayuv, uint8_t* dst_y, int width);
void AYUVToUVRow_NEON(const uint8_t* src_ayuv, void AYUVToUVRow_NEON(const uint8_t* src_ayuv,
int src_stride_ayuv, int src_stride_ayuv,
@ -6550,6 +6681,9 @@ void ARGBAttenuateRow_SSSE3(const uint8_t* src_argb,
void ARGBAttenuateRow_AVX2(const uint8_t* src_argb, void ARGBAttenuateRow_AVX2(const uint8_t* src_argb,
uint8_t* dst_argb, uint8_t* dst_argb,
int width); int width);
void ARGBAttenuateRow_AVX512BW(const uint8_t* src_argb,
uint8_t* dst_argb,
int width);
void ARGBAttenuateRow_NEON(const uint8_t* src_argb, void ARGBAttenuateRow_NEON(const uint8_t* src_argb,
uint8_t* dst_argb, uint8_t* dst_argb,
int width); int width);
@ -6598,6 +6732,9 @@ void ARGBUnattenuateRow_Any_AVX2(const uint8_t* src_ptr,
void ARGBGrayRow_C(const uint8_t* src_argb, uint8_t* dst_argb, int width); void ARGBGrayRow_C(const uint8_t* src_argb, uint8_t* dst_argb, int width);
void ARGBGrayRow_SSSE3(const uint8_t* src_argb, uint8_t* dst_argb, int width); void ARGBGrayRow_SSSE3(const uint8_t* src_argb, uint8_t* dst_argb, int width);
void ARGBGrayRow_AVX512BW(const uint8_t* src_argb,
uint8_t* dst_argb,
int width);
void ARGBGrayRow_NEON(const uint8_t* src_argb, uint8_t* dst_argb, int width); void ARGBGrayRow_NEON(const uint8_t* src_argb, uint8_t* dst_argb, int width);
void ARGBGrayRow_NEON_DotProd(const uint8_t* src_argb, void ARGBGrayRow_NEON_DotProd(const uint8_t* src_argb,
uint8_t* dst_argb, uint8_t* dst_argb,
@ -6817,6 +6954,11 @@ void InterpolateRow_16_Any_AVX2(uint16_t* dst_ptr,
ptrdiff_t src_stride, ptrdiff_t src_stride,
int width, int width,
int source_y_fraction); int source_y_fraction);
void InterpolateRow_16_AVX512BW(uint16_t* dst_ptr,
const uint16_t* src_ptr,
ptrdiff_t src_stride,
int width,
int source_y_fraction);
void InterpolateRow_16_NEON(uint16_t* dst_ptr, void InterpolateRow_16_NEON(uint16_t* dst_ptr,
const uint16_t* src_ptr, const uint16_t* src_ptr,
ptrdiff_t src_stride, ptrdiff_t src_stride,

View File

@ -2646,6 +2646,12 @@ int AYUVToNV12(const uint8_t* src_ayuv,
} }
} }
#endif #endif
#if defined(HAS_AYUVTOYROW_AVX512VBMI)
if (TestCpuFlag(kCpuHasAVX512VBMI | kCpuHasAVX512VL)) {
AYUVToUVRow = AYUVToUVRow_AVX512VBMI;
AYUVToYRow = AYUVToYRow_AVX512VBMI;
}
#endif
#if defined(HAS_AYUVTOYROW_NEON) #if defined(HAS_AYUVTOYROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
@ -2726,6 +2732,12 @@ int AYUVToNV21(const uint8_t* src_ayuv,
} }
} }
#endif #endif
#if defined(HAS_AYUVTOYROW_AVX512VBMI)
if (TestCpuFlag(kCpuHasAVX512VBMI | kCpuHasAVX512VL)) {
AYUVToVURow = AYUVToVURow_AVX512VBMI;
AYUVToYRow = AYUVToYRow_AVX512VBMI;
}
#endif
#if defined(HAS_AYUVTOYROW_NEON) #if defined(HAS_AYUVTOYROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
@ -3343,6 +3355,245 @@ int RGBAToI420(const uint8_t* src_rgba,
&kRgbaI601Constants, width, height); &kRgbaI601Constants, width, height);
} }
static int AR30ToI420Matrix(const uint8_t* src_ar30,
int src_stride_ar30,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_u,
int dst_stride_u,
uint8_t* dst_v,
int dst_stride_v,
const struct ArgbConstants* argbconstants,
int width,
int height) {
int y;
void (*AR30ToARGBRow)(const uint8_t* src_ar30, uint8_t* dst_argb, int width) =
AR30ToARGBRow_C;
void (*ARGBToYMatrixRow)(const uint8_t* src_argb, uint8_t* dst_y, int width,
const struct ArgbConstants* c) = ARGBToYMatrixRow_C;
void (*ARGBToUVMatrixRow)(const uint8_t* src_argb, int src_stride_argb,
uint8_t* dst_u, uint8_t* dst_v, int width,
const struct ArgbConstants* c) =
ARGBToUVMatrixRow_C;
if (!src_ar30 || !dst_y || !dst_u || !dst_v || !argbconstants || width <= 0 ||
height == 0 || height == INT_MIN) {
return -1;
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
src_ar30 = src_ar30 + (ptrdiff_t)(height - 1) * src_stride_ar30;
src_stride_ar30 = -src_stride_ar30;
}
#if defined(HAS_AR30TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
AR30ToARGBRow = AR30ToARGBRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_SSSE3;
}
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_AVX2)
if (TestCpuFlag(kCpuHasAVX2)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_Any_AVX2;
if (IS_ALIGNED(width, 32)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_AVX2;
}
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_Any_AVX512BW;
if (IS_ALIGNED(width, 64)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_AVX512BW;
}
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_Any_NEON;
if (IS_ALIGNED(width, 16)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_NEON;
}
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_NEON_DOTPROD)
if (TestCpuFlag(kCpuHasNeonDotProd)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_Any_NEON_DotProd;
if (IS_ALIGNED(width, 16)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_NEON_DotProd;
}
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_SVE2)
if (TestCpuFlag(kCpuHasSVE2)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_SVE2;
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_SME)
if (TestCpuFlag(kCpuHasSME)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_SME;
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_LSX)
if (TestCpuFlag(kCpuHasLSX)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_Any_LSX;
if (IS_ALIGNED(width, 16)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_LSX;
}
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_LASX)
if (TestCpuFlag(kCpuHasLASX)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_Any_LASX;
if (IS_ALIGNED(width, 32)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_LASX;
}
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_RVV)
if (TestCpuFlag(kCpuHasRVV)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_RVV;
}
#endif
#if defined(HAS_ARGBTOYMATRIXROW_WASMSIMD)
if (TestCpuFlag(kCpuHasWASMSIMD)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_Any_WASMSIMD;
if (IS_ALIGNED(width, 16)) {
ARGBToYMatrixRow = ARGBToYMatrixRow_WASMSIMD;
}
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_Any_SSSE3;
if (IS_ALIGNED(width, 16)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_SSSE3;
}
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_AVX2)
if (TestCpuFlag(kCpuHasAVX2)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_Any_AVX2;
if (IS_ALIGNED(width, 32)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_AVX2;
}
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_Any_NEON;
if (IS_ALIGNED(width, 16)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_NEON;
}
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_NEON_I8MM)
if (TestCpuFlag(kCpuHasNeonI8MM)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_Any_NEON_I8MM;
if (IS_ALIGNED(width, 16)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_NEON_I8MM;
}
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_SVE2)
if (TestCpuFlag(kCpuHasSVE2)) {
if (IS_ALIGNED(width, 2)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_SVE2;
}
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_SME)
if (TestCpuFlag(kCpuHasSME)) {
if (IS_ALIGNED(width, 2)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_SME;
}
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_RVV)
if (TestCpuFlag(kCpuHasRVV)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_RVV;
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_WASMSIMD)
if (TestCpuFlag(kCpuHasWASMSIMD)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_Any_WASMSIMD;
if (IS_ALIGNED(width, 16)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_WASMSIMD;
}
}
#endif
int row_stride = width * 4;
align_buffer_64(row, row_stride * 2);
if (!row) {
return -1;
}
for (y = 0; y < height - 1; y += 2) {
AR30ToARGBRow(src_ar30, row, width);
AR30ToARGBRow(src_ar30 + src_stride_ar30, row + row_stride, width);
ARGBToUVMatrixRow(row, row_stride, dst_u, dst_v, width, argbconstants);
ARGBToYMatrixRow(row, dst_y, width, argbconstants);
ARGBToYMatrixRow(row + row_stride, dst_y + dst_stride_y, width,
argbconstants);
src_ar30 += src_stride_ar30 * 2;
dst_y += dst_stride_y * 2;
dst_u += dst_stride_u;
dst_v += dst_stride_v;
}
if (height & 1) {
AR30ToARGBRow(src_ar30, row, width);
ARGBToUVMatrixRow(row, 0, dst_u, dst_v, width, argbconstants);
ARGBToYMatrixRow(row, dst_y, width, argbconstants);
}
free_aligned_buffer_64(row);
return 0;
}
// Convert AR30 to I420.
LIBYUV_API
int AR30ToI420(const uint8_t* src_ar30,
int src_stride_ar30,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_u,
int dst_stride_u,
uint8_t* dst_v,
int dst_stride_v,
int width,
int height) {
return AR30ToI420Matrix(src_ar30, src_stride_ar30, dst_y, dst_stride_y, dst_u,
dst_stride_u, dst_v, dst_stride_v,
&kArgbI601Constants, width, height);
}
// Convert AB30 to I420.
LIBYUV_API
int AB30ToI420(const uint8_t* src_ab30,
int src_stride_ab30,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_u,
int dst_stride_u,
uint8_t* dst_v,
int dst_stride_v,
int width,
int height) {
return AR30ToI420Matrix(src_ab30, src_stride_ab30, dst_y, dst_stride_y, dst_u,
dst_stride_u, dst_v, dst_stride_v,
&kAbgrI601Constants, width, height);
}
// Enabled if 1 pass is available // Enabled if 1 pass is available
#if (defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_LSX) || \ #if (defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_LSX) || \
defined(HAS_RGB24TOYROW_RVV)) defined(HAS_RGB24TOYROW_RVV))

View File

@ -619,6 +619,14 @@ int I444ToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_I444TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
I444ToARGBRow = I444ToARGBRow_Any_AVX512BW;
if (IS_ALIGNED(width, 32)) {
I444ToARGBRow = I444ToARGBRow_AVX512BW;
}
}
#endif
#if defined(HAS_I444TOARGBROW_NEON) #if defined(HAS_I444TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
I444ToARGBRow = I444ToARGBRow_Any_NEON; I444ToARGBRow = I444ToARGBRow_Any_NEON;
@ -2429,6 +2437,11 @@ int I420AlphaToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_I422ALPHATOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
I422AlphaToARGBRow = I422AlphaToARGBRow_AVX512BW;
}
#endif
#if defined(HAS_I422ALPHATOARGBROW_NEON) #if defined(HAS_I422ALPHATOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_NEON; I422AlphaToARGBRow = I422AlphaToARGBRow_Any_NEON;
@ -2484,6 +2497,11 @@ int I420AlphaToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -2591,6 +2609,11 @@ int I422AlphaToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_I422ALPHATOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
I422AlphaToARGBRow = I422AlphaToARGBRow_AVX512BW;
}
#endif
#if defined(HAS_I422ALPHATOARGBROW_NEON) #if defined(HAS_I422ALPHATOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
I422AlphaToARGBRow = I422AlphaToARGBRow_Any_NEON; I422AlphaToARGBRow = I422AlphaToARGBRow_Any_NEON;
@ -2646,6 +2669,11 @@ int I422AlphaToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -2790,6 +2818,11 @@ int I444AlphaToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -3049,6 +3082,11 @@ int I010AlphaToARGBMatrix(const uint16_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -3181,6 +3219,11 @@ int I210AlphaToARGBMatrix(const uint16_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -3311,6 +3354,11 @@ int I410AlphaToARGBMatrix(const uint16_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -3402,6 +3450,11 @@ int I400ToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_I400TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
I400ToARGBRow = I400ToARGBRow_AVX512BW;
}
#endif
#if defined(HAS_I400TOARGBROW_NEON) #if defined(HAS_I400TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
I400ToARGBRow = I400ToARGBRow_Any_NEON; I400ToARGBRow = I400ToARGBRow_Any_NEON;
@ -4055,6 +4108,11 @@ int RAWToRGBA(const uint8_t* src_raw,
} }
} }
#endif #endif
#if defined(HAS_RAWTORGBAROW_AVX512VBMI)
if (TestCpuFlag(kCpuHasAVX512VBMI | kCpuHasAVX512VL)) {
RAWToRGBARow = RAWToRGBARow_AVX512VBMI;
}
#endif
#if defined(HAS_RAWTORGBAROW_NEON) #if defined(HAS_RAWTORGBAROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
RAWToRGBARow = RAWToRGBARow_Any_NEON; RAWToRGBARow = RAWToRGBARow_Any_NEON;
@ -4347,8 +4405,15 @@ int AR30ToARGB(const uint8_t* src_ar30,
height = 1; height = 1;
src_stride_ar30 = dst_stride_argb = 0; src_stride_ar30 = dst_stride_argb = 0;
} }
void (*AR30ToARGBRow)(const uint8_t* src_ar30, uint8_t* dst_argb, int width) =
AR30ToARGBRow_C;
#if defined(HAS_AR30TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
AR30ToARGBRow = AR30ToARGBRow_AVX512BW;
}
#endif
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
AR30ToARGBRow_C(src_ar30, dst_argb, width); AR30ToARGBRow(src_ar30, dst_argb, width);
src_ar30 += src_stride_ar30; src_ar30 += src_stride_ar30;
dst_argb += dst_stride_argb; dst_argb += dst_stride_argb;
} }
@ -4364,6 +4429,8 @@ int AR30ToABGR(const uint8_t* src_ar30,
int width, int width,
int height) { int height) {
int y; int y;
void (*AR30ToABGRRow)(const uint8_t* src_ar30, uint8_t* dst_abgr, int width) =
AR30ToABGRRow_C;
if (!src_ar30 || !dst_abgr || width <= 0 || height == 0 || if (!src_ar30 || !dst_abgr || width <= 0 || height == 0 ||
height == INT_MIN) { height == INT_MIN) {
return -1; return -1;
@ -4381,8 +4448,13 @@ int AR30ToABGR(const uint8_t* src_ar30,
height = 1; height = 1;
src_stride_ar30 = dst_stride_abgr = 0; src_stride_ar30 = dst_stride_abgr = 0;
} }
#if defined(HAS_AR30TOABGRROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
AR30ToABGRRow = AR30ToABGRRow_AVX512BW;
}
#endif
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
AR30ToABGRRow_C(src_ar30, dst_abgr, width); AR30ToABGRRow(src_ar30, dst_abgr, width);
src_ar30 += src_stride_ar30; src_ar30 += src_stride_ar30;
dst_abgr += dst_stride_abgr; dst_abgr += dst_stride_abgr;
} }
@ -4398,6 +4470,8 @@ int AR30ToAB30(const uint8_t* src_ar30,
int width, int width,
int height) { int height) {
int y; int y;
void (*AR30ToAB30Row)(const uint8_t* src_ar30, uint8_t* dst_ab30, int width) =
AR30ToAB30Row_C;
if (!src_ar30 || !dst_ab30 || width <= 0 || height == 0 || if (!src_ar30 || !dst_ab30 || width <= 0 || height == 0 ||
height == INT_MIN) { height == INT_MIN) {
return -1; return -1;
@ -4415,8 +4489,13 @@ int AR30ToAB30(const uint8_t* src_ar30,
height = 1; height = 1;
src_stride_ar30 = dst_stride_ab30 = 0; src_stride_ar30 = dst_stride_ab30 = 0;
} }
#if defined(HAS_AR30TOAB30ROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
AR30ToAB30Row = AR30ToAB30Row_AVX512BW;
}
#endif
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
AR30ToAB30Row_C(src_ar30, dst_ab30, width); AR30ToAB30Row(src_ar30, dst_ab30, width);
src_ar30 += src_stride_ar30; src_ar30 += src_stride_ar30;
dst_ab30 += dst_stride_ab30; dst_ab30 += dst_stride_ab30;
} }
@ -4597,6 +4676,11 @@ int NV12ToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_NV12TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
NV12ToARGBRow = NV12ToARGBRow_AVX512BW;
}
#endif
#if defined(HAS_NV12TOARGBROW_NEON) #if defined(HAS_NV12TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
NV12ToARGBRow = NV12ToARGBRow_Any_NEON; NV12ToARGBRow = NV12ToARGBRow_Any_NEON;
@ -4698,6 +4782,11 @@ int NV21ToARGBMatrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_NV21TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
NV21ToARGBRow = NV21ToARGBRow_AVX512BW;
}
#endif
#if defined(HAS_NV21TOARGBROW_NEON) #if defined(HAS_NV21TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
NV21ToARGBRow = NV21ToARGBRow_Any_NEON; NV21ToARGBRow = NV21ToARGBRow_Any_NEON;
@ -4876,6 +4965,11 @@ int NV12ToRGB24Matrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_NV12TORGB24ROW_AVX512VBMI)
if (TestCpuFlag(kCpuHasAVX512VBMI | kCpuHasAVX512VL)) {
NV12ToRGB24Row = NV12ToRGB24Row_AVX512VBMI;
}
#endif
#if defined(HAS_NV12TORGB24ROW_RVV) #if defined(HAS_NV12TORGB24ROW_RVV)
if (TestCpuFlag(kCpuHasRVV)) { if (TestCpuFlag(kCpuHasRVV)) {
NV12ToRGB24Row = NV12ToRGB24Row_RVV; NV12ToRGB24Row = NV12ToRGB24Row_RVV;
@ -4953,6 +5047,11 @@ int NV21ToRGB24Matrix(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_NV21TORGB24ROW_AVX512VBMI)
if (TestCpuFlag(kCpuHasAVX512VBMI | kCpuHasAVX512VL)) {
NV21ToRGB24Row = NV21ToRGB24Row_AVX512VBMI;
}
#endif
#if defined(HAS_NV21TORGB24ROW_RVV) #if defined(HAS_NV21TORGB24ROW_RVV)
if (TestCpuFlag(kCpuHasRVV)) { if (TestCpuFlag(kCpuHasRVV)) {
NV21ToRGB24Row = NV21ToRGB24Row_RVV; NV21ToRGB24Row = NV21ToRGB24Row_RVV;
@ -7013,6 +7112,14 @@ static int I420ToARGBMatrixBilinear(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_I444TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
I444ToARGBRow = I444ToARGBRow_Any_AVX512BW;
if (IS_ALIGNED(width, 32)) {
I444ToARGBRow = I444ToARGBRow_AVX512BW;
}
}
#endif
#if defined(HAS_I444TOARGBROW_NEON) #if defined(HAS_I444TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
I444ToARGBRow = I444ToARGBRow_Any_NEON; I444ToARGBRow = I444ToARGBRow_Any_NEON;
@ -7163,6 +7270,14 @@ static int I422ToARGBMatrixLinear(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_I444TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
I444ToARGBRow = I444ToARGBRow_Any_AVX512BW;
if (IS_ALIGNED(width, 32)) {
I444ToARGBRow = I444ToARGBRow_AVX512BW;
}
}
#endif
#if defined(HAS_I444TOARGBROW_NEON) #if defined(HAS_I444TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
I444ToARGBRow = I444ToARGBRow_Any_NEON; I444ToARGBRow = I444ToARGBRow_Any_NEON;
@ -7955,6 +8070,11 @@ static int I420AlphaToARGBMatrixBilinear(
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -8175,6 +8295,11 @@ static int I422AlphaToARGBMatrixLinear(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -8347,6 +8472,11 @@ static int I010AlphaToARGBMatrixBilinear(
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -8541,6 +8671,11 @@ static int I210AlphaToARGBMatrixLinear(const uint16_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;

View File

@ -577,6 +577,11 @@ int ARGBToNV12Matrix(const uint8_t* src_argb,
} }
} }
#endif #endif
#if defined(HAS_ARGBTOUVMATRIXROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_RVV) #if defined(HAS_ARGBTOUVMATRIXROW_RVV)
if (TestCpuFlag(kCpuHasRVV)) { if (TestCpuFlag(kCpuHasRVV)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_RVV; ARGBToUVMatrixRow = ARGBToUVMatrixRow_RVV;
@ -1374,6 +1379,11 @@ int ARGBToNV21Matrix(const uint8_t* src_argb,
} }
} }
#endif #endif
#if defined(HAS_ARGBTOUVMATRIXROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBTOUVMATRIXROW_RVV) #if defined(HAS_ARGBTOUVMATRIXROW_RVV)
if (TestCpuFlag(kCpuHasRVV)) { if (TestCpuFlag(kCpuHasRVV)) {
ARGBToUVMatrixRow = ARGBToUVMatrixRow_RVV; ARGBToUVMatrixRow = ARGBToUVMatrixRow_RVV;
@ -3747,6 +3757,11 @@ int ABGRToAR30(const uint8_t* src_abgr,
ABGRToAR30Row = ABGRToAR30Row_AVX2; ABGRToAR30Row = ABGRToAR30Row_AVX2;
} }
} }
#endif
#if defined(HAS_ABGRTOAR30ROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ABGRToAR30Row = ABGRToAR30Row_AVX512BW;
}
#endif #endif
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
ABGRToAR30Row(src_abgr, dst_ar30, width); ABGRToAR30Row(src_abgr, dst_ar30, width);
@ -3806,6 +3821,11 @@ int ARGBToAR30(const uint8_t* src_argb,
ARGBToAR30Row = ARGBToAR30Row_AVX2; ARGBToAR30Row = ARGBToAR30Row_AVX2;
} }
} }
#endif
#if defined(HAS_ARGBTOAR30ROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBToAR30Row = ARGBToAR30Row_AVX512BW;
}
#endif #endif
for (y = 0; y < height; ++y) { for (y = 0; y < height; ++y) {
ARGBToAR30Row(src_argb, dst_ar30, width); ARGBToAR30Row(src_argb, dst_ar30, width);

View File

@ -65,6 +65,11 @@ static int NV16ToARGB(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_NV12TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
NV12ToARGBRow = NV12ToARGBRow_AVX512BW;
}
#endif
#if defined(HAS_NV12TOARGBROW_NEON) #if defined(HAS_NV12TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
NV12ToARGBRow = NV12ToARGBRow_Any_NEON; NV12ToARGBRow = NV12ToARGBRow_Any_NEON;
@ -162,6 +167,14 @@ static int NV24ToARGB(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_I444TOARGBROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
I444ToARGBRow = I444ToARGBRow_Any_AVX512BW;
if (IS_ALIGNED(width, 32)) {
I444ToARGBRow = I444ToARGBRow_AVX512BW;
}
}
#endif
#if defined(HAS_I444TOARGBROW_NEON) #if defined(HAS_I444TOARGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
I444ToARGBRow = I444ToARGBRow_Any_NEON; I444ToARGBRow = I444ToARGBRow_Any_NEON;
@ -218,6 +231,14 @@ static int NV24ToARGB(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_SPLITUVROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
SplitUVRow = SplitUVRow_Any_AVX512BW;
if (IS_ALIGNED(width, 64)) {
SplitUVRow = SplitUVRow_AVX512BW;
}
}
#endif
#if defined(HAS_SPLITUVROW_NEON) #if defined(HAS_SPLITUVROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
SplitUVRow = SplitUVRow_Any_NEON; SplitUVRow = SplitUVRow_Any_NEON;

View File

@ -84,6 +84,14 @@ static int NV16ToI420(const uint8_t* src_y,
} }
} }
#endif #endif
#if defined(HAS_SPLITUVROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
SplitUVRow = SplitUVRow_Any_AVX512BW;
if (IS_ALIGNED(halfwidth, 64)) {
SplitUVRow = SplitUVRow_AVX512BW;
}
}
#endif
#if defined(HAS_SPLITUVROW_NEON) #if defined(HAS_SPLITUVROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
SplitUVRow = SplitUVRow_Any_NEON; SplitUVRow = SplitUVRow_Any_NEON;
@ -331,7 +339,18 @@ int ConvertToI420(const uint8_t* sample,
dst_stride_u, dst_v, dst_stride_v, crop_width, dst_stride_u, dst_v, dst_stride_v, crop_width,
inv_crop_height); inv_crop_height);
break; break;
// TODO(fbarchard): Add AR30 and AB30 case FOURCC_AR30:
src = sample + ((ptrdiff_t)src_width * crop_y + crop_x) * 4;
r = AR30ToI420(src, src_width * 4, dst_y, dst_stride_y, dst_u,
dst_stride_u, dst_v, dst_stride_v, crop_width,
inv_crop_height);
break;
case FOURCC_AB30:
src = sample + ((ptrdiff_t)src_width * crop_y + crop_x) * 4;
r = AB30ToI420(src, src_width * 4, dst_y, dst_stride_y, dst_u,
dst_stride_u, dst_v, dst_stride_v, crop_width,
inv_crop_height);
break;
case FOURCC_I400: case FOURCC_I400:
src = sample + (ptrdiff_t)src_width * crop_y + crop_x; src = sample + (ptrdiff_t)src_width * crop_y + crop_x;
r = I400ToI420(src, src_width, dst_y, dst_stride_y, dst_u, dst_stride_u, r = I400ToI420(src, src_width, dst_y, dst_stride_y, dst_u, dst_stride_u,

View File

@ -1127,6 +1127,11 @@ void SwapUVPlane(const uint8_t* src_uv,
} }
} }
#endif #endif
#if defined(HAS_SWAPUVROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
SwapUVRow = SwapUVRow_AVX512BW;
}
#endif
#if defined(HAS_SWAPUVROW_NEON) #if defined(HAS_SWAPUVROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
SwapUVRow = SwapUVRow_Any_NEON; SwapUVRow = SwapUVRow_Any_NEON;
@ -1573,6 +1578,11 @@ void MergeRGBPlane(const uint8_t* src_r,
} }
} }
#endif #endif
#if defined(HAS_MERGERGBROW_AVX512VBMI)
if (TestCpuFlag(kCpuHasAVX512VBMI | kCpuHasAVX512VL)) {
MergeRGBRow = MergeRGBRow_AVX512VBMI;
}
#endif
#if defined(HAS_MERGERGBROW_NEON) #if defined(HAS_MERGERGBROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
MergeRGBRow = MergeRGBRow_Any_NEON; MergeRGBRow = MergeRGBRow_Any_NEON;
@ -2003,6 +2013,11 @@ void MergeXR30Plane(const uint16_t* src_r,
} }
} }
#endif #endif
#if defined(HAS_MERGEXR30ROW_10_AVX512BW)
if (depth == 10 && TestCpuFlag(kCpuHasAVX512BW | kCpuHasAVX512VL)) {
MergeXR30Row = MergeXR30Row_10_AVX512BW;
}
#endif
#if defined(HAS_MERGEXR30ROW_NEON) #if defined(HAS_MERGEXR30ROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
if (depth == 10) { if (depth == 10) {
@ -2755,6 +2770,112 @@ void MirrorPlane(const uint8_t* src_y,
} }
} }
// Mirror a plane of 16-bit data.
LIBYUV_API
void MirrorPlane_16(const uint16_t* src_y,
int src_stride_y,
uint16_t* dst_y,
int dst_stride_y,
int width,
int height) {
int y;
void (*MirrorRow_16)(const uint16_t* src, uint16_t* dst, int width) =
MirrorRow_16_C;
if (width <= 0 || height == 0 || height == INT_MIN) {
return;
}
// Negative height means invert the image.
if (height < 0) {
height = -height;
src_y = src_y + (ptrdiff_t)(height - 1) * src_stride_y;
src_stride_y = -src_stride_y;
}
#if defined(HAS_MIRRORUVROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) {
MirrorRow_16 = reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_Any_NEON);
if (IS_ALIGNED(width, 32)) {
MirrorRow_16 =
reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_NEON);
}
}
#endif
#if defined(HAS_MIRRORUVROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) {
MirrorRow_16 = reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_Any_SSSE3);
if (IS_ALIGNED(width, 8)) {
MirrorRow_16 =
reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_SSSE3);
}
}
#endif
#if defined(HAS_MIRRORUVROW_AVX2)
if (TestCpuFlag(kCpuHasAVX2)) {
MirrorRow_16 = reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_Any_AVX2);
if (IS_ALIGNED(width, 16)) {
MirrorRow_16 =
reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_AVX2);
}
}
#endif
#if defined(HAS_MIRRORROW_16_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
MirrorRow_16 = MirrorRow_16_AVX512BW;
}
#endif
#if defined(HAS_MIRRORUVROW_LSX)
if (TestCpuFlag(kCpuHasLSX)) {
MirrorRow_16 = reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_Any_LSX);
if (IS_ALIGNED(width, 8)) {
MirrorRow_16 =
reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_LSX);
}
}
#endif
#if defined(HAS_MIRRORUVROW_LASX)
if (TestCpuFlag(kCpuHasLASX)) {
MirrorRow_16 = reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_Any_LASX);
if (IS_ALIGNED(width, 16)) {
MirrorRow_16 =
reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_LASX);
}
}
#endif
#if defined(HAS_MIRRORUVROW_RVV)
if (TestCpuFlag(kCpuHasRVV)) {
MirrorRow_16 = reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_RVV);
}
#endif
#if defined(HAS_MIRRORUVROW_WASMSIMD)
if (TestCpuFlag(kCpuHasWASMSIMD)) {
MirrorRow_16 = reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_Any_WASMSIMD);
if (IS_ALIGNED(width, 8)) {
MirrorRow_16 =
reinterpret_cast<void (*)(const uint16_t*, uint16_t*, int)>(
MirrorUVRow_WASMSIMD);
}
}
#endif
// Mirror plane
for (y = 0; y < height; ++y) {
MirrorRow_16(src_y, dst_y, width);
src_y += src_stride_y;
dst_y += dst_stride_y;
}
}
// Mirror a plane of UV data. // Mirror a plane of UV data.
LIBYUV_API LIBYUV_API
void MirrorUVPlane(const uint8_t* src_uv, void MirrorUVPlane(const uint8_t* src_uv,
@ -2799,7 +2920,12 @@ void MirrorUVPlane(const uint8_t* src_uv,
} }
} }
#endif #endif
#if defined(HAS_MIRRORUVROW_AVX512BW) #if defined(HAS_MIRRORROW_16_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
MirrorUVRow = reinterpret_cast<void (*)(const uint8_t*, uint8_t*, int)>(
MirrorRow_16_AVX512BW);
}
#elif defined(HAS_MIRRORUVROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) { if (TestCpuFlag(kCpuHasAVX512BW)) {
MirrorUVRow = MirrorUVRow_Any_AVX512BW; MirrorUVRow = MirrorUVRow_Any_AVX512BW;
if (IS_ALIGNED(width, 32)) { if (IS_ALIGNED(width, 32)) {
@ -3133,6 +3259,11 @@ int ARGBBlend(const uint8_t* src_argb0,
ARGBBlendRow = ARGBBlendRow_SSSE3; ARGBBlendRow = ARGBBlendRow_SSSE3;
} }
#endif #endif
#if defined(HAS_ARGBBLENDROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBBlendRow = ARGBBlendRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBBLENDROW_NEON) #if defined(HAS_ARGBBLENDROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBBlendRow = ARGBBlendRow_NEON; ARGBBlendRow = ARGBBlendRow_NEON;
@ -3479,6 +3610,11 @@ int ARGBMultiply(const uint8_t* src_argb0,
} }
} }
#endif #endif
#if defined(HAS_ARGBMULTIPLYROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBMultiplyRow = ARGBMultiplyRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBMULTIPLYROW_NEON) #if defined(HAS_ARGBMULTIPLYROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBMultiplyRow = ARGBMultiplyRow_Any_NEON; ARGBMultiplyRow = ARGBMultiplyRow_Any_NEON;
@ -4010,6 +4146,11 @@ int ARGBAttenuate(const uint8_t* src_argb,
} }
} }
#endif #endif
#if defined(HAS_ARGBATTENUATEROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBAttenuateRow = ARGBAttenuateRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBATTENUATEROW_NEON) #if defined(HAS_ARGBATTENUATEROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
@ -4133,6 +4274,11 @@ int ARGBGrayTo(const uint8_t* src_argb,
ARGBGrayRow = ARGBGrayRow_SSSE3; ARGBGrayRow = ARGBGrayRow_SSSE3;
} }
#endif #endif
#if defined(HAS_ARGBGRAYROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBGrayRow = ARGBGrayRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBGRAYROW_NEON) #if defined(HAS_ARGBGRAYROW_NEON)
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
ARGBGrayRow = ARGBGrayRow_NEON; ARGBGrayRow = ARGBGrayRow_NEON;
@ -4188,6 +4334,11 @@ int ARGBGray(uint8_t* dst_argb,
ARGBGrayRow = ARGBGrayRow_SSSE3; ARGBGrayRow = ARGBGrayRow_SSSE3;
} }
#endif #endif
#if defined(HAS_ARGBGRAYROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
ARGBGrayRow = ARGBGrayRow_AVX512BW;
}
#endif
#if defined(HAS_ARGBGRAYROW_NEON) #if defined(HAS_ARGBGRAYROW_NEON)
if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
ARGBGrayRow = ARGBGrayRow_NEON; ARGBGrayRow = ARGBGrayRow_NEON;
@ -4859,6 +5010,11 @@ int InterpolatePlane_16(const uint16_t* src0,
} }
} }
#endif #endif
#if defined(HAS_INTERPOLATEROW_16_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
InterpolateRow_16 = InterpolateRow_16_AVX512BW;
}
#endif
#if defined(HAS_INTERPOLATEROW_16_NEON) #if defined(HAS_INTERPOLATEROW_16_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
InterpolateRow_16 = InterpolateRow_16_Any_NEON; InterpolateRow_16 = InterpolateRow_16_Any_NEON;
@ -6049,6 +6205,14 @@ int UYVYToNV12(const uint8_t* src_uyvy,
} }
} }
#endif #endif
#if defined(HAS_SPLITUVROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
SplitUVRow = SplitUVRow_Any_AVX512BW;
if (IS_ALIGNED(width, 64)) {
SplitUVRow = SplitUVRow_AVX512BW;
}
}
#endif
#if defined(HAS_SPLITUVROW_NEON) #if defined(HAS_SPLITUVROW_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
SplitUVRow = SplitUVRow_Any_NEON; SplitUVRow = SplitUVRow_Any_NEON;
@ -6206,6 +6370,11 @@ void HalfMergeUVPlane(const uint8_t* src_u,
HalfMergeUVRow = HalfMergeUVRow_AVX2; HalfMergeUVRow = HalfMergeUVRow_AVX2;
} }
#endif #endif
#if defined(HAS_HALFMERGEUVROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
HalfMergeUVRow = HalfMergeUVRow_AVX512BW;
}
#endif
for (y = 0; y < height - 1; y += 2) { for (y = 0; y < height - 1; y += 2) {
// Merge a row of U and V into a row of UV. // Merge a row of U and V into a row of UV.

View File

@ -222,6 +222,14 @@ void RotatePlane180(const uint8_t* src,
} }
} }
#endif #endif
#if defined(HAS_MIRRORROW_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
MirrorRow = MirrorRow_Any_AVX512BW;
if (IS_ALIGNED(width, 64)) {
MirrorRow = MirrorRow_AVX512BW;
}
}
#endif
#if defined(HAS_MIRRORROW_LSX) #if defined(HAS_MIRRORROW_LSX)
if (TestCpuFlag(kCpuHasLSX)) { if (TestCpuFlag(kCpuHasLSX)) {
MirrorRow = MirrorRow_Any_LSX; MirrorRow = MirrorRow_Any_LSX;
@ -768,8 +776,7 @@ static void RotatePlane180_16(const uint16_t* src,
int width, int width,
int height) { int height) {
// Rotate by 180 is a vertical flip (negative height) and horizontal mirror. // Rotate by 180 is a vertical flip (negative height) and horizontal mirror.
MirrorUVPlane((const uint8_t*)src, src_stride * 2, (uint8_t*)dst, MirrorPlane_16(src, src_stride, dst, dst_stride, width, -height);
dst_stride * 2, width, -height);
} }
LIBYUV_API LIBYUV_API

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1275,6 +1275,11 @@ static int ScalePlaneBilinearDown_16(int src_width,
} }
} }
#endif #endif
#if defined(HAS_INTERPOLATEROW_16_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
InterpolateRow = InterpolateRow_16_AVX512BW;
}
#endif
#if defined(HAS_INTERPOLATEROW_16_NEON) #if defined(HAS_INTERPOLATEROW_16_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
InterpolateRow = InterpolateRow_16_Any_NEON; InterpolateRow = InterpolateRow_16_Any_NEON;
@ -1894,6 +1899,11 @@ static int ScalePlaneBilinearUp_16(int src_width,
} }
} }
#endif #endif
#if defined(HAS_INTERPOLATEROW_16_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
InterpolateRow = InterpolateRow_16_AVX512BW;
}
#endif
#if defined(HAS_INTERPOLATEROW_16_NEON) #if defined(HAS_INTERPOLATEROW_16_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
InterpolateRow = InterpolateRow_16_Any_NEON; InterpolateRow = InterpolateRow_16_Any_NEON;

View File

@ -1523,6 +1523,11 @@ void ScalePlaneVertical_16(int src_height,
} }
} }
#endif #endif
#if defined(HAS_INTERPOLATEROW_16_AVX512BW)
if (TestCpuFlag(kCpuHasAVX512BW)) {
InterpolateRow = InterpolateRow_16_AVX512BW;
}
#endif
#if defined(HAS_INTERPOLATEROW_16_NEON) #if defined(HAS_INTERPOLATEROW_16_NEON)
if (TestCpuFlag(kCpuHasNEON)) { if (TestCpuFlag(kCpuHasNEON)) {
InterpolateRow = InterpolateRow_16_Any_NEON; InterpolateRow = InterpolateRow_16_Any_NEON;

View File

@ -880,6 +880,8 @@ TESTATOPLANAR(RAW, 3, 1, J444, 1, 1)
TESTATOPLANAR(RGB24, 3, 1, I420, 2, 2) TESTATOPLANAR(RGB24, 3, 1, I420, 2, 2)
TESTATOPLANAR(RGB24, 3, 1, J420, 2, 2) TESTATOPLANAR(RGB24, 3, 1, J420, 2, 2)
TESTATOPLANAR(RGBA, 4, 1, I420, 2, 2) TESTATOPLANAR(RGBA, 4, 1, I420, 2, 2)
TESTATOPLANAR(AR30, 4, 1, I420, 2, 2)
TESTATOPLANAR(AB30, 4, 1, I420, 2, 2)
TESTATOPLANAR(UYVY, 2, 1, I420, 2, 2) TESTATOPLANAR(UYVY, 2, 1, I420, 2, 2)
TESTATOPLANAR(UYVY, 2, 1, I422, 2, 1) TESTATOPLANAR(UYVY, 2, 1, I422, 2, 1)
TESTATOPLANAR(YUY2, 2, 1, I420, 2, 2) TESTATOPLANAR(YUY2, 2, 1, I420, 2, 2)

View File

@ -855,6 +855,34 @@ TEST_F(LibYUVPlanarTest, ARGBMirror_Opt) {
free_aligned_buffer_page_end(dst_pixels_c); free_aligned_buffer_page_end(dst_pixels_c);
} }
TEST_F(LibYUVPlanarTest, MirrorPlane_16_Opt) {
align_buffer_page_end(src_pixels_8, benchmark_width_ * benchmark_height_ * 2);
align_buffer_page_end(dst_pixels_opt_8,
benchmark_width_ * benchmark_height_ * 2);
align_buffer_page_end(dst_pixels_c_8,
benchmark_width_ * benchmark_height_ * 2);
uint16_t* src_pixels = reinterpret_cast<uint16_t*>(src_pixels_8);
uint16_t* dst_pixels_opt = reinterpret_cast<uint16_t*>(dst_pixels_opt_8);
uint16_t* dst_pixels_c = reinterpret_cast<uint16_t*>(dst_pixels_c_8);
MemRandomize(src_pixels_8, benchmark_width_ * benchmark_height_ * 2);
MaskCpuFlags(disable_cpu_flags_);
MirrorPlane_16(src_pixels, benchmark_width_, dst_pixels_c, benchmark_width_,
benchmark_width_, benchmark_height_);
MaskCpuFlags(benchmark_cpu_info_);
for (int i = 0; i < benchmark_iterations_; ++i) {
MirrorPlane_16(src_pixels, benchmark_width_, dst_pixels_opt,
benchmark_width_, benchmark_width_, benchmark_height_);
}
for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) {
EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]);
}
free_aligned_buffer_page_end(src_pixels_8);
free_aligned_buffer_page_end(dst_pixels_opt_8);
free_aligned_buffer_page_end(dst_pixels_c_8);
}
TEST_F(LibYUVPlanarTest, MirrorPlane_Opt) { TEST_F(LibYUVPlanarTest, MirrorPlane_Opt) {
align_buffer_page_end(src_pixels, benchmark_width_ * benchmark_height_); align_buffer_page_end(src_pixels, benchmark_width_ * benchmark_height_);
align_buffer_page_end(dst_pixels_opt, benchmark_width_ * benchmark_height_); align_buffer_page_end(dst_pixels_opt, benchmark_width_ * benchmark_height_);