Disable RVV ScaleDownBy4 if compiler option is not enabled

- Some configs have int64 elements off by default.
  Disable ScaleDownBy4 row function to avoid compile error

Bug: 344954354
Change-Id: Ie0d74daea72375eff6438ab54cb2803d68d67e52
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5598460
Reviewed-by: James Zern <jzern@google.com>
This commit is contained in:
Frank Barchard 2024-06-05 13:02:01 -07:00
parent b0dfa70114
commit efd164d64e
3 changed files with 14 additions and 3 deletions

View File

@ -182,7 +182,9 @@ extern "C" {
#define HAS_SCALEADDROW_RVV
// TODO: Test ScaleARGBRowDownEven_RVV and enable it
// #define HAS_SCALEARGBROWDOWNEVEN_RVV
#if defined(__riscv_zve64x)
#define HAS_SCALEUVROWDOWN4_RVV
#endif
#define HAS_SCALEUVROWDOWNEVEN_RVV
#define HAS_SCALEARGBROWDOWN2_RVV
#define HAS_SCALEARGBROWDOWN2BOX_RVV

View File

@ -327,10 +327,16 @@ static void ScaleUVDownEven(int src_width,
}
}
#endif
#if defined(HAS_SCALEUVROWDOWNEVEN_RVV)
#if defined(HAS_SCALEUVROWDOWNEVEN_RVV) || defined(HAS_SCALEUVROWDOWN4_RVV)
if (TestCpuFlag(kCpuHasRVV) && !filtering) {
ScaleUVRowDownEven =
(col_step == 4) ? ScaleUVRowDown4_RVV : ScaleUVRowDownEven_RVV;
#if defined(HAS_SCALEUVROWDOWNEVEN_RVV)
ScaleUVRowDownEven = ScaleUVRowDownEven_RVV;
#endif
#if defined(HAS_SCALEUVROWDOWN4_RVV)
if (col_step == 4) {
ScaleUVRowDownEven = ScaleUVRowDown4_RVV;
}
#endif
}
#endif

View File

@ -144,6 +144,9 @@ TEST_F(LibYUVBaseTest, TestCompilerMacros) {
#ifdef __riscv_v_intrinsic
printf("__riscv_v_intrinsic %d\n", __riscv_v_intrinsic);
#endif
#ifdef __riscv_zve64x
printf("__riscv_zve64x %d\n", __riscv_zve64x);
#endif
#ifdef __APPLE__
printf("__APPLE__ %d\n", __APPLE__);
#endif