From 1dcbc3055352a7fe4eb5d35b183f7cb6d1938b98 Mon Sep 17 00:00:00 2001 From: Bruce Lai Date: Thu, 14 Sep 2023 19:03:02 -0700 Subject: [PATCH] Add HAS_SCALEARGBROWDOWNEVEN_RVV marco and disable it by default HAS_SCALEARGBROWDOWNEVEN_RVV wasn't defined, so we cannot use ScaleARGBRowDownEven_RVV & ScaleARGBRowDownEvenBox_RVV. - Seperate to two conditional statements when selecting DownEven or DownEvenBox. - Also, add HAS_SCALEARGBROWDOWNEVEN_RVV and disable it by default. Bug: libyuv:965 Signed-off-by: Bruce Lai Change-Id: Ic7ec40520b64131a456c6f3eea0639b3620f11ae Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4882441 Commit-Queue: Frank Barchard Reviewed-by: Frank Barchard --- include/libyuv/scale_row.h | 1 + source/scale_argb.cc | 10 +++++++--- source/scale_rvv.cc | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/libyuv/scale_row.h b/include/libyuv/scale_row.h index c015d772d..91bcbbc1b 100644 --- a/include/libyuv/scale_row.h +++ b/include/libyuv/scale_row.h @@ -180,6 +180,7 @@ extern "C" { #if !defined(LIBYUV_DISABLE_RVV) && defined(__riscv_vector) #define HAS_SCALEADDROW_RVV +// #define HAS_SCALEARGBROWDOWNEVEN_RVV #define HAS_SCALEUVROWDOWN4_RVV #define HAS_SCALEUVROWDOWNEVEN_RVV #if __riscv_v_intrinsic == 11000 diff --git a/source/scale_argb.cc b/source/scale_argb.cc index c8e0db9e1..18bdeb86f 100644 --- a/source/scale_argb.cc +++ b/source/scale_argb.cc @@ -284,10 +284,14 @@ static void ScaleARGBDownEven(int src_width, } } #endif +#if defined(HAS_SCALEARGBROWDOWNEVENBOX_RVV) + if (filtering && TestCpuFlag(kCpuHasRVV)) { + ScaleARGBRowDownEven = ScaleARGBRowDownEvenBox_RVV; + } +#endif #if defined(HAS_SCALEARGBROWDOWNEVEN_RVV) - if (TestCpuFlag(kCpuHasRVV)) { - ScaleARGBRowDownEven = - filtering ? ScaleARGBRowDownEvenBox_RVV : ScaleARGBRowDownEven_RVV; + if (!filtering && TestCpuFlag(kCpuHasRVV)) { + ScaleARGBRowDownEven = ScaleARGBRowDownEven_RVV; } #endif diff --git a/source/scale_rvv.cc b/source/scale_rvv.cc index fd14842d1..de037e45c 100644 --- a/source/scale_rvv.cc +++ b/source/scale_rvv.cc @@ -130,6 +130,7 @@ void ScaleARGBRowDown2Box_RVV(const uint8_t* src_argb, } #endif +#ifdef HAS_SCALEARGBROWDOWNEVEN_RVV void ScaleARGBRowDownEven_RVV(const uint8_t* src_argb, ptrdiff_t src_stride, int src_stepx, @@ -148,6 +149,7 @@ void ScaleARGBRowDownEven_RVV(const uint8_t* src_argb, dst += vl; } while (w > 0); } +#endif #ifdef HAS_SCALEARGBROWDOWNEVENBOX_RVV void ScaleARGBRowDownEvenBox_RVV(const uint8_t* src_argb,