Coverage Report

Created: 2026-01-25 07:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ffmpeg/libswscale/ops_tmpl_common.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 "ops_backend.h"
22
23
#ifndef BIT_DEPTH
24
#  error Should only be included from ops_tmpl_*.c!
25
#endif
26
27
#define WRAP_CONVERT_UINT(N)                                                    \
28
0
DECL_PATTERN(convert_uint##N)                                                   \
29
0
{                                                                               \
30
0
    u##N##block_t xu, yu, zu, wu;                                               \
31
0
                                                                                \
32
0
    SWS_LOOP                                                                    \
33
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {                                  \
34
0
        if (X)                                                                  \
35
0
            xu[i] = x[i];                                                       \
36
0
        if (Y)                                                                  \
37
0
            yu[i] = y[i];                                                       \
38
0
        if (Z)                                                                  \
39
0
            zu[i] = z[i];                                                       \
40
0
        if (W)                                                                  \
41
0
            wu[i] = w[i];                                                       \
42
0
    }                                                                           \
43
0
                                                                                \
44
0
    CONTINUE(u##N##block_t, xu, yu, zu, wu);                                    \
45
0
}                                                                               \
Unexecuted instantiation: ops_backend.c:convert_uint16_u8
Unexecuted instantiation: ops_backend.c:convert_uint32_u8
Unexecuted instantiation: ops_backend.c:convert_uint8_u16
Unexecuted instantiation: ops_backend.c:convert_uint32_u16
Unexecuted instantiation: ops_backend.c:convert_uint8_u32
Unexecuted instantiation: ops_backend.c:convert_uint16_u32
Unexecuted instantiation: ops_backend.c:convert_uint8_f32
Unexecuted instantiation: ops_backend.c:convert_uint16_f32
Unexecuted instantiation: ops_backend.c:convert_uint32_f32
Unexecuted instantiation: ops_backend.c:convert_uint32_u32
46
                                                                                \
47
WRAP_COMMON_PATTERNS(convert_uint##N,                                           \
48
    .op = SWS_OP_CONVERT,                                                       \
49
    .convert.to = SWS_PIXEL_U##N,                                               \
50
);
51
52
#if BIT_DEPTH != 8
53
WRAP_CONVERT_UINT(8)
54
#endif
55
56
#if BIT_DEPTH != 16
57
WRAP_CONVERT_UINT(16)
58
#endif
59
60
#if BIT_DEPTH != 32 || defined(IS_FLOAT)
61
WRAP_CONVERT_UINT(32)
62
#endif
63
64
DECL_PATTERN(clear)
65
0
{
66
0
    SWS_LOOP
67
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
68
0
        if (!X)
69
0
            x[i] = impl->priv.px[0];
70
0
        if (!Y)
71
0
            y[i] = impl->priv.px[1];
72
0
        if (!Z)
73
0
            z[i] = impl->priv.px[2];
74
0
        if (!W)
75
0
            w[i] = impl->priv.px[3];
76
0
    }
77
78
0
    CONTINUE(block_t, x, y, z, w);
79
0
}
Unexecuted instantiation: ops_backend.c:clear_u8
Unexecuted instantiation: ops_backend.c:clear_u16
Unexecuted instantiation: ops_backend.c:clear_u32
Unexecuted instantiation: ops_backend.c:clear_f32
80
81
#define WRAP_CLEAR(X, Y, Z, W)                                                  \
82
0
DECL_IMPL(clear##_##X##Y##Z##W)                                                 \
83
0
{                                                                               \
84
0
    CALL(clear, X, Y, Z, W);                                                    \
85
0
}                                                                               \
Unexecuted instantiation: ops_backend.c:clear_1110_u8
Unexecuted instantiation: ops_backend.c:clear_0111_u8
Unexecuted instantiation: ops_backend.c:clear_0011_u8
Unexecuted instantiation: ops_backend.c:clear_1001_u8
Unexecuted instantiation: ops_backend.c:clear_1100_u8
Unexecuted instantiation: ops_backend.c:clear_0101_u8
Unexecuted instantiation: ops_backend.c:clear_1010_u8
Unexecuted instantiation: ops_backend.c:clear_1000_u8
Unexecuted instantiation: ops_backend.c:clear_0100_u8
Unexecuted instantiation: ops_backend.c:clear_0010_u8
Unexecuted instantiation: ops_backend.c:clear_1110_u16
Unexecuted instantiation: ops_backend.c:clear_0111_u16
Unexecuted instantiation: ops_backend.c:clear_0011_u16
Unexecuted instantiation: ops_backend.c:clear_1001_u16
Unexecuted instantiation: ops_backend.c:clear_1100_u16
Unexecuted instantiation: ops_backend.c:clear_0101_u16
Unexecuted instantiation: ops_backend.c:clear_1010_u16
Unexecuted instantiation: ops_backend.c:clear_1000_u16
Unexecuted instantiation: ops_backend.c:clear_0100_u16
Unexecuted instantiation: ops_backend.c:clear_0010_u16
Unexecuted instantiation: ops_backend.c:clear_1110_u32
Unexecuted instantiation: ops_backend.c:clear_0111_u32
Unexecuted instantiation: ops_backend.c:clear_0011_u32
Unexecuted instantiation: ops_backend.c:clear_1001_u32
Unexecuted instantiation: ops_backend.c:clear_1100_u32
Unexecuted instantiation: ops_backend.c:clear_0101_u32
Unexecuted instantiation: ops_backend.c:clear_1010_u32
Unexecuted instantiation: ops_backend.c:clear_1000_u32
Unexecuted instantiation: ops_backend.c:clear_0100_u32
Unexecuted instantiation: ops_backend.c:clear_0010_u32
Unexecuted instantiation: ops_backend.c:clear_1110_f32
Unexecuted instantiation: ops_backend.c:clear_0111_f32
Unexecuted instantiation: ops_backend.c:clear_0011_f32
Unexecuted instantiation: ops_backend.c:clear_1001_f32
Unexecuted instantiation: ops_backend.c:clear_1100_f32
Unexecuted instantiation: ops_backend.c:clear_0101_f32
Unexecuted instantiation: ops_backend.c:clear_1010_f32
Unexecuted instantiation: ops_backend.c:clear_1000_f32
Unexecuted instantiation: ops_backend.c:clear_0100_f32
Unexecuted instantiation: ops_backend.c:clear_0010_f32
86
                                                                                \
87
DECL_ENTRY(clear##_##X##Y##Z##W,                                                \
88
    .setup = ff_sws_setup_q4,                                                   \
89
    .op = SWS_OP_CLEAR,                                                         \
90
    .flexible = true,                                                           \
91
    .unused = { !X, !Y, !Z, !W },                                               \
92
);
93
94
WRAP_CLEAR(1, 1, 1, 0) /* rgba alpha */
95
WRAP_CLEAR(0, 1, 1, 1) /* argb alpha */
96
97
WRAP_CLEAR(0, 0, 1, 1) /* vuya chroma */
98
WRAP_CLEAR(1, 0, 0, 1) /* yuva chroma */
99
WRAP_CLEAR(1, 1, 0, 0) /* ayuv chroma */
100
WRAP_CLEAR(0, 1, 0, 1) /* uyva chroma */
101
WRAP_CLEAR(1, 0, 1, 0) /* xvyu chroma */
102
103
WRAP_CLEAR(1, 0, 0, 0) /* gray -> yuva */
104
WRAP_CLEAR(0, 1, 0, 0) /* gray -> ayuv */
105
WRAP_CLEAR(0, 0, 1, 0) /* gray -> vuya */
106
107
DECL_PATTERN(min)
108
0
{
109
0
    SWS_LOOP
110
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
111
0
        if (X)
112
0
            x[i] = FFMIN(x[i], impl->priv.px[0]);
113
0
        if (Y)
114
0
            y[i] = FFMIN(y[i], impl->priv.px[1]);
115
0
        if (Z)
116
0
            z[i] = FFMIN(z[i], impl->priv.px[2]);
117
0
        if (W)
118
0
            w[i] = FFMIN(w[i], impl->priv.px[3]);
119
0
    }
120
121
0
    CONTINUE(block_t, x, y, z, w);
122
0
}
Unexecuted instantiation: ops_backend.c:min_u8
Unexecuted instantiation: ops_backend.c:min_u16
Unexecuted instantiation: ops_backend.c:min_u32
Unexecuted instantiation: ops_backend.c:min_f32
123
124
DECL_PATTERN(max)
125
0
{
126
0
    SWS_LOOP
127
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
128
0
        if (X)
129
0
            x[i] = FFMAX(x[i], impl->priv.px[0]);
130
0
        if (Y)
131
0
            y[i] = FFMAX(y[i], impl->priv.px[1]);
132
0
        if (Z)
133
0
            z[i] = FFMAX(z[i], impl->priv.px[2]);
134
0
        if (W)
135
0
            w[i] = FFMAX(w[i], impl->priv.px[3]);
136
0
    }
137
138
0
    CONTINUE(block_t, x, y, z, w);
139
0
}
Unexecuted instantiation: ops_backend.c:max_u8
Unexecuted instantiation: ops_backend.c:max_u16
Unexecuted instantiation: ops_backend.c:max_u32
Unexecuted instantiation: ops_backend.c:max_f32
140
141
WRAP_COMMON_PATTERNS(min,
142
    .op = SWS_OP_MIN,
143
    .setup = ff_sws_setup_q4,
144
    .flexible = true,
145
);
146
147
WRAP_COMMON_PATTERNS(max,
148
    .op = SWS_OP_MAX,
149
    .setup = ff_sws_setup_q4,
150
    .flexible = true,
151
);
152
153
DECL_PATTERN(scale)
154
0
{
155
0
    const pixel_t scale = impl->priv.px[0];
156
157
0
    SWS_LOOP
158
0
    for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
159
0
        if (X)
160
0
            x[i] *= scale;
161
0
        if (Y)
162
0
            y[i] *= scale;
163
0
        if (Z)
164
0
            z[i] *= scale;
165
0
        if (W)
166
0
            w[i] *= scale;
167
0
    }
168
169
0
    CONTINUE(block_t, x, y, z, w);
170
0
}
Unexecuted instantiation: ops_backend.c:scale_u8
Unexecuted instantiation: ops_backend.c:scale_u16
Unexecuted instantiation: ops_backend.c:scale_u32
Unexecuted instantiation: ops_backend.c:scale_f32
171
172
WRAP_COMMON_PATTERNS(scale,
173
    .op = SWS_OP_SCALE,
174
    .setup = ff_sws_setup_q,
175
    .flexible = true,
176
);