../../../ffmpeg/
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
394 / 413
95.4%
Branches:
286 / 320
89.4%
Functions:
20 / 20
100.0%

libswscale/uops.c
Line Branch Exec Source
1 /**
2 * Copyright (C) 2026 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 <float.h>
22 #include <math.h>
23 #include <stdbool.h>
24
25 #include "libavutil/avassert.h"
26 #include "libavutil/intmath.h"
27 #include "libavutil/mem.h"
28 #include "libavutil/refstruct.h"
29
30 #include "ops.h"
31 #include "uops.h"
32 #include "uops_list.h"
33 #include "swscale_internal.h"
34
35 672755530 int ff_sws_uop_cmp(const SwsUOp *a, const SwsUOp *b)
36 {
37
2/2
✓ Branch 2 → 3 taken 455037260 times.
✓ Branch 2 → 4 taken 217718270 times.
672755530 if (a->type != b->type)
38 455037260 return (int) a->type - b->type;
39
2/2
✓ Branch 4 → 5 taken 174988353 times.
✓ Branch 4 → 6 taken 42729917 times.
217718270 if (a->uop != b->uop)
40 174988353 return (int) a->uop - b->uop;
41
2/2
✓ Branch 6 → 7 taken 21508173 times.
✓ Branch 6 → 8 taken 21221744 times.
42729917 if (a->mask != b->mask)
42 21508173 return (int) a->mask - b->mask;
43 21221744 return memcmp(&a->par, &b->par, sizeof(a->par));
44 }
45
46 static const struct {
47 char abbr[32];
48 } uop_names[SWS_UOP_TYPE_NB] = {
49 #define UOP_NAME(OP, ABBR) [OP] = { ABBR },
50 UOPS_LIST(UOP_NAME)
51 #undef UOP_NAME
52 };
53
54 800161 void ff_sws_uop_name(const SwsUOp *op, char buf[SWS_UOP_NAME_MAX])
55 {
56 AVBPrint bp;
57 800161 av_bprint_init_for_buffer(&bp, buf, SWS_UOP_NAME_MAX);
58
59
1/2
✓ Branch 3 → 4 taken 800161 times.
✗ Branch 3 → 6 not taken.
800161 if (op->type != SWS_PIXEL_NONE)
60 800161 av_bprintf(&bp, "%s_", ff_sws_pixel_type_name(op->type));
61 800161 av_bprintf(&bp, "%s", uop_names[op->uop].abbr);
62
63
1/2
✓ Branch 7 → 8 taken 800161 times.
✗ Branch 7 → 11 not taken.
800161 if (op->mask)
64 800161 av_bprintf(&bp, "_%s", ff_sws_comp_mask_str(op->mask));
65
66 800161 const SwsUOpParams *par = &op->par;
67
10/10
✓ Branch 11 → 12 taken 72108 times.
✓ Branch 11 → 15 taken 11644 times.
✓ Branch 11 → 17 taken 13589 times.
✓ Branch 11 → 19 taken 38803 times.
✓ Branch 11 → 30 taken 32350 times.
✓ Branch 11 → 37 taken 57938 times.
✓ Branch 11 → 49 taken 44401 times.
✓ Branch 11 → 66 taken 37584 times.
✓ Branch 11 → 73 taken 48 times.
✓ Branch 11 → 78 taken 491696 times.
800161 switch (op->uop) {
68 72108 case SWS_UOP_READ_PLANAR_FH:
69 case SWS_UOP_READ_PLANAR_FV:
70 case SWS_UOP_READ_PLANAR_FV_FMA:
71 72108 av_bprintf(&bp, "_%s", ff_sws_pixel_type_name(par->filter.type));
72 72108 break;
73 11644 case SWS_UOP_RW_SHUFFLE:
74 11644 av_bprintf(&bp, "_%x_%u_%u", par->shuffle.clear_value,
75 11644 par->shuffle.read_size, par->shuffle.write_size);
76 11644 break;
77 13589 case SWS_UOP_LSHIFT:
78 case SWS_UOP_RSHIFT:
79 13589 av_bprintf(&bp, "_%u", par->shift.amount);
80 13589 break;
81 38803 case SWS_UOP_PERMUTE:
82 case SWS_UOP_COPY:
83 38803 av_bprint_chars(&bp, '_', 1);
84
2/2
✓ Branch 23 → 21 taken 103761 times.
✓ Branch 23 → 24 taken 38803 times.
142564 for (int i = 0; i < par->move.num_moves; i++)
85 103761 av_bprint_chars(&bp, "txyzw"[par->move.dst[i] + 1], 1);
86 38803 av_bprint_chars(&bp, '_', 1);
87
2/2
✓ Branch 28 → 26 taken 103761 times.
✓ Branch 28 → 29 taken 38803 times.
142564 for (int i = 0; i < par->move.num_moves; i++)
88 103761 av_bprint_chars(&bp, "txyzw"[par->move.src[i] + 1], 1);
89 38803 break;
90 32350 case SWS_UOP_PACK:
91 case SWS_UOP_UNPACK:
92 32350 av_bprint_chars(&bp, '_', 1);
93
4/4
✓ Branch 34 → 35 taken 129400 times.
✓ Branch 34 → 36 taken 10434 times.
✓ Branch 35 → 32 taken 107484 times.
✓ Branch 35 → 36 taken 21916 times.
139834 for (int i = 0; i < 4 && par->pack.pattern[i]; i++)
94 107484 av_bprintf(&bp, "%x", par->pack.pattern[i]);
95 32350 break;
96 57938 case SWS_UOP_CLEAR:
97 57938 av_bprint_chars(&bp, '_', 1);
98
2/2
✓ Branch 47 → 39 taken 231752 times.
✓ Branch 47 → 48 taken 57938 times.
289690 for (int i = 0; i < 4; i++) {
99
2/2
✓ Branch 39 → 40 taken 162605 times.
✓ Branch 39 → 41 taken 69147 times.
231752 if (!SWS_COMP_TEST(op->mask, i))
100 162605 continue;
101
2/2
✓ Branch 41 → 42 taken 8156 times.
✓ Branch 41 → 43 taken 60991 times.
69147 else if (SWS_COMP_TEST(par->clear.one, i))
102 8156 av_bprint_chars(&bp, '1', 1);
103
2/2
✓ Branch 43 → 44 taken 6089 times.
✓ Branch 43 → 45 taken 54902 times.
60991 else if (SWS_COMP_TEST(par->clear.zero, i))
104 6089 av_bprint_chars(&bp, '0', 1);
105 else
106 54902 av_bprint_chars(&bp, 'x', 1);
107 }
108 57938 break;
109 44401 case SWS_UOP_LINEAR:
110 case SWS_UOP_LINEAR_FMA:
111
2/2
✓ Branch 64 → 50 taken 177604 times.
✓ Branch 64 → 65 taken 44401 times.
222005 for (int i = 0; i < 4; i++) {
112
2/2
✓ Branch 50 → 51 taken 66300 times.
✓ Branch 50 → 52 taken 111304 times.
177604 if (!SWS_COMP_TEST(op->mask, i))
113 66300 continue;
114 111304 av_bprint_chars(&bp, '_', 1);
115
2/2
✓ Branch 62 → 54 taken 556520 times.
✓ Branch 62 → 63 taken 111304 times.
667824 for (int j = 0; j < 5; j++) {
116
2/2
✓ Branch 54 → 55 taken 195 times.
✓ Branch 54 → 56 taken 556325 times.
556520 if (par->lin.one & SWS_MASK(i, j))
117 195 av_bprint_chars(&bp, '1', 1);
118
2/2
✓ Branch 56 → 57 taken 235117 times.
✓ Branch 56 → 58 taken 321208 times.
556325 else if (par->lin.zero & SWS_MASK(i, j))
119 235117 av_bprint_chars(&bp, '0', 1);
120
2/2
✓ Branch 58 → 59 taken 237 times.
✓ Branch 58 → 60 taken 320971 times.
321208 else if (par->lin.exact & SWS_MASK(i, j))
121 237 av_bprint_chars(&bp, 'X', 1);
122 else
123 320971 av_bprint_chars(&bp, 'x', 1);
124 }
125 }
126 44401 break;
127 37584 case SWS_UOP_DITHER:
128
2/2
✓ Branch 70 → 67 taken 150336 times.
✓ Branch 70 → 71 taken 37584 times.
187920 for (int i = 0; i < 4; i++) {
129
2/2
✓ Branch 67 → 68 taken 100815 times.
✓ Branch 67 → 69 taken 49521 times.
150336 if (SWS_COMP_TEST(op->mask, i))
130 100815 av_bprintf(&bp, "_%d", par->dither.y_offset[i]);
131 }
132 37584 const unsigned size = 1u << par->dither.size_log2;
133 37584 av_bprintf(&bp, "_%ux%u", size, size);
134 37584 break;
135 48 case SWS_UOP_LUT_3D:
136
2/2
✓ Branch 73 → 74 taken 24 times.
✓ Branch 73 → 75 taken 24 times.
48 av_bprintf(&bp, "_%s", par->lut3d.dynamic ? "dynamic" : "static");
137 48 break;
138 }
139
140
1/2
✗ Branch 79 → 80 not taken.
✓ Branch 79 → 82 taken 800161 times.
800161 av_assert0(av_bprint_is_complete(&bp));
141 800161 }
142
143 18159706 static void uop_uninit(SwsUOp *uop)
144 {
145
4/4
✓ Branch 2 → 3 taken 961104 times.
✓ Branch 2 → 5 taken 1477861 times.
✓ Branch 2 → 7 taken 421344 times.
✓ Branch 2 → 9 taken 15299397 times.
18159706 switch (uop->uop) {
146 961104 case SWS_UOP_DITHER:
147 961104 av_refstruct_unref(&uop->data.ptr);
148 961104 break;
149 1477861 case SWS_UOP_READ_PLANAR_FH:
150 case SWS_UOP_READ_PLANAR_FV:
151 case SWS_UOP_READ_PLANAR_FV_FMA:
152 1477861 av_refstruct_unref(&uop->data.kernel);
153 1477861 break;
154 421344 case SWS_UOP_LUT_3D:
155 421344 av_refstruct_unref(&uop->data.lut3d);
156 421344 break;
157 }
158
159 18159706 *uop = (SwsUOp) {0};
160 18159706 }
161
162 3179948 void ff_sws_uop_list_free(SwsUOpList **p_ops)
163 {
164 3179948 SwsUOpList *ops = *p_ops;
165
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 3179948 times.
3179948 if (!ops)
166 ✗ return;
167
168
2/2
✓ Branch 7 → 5 taken 17956504 times.
✓ Branch 7 → 8 taken 3179948 times.
21136452 for (int i = 0; i < ops->num_ops; i++)
169 17956504 uop_uninit(&ops->ops[i]);
170
171 3179948 av_freep(&ops->ops);
172 3179948 av_free(ops);
173 3179948 *p_ops = NULL;
174 }
175
176 3179948 SwsUOpList *ff_sws_uop_list_alloc(void)
177 {
178 3179948 return av_mallocz(sizeof(SwsUOpList));
179 }
180
181 18159706 int ff_sws_uop_list_append(SwsUOpList *uops, SwsUOp *uop)
182 {
183
1/2
✗ Branch 3 → 4 not taken.
✓ Branch 3 → 6 taken 18159706 times.
18159706 if (!av_dynarray2_add((void **) &uops->ops, &uops->num_ops,
184 sizeof(*uop), (uint8_t *) uop))
185 {
186 ✗ uop_uninit(uop);
187 ✗ return AVERROR(ENOMEM);
188 }
189
190 18159706 *uop = (SwsUOp) {0};
191 18159706 return 0;
192 }
193
194 72674 void ff_sws_uop_list_remove_at(SwsUOpList *uops, int index, int count)
195 {
196 72674 const int end = uops->num_ops - count;
197 av_assert2(index >= 0 && count >= 0 && index + count <= uops->num_ops);
198
2/2
✓ Branch 5 → 3 taken 203202 times.
✓ Branch 5 → 6 taken 72674 times.
275876 for (int i = 0; i < count; i++)
199 203202 uop_uninit(&uops->ops[index + i]);
200
2/2
✓ Branch 8 → 7 taken 14730 times.
✓ Branch 8 → 9 taken 72674 times.
87404 for (int i = index; i < end; i++)
201 14730 uops->ops[i] = uops->ops[i + count];
202 72674 uops->num_ops = end;
203 72674 }
204
205 441146 void ff_sws_uop_list_print(void *log, int lev, const SwsUOpList *uops)
206 {
207
1/2
✓ Branch 3 → 4 taken 441146 times.
✗ Branch 3 → 5 not taken.
441146 if (av_log_get_level() < lev)
208 441146 return;
209
210 ✗ av_log(log, lev, "Compiled micro-ops:\n");
211
0/2
✗ Branch 10 → 7 not taken.
✗ Branch 10 → 11 not taken.
✗ for (int i = 0; i < uops->num_ops; i++) {
212 char name[SWS_UOP_NAME_MAX];
213 ✗ ff_sws_uop_name(&uops->ops[i], name);
214 ✗ av_log(log, lev, " %s\n", name);
215 }
216 }
217
218 997735 int ff_sws_dither_height(const SwsDitherUOp *dither)
219 {
220 997735 int max_offset = 0;
221
2/2
✓ Branch 4 → 3 taken 3990940 times.
✓ Branch 4 → 5 taken 997735 times.
4988675 for (int i = 0; i < 4; i++)
222 3990940 max_offset = FFMAX(max_offset, dither->y_offset[i]);
223 997735 return (1 << dither->size_log2) + max_offset;
224 }
225
226 /* Conditionally promotes a pixel type to integer only if allowed by the flags */
227 7929616 static SwsPixelType pixel_type_to_int(SwsUOpFlags flags, const SwsPixelType type)
228 {
229
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 7929616 times.
7929616 if (!(flags & SWS_UOP_FLAG_PUNNING))
230 ✗ return type;
231
232
3/4
✓ Branch 4 → 5 taken 1538015 times.
✓ Branch 4 → 6 taken 4382957 times.
✓ Branch 4 → 7 taken 2008644 times.
✗ Branch 4 → 8 not taken.
7929616 switch (ff_sws_pixel_type_size(type)) {
233 1538015 case 1: return SWS_PIXEL_U8;
234 4382957 case 2: return SWS_PIXEL_U16;
235 2008644 case 4: return SWS_PIXEL_U32;
236 ✗ default: break;
237 }
238
239 ✗ av_unreachable("Invalid pixel type!");
240 return SWS_PIXEL_NONE;
241 }
242
243 1833786 static int significant_bits_f32(float f)
244 {
245 int exp;
246 1833786 const uint32_t mant = ldexpf(frexpf(fabsf(f), &exp), FLT_MANT_DIG);
247
1/2
✓ Branch 2 → 3 taken 1833786 times.
✗ Branch 2 → 4 not taken.
1833786 return mant ? FLT_MANT_DIG - ff_ctz(mant) : 0;
248 }
249
250 1838159 static bool exact_prod(SwsPixel coef, const SwsOpPad *input)
251 {
252
2/2
✓ Branch 2 → 3 taken 4373 times.
✓ Branch 2 → 4 taken 1833786 times.
1838159 if (ff_sws_pixel_type_is_int(input->type))
253 4373 return true;
254
255
1/2
✓ Branch 4 → 5 taken 1833786 times.
✗ Branch 4 → 24 not taken.
1833786 switch (input->type) {
256 1833786 case SWS_PIXEL_F32: {
257 1833786 const int bits = significant_bits_f32(coef.f32);
258
2/2
✓ Branch 6 → 7 taken 4810 times.
✓ Branch 6 → 8 taken 1828976 times.
1833786 if (bits <= 1)
259 4810 return true; /* power of two */
260
4/6
✓ Branch 8 → 9 taken 743623 times.
✓ Branch 8 → 11 taken 1085353 times.
✓ Branch 9 → 10 taken 743623 times.
✗ Branch 9 → 11 not taken.
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 12 taken 743623 times.
1828976 if (!(input->flags & SWS_COMP_EXACT) || input->min.den != 1 || input->max.den != 1)
261 1085353 return false; /* not only integers, or unknown bounds */
262
263
2/4
✓ Branch 12 → 13 taken 743623 times.
✗ Branch 12 → 14 not taken.
✗ Branch 15 → 16 not taken.
✓ Branch 15 → 17 taken 743623 times.
743623 const uint64_t lo = FFABS64U(input->min.num), hi = FFABS64U(input->max.num);
264 743623 const uint64_t max = FFMAX(lo, hi);
265
1/2
✗ Branch 18 → 19 not taken.
✓ Branch 18 → 20 taken 743623 times.
743623 if (max >= 1ULL << FLT_MANT_DIG)
266 ✗ return false;
267
1/2
✓ Branch 20 → 21 taken 743623 times.
✗ Branch 20 → 22 not taken.
743623 return bits + (max ? av_log2(max) + 1 : 0) <= FLT_MANT_DIG;
268 }
269 }
270
271 ✗ av_unreachable("Invalid pixel type!");
272 return false;
273 }
274
275 739012 static bool check_filter_fma(SwsContext *ctx, SwsUOpFlags flags, const SwsOp *op)
276 {
277
2/2
✓ Branch 2 → 3 taken 490104 times.
✓ Branch 2 → 4 taken 248908 times.
739012 if (!(flags & SWS_UOP_FLAG_FMA))
278 490104 return false;
279
2/2
✓ Branch 4 → 5 taken 167995 times.
✓ Branch 4 → 6 taken 80913 times.
248908 if (!(ctx->flags & SWS_BITEXACT))
280 167995 return true;
281
2/2
✓ Branch 6 → 7 taken 47133 times.
✓ Branch 6 → 8 taken 33780 times.
80913 if (!ff_sws_pixel_type_is_int(op->rw.type))
282 47133 return false;
283
284 33780 const int bits = ff_sws_pixel_type_size(op->rw.type) * 8;
285 33780 const uint64_t max_val = UINT64_MAX >> (64 - bits);
286
287 /* Maximum value representable losslessly as float. Note that this is
288 * currently true only for U8, but that may change if we ever update the
289 * value of SWS_FILTER_SCALE. */
290 33780 return max_val * SWS_FILTER_SCALE <= (1 << 22);
291 }
292
293 6198636 static int translate_rw_op(SwsContext *ctx, SwsUOpList *ops, SwsUOpFlags flags,
294 const SwsOp *op)
295 {
296 12397272 SwsUOp uop = {
297 6198636 .type = op->rw.type,
298
6/6
✓ Branch 2 → 3 taken 4527975 times.
✓ Branch 2 → 4 taken 1670661 times.
✓ Branch 5 → 6 taken 4303142 times.
✓ Branch 5 → 7 taken 1895494 times.
✓ Branch 8 → 9 taken 1119226 times.
✓ Branch 8 → 10 taken 5079410 times.
6198636 .mask = SWS_COMP_MASK(op->rw.elems > 0, op->rw.elems > 1,
299 op->rw.elems > 2, op->rw.elems > 3),
300 };
301
302 /* Non-filtered reads don't care about the exact pixel contents */
303
2/2
✓ Branch 11 → 12 taken 4720775 times.
✓ Branch 11 → 14 taken 1477861 times.
6198636 if (!op->rw.filter.op)
304 4720775 uop.type = pixel_type_to_int(flags, op->rw.type);
305
306 6198636 const bool is_read = op->op == SWS_OP_READ;
307
2/2
✓ Branch 14 → 15 taken 1477861 times.
✓ Branch 14 → 26 taken 4720775 times.
6198636 if (op->rw.filter.op) {
308
3/6
✓ Branch 15 → 16 taken 1477861 times.
✗ Branch 15 → 18 not taken.
✓ Branch 16 → 17 taken 1477861 times.
✗ Branch 16 → 18 not taken.
✗ Branch 17 → 18 not taken.
✓ Branch 17 → 19 taken 1477861 times.
1477861 if (op->op == SWS_OP_WRITE || op->rw.frac || op->rw.mode != SWS_RW_PLANAR)
309 ✗ return AVERROR(ENOTSUP);
310 1477861 uop.par.filter.type = op->rw.filter.type;
311 1477861 uop.data.kernel = av_refstruct_ref(op->rw.filter.kernel);
312
2/2
✓ Branch 20 → 21 taken 738849 times.
✓ Branch 20 → 22 taken 739012 times.
1477861 if (op->rw.filter.op == SWS_OP_FILTER_H) {
313 738849 uop.uop = SWS_UOP_READ_PLANAR_FH;
314
2/2
✓ Branch 23 → 24 taken 180088 times.
✓ Branch 23 → 25 taken 558924 times.
739012 } else if (check_filter_fma(ctx, flags, op)) {
315 180088 uop.uop = SWS_UOP_READ_PLANAR_FV_FMA;
316 } else {
317 558924 uop.uop = SWS_UOP_READ_PLANAR_FV;
318 }
319
4/4
✓ Branch 26 → 27 taken 1751774 times.
✓ Branch 26 → 34 taken 2969001 times.
✓ Branch 27 → 28 taken 1042370 times.
✓ Branch 27 → 34 taken 709404 times.
4720775 } else if (op->rw.mode == SWS_RW_PACKED && op->rw.elems > 1) {
320
1/2
✗ Branch 28 → 29 not taken.
✓ Branch 28 → 30 taken 1042370 times.
1042370 if (op->rw.frac)
321 ✗ return AVERROR(ENOTSUP);
322
2/2
✓ Branch 30 → 31 taken 520145 times.
✓ Branch 30 → 32 taken 522225 times.
1042370 uop.uop = is_read ? SWS_UOP_READ_PACKED : SWS_UOP_WRITE_PACKED;
323
2/2
✓ Branch 34 → 35 taken 10560 times.
✓ Branch 34 → 40 taken 3667845 times.
3678405 } else if (op->rw.mode == SWS_RW_PALETTE) {
324
4/6
✓ Branch 35 → 36 taken 10032 times.
✓ Branch 35 → 38 taken 528 times.
✓ Branch 36 → 37 taken 10032 times.
✗ Branch 36 → 38 not taken.
✗ Branch 37 → 38 not taken.
✓ Branch 37 → 39 taken 10032 times.
10560 if (!(flags & SWS_UOP_FLAG_READ_PALETTE) || op->rw.frac || !is_read)
325 528 return AVERROR(ENOTSUP);
326 10032 uop.uop = SWS_UOP_READ_PALETTE;
327
2/2
✓ Branch 40 → 41 taken 54284 times.
✓ Branch 40 → 45 taken 3613561 times.
3667845 } else if (op->rw.frac == 3) {
328
2/2
✓ Branch 41 → 42 taken 26776 times.
✓ Branch 41 → 43 taken 27508 times.
54284 uop.uop = is_read ? SWS_UOP_READ_BIT : SWS_UOP_WRITE_BIT;
329
2/2
✓ Branch 45 → 46 taken 56140 times.
✓ Branch 45 → 50 taken 3557421 times.
3613561 } else if (op->rw.frac == 1) {
330
2/2
✓ Branch 46 → 47 taken 28664 times.
✓ Branch 46 → 48 taken 27476 times.
56140 uop.uop = is_read ? SWS_UOP_READ_NIBBLE : SWS_UOP_WRITE_NIBBLE;
331 } else {
332
1/2
✗ Branch 50 → 51 not taken.
✓ Branch 50 → 53 taken 3557421 times.
3557421 av_assert0(!op->rw.frac);
333
2/2
✓ Branch 53 → 54 taken 955210 times.
✓ Branch 53 → 55 taken 2602211 times.
3557421 uop.uop = is_read ? SWS_UOP_READ_PLANAR : SWS_UOP_WRITE_PLANAR;
334 }
335
336 6198108 const int planes = ff_sws_rw_op_planes(op);
337
2/2
✓ Branch 58 → 59 taken 3018688 times.
✓ Branch 58 → 60 taken 3179420 times.
6198108 if (op->op == SWS_OP_READ) {
338 3018688 ops->planes_in |= SWS_COMP_ELEMS(planes);
339 } else {
340 3179420 ops->planes_out |= SWS_COMP_ELEMS(planes);
341 }
342
343 6198108 return ff_sws_uop_list_append(ops, &uop);
344 }
345
346 4728368 static int count_idx(const int *arr, size_t size, int val)
347 {
348 4728368 int num = 0;
349
2/2
✓ Branch 6 → 3 taken 23641840 times.
✓ Branch 6 → 7 taken 4728368 times.
28370208 for (size_t i = 0; i < size; i++) {
350
2/2
✓ Branch 3 → 4 taken 6548641 times.
✓ Branch 3 → 5 taken 17093199 times.
23641840 if (arr[i] == val)
351 6548641 num++;
352 }
353
354 4728368 return num;
355 }
356
357 1131129 static int translate_swizzle(SwsUOpList *ops, SwsUOpFlags flags, const SwsOp *op)
358 {
359 3393387 SwsUOp uop = {
360 .uop = SWS_UOP_PERMUTE,
361 1131129 .type = pixel_type_to_int(flags, ff_sws_op_input_type(op)),
362 1131129 .mask = ff_sws_comp_mask_needed(op),
363 };
364 1131129 SwsMoveUOp *par = &uop.par.move;
365
366 /* Mask of components that are not yet satisfied */
367 1131129 SwsCompMask todo = uop.mask;
368
2/2
✓ Branch 9 → 6 taken 4524516 times.
✓ Branch 9 → 10 taken 1131129 times.
5655645 for (int i = 0; i < 4; i++) {
369
2/2
✓ Branch 6 → 7 taken 1699404 times.
✓ Branch 6 → 8 taken 2825112 times.
4524516 if (op->swizzle.in[i] == i)
370 1699404 todo &= ~SWS_COMP(i);
371 }
372
373 /* Mask of components whose value is required for the final output */
374 1131129 SwsCompMask needed = 0;
375
2/2
✓ Branch 14 → 11 taken 4524516 times.
✓ Branch 14 → 15 taken 1131129 times.
5655645 for (int i = 0; i < 4; i++) {
376
2/2
✓ Branch 11 → 12 taken 3405274 times.
✓ Branch 11 → 13 taken 1119242 times.
4524516 if (SWS_OP_NEEDED(op, i))
377 3405274 needed |= SWS_COMP(op->swizzle.in[i]);
378 }
379
380 /* Current mapping of registers to components */
381 1131129 int idx[4 + 1] = { 0, 1, 2, 3, -1 }; /* +1 for tmp */
382
383 /* Decompose the swizzle mask into a series of register-register moves */
384
2/2
✓ Branch 50 → 16 taken 3201609 times.
✓ Branch 50 → 51 taken 1131129 times.
4332738 while (todo) {
385 3201609 int dst = -1, src = -1;
386
387 /* Find next unsatisfied dst <- src move that doesn't clobber a value */
388
2/2
✓ Branch 33 → 17 taken 8259268 times.
✓ Branch 33 → 34 taken 688995 times.
8948263 for (dst = 0; dst < 4; dst++) {
389
2/2
✓ Branch 17 → 18 taken 3530900 times.
✓ Branch 17 → 19 taken 4728368 times.
8259268 if (!SWS_COMP_TEST(todo, dst))
390 3530900 continue; /* already satisfied */
391 4728368 const int cur = idx[dst];
392
4/4
✓ Branch 20 → 21 taken 2908095 times.
✓ Branch 20 → 23 taken 1820273 times.
✓ Branch 21 → 22 taken 2215754 times.
✓ Branch 21 → 23 taken 692341 times.
4728368 if (count_idx(idx, FF_ARRAY_ELEMS(idx), cur) == 1 && SWS_COMP_TEST(needed, cur))
393 2215754 continue; /* clobbers last remaining, still-needed value */
394
1/2
✓ Branch 30 → 24 taken 7814970 times.
✗ Branch 30 → 31 not taken.
7814970 for (src = 0; src < FF_ARRAY_ELEMS(idx); src++) {
395
2/2
✓ Branch 24 → 25 taken 2512614 times.
✓ Branch 24 → 29 taken 5302356 times.
7814970 if (idx[src] == op->swizzle.in[dst]) {
396 /* Prevent read-after-write dependency. */
397
4/4
✓ Branch 25 → 26 taken 2006517 times.
✓ Branch 25 → 28 taken 506097 times.
✓ Branch 26 → 27 taken 808 times.
✓ Branch 26 → 28 taken 2005709 times.
2512614 if (par->num_moves > 0 && src == par->dst[par->num_moves - 1])
398 808 src = par->src[par->num_moves - 1];
399 2512614 break;
400 }
401 }
402 av_assert1(src < FF_ARRAY_ELEMS(idx));
403 2512614 todo &= ~SWS_COMP(dst);
404 2512614 break;
405 }
406
407
2/2
✓ Branch 34 → 35 taken 688995 times.
✓ Branch 34 → 40 taken 2512614 times.
3201609 if (dst == 4) {
408 /* Stuck in a cycle, break it by saving to the scratch register */
409 688995 dst = 4;
410
1/2
✓ Branch 39 → 36 taken 755264 times.
✗ Branch 39 → 40 not taken.
755264 for (src = 0; src < 4; src++) {
411
2/2
✓ Branch 36 → 37 taken 688995 times.
✓ Branch 36 → 38 taken 66269 times.
755264 if (SWS_COMP_TEST(todo, src)) {
412 688995 needed &= ~SWS_COMP(idx[src]);
413 688995 break;
414 }
415 }
416 av_assert1(src < 4);
417 }
418
419
1/2
✗ Branch 40 → 41 not taken.
✓ Branch 40 → 43 taken 3201609 times.
3201609 av_assert0(par->num_moves < SWS_UOP_MOVE_MAX);
420
2/2
✓ Branch 43 → 44 taken 2512614 times.
✓ Branch 43 → 45 taken 688995 times.
3201609 par->dst[par->num_moves] = dst > 3 ? -1 : dst;
421
2/2
✓ Branch 46 → 47 taken 2512614 times.
✓ Branch 46 → 48 taken 688995 times.
3201609 par->src[par->num_moves] = src > 3 ? -1 : src;
422 3201609 par->num_moves++;
423 3201609 idx[dst] = idx[src];
424 }
425
426 /* Check for duplicates in the final register map */
427 1131129 SwsCompMask seen = 0;
428
2/2
✓ Branch 58 → 52 taken 4182474 times.
✓ Branch 58 → 59 taken 954842 times.
5137316 for (int i = 0; i < 4; i++) {
429
2/2
✓ Branch 52 → 53 taken 968485 times.
✓ Branch 52 → 54 taken 3213989 times.
4182474 if (!SWS_COMP_TEST(uop.mask, i))
430 968485 continue;
431 av_assert2(idx[i] >= 0); /* should be no tmp register */
432 3213989 const SwsCompMask bit = SWS_COMP(idx[i]);
433
2/2
✓ Branch 54 → 55 taken 176287 times.
✓ Branch 54 → 56 taken 3037702 times.
3213989 if (seen & bit) {
434 176287 uop.uop = SWS_UOP_COPY;
435 176287 break;
436 }
437 3037702 seen |= bit;
438 }
439
440 /* Add any extra unused components to the mask, to prevent generating
441 * duplicate uops like permute_xyz_txy_xyt and permute_xyzw_txy_xyt */
442
2/2
✓ Branch 64 → 60 taken 4524516 times.
✓ Branch 64 → 65 taken 1131129 times.
5655645 for (int i = 0; i < 4; i++) {
443 4524516 const SwsCompMask bit = SWS_COMP(i);
444
4/4
✓ Branch 60 → 61 taken 1486814 times.
✓ Branch 60 → 63 taken 3037702 times.
✓ Branch 61 → 62 taken 779475 times.
✓ Branch 61 → 63 taken 707339 times.
4524516 if (!(seen & bit) && idx[i] == i)
445 779475 uop.mask |= bit;
446 }
447
448 1131129 return ff_sws_uop_list_append(ops, &uop);
449 }
450
451 1157506 static int translate_dither_op(SwsUOpList *ops, SwsUOpFlags flags, const SwsOp *op)
452 {
453 2315012 SwsUOp uop = {
454 1157506 .type = ff_sws_op_input_type(op),
455 .uop = SWS_UOP_DITHER,
456 1157506 .par.dither.size_log2 = op->dither.size_log2,
457 };
458
459
3/4
✓ Branch 3 → 4 taken 1157506 times.
✗ Branch 3 → 15 not taken.
✓ Branch 4 → 5 taken 196402 times.
✓ Branch 4 → 15 taken 961104 times.
1157506 if ((flags & SWS_UOP_FLAG_ADD) && op->dither.size_log2 == 0) {
460 /* Constant offset */
461 196402 const SwsPixel val = ff_sws_pixel_from_q64(uop.type, op->dither.matrix[0]);
462 196402 uop.uop = SWS_UOP_ADD;
463
2/2
✓ Branch 12 → 7 taken 785608 times.
✓ Branch 12 → 13 taken 196402 times.
982010 for (int i = 0; i < 4; i++) {
464
4/4
✓ Branch 7 → 8 taken 492360 times.
✓ Branch 7 → 9 taken 293248 times.
✓ Branch 8 → 9 taken 5142 times.
✓ Branch 8 → 10 taken 487218 times.
785608 if (!SWS_OP_NEEDED(op, i) || op->dither.y_offset[i] < 0)
465 298390 continue;
466 487218 uop.mask |= SWS_COMP(i);
467 487218 uop.data.vec4[i] = val;
468 }
469
470 196402 return ff_sws_uop_list_append(ops, &uop);
471 }
472
473 961104 const int size = 1 << op->dither.size_log2;
474
2/2
✓ Branch 21 → 16 taken 3844416 times.
✓ Branch 21 → 22 taken 961104 times.
4805520 for (int i = 0; i < 4; i++) {
475
4/4
✓ Branch 16 → 17 taken 2686281 times.
✓ Branch 16 → 18 taken 1158135 times.
✓ Branch 17 → 18 taken 71460 times.
✓ Branch 17 → 19 taken 2614821 times.
3844416 if (!SWS_OP_NEEDED(op, i) || op->dither.y_offset[i] < 0)
476 1229595 continue;
477 2614821 const uint8_t off = op->dither.y_offset[i] & (size - 1);
478 2614821 uop.mask |= SWS_COMP(i);
479 2614821 uop.par.dither.y_offset[i] = off;
480 }
481
482 /* Allocate extra rows to allow over-reading for row offsets. Note that
483 * y_offset is currently never larger than 5, so the extra space needed
484 * for this over-allocation is bounded by 5 * size * sizeof(float),
485 * typically 320 bytes for a 16x16 dither matrix. */
486 961104 const int stride = size * sizeof(SwsPixel);
487 961104 const int num_rows = ff_sws_dither_height(&uop.par.dither);
488 961104 SwsPixel *matrix = uop.data.ptr = ff_refstruct_calloc(num_rows, stride);
489
1/2
✗ Branch 24 → 25 not taken.
✓ Branch 24 → 26 taken 961104 times.
961104 if (!matrix)
490 ✗ return AVERROR(ENOMEM);
491
492
2/2
✓ Branch 29 → 27 taken 246042624 times.
✓ Branch 29 → 30 taken 961104 times.
247003728 for (int i = 0; i < size * size; i++)
493 246042624 matrix[i] = ff_sws_pixel_from_q64(uop.type, op->dither.matrix[i]);
494 961104 memcpy(&matrix[size * size], matrix, (num_rows - size) * stride);
495
496 961104 return ff_sws_uop_list_append(ops, &uop);
497 }
498
499 1356210 static int translate_linear_op(SwsContext *ctx, SwsUOpList *ops,
500 SwsUOpFlags flags, const SwsOp *op,
501 const SwsOpPad inputs[4])
502 {
503 2712420 SwsUOp uop = {
504 1356210 .type = ff_sws_op_input_type(op),
505 .uop = SWS_UOP_LINEAR,
506 };
507
508 1356210 const SwsPixel one = ff_sws_pixel_from_q64(uop.type, (AVRational64) {1, 1});
509 1356210 const uint32_t mask = ff_sws_linear_mask(&op->lin);
510 1356210 const bool bitexact = ctx->flags & SWS_BITEXACT;
511 1356210 uint32_t exact = 0;
512
513
2/2
✓ Branch 27 → 6 taken 5424840 times.
✓ Branch 27 → 28 taken 1356210 times.
6781050 for (int i = 0; i < 4; i++) {
514
4/4
✓ Branch 6 → 7 taken 3758155 times.
✓ Branch 6 → 8 taken 1666685 times.
✓ Branch 7 → 8 taken 144918 times.
✓ Branch 7 → 9 taken 3613237 times.
5424840 if (!SWS_OP_NEEDED(op, i) || !(mask & SWS_MASK_ROW(i))) {
515 1811603 uop.par.lin.zero |= SWS_MASK_ROW(i) ^ SWS_MASK(i, i);
516 1811603 uop.par.lin.one |= SWS_MASK(i, i);
517 1811603 uop.data.mat4x5[i][i] = one;
518 1811603 continue;
519 }
520 3613237 uop.mask |= SWS_COMP(i);
521 3613237 bool nonzero = (op->lin.m[i][4].num != 0);
522
2/2
✓ Branch 25 → 10 taken 18066185 times.
✓ Branch 25 → 26 taken 3613237 times.
21679422 for (int j = 0; j < 5; j++) {
523 18066185 const AVRational64 k = op->lin.m[i][j];
524 18066185 const SwsPixel px = ff_sws_pixel_from_q64(uop.type, k);
525 18066185 uop.data.mat4x5[i][j] = px;
526
2/2
✓ Branch 11 → 12 taken 8177891 times.
✓ Branch 11 → 13 taken 9888294 times.
18066185 if (k.num == 0)
527 8177891 uop.par.lin.zero |= SWS_MASK(i, j);
528
4/4
✓ Branch 13 → 14 taken 7565157 times.
✓ Branch 13 → 16 taken 2323137 times.
✓ Branch 14 → 15 taken 2778 times.
✓ Branch 14 → 16 taken 7562379 times.
9888294 else if (j < 4 && k.num == k.den)
529 2778 uop.par.lin.one |= SWS_MASK(i, j);
530
8/8
✓ Branch 16 → 17 taken 7562379 times.
✓ Branch 16 → 22 taken 2323137 times.
✓ Branch 17 → 18 taken 6272279 times.
✓ Branch 17 → 22 taken 1290100 times.
✓ Branch 18 → 19 taken 1838159 times.
✓ Branch 18 → 21 taken 4434120 times.
✓ Branch 20 → 21 taken 24389 times.
✓ Branch 20 → 22 taken 1813770 times.
9885516 else if (j < 4 && nonzero && (!bitexact || exact_prod(px, &inputs[j])))
531 4458509 exact |= SWS_MASK(i, j);
532
2/2
✓ Branch 22 → 23 taken 9888294 times.
✓ Branch 22 → 24 taken 8177891 times.
18066185 if (k.num != 0)
533 9888294 nonzero = true;
534 }
535 }
536
537
4/4
✓ Branch 28 → 29 taken 532925 times.
✓ Branch 28 → 31 taken 823285 times.
✓ Branch 29 → 30 taken 525588 times.
✓ Branch 29 → 31 taken 7337 times.
1356210 if ((flags & SWS_UOP_FLAG_FMA) && !ff_sws_pixel_type_is_int(uop.type)) {
538 /* multiplication by 1 and 0 are always exact by definition */
539 525588 uop.uop = SWS_UOP_LINEAR_FMA;
540 525588 uop.par.lin.exact = exact | uop.par.lin.zero | uop.par.lin.one;
541 }
542
543 1356210 return ff_sws_uop_list_append(ops, &uop);
544 }
545
546 18094124 static int translate_op(SwsContext *ctx, SwsUOpList *uops, SwsUOpFlags flags,
547 const SwsOp *op, const SwsOpPad inputs[4])
548 {
549
5/6
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 4 taken 6198636 times.
✓ Branch 2 → 5 taken 1131129 times.
✓ Branch 2 → 6 taken 1157506 times.
✓ Branch 2 → 7 taken 1356210 times.
✓ Branch 2 → 8 taken 8250643 times.
18094124 switch (op->op) {
550 ✗ case SWS_OP_FILTER_H:
551 case SWS_OP_FILTER_V:
552 ✗ return AVERROR(ENOTSUP); /* always handled by subpass splitting */
553 6198636 case SWS_OP_READ:
554 case SWS_OP_WRITE:
555 6198636 return translate_rw_op(ctx, uops, flags, op);
556 1131129 case SWS_OP_SWIZZLE:
557 1131129 return translate_swizzle(uops, flags, op);
558 1157506 case SWS_OP_DITHER:
559 1157506 return translate_dither_op(uops, flags, op);
560 1356210 case SWS_OP_LINEAR:
561 1356210 return translate_linear_op(ctx, uops, flags, op, inputs);
562 8250643 default:
563 8250643 break;
564 }
565
566 /* Default handling for "simple" ops */
567 24751929 SwsUOp uop = {
568 .uop = SWS_UOP_INVALID,
569 8250643 .type = ff_sws_op_input_type(op),
570 8250643 .mask = ff_sws_comp_mask_needed(op),
571 };
572
573
8/9
✓ Branch 11 → 12 taken 2330566 times.
✓ Branch 11 → 18 taken 708272 times.
✓ Branch 11 → 29 taken 286133 times.
✓ Branch 11 → 33 taken 606832 times.
✓ Branch 11 → 49 taken 752252 times.
✓ Branch 11 → 50 taken 1766444 times.
✓ Branch 11 → 60 taken 1378800 times.
✓ Branch 11 → 62 taken 421344 times.
✗ Branch 11 → 64 not taken.
8250643 switch (op->op) {
574 2330566 case SWS_OP_CONVERT:
575
4/5
✓ Branch 12 → 13 taken 513180 times.
✓ Branch 12 → 14 taken 1141690 times.
✓ Branch 12 → 15 taken 109028 times.
✓ Branch 12 → 16 taken 566668 times.
✗ Branch 12 → 17 not taken.
2330566 switch (op->convert.to) {
576 513180 case SWS_PIXEL_U8: uop.uop = SWS_UOP_TO_U8; break;
577 1141690 case SWS_PIXEL_U16: uop.uop = SWS_UOP_TO_U16; break;
578 109028 case SWS_PIXEL_U32: uop.uop = SWS_UOP_TO_U32; break;
579 566668 case SWS_PIXEL_F32: uop.uop = SWS_UOP_TO_F32; break;
580 }
581 2330566 break;
582 708272 case SWS_OP_UNPACK:
583 case SWS_OP_PACK:
584
2/2
✓ Branch 18 → 19 taken 356512 times.
✓ Branch 18 → 20 taken 351760 times.
708272 uop.uop = op->op == SWS_OP_PACK ? SWS_UOP_PACK : SWS_UOP_UNPACK;
585 708272 uop.mask = 0;
586
4/4
✓ Branch 26 → 27 taken 2833088 times.
✓ Branch 26 → 28 taken 219668 times.
✓ Branch 27 → 22 taken 2344484 times.
✓ Branch 27 → 28 taken 488604 times.
3052756 for (int i = 0; i < 4 && op->pack.pattern[i]; i++) {
587 2344484 uop.par.pack.pattern[i] = op->pack.pattern[i];
588
4/4
✓ Branch 22 → 23 taken 1164922 times.
✓ Branch 22 → 24 taken 1179562 times.
✓ Branch 23 → 24 taken 1042640 times.
✓ Branch 23 → 25 taken 122282 times.
2344484 if (op->op == SWS_OP_PACK || SWS_OP_NEEDED(op, i))
589 2222202 uop.mask |= SWS_COMP(i);
590 }
591 708272 break;
592 286133 case SWS_OP_LSHIFT:
593 case SWS_OP_RSHIFT:
594
2/2
✓ Branch 29 → 30 taken 151846 times.
✓ Branch 29 → 31 taken 134287 times.
286133 uop.uop = op->op == SWS_OP_LSHIFT ? SWS_UOP_LSHIFT : SWS_UOP_RSHIFT;
595 286133 uop.par.shift.amount = op->shift.amount;
596 286133 break;
597 606832 case SWS_OP_CLEAR:
598 606832 uop.uop = SWS_UOP_CLEAR;
599 606832 uop.mask &= op->clear.mask;
600
2/2
✓ Branch 47 → 34 taken 2427328 times.
✓ Branch 47 → 48 taken 606832 times.
3034160 for (int i = 0; i < 4; i++) {
601
2/2
✓ Branch 34 → 35 taken 1728416 times.
✓ Branch 34 → 36 taken 698912 times.
2427328 if (!SWS_COMP_TEST(op->clear.mask, i))
602 1728416 continue;
603 698912 const AVRational64 v = op->clear.value[i];
604 698912 const SwsPixelType type = op->clear.type[i];
605 698912 const SwsPixel px = ff_sws_pixel_from_q64(type, v);
606 698912 uop.type = pixel_type_to_int(flags, type);
607 698912 uop.data.vec4[i] = ff_sws_pixel_expand32(type, px);
608
2/2
✓ Branch 39 → 40 taken 123872 times.
✓ Branch 39 → 41 taken 575040 times.
698912 if (v.num == 0)
609 123872 uop.par.clear.zero |= SWS_COMP(i);
610
2/2
✓ Branch 42 → 43 taken 153070 times.
✓ Branch 42 → 44 taken 421970 times.
575040 else if (ff_sws_pixel_is_1s(type, px))
611 153070 uop.par.clear.one |= SWS_COMP(i);
612 }
613 606832 break;
614 752252 case SWS_OP_SCALE:
615 752252 uop.uop = SWS_UOP_SCALE;
616 752252 uop.data.scalar = ff_sws_pixel_from_q64(uop.type, op->scale.factor);
617 752252 break;
618 1766444 case SWS_OP_MIN:
619 case SWS_OP_MAX:
620
2/2
✓ Branch 50 → 51 taken 1184191 times.
✓ Branch 50 → 52 taken 582253 times.
1766444 uop.uop = op->op == SWS_OP_MIN ? SWS_UOP_MIN : SWS_UOP_MAX;
621 1766444 uop.mask &= ff_sws_comp_mask_q4(op->clamp.limit);
622
2/2
✓ Branch 58 → 55 taken 7065776 times.
✓ Branch 58 → 59 taken 1766444 times.
8832220 for (int i = 0; i < 4; i++) {
623
2/2
✓ Branch 55 → 56 taken 4603922 times.
✓ Branch 55 → 57 taken 2461854 times.
7065776 if (SWS_COMP_TEST(uop.mask, i))
624 4603922 uop.data.vec4[i] = ff_sws_pixel_from_q64(uop.type, op->clamp.limit[i]);
625 }
626 1766444 break;
627 1378800 case SWS_OP_SWAP_BYTES:
628 1378800 uop.uop = SWS_UOP_SWAP_BYTES;
629 1378800 uop.type = pixel_type_to_int(flags, uop.type);
630 1378800 break;
631 421344 case SWS_OP_LUT_3D:
632 421344 uop.uop = SWS_UOP_LUT_3D;
633 421344 uop.par.lut3d.dynamic = op->lut3d.dynamic;
634 421344 uop.data.lut3d = av_refstruct_ref_c(op->lut3d.lut);
635 421344 break;
636 ✗ default:
637 ✗ return AVERROR(ENOTSUP);
638 }
639
640
1/2
✗ Branch 66 → 67 not taken.
✓ Branch 66 → 69 taken 8250643 times.
8250643 av_assert0(uop.uop != SWS_UOP_INVALID);
641 8250643 return ff_sws_uop_list_append(uops, &uop);
642 }
643
644 3179948 int ff_sws_ops_translate(SwsContext *ctx, const SwsOpList *ops,
645 SwsUOpFlags flags, SwsUOpList *uops)
646 {
647 3179948 const SwsOpPad *inputs = ops->inputs;
648
2/2
✓ Branch 14 → 3 taken 18094124 times.
✓ Branch 14 → 15 taken 3179420 times.
21273544 for (int n = 0; n < ops->num_ops; n++) {
649 18094124 const SwsOp *op = &ops->ops[n];
650
2/2
✓ Branch 9 → 4 taken 72376496 times.
✓ Branch 9 → 10 taken 18094124 times.
90470620 for (int i = 0; i < 4; i++) {
651
2/2
✓ Branch 4 → 5 taken 32419116 times.
✓ Branch 4 → 6 taken 39957380 times.
72376496 if (!SWS_OP_NEEDED(op, i))
652 32419116 continue;
653 39957380 const int pixel_size = ff_sws_pixel_type_size(op->outputs[i].type);
654
2/2
✓ Branch 6 → 7 taken 3735219 times.
✓ Branch 6 → 8 taken 36222161 times.
39957380 if (pixel_size > uops->pixel_size_max)
655 3735219 uops->pixel_size_max = pixel_size;
656 }
657
658 18094124 int ret = translate_op(ctx, uops, flags, op, inputs);
659
2/2
✓ Branch 11 → 12 taken 528 times.
✓ Branch 11 → 13 taken 18093596 times.
18094124 if (ret < 0)
660 528 return ret;
661 18093596 inputs = op->outputs;
662 }
663
664 3179420 return ff_sws_uop_list_optimize(ctx, flags, uops);
665 }
666