mc.h (3676B)
1 /* 2 * Copyright © 2018, VideoLAN and dav1d authors 3 * Copyright © 2018, Two Orioles, LLC 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright notice, this 10 * list of conditions and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #include "config.h" 29 30 #include "src/mc.h" 31 #include "src/cpu.h" 32 33 decl_8tap_fns(neon); 34 decl_8tap_fns(neon_dotprod); 35 decl_8tap_fns(neon_i8mm); 36 decl_8tap_fns(sve2); 37 38 decl_mc_fn(BF(dav1d_put_bilin, neon)); 39 decl_mct_fn(BF(dav1d_prep_bilin, neon)); 40 41 decl_avg_fn(BF(dav1d_avg, neon)); 42 decl_w_avg_fn(BF(dav1d_w_avg, neon)); 43 decl_mask_fn(BF(dav1d_mask, neon)); 44 decl_blend_fn(BF(dav1d_blend, neon)); 45 decl_blend_dir_fn(BF(dav1d_blend_h, neon)); 46 decl_blend_dir_fn(BF(dav1d_blend_v, neon)); 47 48 decl_w_mask_fn(BF(dav1d_w_mask_444, neon)); 49 decl_w_mask_fn(BF(dav1d_w_mask_422, neon)); 50 decl_w_mask_fn(BF(dav1d_w_mask_420, neon)); 51 52 decl_warp8x8_fn(BF(dav1d_warp_affine_8x8, neon)); 53 decl_warp8x8t_fn(BF(dav1d_warp_affine_8x8t, neon)); 54 55 decl_emu_edge_fn(BF(dav1d_emu_edge, neon)); 56 57 static ALWAYS_INLINE void mc_dsp_init_arm(Dav1dMCDSPContext *const c) { 58 #define init_mc_fn(type, name, suffix) \ 59 c->mc[type] = BF(dav1d_put_##name, suffix) 60 #define init_mct_fn(type, name, suffix) \ 61 c->mct[type] = BF(dav1d_prep_##name, suffix) 62 const unsigned flags = dav1d_get_cpu_flags(); 63 64 if (!(flags & DAV1D_ARM_CPU_FLAG_NEON)) return; 65 66 init_8tap_fns(neon); 67 68 init_mc_fn (FILTER_2D_BILINEAR, bilin, neon); 69 init_mct_fn(FILTER_2D_BILINEAR, bilin, neon); 70 71 c->avg = BF(dav1d_avg, neon); 72 c->w_avg = BF(dav1d_w_avg, neon); 73 c->mask = BF(dav1d_mask, neon); 74 c->blend = BF(dav1d_blend, neon); 75 c->blend_h = BF(dav1d_blend_h, neon); 76 c->blend_v = BF(dav1d_blend_v, neon); 77 c->w_mask[0] = BF(dav1d_w_mask_444, neon); 78 c->w_mask[1] = BF(dav1d_w_mask_422, neon); 79 c->w_mask[2] = BF(dav1d_w_mask_420, neon); 80 c->warp8x8 = BF(dav1d_warp_affine_8x8, neon); 81 c->warp8x8t = BF(dav1d_warp_affine_8x8t, neon); 82 c->emu_edge = BF(dav1d_emu_edge, neon); 83 84 #if ARCH_AARCH64 85 #if BITDEPTH == 8 86 #if HAVE_DOTPROD 87 if (flags & DAV1D_ARM_CPU_FLAG_DOTPROD) { 88 init_8tap_fns(neon_dotprod); 89 } 90 #endif // HAVE_DOTPROD 91 92 #if HAVE_I8MM 93 if (flags & DAV1D_ARM_CPU_FLAG_I8MM) { 94 init_8tap_fns(neon_i8mm); 95 } 96 #endif // HAVE_I8MM 97 #endif // BITDEPTH == 8 98 99 #if BITDEPTH == 16 100 #if HAVE_SVE2 101 if (flags & DAV1D_ARM_CPU_FLAG_SVE2) { 102 init_8tap_fns(sve2); 103 } 104 #endif // HAVE_SVE2 105 #endif // BITDEPTH == 16 106 #endif // ARCH_AARCH64 107 }