Coverage Report

Created: 2026-04-29 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ffmpeg/libswscale/ops_tmpl_int.c
Line
Count
Source
1
/**
2
 * Copyright (C) 2025 Niklas Haas
3
 *
4
 * This file is part of FFmpeg.
5
 *
6
 * FFmpeg is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * FFmpeg is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with FFmpeg; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
 */
20
21
#include "libavutil/avassert.h"
22
#include "libavutil/bswap.h"
23
24
#include "ops_backend.h"
25
26
#ifndef BIT_DEPTH
27
#  define BIT_DEPTH 8
28
#endif
29
30
#if BIT_DEPTH == 32
31
#  define PIXEL_TYPE SWS_PIXEL_U32
32
#  define PIXEL_MAX  0xFFFFFFFFu
33
0
#  define SWAP_BYTES av_bswap32
34
0
#  define pixel_t    uint32_t
35
0
#  define inter_t    int64_t
36
#  define block_t    u32block_t
37
0
#  define px         u32
38
#elif BIT_DEPTH == 16
39
#  define PIXEL_TYPE SWS_PIXEL_U16
40
#  define PIXEL_MAX  0xFFFFu
41
0
#  define SWAP_BYTES av_bswap16
42
0
#  define pixel_t    uint16_t
43
0
#  define inter_t    int64_t
44
#  define block_t    u16block_t
45
0
#  define px         u16
46
#elif BIT_DEPTH == 8
47
#  define PIXEL_TYPE SWS_PIXEL_U8
48
#  define PIXEL_MAX  0xFFu
49
0
#  define pixel_t    uint8_t
50
0
#  define inter_t    int32_t
51
#  define block_t    u8block_t
52
0
#  define px         u8
53
#else
54
#  error Invalid BIT_DEPTH
55
#endif
56
57
#define IS_FLOAT  0
58
#define FMT_CHAR  u
59
#include "ops_tmpl_common.c"
60
61
DECL_READ(read_planar, const int elems)
62
0
{
63
0
    SWS_LOOP
64
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
65
0
        x[i] = in0[i];
66
0
        if (elems > 1)
67
0
            y[i] = in1[i];
68
0
        if (elems > 2)
69
0
            z[i] = in2[i];
70
0
        if (elems > 3)
71
0
            w[i] = in3[i];
72
0
    }
73
74
0
    CONTINUE(x, y, z, w);
75
0
}
Unexecuted instantiation: ops_backend.c:read_planar_u8
Unexecuted instantiation: ops_backend.c:read_planar_u16
Unexecuted instantiation: ops_backend.c:read_planar_u32
76
77
DECL_READ(read_packed, const int elems)
78
0
{
79
0
    SWS_LOOP
80
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
81
0
        x[i] = in0[elems * i + 0];
82
0
        if (elems > 1)
83
0
            y[i] = in0[elems * i + 1];
84
0
        if (elems > 2)
85
0
            z[i] = in0[elems * i + 2];
86
0
        if (elems > 3)
87
0
            w[i] = in0[elems * i + 3];
88
0
    }
89
90
0
    CONTINUE(x, y, z, w);
91
0
}
Unexecuted instantiation: ops_backend.c:read_packed_u8
Unexecuted instantiation: ops_backend.c:read_packed_u16
Unexecuted instantiation: ops_backend.c:read_packed_u32
92
93
DECL_WRITE(write_planar, const int elems)
94
0
{
95
0
    SWS_LOOP
96
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
97
0
        out0[i] = x[i];
98
0
        if (elems > 1)
99
0
            out1[i] = y[i];
100
0
        if (elems > 2)
101
0
            out2[i] = z[i];
102
0
        if (elems > 3)
103
0
            out3[i] = w[i];
104
0
    }
105
0
}
Unexecuted instantiation: ops_backend.c:write_planar_u8
Unexecuted instantiation: ops_backend.c:write_planar_u16
Unexecuted instantiation: ops_backend.c:write_planar_u32
106
107
DECL_WRITE(write_packed, const int elems)
108
0
{
109
0
    SWS_LOOP
110
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
111
0
        out0[elems * i + 0] = x[i];
112
0
        if (elems > 1)
113
0
            out0[elems * i + 1] = y[i];
114
0
        if (elems > 2)
115
0
            out0[elems * i + 2] = z[i];
116
0
        if (elems > 3)
117
0
            out0[elems * i + 3] = w[i];
118
0
    }
119
0
}
Unexecuted instantiation: ops_backend.c:write_packed_u8
Unexecuted instantiation: ops_backend.c:write_packed_u16
Unexecuted instantiation: ops_backend.c:write_packed_u32
120
121
#define WRAP_READ(FUNC, ELEMS, FRAC, PACKED)                                    \
122
static av_flatten void fn(FUNC##ELEMS)(SwsOpIter *restrict iter,                \
123
                                       const SwsOpImpl *restrict impl,          \
124
                                       void *restrict x, void *restrict y,      \
125
0
                                       void *restrict z, void *restrict w)      \
126
0
{                                                                               \
127
0
    CALL_READ(FUNC, ELEMS);                                                     \
128
0
    for (int i = 0; i < (PACKED ? 1 : ELEMS); i++)                              \
129
0
        iter->in[i] += sizeof(block_t) * (PACKED ? ELEMS : 1) >> FRAC;          \
130
0
}                                                                               \
Unexecuted instantiation: ops_backend.c:read_planar1_u8
Unexecuted instantiation: ops_backend.c:read_planar2_u8
Unexecuted instantiation: ops_backend.c:read_planar3_u8
Unexecuted instantiation: ops_backend.c:read_planar4_u8
Unexecuted instantiation: ops_backend.c:read_packed2_u8
Unexecuted instantiation: ops_backend.c:read_packed3_u8
Unexecuted instantiation: ops_backend.c:read_packed4_u8
Unexecuted instantiation: ops_backend.c:read_bits1_u8
Unexecuted instantiation: ops_backend.c:read_nibbles1_u8
Unexecuted instantiation: ops_backend.c:read_planar1_u16
Unexecuted instantiation: ops_backend.c:read_planar2_u16
Unexecuted instantiation: ops_backend.c:read_planar3_u16
Unexecuted instantiation: ops_backend.c:read_planar4_u16
Unexecuted instantiation: ops_backend.c:read_packed2_u16
Unexecuted instantiation: ops_backend.c:read_packed3_u16
Unexecuted instantiation: ops_backend.c:read_packed4_u16
Unexecuted instantiation: ops_backend.c:read_planar1_u32
Unexecuted instantiation: ops_backend.c:read_planar2_u32
Unexecuted instantiation: ops_backend.c:read_planar3_u32
Unexecuted instantiation: ops_backend.c:read_planar4_u32
Unexecuted instantiation: ops_backend.c:read_packed2_u32
Unexecuted instantiation: ops_backend.c:read_packed3_u32
Unexecuted instantiation: ops_backend.c:read_packed4_u32
131
                                                                                \
132
DECL_ENTRY(FUNC##ELEMS, SWS_COMP_ELEMS(ELEMS),                                  \
133
    .op = SWS_OP_READ,                                                          \
134
    .rw = {                                                                     \
135
        .elems  = ELEMS,                                                        \
136
        .packed = PACKED,                                                       \
137
        .frac   = FRAC,                                                         \
138
    },                                                                          \
139
);
140
141
WRAP_READ(read_planar, 1, 0, false)
142
WRAP_READ(read_planar, 2, 0, false)
143
WRAP_READ(read_planar, 3, 0, false)
144
WRAP_READ(read_planar, 4, 0, false)
145
WRAP_READ(read_packed, 2, 0, true)
146
WRAP_READ(read_packed, 3, 0, true)
147
WRAP_READ(read_packed, 4, 0, true)
148
149
#define WRAP_WRITE(FUNC, ELEMS, FRAC, PACKED)                                   \
150
static av_flatten void fn(FUNC##ELEMS)(SwsOpIter *restrict iter,                \
151
                                       const SwsOpImpl *restrict impl,          \
152
                                       void *restrict x, void *restrict y,      \
153
0
                                       void *restrict z, void *restrict w)      \
154
0
{                                                                               \
155
0
    CALL_WRITE(FUNC, ELEMS);                                                    \
156
0
    for (int i = 0; i < (PACKED ? 1 : ELEMS); i++)                              \
157
0
        iter->out[i] += sizeof(block_t) * (PACKED ? ELEMS : 1) >> FRAC;         \
158
0
}                                                                               \
Unexecuted instantiation: ops_backend.c:write_planar1_u8
Unexecuted instantiation: ops_backend.c:write_planar2_u8
Unexecuted instantiation: ops_backend.c:write_planar3_u8
Unexecuted instantiation: ops_backend.c:write_planar4_u8
Unexecuted instantiation: ops_backend.c:write_packed2_u8
Unexecuted instantiation: ops_backend.c:write_packed3_u8
Unexecuted instantiation: ops_backend.c:write_packed4_u8
Unexecuted instantiation: ops_backend.c:write_bits1_u8
Unexecuted instantiation: ops_backend.c:write_nibbles1_u8
Unexecuted instantiation: ops_backend.c:write_planar1_u16
Unexecuted instantiation: ops_backend.c:write_planar2_u16
Unexecuted instantiation: ops_backend.c:write_planar3_u16
Unexecuted instantiation: ops_backend.c:write_planar4_u16
Unexecuted instantiation: ops_backend.c:write_packed2_u16
Unexecuted instantiation: ops_backend.c:write_packed3_u16
Unexecuted instantiation: ops_backend.c:write_packed4_u16
Unexecuted instantiation: ops_backend.c:write_planar1_u32
Unexecuted instantiation: ops_backend.c:write_planar2_u32
Unexecuted instantiation: ops_backend.c:write_planar3_u32
Unexecuted instantiation: ops_backend.c:write_planar4_u32
Unexecuted instantiation: ops_backend.c:write_packed2_u32
Unexecuted instantiation: ops_backend.c:write_packed3_u32
Unexecuted instantiation: ops_backend.c:write_packed4_u32
159
                                                                                \
160
DECL_ENTRY(FUNC##ELEMS, SWS_COMP_ALL,                                           \
161
    .op = SWS_OP_WRITE,                                                         \
162
    .rw = {                                                                     \
163
        .elems  = ELEMS,                                                        \
164
        .packed = PACKED,                                                       \
165
        .frac   = FRAC,                                                         \
166
    },                                                                          \
167
);
168
169
WRAP_WRITE(write_planar, 1, 0, false)
170
WRAP_WRITE(write_planar, 2, 0, false)
171
WRAP_WRITE(write_planar, 3, 0, false)
172
WRAP_WRITE(write_planar, 4, 0, false)
173
WRAP_WRITE(write_packed, 2, 0, true)
174
WRAP_WRITE(write_packed, 3, 0, true)
175
WRAP_WRITE(write_packed, 4, 0, true)
176
177
#if BIT_DEPTH == 8
178
DECL_READ(read_nibbles, const int elems)
179
0
{
180
0
    SWS_LOOP
181
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i += 2) {
182
0
        const pixel_t val = ((const pixel_t *) in0)[i >> 1];
183
0
        x[i + 0] = val >> 4;  /* high nibble */
184
0
        x[i + 1] = val & 0xF; /* low nibble */
185
0
    }
186
187
0
    CONTINUE(x, y, z, w);
188
0
}
189
190
DECL_READ(read_bits, const int elems)
191
0
{
192
0
    SWS_LOOP
193
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i += 8) {
194
0
        const pixel_t val = ((const pixel_t *) in0)[i >> 3];
195
0
        x[i + 0] = (val >> 7) & 1;
196
0
        x[i + 1] = (val >> 6) & 1;
197
0
        x[i + 2] = (val >> 5) & 1;
198
0
        x[i + 3] = (val >> 4) & 1;
199
0
        x[i + 4] = (val >> 3) & 1;
200
0
        x[i + 5] = (val >> 2) & 1;
201
0
        x[i + 6] = (val >> 1) & 1;
202
0
        x[i + 7] = (val >> 0) & 1;
203
0
    }
204
205
0
    CONTINUE(x, y, z, w);
206
0
}
207
208
WRAP_READ(read_nibbles, 1, 1, false)
209
WRAP_READ(read_bits,    1, 3, false)
210
211
DECL_WRITE(write_nibbles, const int elems)
212
0
{
213
0
    SWS_LOOP
214
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i += 2)
215
0
        out0[i >> 1] = x[i] << 4 | x[i + 1];
216
0
}
217
218
DECL_WRITE(write_bits, const int elems)
219
0
{
220
0
    SWS_LOOP
221
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i += 8) {
222
0
        out0[i >> 3] = x[i + 0] << 7 |
223
0
                       x[i + 1] << 6 |
224
0
                       x[i + 2] << 5 |
225
0
                       x[i + 3] << 4 |
226
0
                       x[i + 4] << 3 |
227
0
                       x[i + 5] << 2 |
228
0
                       x[i + 6] << 1 |
229
0
                       x[i + 7];
230
0
    }
231
0
}
232
233
WRAP_WRITE(write_nibbles, 1, 1, false)
234
WRAP_WRITE(write_bits,    1, 3, false)
235
#endif /* BIT_DEPTH == 8 */
236
237
#ifdef SWAP_BYTES
238
DECL_PATTERN(swap_bytes)
239
0
{
240
0
    SWS_LOOP
241
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
242
0
        if (X)
243
0
            x[i] = SWAP_BYTES(x[i]);
244
0
        if (Y)
245
0
            y[i] = SWAP_BYTES(y[i]);
246
0
        if (Z)
247
0
            z[i] = SWAP_BYTES(z[i]);
248
0
        if (W)
249
0
            w[i] = SWAP_BYTES(w[i]);
250
0
    }
251
252
0
    CONTINUE(x, y, z, w);
253
0
}
Unexecuted instantiation: ops_backend.c:swap_bytes_u16
Unexecuted instantiation: ops_backend.c:swap_bytes_u32
254
255
WRAP_COMMON_PATTERNS(swap_bytes, .op = SWS_OP_SWAP_BYTES);
256
#endif /* SWAP_BYTES */
257
258
#if BIT_DEPTH == 8
259
DECL_PATTERN(expand16)
260
0
{
261
0
    u16block_t x16, y16, z16, w16;
262
263
0
    SWS_LOOP
264
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
265
0
        if (X)
266
0
            x16[i] = x[i] << 8 | x[i];
267
0
        if (Y)
268
0
            y16[i] = y[i] << 8 | y[i];
269
0
        if (Z)
270
0
            z16[i] = z[i] << 8 | z[i];
271
0
        if (W)
272
0
            w16[i] = w[i] << 8 | w[i];
273
0
    }
274
275
0
    CONTINUE(x16, y16, z16, w16);
276
0
}
277
278
WRAP_COMMON_PATTERNS(expand16,
279
    .op = SWS_OP_CONVERT,
280
    .convert.to = SWS_PIXEL_U16,
281
    .convert.expand = true,
282
);
283
284
DECL_PATTERN(expand32)
285
0
{
286
0
    u32block_t x32, y32, z32, w32;
287
288
0
    SWS_LOOP
289
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
290
0
        x32[i] = (uint32_t)x[i] << 24 | x[i] << 16 | x[i] << 8 | x[i];
291
0
        y32[i] = (uint32_t)y[i] << 24 | y[i] << 16 | y[i] << 8 | y[i];
292
0
        z32[i] = (uint32_t)z[i] << 24 | z[i] << 16 | z[i] << 8 | z[i];
293
0
        w32[i] = (uint32_t)w[i] << 24 | w[i] << 16 | w[i] << 8 | w[i];
294
0
    }
295
296
0
    CONTINUE(x32, y32, z32, w32);
297
0
}
298
299
WRAP_COMMON_PATTERNS(expand32,
300
    .op = SWS_OP_CONVERT,
301
    .convert.to = SWS_PIXEL_U32,
302
    .convert.expand = true,
303
);
304
#endif
305
306
DECL_FUNC(pack, const int bits0, const int bits1, const int bits2, const int bits3)
307
0
{
308
0
    SWS_LOOP
309
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
310
0
        x[i] = x[i] << (bits1 + bits2 + bits3);
311
0
        if (bits1)
312
0
            x[i] |= y[i] << (bits2 + bits3);
313
0
        if (bits2)
314
0
            x[i] |= z[i] << bits3;
315
0
        if (bits3)
316
0
            x[i] |= w[i];
317
0
    }
318
319
0
    CONTINUE(x, y, z, w);
320
0
}
Unexecuted instantiation: ops_backend.c:pack_u8
Unexecuted instantiation: ops_backend.c:pack_u16
Unexecuted instantiation: ops_backend.c:pack_u32
321
322
DECL_FUNC(unpack, const int bits0, const int bits1, const int bits2, const int bits3)
323
0
{
324
0
    SWS_LOOP
325
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
326
0
        const pixel_t val = x[i];
327
0
        x[i] = val >> (bits1 + bits2 + bits3);
328
0
        if (bits1)
329
0
            y[i] = (val >> (bits2 + bits3)) & ((1 << bits1) - 1);
330
0
        if (bits2)
331
0
            z[i] = (val >> bits3) & ((1 << bits2) - 1);
332
0
        if (bits3)
333
0
            w[i] = val & ((1 << bits3) - 1);
334
0
    }
335
336
0
    CONTINUE(x, y, z, w);
337
0
}
Unexecuted instantiation: ops_backend.c:unpack_u8
Unexecuted instantiation: ops_backend.c:unpack_u16
Unexecuted instantiation: ops_backend.c:unpack_u32
338
339
#define WRAP_PACK_UNPACK(X, Y, Z, W)                                            \
340
DECL_IMPL(pack, pack_##X##Y##Z##W, X, Y, Z, W)                                  \
341
                                                                                \
342
DECL_ENTRY(pack_##X##Y##Z##W, SWS_COMP(0),                                      \
343
    .op = SWS_OP_PACK,                                                          \
344
    .pack.pattern = { X, Y, Z, W },                                             \
345
);                                                                              \
346
                                                                                \
347
DECL_IMPL(unpack, unpack_##X##Y##Z##W, X, Y, Z, W)                              \
348
                                                                                \
349
DECL_ENTRY(unpack_##X##Y##Z##W, SWS_COMP_MASK(X, Y, Z, W),                      \
350
    .op = SWS_OP_UNPACK,                                                        \
351
    .pack.pattern = { X, Y, Z, W },                                             \
352
);
353
354
WRAP_PACK_UNPACK( 3,  3,  2,  0)
355
WRAP_PACK_UNPACK( 2,  3,  3,  0)
356
WRAP_PACK_UNPACK( 1,  2,  1,  0)
357
WRAP_PACK_UNPACK( 5,  6,  5,  0)
358
WRAP_PACK_UNPACK( 5,  5,  5,  0)
359
WRAP_PACK_UNPACK( 4,  4,  4,  0)
360
WRAP_PACK_UNPACK( 2, 10, 10, 10)
361
WRAP_PACK_UNPACK(10, 10, 10,  2)
362
363
#if BIT_DEPTH != 8
364
DECL_PATTERN(lshift)
365
0
{
366
0
    const uint8_t amount = impl->priv.u8[0];
367
368
0
    SWS_LOOP
369
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
370
0
        x[i] <<= amount;
371
0
        y[i] <<= amount;
372
0
        z[i] <<= amount;
373
0
        w[i] <<= amount;
374
0
    }
375
376
0
    CONTINUE(x, y, z, w);
377
0
}
Unexecuted instantiation: ops_backend.c:lshift_u16
Unexecuted instantiation: ops_backend.c:lshift_u32
378
379
DECL_PATTERN(rshift)
380
0
{
381
0
    const uint8_t amount = impl->priv.u8[0];
382
383
0
    SWS_LOOP
384
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
385
0
        x[i] >>= amount;
386
0
        y[i] >>= amount;
387
0
        z[i] >>= amount;
388
0
        w[i] >>= amount;
389
0
    }
390
391
0
    CONTINUE(x, y, z, w);
392
0
}
Unexecuted instantiation: ops_backend.c:rshift_u16
Unexecuted instantiation: ops_backend.c:rshift_u32
393
394
WRAP_COMMON_PATTERNS(lshift,
395
    .op       = SWS_OP_LSHIFT,
396
    .setup    = ff_sws_setup_shift,
397
    .flexible = true,
398
);
399
400
WRAP_COMMON_PATTERNS(rshift,
401
    .op       = SWS_OP_RSHIFT,
402
    .setup    = ff_sws_setup_shift,
403
    .flexible = true,
404
);
405
#endif /* BIT_DEPTH != 8 */
406
407
DECL_PATTERN(convert_float)
408
0
{
409
0
    f32block_t xf, yf, zf, wf;
410
411
0
    SWS_LOOP
412
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
413
0
        xf[i] = x[i];
414
0
        yf[i] = y[i];
415
0
        zf[i] = z[i];
416
0
        wf[i] = w[i];
417
0
    }
418
419
0
    CONTINUE(xf, yf, zf, wf);
420
0
}
Unexecuted instantiation: ops_backend.c:convert_float_u8
Unexecuted instantiation: ops_backend.c:convert_float_u16
Unexecuted instantiation: ops_backend.c:convert_float_u32
421
422
WRAP_COMMON_PATTERNS(convert_float,
423
    .op = SWS_OP_CONVERT,
424
    .convert.to = SWS_PIXEL_F32,
425
);
426
427
/**
428
 * Swizzle by directly swapping the order of arguments to the continuation.
429
 * Note that this is only safe to do if no arguments are duplicated.
430
 */
431
#define DECL_SWIZZLE(X, Y, Z, W)                                                \
432
static void                                                                     \
433
fn(swizzle_##X##Y##Z##W)(SwsOpIter *restrict iter,                              \
434
                         const SwsOpImpl *restrict impl,                        \
435
                         void *restrict c0, void *restrict c1,                  \
436
0
                         void *restrict c2, void *restrict c3)                  \
437
0
{                                                                               \
438
0
    CONTINUE(c##X, c##Y, c##Z, c##W);                                           \
439
0
}                                                                               \
Unexecuted instantiation: ops_backend.c:swizzle_3012_u8
Unexecuted instantiation: ops_backend.c:swizzle_3021_u8
Unexecuted instantiation: ops_backend.c:swizzle_2103_u8
Unexecuted instantiation: ops_backend.c:swizzle_3210_u8
Unexecuted instantiation: ops_backend.c:swizzle_3102_u8
Unexecuted instantiation: ops_backend.c:swizzle_3201_u8
Unexecuted instantiation: ops_backend.c:swizzle_1203_u8
Unexecuted instantiation: ops_backend.c:swizzle_1023_u8
Unexecuted instantiation: ops_backend.c:swizzle_2013_u8
Unexecuted instantiation: ops_backend.c:swizzle_2310_u8
Unexecuted instantiation: ops_backend.c:swizzle_2130_u8
Unexecuted instantiation: ops_backend.c:swizzle_1230_u8
Unexecuted instantiation: ops_backend.c:swizzle_1320_u8
Unexecuted instantiation: ops_backend.c:swizzle_0213_u8
Unexecuted instantiation: ops_backend.c:swizzle_0231_u8
Unexecuted instantiation: ops_backend.c:swizzle_0312_u8
Unexecuted instantiation: ops_backend.c:swizzle_3120_u8
Unexecuted instantiation: ops_backend.c:swizzle_0321_u8
Unexecuted instantiation: ops_backend.c:swizzle_3012_u16
Unexecuted instantiation: ops_backend.c:swizzle_3021_u16
Unexecuted instantiation: ops_backend.c:swizzle_2103_u16
Unexecuted instantiation: ops_backend.c:swizzle_3210_u16
Unexecuted instantiation: ops_backend.c:swizzle_3102_u16
Unexecuted instantiation: ops_backend.c:swizzle_3201_u16
Unexecuted instantiation: ops_backend.c:swizzle_1203_u16
Unexecuted instantiation: ops_backend.c:swizzle_1023_u16
Unexecuted instantiation: ops_backend.c:swizzle_2013_u16
Unexecuted instantiation: ops_backend.c:swizzle_2310_u16
Unexecuted instantiation: ops_backend.c:swizzle_2130_u16
Unexecuted instantiation: ops_backend.c:swizzle_1230_u16
Unexecuted instantiation: ops_backend.c:swizzle_1320_u16
Unexecuted instantiation: ops_backend.c:swizzle_0213_u16
Unexecuted instantiation: ops_backend.c:swizzle_0231_u16
Unexecuted instantiation: ops_backend.c:swizzle_0312_u16
Unexecuted instantiation: ops_backend.c:swizzle_3120_u16
Unexecuted instantiation: ops_backend.c:swizzle_0321_u16
Unexecuted instantiation: ops_backend.c:swizzle_3012_u32
Unexecuted instantiation: ops_backend.c:swizzle_3021_u32
Unexecuted instantiation: ops_backend.c:swizzle_2103_u32
Unexecuted instantiation: ops_backend.c:swizzle_3210_u32
Unexecuted instantiation: ops_backend.c:swizzle_3102_u32
Unexecuted instantiation: ops_backend.c:swizzle_3201_u32
Unexecuted instantiation: ops_backend.c:swizzle_1203_u32
Unexecuted instantiation: ops_backend.c:swizzle_1023_u32
Unexecuted instantiation: ops_backend.c:swizzle_2013_u32
Unexecuted instantiation: ops_backend.c:swizzle_2310_u32
Unexecuted instantiation: ops_backend.c:swizzle_2130_u32
Unexecuted instantiation: ops_backend.c:swizzle_1230_u32
Unexecuted instantiation: ops_backend.c:swizzle_1320_u32
Unexecuted instantiation: ops_backend.c:swizzle_0213_u32
Unexecuted instantiation: ops_backend.c:swizzle_0231_u32
Unexecuted instantiation: ops_backend.c:swizzle_0312_u32
Unexecuted instantiation: ops_backend.c:swizzle_3120_u32
Unexecuted instantiation: ops_backend.c:swizzle_0321_u32
440
                                                                                \
441
DECL_ENTRY(swizzle_##X##Y##Z##W, SWS_COMP_ALL,                                  \
442
    .op = SWS_OP_SWIZZLE,                                                       \
443
    .swizzle.in = { X, Y, Z, W },                                               \
444
);
445
446
DECL_SWIZZLE(3, 0, 1, 2)
447
DECL_SWIZZLE(3, 0, 2, 1)
448
DECL_SWIZZLE(2, 1, 0, 3)
449
DECL_SWIZZLE(3, 2, 1, 0)
450
DECL_SWIZZLE(3, 1, 0, 2)
451
DECL_SWIZZLE(3, 2, 0, 1)
452
DECL_SWIZZLE(1, 2, 0, 3)
453
DECL_SWIZZLE(1, 0, 2, 3)
454
DECL_SWIZZLE(2, 0, 1, 3)
455
DECL_SWIZZLE(2, 3, 1, 0)
456
DECL_SWIZZLE(2, 1, 3, 0)
457
DECL_SWIZZLE(1, 2, 3, 0)
458
DECL_SWIZZLE(1, 3, 2, 0)
459
DECL_SWIZZLE(0, 2, 1, 3)
460
DECL_SWIZZLE(0, 2, 3, 1)
461
DECL_SWIZZLE(0, 3, 1, 2)
462
DECL_SWIZZLE(3, 1, 2, 0)
463
DECL_SWIZZLE(0, 3, 2, 1)
464
465
/* Broadcast luma -> rgb (only used for y(a) -> rgb(a)) */
466
#define DECL_EXPAND_LUMA(X, W, T0, T1)                                          \
467
DECL_FUNC(expand_luma_##X##W##_impl,                                            \
468
0
          block_t c0, block_t c1, block_t c2, block_t c3)                       \
469
0
{                                                                               \
470
0
    SWS_LOOP                                                                    \
471
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++)                                    \
472
0
        T0[i] = T1[i] = c0[i];                                                  \
473
0
                                                                                \
474
0
    CONTINUE(c##X, T0, T1, c##W);                                               \
475
0
}                                                                               \
Unexecuted instantiation: ops_backend.c:expand_luma_03_impl_u8
Unexecuted instantiation: ops_backend.c:expand_luma_30_impl_u8
Unexecuted instantiation: ops_backend.c:expand_luma_10_impl_u8
Unexecuted instantiation: ops_backend.c:expand_luma_01_impl_u8
Unexecuted instantiation: ops_backend.c:expand_luma_03_impl_u16
Unexecuted instantiation: ops_backend.c:expand_luma_30_impl_u16
Unexecuted instantiation: ops_backend.c:expand_luma_10_impl_u16
Unexecuted instantiation: ops_backend.c:expand_luma_01_impl_u16
Unexecuted instantiation: ops_backend.c:expand_luma_03_impl_u32
Unexecuted instantiation: ops_backend.c:expand_luma_30_impl_u32
Unexecuted instantiation: ops_backend.c:expand_luma_10_impl_u32
Unexecuted instantiation: ops_backend.c:expand_luma_01_impl_u32
476
                                                                                \
477
DECL_IMPL(expand_luma_##X##W##_impl, expand_luma_##X##W, x, y, z, w)            \
478
                                                                                \
479
DECL_ENTRY(expand_luma_##X##W, SWS_COMP_ALL,                                    \
480
    .op = SWS_OP_SWIZZLE,                                                       \
481
    .swizzle.in = { X, 0, 0, W },                                               \
482
);
483
484
DECL_EXPAND_LUMA(0, 3, c1, c2)
485
DECL_EXPAND_LUMA(3, 0, c1, c2)
486
DECL_EXPAND_LUMA(1, 0, c2, c3)
487
DECL_EXPAND_LUMA(0, 1, c2, c3)
488
489
static const SwsOpTable fn(op_table_int) = {
490
    .block_size = SWS_BLOCK_SIZE,
491
    .entries = {
492
        &fn(op_read_planar1),
493
        &fn(op_read_planar2),
494
        &fn(op_read_planar3),
495
        &fn(op_read_planar4),
496
        &fn(op_read_packed2),
497
        &fn(op_read_packed3),
498
        &fn(op_read_packed4),
499
500
        &fn(op_write_planar1),
501
        &fn(op_write_planar2),
502
        &fn(op_write_planar3),
503
        &fn(op_write_planar4),
504
        &fn(op_write_packed2),
505
        &fn(op_write_packed3),
506
        &fn(op_write_packed4),
507
508
        &fn(op_filter1_v),
509
        &fn(op_filter2_v),
510
        &fn(op_filter3_v),
511
        &fn(op_filter4_v),
512
513
        &fn(op_filter1_h),
514
        &fn(op_filter2_h),
515
        &fn(op_filter3_h),
516
        &fn(op_filter4_h),
517
518
#if BIT_DEPTH == 8
519
        &fn(op_read_bits1),
520
        &fn(op_read_nibbles1),
521
        &fn(op_write_bits1),
522
        &fn(op_write_nibbles1),
523
524
        &fn(op_pack_1210),
525
        &fn(op_pack_2330),
526
        &fn(op_pack_3320),
527
528
        &fn(op_unpack_1210),
529
        &fn(op_unpack_2330),
530
        &fn(op_unpack_3320),
531
532
        REF_COMMON_PATTERNS(expand16),
533
        REF_COMMON_PATTERNS(expand32),
534
#elif BIT_DEPTH == 16
535
        &fn(op_pack_4440),
536
        &fn(op_pack_5550),
537
        &fn(op_pack_5650),
538
        &fn(op_unpack_4440),
539
        &fn(op_unpack_5550),
540
        &fn(op_unpack_5650),
541
#elif BIT_DEPTH == 32
542
        &fn(op_pack_2101010),
543
        &fn(op_pack_1010102),
544
        &fn(op_unpack_2101010),
545
        &fn(op_unpack_1010102),
546
#endif
547
548
#ifdef SWAP_BYTES
549
        REF_COMMON_PATTERNS(swap_bytes),
550
#endif
551
552
        REF_COMMON_PATTERNS(min),
553
        REF_COMMON_PATTERNS(max),
554
        REF_COMMON_PATTERNS(scale),
555
        REF_COMMON_PATTERNS(convert_float),
556
557
        &fn(op_clear_0001),
558
        &fn(op_clear_1000),
559
        &fn(op_clear_1100),
560
        &fn(op_clear_0100),
561
        &fn(op_clear_0110),
562
        &fn(op_clear_0011),
563
        &fn(op_clear_1010),
564
        &fn(op_clear_0101),
565
        &fn(op_clear_0111),
566
        &fn(op_clear_1011),
567
        &fn(op_clear_1101),
568
569
        &fn(op_swizzle_3012),
570
        &fn(op_swizzle_3021),
571
        &fn(op_swizzle_2103),
572
        &fn(op_swizzle_3210),
573
        &fn(op_swizzle_3102),
574
        &fn(op_swizzle_3201),
575
        &fn(op_swizzle_1203),
576
        &fn(op_swizzle_1023),
577
        &fn(op_swizzle_2013),
578
        &fn(op_swizzle_2310),
579
        &fn(op_swizzle_2130),
580
        &fn(op_swizzle_1230),
581
        &fn(op_swizzle_1320),
582
        &fn(op_swizzle_0213),
583
        &fn(op_swizzle_0231),
584
        &fn(op_swizzle_0312),
585
        &fn(op_swizzle_3120),
586
        &fn(op_swizzle_0321),
587
588
        &fn(op_expand_luma_03),
589
        &fn(op_expand_luma_30),
590
        &fn(op_expand_luma_10),
591
        &fn(op_expand_luma_01),
592
593
#if BIT_DEPTH != 8
594
        REF_COMMON_PATTERNS(lshift),
595
        REF_COMMON_PATTERNS(rshift),
596
        REF_COMMON_PATTERNS(convert_uint8),
597
#endif /* BIT_DEPTH != 8 */
598
599
#if BIT_DEPTH != 16
600
        REF_COMMON_PATTERNS(convert_uint16),
601
#endif
602
#if BIT_DEPTH != 32
603
        REF_COMMON_PATTERNS(convert_uint32),
604
#endif
605
606
        NULL
607
    },
608
};
609
610
#undef PIXEL_TYPE
611
#undef PIXEL_MAX
612
#undef SWAP_BYTES
613
#undef pixel_t
614
#undef inter_t
615
#undef block_t
616
#undef px
617
618
#undef FMT_CHAR
619
#undef IS_FLOAT