Coverage Report

Created: 2026-09-02 06:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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
1.79M
#define get_intermediate_bits(bitdepth_max) 4
41
// Output in interval [-5132, 9212], fits in int16_t as is
42
110M
#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
520k
{
55
7.76M
    do {
56
7.76M
        pixel_copy(dst, src, w);
57
58
7.76M
        dst += dst_stride;
59
7.76M
        src += src_stride;
60
7.76M
    } while (--h);
61
520k
}
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
86.6k
{
67
86.6k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
68
1.93M
    do {
69
40.7M
        for (int x = 0; x < w; x++)
70
38.8M
            tmp[x] = (src[x] << intermediate_bits) - PREP_BIAS;
71
72
1.93M
        tmp += w;
73
1.93M
        src += src_stride;
74
1.93M
    } while (--h);
75
86.6k
}
76
77
#define FILTER_8TAP(src, x, F, stride) \
78
218M
    (F[0] * src[x + -3 * stride] + \
79
218M
     F[1] * src[x + -2 * stride] + \
80
218M
     F[2] * src[x + -1 * stride] + \
81
218M
     F[3] * src[x + +0 * stride] + \
82
218M
     F[4] * src[x + +1 * stride] + \
83
218M
     F[5] * src[x + +2 * stride] + \
84
218M
     F[6] * src[x + +3 * stride] + \
85
218M
     F[7] * src[x + +4 * stride])
86
87
#define FILTER_8TAP2(src, x, F) \
88
81.0M
    (F[0] * src[0][x] + \
89
81.0M
     F[1] * src[1][x] + \
90
81.0M
     F[2] * src[2][x] + \
91
81.0M
     F[3] * src[3][x] + \
92
81.0M
     F[4] * src[4][x] + \
93
81.0M
     F[5] * src[5][x] + \
94
81.0M
     F[6] * src[6][x] + \
95
81.0M
     F[7] * src[7][x])
96
97
#define DAV1D_FILTER_8TAP_RND(src, x, F, stride, sh) \
98
214M
    ((FILTER_8TAP(src, x, F, stride) + ((1 << (sh)) >> 1)) >> (sh))
99
100
#define DAV1D_FILTER_8TAP_RND2(src, x, F, stride, rnd, sh) \
101
4.26M
    ((FILTER_8TAP(src, x, F, stride) + (rnd)) >> (sh))
102
103
#define DAV1D_FILTER_8TAP_RND3(src, x, F, sh) \
104
81.0M
    ((FILTER_8TAP2(src, x, F) + ((1 << (sh)) >> 1)) >> (sh))
105
106
#define DAV1D_FILTER_8TAP_CLIP(src, x, F, stride, sh) \
107
22.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
4.26M
    iclip_pixel(DAV1D_FILTER_8TAP_RND2(src, x, F, stride, rnd, sh))
111
112
#define DAV1D_FILTER_8TAP_CLIP3(src, x, F, sh) \
113
57.2M
    iclip_pixel(DAV1D_FILTER_8TAP_RND3(src, x, F, sh))
114
115
#define GET_H_FILTER(mx) \
116
147M
    const int8_t *const fh = !(mx) ? NULL : w > 4 ? \
117
137M
        dav1d_mc_subpel_filters[filter_type & 3][(mx) - 1] : \
118
137M
        dav1d_mc_subpel_filters[3 + (filter_type & 1)][(mx) - 1]
119
120
#define GET_V_FILTER(my) \
121
4.93M
    const int8_t *const fv = !(my) ? NULL : h > 4 ? \
122
3.47M
        dav1d_mc_subpel_filters[filter_type >> 2][(my) - 1] : \
123
3.47M
        dav1d_mc_subpel_filters[3 + ((filter_type >> 2) & 1)][(my) - 1]
124
125
#define GET_FILTERS() \
126
722k
    GET_H_FILTER(mx); \
127
722k
    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
587k
{
135
587k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
136
587k
    const int intermediate_rnd = 32 + ((1 << (6 - intermediate_bits)) >> 1);
137
138
587k
    GET_FILTERS();
139
587k
    dst_stride = PXSTRIDE(dst_stride);
140
587k
    src_stride = PXSTRIDE(src_stride);
141
142
587k
    if (fh) {
143
123k
        if (fv) {
144
88.2k
            int tmp_h = h + 7;
145
88.2k
            int16_t mid[128 * 135], *mid_ptr = mid;
146
147
88.2k
            src -= src_stride * 3;
148
1.51M
            do {
149
21.4M
                for (int x = 0; x < w; x++)
150
19.9M
                    mid_ptr[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,
151
1.51M
                                                       6 - intermediate_bits);
152
153
1.51M
                mid_ptr += 128;
154
1.51M
                src += src_stride;
155
1.51M
            } while (--tmp_h);
156
157
88.2k
            mid_ptr = mid + 128 * 3;
158
897k
            do {
159
15.3M
                for (int x = 0; x < w; x++)
160
14.4M
                    dst[x] = DAV1D_FILTER_8TAP_CLIP(mid_ptr, x, fv, 128,
161
897k
                                                    6 + intermediate_bits);
162
163
897k
                mid_ptr += 128;
164
897k
                dst += dst_stride;
165
897k
            } while (--h);
166
88.2k
        } else {
167
306k
            do {
168
4.56M
                for (int x = 0; x < w; x++) {
169
4.26M
                    dst[x] = DAV1D_FILTER_8TAP_CLIP2(src, x, fh, 1,
170
4.26M
                                                     intermediate_rnd, 6);
171
4.26M
                }
172
173
306k
                dst += dst_stride;
174
306k
                src += src_stride;
175
306k
            } while (--h);
176
35.1k
        }
177
464k
    } else if (fv) {
178
520k
        do {
179
8.37M
            for (int x = 0; x < w; x++)
180
7.85M
                dst[x] = DAV1D_FILTER_8TAP_CLIP(src, x, fv, src_stride, 6);
181
182
520k
            dst += dst_stride;
183
520k
            src += src_stride;
184
520k
        } while (--h);
185
62.2k
    } else
186
401k
        put_c(dst, dst_stride, src, src_stride, w, h);
187
587k
}
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
253k
{
196
253k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
197
253k
    const int intermediate_rnd = (1 << intermediate_bits) >> 1;
198
253k
    int16_t mid[128 * 8];
199
253k
    int16_t *mid_ptrs[8];
200
253k
    int in_y = -8;
201
253k
    src_stride = PXSTRIDE(src_stride);
202
203
2.28M
    for (int i = 0; i < 8; i++)
204
2.03M
        mid_ptrs[i] = &mid[128 * i];
205
206
253k
    src -= src_stride * 3;
207
208
3.12M
    for (int y = 0; y < h; y++) {
209
2.87M
        int x;
210
2.87M
        int src_y = my >> 10;
211
2.87M
        GET_V_FILTER((my & 0x3ff) >> 6);
212
213
7.50M
        while (in_y < src_y) {
214
4.63M
            int imx = mx, ioff = 0;
215
4.63M
            int16_t *mid_ptr = mid_ptrs[0];
216
217
37.0M
            for (int i = 0; i < 7; i++)
218
32.3M
                mid_ptrs[i] = mid_ptrs[i + 1];
219
4.63M
            mid_ptrs[7] = mid_ptr;
220
221
100M
            for (x = 0; x < w; x++) {
222
95.9M
                GET_H_FILTER(imx >> 6);
223
95.9M
                mid_ptr[x] = fh ? DAV1D_FILTER_8TAP_RND(src, ioff, fh, 1,
224
95.9M
                                                        6 - intermediate_bits) :
225
95.9M
                                  src[ioff] << intermediate_bits;
226
95.9M
                imx += dx;
227
95.9M
                ioff += imx >> 10;
228
95.9M
                imx &= 0x3ff;
229
95.9M
            }
230
231
4.63M
            src += src_stride;
232
4.63M
            in_y++;
233
4.63M
        }
234
235
69.9M
        for (x = 0; x < w; x++)
236
67.1M
            dst[x] = fv ? DAV1D_FILTER_8TAP_CLIP3(mid_ptrs, x, fv,
237
67.1M
                                                  6 + intermediate_bits) :
238
67.1M
                          iclip_pixel((mid_ptrs[3][x] + intermediate_rnd) >>
239
9.87M
                                              intermediate_bits);
240
241
2.87M
        my += dy;
242
2.87M
        dst += PXSTRIDE(dst_stride);
243
2.87M
    }
244
253k
}
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
135k
{
251
135k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
252
135k
    GET_FILTERS();
253
135k
    src_stride = PXSTRIDE(src_stride);
254
255
135k
    if (fh) {
256
44.6k
        if (fv) {
257
33.1k
            int tmp_h = h + 7;
258
33.1k
            int16_t mid[128 * 135], *mid_ptr = mid;
259
260
33.1k
            src -= src_stride * 3;
261
850k
            do {
262
17.2M
                for (int x = 0; x < w; x++)
263
16.4M
                    mid_ptr[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,
264
850k
                                                       6 - intermediate_bits);
265
266
850k
                mid_ptr += 128;
267
850k
                src += src_stride;
268
850k
            } while (--tmp_h);
269
270
33.1k
            mid_ptr = mid + 128 * 3;
271
620k
            do {
272
14.2M
                for (int x = 0; x < w; x++) {
273
13.6M
                    int t = DAV1D_FILTER_8TAP_RND(mid_ptr, x, fv, 128, 6) -
274
13.6M
                                  PREP_BIAS;
275
13.6M
                    assert(t >= INT16_MIN && t <= INT16_MAX);
276
13.6M
                    tmp[x] = t;
277
13.6M
                }
278
279
620k
                mid_ptr += 128;
280
620k
                tmp += w;
281
620k
            } while (--h);
282
33.1k
        } else {
283
163k
            do {
284
2.92M
                for (int x = 0; x < w; x++)
285
2.76M
                    tmp[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,
286
2.76M
                                                   6 - intermediate_bits) -
287
2.76M
                             PREP_BIAS;
288
289
163k
                tmp += w;
290
163k
                src += src_stride;
291
163k
            } while (--h);
292
11.4k
        }
293
90.5k
    } else if (fv) {
294
120k
        do {
295
2.32M
            for (int x = 0; x < w; x++)
296
2.20M
                tmp[x] = DAV1D_FILTER_8TAP_RND(src, x, fv, src_stride,
297
2.20M
                                               6 - intermediate_bits) -
298
2.20M
                         PREP_BIAS;
299
300
120k
            tmp += w;
301
120k
            src += src_stride;
302
120k
        } while (--h);
303
7.76k
    } else
304
82.7k
        prep_c(tmp, src, src_stride, w, h HIGHBD_TAIL_SUFFIX);
305
135k
}
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
83.8k
{
313
83.8k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
314
83.8k
    int16_t mid[128 * 8];
315
83.8k
    int16_t *mid_ptrs[8];
316
83.8k
    int in_y = -8;
317
83.8k
    src_stride = PXSTRIDE(src_stride);
318
319
754k
    for (int i = 0; i < 8; i++)
320
670k
        mid_ptrs[i] = &mid[128 * i];
321
322
83.8k
    src -= src_stride * 3;
323
324
1.42M
    for (int y = 0; y < h; y++) {
325
1.34M
        int x;
326
1.34M
        int src_y = my >> 10;
327
1.34M
        GET_V_FILTER((my & 0x3ff) >> 6);
328
329
3.20M
        while (in_y < src_y) {
330
1.85M
            int imx = mx, ioff = 0;
331
1.85M
            int16_t *mid_ptr = mid_ptrs[0];
332
333
14.8M
            for (int i = 0; i < 7; i++)
334
13.0M
                mid_ptrs[i] = mid_ptrs[i + 1];
335
1.85M
            mid_ptrs[7] = mid_ptr;
336
337
53.2M
            for (x = 0; x < w; x++) {
338
51.3M
                GET_H_FILTER(imx >> 6);
339
51.3M
                mid_ptr[x] = fh ? DAV1D_FILTER_8TAP_RND(src, ioff, fh, 1,
340
51.3M
                                                        6 - intermediate_bits) :
341
51.3M
                                  src[ioff] << intermediate_bits;
342
51.3M
                imx += dx;
343
51.3M
                ioff += imx >> 10;
344
51.3M
                imx &= 0x3ff;
345
51.3M
            }
346
347
1.85M
            src += src_stride;
348
1.85M
            in_y++;
349
1.85M
        }
350
351
42.6M
        for (x = 0; x < w; x++)
352
41.2M
            tmp[x] = (fv ? DAV1D_FILTER_8TAP_RND3(mid_ptrs, x, fv, 6)
353
41.2M
                         : mid_ptrs[3][x]) - PREP_BIAS;
354
355
1.34M
        my += dy;
356
1.34M
        tmp += w;
357
1.34M
    }
358
83.8k
}
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
587k
                                HIGHBD_DECL_SUFFIX) \
368
587k
{ \
369
587k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
587k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
587k
} \
mc_tmpl.c:put_8tap_regular_c
Line
Count
Source
367
183k
                                HIGHBD_DECL_SUFFIX) \
368
183k
{ \
369
183k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
183k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
183k
} \
mc_tmpl.c:put_8tap_regular_smooth_c
Line
Count
Source
367
5.47k
                                HIGHBD_DECL_SUFFIX) \
368
5.47k
{ \
369
5.47k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
5.47k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
5.47k
} \
mc_tmpl.c:put_8tap_regular_sharp_c
Line
Count
Source
367
1.45k
                                HIGHBD_DECL_SUFFIX) \
368
1.45k
{ \
369
1.45k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
1.45k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
1.45k
} \
mc_tmpl.c:put_8tap_sharp_regular_c
Line
Count
Source
367
1.99k
                                HIGHBD_DECL_SUFFIX) \
368
1.99k
{ \
369
1.99k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
1.99k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
1.99k
} \
mc_tmpl.c:put_8tap_sharp_smooth_c
Line
Count
Source
367
831
                                HIGHBD_DECL_SUFFIX) \
368
831
{ \
369
831
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
831
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
831
} \
mc_tmpl.c:put_8tap_sharp_c
Line
Count
Source
367
34.9k
                                HIGHBD_DECL_SUFFIX) \
368
34.9k
{ \
369
34.9k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
34.9k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
34.9k
} \
mc_tmpl.c:put_8tap_smooth_regular_c
Line
Count
Source
367
3.51k
                                HIGHBD_DECL_SUFFIX) \
368
3.51k
{ \
369
3.51k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
3.51k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
3.51k
} \
mc_tmpl.c:put_8tap_smooth_c
Line
Count
Source
367
354k
                                HIGHBD_DECL_SUFFIX) \
368
354k
{ \
369
354k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
354k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
354k
} \
mc_tmpl.c:put_8tap_smooth_sharp_c
Line
Count
Source
367
1.17k
                                HIGHBD_DECL_SUFFIX) \
368
1.17k
{ \
369
1.17k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
1.17k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
1.17k
} \
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
253k
                                       HIGHBD_DECL_SUFFIX) \
380
253k
{ \
381
253k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
253k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
253k
} \
mc_tmpl.c:put_8tap_regular_scaled_c
Line
Count
Source
379
177k
                                       HIGHBD_DECL_SUFFIX) \
380
177k
{ \
381
177k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
177k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
177k
} \
mc_tmpl.c:put_8tap_regular_smooth_scaled_c
Line
Count
Source
379
11.3k
                                       HIGHBD_DECL_SUFFIX) \
380
11.3k
{ \
381
11.3k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
11.3k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
11.3k
} \
mc_tmpl.c:put_8tap_regular_sharp_scaled_c
Line
Count
Source
379
1.31k
                                       HIGHBD_DECL_SUFFIX) \
380
1.31k
{ \
381
1.31k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
1.31k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
1.31k
} \
mc_tmpl.c:put_8tap_sharp_regular_scaled_c
Line
Count
Source
379
2.74k
                                       HIGHBD_DECL_SUFFIX) \
380
2.74k
{ \
381
2.74k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
2.74k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
2.74k
} \
mc_tmpl.c:put_8tap_sharp_smooth_scaled_c
Line
Count
Source
379
940
                                       HIGHBD_DECL_SUFFIX) \
380
940
{ \
381
940
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
940
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
940
} \
mc_tmpl.c:put_8tap_sharp_scaled_c
Line
Count
Source
379
23.4k
                                       HIGHBD_DECL_SUFFIX) \
380
23.4k
{ \
381
23.4k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
23.4k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
23.4k
} \
mc_tmpl.c:put_8tap_smooth_regular_scaled_c
Line
Count
Source
379
15.6k
                                       HIGHBD_DECL_SUFFIX) \
380
15.6k
{ \
381
15.6k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
15.6k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
15.6k
} \
mc_tmpl.c:put_8tap_smooth_scaled_c
Line
Count
Source
379
20.3k
                                       HIGHBD_DECL_SUFFIX) \
380
20.3k
{ \
381
20.3k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
20.3k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
20.3k
} \
mc_tmpl.c:put_8tap_smooth_sharp_scaled_c
Line
Count
Source
379
915
                                       HIGHBD_DECL_SUFFIX) \
380
915
{ \
381
915
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
915
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
915
} \
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
135k
                                 HIGHBD_DECL_SUFFIX) \
390
135k
{ \
391
135k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
135k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
135k
} \
mc_tmpl.c:prep_8tap_regular_c
Line
Count
Source
389
31.4k
                                 HIGHBD_DECL_SUFFIX) \
390
31.4k
{ \
391
31.4k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
31.4k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
31.4k
} \
mc_tmpl.c:prep_8tap_regular_smooth_c
Line
Count
Source
389
1.01k
                                 HIGHBD_DECL_SUFFIX) \
390
1.01k
{ \
391
1.01k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
1.01k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
1.01k
} \
mc_tmpl.c:prep_8tap_regular_sharp_c
Line
Count
Source
389
3.18k
                                 HIGHBD_DECL_SUFFIX) \
390
3.18k
{ \
391
3.18k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
3.18k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
3.18k
} \
mc_tmpl.c:prep_8tap_sharp_regular_c
Line
Count
Source
389
5.96k
                                 HIGHBD_DECL_SUFFIX) \
390
5.96k
{ \
391
5.96k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
5.96k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
5.96k
} \
mc_tmpl.c:prep_8tap_sharp_smooth_c
Line
Count
Source
389
1.47k
                                 HIGHBD_DECL_SUFFIX) \
390
1.47k
{ \
391
1.47k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
1.47k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
1.47k
} \
mc_tmpl.c:prep_8tap_sharp_c
Line
Count
Source
389
20.6k
                                 HIGHBD_DECL_SUFFIX) \
390
20.6k
{ \
391
20.6k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
20.6k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
20.6k
} \
mc_tmpl.c:prep_8tap_smooth_regular_c
Line
Count
Source
389
998
                                 HIGHBD_DECL_SUFFIX) \
390
998
{ \
391
998
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
998
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
998
} \
mc_tmpl.c:prep_8tap_smooth_c
Line
Count
Source
389
69.3k
                                 HIGHBD_DECL_SUFFIX) \
390
69.3k
{ \
391
69.3k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
69.3k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
69.3k
} \
mc_tmpl.c:prep_8tap_smooth_sharp_c
Line
Count
Source
389
1.05k
                                 HIGHBD_DECL_SUFFIX) \
390
1.05k
{ \
391
1.05k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
1.05k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
1.05k
} \
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
83.8k
                                        HIGHBD_DECL_SUFFIX) \
401
83.8k
{ \
402
83.8k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
83.8k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
83.8k
}
mc_tmpl.c:prep_8tap_regular_scaled_c
Line
Count
Source
400
23.0k
                                        HIGHBD_DECL_SUFFIX) \
401
23.0k
{ \
402
23.0k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
23.0k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
23.0k
}
mc_tmpl.c:prep_8tap_regular_smooth_scaled_c
Line
Count
Source
400
1.91k
                                        HIGHBD_DECL_SUFFIX) \
401
1.91k
{ \
402
1.91k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
1.91k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
1.91k
}
mc_tmpl.c:prep_8tap_regular_sharp_scaled_c
Line
Count
Source
400
2.56k
                                        HIGHBD_DECL_SUFFIX) \
401
2.56k
{ \
402
2.56k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
2.56k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
2.56k
}
mc_tmpl.c:prep_8tap_sharp_regular_scaled_c
Line
Count
Source
400
11.0k
                                        HIGHBD_DECL_SUFFIX) \
401
11.0k
{ \
402
11.0k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
11.0k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
11.0k
}
mc_tmpl.c:prep_8tap_sharp_smooth_scaled_c
Line
Count
Source
400
1.66k
                                        HIGHBD_DECL_SUFFIX) \
401
1.66k
{ \
402
1.66k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
1.66k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
1.66k
}
mc_tmpl.c:prep_8tap_sharp_scaled_c
Line
Count
Source
400
5.69k
                                        HIGHBD_DECL_SUFFIX) \
401
5.69k
{ \
402
5.69k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
5.69k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
5.69k
}
mc_tmpl.c:prep_8tap_smooth_regular_scaled_c
Line
Count
Source
400
6.76k
                                        HIGHBD_DECL_SUFFIX) \
401
6.76k
{ \
402
6.76k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
6.76k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
6.76k
}
mc_tmpl.c:prep_8tap_smooth_scaled_c
Line
Count
Source
400
29.8k
                                        HIGHBD_DECL_SUFFIX) \
401
29.8k
{ \
402
29.8k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
29.8k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
29.8k
}
mc_tmpl.c:prep_8tap_smooth_sharp_scaled_c
Line
Count
Source
400
1.41k
                                        HIGHBD_DECL_SUFFIX) \
401
1.41k
{ \
402
1.41k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
1.41k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
1.41k
}
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
12.9M
    (16 * src[x] + ((mxy) * (src[x + stride] - src[x])))
418
419
#define FILTER_BILIN_RND(src, x, mxy, stride, sh) \
420
12.9M
    ((FILTER_BILIN(src, x, mxy, stride) + ((1 << (sh)) >> 1)) >> (sh))
421
422
#define FILTER_BILIN_CLIP(src, x, mxy, stride, sh) \
423
1.54M
    iclip_pixel(FILTER_BILIN_RND(src, x, mxy, stride, sh))
424
425
#define FILTER_BILIN2(src1, src2, x, mxy) \
426
4.90M
    (16 * src1[x] + ((mxy) * (src2[x] - src1[x])))
427
428
#define FILTER_BILIN_RND2(src1, src2, x, mxy, sh) \
429
4.90M
    ((FILTER_BILIN2(src1, src2, x, mxy) + ((1 << (sh)) >> 1)) >> (sh))
430
431
#define FILTER_BILIN_CLIP2(src1, src2, x, mxy, sh) \
432
3.96M
    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
135k
{
439
135k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
440
135k
    const int intermediate_rnd = (1 << intermediate_bits) >> 1;
441
135k
    dst_stride = PXSTRIDE(dst_stride);
442
135k
    src_stride = PXSTRIDE(src_stride);
443
444
135k
    if (mx) {
445
14.6k
        if (my) {
446
9.67k
            int16_t mid[128 * 129], *mid_ptr = mid;
447
9.67k
            int tmp_h = h + 1;
448
449
83.2k
            do {
450
1.12M
                for (int x = 0; x < w; x++)
451
1.04M
                    mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1,
452
83.2k
                                                  4 - intermediate_bits);
453
454
83.2k
                mid_ptr += 128;
455
83.2k
                src += src_stride;
456
83.2k
            } while (--tmp_h);
457
458
9.67k
            mid_ptr = mid;
459
73.5k
            do {
460
1.05M
                for (int x = 0; x < w; x++)
461
980k
                    dst[x] = FILTER_BILIN_CLIP(mid_ptr, x, my, 128,
462
73.5k
                                               4 + intermediate_bits);
463
464
73.5k
                mid_ptr += 128;
465
73.5k
                dst += dst_stride;
466
73.5k
            } while (--h);
467
9.67k
        } else {
468
39.8k
            do {
469
555k
                for (int x = 0; x < w; x++) {
470
515k
                    const int px = FILTER_BILIN_RND(src, x, mx, 1,
471
515k
                                                    4 - intermediate_bits);
472
515k
                    dst[x] = iclip_pixel((px + intermediate_rnd) >> intermediate_bits);
473
515k
                }
474
475
39.8k
                dst += dst_stride;
476
39.8k
                src += src_stride;
477
39.8k
            } while (--h);
478
5.01k
        }
479
121k
    } else if (my) {
480
32.9k
        do {
481
598k
            for (int x = 0; x < w; x++)
482
565k
                dst[x] = FILTER_BILIN_CLIP(src, x, my, src_stride, 4);
483
484
32.9k
            dst += dst_stride;
485
32.9k
            src += src_stride;
486
32.9k
        } while (--h);
487
3.19k
    } else
488
117k
        put_c(dst, dst_stride, src, src_stride, w, h);
489
135k
}
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
14.5k
{
497
14.5k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
498
14.5k
    int16_t mid[128 * 2];
499
14.5k
    int in_y = -2;
500
501
195k
    do {
502
195k
        int x;
503
195k
        int y = my >> 10;
504
195k
        int16_t *mid1 = &mid[(y & 1) * 128];
505
195k
        int16_t *mid2 = &mid[((y + 1) & 1) * 128];
506
195k
        int dmy = my & 0x3ff;
507
508
410k
        while (in_y < y) {
509
215k
            int imx = mx, ioff = 0;
510
215k
            int16_t *mid_ptr = &mid[(in_y & 1) * 128];
511
512
4.56M
            for (x = 0; x < w; x++) {
513
4.35M
                mid_ptr[x] = FILTER_BILIN_RND(src, ioff, imx >> 6, 1,
514
4.35M
                                              4 - intermediate_bits);
515
4.35M
                imx += dx;
516
4.35M
                ioff += imx >> 10;
517
4.35M
                imx &= 0x3ff;
518
4.35M
            }
519
520
215k
            src += PXSTRIDE(src_stride);
521
215k
            in_y++;
522
215k
        }
523
524
4.16M
        for (x = 0; x < w; x++)
525
3.96M
            dst[x] = FILTER_BILIN_CLIP2(mid1, mid2, x, dmy >> 6,
526
195k
                                       4 + intermediate_bits);
527
528
195k
        my += dy;
529
195k
        dst += PXSTRIDE(dst_stride);
530
195k
    } while (--h);
531
14.5k
}
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
11.4k
{
538
11.4k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
539
11.4k
    src_stride = PXSTRIDE(src_stride);
540
541
11.4k
    if (mx) {
542
5.61k
        if (my) {
543
4.00k
            int16_t mid[128 * 129], *mid_ptr = mid;
544
4.00k
            int tmp_h = h + 1;
545
546
75.7k
            do {
547
1.38M
                for (int x = 0; x < w; x++)
548
1.31M
                    mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1,
549
75.7k
                                                  4 - intermediate_bits);
550
551
75.7k
                mid_ptr += 128;
552
75.7k
                src += src_stride;
553
75.7k
            } while (--tmp_h);
554
555
4.00k
            mid_ptr = mid;
556
74.6k
            do {
557
1.40M
                for (int x = 0; x < w; x++)
558
1.33M
                    tmp[x] = FILTER_BILIN_RND(mid_ptr, x, my, 128, 4) -
559
1.33M
                             PREP_BIAS;
560
561
74.6k
                mid_ptr += 128;
562
74.6k
                tmp += w;
563
74.6k
            } while (--h);
564
4.00k
        } else {
565
34.1k
            do {
566
848k
                for (int x = 0; x < w; x++)
567
814k
                    tmp[x] = FILTER_BILIN_RND(src, x, mx, 1,
568
814k
                                              4 - intermediate_bits) -
569
814k
                             PREP_BIAS;
570
571
34.1k
                tmp += w;
572
34.1k
                src += src_stride;
573
34.1k
            } while (--h);
574
1.60k
        }
575
5.82k
    } else if (my) {
576
45.6k
        do {
577
1.11M
            for (int x = 0; x < w; x++)
578
1.07M
                tmp[x] = FILTER_BILIN_RND(src, x, my, src_stride,
579
1.07M
                                          4 - intermediate_bits) - PREP_BIAS;
580
581
45.6k
            tmp += w;
582
45.6k
            src += src_stride;
583
45.6k
        } while (--h);
584
1.94k
    } else
585
3.88k
        prep_c(tmp, src, src_stride, w, h HIGHBD_TAIL_SUFFIX);
586
11.4k
}
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
2.25k
{
593
2.25k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
594
2.25k
    int16_t mid[128 * 2];
595
2.25k
    int in_y = -2;
596
597
40.8k
    do {
598
40.8k
        int x;
599
40.8k
        int y = my >> 10;
600
40.8k
        int16_t *mid1 = &mid[(y & 1) * 128];
601
40.8k
        int16_t *mid2 = &mid[((y + 1) & 1) * 128];
602
40.8k
        int dmy = my & 0x3ff;
603
604
81.2k
        while (in_y < y) {
605
40.3k
            int imx = mx, ioff = 0;
606
40.3k
            int16_t *mid_ptr = &mid[(in_y & 1) * 128];
607
608
971k
            for (x = 0; x < w; x++) {
609
931k
                mid_ptr[x] = FILTER_BILIN_RND(src, ioff, imx >> 6, 1,
610
931k
                                              4 - intermediate_bits);
611
931k
                imx += dx;
612
931k
                ioff += imx >> 10;
613
931k
                imx &= 0x3ff;
614
931k
            }
615
616
40.3k
            src += PXSTRIDE(src_stride);
617
40.3k
            in_y++;
618
40.3k
        }
619
620
978k
        for (x = 0; x < w; x++)
621
937k
            tmp[x] = FILTER_BILIN_RND2(mid1, mid2, x, dmy >> 6, 4) - PREP_BIAS;
622
623
40.8k
        my += dy;
624
40.8k
        tmp += w;
625
40.8k
    } while (--h);
626
2.25k
}
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
82.4k
{
632
82.4k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
633
82.4k
    const int sh = intermediate_bits + 1;
634
82.4k
    const int rnd = (1 << intermediate_bits) + PREP_BIAS * 2;
635
1.77M
    do {
636
44.4M
        for (int x = 0; x < w; x++)
637
42.6M
            dst[x] = iclip_pixel((tmp1[x] + tmp2[x] + rnd) >> sh);
638
639
1.77M
        tmp1 += w;
640
1.77M
        tmp2 += w;
641
1.77M
        dst += PXSTRIDE(dst_stride);
642
1.77M
    } while (--h);
643
82.4k
}
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
21.1k
{
649
21.1k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
650
21.1k
    const int sh = intermediate_bits + 4;
651
21.1k
    const int rnd = (8 << intermediate_bits) + PREP_BIAS * 16;
652
255k
    do {
653
5.01M
        for (int x = 0; x < w; x++)
654
4.75M
            dst[x] = iclip_pixel((tmp1[x] * weight +
655
4.75M
                                  tmp2[x] * (16 - weight) + rnd) >> sh);
656
657
255k
        tmp1 += w;
658
255k
        tmp2 += w;
659
255k
        dst += PXSTRIDE(dst_stride);
660
255k
    } while (--h);
661
21.1k
}
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
13.2k
{
667
13.2k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
668
13.2k
    const int sh = intermediate_bits + 6;
669
13.2k
    const int rnd = (32 << intermediate_bits) + PREP_BIAS * 64;
670
199k
    do {
671
3.96M
        for (int x = 0; x < w; x++)
672
3.76M
            dst[x] = iclip_pixel((tmp1[x] * mask[x] +
673
3.76M
                                  tmp2[x] * (64 - mask[x]) + rnd) >> sh);
674
675
199k
        tmp1 += w;
676
199k
        tmp2 += w;
677
199k
        mask += w;
678
199k
        dst += PXSTRIDE(dst_stride);
679
199k
    } while (--h);
680
13.2k
}
681
682
13.1M
#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
20.9k
{
686
206k
    do {
687
2.74M
        for (int x = 0; x < w; x++) {
688
2.54M
            dst[x] = blend_px(dst[x], tmp[x], mask[x]);
689
2.54M
        }
690
206k
        dst += PXSTRIDE(dst_stride);
691
206k
        tmp += w;
692
206k
        mask += w;
693
206k
    } while (--h);
694
20.9k
}
695
696
static void blend_v_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp,
697
                      const int w, int h)
698
62.0k
{
699
62.0k
    const uint8_t *const mask = &dav1d_obmc_masks[w];
700
754k
    do {
701
5.00M
        for (int x = 0; x < (w * 3) >> 2; x++) {
702
4.25M
            dst[x] = blend_px(dst[x], tmp[x], mask[x]);
703
4.25M
        }
704
754k
        dst += PXSTRIDE(dst_stride);
705
754k
        tmp += w;
706
754k
    } while (--h);
707
62.0k
}
708
709
static void blend_h_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp,
710
                      const int w, int h)
711
91.6k
{
712
91.6k
    const uint8_t *mask = &dav1d_obmc_masks[h];
713
91.6k
    h = (h * 3) >> 2;
714
550k
    do {
715
550k
        const int m = *mask++;
716
6.95M
        for (int x = 0; x < w; x++) {
717
6.40M
            dst[x] = blend_px(dst[x], tmp[x], m);
718
6.40M
        }
719
550k
        dst += PXSTRIDE(dst_stride);
720
550k
        tmp += w;
721
550k
    } while (--h);
722
91.6k
}
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
4.48k
{
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
4.48k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
732
4.48k
    const int bitdepth = bitdepth_from_max(bitdepth_max);
733
4.48k
    const int sh = intermediate_bits + 6;
734
4.48k
    const int rnd = (32 << intermediate_bits) + PREP_BIAS * 64;
735
4.48k
    const int mask_sh = bitdepth + intermediate_bits - 4;
736
4.48k
    const int mask_rnd = 1 << (mask_sh - 5);
737
131k
    do {
738
3.31M
        for (int x = 0; x < w; x++) {
739
3.18M
            const int tmpdiff = tmp1[x] - tmp2[x];
740
3.18M
            const int m = imin(38 + ((abs(tmpdiff) + mask_rnd) >> mask_sh), 64);
741
3.18M
            dst[x] = iclip_pixel((tmpdiff * m + tmp2[x] * 64 + rnd) >> sh);
742
743
3.18M
            if (ss_hor) {
744
1.99M
                x++;
745
746
1.99M
                const int tmpdiff = tmp1[x] - tmp2[x];
747
1.99M
                const int n = imin(38 + ((abs(tmpdiff) + mask_rnd) >> mask_sh), 64);
748
1.99M
                dst[x] = iclip_pixel((tmpdiff * n + tmp2[x] * 64 + rnd) >> sh);
749
750
1.99M
                if (h & ss_ver) {
751
630k
                    mask[x >> 1] = (m + n + mask[x >> 1] + 2 - sign) >> 2;
752
1.36M
                } else if (ss_ver) {
753
630k
                    mask[x >> 1] = m + n;
754
735k
                } else {
755
735k
                    mask[x >> 1] = (m + n + 1 - sign) >> 1;
756
735k
                }
757
1.99M
            } else {
758
1.18M
                mask[x] = m;
759
1.18M
            }
760
3.18M
        }
761
762
131k
        tmp1 += w;
763
131k
        tmp2 += w;
764
131k
        dst += PXSTRIDE(dst_stride);
765
131k
        if (!ss_ver || (h & 1)) mask += w >> ss_hor;
766
131k
    } while (--h);
767
4.48k
}
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
4.48k
                             const int sign HIGHBD_DECL_SUFFIX) \
774
4.48k
{ \
775
4.48k
    w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
776
4.48k
             HIGHBD_TAIL_SUFFIX); \
777
4.48k
}
mc_tmpl.c:w_mask_444_c
Line
Count
Source
773
932
                             const int sign HIGHBD_DECL_SUFFIX) \
774
932
{ \
775
932
    w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
776
932
             HIGHBD_TAIL_SUFFIX); \
777
932
}
mc_tmpl.c:w_mask_422_c
Line
Count
Source
773
1.01k
                             const int sign HIGHBD_DECL_SUFFIX) \
774
1.01k
{ \
775
1.01k
    w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
776
1.01k
             HIGHBD_TAIL_SUFFIX); \
777
1.01k
}
mc_tmpl.c:w_mask_420_c
Line
Count
Source
773
2.53k
                             const int sign HIGHBD_DECL_SUFFIX) \
774
2.53k
{ \
775
2.53k
    w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
776
2.53k
             HIGHBD_TAIL_SUFFIX); \
777
2.53k
}
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
63.8M
    ((F[0] * src[x - 3 * stride] + \
787
63.8M
      F[1] * src[x - 2 * stride] + \
788
63.8M
      F[2] * src[x - 1 * stride] + \
789
63.8M
      F[3] * src[x + 0 * stride] + \
790
63.8M
      F[4] * src[x + 1 * stride] + \
791
63.8M
      F[5] * src[x + 2 * stride] + \
792
63.8M
      F[6] * src[x + 3 * stride] + \
793
63.8M
      F[7] * src[x + 4 * stride] + \
794
63.8M
      ((1 << (sh)) >> 1)) >> (sh))
795
796
#define FILTER_WARP_CLIP(src, x, F, stride, sh) \
797
14.2M
    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
243k
{
804
243k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
805
243k
    int16_t mid[15 * 8], *mid_ptr = mid;
806
807
243k
    src -= 3 * PXSTRIDE(src_stride);
808
3.81M
    for (int y = 0; y < 15; y++, mx += abcd[1]) {
809
31.6M
        for (int x = 0, tmx = mx; x < 8; x++, tmx += abcd[0]) {
810
28.0M
            const int8_t *const filter =
811
28.0M
                dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)];
812
813
28.0M
            mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1,
814
28.0M
                                         7 - intermediate_bits);
815
28.0M
        }
816
3.57M
        src += PXSTRIDE(src_stride);
817
3.57M
        mid_ptr += 8;
818
3.57M
    }
819
820
243k
    mid_ptr = &mid[3 * 8];
821
2.04M
    for (int y = 0; y < 8; y++, my += abcd[3]) {
822
16.0M
        for (int x = 0, tmy = my; x < 8; x++, tmy += abcd[2]) {
823
14.2M
            const int8_t *const filter =
824
14.2M
                dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)];
825
826
14.2M
            dst[x] = FILTER_WARP_CLIP(mid_ptr, x, filter, 8,
827
14.2M
                                      7 + intermediate_bits);
828
14.2M
        }
829
1.79M
        mid_ptr += 8;
830
1.79M
        dst += PXSTRIDE(dst_stride);
831
1.79M
    }
832
243k
}
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
117k
{
839
117k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
840
117k
    int16_t mid[15 * 8], *mid_ptr = mid;
841
842
117k
    src -= 3 * PXSTRIDE(src_stride);
843
1.86M
    for (int y = 0; y < 15; y++, mx += abcd[1]) {
844
15.7M
        for (int x = 0, tmx = mx; x < 8; x++, tmx += abcd[0]) {
845
13.9M
            const int8_t *const filter =
846
13.9M
                dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)];
847
848
13.9M
            mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1,
849
13.9M
                                         7 - intermediate_bits);
850
13.9M
        }
851
1.75M
        src += PXSTRIDE(src_stride);
852
1.75M
        mid_ptr += 8;
853
1.75M
    }
854
855
117k
    mid_ptr = &mid[3 * 8];
856
1.05M
    for (int y = 0; y < 8; y++, my += abcd[3]) {
857
8.44M
        for (int x = 0, tmy = my; x < 8; x++, tmy += abcd[2]) {
858
7.50M
            const int8_t *const filter =
859
7.50M
                dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)];
860
861
7.50M
            tmp[x] = FILTER_WARP_RND(mid_ptr, x, filter, 8, 7) - PREP_BIAS;
862
7.50M
        }
863
940k
        mid_ptr += 8;
864
940k
        tmp += tmp_stride;
865
940k
    }
866
117k
}
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
1.29M
{
874
    // find offset in reference of visible block to copy
875
1.29M
    ref += iclip((int) y, 0, (int) ih - 1) * PXSTRIDE(ref_stride) +
876
1.29M
           iclip((int) x, 0, (int) iw - 1);
877
878
    // number of pixels to extend (left, right, top, bottom)
879
1.29M
    const int left_ext = iclip((int) -x, 0, (int) bw - 1);
880
1.29M
    const int right_ext = iclip((int) (x + bw - iw), 0, (int) bw - 1);
881
1.29M
    assert(left_ext + right_ext < bw);
882
1.29M
    const int top_ext = iclip((int) -y, 0, (int) bh - 1);
883
1.29M
    const int bottom_ext = iclip((int) (y + bh - ih), 0, (int) bh - 1);
884
1.29M
    assert(top_ext + bottom_ext < bh);
885
886
    // copy visible portion first
887
1.29M
    pixel *blk = dst + top_ext * PXSTRIDE(dst_stride);
888
1.29M
    const int center_w = (int) (bw - left_ext - right_ext);
889
1.29M
    const int center_h = (int) (bh - top_ext - bottom_ext);
890
19.1M
    for (int y = 0; y < center_h; y++) {
891
17.8M
        pixel_copy(blk + left_ext, ref, center_w);
892
        // extend left edge for this line
893
17.8M
        if (left_ext)
894
4.49M
            pixel_set(blk, blk[left_ext], left_ext);
895
        // extend right edge for this line
896
17.8M
        if (right_ext)
897
14.8M
            pixel_set(blk + left_ext + center_w, blk[left_ext + center_w - 1],
898
14.8M
                      right_ext);
899
17.8M
        ref += PXSTRIDE(ref_stride);
900
17.8M
        blk += PXSTRIDE(dst_stride);
901
17.8M
    }
902
903
    // copy top
904
1.29M
    blk = dst + top_ext * PXSTRIDE(dst_stride);
905
2.51M
    for (int y = 0; y < top_ext; y++) {
906
1.22M
        pixel_copy(dst, blk, bw);
907
1.22M
        dst += PXSTRIDE(dst_stride);
908
1.22M
    }
909
910
    // copy bottom
911
1.29M
    dst += center_h * PXSTRIDE(dst_stride);
912
4.96M
    for (int y = 0; y < bottom_ext; y++) {
913
3.66M
        pixel_copy(dst, &dst[-PXSTRIDE(dst_stride)], bw);
914
3.66M
        dst += PXSTRIDE(dst_stride);
915
3.66M
    }
916
1.29M
}
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
112k
{
923
3.81M
    do {
924
3.81M
        int mx = mx0, src_x = -1;
925
184M
        for (int x = 0; x < dst_w; x++) {
926
180M
            const int8_t *const F = dav1d_resize_filter[mx >> 8];
927
180M
            dst[x] = iclip_pixel((-(F[0] * src[iclip(src_x - 3, 0, src_w - 1)] +
928
180M
                                    F[1] * src[iclip(src_x - 2, 0, src_w - 1)] +
929
180M
                                    F[2] * src[iclip(src_x - 1, 0, src_w - 1)] +
930
180M
                                    F[3] * src[iclip(src_x + 0, 0, src_w - 1)] +
931
180M
                                    F[4] * src[iclip(src_x + 1, 0, src_w - 1)] +
932
180M
                                    F[5] * src[iclip(src_x + 2, 0, src_w - 1)] +
933
180M
                                    F[6] * src[iclip(src_x + 3, 0, src_w - 1)] +
934
180M
                                    F[7] * src[iclip(src_x + 4, 0, src_w - 1)]) +
935
180M
                                  64) >> 7);
936
180M
            mx += dx;
937
180M
            src_x += mx >> 14;
938
180M
            mx &= 0x3fff;
939
180M
        }
940
941
3.81M
        dst += PXSTRIDE(dst_stride);
942
3.81M
        src += PXSTRIDE(src_stride);
943
3.81M
    } while (--h);
944
112k
}
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
27.6k
COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) {
961
276k
#define init_mc_fns(type, name) do { \
962
276k
    c->mc        [type] = put_##name##_c; \
963
276k
    c->mc_scaled [type] = put_##name##_scaled_c; \
964
276k
    c->mct       [type] = prep_##name##_c; \
965
276k
    c->mct_scaled[type] = prep_##name##_scaled_c; \
966
276k
} while (0)
967
968
27.6k
    init_mc_fns(FILTER_2D_8TAP_REGULAR,        8tap_regular);
969
27.6k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth);
970
27.6k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp);
971
27.6k
    init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular);
972
27.6k
    init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth);
973
27.6k
    init_mc_fns(FILTER_2D_8TAP_SHARP,          8tap_sharp);
974
27.6k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular);
975
27.6k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH,         8tap_smooth);
976
27.6k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp);
977
27.6k
    init_mc_fns(FILTER_2D_BILINEAR,            bilin);
978
979
27.6k
    c->avg      = avg_c;
980
27.6k
    c->w_avg    = w_avg_c;
981
27.6k
    c->mask     = mask_c;
982
27.6k
    c->blend    = blend_c;
983
27.6k
    c->blend_v  = blend_v_c;
984
27.6k
    c->blend_h  = blend_h_c;
985
27.6k
    c->w_mask[0] = w_mask_444_c;
986
27.6k
    c->w_mask[1] = w_mask_422_c;
987
27.6k
    c->w_mask[2] = w_mask_420_c;
988
27.6k
    c->warp8x8  = warp_affine_8x8_c;
989
27.6k
    c->warp8x8t = warp_affine_8x8t_c;
990
27.6k
    c->emu_edge = emu_edge_c;
991
27.6k
    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
27.6k
}
dav1d_mc_dsp_init_8bpc
Line
Count
Source
960
12.6k
COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) {
961
12.6k
#define init_mc_fns(type, name) do { \
962
12.6k
    c->mc        [type] = put_##name##_c; \
963
12.6k
    c->mc_scaled [type] = put_##name##_scaled_c; \
964
12.6k
    c->mct       [type] = prep_##name##_c; \
965
12.6k
    c->mct_scaled[type] = prep_##name##_scaled_c; \
966
12.6k
} while (0)
967
968
12.6k
    init_mc_fns(FILTER_2D_8TAP_REGULAR,        8tap_regular);
969
12.6k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth);
970
12.6k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp);
971
12.6k
    init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular);
972
12.6k
    init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth);
973
12.6k
    init_mc_fns(FILTER_2D_8TAP_SHARP,          8tap_sharp);
974
12.6k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular);
975
12.6k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH,         8tap_smooth);
976
12.6k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp);
977
12.6k
    init_mc_fns(FILTER_2D_BILINEAR,            bilin);
978
979
12.6k
    c->avg      = avg_c;
980
12.6k
    c->w_avg    = w_avg_c;
981
12.6k
    c->mask     = mask_c;
982
12.6k
    c->blend    = blend_c;
983
12.6k
    c->blend_v  = blend_v_c;
984
12.6k
    c->blend_h  = blend_h_c;
985
12.6k
    c->w_mask[0] = w_mask_444_c;
986
12.6k
    c->w_mask[1] = w_mask_422_c;
987
12.6k
    c->w_mask[2] = w_mask_420_c;
988
12.6k
    c->warp8x8  = warp_affine_8x8_c;
989
12.6k
    c->warp8x8t = warp_affine_8x8t_c;
990
12.6k
    c->emu_edge = emu_edge_c;
991
12.6k
    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
12.6k
}
dav1d_mc_dsp_init_16bpc
Line
Count
Source
960
14.9k
COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) {
961
14.9k
#define init_mc_fns(type, name) do { \
962
14.9k
    c->mc        [type] = put_##name##_c; \
963
14.9k
    c->mc_scaled [type] = put_##name##_scaled_c; \
964
14.9k
    c->mct       [type] = prep_##name##_c; \
965
14.9k
    c->mct_scaled[type] = prep_##name##_scaled_c; \
966
14.9k
} while (0)
967
968
14.9k
    init_mc_fns(FILTER_2D_8TAP_REGULAR,        8tap_regular);
969
14.9k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth);
970
14.9k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp);
971
14.9k
    init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular);
972
14.9k
    init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth);
973
14.9k
    init_mc_fns(FILTER_2D_8TAP_SHARP,          8tap_sharp);
974
14.9k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular);
975
14.9k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH,         8tap_smooth);
976
14.9k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp);
977
14.9k
    init_mc_fns(FILTER_2D_BILINEAR,            bilin);
978
979
14.9k
    c->avg      = avg_c;
980
14.9k
    c->w_avg    = w_avg_c;
981
14.9k
    c->mask     = mask_c;
982
14.9k
    c->blend    = blend_c;
983
14.9k
    c->blend_v  = blend_v_c;
984
14.9k
    c->blend_h  = blend_h_c;
985
14.9k
    c->w_mask[0] = w_mask_444_c;
986
14.9k
    c->w_mask[1] = w_mask_422_c;
987
14.9k
    c->w_mask[2] = w_mask_420_c;
988
14.9k
    c->warp8x8  = warp_affine_8x8_c;
989
14.9k
    c->warp8x8t = warp_affine_8x8t_c;
990
14.9k
    c->emu_edge = emu_edge_c;
991
14.9k
    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
14.9k
}