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_mc_fn(BF(dav1d_put_8tap_regular, neon));
34 decl_mc_fn(BF(dav1d_put_8tap_regular_smooth, neon));
35 decl_mc_fn(BF(dav1d_put_8tap_regular_sharp, neon));
36 decl_mc_fn(BF(dav1d_put_8tap_smooth, neon));
37 decl_mc_fn(BF(dav1d_put_8tap_smooth_regular, neon));
38 decl_mc_fn(BF(dav1d_put_8tap_smooth_sharp, neon));
39 decl_mc_fn(BF(dav1d_put_8tap_sharp, neon));
40 decl_mc_fn(BF(dav1d_put_8tap_sharp_regular, neon));
41 decl_mc_fn(BF(dav1d_put_8tap_sharp_smooth, neon));
42 decl_mc_fn(BF(dav1d_put_bilin, neon));
43 
44 decl_mct_fn(BF(dav1d_prep_8tap_regular, neon));
45 decl_mct_fn(BF(dav1d_prep_8tap_regular_smooth, neon));
46 decl_mct_fn(BF(dav1d_prep_8tap_regular_sharp, neon));
47 decl_mct_fn(BF(dav1d_prep_8tap_smooth, neon));
48 decl_mct_fn(BF(dav1d_prep_8tap_smooth_regular, neon));
49 decl_mct_fn(BF(dav1d_prep_8tap_smooth_sharp, neon));
50 decl_mct_fn(BF(dav1d_prep_8tap_sharp, neon));
51 decl_mct_fn(BF(dav1d_prep_8tap_sharp_regular, neon));
52 decl_mct_fn(BF(dav1d_prep_8tap_sharp_smooth, neon));
53 decl_mct_fn(BF(dav1d_prep_bilin, neon));
54 
55 decl_avg_fn(BF(dav1d_avg, neon));
56 decl_w_avg_fn(BF(dav1d_w_avg, neon));
57 decl_mask_fn(BF(dav1d_mask, neon));
58 decl_blend_fn(BF(dav1d_blend, neon));
59 decl_blend_dir_fn(BF(dav1d_blend_h, neon));
60 decl_blend_dir_fn(BF(dav1d_blend_v, neon));
61 
62 decl_w_mask_fn(BF(dav1d_w_mask_444, neon));
63 decl_w_mask_fn(BF(dav1d_w_mask_422, neon));
64 decl_w_mask_fn(BF(dav1d_w_mask_420, neon));
65 
66 decl_warp8x8_fn(BF(dav1d_warp_affine_8x8, neon));
67 decl_warp8x8t_fn(BF(dav1d_warp_affine_8x8t, neon));
68 
69 decl_emu_edge_fn(BF(dav1d_emu_edge, neon));
70 
bitfn(dav1d_mc_dsp_init_arm)71 void bitfn(dav1d_mc_dsp_init_arm)(Dav1dMCDSPContext *const c) {
72 #define init_mc_fn(type, name, suffix) \
73     c->mc[type] = BF(dav1d_put_##name, suffix)
74 #define init_mct_fn(type, name, suffix) \
75     c->mct[type] = BF(dav1d_prep_##name, suffix)
76     const unsigned flags = dav1d_get_cpu_flags();
77 
78     if (!(flags & DAV1D_ARM_CPU_FLAG_NEON)) return;
79 
80     init_mc_fn (FILTER_2D_8TAP_REGULAR,        8tap_regular,        neon);
81     init_mc_fn (FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth, neon);
82     init_mc_fn (FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp,  neon);
83     init_mc_fn (FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular, neon);
84     init_mc_fn (FILTER_2D_8TAP_SMOOTH,         8tap_smooth,         neon);
85     init_mc_fn (FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp,   neon);
86     init_mc_fn (FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular,  neon);
87     init_mc_fn (FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth,   neon);
88     init_mc_fn (FILTER_2D_8TAP_SHARP,          8tap_sharp,          neon);
89     init_mc_fn (FILTER_2D_BILINEAR,            bilin,               neon);
90 
91     init_mct_fn(FILTER_2D_8TAP_REGULAR,        8tap_regular,        neon);
92     init_mct_fn(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth, neon);
93     init_mct_fn(FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp,  neon);
94     init_mct_fn(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular, neon);
95     init_mct_fn(FILTER_2D_8TAP_SMOOTH,         8tap_smooth,         neon);
96     init_mct_fn(FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp,   neon);
97     init_mct_fn(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular,  neon);
98     init_mct_fn(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth,   neon);
99     init_mct_fn(FILTER_2D_8TAP_SHARP,          8tap_sharp,          neon);
100     init_mct_fn(FILTER_2D_BILINEAR,            bilin,               neon);
101 
102     c->avg = BF(dav1d_avg, neon);
103     c->w_avg = BF(dav1d_w_avg, neon);
104     c->mask = BF(dav1d_mask, neon);
105     c->blend = BF(dav1d_blend, neon);
106     c->blend_h = BF(dav1d_blend_h, neon);
107     c->blend_v = BF(dav1d_blend_v, neon);
108     c->w_mask[0] = BF(dav1d_w_mask_444, neon);
109     c->w_mask[1] = BF(dav1d_w_mask_422, neon);
110     c->w_mask[2] = BF(dav1d_w_mask_420, neon);
111     c->warp8x8 = BF(dav1d_warp_affine_8x8, neon);
112     c->warp8x8t = BF(dav1d_warp_affine_8x8t, neon);
113     c->emu_edge = BF(dav1d_emu_edge, neon);
114 }
115