Coverage Report

Created: 2026-10-17 06:55

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.43M
#define get_intermediate_bits(bitdepth_max) 4
41
// Output in interval [-5132, 9212], fits in int16_t as is
42
72.4M
#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
65.3k
{
55
967k
    do {
56
967k
        pixel_copy(dst, src, w);
57
58
967k
        dst += dst_stride;
59
967k
        src += src_stride;
60
967k
    } while (--h);
61
65.3k
}
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
13.0k
{
67
13.0k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
68
208k
    do {
69
4.38M
        for (int x = 0; x < w; x++)
70
4.17M
            tmp[x] = (src[x] << intermediate_bits) - PREP_BIAS;
71
72
208k
        tmp += w;
73
208k
        src += src_stride;
74
208k
    } while (--h);
75
13.0k
}
76
77
#define FILTER_8TAP(src, x, F, stride) \
78
68.0M
    (F[0] * src[x + -3 * stride] + \
79
68.0M
     F[1] * src[x + -2 * stride] + \
80
68.0M
     F[2] * src[x + -1 * stride] + \
81
68.0M
     F[3] * src[x + +0 * stride] + \
82
68.0M
     F[4] * src[x + +1 * stride] + \
83
68.0M
     F[5] * src[x + +2 * stride] + \
84
68.0M
     F[6] * src[x + +3 * stride] + \
85
68.0M
     F[7] * src[x + +4 * stride])
86
87
#define FILTER_8TAP2(src, x, F) \
88
68.3M
    (F[0] * src[0][x] + \
89
68.3M
     F[1] * src[1][x] + \
90
68.3M
     F[2] * src[2][x] + \
91
68.3M
     F[3] * src[3][x] + \
92
68.3M
     F[4] * src[4][x] + \
93
68.3M
     F[5] * src[5][x] + \
94
68.3M
     F[6] * src[6][x] + \
95
68.3M
     F[7] * src[7][x])
96
97
#define DAV1D_FILTER_8TAP_RND(src, x, F, stride, sh) \
98
65.9M
    ((FILTER_8TAP(src, x, F, stride) + ((1 << (sh)) >> 1)) >> (sh))
99
100
#define DAV1D_FILTER_8TAP_RND2(src, x, F, stride, rnd, sh) \
101
2.11M
    ((FILTER_8TAP(src, x, F, stride) + (rnd)) >> (sh))
102
103
#define DAV1D_FILTER_8TAP_RND3(src, x, F, sh) \
104
68.3M
    ((FILTER_8TAP2(src, x, F) + ((1 << (sh)) >> 1)) >> (sh))
105
106
#define DAV1D_FILTER_8TAP_CLIP(src, x, F, stride, sh) \
107
8.15M
    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
2.11M
    iclip_pixel(DAV1D_FILTER_8TAP_RND2(src, x, F, stride, rnd, sh))
111
112
#define DAV1D_FILTER_8TAP_CLIP3(src, x, F, sh) \
113
39.7M
    iclip_pixel(DAV1D_FILTER_8TAP_RND3(src, x, F, sh))
114
115
#define GET_H_FILTER(mx) \
116
45.3M
    const int8_t *const fh = !(mx) ? NULL : w > 4 ? \
117
41.7M
        dav1d_mc_subpel_filters[filter_type & 3][(mx) - 1] : \
118
41.7M
        dav1d_mc_subpel_filters[3 + (filter_type & 1)][(mx) - 1]
119
120
#define GET_V_FILTER(my) \
121
3.77M
    const int8_t *const fv = !(my) ? NULL : h > 4 ? \
122
3.35M
        dav1d_mc_subpel_filters[filter_type >> 2][(my) - 1] : \
123
3.35M
        dav1d_mc_subpel_filters[3 + ((filter_type >> 2) & 1)][(my) - 1]
124
125
#define GET_FILTERS() \
126
129k
    GET_H_FILTER(mx); \
127
129k
    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
107k
{
135
107k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
136
107k
    const int intermediate_rnd = 32 + ((1 << (6 - intermediate_bits)) >> 1);
137
138
107k
    GET_FILTERS();
139
107k
    dst_stride = PXSTRIDE(dst_stride);
140
107k
    src_stride = PXSTRIDE(src_stride);
141
142
107k
    if (fh) {
143
58.8k
        if (fv) {
144
45.7k
            int tmp_h = h + 7;
145
45.7k
            int16_t mid[128 * 135], *mid_ptr = mid;
146
147
45.7k
            src -= src_stride * 3;
148
752k
            do {
149
10.0M
                for (int x = 0; x < w; x++)
150
9.29M
                    mid_ptr[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,
151
752k
                                                       6 - intermediate_bits);
152
153
752k
                mid_ptr += 128;
154
752k
                src += src_stride;
155
752k
            } while (--tmp_h);
156
157
45.7k
            mid_ptr = mid + 128 * 3;
158
432k
            do {
159
6.74M
                for (int x = 0; x < w; x++)
160
6.31M
                    dst[x] = DAV1D_FILTER_8TAP_CLIP(mid_ptr, x, fv, 128,
161
432k
                                                    6 + intermediate_bits);
162
163
432k
                mid_ptr += 128;
164
432k
                dst += dst_stride;
165
432k
            } while (--h);
166
45.7k
        } else {
167
125k
            do {
168
2.24M
                for (int x = 0; x < w; x++) {
169
2.11M
                    dst[x] = DAV1D_FILTER_8TAP_CLIP2(src, x, fh, 1,
170
2.11M
                                                     intermediate_rnd, 6);
171
2.11M
                }
172
173
125k
                dst += dst_stride;
174
125k
                src += src_stride;
175
125k
            } while (--h);
176
13.1k
        }
177
58.8k
    } else if (fv) {
178
114k
        do {
179
1.95M
            for (int x = 0; x < w; x++)
180
1.84M
                dst[x] = DAV1D_FILTER_8TAP_CLIP(src, x, fv, src_stride, 6);
181
182
114k
            dst += dst_stride;
183
114k
            src += src_stride;
184
114k
        } while (--h);
185
12.7k
    } else
186
35.4k
        put_c(dst, dst_stride, src, src_stride, w, h);
187
107k
}
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
190k
{
196
190k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
197
190k
    const int intermediate_rnd = (1 << intermediate_bits) >> 1;
198
190k
    int16_t mid[128 * 8];
199
190k
    int16_t *mid_ptrs[8];
200
190k
    int in_y = -8;
201
190k
    src_stride = PXSTRIDE(src_stride);
202
203
1.71M
    for (int i = 0; i < 8; i++)
204
1.52M
        mid_ptrs[i] = &mid[128 * i];
205
206
190k
    src -= src_stride * 3;
207
208
2.54M
    for (int y = 0; y < h; y++) {
209
2.35M
        int x;
210
2.35M
        int src_y = my >> 10;
211
2.35M
        GET_V_FILTER((my & 0x3ff) >> 6);
212
213
4.43M
        while (in_y < src_y) {
214
2.08M
            int imx = mx, ioff = 0;
215
2.08M
            int16_t *mid_ptr = mid_ptrs[0];
216
217
16.6M
            for (int i = 0; i < 7; i++)
218
14.5M
                mid_ptrs[i] = mid_ptrs[i + 1];
219
2.08M
            mid_ptrs[7] = mid_ptr;
220
221
32.5M
            for (x = 0; x < w; x++) {
222
30.4M
                GET_H_FILTER(imx >> 6);
223
30.4M
                mid_ptr[x] = fh ? DAV1D_FILTER_8TAP_RND(src, ioff, fh, 1,
224
30.4M
                                                        6 - intermediate_bits) :
225
30.4M
                                  src[ioff] << intermediate_bits;
226
30.4M
                imx += dx;
227
30.4M
                ioff += imx >> 10;
228
30.4M
                imx &= 0x3ff;
229
30.4M
            }
230
231
2.08M
            src += src_stride;
232
2.08M
            in_y++;
233
2.08M
        }
234
235
47.9M
        for (x = 0; x < w; x++)
236
45.5M
            dst[x] = fv ? DAV1D_FILTER_8TAP_CLIP3(mid_ptrs, x, fv,
237
45.5M
                                                  6 + intermediate_bits) :
238
45.5M
                          iclip_pixel((mid_ptrs[3][x] + intermediate_rnd) >>
239
5.81M
                                              intermediate_bits);
240
241
2.35M
        my += dy;
242
2.35M
        dst += PXSTRIDE(dst_stride);
243
2.35M
    }
244
190k
}
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
22.9k
{
251
22.9k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
252
22.9k
    GET_FILTERS();
253
22.9k
    src_stride = PXSTRIDE(src_stride);
254
255
22.9k
    if (fh) {
256
10.7k
        if (fv) {
257
6.69k
            int tmp_h = h + 7;
258
6.69k
            int16_t mid[128 * 135], *mid_ptr = mid;
259
260
6.69k
            src -= src_stride * 3;
261
143k
            do {
262
2.76M
                for (int x = 0; x < w; x++)
263
2.62M
                    mid_ptr[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,
264
143k
                                                       6 - intermediate_bits);
265
266
143k
                mid_ptr += 128;
267
143k
                src += src_stride;
268
143k
            } while (--tmp_h);
269
270
6.69k
            mid_ptr = mid + 128 * 3;
271
96.8k
            do {
272
2.17M
                for (int x = 0; x < w; x++) {
273
2.08M
                    int t = DAV1D_FILTER_8TAP_RND(mid_ptr, x, fv, 128, 6) -
274
2.08M
                                  PREP_BIAS;
275
2.08M
                    assert(t >= INT16_MIN && t <= INT16_MAX);
276
2.08M
                    tmp[x] = t;
277
2.08M
                }
278
279
96.8k
                mid_ptr += 128;
280
96.8k
                tmp += w;
281
96.8k
            } while (--h);
282
6.69k
        } else {
283
57.4k
            do {
284
1.20M
                for (int x = 0; x < w; x++)
285
1.15M
                    tmp[x] = DAV1D_FILTER_8TAP_RND(src, x, fh, 1,
286
1.15M
                                                   6 - intermediate_bits) -
287
1.15M
                             PREP_BIAS;
288
289
57.4k
                tmp += w;
290
57.4k
                src += src_stride;
291
57.4k
            } while (--h);
292
4.03k
        }
293
12.1k
    } else if (fv) {
294
53.2k
        do {
295
1.01M
            for (int x = 0; x < w; x++)
296
966k
                tmp[x] = DAV1D_FILTER_8TAP_RND(src, x, fv, src_stride,
297
966k
                                               6 - intermediate_bits) -
298
966k
                         PREP_BIAS;
299
300
53.2k
            tmp += w;
301
53.2k
            src += src_stride;
302
53.2k
        } while (--h);
303
3.12k
    } else
304
9.06k
        prep_c(tmp, src, src_stride, w, h HIGHBD_TAIL_SUFFIX);
305
22.9k
}
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
62.1k
{
313
62.1k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
314
62.1k
    int16_t mid[128 * 8];
315
62.1k
    int16_t *mid_ptrs[8];
316
62.1k
    int in_y = -8;
317
62.1k
    src_stride = PXSTRIDE(src_stride);
318
319
559k
    for (int i = 0; i < 8; i++)
320
497k
        mid_ptrs[i] = &mid[128 * i];
321
322
62.1k
    src -= src_stride * 3;
323
324
1.35M
    for (int y = 0; y < h; y++) {
325
1.29M
        int x;
326
1.29M
        int src_y = my >> 10;
327
1.29M
        GET_V_FILTER((my & 0x3ff) >> 6);
328
329
2.07M
        while (in_y < src_y) {
330
786k
            int imx = mx, ioff = 0;
331
786k
            int16_t *mid_ptr = mid_ptrs[0];
332
333
6.29M
            for (int i = 0; i < 7; i++)
334
5.50M
                mid_ptrs[i] = mid_ptrs[i + 1];
335
786k
            mid_ptrs[7] = mid_ptr;
336
337
15.6M
            for (x = 0; x < w; x++) {
338
14.8M
                GET_H_FILTER(imx >> 6);
339
14.8M
                mid_ptr[x] = fh ? DAV1D_FILTER_8TAP_RND(src, ioff, fh, 1,
340
14.8M
                                                        6 - intermediate_bits) :
341
14.8M
                                  src[ioff] << intermediate_bits;
342
14.8M
                imx += dx;
343
14.8M
                ioff += imx >> 10;
344
14.8M
                imx &= 0x3ff;
345
14.8M
            }
346
347
786k
            src += src_stride;
348
786k
            in_y++;
349
786k
        }
350
351
32.3M
        for (x = 0; x < w; x++)
352
31.0M
            tmp[x] = (fv ? DAV1D_FILTER_8TAP_RND3(mid_ptrs, x, fv, 6)
353
31.0M
                         : mid_ptrs[3][x]) - PREP_BIAS;
354
355
1.29M
        my += dy;
356
1.29M
        tmp += w;
357
1.29M
    }
358
62.1k
}
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
107k
                                HIGHBD_DECL_SUFFIX) \
368
107k
{ \
369
107k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
107k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
107k
} \
mc_tmpl.c:put_8tap_regular_c
Line
Count
Source
367
77.2k
                                HIGHBD_DECL_SUFFIX) \
368
77.2k
{ \
369
77.2k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
77.2k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
77.2k
} \
mc_tmpl.c:put_8tap_regular_smooth_c
Line
Count
Source
367
2.84k
                                HIGHBD_DECL_SUFFIX) \
368
2.84k
{ \
369
2.84k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
2.84k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
2.84k
} \
mc_tmpl.c:put_8tap_regular_sharp_c
Line
Count
Source
367
1.20k
                                HIGHBD_DECL_SUFFIX) \
368
1.20k
{ \
369
1.20k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
1.20k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
1.20k
} \
mc_tmpl.c:put_8tap_sharp_regular_c
Line
Count
Source
367
851
                                HIGHBD_DECL_SUFFIX) \
368
851
{ \
369
851
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
851
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
851
} \
mc_tmpl.c:put_8tap_sharp_smooth_c
Line
Count
Source
367
506
                                HIGHBD_DECL_SUFFIX) \
368
506
{ \
369
506
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
506
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
506
} \
mc_tmpl.c:put_8tap_sharp_c
Line
Count
Source
367
9.57k
                                HIGHBD_DECL_SUFFIX) \
368
9.57k
{ \
369
9.57k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
9.57k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
9.57k
} \
mc_tmpl.c:put_8tap_smooth_regular_c
Line
Count
Source
367
4.59k
                                HIGHBD_DECL_SUFFIX) \
368
4.59k
{ \
369
4.59k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
4.59k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
4.59k
} \
mc_tmpl.c:put_8tap_smooth_c
Line
Count
Source
367
9.44k
                                HIGHBD_DECL_SUFFIX) \
368
9.44k
{ \
369
9.44k
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
9.44k
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
9.44k
} \
mc_tmpl.c:put_8tap_smooth_sharp_c
Line
Count
Source
367
827
                                HIGHBD_DECL_SUFFIX) \
368
827
{ \
369
827
    put_8tap_c(dst, dst_stride, src, src_stride, w, h, mx, my, \
370
827
               type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
371
827
} \
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
190k
                                       HIGHBD_DECL_SUFFIX) \
380
190k
{ \
381
190k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
190k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
190k
} \
mc_tmpl.c:put_8tap_regular_scaled_c
Line
Count
Source
379
135k
                                       HIGHBD_DECL_SUFFIX) \
380
135k
{ \
381
135k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
135k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
135k
} \
mc_tmpl.c:put_8tap_regular_smooth_scaled_c
Line
Count
Source
379
3.04k
                                       HIGHBD_DECL_SUFFIX) \
380
3.04k
{ \
381
3.04k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
3.04k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
3.04k
} \
mc_tmpl.c:put_8tap_regular_sharp_scaled_c
Line
Count
Source
379
1.25k
                                       HIGHBD_DECL_SUFFIX) \
380
1.25k
{ \
381
1.25k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
1.25k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
1.25k
} \
mc_tmpl.c:put_8tap_sharp_regular_scaled_c
Line
Count
Source
379
2.24k
                                       HIGHBD_DECL_SUFFIX) \
380
2.24k
{ \
381
2.24k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
2.24k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
2.24k
} \
mc_tmpl.c:put_8tap_sharp_smooth_scaled_c
Line
Count
Source
379
902
                                       HIGHBD_DECL_SUFFIX) \
380
902
{ \
381
902
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
902
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
902
} \
mc_tmpl.c:put_8tap_sharp_scaled_c
Line
Count
Source
379
9.07k
                                       HIGHBD_DECL_SUFFIX) \
380
9.07k
{ \
381
9.07k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
9.07k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
9.07k
} \
mc_tmpl.c:put_8tap_smooth_regular_scaled_c
Line
Count
Source
379
3.81k
                                       HIGHBD_DECL_SUFFIX) \
380
3.81k
{ \
381
3.81k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
3.81k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
3.81k
} \
mc_tmpl.c:put_8tap_smooth_scaled_c
Line
Count
Source
379
33.9k
                                       HIGHBD_DECL_SUFFIX) \
380
33.9k
{ \
381
33.9k
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
33.9k
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
33.9k
} \
mc_tmpl.c:put_8tap_smooth_sharp_scaled_c
Line
Count
Source
379
922
                                       HIGHBD_DECL_SUFFIX) \
380
922
{ \
381
922
    put_8tap_scaled_c(dst, dst_stride, src, src_stride, w, h, mx, my, dx, dy, \
382
922
                      type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
383
922
} \
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
22.9k
                                 HIGHBD_DECL_SUFFIX) \
390
22.9k
{ \
391
22.9k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
22.9k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
22.9k
} \
mc_tmpl.c:prep_8tap_regular_c
Line
Count
Source
389
6.29k
                                 HIGHBD_DECL_SUFFIX) \
390
6.29k
{ \
391
6.29k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
6.29k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
6.29k
} \
mc_tmpl.c:prep_8tap_regular_smooth_c
Line
Count
Source
389
955
                                 HIGHBD_DECL_SUFFIX) \
390
955
{ \
391
955
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
955
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
955
} \
mc_tmpl.c:prep_8tap_regular_sharp_c
Line
Count
Source
389
1.29k
                                 HIGHBD_DECL_SUFFIX) \
390
1.29k
{ \
391
1.29k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
1.29k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
1.29k
} \
mc_tmpl.c:prep_8tap_sharp_regular_c
Line
Count
Source
389
2.40k
                                 HIGHBD_DECL_SUFFIX) \
390
2.40k
{ \
391
2.40k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
2.40k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
2.40k
} \
mc_tmpl.c:prep_8tap_sharp_smooth_c
Line
Count
Source
389
914
                                 HIGHBD_DECL_SUFFIX) \
390
914
{ \
391
914
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
914
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
914
} \
mc_tmpl.c:prep_8tap_sharp_c
Line
Count
Source
389
6.02k
                                 HIGHBD_DECL_SUFFIX) \
390
6.02k
{ \
391
6.02k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
6.02k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
6.02k
} \
mc_tmpl.c:prep_8tap_smooth_regular_c
Line
Count
Source
389
1.39k
                                 HIGHBD_DECL_SUFFIX) \
390
1.39k
{ \
391
1.39k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
1.39k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
1.39k
} \
mc_tmpl.c:prep_8tap_smooth_c
Line
Count
Source
389
2.90k
                                 HIGHBD_DECL_SUFFIX) \
390
2.90k
{ \
391
2.90k
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
2.90k
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
2.90k
} \
mc_tmpl.c:prep_8tap_smooth_sharp_c
Line
Count
Source
389
710
                                 HIGHBD_DECL_SUFFIX) \
390
710
{ \
391
710
    prep_8tap_c(tmp, src, src_stride, w, h, mx, my, \
392
710
                type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
393
710
} \
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
62.1k
                                        HIGHBD_DECL_SUFFIX) \
401
62.1k
{ \
402
62.1k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
62.1k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
62.1k
}
mc_tmpl.c:prep_8tap_regular_scaled_c
Line
Count
Source
400
25.8k
                                        HIGHBD_DECL_SUFFIX) \
401
25.8k
{ \
402
25.8k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
25.8k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
25.8k
}
mc_tmpl.c:prep_8tap_regular_smooth_scaled_c
Line
Count
Source
400
1.63k
                                        HIGHBD_DECL_SUFFIX) \
401
1.63k
{ \
402
1.63k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
1.63k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
1.63k
}
mc_tmpl.c:prep_8tap_regular_sharp_scaled_c
Line
Count
Source
400
2.67k
                                        HIGHBD_DECL_SUFFIX) \
401
2.67k
{ \
402
2.67k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
2.67k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
2.67k
}
mc_tmpl.c:prep_8tap_sharp_regular_scaled_c
Line
Count
Source
400
4.84k
                                        HIGHBD_DECL_SUFFIX) \
401
4.84k
{ \
402
4.84k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
4.84k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
4.84k
}
mc_tmpl.c:prep_8tap_sharp_smooth_scaled_c
Line
Count
Source
400
1.57k
                                        HIGHBD_DECL_SUFFIX) \
401
1.57k
{ \
402
1.57k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
1.57k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
1.57k
}
mc_tmpl.c:prep_8tap_sharp_scaled_c
Line
Count
Source
400
11.6k
                                        HIGHBD_DECL_SUFFIX) \
401
11.6k
{ \
402
11.6k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
11.6k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
11.6k
}
mc_tmpl.c:prep_8tap_smooth_regular_scaled_c
Line
Count
Source
400
4.39k
                                        HIGHBD_DECL_SUFFIX) \
401
4.39k
{ \
402
4.39k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
4.39k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
4.39k
}
mc_tmpl.c:prep_8tap_smooth_scaled_c
Line
Count
Source
400
8.08k
                                        HIGHBD_DECL_SUFFIX) \
401
8.08k
{ \
402
8.08k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
8.08k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
8.08k
}
mc_tmpl.c:prep_8tap_smooth_sharp_scaled_c
Line
Count
Source
400
1.43k
                                        HIGHBD_DECL_SUFFIX) \
401
1.43k
{ \
402
1.43k
    prep_8tap_scaled_c(tmp, src, src_stride, w, h, mx, my, dx, dy, \
403
1.43k
                       type_h | (type_v << 2) HIGHBD_TAIL_SUFFIX); \
404
1.43k
}
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
28.9M
    (16 * src[x] + ((mxy) * (src[x + stride] - src[x])))
418
419
#define FILTER_BILIN_RND(src, x, mxy, stride, sh) \
420
28.9M
    ((FILTER_BILIN(src, x, mxy, stride) + ((1 << (sh)) >> 1)) >> (sh))
421
422
#define FILTER_BILIN_CLIP(src, x, mxy, stride, sh) \
423
910k
    iclip_pixel(FILTER_BILIN_RND(src, x, mxy, stride, sh))
424
425
#define FILTER_BILIN2(src1, src2, x, mxy) \
426
89.4M
    (16 * src1[x] + ((mxy) * (src2[x] - src1[x])))
427
428
#define FILTER_BILIN_RND2(src1, src2, x, mxy, sh) \
429
89.4M
    ((FILTER_BILIN2(src1, src2, x, mxy) + ((1 << (sh)) >> 1)) >> (sh))
430
431
#define FILTER_BILIN_CLIP2(src1, src2, x, mxy, sh) \
432
59.2M
    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
41.5k
{
439
41.5k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
440
41.5k
    const int intermediate_rnd = (1 << intermediate_bits) >> 1;
441
41.5k
    dst_stride = PXSTRIDE(dst_stride);
442
41.5k
    src_stride = PXSTRIDE(src_stride);
443
444
41.5k
    if (mx) {
445
8.82k
        if (my) {
446
5.93k
            int16_t mid[128 * 129], *mid_ptr = mid;
447
5.93k
            int tmp_h = h + 1;
448
449
52.1k
            do {
450
669k
                for (int x = 0; x < w; x++)
451
617k
                    mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1,
452
52.1k
                                                  4 - intermediate_bits);
453
454
52.1k
                mid_ptr += 128;
455
52.1k
                src += src_stride;
456
52.1k
            } while (--tmp_h);
457
458
5.93k
            mid_ptr = mid;
459
46.2k
            do {
460
630k
                for (int x = 0; x < w; x++)
461
583k
                    dst[x] = FILTER_BILIN_CLIP(mid_ptr, x, my, 128,
462
46.2k
                                               4 + intermediate_bits);
463
464
46.2k
                mid_ptr += 128;
465
46.2k
                dst += dst_stride;
466
46.2k
            } while (--h);
467
5.93k
        } else {
468
21.6k
            do {
469
422k
                for (int x = 0; x < w; x++) {
470
400k
                    const int px = FILTER_BILIN_RND(src, x, mx, 1,
471
400k
                                                    4 - intermediate_bits);
472
400k
                    dst[x] = iclip_pixel((px + intermediate_rnd) >> intermediate_bits);
473
400k
                }
474
475
21.6k
                dst += dst_stride;
476
21.6k
                src += src_stride;
477
21.6k
            } while (--h);
478
2.88k
        }
479
32.7k
    } else if (my) {
480
24.1k
        do {
481
350k
            for (int x = 0; x < w; x++)
482
326k
                dst[x] = FILTER_BILIN_CLIP(src, x, my, src_stride, 4);
483
484
24.1k
            dst += dst_stride;
485
24.1k
            src += src_stride;
486
24.1k
        } while (--h);
487
2.77k
    } else
488
29.9k
        put_c(dst, dst_stride, src, src_stride, w, h);
489
41.5k
}
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
553k
{
497
553k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
498
553k
    int16_t mid[128 * 2];
499
553k
    int in_y = -2;
500
501
4.68M
    do {
502
4.68M
        int x;
503
4.68M
        int y = my >> 10;
504
4.68M
        int16_t *mid1 = &mid[(y & 1) * 128];
505
4.68M
        int16_t *mid2 = &mid[((y + 1) & 1) * 128];
506
4.68M
        int dmy = my & 0x3ff;
507
508
6.32M
        while (in_y < y) {
509
1.63M
            int imx = mx, ioff = 0;
510
1.63M
            int16_t *mid_ptr = &mid[(in_y & 1) * 128];
511
512
18.7M
            for (x = 0; x < w; x++) {
513
17.0M
                mid_ptr[x] = FILTER_BILIN_RND(src, ioff, imx >> 6, 1,
514
17.0M
                                              4 - intermediate_bits);
515
17.0M
                imx += dx;
516
17.0M
                ioff += imx >> 10;
517
17.0M
                imx &= 0x3ff;
518
17.0M
            }
519
520
1.63M
            src += PXSTRIDE(src_stride);
521
1.63M
            in_y++;
522
1.63M
        }
523
524
63.9M
        for (x = 0; x < w; x++)
525
59.2M
            dst[x] = FILTER_BILIN_CLIP2(mid1, mid2, x, dmy >> 6,
526
4.68M
                                       4 + intermediate_bits);
527
528
4.68M
        my += dy;
529
4.68M
        dst += PXSTRIDE(dst_stride);
530
4.68M
    } while (--h);
531
553k
}
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
12.2k
{
538
12.2k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
539
12.2k
    src_stride = PXSTRIDE(src_stride);
540
541
12.2k
    if (mx) {
542
6.41k
        if (my) {
543
3.79k
            int16_t mid[128 * 129], *mid_ptr = mid;
544
3.79k
            int tmp_h = h + 1;
545
546
51.7k
            do {
547
932k
                for (int x = 0; x < w; x++)
548
880k
                    mid_ptr[x] = FILTER_BILIN_RND(src, x, mx, 1,
549
51.7k
                                                  4 - intermediate_bits);
550
551
51.7k
                mid_ptr += 128;
552
51.7k
                src += src_stride;
553
51.7k
            } while (--tmp_h);
554
555
3.79k
            mid_ptr = mid;
556
47.9k
            do {
557
892k
                for (int x = 0; x < w; x++)
558
844k
                    tmp[x] = FILTER_BILIN_RND(mid_ptr, x, my, 128, 4) -
559
844k
                             PREP_BIAS;
560
561
47.9k
                mid_ptr += 128;
562
47.9k
                tmp += w;
563
47.9k
            } while (--h);
564
3.79k
        } else {
565
31.7k
            do {
566
623k
                for (int x = 0; x < w; x++)
567
591k
                    tmp[x] = FILTER_BILIN_RND(src, x, mx, 1,
568
591k
                                              4 - intermediate_bits) -
569
591k
                             PREP_BIAS;
570
571
31.7k
                tmp += w;
572
31.7k
                src += src_stride;
573
31.7k
            } while (--h);
574
2.61k
        }
575
6.41k
    } else if (my) {
576
23.9k
        do {
577
428k
            for (int x = 0; x < w; x++)
578
404k
                tmp[x] = FILTER_BILIN_RND(src, x, my, src_stride,
579
404k
                                          4 - intermediate_bits) - PREP_BIAS;
580
581
23.9k
            tmp += w;
582
23.9k
            src += src_stride;
583
23.9k
        } while (--h);
584
1.84k
    } else
585
4.01k
        prep_c(tmp, src, src_stride, w, h HIGHBD_TAIL_SUFFIX);
586
12.2k
}
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
175k
{
593
175k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
594
175k
    int16_t mid[128 * 2];
595
175k
    int in_y = -2;
596
597
2.13M
    do {
598
2.13M
        int x;
599
2.13M
        int y = my >> 10;
600
2.13M
        int16_t *mid1 = &mid[(y & 1) * 128];
601
2.13M
        int16_t *mid2 = &mid[((y + 1) & 1) * 128];
602
2.13M
        int dmy = my & 0x3ff;
603
604
2.71M
        while (in_y < y) {
605
584k
            int imx = mx, ioff = 0;
606
584k
            int16_t *mid_ptr = &mid[(in_y & 1) * 128];
607
608
7.82M
            for (x = 0; x < w; x++) {
609
7.23M
                mid_ptr[x] = FILTER_BILIN_RND(src, ioff, imx >> 6, 1,
610
7.23M
                                              4 - intermediate_bits);
611
7.23M
                imx += dx;
612
7.23M
                ioff += imx >> 10;
613
7.23M
                imx &= 0x3ff;
614
7.23M
            }
615
616
584k
            src += PXSTRIDE(src_stride);
617
584k
            in_y++;
618
584k
        }
619
620
32.3M
        for (x = 0; x < w; x++)
621
30.2M
            tmp[x] = FILTER_BILIN_RND2(mid1, mid2, x, dmy >> 6, 4) - PREP_BIAS;
622
623
2.13M
        my += dy;
624
2.13M
        tmp += w;
625
2.13M
    } while (--h);
626
175k
}
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
94.2k
{
632
94.2k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
633
94.2k
    const int sh = intermediate_bits + 1;
634
94.2k
    const int rnd = (1 << intermediate_bits) + PREP_BIAS * 2;
635
1.29M
    do {
636
24.7M
        for (int x = 0; x < w; x++)
637
23.4M
            dst[x] = iclip_pixel((tmp1[x] + tmp2[x] + rnd) >> sh);
638
639
1.29M
        tmp1 += w;
640
1.29M
        tmp2 += w;
641
1.29M
        dst += PXSTRIDE(dst_stride);
642
1.29M
    } while (--h);
643
94.2k
}
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
2.72k
{
649
2.72k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
650
2.72k
    const int sh = intermediate_bits + 4;
651
2.72k
    const int rnd = (8 << intermediate_bits) + PREP_BIAS * 16;
652
41.5k
    do {
653
681k
        for (int x = 0; x < w; x++)
654
639k
            dst[x] = iclip_pixel((tmp1[x] * weight +
655
639k
                                  tmp2[x] * (16 - weight) + rnd) >> sh);
656
657
41.5k
        tmp1 += w;
658
41.5k
        tmp2 += w;
659
41.5k
        dst += PXSTRIDE(dst_stride);
660
41.5k
    } while (--h);
661
2.72k
}
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
30.2k
{
667
30.2k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
668
30.2k
    const int sh = intermediate_bits + 6;
669
30.2k
    const int rnd = (32 << intermediate_bits) + PREP_BIAS * 64;
670
368k
    do {
671
5.22M
        for (int x = 0; x < w; x++)
672
4.85M
            dst[x] = iclip_pixel((tmp1[x] * mask[x] +
673
4.85M
                                  tmp2[x] * (64 - mask[x]) + rnd) >> sh);
674
675
368k
        tmp1 += w;
676
368k
        tmp2 += w;
677
368k
        mask += w;
678
368k
        dst += PXSTRIDE(dst_stride);
679
368k
    } while (--h);
680
30.2k
}
681
682
14.4M
#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
12.1k
{
686
112k
    do {
687
1.37M
        for (int x = 0; x < w; x++) {
688
1.25M
            dst[x] = blend_px(dst[x], tmp[x], mask[x]);
689
1.25M
        }
690
112k
        dst += PXSTRIDE(dst_stride);
691
112k
        tmp += w;
692
112k
        mask += w;
693
112k
    } while (--h);
694
12.1k
}
695
696
static void blend_v_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp,
697
                      const int w, int h)
698
148k
{
699
148k
    const uint8_t *const mask = &dav1d_obmc_masks[w];
700
1.39M
    do {
701
7.55M
        for (int x = 0; x < (w * 3) >> 2; x++) {
702
6.15M
            dst[x] = blend_px(dst[x], tmp[x], mask[x]);
703
6.15M
        }
704
1.39M
        dst += PXSTRIDE(dst_stride);
705
1.39M
        tmp += w;
706
1.39M
    } while (--h);
707
148k
}
708
709
static void blend_h_c(pixel *dst, const ptrdiff_t dst_stride, const pixel *tmp,
710
                      const int w, int h)
711
106k
{
712
106k
    const uint8_t *mask = &dav1d_obmc_masks[h];
713
106k
    h = (h * 3) >> 2;
714
559k
    do {
715
559k
        const int m = *mask++;
716
7.61M
        for (int x = 0; x < w; x++) {
717
7.05M
            dst[x] = blend_px(dst[x], tmp[x], m);
718
7.05M
        }
719
559k
        dst += PXSTRIDE(dst_stride);
720
559k
        tmp += w;
721
559k
    } while (--h);
722
106k
}
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
9.90k
{
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
9.90k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
732
9.90k
    const int bitdepth = bitdepth_from_max(bitdepth_max);
733
9.90k
    const int sh = intermediate_bits + 6;
734
9.90k
    const int rnd = (32 << intermediate_bits) + PREP_BIAS * 64;
735
9.90k
    const int mask_sh = bitdepth + intermediate_bits - 4;
736
9.90k
    const int mask_rnd = 1 << (mask_sh - 5);
737
279k
    do {
738
4.70M
        for (int x = 0; x < w; x++) {
739
4.42M
            const int tmpdiff = tmp1[x] - tmp2[x];
740
4.42M
            const int m = imin(38 + ((abs(tmpdiff) + mask_rnd) >> mask_sh), 64);
741
4.42M
            dst[x] = iclip_pixel((tmpdiff * m + tmp2[x] * 64 + rnd) >> sh);
742
743
4.42M
            if (ss_hor) {
744
2.86M
                x++;
745
746
2.86M
                const int tmpdiff = tmp1[x] - tmp2[x];
747
2.86M
                const int n = imin(38 + ((abs(tmpdiff) + mask_rnd) >> mask_sh), 64);
748
2.86M
                dst[x] = iclip_pixel((tmpdiff * n + tmp2[x] * 64 + rnd) >> sh);
749
750
2.86M
                if (h & ss_ver) {
751
1.22M
                    mask[x >> 1] = (m + n + mask[x >> 1] + 2 - sign) >> 2;
752
1.63M
                } else if (ss_ver) {
753
1.22M
                    mask[x >> 1] = m + n;
754
1.22M
                } else {
755
418k
                    mask[x >> 1] = (m + n + 1 - sign) >> 1;
756
418k
                }
757
2.86M
            } else {
758
1.56M
                mask[x] = m;
759
1.56M
            }
760
4.42M
        }
761
762
279k
        tmp1 += w;
763
279k
        tmp2 += w;
764
279k
        dst += PXSTRIDE(dst_stride);
765
279k
        if (!ss_ver || (h & 1)) mask += w >> ss_hor;
766
279k
    } while (--h);
767
9.90k
}
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
9.90k
                             const int sign HIGHBD_DECL_SUFFIX) \
774
9.90k
{ \
775
9.90k
    w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
776
9.90k
             HIGHBD_TAIL_SUFFIX); \
777
9.90k
}
mc_tmpl.c:w_mask_444_c
Line
Count
Source
773
1.75k
                             const int sign HIGHBD_DECL_SUFFIX) \
774
1.75k
{ \
775
1.75k
    w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
776
1.75k
             HIGHBD_TAIL_SUFFIX); \
777
1.75k
}
mc_tmpl.c:w_mask_422_c
Line
Count
Source
773
373
                             const int sign HIGHBD_DECL_SUFFIX) \
774
373
{ \
775
373
    w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
776
373
             HIGHBD_TAIL_SUFFIX); \
777
373
}
mc_tmpl.c:w_mask_420_c
Line
Count
Source
773
7.78k
                             const int sign HIGHBD_DECL_SUFFIX) \
774
7.78k
{ \
775
7.78k
    w_mask_c(dst, dst_stride, tmp1, tmp2, w, h, mask, sign, ss_hor, ss_ver \
776
7.78k
             HIGHBD_TAIL_SUFFIX); \
777
7.78k
}
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
21.8M
    ((F[0] * src[x - 3 * stride] + \
787
21.8M
      F[1] * src[x - 2 * stride] + \
788
21.8M
      F[2] * src[x - 1 * stride] + \
789
21.8M
      F[3] * src[x + 0 * stride] + \
790
21.8M
      F[4] * src[x + 1 * stride] + \
791
21.8M
      F[5] * src[x + 2 * stride] + \
792
21.8M
      F[6] * src[x + 3 * stride] + \
793
21.8M
      F[7] * src[x + 4 * stride] + \
794
21.8M
      ((1 << (sh)) >> 1)) >> (sh))
795
796
#define FILTER_WARP_CLIP(src, x, F, stride, sh) \
797
6.72M
    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
105k
{
804
105k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
805
105k
    int16_t mid[15 * 8], *mid_ptr = mid;
806
807
105k
    src -= 3 * PXSTRIDE(src_stride);
808
1.68M
    for (int y = 0; y < 15; y++, mx += abcd[1]) {
809
14.1M
        for (int x = 0, tmx = mx; x < 8; x++, tmx += abcd[0]) {
810
12.6M
            const int8_t *const filter =
811
12.6M
                dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)];
812
813
12.6M
            mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1,
814
12.6M
                                         7 - intermediate_bits);
815
12.6M
        }
816
1.57M
        src += PXSTRIDE(src_stride);
817
1.57M
        mid_ptr += 8;
818
1.57M
    }
819
820
105k
    mid_ptr = &mid[3 * 8];
821
946k
    for (int y = 0; y < 8; y++, my += abcd[3]) {
822
7.56M
        for (int x = 0, tmy = my; x < 8; x++, tmy += abcd[2]) {
823
6.72M
            const int8_t *const filter =
824
6.72M
                dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)];
825
826
6.72M
            dst[x] = FILTER_WARP_CLIP(mid_ptr, x, filter, 8,
827
6.72M
                                      7 + intermediate_bits);
828
6.72M
        }
829
840k
        mid_ptr += 8;
830
840k
        dst += PXSTRIDE(dst_stride);
831
840k
    }
832
105k
}
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
13.5k
{
839
13.5k
    const int intermediate_bits = get_intermediate_bits(bitdepth_max);
840
13.5k
    int16_t mid[15 * 8], *mid_ptr = mid;
841
842
13.5k
    src -= 3 * PXSTRIDE(src_stride);
843
216k
    for (int y = 0; y < 15; y++, mx += abcd[1]) {
844
1.82M
        for (int x = 0, tmx = mx; x < 8; x++, tmx += abcd[0]) {
845
1.62M
            const int8_t *const filter =
846
1.62M
                dav1d_mc_warp_filter[64 + ((tmx + 512) >> 10)];
847
848
1.62M
            mid_ptr[x] = FILTER_WARP_RND(src, x, filter, 1,
849
1.62M
                                         7 - intermediate_bits);
850
1.62M
        }
851
203k
        src += PXSTRIDE(src_stride);
852
203k
        mid_ptr += 8;
853
203k
    }
854
855
13.5k
    mid_ptr = &mid[3 * 8];
856
121k
    for (int y = 0; y < 8; y++, my += abcd[3]) {
857
975k
        for (int x = 0, tmy = my; x < 8; x++, tmy += abcd[2]) {
858
866k
            const int8_t *const filter =
859
866k
                dav1d_mc_warp_filter[64 + ((tmy + 512) >> 10)];
860
861
866k
            tmp[x] = FILTER_WARP_RND(mid_ptr, x, filter, 8, 7) - PREP_BIAS;
862
866k
        }
863
108k
        mid_ptr += 8;
864
108k
        tmp += tmp_stride;
865
108k
    }
866
13.5k
}
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
883k
{
874
    // find offset in reference of visible block to copy
875
883k
    ref += iclip((int) y, 0, (int) ih - 1) * PXSTRIDE(ref_stride) +
876
883k
           iclip((int) x, 0, (int) iw - 1);
877
878
    // number of pixels to extend (left, right, top, bottom)
879
883k
    const int left_ext = iclip((int) -x, 0, (int) bw - 1);
880
883k
    const int right_ext = iclip((int) (x + bw - iw), 0, (int) bw - 1);
881
883k
    assert(left_ext + right_ext < bw);
882
883k
    const int top_ext = iclip((int) -y, 0, (int) bh - 1);
883
883k
    const int bottom_ext = iclip((int) (y + bh - ih), 0, (int) bh - 1);
884
883k
    assert(top_ext + bottom_ext < bh);
885
886
    // copy visible portion first
887
883k
    pixel *blk = dst + top_ext * PXSTRIDE(dst_stride);
888
883k
    const int center_w = (int) (bw - left_ext - right_ext);
889
883k
    const int center_h = (int) (bh - top_ext - bottom_ext);
890
8.66M
    for (int y = 0; y < center_h; y++) {
891
7.78M
        pixel_copy(blk + left_ext, ref, center_w);
892
        // extend left edge for this line
893
7.78M
        if (left_ext)
894
2.67M
            pixel_set(blk, blk[left_ext], left_ext);
895
        // extend right edge for this line
896
7.78M
        if (right_ext)
897
4.80M
            pixel_set(blk + left_ext + center_w, blk[left_ext + center_w - 1],
898
4.80M
                      right_ext);
899
7.78M
        ref += PXSTRIDE(ref_stride);
900
7.78M
        blk += PXSTRIDE(dst_stride);
901
7.78M
    }
902
903
    // copy top
904
883k
    blk = dst + top_ext * PXSTRIDE(dst_stride);
905
1.69M
    for (int y = 0; y < top_ext; y++) {
906
807k
        pixel_copy(dst, blk, bw);
907
807k
        dst += PXSTRIDE(dst_stride);
908
807k
    }
909
910
    // copy bottom
911
883k
    dst += center_h * PXSTRIDE(dst_stride);
912
2.08M
    for (int y = 0; y < bottom_ext; y++) {
913
1.19M
        pixel_copy(dst, &dst[-PXSTRIDE(dst_stride)], bw);
914
1.19M
        dst += PXSTRIDE(dst_stride);
915
1.19M
    }
916
883k
}
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
128k
{
923
4.56M
    do {
924
4.56M
        int mx = mx0, src_x = -1;
925
293M
        for (int x = 0; x < dst_w; x++) {
926
288M
            const int8_t *const F = dav1d_resize_filter[mx >> 8];
927
288M
            dst[x] = iclip_pixel((-(F[0] * src[iclip(src_x - 3, 0, src_w - 1)] +
928
288M
                                    F[1] * src[iclip(src_x - 2, 0, src_w - 1)] +
929
288M
                                    F[2] * src[iclip(src_x - 1, 0, src_w - 1)] +
930
288M
                                    F[3] * src[iclip(src_x + 0, 0, src_w - 1)] +
931
288M
                                    F[4] * src[iclip(src_x + 1, 0, src_w - 1)] +
932
288M
                                    F[5] * src[iclip(src_x + 2, 0, src_w - 1)] +
933
288M
                                    F[6] * src[iclip(src_x + 3, 0, src_w - 1)] +
934
288M
                                    F[7] * src[iclip(src_x + 4, 0, src_w - 1)]) +
935
288M
                                  64) >> 7);
936
288M
            mx += dx;
937
288M
            src_x += mx >> 14;
938
288M
            mx &= 0x3fff;
939
288M
        }
940
941
4.56M
        dst += PXSTRIDE(dst_stride);
942
4.56M
        src += PXSTRIDE(src_stride);
943
4.56M
    } while (--h);
944
128k
}
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
40.4k
COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) {
961
404k
#define init_mc_fns(type, name) do { \
962
404k
    c->mc        [type] = put_##name##_c; \
963
404k
    c->mc_scaled [type] = put_##name##_scaled_c; \
964
404k
    c->mct       [type] = prep_##name##_c; \
965
404k
    c->mct_scaled[type] = prep_##name##_scaled_c; \
966
404k
} while (0)
967
968
40.4k
    init_mc_fns(FILTER_2D_8TAP_REGULAR,        8tap_regular);
969
40.4k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth);
970
40.4k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp);
971
40.4k
    init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular);
972
40.4k
    init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth);
973
40.4k
    init_mc_fns(FILTER_2D_8TAP_SHARP,          8tap_sharp);
974
40.4k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular);
975
40.4k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH,         8tap_smooth);
976
40.4k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp);
977
40.4k
    init_mc_fns(FILTER_2D_BILINEAR,            bilin);
978
979
40.4k
    c->avg      = avg_c;
980
40.4k
    c->w_avg    = w_avg_c;
981
40.4k
    c->mask     = mask_c;
982
40.4k
    c->blend    = blend_c;
983
40.4k
    c->blend_v  = blend_v_c;
984
40.4k
    c->blend_h  = blend_h_c;
985
40.4k
    c->w_mask[0] = w_mask_444_c;
986
40.4k
    c->w_mask[1] = w_mask_422_c;
987
40.4k
    c->w_mask[2] = w_mask_420_c;
988
40.4k
    c->warp8x8  = warp_affine_8x8_c;
989
40.4k
    c->warp8x8t = warp_affine_8x8t_c;
990
40.4k
    c->emu_edge = emu_edge_c;
991
40.4k
    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
40.4k
}
dav1d_mc_dsp_init_8bpc
Line
Count
Source
960
18.0k
COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) {
961
18.0k
#define init_mc_fns(type, name) do { \
962
18.0k
    c->mc        [type] = put_##name##_c; \
963
18.0k
    c->mc_scaled [type] = put_##name##_scaled_c; \
964
18.0k
    c->mct       [type] = prep_##name##_c; \
965
18.0k
    c->mct_scaled[type] = prep_##name##_scaled_c; \
966
18.0k
} while (0)
967
968
18.0k
    init_mc_fns(FILTER_2D_8TAP_REGULAR,        8tap_regular);
969
18.0k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth);
970
18.0k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp);
971
18.0k
    init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular);
972
18.0k
    init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth);
973
18.0k
    init_mc_fns(FILTER_2D_8TAP_SHARP,          8tap_sharp);
974
18.0k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular);
975
18.0k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH,         8tap_smooth);
976
18.0k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp);
977
18.0k
    init_mc_fns(FILTER_2D_BILINEAR,            bilin);
978
979
18.0k
    c->avg      = avg_c;
980
18.0k
    c->w_avg    = w_avg_c;
981
18.0k
    c->mask     = mask_c;
982
18.0k
    c->blend    = blend_c;
983
18.0k
    c->blend_v  = blend_v_c;
984
18.0k
    c->blend_h  = blend_h_c;
985
18.0k
    c->w_mask[0] = w_mask_444_c;
986
18.0k
    c->w_mask[1] = w_mask_422_c;
987
18.0k
    c->w_mask[2] = w_mask_420_c;
988
18.0k
    c->warp8x8  = warp_affine_8x8_c;
989
18.0k
    c->warp8x8t = warp_affine_8x8t_c;
990
18.0k
    c->emu_edge = emu_edge_c;
991
18.0k
    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
18.0k
}
dav1d_mc_dsp_init_16bpc
Line
Count
Source
960
22.3k
COLD void bitfn(dav1d_mc_dsp_init)(Dav1dMCDSPContext *const c) {
961
22.3k
#define init_mc_fns(type, name) do { \
962
22.3k
    c->mc        [type] = put_##name##_c; \
963
22.3k
    c->mc_scaled [type] = put_##name##_scaled_c; \
964
22.3k
    c->mct       [type] = prep_##name##_c; \
965
22.3k
    c->mct_scaled[type] = prep_##name##_scaled_c; \
966
22.3k
} while (0)
967
968
22.3k
    init_mc_fns(FILTER_2D_8TAP_REGULAR,        8tap_regular);
969
22.3k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SMOOTH, 8tap_regular_smooth);
970
22.3k
    init_mc_fns(FILTER_2D_8TAP_REGULAR_SHARP,  8tap_regular_sharp);
971
22.3k
    init_mc_fns(FILTER_2D_8TAP_SHARP_REGULAR,  8tap_sharp_regular);
972
22.3k
    init_mc_fns(FILTER_2D_8TAP_SHARP_SMOOTH,   8tap_sharp_smooth);
973
22.3k
    init_mc_fns(FILTER_2D_8TAP_SHARP,          8tap_sharp);
974
22.3k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_REGULAR, 8tap_smooth_regular);
975
22.3k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH,         8tap_smooth);
976
22.3k
    init_mc_fns(FILTER_2D_8TAP_SMOOTH_SHARP,   8tap_smooth_sharp);
977
22.3k
    init_mc_fns(FILTER_2D_BILINEAR,            bilin);
978
979
22.3k
    c->avg      = avg_c;
980
22.3k
    c->w_avg    = w_avg_c;
981
22.3k
    c->mask     = mask_c;
982
22.3k
    c->blend    = blend_c;
983
22.3k
    c->blend_v  = blend_v_c;
984
22.3k
    c->blend_h  = blend_h_c;
985
22.3k
    c->w_mask[0] = w_mask_444_c;
986
22.3k
    c->w_mask[1] = w_mask_422_c;
987
22.3k
    c->w_mask[2] = w_mask_420_c;
988
22.3k
    c->warp8x8  = warp_affine_8x8_c;
989
22.3k
    c->warp8x8t = warp_affine_8x8t_c;
990
22.3k
    c->emu_edge = emu_edge_c;
991
22.3k
    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
22.3k
}