Commit d0b1bd0d10 for aom

commit d0b1bd0d106409dd839ed6205a31be91c7a4c132
Author: Li Zhang <li.zhang2@arm.com>
Date:   Fri Dec 12 16:04:20 2025 +0100

    Fix standard bitdepth-only builds

    The kHbdDotProdMergeBlockTbl constant table defined in
    higbd_convolve_sve2.c is used in standard bit-depth convolve_sve2.c,
    which causes a compilation error for standard bidepth-only builds. Move
    the table definition to convolve_sve2.c to avoid the error. Also rename
    the table to better reflect the purpose.

    Similarly, move aom_tbl2x2_s16 helper function used by convolve_sve2.c
    from highbd_convolve_sve2.h to convolve_sve2.h to avoid including the
    high bit-depth header in standard bit-depth .c files.

    Also move highbd_warp_plane_sve.c in av1.cmake to the dedicated high
    bit-depth section as it is not used for standard bit-depth.

    Change-Id: I29ece9130a9aadb5cdd87f1e6ab9e9c42aa67f24

diff --git a/av1/av1.cmake b/av1/av1.cmake
index b2f1bdf510..14346a130e 100644
--- a/av1/av1.cmake
+++ b/av1/av1.cmake
@@ -466,7 +466,6 @@ list(APPEND AOM_AV1_COMMON_INTRIN_NEON_I8MM
             "${AOM_ROOT}/av1/common/arm/warp_plane_neon_i8mm.c")

 list(APPEND AOM_AV1_COMMON_INTRIN_SVE
-            "${AOM_ROOT}/av1/common/arm/highbd_warp_plane_sve.c"
             "${AOM_ROOT}/av1/common/arm/warp_plane_sve.c")

 list(APPEND AOM_AV1_COMMON_INTRIN_SVE2
@@ -550,6 +549,9 @@ if(CONFIG_AV1_HIGHBITDEPTH)
               "${AOM_ROOT}/av1/common/arm/highbd_warp_plane_neon.c"
               "${AOM_ROOT}/av1/common/arm/highbd_wiener_convolve_neon.c")

+  list(APPEND AOM_AV1_COMMON_INTRIN_SVE
+              "${AOM_ROOT}/av1/common/arm/highbd_warp_plane_sve.c")
+
   list(APPEND AOM_AV1_COMMON_INTRIN_SVE2
               "${AOM_ROOT}/av1/common/arm/highbd_compound_convolve_sve2.c"
               "${AOM_ROOT}/av1/common/arm/highbd_convolve_sve2.c")
diff --git a/av1/common/arm/convolve_sve2.c b/av1/common/arm/convolve_sve2.c
index 8090b2415e..ae003867e6 100644
--- a/av1/common/arm/convolve_sve2.c
+++ b/av1/common/arm/convolve_sve2.c
@@ -23,9 +23,20 @@
 #include "aom_dsp/arm/mem_neon.h"
 #include "aom_dsp/arm/transpose_neon.h"
 #include "aom_ports/mem.h"
-#include "av1/common/arm/highbd_convolve_sve2.h"
+#include "av1/common/arm/convolve_sve2.h"
 #include "av1/common/arm/convolve_neon_i8mm.h"

+// clang-format off
+DECLARE_ALIGNED(16, const uint16_t, kSVEDotProdMergeBlockTbl[24]) = {
+  // Shift left and insert new last column in transposed 4x4 block.
+  1, 2, 3, 0, 5, 6, 7, 4,
+  // Shift left and insert two new columns in transposed 4x4 block.
+  2, 3, 0, 1, 6, 7, 4, 5,
+  // Shift left and insert three new columns in transposed 4x4 block.
+  3, 0, 1, 2, 7, 4, 5, 6,
+};
+// clang-format on
+
 static inline int32x4_t highbd_convolve12_4_2d_v(int16x8_t s0[2],
                                                  int16x8_t s1[2],
                                                  int16x8_t s2[2],
@@ -52,7 +63,7 @@ static inline void convolve_2d_sr_vert_12tap_sve2(
   const int bd = 8;
   const int16x8_t sub_const = vdupq_n_s16(1 << (bd - 1));

-  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kHbdDotProdMergeBlockTbl);
+  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kSVEDotProdMergeBlockTbl);
   // Scale indices by size of the true vector length to avoid reading from an
   // 'undefined' portion of a vector on a system with SVE vectors > 128-bit.
   uint16x8_t correction0 =
diff --git a/av1/common/arm/convolve_sve2.h b/av1/common/arm/convolve_sve2.h
new file mode 100644
index 0000000000..bd02153db4
--- /dev/null
+++ b/av1/common/arm/convolve_sve2.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025, Alliance for Open Media. All rights reserved.
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#ifndef AOM_AV1_COMMON_ARM_CONVOLVE_SVE2_H_
+#define AOM_AV1_COMMON_ARM_CONVOLVE_SVE2_H_
+
+#include "aom_dsp/arm/aom_neon_sve2_bridge.h"
+#include "aom_ports/mem.h"
+
+DECLARE_ALIGNED(16, extern const uint16_t, kSVEDotProdMergeBlockTbl[24]);
+
+static inline void aom_tbl2x2_s16(int16x8_t t0[2], int16x8_t t1[2],
+                                  uint16x8_t tbl, int16x8_t res[2]) {
+  res[0] = aom_tbl2_s16(t0[0], t1[0], tbl);
+  res[1] = aom_tbl2_s16(t0[1], t1[1], tbl);
+}
+
+#endif  // AOM_AV1_COMMON_ARM_CONVOLVE_SVE2_H_
diff --git a/av1/common/arm/highbd_compound_convolve_sve2.c b/av1/common/arm/highbd_compound_convolve_sve2.c
index 36c0ae7cf3..e5fbe419b3 100644
--- a/av1/common/arm/highbd_compound_convolve_sve2.c
+++ b/av1/common/arm/highbd_compound_convolve_sve2.c
@@ -24,6 +24,7 @@
 #include "av1/common/convolve.h"
 #include "av1/common/filter.h"
 #include "av1/common/filter.h"
+#include "av1/common/arm/convolve_sve2.h"
 #include "av1/common/arm/highbd_compound_convolve_neon.h"
 #include "av1/common/arm/highbd_convolve_neon.h"
 #include "av1/common/arm/highbd_convolve_sve2.h"
@@ -473,7 +474,7 @@ static inline void highbd_12_dist_wtd_convolve_y_8tap_sve2(
       vdupq_n_s64((1 << (12 + FILTER_BITS)) + (1 << (12 + FILTER_BITS - 1)));
   const int16x8_t y_filter = vld1q_s16(y_filter_ptr);

-  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kHbdDotProdMergeBlockTbl);
+  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kSVEDotProdMergeBlockTbl);
   // Scale indices by size of the true vector length to avoid reading from an
   // 'undefined' portion of a vector on a system with SVE vectors > 128-bit.
   uint16x8_t correction0 =
@@ -649,7 +650,7 @@ static inline void highbd_dist_wtd_convolve_y_8tap_sve2(
       vdupq_n_s64((1 << (bd + FILTER_BITS)) + (1 << (bd + FILTER_BITS - 1)));
   const int16x8_t y_filter = vld1q_s16(y_filter_ptr);

-  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kHbdDotProdMergeBlockTbl);
+  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kSVEDotProdMergeBlockTbl);
   // Scale indices by size of the true vector length to avoid reading from an
   // 'undefined' portion of a vector on a system with SVE vectors > 128-bit.
   uint16x8_t correction0 =
@@ -1200,7 +1201,7 @@ static inline void highbd_dist_wtd_convolve_2d_vert_8tap_sve2(
   const int16x8_t y_filter = vld1q_s16(y_filter_ptr);
   const int64x2_t offset_s64 = vdupq_n_s64(offset);

-  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kHbdDotProdMergeBlockTbl);
+  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kSVEDotProdMergeBlockTbl);
   // Scale indices by size of the true vector length to avoid reading from an
   // 'undefined' portion of a vector on a system with SVE vectors > 128-bit.
   uint16x8_t correction0 =
diff --git a/av1/common/arm/highbd_convolve_sve2.c b/av1/common/arm/highbd_convolve_sve2.c
index a455e8030b..656d8d50a7 100644
--- a/av1/common/arm/highbd_convolve_sve2.c
+++ b/av1/common/arm/highbd_convolve_sve2.c
@@ -24,19 +24,9 @@
 #include "aom_ports/mem.h"
 #include "av1/common/convolve.h"
 #include "av1/common/filter.h"
+#include "av1/common/arm/convolve_sve2.h"
 #include "av1/common/arm/highbd_convolve_sve2.h"

-// clang-format off
-DECLARE_ALIGNED(16, const uint16_t, kHbdDotProdMergeBlockTbl[24]) = {
-  // Shift left and insert new last column in transposed 4x4 block.
-  1, 2, 3, 0, 5, 6, 7, 4,
-  // Shift left and insert two new columns in transposed 4x4 block.
-  2, 3, 0, 1, 6, 7, 4, 5,
-  // Shift left and insert three new columns in transposed 4x4 block.
-  3, 0, 1, 2, 7, 4, 5, 6,
-};
-// clang-format on
-
 static inline uint16x4_t convolve12_4_x(
     int16x8_t s0, int16x8_t s1, int16x8_t filter_0_7, int16x8_t filter_4_11,
     const int64x2_t offset, uint16x8x4_t permute_tbl, uint16x4_t max) {
@@ -559,7 +549,7 @@ static void highbd_convolve_y_sr_8tap_sve2(const uint16_t *src,

   const int16x8_t y_filter = vld1q_s16(filter_y);

-  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kHbdDotProdMergeBlockTbl);
+  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kSVEDotProdMergeBlockTbl);
   // Scale indices by size of the true vector length to avoid reading from an
   // 'undefined' portion of a vector on a system with SVE vectors > 128-bit.
   uint16x8_t correction0 =
@@ -1202,7 +1192,7 @@ static inline void highbd_convolve_2d_sr_vert_12tap_sve2(
   const int16x8_t y_filter_0_7 = vld1q_s16(y_filter_ptr);
   const int16x8_t y_filter_4_11 = vld1q_s16(y_filter_ptr + 4);

-  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kHbdDotProdMergeBlockTbl);
+  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kSVEDotProdMergeBlockTbl);
   // Scale indices by size of the true vector length to avoid reading from an
   // 'undefined' portion of a vector on a system with SVE vectors > 128-bit.
   uint16x8_t correction0 =
@@ -1345,7 +1335,7 @@ static void highbd_convolve_2d_sr_vert_8tap_sve2(
   const int32x4_t shift = vdupq_n_s32(-conv_params->round_1);
   const int16x8_t y_filter = vld1q_s16(filter_y);

-  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kHbdDotProdMergeBlockTbl);
+  uint16x8x3_t merge_block_tbl = vld1q_u16_x3(kSVEDotProdMergeBlockTbl);
   // Scale indices by size of the true vector length to avoid reading from an
   // 'undefined' portion of a vector on a system with SVE vectors > 128-bit.
   uint16x8_t correction0 =
diff --git a/av1/common/arm/highbd_convolve_sve2.h b/av1/common/arm/highbd_convolve_sve2.h
index 5862e6858a..0b59e26249 100644
--- a/av1/common/arm/highbd_convolve_sve2.h
+++ b/av1/common/arm/highbd_convolve_sve2.h
@@ -16,8 +16,6 @@

 #include "aom_dsp/arm/aom_neon_sve2_bridge.h"

-DECLARE_ALIGNED(16, extern const uint16_t, kHbdDotProdMergeBlockTbl[24]);
-
 static inline void aom_tbl2x4_s16(int16x8_t t0[4], int16x8_t t1[4],
                                   uint16x8_t tbl, int16x8_t res[4]) {
   res[0] = aom_tbl2_s16(t0[0], t1[0], tbl);
@@ -26,10 +24,4 @@ static inline void aom_tbl2x4_s16(int16x8_t t0[4], int16x8_t t1[4],
   res[3] = aom_tbl2_s16(t0[3], t1[3], tbl);
 }

-static inline void aom_tbl2x2_s16(int16x8_t t0[2], int16x8_t t1[2],
-                                  uint16x8_t tbl, int16x8_t res[2]) {
-  res[0] = aom_tbl2_s16(t0[0], t1[0], tbl);
-  res[1] = aom_tbl2_s16(t0[1], t1[1], tbl);
-}
-
 #endif  // AOM_AV1_COMMON_ARM_HIGHBD_CONVOLVE_SVE2_H_