/work/dav1d/src/mc_tmpl.c
Line | Count | Source |
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 <stdlib.h> |
31 | | #include <string.h> |
32 | | |
33 | | #include "common/attributes.h" |
34 | | #include "common/intops.h" |
35 | | |
36 | | #include "src/mc.h" |
37 | | #include "src/tables.h" |
38 | | |
39 | | #if BITDEPTH == 8 |
40 | 5.03M | #define get_intermediate_bits(bitdepth_max) 4 |
41 | | // Output in interval [-5132, 9212], fits in int16_t as is |
42 | 459M | #define PREP_BIAS 0 |
43 | | #else |
44 | | // 4 for 10 bits/component, 2 for 12 bits/component |
45 | | #define get_intermediate_bits(bitdepth_max) (14 - bitdepth_from_max(bitdepth_max)) |
46 | | // Output in interval [-20588, 36956] (10-bit), [-20602, 36983] (12-bit) |
47 | | // Subtract a bias to ensure the output fits in int16_t |
48 | | #define PREP_BIAS 8192 |
49 | | #endif |
50 | | |
51 | | static NOINLINE void |
52 | | put_c(pixel *dst, const ptrdiff_t dst_stride, |
53 | | const pixel *src, const ptrdiff_t src_stride, const int w, int h) |
54 | 976k | { |
55 | 16.8M | do { |
56 | 16.8M | pixel_copy(dst, src, w); |
57 | | |
58 | 16.8M | dst += dst_stride; |
59 | 16.8M | src += src_stride; |
60 | 16.8M | } while (--h); |
61 | 976k | } |
62 | | |
63 | | static NOINLINE void |
64 | | prep_c(int16_t *tmp, const pixel *src, const ptrdiff_t src_stride, |
65 | | const int w, int h HIGHBD_DECL_SUFFIX) |
66 | 207k | { |
67 | 207k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
68 | 5.82M | do { |
69 | 191M | for (int x = 0; x < w; x++) |
70 | 185M | tmp[x] = (src[x] << intermediate_bits) - PREP_BIAS; |
71 | | |
72 | 5.82M | tmp += w; |
73 | 5.82M | src += src_stride; |
74 | 5.82M | } while (--h); |
75 | 207k | } |
76 | | |
77 | | #define FILTER_8TAP(src, x, F, stride) \ |
78 | 575M | (F[0] * src[x + -3 * stride] + \ |
79 | 575M | F[1] * src[x + -2 * stride] + \ |
80 | 575M | F[2] * src[x + -1 * stride] + \ |
81 | 575M | F[3] * src[x + +0 * stride] + \ |
82 | 575M | F[4] * src[x + +1 * stride] + \ |
83 | 575M | F[5] * src[x + +2 * stride] + \ |
84 | 575M | F[6] * src[x + +3 * stride] + \ |
85 | 575M | F[7] * src[x + +4 * stride]) |
86 | | |
87 | | #define FILTER_8TAP2(src, x, F) \ |
88 | 406M | (F[0] * src[0][x] + \ |
89 | 406M | F[1] * src[1][x] + \ |
90 | 406M | F[2] * src[2][x] + \ |
91 | 406M | F[3] * src[3][x] + \ |
92 | 406M | F[4] * src[4][x] + \ |
93 | 406M | F[5] * src[5][x] + \ |
94 | 406M | F[6] * src[6][x] + \ |
95 | 406M | F[7] * src[7][x]) |
96 | | |
97 | | #define DAV1D_FILTER_8TAP_RND(src, x, F, stride, sh) \ |
98 | 534M | ((FILTER_8TAP(src, x, F, stride) + ((1 << (sh)) >> 1)) >> (sh)) |
99 | | |
100 | | #define DAV1D_FILTER_8TAP_RND2(src, x, F, stride, rnd, sh) \ |
101 | 40.4M | ((FILTER_8TAP(src, x, F, stride) + (rnd)) >> (sh)) |
102 | | |
103 | | #define DAV1D_FILTER_8TAP_RND3(src, x, F, sh) \ |
104 | 406M | ((FILTER_8TAP2(src, x, F) + ((1 << (sh)) >> 1)) >> (sh)) |
105 | | |
106 | | #define DAV1D_FILTER_8TAP_CLIP(src, x, F, stride, sh) \ |
107 | 61.3M | iclip_pixel(DAV1D_FILTER_8TAP_RND(src, x, F, stride, sh)) |
108 | | |
109 | | #define DAV1D_FILTER_8TAP_CLIP2(src, x, F, stride, rnd, sh) \ |
110 | 40.4M | iclip_pixel(DAV1D_FILTER_8TAP_RND2(src, x, F, stride, rnd, sh)) |
111 | | |
112 | | #define DAV1D_FILTER_8TAP_CLIP3(src, x, F, sh) \ |
113 | 265M | iclip_pixel(DAV1D_FILTER_8TAP_RND3(src, x, F, sh)) |
114 | | |
115 | | #define GET_H_FILTER(mx) \ |
116 | 366M | const int8_t *const fh = !(mx) ? NULL : w > 4 ? \ |
117 | 339M | dav1d_mc_subpel_filters[filter_type & 3][(mx) - 1] : \ |
118 | 339M | dav1d_mc_subpel_filters[3 + (filter_type & 1)][(mx) - 1] |
119 | | |
120 | | #define GET_V_FILTER(my) \ |
121 | 18.4M | const int8_t *const fv = !(my) ? NULL : h > 4 ? \ |
122 | 15.3M | dav1d_mc_subpel_filters[filter_type >> 2][(my) - 1] : \ |
123 | 15.3M | dav1d_mc_subpel_filters[3 + ((filter_type >> 2) & 1)][(my) - 1] |
124 | | |
125 | | #define GET_FILTERS() \ |
126 | 1.45M | GET_H_FILTER(mx); \ |
127 | 1.45M | GET_V_FILTER(my) |
128 | | |
129 | | static NOINLINE void |
130 | | put_8tap_c(pixel *dst, ptrdiff_t dst_stride, |
131 | | const pixel *src, ptrdiff_t src_stride, |
132 | | const int w, int h, const int mx, const int my, |
133 | | const int filter_type HIGHBD_DECL_SUFFIX) |
134 | 1.13M | { |
135 | 1.13M | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
136 | 1.13M | const int intermediate_rnd = 32 + ((1 << (6 - intermediate_bits)) >> 1); |
137 | | |
138 | 1.13M | GET_FILTERS(); |
139 | 1.13M | dst_stride = PXSTRIDE(dst_stride); |
140 | 1.13M | src_stride = PXSTRIDE(src_stride); |
141 | | |
142 | 1.13M | if (fh) { |
143 | 324k | if (fv) { |
144 | 216k | int tmp_h = h + 7; |
145 | 216k | int16_t mid[128 * 135], *mid_ptr = mid; |
146 | | |
147 | 216k | src -= src_stride * 3; |
148 | 3.77M | do { |
149 | 58.8M | for (int x = 0; x < w; x++) |
150 | 55.0M | mid_ptr[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1, |
151 | 3.77M | 6 - intermediate_bits); |
152 | | |
153 | 3.77M | mid_ptr += 128; |
154 | 3.77M | src += src_stride; |
155 | 3.77M | } while (--tmp_h); |
156 | | |
157 | 216k | mid_ptr = mid + 128 * 3; |
158 | 2.23M | do { |
159 | 42.4M | for (int x = 0; x < w; x++) |
160 | 40.2M | dst[x] = DAV1D_FILTER_8TAP_CLIP(mid_ptr, x, fv, 128, |
161 | 2.23M | 6 + intermediate_bits); |
162 | | |
163 | 2.23M | mid_ptr += 128; |
164 | 2.23M | dst += dst_stride; |
165 | 2.23M | } while (--h); |
166 | 216k | } else { |
167 | 1.22M | do { |
168 | 41.6M | for (int x = 0; x < w; x++) { |
169 | 40.4M | dst[x] = DAV1D_FILTER_8TAP_CLIP2(src, x, fh, 1, |
170 | 40.4M | intermediate_rnd, 6); |
171 | 40.4M | } |
172 | | |
173 | 1.22M | dst += dst_stride; |
174 | 1.22M | src += src_stride; |
175 | 1.22M | } while (--h); |
176 | 108k | } |
177 | 814k | } else if (fv) { |
178 | 1.15M | do { |
179 | 22.3M | for (int x = 0; x < w; x++) |
180 | 21.1M | dst[x] = DAV1D_FILTER_8TAP_CLIP(src, x, fv, src_stride, 6); |
181 | | |
182 | 1.15M | dst += dst_stride; |
183 | 1.15M | src += src_stride; |
184 | 1.15M | } while (--h); |
185 | 120k | } else |
186 | 693k | put_c(dst, dst_stride, src, src_stride, w, h); |
187 | 1.13M | } |
188 | | |
189 | | static NOINLINE void |
190 | | put_8tap_scaled_c(pixel *dst, const ptrdiff_t dst_stride, |
191 | | const pixel *src, ptrdiff_t src_stride, |
192 | | const int w, int h, const int mx, int my, |
193 | | const int dx, const int dy, const int filter_type |
194 | | HIGHBD_DECL_SUFFIX) |
195 | 813k | { |
196 | 813k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
197 | 813k | const int intermediate_rnd = (1 << intermediate_bits) >> 1; |
198 | 813k | int16_t mid[128 * 8]; |
199 | 813k | int16_t *mid_ptrs[8]; |
200 | 813k | int in_y = -8; |
201 | 813k | src_stride = PXSTRIDE(src_stride); |
202 | | |
203 | 7.32M | for (int i = 0; i < 8; i++) |
204 | 6.50M | mid_ptrs[i] = &mid[128 * i]; |
205 | | |
206 | 813k | src -= src_stride * 3; |
207 | | |
208 | 11.4M | for (int y = 0; y < h; y++) { |
209 | 10.5M | int x; |
210 | 10.5M | int src_y = my >> 10; |
211 | 10.5M | GET_V_FILTER((my & 0x3ff) >> 6); |
212 | | |
213 | 21.8M | while (in_y < src_y) { |
214 | 11.2M | int imx = mx, ioff = 0; |
215 | 11.2M | int16_t *mid_ptr = mid_ptrs[0]; |
216 | | |
217 | 90.1M | for (int i = 0; i < 7; i++) |
218 | 78.9M | mid_ptrs[i] = mid_ptrs[i + 1]; |
219 | 11.2M | mid_ptrs[7] = mid_ptr; |
220 | | |
221 | 236M | for (x = 0; x < w; x++) { |
222 | 224M | GET_H_FILTER(imx >> 6); |
223 | 224M | mid_ptr[x] = fh ? DAV1D_FILTER_8TAP_RND(src, ioff, fh, 1, |
224 | 224M | 6 - intermediate_bits) : |
225 | 224M | src[ioff] << intermediate_bits; |
226 | 224M | imx += dx; |
227 | 224M | ioff += imx >> 10; |
228 | 224M | imx &= 0x3ff; |
229 | 224M | } |
230 | | |
231 | 11.2M | src += src_stride; |
232 | 11.2M | in_y++; |
233 | 11.2M | } |
234 | | |
235 | 309M | for (x = 0; x < w; x++) |
236 | 299M | dst[x] = fv ? DAV1D_FILTER_8TAP_CLIP3(mid_ptrs, x, fv, |
237 | 299M | 6 + intermediate_bits) : |
238 | 299M | iclip_pixel((mid_ptrs[3][x] + intermediate_rnd) >> |
239 | 33.3M | intermediate_bits); |
240 | | |
241 | 10.5M | my += dy; |
242 | 10.5M | dst += PXSTRIDE(dst_stride); |
243 | 10.5M | } |
244 | 813k | } |
245 | | |
246 | | static NOINLINE void |
247 | | prep_8tap_c(int16_t *tmp, const pixel *src, ptrdiff_t src_stride, |
248 | | const int w, int h, const int mx, const int my, |
249 | | const int filter_type HIGHBD_DECL_SUFFIX) |
250 | 312k | { |
251 | 312k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
252 | 312k | GET_FILTERS(); |
253 | 312k | src_stride = PXSTRIDE(src_stride); |
254 | | |
255 | 312k | if (fh) { |
256 | 89.7k | if (fv) { |
257 | 64.1k | int tmp_h = h + 7; |
258 | 64.1k | int16_t mid[128 * 135], *mid_ptr = mid; |
259 | | |
260 | 64.1k | src -= src_stride * 3; |
261 | 1.55M | do { |
262 | 31.1M | for (int x = 0; x < w; x++) |
263 | 29.6M | mid_ptr[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1, |
264 | 1.55M | 6 - intermediate_bits); |
265 | | |
266 | 1.55M | mid_ptr += 128; |
267 | 1.55M | src += src_stride; |
268 | 1.55M | } while (--tmp_h); |
269 | | |
270 | 64.1k | mid_ptr = mid + 128 * 3; |
271 | 1.10M | do { |
272 | 25.4M | for (int x = 0; x < w; x++) { |
273 | 24.3M | int t = DAV1D_FILTER_8TAP_RND(mid_ptr, x, fv, 128, 6) - |
274 | 24.3M | PREP_BIAS; |
275 | 24.3M | assert(t >= INT16_MIN && t <= INT16_MAX); |
276 | 24.3M | tmp[x] = t; |
277 | 24.3M | } |
278 | | |
279 | 1.10M | mid_ptr += 128; |
280 | 1.10M | tmp += w; |
281 | 1.10M | } while (--h); |
282 | 64.1k | } else { |
283 | 506k | do { |
284 | 16.5M | for (int x = 0; x < w; x++) |
285 | 16.0M | tmp[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1, |
286 | 16.0M | 6 - intermediate_bits) - |
287 | 16.0M | PREP_BIAS; |
288 | | |
289 | 506k | tmp += w; |
290 | 506k | src += src_stride; |
291 | 506k | } while (--h); |
292 | 25.5k | } |
293 | 222k | } else if (fv) { |
294 | 438k | do { |
295 | 9.44M | for (int x = 0; x < w; x++) |
296 | 9.00M | tmp[x] = DAV1D_FILTER_8TAP_RND(src, x, fv, src_stride, |
297 | 9.00M | 6 - intermediate_bits) - |
298 | 9.00M | PREP_BIAS; |
299 | | |
300 | 438k | tmp += w; |
301 | 438k | src += src_stride; |
302 | 438k | } while (--h); |
303 | 25.5k | } else |
304 | 196k | prep_c(tmp, src, src_stride, w, h HIGHBD_TAIL_SUFFIX); |
305 | 312k | } |
306 | | |
307 | | static NOINLINE void |
308 | | prep_8tap_scaled_c(int16_t *tmp, const pixel *src, ptrdiff_t src_stride, |
309 | | const int w, int h, const int mx, int my, |
310 | | const int dx, const int dy, const int filter_type |
311 | | HIGHBD_DECL_SUFFIX) |
312 | 356k | { |
313 | 356k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
314 | 356k | int16_t mid[128 * 8]; |
315 | 356k | int16_t *mid_ptrs[8]; |
316 | 356k | int in_y = -8; |
317 | 356k | src_stride = PXSTRIDE(src_stride); |
318 | | |
319 | 3.20M | for (int i = 0; i < 8; i++) |
320 | 2.84M | mid_ptrs[i] = &mid[128 * i]; |
321 | | |
322 | 356k | src -= src_stride * 3; |
323 | | |
324 | 6.79M | for (int y = 0; y < h; y++) { |
325 | 6.43M | int x; |
326 | 6.43M | int src_y = my >> 10; |
327 | 6.43M | GET_V_FILTER((my & 0x3ff) >> 6); |
328 | | |
329 | 12.2M | while (in_y < src_y) { |
330 | 5.85M | int imx = mx, ioff = 0; |
331 | 5.85M | int16_t *mid_ptr = mid_ptrs[0]; |
332 | | |
333 | 46.8M | for (int i = 0; i < 7; i++) |
334 | 40.9M | mid_ptrs[i] = mid_ptrs[i + 1]; |
335 | 5.85M | mid_ptrs[7] = mid_ptr; |
336 | | |
337 | 145M | for (x = 0; x < w; x++) { |
338 | 139M | GET_H_FILTER(imx >> 6); |
339 | 139M | mid_ptr[x] = fh ? DAV1D_FILTER_8TAP_RND(src, ioff, fh, 1, |
340 | 139M | 6 - intermediate_bits) : |
341 | 139M | src[ioff] << intermediate_bits; |
342 | 139M | imx += dx; |
343 | 139M | ioff += imx >> 10; |
344 | 139M | imx &= 0x3ff; |
345 | 139M | } |
346 | | |
347 | 5.85M | src += src_stride; |
348 | 5.85M | in_y++; |
349 | 5.85M | } |
350 | | |
351 | 179M | for (x = 0; x < w; x++) |
352 | 173M | tmp[x] = (fv ? DAV1D_FILTER_8TAP_RND3(mid_ptrs, x, fv, 6) |
353 | 173M | : mid_ptrs[3][x]) - PREP_BIAS; |
354 | | |
355 | 6.43M | my += dy; |
356 | 6.43M | tmp += w; |
357 | 6.43M | } |
358 | 356k | } |
359 | | |
360 | | #define filter_fns(type, type_h, type_v) \ |
361 | | static void put_8tap_##type##_c(pixel *const dst, \ |
362 | | const ptrdiff_t dst_stride, \ |
363 | | const pixel *const src, \ |
364 | | const ptrdiff_t src_stride, \ |
365 | | const int w, const int h, \ |
366 | | const int mx, const int my \ |
367 | 1.13M | HIGHBD_DECL_SUFFIX) \ |
368 | 1.13M | { \ |
369 | 1.13M | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ |
370 | 1.13M | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ |
371 | 1.13M | } \ mc_tmpl.c:put_8tap_regular_c Line | Count | Source | 367 | 521k | HIGHBD_DECL_SUFFIX) \ | 368 | 521k | { \ | 369 | 521k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 521k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 521k | } \ |
mc_tmpl.c:put_8tap_regular_smooth_c Line | Count | Source | 367 | 14.4k | HIGHBD_DECL_SUFFIX) \ | 368 | 14.4k | { \ | 369 | 14.4k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 14.4k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 14.4k | } \ |
mc_tmpl.c:put_8tap_regular_sharp_c Line | Count | Source | 367 | 2.83k | HIGHBD_DECL_SUFFIX) \ | 368 | 2.83k | { \ | 369 | 2.83k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 2.83k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 2.83k | } \ |
mc_tmpl.c:put_8tap_sharp_regular_c Line | Count | Source | 367 | 3.77k | HIGHBD_DECL_SUFFIX) \ | 368 | 3.77k | { \ | 369 | 3.77k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 3.77k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 3.77k | } \ |
mc_tmpl.c:put_8tap_sharp_smooth_c Line | Count | Source | 367 | 1.74k | HIGHBD_DECL_SUFFIX) \ | 368 | 1.74k | { \ | 369 | 1.74k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 1.74k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 1.74k | } \ |
mc_tmpl.c:put_8tap_sharp_c Line | Count | Source | 367 | 47.4k | HIGHBD_DECL_SUFFIX) \ | 368 | 47.4k | { \ | 369 | 47.4k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 47.4k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 47.4k | } \ |
mc_tmpl.c:put_8tap_smooth_regular_c Line | Count | Source | 367 | 10.6k | HIGHBD_DECL_SUFFIX) \ | 368 | 10.6k | { \ | 369 | 10.6k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 10.6k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 10.6k | } \ |
mc_tmpl.c:put_8tap_smooth_c Line | Count | Source | 367 | 535k | HIGHBD_DECL_SUFFIX) \ | 368 | 535k | { \ | 369 | 535k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 535k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 535k | } \ |
mc_tmpl.c:put_8tap_smooth_sharp_c Line | Count | Source | 367 | 2.07k | HIGHBD_DECL_SUFFIX) \ | 368 | 2.07k | { \ | 369 | 2.07k | put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \ | 370 | 2.07k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 371 | 2.07k | } \ |
|
372 | | static void put_8tap_##type##_scaled_c(pixel *const dst, \ |
373 | | const ptrdiff_t dst_stride, \ |
374 | | const pixel *const src, \ |
375 | | const ptrdiff_t src_stride, \ |
376 | | const int w, const int h, \ |
377 | | const int mx, const int my, \ |
378 | | const int dx, const int dy \ |
379 | 813k | HIGHBD_DECL_SUFFIX) \ |
380 | 813k | { \ |
381 | 813k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ |
382 | 813k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ |
383 | 813k | } \ mc_tmpl.c:put_8tap_regular_scaled_c Line | Count | Source | 379 | 585k | HIGHBD_DECL_SUFFIX) \ | 380 | 585k | { \ | 381 | 585k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 585k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 585k | } \ |
mc_tmpl.c:put_8tap_regular_smooth_scaled_c Line | Count | Source | 379 | 41.2k | HIGHBD_DECL_SUFFIX) \ | 380 | 41.2k | { \ | 381 | 41.2k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 41.2k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 41.2k | } \ |
mc_tmpl.c:put_8tap_regular_sharp_scaled_c Line | Count | Source | 379 | 6.62k | HIGHBD_DECL_SUFFIX) \ | 380 | 6.62k | { \ | 381 | 6.62k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 6.62k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 6.62k | } \ |
mc_tmpl.c:put_8tap_sharp_regular_scaled_c Line | Count | Source | 379 | 14.9k | HIGHBD_DECL_SUFFIX) \ | 380 | 14.9k | { \ | 381 | 14.9k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 14.9k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 14.9k | } \ |
mc_tmpl.c:put_8tap_sharp_smooth_scaled_c Line | Count | Source | 379 | 4.31k | HIGHBD_DECL_SUFFIX) \ | 380 | 4.31k | { \ | 381 | 4.31k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 4.31k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 4.31k | } \ |
mc_tmpl.c:put_8tap_sharp_scaled_c Line | Count | Source | 379 | 45.2k | HIGHBD_DECL_SUFFIX) \ | 380 | 45.2k | { \ | 381 | 45.2k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 45.2k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 45.2k | } \ |
mc_tmpl.c:put_8tap_smooth_regular_scaled_c Line | Count | Source | 379 | 52.8k | HIGHBD_DECL_SUFFIX) \ | 380 | 52.8k | { \ | 381 | 52.8k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 52.8k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 52.8k | } \ |
mc_tmpl.c:put_8tap_smooth_scaled_c Line | Count | Source | 379 | 58.6k | HIGHBD_DECL_SUFFIX) \ | 380 | 58.6k | { \ | 381 | 58.6k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 58.6k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 58.6k | } \ |
mc_tmpl.c:put_8tap_smooth_sharp_scaled_c Line | Count | Source | 379 | 4.29k | HIGHBD_DECL_SUFFIX) \ | 380 | 4.29k | { \ | 381 | 4.29k | put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \ | 382 | 4.29k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 383 | 4.29k | } \ |
|
384 | | static void prep_8tap_##type##_c(int16_t *const tmp, \ |
385 | | const pixel *const src, \ |
386 | | const ptrdiff_t src_stride, \ |
387 | | const int w, const int h, \ |
388 | | const int mx, const int my \ |
389 | 312k | HIGHBD_DECL_SUFFIX) \ |
390 | 312k | { \ |
391 | 312k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ |
392 | 312k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ |
393 | 312k | } \ mc_tmpl.c:prep_8tap_regular_c Line | Count | Source | 389 | 139k | HIGHBD_DECL_SUFFIX) \ | 390 | 139k | { \ | 391 | 139k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 139k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 139k | } \ |
mc_tmpl.c:prep_8tap_regular_smooth_c Line | Count | Source | 389 | 2.72k | HIGHBD_DECL_SUFFIX) \ | 390 | 2.72k | { \ | 391 | 2.72k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 2.72k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 2.72k | } \ |
mc_tmpl.c:prep_8tap_regular_sharp_c Line | Count | Source | 389 | 4.62k | HIGHBD_DECL_SUFFIX) \ | 390 | 4.62k | { \ | 391 | 4.62k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 4.62k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 4.62k | } \ |
mc_tmpl.c:prep_8tap_sharp_regular_c Line | Count | Source | 389 | 8.05k | HIGHBD_DECL_SUFFIX) \ | 390 | 8.05k | { \ | 391 | 8.05k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 8.05k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 8.05k | } \ |
mc_tmpl.c:prep_8tap_sharp_smooth_c Line | Count | Source | 389 | 2.63k | HIGHBD_DECL_SUFFIX) \ | 390 | 2.63k | { \ | 391 | 2.63k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 2.63k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 2.63k | } \ |
mc_tmpl.c:prep_8tap_sharp_c Line | Count | Source | 389 | 31.0k | HIGHBD_DECL_SUFFIX) \ | 390 | 31.0k | { \ | 391 | 31.0k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 31.0k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 31.0k | } \ |
mc_tmpl.c:prep_8tap_smooth_regular_c Line | Count | Source | 389 | 3.35k | HIGHBD_DECL_SUFFIX) \ | 390 | 3.35k | { \ | 391 | 3.35k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 3.35k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 3.35k | } \ |
mc_tmpl.c:prep_8tap_smooth_c Line | Count | Source | 389 | 117k | HIGHBD_DECL_SUFFIX) \ | 390 | 117k | { \ | 391 | 117k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 117k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 117k | } \ |
mc_tmpl.c:prep_8tap_smooth_sharp_c Line | Count | Source | 389 | 2.78k | HIGHBD_DECL_SUFFIX) \ | 390 | 2.78k | { \ | 391 | 2.78k | prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \ | 392 | 2.78k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 393 | 2.78k | } \ |
|
394 | | static void prep_8tap_##type##_scaled_c(int16_t *const tmp, \ |
395 | | const pixel *const src, \ |
396 | | const ptrdiff_t src_stride, \ |
397 | | const int w, const int h, \ |
398 | | const int mx, const int my, \ |
399 | | const int dx, const int dy \ |
400 | 356k | HIGHBD_DECL_SUFFIX) \ |
401 | 356k | { \ |
402 | 356k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ |
403 | 356k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ |
404 | 356k | } mc_tmpl.c:prep_8tap_regular_scaled_c Line | Count | Source | 400 | 170k | HIGHBD_DECL_SUFFIX) \ | 401 | 170k | { \ | 402 | 170k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 170k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 170k | } |
mc_tmpl.c:prep_8tap_regular_smooth_scaled_c Line | Count | Source | 400 | 13.2k | HIGHBD_DECL_SUFFIX) \ | 401 | 13.2k | { \ | 402 | 13.2k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 13.2k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 13.2k | } |
mc_tmpl.c:prep_8tap_regular_sharp_scaled_c Line | Count | Source | 400 | 17.0k | HIGHBD_DECL_SUFFIX) \ | 401 | 17.0k | { \ | 402 | 17.0k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 17.0k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 17.0k | } |
mc_tmpl.c:prep_8tap_sharp_regular_scaled_c Line | Count | Source | 400 | 42.1k | HIGHBD_DECL_SUFFIX) \ | 401 | 42.1k | { \ | 402 | 42.1k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 42.1k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 42.1k | } |
mc_tmpl.c:prep_8tap_sharp_smooth_scaled_c Line | Count | Source | 400 | 7.24k | HIGHBD_DECL_SUFFIX) \ | 401 | 7.24k | { \ | 402 | 7.24k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 7.24k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 7.24k | } |
mc_tmpl.c:prep_8tap_sharp_scaled_c Line | Count | Source | 400 | 26.0k | HIGHBD_DECL_SUFFIX) \ | 401 | 26.0k | { \ | 402 | 26.0k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 26.0k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 26.0k | } |
mc_tmpl.c:prep_8tap_smooth_regular_scaled_c Line | Count | Source | 400 | 30.8k | HIGHBD_DECL_SUFFIX) \ | 401 | 30.8k | { \ | 402 | 30.8k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 30.8k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 30.8k | } |
mc_tmpl.c:prep_8tap_smooth_scaled_c Line | Count | Source | 400 | 38.8k | HIGHBD_DECL_SUFFIX) \ | 401 | 38.8k | { \ | 402 | 38.8k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 38.8k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 38.8k | } |
mc_tmpl.c:prep_8tap_smooth_sharp_scaled_c Line | Count | Source | 400 | 10.2k | HIGHBD_DECL_SUFFIX) \ | 401 | 10.2k | { \ | 402 | 10.2k | prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \ | 403 | 10.2k | type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \ | 404 | 10.2k | } |
|
405 | | |
406 | | filter_fns(regular, DAV1D_FILTER_8TAP_REGULAR, DAV1D_FILTER_8TAP_REGULAR) |
407 | | filter_fns(regular_sharp, DAV1D_FILTER_8TAP_REGULAR, DAV1D_FILTER_8TAP_SHARP) |
408 | | filter_fns(regular_smooth, DAV1D_FILTER_8TAP_REGULAR, DAV1D_FILTER_8TAP_SMOOTH) |
409 | | filter_fns(smooth, DAV1D_FILTER_8TAP_SMOOTH, DAV1D_FILTER_8TAP_SMOOTH) |
410 | | filter_fns(smooth_regular, DAV1D_FILTER_8TAP_SMOOTH, DAV1D_FILTER_8TAP_REGULAR) |
411 | | filter_fns(smooth_sharp, DAV1D_FILTER_8TAP_SMOOTH, DAV1D_FILTER_8TAP_SHARP) |
412 | | filter_fns(sharp, DAV1D_FILTER_8TAP_SHARP, DAV1D_FILTER_8TAP_SHARP) |
413 | | filter_fns(sharp_regular, DAV1D_FILTER_8TAP_SHARP, DAV1D_FILTER_8TAP_REGULAR) |
414 | | filter_fns(sharp_smooth, DAV1D_FILTER_8TAP_SHARP, DAV1D_FILTER_8TAP_SMOOTH) |
415 | | |
416 | | #define FILTER_BILIN(src, x, mxy, stride) \ |
417 | 79.9M | (16 * src[x] + ((mxy) * (src[x + stride] - src[x]))) |
418 | | |
419 | | #define FILTER_BILIN_RND(src, x, mxy, stride, sh) \ |
420 | 79.9M | ((FILTER_BILIN(src, x, mxy, stride) + ((1 << (sh)) >> 1)) >> (sh)) |
421 | | |
422 | | #define FILTER_BILIN_CLIP(src, x, mxy, stride, sh) \ |
423 | 4.94M | iclip_pixel(FILTER_BILIN_RND(src, x, mxy, stride, sh)) |
424 | | |
425 | | #define FILTER_BILIN2(src1, src2, x, mxy) \ |
426 | 113M | (16 * src1[x] + ((mxy) * (src2[x] - src1[x]))) |
427 | | |
428 | | #define FILTER_BILIN_RND2(src1, src2, x, mxy, sh) \ |
429 | 113M | ((FILTER_BILIN2(src1, src2, x, mxy) + ((1 << (sh)) >> 1)) >> (sh)) |
430 | | |
431 | | #define FILTER_BILIN_CLIP2(src1, src2, x, mxy, sh) \ |
432 | 79.6M | iclip_pixel(FILTER_BILIN_RND2(src1, src2, x, mxy, sh)) |
433 | | |
434 | | static void put_bilin_c(pixel *dst, ptrdiff_t dst_stride, |
435 | | const pixel *src, ptrdiff_t src_stride, |
436 | | const int w, int h, const int mx, const int my |
437 | | HIGHBD_DECL_SUFFIX) |
438 | 344k | { |
439 | 344k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
440 | 344k | const int intermediate_rnd = (1 << intermediate_bits) >> 1; |
441 | 344k | dst_stride = PXSTRIDE(dst_stride); |
442 | 344k | src_stride = PXSTRIDE(src_stride); |
443 | | |
444 | 344k | if (mx) { |
445 | 45.5k | if (my) { |
446 | 24.2k | int16_t mid[128 * 129], *mid_ptr = mid; |
447 | 24.2k | int tmp_h = h + 1; |
448 | | |
449 | 218k | do { |
450 | 3.27M | for (int x = 0; x < w; x++) |
451 | 3.05M | mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1, |
452 | 218k | 4 - intermediate_bits); |
453 | | |
454 | 218k | mid_ptr += 128; |
455 | 218k | src += src_stride; |
456 | 218k | } while (--tmp_h); |
457 | | |
458 | 24.2k | mid_ptr = mid; |
459 | 193k | do { |
460 | 3.07M | for (int x = 0; x < w; x++) |
461 | 2.88M | dst[x] = FILTER_BILIN_CLIP(mid_ptr, x, my, 128, |
462 | 193k | 4 + intermediate_bits); |
463 | | |
464 | 193k | mid_ptr += 128; |
465 | 193k | dst += dst_stride; |
466 | 193k | } while (--h); |
467 | 24.2k | } else { |
468 | 208k | do { |
469 | 5.04M | for (int x = 0; x < w; x++) { |
470 | 4.83M | const int px = FILTER_BILIN_RND(src, x, mx, 1, |
471 | 4.83M | 4 - intermediate_bits); |
472 | 4.83M | dst[x] = iclip_pixel((px + intermediate_rnd) >> intermediate_bits); |
473 | 4.83M | } |
474 | | |
475 | 208k | dst += dst_stride; |
476 | 208k | src += src_stride; |
477 | 208k | } while (--h); |
478 | 21.3k | } |
479 | 298k | } else if (my) { |
480 | 135k | do { |
481 | 2.20M | for (int x = 0; x < w; x++) |
482 | 2.06M | dst[x] = FILTER_BILIN_CLIP(src, x, my, src_stride, 4); |
483 | | |
484 | 135k | dst += dst_stride; |
485 | 135k | src += src_stride; |
486 | 135k | } while (--h); |
487 | 16.2k | } else |
488 | 282k | put_c(dst, dst_stride, src, src_stride, w, h); |
489 | 344k | } |
490 | | |
491 | | static void put_bilin_scaled_c(pixel *dst, ptrdiff_t dst_stride, |
492 | | const pixel *src, ptrdiff_t src_stride, |
493 | | const int w, int h, const int mx, int my, |
494 | | const int dx, const int dy |
495 | | HIGHBD_DECL_SUFFIX) |
496 | 506k | { |
497 | 506k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
498 | 506k | int16_t mid[128 * 2]; |
499 | 506k | int in_y = -2; |
500 | | |
501 | 4.70M | do { |
502 | 4.70M | int x; |
503 | 4.70M | int y = my >> 10; |
504 | 4.70M | int16_t *mid1 = &mid[(y & 1) * 128]; |
505 | 4.70M | int16_t *mid2 = &mid[((y + 1) & 1) * 128]; |
506 | 4.70M | int dmy = my & 0x3ff; |
507 | | |
508 | 6.67M | while (in_y < y) { |
509 | 1.96M | int imx = mx, ioff = 0; |
510 | 1.96M | int16_t *mid_ptr = &mid[(in_y & 1) * 128]; |
511 | | |
512 | 47.5M | for (x = 0; x < w; x++) { |
513 | 45.5M | mid_ptr[x] = FILTER_BILIN_RND(src, ioff, imx >> 6, 1, |
514 | 45.5M | 4 - intermediate_bits); |
515 | 45.5M | imx += dx; |
516 | 45.5M | ioff += imx >> 10; |
517 | 45.5M | imx &= 0x3ff; |
518 | 45.5M | } |
519 | | |
520 | 1.96M | src += PXSTRIDE(src_stride); |
521 | 1.96M | in_y++; |
522 | 1.96M | } |
523 | | |
524 | 84.3M | for (x = 0; x < w; x++) |
525 | 79.6M | dst[x] = FILTER_BILIN_CLIP2(mid1, mid2, x, dmy >> 6, |
526 | 4.70M | 4 + intermediate_bits); |
527 | | |
528 | 4.70M | my += dy; |
529 | 4.70M | dst += PXSTRIDE(dst_stride); |
530 | 4.70M | } while (--h); |
531 | 506k | } |
532 | | |
533 | | static void prep_bilin_c(int16_t *tmp, |
534 | | const pixel *src, ptrdiff_t src_stride, |
535 | | const int w, int h, const int mx, const int my |
536 | | HIGHBD_DECL_SUFFIX) |
537 | 31.7k | { |
538 | 31.7k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
539 | 31.7k | src_stride = PXSTRIDE(src_stride); |
540 | | |
541 | 31.7k | if (mx) { |
542 | 15.1k | if (my) { |
543 | 9.49k | int16_t mid[128 * 129], *mid_ptr = mid; |
544 | 9.49k | int tmp_h = h + 1; |
545 | | |
546 | 137k | do { |
547 | 2.63M | for (int x = 0; x < w; x++) |
548 | 2.49M | mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1, |
549 | 137k | 4 - intermediate_bits); |
550 | | |
551 | 137k | mid_ptr += 128; |
552 | 137k | src += src_stride; |
553 | 137k | } while (--tmp_h); |
554 | | |
555 | 9.49k | mid_ptr = mid; |
556 | 129k | do { |
557 | 2.55M | for (int x = 0; x < w; x++) |
558 | 2.42M | tmp[x] = FILTER_BILIN_RND(mid_ptr, x, my, 128, 4) - |
559 | 2.42M | PREP_BIAS; |
560 | | |
561 | 129k | mid_ptr += 128; |
562 | 129k | tmp += w; |
563 | 129k | } while (--h); |
564 | 9.49k | } else { |
565 | 85.7k | do { |
566 | 1.96M | for (int x = 0; x < w; x++) |
567 | 1.87M | tmp[x] = FILTER_BILIN_RND(src, x, mx, 1, |
568 | 1.87M | 4 - intermediate_bits) - |
569 | 1.87M | PREP_BIAS; |
570 | | |
571 | 85.7k | tmp += w; |
572 | 85.7k | src += src_stride; |
573 | 85.7k | } while (--h); |
574 | 5.60k | } |
575 | 16.6k | } else if (my) { |
576 | 88.4k | do { |
577 | 2.10M | for (int x = 0; x < w; x++) |
578 | 2.02M | tmp[x] = FILTER_BILIN_RND(src, x, my, src_stride, |
579 | 2.02M | 4 - intermediate_bits) - PREP_BIAS; |
580 | | |
581 | 88.4k | tmp += w; |
582 | 88.4k | src += src_stride; |
583 | 88.4k | } while (--h); |
584 | 5.54k | } else |
585 | 11.0k | prep_c(tmp, src, src_stride, w, h HIGHBD_TAIL_SUFFIX); |
586 | 31.7k | } |
587 | | |
588 | | static void prep_bilin_scaled_c(int16_t *tmp, |
589 | | const pixel *src, ptrdiff_t src_stride, |
590 | | const int w, int h, const int mx, int my, |
591 | | const int dx, const int dy HIGHBD_DECL_SUFFIX) |
592 | 152k | { |
593 | 152k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
594 | 152k | int16_t mid[128 * 2]; |
595 | 152k | int in_y = -2; |
596 | | |
597 | 1.99M | do { |
598 | 1.99M | int x; |
599 | 1.99M | int y = my >> 10; |
600 | 1.99M | int16_t *mid1 = &mid[(y & 1) * 128]; |
601 | 1.99M | int16_t *mid2 = &mid[((y + 1) & 1) * 128]; |
602 | 1.99M | int dmy = my & 0x3ff; |
603 | | |
604 | 2.62M | while (in_y < y) { |
605 | 631k | int imx = mx, ioff = 0; |
606 | 631k | int16_t *mid_ptr = &mid[(in_y & 1) * 128]; |
607 | | |
608 | 13.3M | for (x = 0; x < w; x++) { |
609 | 12.7M | mid_ptr[x] = FILTER_BILIN_RND(src, ioff, imx >> 6, 1, |
610 | 12.7M | 4 - intermediate_bits); |
611 | 12.7M | imx += dx; |
612 | 12.7M | ioff += imx >> 10; |
613 | 12.7M | imx &= 0x3ff; |
614 | 12.7M | } |
615 | | |
616 | 631k | src += PXSTRIDE(src_stride); |
617 | 631k | in_y++; |
618 | 631k | } |
619 | | |
620 | 35.6M | for (x = 0; x < w; x++) |
621 | 33.6M | tmp[x] = FILTER_BILIN_RND2(mid1, mid2, x, dmy >> 6, 4) - PREP_BIAS; |
622 | | |
623 | 1.99M | my += dy; |
624 | 1.99M | tmp += w; |
625 | 1.99M | } while (--h); |
626 | 152k | } |
627 | | |
628 | | static void avg_c(pixel *dst, const ptrdiff_t dst_stride, |
629 | | const int16_t *tmp1, const int16_t *tmp2, const int w, int h |
630 | | HIGHBD_DECL_SUFFIX) |
631 | 296k | { |
632 | 296k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
633 | 296k | const int sh = intermediate_bits + 1; |
634 | 296k | const int rnd = (1 << intermediate_bits) + PREP_BIAS * 2; |
635 | 5.57M | do { |
636 | 146M | for (int x = 0; x < w; x++) |
637 | 140M | dst[x] = iclip_pixel((tmp1[x] + tmp2[x] + rnd) >> sh); |
638 | | |
639 | 5.57M | tmp1 += w; |
640 | 5.57M | tmp2 += w; |
641 | 5.57M | dst += PXSTRIDE(dst_stride); |
642 | 5.57M | } while (--h); |
643 | 296k | } |
644 | | |
645 | | static void w_avg_c(pixel *dst, const ptrdiff_t dst_stride, |
646 | | const int16_t *tmp1, const int16_t *tmp2, const int w, int h, |
647 | | const int weight HIGHBD_DECL_SUFFIX) |
648 | 43.6k | { |
649 | 43.6k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
650 | 43.6k | const int sh = intermediate_bits + 4; |
651 | 43.6k | const int rnd = (8 << intermediate_bits) + PREP_BIAS * 16; |
652 | 819k | do { |
653 | 23.7M | for (int x = 0; x < w; x++) |
654 | 22.9M | dst[x] = iclip_pixel((tmp1[x] * weight + |
655 | 22.9M | tmp2[x] * (16 - weight) + rnd) >> sh); |
656 | | |
657 | 819k | tmp1 += w; |
658 | 819k | tmp2 += w; |
659 | 819k | dst += PXSTRIDE(dst_stride); |
660 | 819k | } while (--h); |
661 | 43.6k | } |
662 | | |
663 | | static void mask_c(pixel *dst, const ptrdiff_t dst_stride, |
664 | | const int16_t *tmp1, const int16_t *tmp2, const int w, int h, |
665 | | const uint8_t *mask HIGHBD_DECL_SUFFIX) |
666 | 73.5k | { |
667 | 73.5k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
668 | 73.5k | const int sh = intermediate_bits + 6; |
669 | 73.5k | const int rnd = (32 << intermediate_bits) + PREP_BIAS * 64; |
670 | 1.21M | do { |
671 | 27.9M | for (int x = 0; x < w; x++) |
672 | 26.7M | dst[x] = iclip_pixel((tmp1[x] * mask[x] + |
673 | 26.7M | tmp2[x] * (64 - mask[x]) + rnd) >> sh); |
674 | | |
675 | 1.21M | tmp1 += w; |
676 | 1.21M | tmp2 += w; |
677 | 1.21M | mask += w; |
678 | 1.21M | dst += PXSTRIDE(dst_stride); |
679 | 1.21M | } while (--h); |
680 | 73.5k | } |
681 | | |
682 | 43.7M | #define blend_px(a, b, m) (((a * (64 - m) + b * m) + 32) >> 6) |
683 | | static void blend_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp, |
684 | | const int w, int h, const uint8_t *mask) |
685 | 59.5k | { |
686 | 601k | do { |
687 | 7.95M | for (int x = 0; x < w; x++) { |
688 | 7.35M | dst[x] = blend_px(dst[x], tmp[x], mask[x]); |
689 | 7.35M | } |
690 | 601k | dst += PXSTRIDE(dst_stride); |
691 | 601k | tmp += w; |
692 | 601k | mask += w; |
693 | 601k | } while (--h); |
694 | 59.5k | } |
695 | | |
696 | | static void blend_v_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp, |
697 | | const int w, int h) |
698 | 279k | { |
699 | 279k | const uint8_t *const mask = &dav1d_obmc_masks[w]; |
700 | 3.04M | do { |
701 | 19.3M | for (int x = 0; x < (w * 3) >> 2; x++) { |
702 | 16.2M | dst[x] = blend_px(dst[x], tmp[x], mask[x]); |
703 | 16.2M | } |
704 | 3.04M | dst += PXSTRIDE(dst_stride); |
705 | 3.04M | tmp += w; |
706 | 3.04M | } while (--h); |
707 | 279k | } |
708 | | |
709 | | static void blend_h_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp, |
710 | | const int w, int h) |
711 | 289k | { |
712 | 289k | const uint8_t *mask = &dav1d_obmc_masks[h]; |
713 | 289k | h = (h * 3) >> 2; |
714 | 1.60M | do { |
715 | 1.60M | const int m = *mask++; |
716 | 21.7M | for (int x = 0; x < w; x++) { |
717 | 20.1M | dst[x] = blend_px(dst[x], tmp[x], m); |
718 | 20.1M | } |
719 | 1.60M | dst += PXSTRIDE(dst_stride); |
720 | 1.60M | tmp += w; |
721 | 1.60M | } while (--h); |
722 | 289k | } |
723 | | |
724 | | static void w_mask_c(pixel *dst, const ptrdiff_t dst_stride, |
725 | | const int16_t *tmp1, const int16_t *tmp2, const int w, int h, |
726 | | uint8_t *mask, const int sign, |
727 | | const int ss_hor, const int ss_ver HIGHBD_DECL_SUFFIX) |
728 | 22.4k | { |
729 | | // store mask at 2x2 resolution, i.e. store 2x1 sum for even rows, |
730 | | // and then load this intermediate to calculate final value for odd rows |
731 | 22.4k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
732 | 22.4k | const int bitdepth = bitdepth_from_max(bitdepth_max); |
733 | 22.4k | const int sh = intermediate_bits + 6; |
734 | 22.4k | const int rnd = (32 << intermediate_bits) + PREP_BIAS * 64; |
735 | 22.4k | const int mask_sh = bitdepth + intermediate_bits - 4; |
736 | 22.4k | const int mask_rnd = 1 << (mask_sh - 5); |
737 | 775k | do { |
738 | 19.0M | for (int x = 0; x < w; x++) { |
739 | 18.2M | const int tmpdiff = tmp1[x] - tmp2[x]; |
740 | 18.2M | const int m = imin(38 + ((abs(tmpdiff) + mask_rnd) >> mask_sh), 64); |
741 | 18.2M | dst[x] = iclip_pixel((tmpdiff * m + tmp2[x] * 64 + rnd) >> sh); |
742 | | |
743 | 18.2M | if (ss_hor) { |
744 | 10.2M | x++; |
745 | | |
746 | 10.2M | const int tmpdiff = tmp1[x] - tmp2[x]; |
747 | 10.2M | const int n = imin(38 + ((abs(tmpdiff) + mask_rnd) >> mask_sh), 64); |
748 | 10.2M | dst[x] = iclip_pixel((tmpdiff * n + tmp2[x] * 64 + rnd) >> sh); |
749 | | |
750 | 10.2M | if (h & ss_ver) { |
751 | 4.55M | mask[x >> 1] = (m + n + mask[x >> 1] + 2 - sign) >> 2; |
752 | 5.67M | } else if (ss_ver) { |
753 | 4.55M | mask[x >> 1] = m + n; |
754 | 4.55M | } else { |
755 | 1.12M | mask[x >> 1] = (m + n + 1 - sign) >> 1; |
756 | 1.12M | } |
757 | 10.2M | } else { |
758 | 8.03M | mask[x] = m; |
759 | 8.03M | } |
760 | 18.2M | } |
761 | | |
762 | 775k | tmp1 += w; |
763 | 775k | tmp2 += w; |
764 | 775k | dst += PXSTRIDE(dst_stride); |
765 | 775k | if (!ss_ver || (h & 1)) mask += w >> ss_hor; |
766 | 775k | } while (--h); |
767 | 22.4k | } |
768 | | |
769 | | #define w_mask_fns(ssn, ss_hor, ss_ver) \ |
770 | | static void w_mask_##ssn##_c(pixel *const dst, const ptrdiff_t dst_stride, \ |
771 | | const int16_t *const tmp1, const int16_t *const tmp2, \ |
772 | | const int w, const int h, uint8_t *mask, \ |
773 | 22.4k | const int sign HIGHBD_DECL_SUFFIX) \ |
774 | 22.4k | { \ |
775 | 22.4k | w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \ |
776 | 22.4k | HIGHBD_TAIL_SUFFIX); \ |
777 | 22.4k | } Line | Count | Source | 773 | 7.58k | const int sign HIGHBD_DECL_SUFFIX) \ | 774 | 7.58k | { \ | 775 | 7.58k | w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \ | 776 | 7.58k | HIGHBD_TAIL_SUFFIX); \ | 777 | 7.58k | } |
Line | Count | Source | 773 | 1.48k | const int sign HIGHBD_DECL_SUFFIX) \ | 774 | 1.48k | { \ | 775 | 1.48k | w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \ | 776 | 1.48k | HIGHBD_TAIL_SUFFIX); \ | 777 | 1.48k | } |
Line | Count | Source | 773 | 13.3k | const int sign HIGHBD_DECL_SUFFIX) \ | 774 | 13.3k | { \ | 775 | 13.3k | w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \ | 776 | 13.3k | HIGHBD_TAIL_SUFFIX); \ | 777 | 13.3k | } |
|
778 | | |
779 | | w_mask_fns(444, 0, 0); |
780 | | w_mask_fns(422, 1, 0); |
781 | | w_mask_fns(420, 1, 1); |
782 | | |
783 | | #undef w_mask_fns |
784 | | |
785 | | #define FILTER_WARP_RND(src, x, F, stride, sh) \ |
786 | 125M | ((F[0] * src[x - 3 * stride] + \ |
787 | 125M | F[1] * src[x - 2 * stride] + \ |
788 | 125M | F[2] * src[x - 1 * stride] + \ |
789 | 125M | F[3] * src[x + 0 * stride] + \ |
790 | 125M | F[4] * src[x + 1 * stride] + \ |
791 | 125M | F[5] * src[x + 2 * stride] + \ |
792 | 125M | F[6] * src[x + 3 * stride] + \ |
793 | 125M | F[7] * src[x + 4 * stride] + \ |
794 | 125M | ((1 << (sh)) >> 1)) >> (sh)) |
795 | | |
796 | | #define FILTER_WARP_CLIP(src, x, F, stride, sh) \ |
797 | 30.4M | iclip_pixel(FILTER_WARP_RND(src, x, F, stride, sh)) |
798 | | |
799 | | static void warp_affine_8x8_c(pixel *dst, const ptrdiff_t dst_stride, |
800 | | const pixel *src, const ptrdiff_t src_stride, |
801 | | const int16_t *const abcd, int mx, int my |
802 | | HIGHBD_DECL_SUFFIX) |
803 | 571k | { |
804 | 571k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
805 | 571k | int16_t mid[15 * 8], *mid_ptr = mid; |
806 | | |
807 | 571k | src -= 3 * PXSTRIDE(src_stride); |
808 | 8.92M | for (int y = 0; y < 15; y++, mx += abcd[1]) { |
809 | 72.8M | for (int x = 0, tmx = mx; x < 8; x++, tmx += abcd[0]) { |
810 | 64.5M | const int8_t *const filter = |
811 | 64.5M | dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)]; |
812 | | |
813 | 64.5M | mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1, |
814 | 64.5M | 7 - intermediate_bits); |
815 | 64.5M | } |
816 | 8.35M | src += PXSTRIDE(src_stride); |
817 | 8.35M | mid_ptr += 8; |
818 | 8.35M | } |
819 | | |
820 | 571k | mid_ptr = &mid[3 * 8]; |
821 | 4.43M | for (int y = 0; y < 8; y++, my += abcd[3]) { |
822 | 34.3M | for (int x = 0, tmy = my; x < 8; x++, tmy += abcd[2]) { |
823 | 30.4M | const int8_t *const filter = |
824 | 30.4M | dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)]; |
825 | | |
826 | 30.4M | dst[x] = FILTER_WARP_CLIP(mid_ptr, x, filter, 8, |
827 | 30.4M | 7 + intermediate_bits); |
828 | 30.4M | } |
829 | 3.86M | mid_ptr += 8; |
830 | 3.86M | dst += PXSTRIDE(dst_stride); |
831 | 3.86M | } |
832 | 571k | } |
833 | | |
834 | | static void warp_affine_8x8t_c(int16_t *tmp, const ptrdiff_t tmp_stride, |
835 | | const pixel *src, const ptrdiff_t src_stride, |
836 | | const int16_t *const abcd, int mx, int my |
837 | | HIGHBD_DECL_SUFFIX) |
838 | 165k | { |
839 | 165k | const int intermediate_bits = get_intermediate_bits(bitdepth_max); |
840 | 165k | int16_t mid[15 * 8], *mid_ptr = mid; |
841 | | |
842 | 165k | src -= 3 * PXSTRIDE(src_stride); |
843 | 2.62M | for (int y = 0; y < 15; y++, mx += abcd[1]) { |
844 | 22.1M | for (int x = 0, tmx = mx; x < 8; x++, tmx += abcd[0]) { |
845 | 19.6M | const int8_t *const filter = |
846 | 19.6M | dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)]; |
847 | | |
848 | 19.6M | mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1, |
849 | 19.6M | 7 - intermediate_bits); |
850 | 19.6M | } |
851 | 2.46M | src += PXSTRIDE(src_stride); |
852 | 2.46M | mid_ptr += 8; |
853 | 2.46M | } |
854 | | |
855 | 165k | mid_ptr = &mid[3 * 8]; |
856 | 1.48M | for (int y = 0; y < 8; y++, my += abcd[3]) { |
857 | 11.8M | for (int x = 0, tmy = my; x < 8; x++, tmy += abcd[2]) { |
858 | 10.5M | const int8_t *const filter = |
859 | 10.5M | dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)]; |
860 | | |
861 | 10.5M | tmp[x] = FILTER_WARP_RND(mid_ptr, x, filter, 8, 7) - PREP_BIAS; |
862 | 10.5M | } |
863 | 1.31M | mid_ptr += 8; |
864 | 1.31M | tmp += tmp_stride; |
865 | 1.31M | } |
866 | 165k | } |
867 | | |
868 | | static void emu_edge_c(const intptr_t bw, const intptr_t bh, |
869 | | const intptr_t iw, const intptr_t ih, |
870 | | const intptr_t x, const intptr_t y, |
871 | | pixel *dst, const ptrdiff_t dst_stride, |
872 | | const pixel *ref, const ptrdiff_t ref_stride) |
873 | 3.13M | { |
874 | | // find offset in reference of visible block to copy |
875 | 3.13M | ref += iclip((int) y, 0, (int) ih - 1) * PXSTRIDE(ref_stride) + |
876 | 3.13M | iclip((int) x, 0, (int) iw - 1); |
877 | | |
878 | | // number of pixels to extend (left, right, top, bottom) |
879 | 3.13M | const int left_ext = iclip((int) -x, 0, (int) bw - 1); |
880 | 3.13M | const int right_ext = iclip((int) (x + bw - iw), 0, (int) bw - 1); |
881 | 3.13M | assert(left_ext + right_ext < bw); |
882 | 3.13M | const int top_ext = iclip((int) -y, 0, (int) bh - 1); |
883 | 3.13M | const int bottom_ext = iclip((int) (y + bh - ih), 0, (int) bh - 1); |
884 | 3.13M | assert(top_ext + bottom_ext < bh); |
885 | | |
886 | | // copy visible portion first |
887 | 3.13M | pixel *blk = dst + top_ext * PXSTRIDE(dst_stride); |
888 | 3.13M | const int center_w = (int) (bw - left_ext - right_ext); |
889 | 3.13M | const int center_h = (int) (bh - top_ext - bottom_ext); |
890 | 43.0M | for (int y = 0; y < center_h; y++) { |
891 | 39.9M | pixel_copy(blk + left_ext, ref, center_w); |
892 | | // extend left edge for this line |
893 | 39.9M | if (left_ext) |
894 | 10.0M | pixel_set(blk, blk[left_ext], left_ext); |
895 | | // extend right edge for this line |
896 | 39.9M | if (right_ext) |
897 | 31.0M | pixel_set(blk + left_ext + center_w, blk[left_ext + center_w - 1], |
898 | 31.0M | right_ext); |
899 | 39.9M | ref += PXSTRIDE(ref_stride); |
900 | 39.9M | blk += PXSTRIDE(dst_stride); |
901 | 39.9M | } |
902 | | |
903 | | // copy top |
904 | 3.13M | blk = dst + top_ext * PXSTRIDE(dst_stride); |
905 | 6.24M | for (int y = 0; y < top_ext; y++) { |
906 | 3.10M | pixel_copy(dst, blk, bw); |
907 | 3.10M | dst += PXSTRIDE(dst_stride); |
908 | 3.10M | } |
909 | | |
910 | | // copy bottom |
911 | 3.13M | dst += center_h * PXSTRIDE(dst_stride); |
912 | 12.7M | for (int y = 0; y < bottom_ext; y++) { |
913 | 9.65M | pixel_copy(dst, &dst[-PXSTRIDE(dst_stride)], bw); |
914 | 9.65M | dst += PXSTRIDE(dst_stride); |
915 | 9.65M | } |
916 | 3.13M | } |
917 | | |
918 | | static void resize_c(pixel *dst, const ptrdiff_t dst_stride, |
919 | | const pixel *src, const ptrdiff_t src_stride, |
920 | | const int dst_w, int h, const int src_w, |
921 | | const int dx, const int mx0 HIGHBD_DECL_SUFFIX) |
922 | 302k | { |
923 | 9.11M | do { |
924 | 9.11M | int mx = mx0, src_x = -1; |
925 | 702M | for (int x = 0; x < dst_w; x++) { |
926 | 693M | const int8_t *const F = dav1d_resize_filter[mx >> 8]; |
927 | 693M | dst[x] = iclip_pixel((-(F[0] * src[iclip(src_x - 3, 0, src_w - 1)] + |
928 | 693M | F[1] * src[iclip(src_x - 2, 0, src_w - 1)] + |
929 | 693M | F[2] * src[iclip(src_x - 1, 0, src_w - 1)] + |
930 | 693M | F[3] * src[iclip(src_x + 0, 0, src_w - 1)] + |
931 | 693M | F[4] * src[iclip(src_x + 1, 0, src_w - 1)] + |
932 | 693M | F[5] * src[iclip(src_x + 2, 0, src_w - 1)] + |
933 | 693M | F[6] * src[iclip(src_x + 3, 0, src_w - 1)] + |
934 | 693M | F[7] * src[iclip(src_x + 4, 0, src_w - 1)]) + |
935 | 693M | 64) >> 7); |
936 | 693M | mx += dx; |
937 | 693M | src_x += mx >> 14; |
938 | 693M | mx &= 0x3fff; |
939 | 693M | } |
940 | | |
941 | 9.11M | dst += PXSTRIDE(dst_stride); |
942 | 9.11M | src += PXSTRIDE(src_stride); |
943 | 9.11M | } while (--h); |
944 | 302k | } |
945 | | |
946 | | #if HAVE_ASM |
947 | | #if ARCH_AARCH64 || ARCH_ARM |
948 | | #include "src/arm/mc.h" |
949 | | #elif ARCH_LOONGARCH64 |
950 | | #include "src/loongarch/mc.h" |
951 | | #elif ARCH_PPC64LE |
952 | | #include "src/ppc/mc.h" |
953 | | #elif ARCH_RISCV |
954 | | #include "src/riscv/mc.h" |
955 | | #elif ARCH_X86 |
956 | | #include "src/x86/mc.h" |
957 | | #endif |
958 | | #endif |
959 | | |
960 | 87.5k | COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) { |
961 | 875k | #define init_mc_fns(type, name) do { \ |
962 | 875k | c->mc [type] = put_##name##_c; \ |
963 | 875k | c->mc_scaled [type] = put_##name##_scaled_c; \ |
964 | 875k | c->mct [type] = prep_##name##_c; \ |
965 | 875k | c->mct_scaled[type] = prep_##name##_scaled_c; \ |
966 | 875k | } while (0) |
967 | | |
968 | 87.5k | init_mc_fns(FILTER_2D_8TAP_REGULAR, 8tap_regular); |
969 | 87.5k | init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth); |
970 | 87.5k | init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP, 8tap_regular_sharp); |
971 | 87.5k | init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR, 8tap_sharp_regular); |
972 | 87.5k | init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH, 8tap_sharp_smooth); |
973 | 87.5k | init_mc_fns(FILTER_2D_8TAP_SHARP, 8tap_sharp); |
974 | 87.5k | init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular); |
975 | 87.5k | init_mc_fns(FILTER_2D_8TAP_SMOOTH, 8tap_smooth); |
976 | 87.5k | init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP, 8tap_smooth_sharp); |
977 | 87.5k | init_mc_fns(FILTER_2D_BILINEAR, bilin); |
978 | | |
979 | 87.5k | c->avg = avg_c; |
980 | 87.5k | c->w_avg = w_avg_c; |
981 | 87.5k | c->mask = mask_c; |
982 | 87.5k | c->blend = blend_c; |
983 | 87.5k | c->blend_v = blend_v_c; |
984 | 87.5k | c->blend_h = blend_h_c; |
985 | 87.5k | c->w_mask[0] = w_mask_444_c; |
986 | 87.5k | c->w_mask[1] = w_mask_422_c; |
987 | 87.5k | c->w_mask[2] = w_mask_420_c; |
988 | 87.5k | c->warp8x8 = warp_affine_8x8_c; |
989 | 87.5k | c->warp8x8t = warp_affine_8x8t_c; |
990 | 87.5k | c->emu_edge = emu_edge_c; |
991 | 87.5k | c->resize = resize_c; |
992 | | |
993 | | #if HAVE_ASM |
994 | | #if ARCH_AARCH64 || ARCH_ARM |
995 | | mc_dsp_init_arm(c); |
996 | | #elif ARCH_LOONGARCH64 |
997 | | mc_dsp_init_loongarch(c); |
998 | | #elif ARCH_PPC64LE |
999 | | mc_dsp_init_ppc(c); |
1000 | | #elif ARCH_RISCV |
1001 | | mc_dsp_init_riscv(c); |
1002 | | #elif ARCH_X86 |
1003 | | mc_dsp_init_x86(c); |
1004 | | #endif |
1005 | | #endif |
1006 | 87.5k | } Line | Count | Source | 960 | 39.7k | COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) { | 961 | 39.7k | #define init_mc_fns(type, name) do { \ | 962 | 39.7k | c->mc [type] = put_##name##_c; \ | 963 | 39.7k | c->mc_scaled [type] = put_##name##_scaled_c; \ | 964 | 39.7k | c->mct [type] = prep_##name##_c; \ | 965 | 39.7k | c->mct_scaled[type] = prep_##name##_scaled_c; \ | 966 | 39.7k | } while (0) | 967 | | | 968 | 39.7k | init_mc_fns(FILTER_2D_8TAP_REGULAR, 8tap_regular); | 969 | 39.7k | init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth); | 970 | 39.7k | init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP, 8tap_regular_sharp); | 971 | 39.7k | init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR, 8tap_sharp_regular); | 972 | 39.7k | init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH, 8tap_sharp_smooth); | 973 | 39.7k | init_mc_fns(FILTER_2D_8TAP_SHARP, 8tap_sharp); | 974 | 39.7k | init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular); | 975 | 39.7k | init_mc_fns(FILTER_2D_8TAP_SMOOTH, 8tap_smooth); | 976 | 39.7k | init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP, 8tap_smooth_sharp); | 977 | 39.7k | init_mc_fns(FILTER_2D_BILINEAR, bilin); | 978 | | | 979 | 39.7k | c->avg = avg_c; | 980 | 39.7k | c->w_avg = w_avg_c; | 981 | 39.7k | c->mask = mask_c; | 982 | 39.7k | c->blend = blend_c; | 983 | 39.7k | c->blend_v = blend_v_c; | 984 | 39.7k | c->blend_h = blend_h_c; | 985 | 39.7k | c->w_mask[0] = w_mask_444_c; | 986 | 39.7k | c->w_mask[1] = w_mask_422_c; | 987 | 39.7k | c->w_mask[2] = w_mask_420_c; | 988 | 39.7k | c->warp8x8 = warp_affine_8x8_c; | 989 | 39.7k | c->warp8x8t = warp_affine_8x8t_c; | 990 | 39.7k | c->emu_edge = emu_edge_c; | 991 | 39.7k | c->resize = resize_c; | 992 | | | 993 | | #if HAVE_ASM | 994 | | #if ARCH_AARCH64 || ARCH_ARM | 995 | | mc_dsp_init_arm(c); | 996 | | #elif ARCH_LOONGARCH64 | 997 | | mc_dsp_init_loongarch(c); | 998 | | #elif ARCH_PPC64LE | 999 | | mc_dsp_init_ppc(c); | 1000 | | #elif ARCH_RISCV | 1001 | | mc_dsp_init_riscv(c); | 1002 | | #elif ARCH_X86 | 1003 | | mc_dsp_init_x86(c); | 1004 | | #endif | 1005 | | #endif | 1006 | 39.7k | } |
Line | Count | Source | 960 | 47.7k | COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) { | 961 | 47.7k | #define init_mc_fns(type, name) do { \ | 962 | 47.7k | c->mc [type] = put_##name##_c; \ | 963 | 47.7k | c->mc_scaled [type] = put_##name##_scaled_c; \ | 964 | 47.7k | c->mct [type] = prep_##name##_c; \ | 965 | 47.7k | c->mct_scaled[type] = prep_##name##_scaled_c; \ | 966 | 47.7k | } while (0) | 967 | | | 968 | 47.7k | init_mc_fns(FILTER_2D_8TAP_REGULAR, 8tap_regular); | 969 | 47.7k | init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth); | 970 | 47.7k | init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP, 8tap_regular_sharp); | 971 | 47.7k | init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR, 8tap_sharp_regular); | 972 | 47.7k | init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH, 8tap_sharp_smooth); | 973 | 47.7k | init_mc_fns(FILTER_2D_8TAP_SHARP, 8tap_sharp); | 974 | 47.7k | init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular); | 975 | 47.7k | init_mc_fns(FILTER_2D_8TAP_SMOOTH, 8tap_smooth); | 976 | 47.7k | init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP, 8tap_smooth_sharp); | 977 | 47.7k | init_mc_fns(FILTER_2D_BILINEAR, bilin); | 978 | | | 979 | 47.7k | c->avg = avg_c; | 980 | 47.7k | c->w_avg = w_avg_c; | 981 | 47.7k | c->mask = mask_c; | 982 | 47.7k | c->blend = blend_c; | 983 | 47.7k | c->blend_v = blend_v_c; | 984 | 47.7k | c->blend_h = blend_h_c; | 985 | 47.7k | c->w_mask[0] = w_mask_444_c; | 986 | 47.7k | c->w_mask[1] = w_mask_422_c; | 987 | 47.7k | c->w_mask[2] = w_mask_420_c; | 988 | 47.7k | c->warp8x8 = warp_affine_8x8_c; | 989 | 47.7k | c->warp8x8t = warp_affine_8x8t_c; | 990 | 47.7k | c->emu_edge = emu_edge_c; | 991 | 47.7k | c->resize = resize_c; | 992 | | | 993 | | #if HAVE_ASM | 994 | | #if ARCH_AARCH64 || ARCH_ARM | 995 | | mc_dsp_init_arm(c); | 996 | | #elif ARCH_LOONGARCH64 | 997 | | mc_dsp_init_loongarch(c); | 998 | | #elif ARCH_PPC64LE | 999 | | mc_dsp_init_ppc(c); | 1000 | | #elif ARCH_RISCV | 1001 | | mc_dsp_init_riscv(c); | 1002 | | #elif ARCH_X86 | 1003 | | mc_dsp_init_x86(c); | 1004 | | #endif | 1005 | | #endif | 1006 | 47.7k | } |
|