shithub: dav1d

Download patch

ref: a285204a5df0f5ec32aab326fd188c942160b356
parent: 7eaa7c9fee35759829298f77e30870837eafe362
author: Martin Storsjö <martin@martin.st>
date: Fri Jan 31 17:35:04 EST 2020

arm: mc: Prepare the init file for higher bitdepths

--- a/include/common/bitdepth.h
+++ b/include/common/bitdepth.h
@@ -49,6 +49,7 @@
 #define iclip_pixel iclip_u8
 #define PIX_HEX_FMT "%02x"
 #define bitfn(x) x##_8bpc
+#define BF(x, suffix) x##_8bpc_##suffix
 #define PXSTRIDE(x) (x)
 #define highbd_only(x)
 #define HIGHBD_DECL_SUFFIX /* nothing */
@@ -72,6 +73,7 @@
 #define HIGHBD_TAIL_SUFFIX , bitdepth_max
 #define bitdepth_from_max(bitdepth_max) (32 - clz(bitdepth_max))
 #define bitfn(x) x##_16bpc
+#define BF(x, suffix) x##_16bpc_##suffix
 static inline ptrdiff_t PXSTRIDE(const ptrdiff_t x) {
     assert(!(x & 1));
     return x >> 1;
--- a/src/arm/mc_init_tmpl.c
+++ b/src/arm/mc_init_tmpl.c
@@ -30,47 +30,47 @@
 #include "src/mc.h"
 #include "src/cpu.h"
 
-decl_mc_fn(dav1d_put_8tap_regular_8bpc_neon);
-decl_mc_fn(dav1d_put_8tap_regular_smooth_8bpc_neon);
-decl_mc_fn(dav1d_put_8tap_regular_sharp_8bpc_neon);
-decl_mc_fn(dav1d_put_8tap_smooth_8bpc_neon);
-decl_mc_fn(dav1d_put_8tap_smooth_regular_8bpc_neon);
-decl_mc_fn(dav1d_put_8tap_smooth_sharp_8bpc_neon);
-decl_mc_fn(dav1d_put_8tap_sharp_8bpc_neon);
-decl_mc_fn(dav1d_put_8tap_sharp_regular_8bpc_neon);
-decl_mc_fn(dav1d_put_8tap_sharp_smooth_8bpc_neon);
-decl_mc_fn(dav1d_put_bilin_8bpc_neon);
+decl_mc_fn(BF(dav1d_put_8tap_regular, neon));
+decl_mc_fn(BF(dav1d_put_8tap_regular_smooth, neon));
+decl_mc_fn(BF(dav1d_put_8tap_regular_sharp, neon));
+decl_mc_fn(BF(dav1d_put_8tap_smooth, neon));
+decl_mc_fn(BF(dav1d_put_8tap_smooth_regular, neon));
+decl_mc_fn(BF(dav1d_put_8tap_smooth_sharp, neon));
+decl_mc_fn(BF(dav1d_put_8tap_sharp, neon));
+decl_mc_fn(BF(dav1d_put_8tap_sharp_regular, neon));
+decl_mc_fn(BF(dav1d_put_8tap_sharp_smooth, neon));
+decl_mc_fn(BF(dav1d_put_bilin, neon));
 
-decl_mct_fn(dav1d_prep_8tap_regular_8bpc_neon);
-decl_mct_fn(dav1d_prep_8tap_regular_smooth_8bpc_neon);
-decl_mct_fn(dav1d_prep_8tap_regular_sharp_8bpc_neon);
-decl_mct_fn(dav1d_prep_8tap_smooth_8bpc_neon);
-decl_mct_fn(dav1d_prep_8tap_smooth_regular_8bpc_neon);
-decl_mct_fn(dav1d_prep_8tap_smooth_sharp_8bpc_neon);
-decl_mct_fn(dav1d_prep_8tap_sharp_8bpc_neon);
-decl_mct_fn(dav1d_prep_8tap_sharp_regular_8bpc_neon);
-decl_mct_fn(dav1d_prep_8tap_sharp_smooth_8bpc_neon);
-decl_mct_fn(dav1d_prep_bilin_8bpc_neon);
+decl_mct_fn(BF(dav1d_prep_8tap_regular, neon));
+decl_mct_fn(BF(dav1d_prep_8tap_regular_smooth, neon));
+decl_mct_fn(BF(dav1d_prep_8tap_regular_sharp, neon));
+decl_mct_fn(BF(dav1d_prep_8tap_smooth, neon));
+decl_mct_fn(BF(dav1d_prep_8tap_smooth_regular, neon));
+decl_mct_fn(BF(dav1d_prep_8tap_smooth_sharp, neon));
+decl_mct_fn(BF(dav1d_prep_8tap_sharp, neon));
+decl_mct_fn(BF(dav1d_prep_8tap_sharp_regular, neon));
+decl_mct_fn(BF(dav1d_prep_8tap_sharp_smooth, neon));
+decl_mct_fn(BF(dav1d_prep_bilin, neon));
 
-decl_avg_fn(dav1d_avg_8bpc_neon);
-decl_w_avg_fn(dav1d_w_avg_8bpc_neon);
-decl_mask_fn(dav1d_mask_8bpc_neon);
-decl_blend_fn(dav1d_blend_8bpc_neon);
-decl_blend_dir_fn(dav1d_blend_h_8bpc_neon);
-decl_blend_dir_fn(dav1d_blend_v_8bpc_neon);
+decl_avg_fn(BF(dav1d_avg, neon));
+decl_w_avg_fn(BF(dav1d_w_avg, neon));
+decl_mask_fn(BF(dav1d_mask, neon));
+decl_blend_fn(BF(dav1d_blend, neon));
+decl_blend_dir_fn(BF(dav1d_blend_h, neon));
+decl_blend_dir_fn(BF(dav1d_blend_v, neon));
 
-decl_w_mask_fn(dav1d_w_mask_444_8bpc_neon);
-decl_w_mask_fn(dav1d_w_mask_422_8bpc_neon);
-decl_w_mask_fn(dav1d_w_mask_420_8bpc_neon);
+decl_w_mask_fn(BF(dav1d_w_mask_444, neon));
+decl_w_mask_fn(BF(dav1d_w_mask_422, neon));
+decl_w_mask_fn(BF(dav1d_w_mask_420, neon));
 
-decl_warp8x8_fn(dav1d_warp_affine_8x8_8bpc_neon);
-decl_warp8x8t_fn(dav1d_warp_affine_8x8t_8bpc_neon);
+decl_warp8x8_fn(BF(dav1d_warp_affine_8x8, neon));
+decl_warp8x8t_fn(BF(dav1d_warp_affine_8x8t, neon));
 
 void bitfn(dav1d_mc_dsp_init_arm)(Dav1dMCDSPContext *const c) {
 #define init_mc_fn(type, name, suffix) \
-    c->mc[type] = dav1d_put_##name##_8bpc_##suffix
+    c->mc[type] = BF(dav1d_put_##name, suffix)
 #define init_mct_fn(type, name, suffix) \
-    c->mct[type] = dav1d_prep_##name##_8bpc_##suffix
+    c->mct[type] = BF(dav1d_prep_##name, suffix)
     const unsigned flags = dav1d_get_cpu_flags();
 
     if (!(flags & DAV1D_ARM_CPU_FLAG_NEON)) return;
@@ -98,16 +98,16 @@
     init_mct_fn(FILTER_2D_8TAP_SHARP,          8tap_sharp,          neon);
     init_mct_fn(FILTER_2D_BILINEAR,            bilin,               neon);
 
-    c->avg = dav1d_avg_8bpc_neon;
-    c->w_avg = dav1d_w_avg_8bpc_neon;
-    c->mask = dav1d_mask_8bpc_neon;
-    c->blend = dav1d_blend_8bpc_neon;
-    c->blend_h = dav1d_blend_h_8bpc_neon;
-    c->blend_v = dav1d_blend_v_8bpc_neon;
-    c->w_mask[0] = dav1d_w_mask_444_8bpc_neon;
-    c->w_mask[1] = dav1d_w_mask_422_8bpc_neon;
-    c->w_mask[2] = dav1d_w_mask_420_8bpc_neon;
-    c->warp8x8 = dav1d_warp_affine_8x8_8bpc_neon;
-    c->warp8x8t = dav1d_warp_affine_8x8t_8bpc_neon;
+    c->avg = BF(dav1d_avg, neon);
+    c->w_avg = BF(dav1d_w_avg, neon);
+    c->mask = BF(dav1d_mask, neon);
+    c->blend = BF(dav1d_blend, neon);
+    c->blend_h = BF(dav1d_blend_h, neon);
+    c->blend_v = BF(dav1d_blend_v, neon);
+    c->w_mask[0] = BF(dav1d_w_mask_444, neon);
+    c->w_mask[1] = BF(dav1d_w_mask_422, neon);
+    c->w_mask[2] = BF(dav1d_w_mask_420, neon);
+    c->warp8x8 = BF(dav1d_warp_affine_8x8, neon);
+    c->warp8x8t = BF(dav1d_warp_affine_8x8t, neon);
 #endif
 }