FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/tests/checkasm/sw_rgb.c
Date: 2026-07-22 00:55:30
Exec Total Coverage
Lines: 490 514 95.3%
Functions: 13 13 100.0%
Branches: 237 542 43.7%

Line Branch Exec Source
1 /*
2 *
3 * This file is part of FFmpeg.
4 *
5 * FFmpeg is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * FFmpeg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #include <string.h>
21
22 #include "libavutil/common.h"
23 #include "libavutil/intreadwrite.h"
24 #include "libavutil/mem_internal.h"
25 #include "libavutil/pixdesc.h"
26
27 #include "libswscale/rgb2rgb.h"
28 #include "libswscale/swscale.h"
29 #include "libswscale/swscale_internal.h"
30
31 #include "checkasm.h"
32
33 #define randomize_buffers(buf, size) \
34 do { \
35 int j; \
36 for (j = 0; j < size; j+=4) \
37 AV_WN32(buf + j, rnd()); \
38 } while (0)
39
40 static const uint8_t width[] = {12, 16, 20, 32, 36, 128};
41 static const struct {uint8_t w, h;} planes[] = {
42 {12,16}, {16,16}, {20,23}, {32,18}, {8,128}, {128,128},
43 {1,1}, {1,4}, {3,8}, {13,16}, {21,9}, {63,7}, {127,5}
44 };
45
46 #define MAX_STRIDE 128
47 #define MAX_HEIGHT 128
48
49 126 static void check_shuffle_bytes(void * func, const char * report)
50 {
51 int i;
52 126 LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE]);
53 126 LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE]);
54 126 LOCAL_ALIGNED_32(uint8_t, dst0, [MAX_STRIDE]);
55 126 LOCAL_ALIGNED_32(uint8_t, dst1, [MAX_STRIDE]);
56
57 126 declare_func(void, const uint8_t *src, uint8_t *dst, int src_size);
58
59 126 memset(dst0, 0, MAX_STRIDE);
60 126 memset(dst1, 0, MAX_STRIDE);
61
2/2
✓ Branch 1 taken 4032 times.
✓ Branch 2 taken 126 times.
4158 randomize_buffers(src0, MAX_STRIDE);
62 126 memcpy(src1, src0, MAX_STRIDE);
63
64
2/2
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 99 times.
126 if (check_func(func, "%s", report)) {
65
2/2
✓ Branch 0 taken 162 times.
✓ Branch 1 taken 27 times.
189 for (i = 0; i < 6; i ++) {
66 162 call_ref(src0, dst0, width[i]);
67 162 call_new(src1, dst1, width[i]);
68
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 162 times.
162 if (memcmp(dst0, dst1, MAX_STRIDE))
69 fail();
70 }
71
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
27 bench_new(src0, dst0, width[5]);
72 }
73 126 }
74
75 28 static void check_interleaved_to_planar(void *func, const char *report, int odd_tail)
76 {
77 int i;
78
79 28 LOCAL_ALIGNED_32(uint8_t, src0, [MAX_STRIDE * MAX_HEIGHT * 2]);
80 28 LOCAL_ALIGNED_32(uint8_t, src1, [MAX_STRIDE * MAX_HEIGHT * 2]);
81 28 LOCAL_ALIGNED_32(uint8_t, dst_y_0, [MAX_STRIDE * MAX_HEIGHT]);
82 28 LOCAL_ALIGNED_32(uint8_t, dst_y_1, [MAX_STRIDE * MAX_HEIGHT]);
83 28 LOCAL_ALIGNED_32(uint8_t, dst_u_0, [(MAX_STRIDE/2) * MAX_HEIGHT]);
84 28 LOCAL_ALIGNED_32(uint8_t, dst_u_1, [(MAX_STRIDE/2) * MAX_HEIGHT]);
85 28 LOCAL_ALIGNED_32(uint8_t, dst_v_0, [(MAX_STRIDE/2) * MAX_HEIGHT]);
86 28 LOCAL_ALIGNED_32(uint8_t, dst_v_1, [(MAX_STRIDE/2) * MAX_HEIGHT]);
87
88 28 declare_func(void, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
89 const uint8_t *src, int width, int height,
90 int lumStride, int chromStride, int srcStride);
91
92
2/2
✓ Branch 1 taken 229376 times.
✓ Branch 2 taken 28 times.
229404 randomize_buffers(src0, MAX_STRIDE * MAX_HEIGHT * 2);
93 28 memcpy(src1, src0, MAX_STRIDE * MAX_HEIGHT * 2);
94
95
2/2
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 22 times.
28 if (check_func(func, "%s", report)) {
96
2/2
✓ Branch 0 taken 78 times.
✓ Branch 1 taken 6 times.
84 for (i = 0; i < FF_ARRAY_ELEMS(planes); i ++) {
97 78 int w = planes[i].w, h = planes[i].h;
98
2/2
✓ Branch 0 taken 42 times.
✓ Branch 1 taken 36 times.
78 int srcStride = 2 * w + (w & 1 ? odd_tail : 0);
99
100 78 memset(dst_y_0, 0, MAX_STRIDE * MAX_HEIGHT);
101 78 memset(dst_y_1, 0, MAX_STRIDE * MAX_HEIGHT);
102 78 memset(dst_u_0, 0, (MAX_STRIDE/2) * MAX_HEIGHT);
103 78 memset(dst_u_1, 0, (MAX_STRIDE/2) * MAX_HEIGHT);
104 78 memset(dst_v_0, 0, (MAX_STRIDE/2) * MAX_HEIGHT);
105 78 memset(dst_v_1, 0, (MAX_STRIDE/2) * MAX_HEIGHT);
106
107 78 call_ref(dst_y_0, dst_u_0, dst_v_0, src0, w, h,
108 MAX_STRIDE, MAX_STRIDE / 2, srcStride);
109 78 call_new(dst_y_1, dst_u_1, dst_v_1, src1, w, h,
110 MAX_STRIDE, MAX_STRIDE / 2, srcStride);
111
1/2
✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
78 if (memcmp(dst_y_0, dst_y_1, MAX_STRIDE * MAX_HEIGHT) ||
112
1/2
✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
78 memcmp(dst_u_0, dst_u_1, (MAX_STRIDE/2) * MAX_HEIGHT) ||
113
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 78 times.
78 memcmp(dst_v_0, dst_v_1, (MAX_STRIDE/2) * MAX_HEIGHT))
114 fail();
115 }
116
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
6 bench_new(dst_y_1, dst_u_1, dst_v_1, src1, planes[5].w, planes[5].h,
117 MAX_STRIDE, MAX_STRIDE / 2, 2 * planes[5].w);
118 }
119 28 }
120
121 #define NUM_LINES 5
122 #define MAX_LINE_SIZE 1920
123 #define BUFSIZE (NUM_LINES * MAX_LINE_SIZE)
124
125 15 static int cmp_off_by_n(const uint8_t *ref, const uint8_t *test, size_t n, int accuracy)
126 {
127
2/2
✓ Branch 0 taken 72000 times.
✓ Branch 1 taken 15 times.
72015 for (size_t i = 0; i < n; i++) {
128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 72000 times.
72000 if (abs(ref[i] - test[i]) > accuracy)
129 return 1;
130 }
131 15 return 0;
132 }
133
134 14 static void check_rgb24toyv12(SwsContext *sws)
135 {
136 static const int input_sizes[] = {16, 128, 512, MAX_LINE_SIZE, -MAX_LINE_SIZE};
137 14 SwsInternal *ctx = sws_internal(sws);
138
139 14 LOCAL_ALIGNED_32(uint8_t, src, [BUFSIZE * 3]);
140 14 LOCAL_ALIGNED_32(uint8_t, buf_y_0, [BUFSIZE]);
141 14 LOCAL_ALIGNED_32(uint8_t, buf_y_1, [BUFSIZE]);
142 14 LOCAL_ALIGNED_32(uint8_t, buf_u_0, [BUFSIZE / 4]);
143 14 LOCAL_ALIGNED_32(uint8_t, buf_u_1, [BUFSIZE / 4]);
144 14 LOCAL_ALIGNED_32(uint8_t, buf_v_0, [BUFSIZE / 4]);
145 14 LOCAL_ALIGNED_32(uint8_t, buf_v_1, [BUFSIZE / 4]);
146
147 14 declare_func(void, const uint8_t *src, uint8_t *ydst, uint8_t *udst,
148 uint8_t *vdst, int width, int height, int lumStride,
149 int chromStride, int srcStride, const int32_t *rgb2yuv);
150
151
2/2
✓ Branch 1 taken 100800 times.
✓ Branch 2 taken 14 times.
100814 randomize_buffers(src, BUFSIZE * 3);
152
153
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 14 times.
84 for (int isi = 0; isi < FF_ARRAY_ELEMS(input_sizes); isi++) {
154 70 int input_size = input_sizes[isi];
155 70 int negstride = input_size < 0;
156
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 56 times.
70 const char *negstride_str = negstride ? "_negstride" : "";
157 70 int width = FFABS(input_size);
158 70 int linesize = width + 32;
159 /* calculate height based on specified width to use the entire buffer. */
160 70 int height = (BUFSIZE / linesize) & ~1;
161 70 uint8_t *src0 = src;
162 70 uint8_t *src1 = src;
163 70 uint8_t *dst_y_0 = buf_y_0;
164 70 uint8_t *dst_y_1 = buf_y_1;
165 70 uint8_t *dst_u_0 = buf_u_0;
166 70 uint8_t *dst_u_1 = buf_u_1;
167 70 uint8_t *dst_v_0 = buf_v_0;
168 70 uint8_t *dst_v_1 = buf_v_1;
169
170
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 56 times.
70 if (negstride) {
171 14 src0 += (height - 1) * (linesize * 3);
172 14 src1 += (height - 1) * (linesize * 3);
173 14 dst_y_0 += (height - 1) * linesize;
174 14 dst_y_1 += (height - 1) * linesize;
175 14 dst_u_0 += ((height / 2) - 1) * (linesize / 2);
176 14 dst_u_1 += ((height / 2) - 1) * (linesize / 2);
177 14 dst_v_0 += ((height / 2) - 1) * (linesize / 2);
178 14 dst_v_1 += ((height / 2) - 1) * (linesize / 2);
179 14 linesize *= -1;
180 }
181
182
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 65 times.
70 if (check_func(ff_rgb24toyv12, "rgb24toyv12_%d_%d%s", width, height, negstride_str)) {
183 5 memset(buf_y_0, 0xFF, BUFSIZE);
184 5 memset(buf_y_1, 0xFF, BUFSIZE);
185 5 memset(buf_u_0, 0xFF, BUFSIZE / 4);
186 5 memset(buf_u_1, 0xFF, BUFSIZE / 4);
187 5 memset(buf_v_0, 0xFF, BUFSIZE / 4);
188 5 memset(buf_v_1, 0xFF, BUFSIZE / 4);
189
190 5 call_ref(src0, dst_y_0, dst_u_0, dst_v_0, width, height,
191 linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
192 5 call_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height,
193 linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
194
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (cmp_off_by_n(buf_y_0, buf_y_1, BUFSIZE, 1) ||
195
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 cmp_off_by_n(buf_u_0, buf_u_1, BUFSIZE / 4, 1) ||
196 5 cmp_off_by_n(buf_v_0, buf_v_1, BUFSIZE / 4, 1))
197 fail();
198
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
5 bench_new(src1, dst_y_1, dst_u_1, dst_v_1, width, height,
199 linesize, linesize / 2, linesize * 3, ctx->input_rgb2yuv_table);
200 }
201 }
202 14 }
203
204 #undef NUM_LINES
205 #undef MAX_LINE_SIZE
206 #undef BUFSIZE
207
208 14 static void check_interleave_bytes(void)
209 {
210 14 LOCAL_ALIGNED_16(uint8_t, src0_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
211 14 LOCAL_ALIGNED_16(uint8_t, src1_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
212 14 LOCAL_ALIGNED_16(uint8_t, dst0_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
213 14 LOCAL_ALIGNED_16(uint8_t, dst1_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
214 // Intentionally using unaligned buffers, as this function doesn't have
215 // any alignment requirements.
216 14 uint8_t *src0 = src0_buf + 1;
217 14 uint8_t *src1 = src1_buf + 1;
218 14 uint8_t *dst0 = dst0_buf + 2;
219 14 uint8_t *dst1 = dst1_buf + 2;
220
221 14 declare_func(void, const uint8_t *, const uint8_t *,
222 uint8_t *, int, int, int, int, int);
223
224
2/2
✓ Branch 1 taken 57344 times.
✓ Branch 2 taken 14 times.
57358 randomize_buffers(src0, MAX_STRIDE * MAX_HEIGHT);
225
2/2
✓ Branch 1 taken 57344 times.
✓ Branch 2 taken 14 times.
57358 randomize_buffers(src1, MAX_STRIDE * MAX_HEIGHT);
226
227
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
14 if (check_func(interleaveBytes, "interleave_bytes")) {
228
2/2
✓ Branch 0 taken 34 times.
✓ Branch 1 taken 2 times.
36 for (int i = 0; i <= 16; i++) {
229 // Try all widths [1,16], and try one random width.
230
231
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 32 times.
34 int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
232 34 int h = 1 + (rnd() % (MAX_HEIGHT-2));
233
234 34 int src0_offset = 0, src0_stride = MAX_STRIDE;
235 34 int src1_offset = 0, src1_stride = MAX_STRIDE;
236 34 int dst_offset = 0, dst_stride = 2 * MAX_STRIDE;
237
238 34 memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
239 34 memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
240
241 // Try different combinations of negative strides
242
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 18 times.
34 if (i & 1) {
243 16 src0_offset = (h-1)*src0_stride;
244 16 src0_stride = -src0_stride;
245 }
246
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 18 times.
34 if (i & 2) {
247 16 src1_offset = (h-1)*src1_stride;
248 16 src1_stride = -src1_stride;
249 }
250
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 18 times.
34 if (i & 4) {
251 16 dst_offset = (h-1)*dst_stride;
252 16 dst_stride = -dst_stride;
253 }
254
255 34 call_ref(src0 + src0_offset, src1 + src1_offset, dst0 + dst_offset,
256 w, h, src0_stride, src1_stride, dst_stride);
257 34 call_new(src0 + src0_offset, src1 + src1_offset, dst1 + dst_offset,
258 w, h, src0_stride, src1_stride, dst_stride);
259 // Check a one pixel-pair edge around the destination area,
260 // to catch overwrites past the end.
261 34 checkasm_check(uint8_t, dst0, 2*MAX_STRIDE, dst1, 2*MAX_STRIDE,
262 2 * w + 2, h + 1, "dst");
263 }
264
265
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
2 bench_new(src0, src1, dst1, 127, MAX_HEIGHT,
266 MAX_STRIDE, MAX_STRIDE, 2*MAX_STRIDE);
267 }
268
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
14 if (check_func(interleaveBytes, "interleave_bytes_aligned")) {
269 // Bench the function in a more typical case, with aligned
270 // buffers and widths.
271
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
2 bench_new(src0_buf, src1_buf, dst1_buf, 128, MAX_HEIGHT,
272 MAX_STRIDE, MAX_STRIDE, 2*MAX_STRIDE);
273 }
274 14 }
275
276 14 static void check_deinterleave_bytes(void)
277 {
278 14 LOCAL_ALIGNED_16(uint8_t, src_buf, [2*MAX_STRIDE*MAX_HEIGHT+2]);
279 14 LOCAL_ALIGNED_16(uint8_t, dst0_u_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
280 14 LOCAL_ALIGNED_16(uint8_t, dst0_v_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
281 14 LOCAL_ALIGNED_16(uint8_t, dst1_u_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
282 14 LOCAL_ALIGNED_16(uint8_t, dst1_v_buf, [MAX_STRIDE*MAX_HEIGHT+1]);
283 // Intentionally using unaligned buffers, as this function doesn't have
284 // any alignment requirements.
285 14 uint8_t *src = src_buf + 2;
286 14 uint8_t *dst0_u = dst0_u_buf + 1;
287 14 uint8_t *dst0_v = dst0_v_buf + 1;
288 14 uint8_t *dst1_u = dst1_u_buf + 1;
289 14 uint8_t *dst1_v = dst1_v_buf + 1;
290
291 14 declare_func(void, const uint8_t *src, uint8_t *dst1, uint8_t *dst2,
292 int width, int height, int srcStride,
293 int dst1Stride, int dst2Stride);
294
295
2/2
✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
114702 randomize_buffers(src, 2*MAX_STRIDE*MAX_HEIGHT);
296
297
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 11 times.
14 if (check_func(deinterleaveBytes, "deinterleave_bytes")) {
298
2/2
✓ Branch 0 taken 51 times.
✓ Branch 1 taken 3 times.
54 for (int i = 0; i <= 16; i++) {
299 // Try all widths [1,16], and try one random width.
300
301
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 48 times.
51 int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
302 51 int h = 1 + (rnd() % (MAX_HEIGHT-2));
303
304 51 int src_offset = 0, src_stride = 2 * MAX_STRIDE;
305 51 int dst_u_offset = 0, dst_u_stride = MAX_STRIDE;
306 51 int dst_v_offset = 0, dst_v_stride = MAX_STRIDE;
307
308 51 memset(dst0_u, 0, MAX_STRIDE * MAX_HEIGHT);
309 51 memset(dst0_v, 0, MAX_STRIDE * MAX_HEIGHT);
310 51 memset(dst1_u, 0, MAX_STRIDE * MAX_HEIGHT);
311 51 memset(dst1_v, 0, MAX_STRIDE * MAX_HEIGHT);
312
313 // Try different combinations of negative strides
314
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 27 times.
51 if (i & 1) {
315 24 src_offset = (h-1)*src_stride;
316 24 src_stride = -src_stride;
317 }
318
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 27 times.
51 if (i & 2) {
319 24 dst_u_offset = (h-1)*dst_u_stride;
320 24 dst_u_stride = -dst_u_stride;
321 }
322
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 27 times.
51 if (i & 4) {
323 24 dst_v_offset = (h-1)*dst_v_stride;
324 24 dst_v_stride = -dst_v_stride;
325 }
326
327 51 call_ref(src + src_offset, dst0_u + dst_u_offset, dst0_v + dst_v_offset,
328 w, h, src_stride, dst_u_stride, dst_v_stride);
329 51 call_new(src + src_offset, dst1_u + dst_u_offset, dst1_v + dst_v_offset,
330 w, h, src_stride, dst_u_stride, dst_v_stride);
331 // Check a one pixel-pair edge around the destination area,
332 // to catch overwrites past the end.
333 51 checkasm_check(uint8_t, dst0_u, MAX_STRIDE, dst1_u, MAX_STRIDE,
334 w + 1, h + 1, "dst_u");
335 51 checkasm_check(uint8_t, dst0_v, MAX_STRIDE, dst1_v, MAX_STRIDE,
336 w + 1, h + 1, "dst_v");
337 }
338
339
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
3 bench_new(src, dst1_u, dst1_v, 127, MAX_HEIGHT,
340 2*MAX_STRIDE, MAX_STRIDE, MAX_STRIDE);
341 }
342
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 11 times.
14 if (check_func(deinterleaveBytes, "deinterleave_bytes_aligned")) {
343 // Bench the function in a more typical case, with aligned
344 // buffers and widths.
345
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
3 bench_new(src_buf, dst1_u_buf, dst1_v_buf, 128, MAX_HEIGHT,
346 2*MAX_STRIDE, MAX_STRIDE, MAX_STRIDE);
347 }
348 14 }
349
350 #define MAX_LINE_SIZE 1920
351 static const int input_sizes[] = {8, 128, 1080, MAX_LINE_SIZE};
352 static const enum AVPixelFormat rgb_formats[] = {
353 AV_PIX_FMT_RGB24,
354 AV_PIX_FMT_BGR24,
355 AV_PIX_FMT_RGBA,
356 AV_PIX_FMT_BGRA,
357 AV_PIX_FMT_ABGR,
358 AV_PIX_FMT_ARGB,
359 };
360
361 14 static void check_rgb_to_y(SwsContext *sws)
362 {
363 14 SwsInternal *ctx = sws_internal(sws);
364
365 14 LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]);
366 14 LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]);
367 14 LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]);
368 14 LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]);
369
370 14 declare_func(void, uint8_t *dst, const uint8_t *src,
371 const uint8_t *unused1, const uint8_t *unused2, int width,
372 uint32_t *rgb2yuv, void *opq);
373
374
2/2
✓ Branch 1 taken 20160 times.
✓ Branch 2 taken 14 times.
20174 randomize_buffers(src24, MAX_LINE_SIZE * 3);
375
2/2
✓ Branch 1 taken 26880 times.
✓ Branch 2 taken 14 times.
26894 randomize_buffers(src32, MAX_LINE_SIZE * 4);
376
377
2/2
✓ Branch 0 taken 84 times.
✓ Branch 1 taken 14 times.
98 for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) {
378 84 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]);
379
380 84 sws->src_format = rgb_formats[i];
381 84 ff_sws_init_scale(ctx);
382
383
2/2
✓ Branch 0 taken 336 times.
✓ Branch 1 taken 84 times.
420 for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
384 336 int w = input_sizes[j];
385
386
2/2
✓ Branch 1 taken 104 times.
✓ Branch 2 taken 232 times.
336 if (check_func(ctx->lumToYV12, "%s_to_y_%d", desc->name, w)) {
387
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 64 times.
104 const uint8_t *src = desc->nb_components == 3 ? src24 : src32;
388 104 memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2);
389 104 memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2);
390
391 104 call_ref(dst0_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
392 104 call_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
393
394
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
104 if (memcmp(dst0_y, dst1_y, w * 2))
395 fail();
396
397
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 40 times.
104 if (desc->nb_components == 3 ||
398 // only bench native endian formats
399
4/4
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 32 times.
64 (sws->src_format == AV_PIX_FMT_RGB32 || sws->src_format == AV_PIX_FMT_RGB32_1))
400
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 72 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
72 bench_new(dst1_y, src, NULL, NULL, w, ctx->input_rgb2yuv_table, NULL);
401 }
402 }
403 }
404 14 }
405
406 14 static void check_rgb_to_uv(SwsContext *sws)
407 {
408 14 SwsInternal *ctx = sws_internal(sws);
409
410 14 LOCAL_ALIGNED_16(uint8_t, src24, [MAX_LINE_SIZE * 3]);
411 14 LOCAL_ALIGNED_16(uint8_t, src32, [MAX_LINE_SIZE * 4]);
412 14 LOCAL_ALIGNED_16(uint8_t, dst0_u, [MAX_LINE_SIZE * 2]);
413 14 LOCAL_ALIGNED_16(uint8_t, dst0_v, [MAX_LINE_SIZE * 2]);
414 14 LOCAL_ALIGNED_16(uint8_t, dst1_u, [MAX_LINE_SIZE * 2]);
415 14 LOCAL_ALIGNED_16(uint8_t, dst1_v, [MAX_LINE_SIZE * 2]);
416
417 14 declare_func(void, uint8_t *dstU, uint8_t *dstV,
418 const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
419 int width, uint32_t *pal, void *opq);
420
421
2/2
✓ Branch 1 taken 20160 times.
✓ Branch 2 taken 14 times.
20174 randomize_buffers(src24, MAX_LINE_SIZE * 3);
422
2/2
✓ Branch 1 taken 26880 times.
✓ Branch 2 taken 14 times.
26894 randomize_buffers(src32, MAX_LINE_SIZE * 4);
423
424
2/2
✓ Branch 0 taken 168 times.
✓ Branch 1 taken 14 times.
182 for (int i = 0; i < 2 * FF_ARRAY_ELEMS(rgb_formats); i++) {
425 168 enum AVPixelFormat src_fmt = rgb_formats[i / 2];
426 168 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src_fmt);
427
428 168 ctx->chrSrcHSubSample = (i % 2) ? 0 : 1;
429 168 sws->src_format = src_fmt;
430
2/2
✓ Branch 0 taken 84 times.
✓ Branch 1 taken 84 times.
168 sws->dst_format = ctx->chrSrcHSubSample ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_YUV444P;
431 168 ff_sws_init_scale(ctx);
432
433
2/2
✓ Branch 0 taken 672 times.
✓ Branch 1 taken 168 times.
840 for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
434 672 int w = input_sizes[j] >> ctx->chrSrcHSubSample;
435
436
4/4
✓ Branch 0 taken 336 times.
✓ Branch 1 taken 336 times.
✓ Branch 3 taken 128 times.
✓ Branch 4 taken 544 times.
672 if (check_func(ctx->chrToYV12, "%s_to_uv%s_%d", desc->name,
437 ctx->chrSrcHSubSample ? "_half" : "",
438 input_sizes[j])) {
439
2/2
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 80 times.
128 const uint8_t *src = desc->nb_components == 3 ? src24 : src32;
440 128 memset(dst0_u, 0xFF, MAX_LINE_SIZE * 2);
441 128 memset(dst0_v, 0xFF, MAX_LINE_SIZE * 2);
442 128 memset(dst1_u, 0xFF, MAX_LINE_SIZE * 2);
443 128 memset(dst1_v, 0xFF, MAX_LINE_SIZE * 2);
444
445 128 call_ref(dst0_u, dst0_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
446 128 call_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
447
448
2/4
✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 128 times.
128 if (memcmp(dst0_u, dst1_u, w * 2) || memcmp(dst0_v, dst1_v, w * 2))
449 fail();
450
451
2/2
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 48 times.
128 if (desc->nb_components == 3 ||
452 // only bench native endian formats
453
4/4
✓ Branch 0 taken 60 times.
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 40 times.
80 (sws->src_format == AV_PIX_FMT_RGB32 || sws->src_format == AV_PIX_FMT_RGB32_1))
454
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
88 bench_new(dst1_u, dst1_v, NULL, src, src, w, ctx->input_rgb2yuv_table, NULL);
455 }
456 }
457 }
458 14 }
459
460 14 static void check_rgba_to_a(SwsContext *sws)
461 {
462 14 SwsInternal *ctx = sws_internal(sws);
463
464 14 LOCAL_ALIGNED_16(uint8_t, src, [MAX_LINE_SIZE * 4]);
465 14 LOCAL_ALIGNED_32(uint8_t, dst0_y, [MAX_LINE_SIZE * 2]);
466 14 LOCAL_ALIGNED_32(uint8_t, dst1_y, [MAX_LINE_SIZE * 2]);
467
468 14 declare_func(void, uint8_t *dst, const uint8_t *src1,
469 const uint8_t *src2, const uint8_t *src3, int width,
470 uint32_t *rgb2yuv, void *opq);
471
472
2/2
✓ Branch 1 taken 26880 times.
✓ Branch 2 taken 14 times.
26894 randomize_buffers(src, MAX_LINE_SIZE * 4);
473
474
2/2
✓ Branch 0 taken 84 times.
✓ Branch 1 taken 14 times.
98 for (int i = 0; i < FF_ARRAY_ELEMS(rgb_formats); i++) {
475 84 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(rgb_formats[i]);
476
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 56 times.
84 if (desc->nb_components < 4)
477 28 continue;
478
479 56 sws->src_format = rgb_formats[i];
480 56 ff_sws_init_scale(ctx);
481
482
2/2
✓ Branch 0 taken 224 times.
✓ Branch 1 taken 56 times.
280 for (int j = 0; j < FF_ARRAY_ELEMS(input_sizes); j++) {
483 224 int w = input_sizes[j];
484
485
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 224 times.
224 if (check_func(ctx->alpToYV12, "%s_to_y_%d", desc->name, w)) {
486 memset(dst0_y, 0xFA, MAX_LINE_SIZE * 2);
487 memset(dst1_y, 0xFA, MAX_LINE_SIZE * 2);
488
489 call_ref(dst0_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL);
490 call_new(dst1_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL);
491
492 if (memcmp(dst0_y, dst1_y, w * 2))
493 fail();
494
495 // only bench native endian formats
496 if (sws->src_format == AV_PIX_FMT_RGB32 || sws->src_format == AV_PIX_FMT_RGB32_1)
497 bench_new(dst1_y, NULL, NULL, src, w, ctx->input_rgb2yuv_table, NULL);
498 }
499 }
500 }
501 14 }
502
503
504 static const int packed_rgb_fmts[] = {
505 AV_PIX_FMT_RGB24,
506 AV_PIX_FMT_BGR24,
507 AV_PIX_FMT_ARGB,
508 AV_PIX_FMT_RGBA,
509 AV_PIX_FMT_ABGR,
510 AV_PIX_FMT_BGRA,
511 AV_PIX_FMT_RGB48BE,
512 AV_PIX_FMT_RGB48LE,
513 AV_PIX_FMT_RGB565BE,
514 AV_PIX_FMT_RGB565LE,
515 AV_PIX_FMT_RGB555BE,
516 AV_PIX_FMT_RGB555LE,
517 AV_PIX_FMT_BGR565BE,
518 AV_PIX_FMT_BGR565LE,
519 AV_PIX_FMT_BGR555BE,
520 AV_PIX_FMT_BGR555LE,
521 AV_PIX_FMT_RGB444LE,
522 AV_PIX_FMT_RGB444BE,
523 AV_PIX_FMT_BGR444LE,
524 AV_PIX_FMT_BGR444BE,
525 AV_PIX_FMT_BGR48BE,
526 AV_PIX_FMT_BGR48LE,
527 AV_PIX_FMT_RGBA64BE,
528 AV_PIX_FMT_RGBA64LE,
529 AV_PIX_FMT_BGRA64BE,
530 AV_PIX_FMT_BGRA64LE,
531 AV_PIX_FMT_RGB8,
532 AV_PIX_FMT_BGR8,
533 AV_PIX_FMT_RGB4,
534 AV_PIX_FMT_BGR4,
535 AV_PIX_FMT_RGB4_BYTE,
536 AV_PIX_FMT_BGR4_BYTE,
537 };
538
539 #define INPUT_SIZE 512
540
541 14 static void check_yuv2packed1(void)
542 {
543 static const int alpha_values[] = {0, 2048, 4096};
544
545
2/2
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1 times.
14 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
546 void, SwsInternal *c, const int16_t *lumSrc,
547 const int16_t *chrUSrc[2], const int16_t *chrVSrc[2],
548 const int16_t *alpSrc, uint8_t *dest,
549 int dstW, int uvalpha, int y);
550
551 const int16_t *luma;
552 const int16_t *chru[2];
553 const int16_t *chrv[2];
554 const int16_t *alpha;
555
556 14 LOCAL_ALIGNED_8(int32_t, src_y, [2 * INPUT_SIZE]);
557 14 LOCAL_ALIGNED_8(int32_t, src_u, [2 * INPUT_SIZE]);
558 14 LOCAL_ALIGNED_8(int32_t, src_v, [2 * INPUT_SIZE]);
559 14 LOCAL_ALIGNED_8(int32_t, src_a, [2 * INPUT_SIZE]);
560
561 14 LOCAL_ALIGNED_8(uint8_t, dst0, [INPUT_SIZE * sizeof(int32_t[4])]);
562 14 LOCAL_ALIGNED_8(uint8_t, dst1, [INPUT_SIZE * sizeof(int32_t[4])]);
563
564
2/2
✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
14350 randomize_buffers((uint8_t*)src_y, 2 * INPUT_SIZE * sizeof(int32_t));
565
2/2
✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
14350 randomize_buffers((uint8_t*)src_u, 2 * INPUT_SIZE * sizeof(int32_t));
566
2/2
✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
14350 randomize_buffers((uint8_t*)src_v, 2 * INPUT_SIZE * sizeof(int32_t));
567
2/2
✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
14350 randomize_buffers((uint8_t*)src_a, 2 * INPUT_SIZE * sizeof(int32_t));
568
569 /* Limit to 14 bit input range */
570
2/2
✓ Branch 0 taken 14336 times.
✓ Branch 1 taken 14 times.
14350 for (int i = 0; i < 2 * INPUT_SIZE; i++) {
571 14336 src_y[i] &= 0x3FFF3FFF;
572 14336 src_a[i] &= 0x3FFF3FFF;
573 14336 src_u[i] &= 0x3FFF3FFF;
574 14336 src_v[i] &= 0x3FFF3FFF;
575 }
576
577 14 luma = (int16_t *)src_y;
578 14 alpha = (int16_t *)src_a;
579
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 14 times.
42 for (int i = 0; i < 2; i++) {
580 28 chru[i] = (int16_t *)(src_u + i*INPUT_SIZE);
581 28 chrv[i] = (int16_t *)(src_v + i*INPUT_SIZE);
582 }
583
584
2/2
✓ Branch 0 taken 448 times.
✓ Branch 1 taken 14 times.
462 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
585 448 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
586 448 int line_size = INPUT_SIZE * desc->comp[0].step;
587 SwsContext *sws;
588 SwsInternal *c;
589
590
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 420 times.
448 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
591 28 line_size = AV_CEIL_RSHIFT(line_size, 3);
592
593 448 sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P,
594 448 MAX_LINE_SIZE, MAX_LINE_SIZE, packed_rgb_fmts[fmi],
595 SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL);
596
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 448 times.
448 if (!sws)
597 fail();
598
599 448 c = sws_internal(sws);
600
601
2/2
✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 448 times.
1792 for (int ai = 0; ai < FF_ARRAY_ELEMS(alpha_values); ai++) {
602 1344 const int chr_alpha = alpha_values[ai];
603
2/2
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 1248 times.
1344 if (check_func(c->yuv2packed1, "yuv2%s_1_%d_%d", desc->name, chr_alpha, INPUT_SIZE)) {
604 96 memset(dst0, 0xFF, INPUT_SIZE * sizeof(int32_t[4]));
605 96 memset(dst1, 0xFF, INPUT_SIZE * sizeof(int32_t[4]));
606
607 96 call_ref(c, luma, chru, chrv, alpha, dst0, INPUT_SIZE, chr_alpha, 0);
608 96 call_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0);
609
610
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
96 if (memcmp(dst0, dst1, line_size))
611 fail();
612
613
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
96 bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, chr_alpha, 0);
614 }
615 }
616
617 448 sws_freeContext(sws);
618 }
619 14 }
620
621 14 static void check_yuv2packed2(void)
622 {
623 static const int alpha_values[] = {0, 2048, 4096};
624
625
2/2
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1 times.
14 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
626 void, SwsInternal *c, const int16_t *lumSrc[2],
627 const int16_t *chrUSrc[2], const int16_t *chrVSrc[2],
628 const int16_t *alpSrc[2], uint8_t *dest,
629 int dstW, int yalpha, int uvalpha, int y);
630
631 const int16_t *luma[2];
632 const int16_t *chru[2];
633 const int16_t *chrv[2];
634 const int16_t *alpha[2];
635
636 14 LOCAL_ALIGNED_8(int32_t, src_y, [2 * INPUT_SIZE]);
637 14 LOCAL_ALIGNED_8(int32_t, src_u, [2 * INPUT_SIZE]);
638 14 LOCAL_ALIGNED_8(int32_t, src_v, [2 * INPUT_SIZE]);
639 14 LOCAL_ALIGNED_8(int32_t, src_a, [2 * INPUT_SIZE]);
640
641 14 LOCAL_ALIGNED_8(uint8_t, dst0, [INPUT_SIZE * sizeof(int32_t[4])]);
642 14 LOCAL_ALIGNED_8(uint8_t, dst1, [INPUT_SIZE * sizeof(int32_t[4])]);
643
644
2/2
✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
14350 randomize_buffers((uint8_t*)src_y, 2 * INPUT_SIZE * sizeof(int32_t));
645
2/2
✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
14350 randomize_buffers((uint8_t*)src_u, 2 * INPUT_SIZE * sizeof(int32_t));
646
2/2
✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
14350 randomize_buffers((uint8_t*)src_v, 2 * INPUT_SIZE * sizeof(int32_t));
647
2/2
✓ Branch 1 taken 14336 times.
✓ Branch 2 taken 14 times.
14350 randomize_buffers((uint8_t*)src_a, 2 * INPUT_SIZE * sizeof(int32_t));
648
649 /* Limit to 14 bit input range */
650
2/2
✓ Branch 0 taken 14336 times.
✓ Branch 1 taken 14 times.
14350 for (int i = 0; i < 2 * INPUT_SIZE; i++) {
651 14336 src_y[i] &= 0x3FFF3FFF;
652 14336 src_u[i] &= 0x3FFF3FFF;
653 14336 src_v[i] &= 0x3FFF3FFF;
654 14336 src_a[i] &= 0x3FFF3FFF;
655 }
656
657
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 14 times.
42 for (int i = 0; i < 2; i++) {
658 28 luma[i] = (int16_t *)(src_y + i*INPUT_SIZE);
659 28 chru[i] = (int16_t *)(src_u + i*INPUT_SIZE);
660 28 chrv[i] = (int16_t *)(src_v + i*INPUT_SIZE);
661 28 alpha[i] = (int16_t *)(src_a + i*INPUT_SIZE);
662 }
663
664
2/2
✓ Branch 0 taken 448 times.
✓ Branch 1 taken 14 times.
462 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
665 448 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
666 448 int line_size = INPUT_SIZE * desc->comp[0].step;
667 SwsContext *sws;
668 SwsInternal *c;
669
670
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 420 times.
448 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
671 28 line_size = AV_CEIL_RSHIFT(line_size, 3);
672
673 448 sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P,
674 448 MAX_LINE_SIZE, MAX_LINE_SIZE, packed_rgb_fmts[fmi],
675 SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL);
676
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 448 times.
448 if (!sws)
677 fail();
678
679 448 c = sws_internal(sws);
680
681
2/2
✓ Branch 0 taken 1344 times.
✓ Branch 1 taken 448 times.
1792 for (int ai = 0; ai < FF_ARRAY_ELEMS(alpha_values); ai++) {
682 1344 const int lum_alpha = alpha_values[ai];
683 1344 const int chr_alpha = alpha_values[ai];
684
2/2
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 1248 times.
1344 if (check_func(c->yuv2packed2, "yuv2%s_2_%d_%d", desc->name, lum_alpha, INPUT_SIZE)) {
685 96 memset(dst0, 0xFF, INPUT_SIZE * sizeof(int32_t[4]));
686 96 memset(dst1, 0xFF, INPUT_SIZE * sizeof(int32_t[4]));
687
688 96 call_ref(c, luma, chru, chrv, alpha, dst0, INPUT_SIZE, lum_alpha, chr_alpha, 0);
689 96 call_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0);
690
691
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
96 if (memcmp(dst0, dst1, line_size))
692 fail();
693
694
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
96 bench_new(c, luma, chru, chrv, alpha, dst1, INPUT_SIZE, lum_alpha, chr_alpha, 0);
695 }
696 }
697
698 448 sws_freeContext(sws);
699 }
700 14 }
701
702 14 static void check_yuv2packedX(void)
703 {
704 #define LARGEST_FILTER 16
705 static const int filter_sizes[] = {2, 16};
706
707
2/2
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 1 times.
14 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT,
708 void, SwsInternal *c, const int16_t *lumFilter,
709 const int16_t **lumSrcx, int lumFilterSize,
710 const int16_t *chrFilter, const int16_t **chrUSrcx,
711 const int16_t **chrVSrcx, int chrFilterSize,
712 const int16_t **alpSrcx, uint8_t *dest,
713 int dstW, int y);
714
715 const int16_t *luma[LARGEST_FILTER];
716 const int16_t *chru[LARGEST_FILTER];
717 const int16_t *chrv[LARGEST_FILTER];
718 const int16_t *alpha[LARGEST_FILTER];
719
720 14 LOCAL_ALIGNED_8(int16_t, luma_filter, [LARGEST_FILTER]);
721 14 LOCAL_ALIGNED_8(int16_t, chr_filter, [LARGEST_FILTER]);
722
723 14 LOCAL_ALIGNED_8(int32_t, src_y, [LARGEST_FILTER * INPUT_SIZE]);
724 14 LOCAL_ALIGNED_8(int32_t, src_u, [LARGEST_FILTER * INPUT_SIZE]);
725 14 LOCAL_ALIGNED_8(int32_t, src_v, [LARGEST_FILTER * INPUT_SIZE]);
726 14 LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_FILTER * INPUT_SIZE]);
727
728 14 LOCAL_ALIGNED_8(uint8_t, dst0, [INPUT_SIZE * sizeof(int32_t[4])]);
729 14 LOCAL_ALIGNED_8(uint8_t, dst1, [INPUT_SIZE * sizeof(int32_t[4])]);
730
731
2/2
✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
114702 randomize_buffers((uint8_t*)src_y, LARGEST_FILTER * INPUT_SIZE * sizeof(int32_t));
732
2/2
✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
114702 randomize_buffers((uint8_t*)src_u, LARGEST_FILTER * INPUT_SIZE * sizeof(int32_t));
733
2/2
✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
114702 randomize_buffers((uint8_t*)src_v, LARGEST_FILTER * INPUT_SIZE * sizeof(int32_t));
734
2/2
✓ Branch 1 taken 114688 times.
✓ Branch 2 taken 14 times.
114702 randomize_buffers((uint8_t*)src_a, LARGEST_FILTER * INPUT_SIZE * sizeof(int32_t));
735
736 /* Limit to 14 bit input range */
737
2/2
✓ Branch 0 taken 114688 times.
✓ Branch 1 taken 14 times.
114702 for (int i = 0; i < LARGEST_FILTER * INPUT_SIZE; i++) {
738 114688 src_y[i] &= 0x3FFF3FFF;
739 114688 src_u[i] &= 0x3FFF3FFF;
740 114688 src_v[i] &= 0x3FFF3FFF;
741 114688 src_a[i] &= 0x3FFF3FFF;
742 }
743
744
2/2
✓ Branch 0 taken 224 times.
✓ Branch 1 taken 14 times.
238 for (int i = 0; i < LARGEST_FILTER; i++) {
745 224 luma[i] = (int16_t *)(src_y + i*INPUT_SIZE);
746 224 chru[i] = (int16_t *)(src_u + i*INPUT_SIZE);
747 224 chrv[i] = (int16_t *)(src_v + i*INPUT_SIZE);
748 224 alpha[i] = (int16_t *)(src_a + i*INPUT_SIZE);
749 }
750
751
2/2
✓ Branch 0 taken 448 times.
✓ Branch 1 taken 14 times.
462 for (int fmi = 0; fmi < FF_ARRAY_ELEMS(packed_rgb_fmts); fmi++) {
752 448 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(packed_rgb_fmts[fmi]);
753 448 int line_size = INPUT_SIZE * desc->comp[0].step;
754 SwsContext *sws;
755 SwsInternal *c;
756
757
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 420 times.
448 if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM)
758 28 line_size = AV_CEIL_RSHIFT(line_size, 3);
759
760 448 sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P,
761 448 MAX_LINE_SIZE, MAX_LINE_SIZE, packed_rgb_fmts[fmi],
762 SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL);
763
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 448 times.
448 if (!sws)
764 fail();
765
766 448 c = sws_internal(sws);
767
768
2/2
✓ Branch 0 taken 896 times.
✓ Branch 1 taken 448 times.
1344 for (int fsi = 0; fsi < FF_ARRAY_ELEMS(filter_sizes); fsi++) {
769 896 const int luma_filter_size = filter_sizes[fsi];
770 896 const int chr_filter_size = filter_sizes[fsi];
771
772
2/2
✓ Branch 0 taken 8064 times.
✓ Branch 1 taken 896 times.
8960 for (int i = 0; i < luma_filter_size; i++)
773 8064 luma_filter[i] = -((1 << 12) / (luma_filter_size - 1));
774 896 luma_filter[rnd() % luma_filter_size] = (1 << 13) - 1;
775
776
2/2
✓ Branch 0 taken 8064 times.
✓ Branch 1 taken 896 times.
8960 for (int i = 0; i < chr_filter_size; i++)
777 8064 chr_filter[i] = -((1 << 12) / (chr_filter_size - 1));
778 896 chr_filter[rnd() % chr_filter_size] = (1 << 13) - 1;
779
780
2/2
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 832 times.
896 if (check_func(c->yuv2packedX, "yuv2%s_X_%d_%d", desc->name, luma_filter_size, INPUT_SIZE)) {
781 64 memset(dst0, 0xFF, INPUT_SIZE * sizeof(int32_t[4]));
782 64 memset(dst1, 0xFF, INPUT_SIZE * sizeof(int32_t[4]));
783
784 64 call_ref(c, luma_filter, luma, luma_filter_size,
785 chr_filter, chru, chrv, chr_filter_size,
786 alpha, dst0, INPUT_SIZE, 0);
787
788 64 call_new(c, luma_filter, luma, luma_filter_size,
789 chr_filter, chru, chrv, chr_filter_size,
790 alpha, dst1, INPUT_SIZE, 0);
791
792
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
64 if (memcmp(dst0, dst1, line_size))
793 fail();
794
795
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
64 bench_new(c, luma_filter, luma, luma_filter_size,
796 chr_filter, chru, chrv, chr_filter_size,
797 alpha, dst1, INPUT_SIZE, 0);
798 }
799 }
800
801 448 sws_freeContext(sws);
802 }
803 14 }
804
805 #undef INPUT_SIZE
806 #undef LARGEST_FILTER
807
808 14 void checkasm_check_sw_rgb(void)
809 {
810 SwsContext *sws;
811
812 14 ff_sws_rgb2rgb_init();
813
814 14 check_shuffle_bytes(shuffle_bytes_2103, "shuffle_bytes_2103");
815 14 report("shuffle_bytes_2103");
816
817 14 check_shuffle_bytes(shuffle_bytes_0321, "shuffle_bytes_0321");
818 14 report("shuffle_bytes_0321");
819
820 14 check_shuffle_bytes(shuffle_bytes_1230, "shuffle_bytes_1230");
821 14 report("shuffle_bytes_1230");
822
823 14 check_shuffle_bytes(shuffle_bytes_3012, "shuffle_bytes_3012");
824 14 report("shuffle_bytes_3012");
825
826 14 check_shuffle_bytes(shuffle_bytes_3210, "shuffle_bytes_3210");
827 14 report("shuffle_bytes_3210");
828
829 14 check_shuffle_bytes(shuffle_bytes_3102, "shuffle_bytes_3102");
830 14 report("shuffle_bytes_3102");
831
832 14 check_shuffle_bytes(shuffle_bytes_2013, "shuffle_bytes_2013");
833 14 report("shuffle_bytes_2013");
834
835 14 check_shuffle_bytes(shuffle_bytes_1203, "shuffle_bytes_1203");
836 14 report("shuffle_bytes_1203");
837
838 14 check_shuffle_bytes(shuffle_bytes_2130, "shuffle_bytes_2130");
839 14 report("shuffle_bytes_2130");
840
841 {
842 /* rgb24tobgr24 operates on 3-byte pixels, so test widths must be
843 * multiples of 3 to avoid reading past the source buffer. */
844 static const int rgb24_width[] = {3, 12, 24, 36, 48, 126, 1920 * 3};
845 int i;
846 #define RGB24_BENCH_WIDTH (1920 * 3)
847 14 LOCAL_ALIGNED_32(uint8_t, src0, [RGB24_BENCH_WIDTH]);
848 14 LOCAL_ALIGNED_32(uint8_t, src1, [RGB24_BENCH_WIDTH]);
849 14 LOCAL_ALIGNED_32(uint8_t, dst0, [RGB24_BENCH_WIDTH]);
850 14 LOCAL_ALIGNED_32(uint8_t, dst1, [RGB24_BENCH_WIDTH]);
851
852 14 declare_func(void, const uint8_t *src, uint8_t *dst, int src_size);
853
854 14 memset(dst0, 0, RGB24_BENCH_WIDTH);
855 14 memset(dst1, 0, RGB24_BENCH_WIDTH);
856
2/2
✓ Branch 1 taken 20160 times.
✓ Branch 2 taken 14 times.
20174 randomize_buffers(src0, RGB24_BENCH_WIDTH);
857 14 memcpy(src1, src0, RGB24_BENCH_WIDTH);
858
859
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
14 if (check_func(rgb24tobgr24, "rgb24tobgr24")) {
860
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 2 times.
16 for (i = 0; i < FF_ARRAY_ELEMS(rgb24_width); i++) {
861 14 call_ref(src0, dst0, rgb24_width[i]);
862 14 call_new(src1, dst1, rgb24_width[i]);
863
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (memcmp(dst0, dst1, rgb24_width[i]))
864 fail();
865 }
866
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
2 bench_new(src0, dst0, RGB24_BENCH_WIDTH);
867 }
868 #undef RGB24_BENCH_WIDTH
869 }
870 14 report("rgb24tobgr24");
871
872 {
873 /* rgb32tobgr24: 4-byte pixels → 3-byte pixels.
874 * Test widths must be multiples of 4 (one pixel).
875 * Sizes chosen to exercise each codepath tier:
876 * 4 = scalar only (1 pixel)
877 * 16 = scalar only (4 pixels, loop iteration)
878 * 32 = medium only
879 * 48 = medium + scalar
880 * 64 = fast only (exact)
881 * 68 = fast + scalar (skip medium)
882 * 100 = fast + medium + scalar (all tiers)
883 * 128 = fast only (multi-iteration)
884 * 1920*4 = fast only (benchmark width)
885 */
886 static const int rgb32_widths[] = {4, 16, 32, 48, 64, 68, 100, 128, 1920 * 4};
887 #define RGB32_BENCH_WIDTH (1920 * 4)
888 #define RGB32_DST_SIZE (RGB32_BENCH_WIDTH * 3 / 4 + 8)
889 14 LOCAL_ALIGNED_32(uint8_t, src0, [RGB32_BENCH_WIDTH]);
890 14 LOCAL_ALIGNED_32(uint8_t, src1, [RGB32_BENCH_WIDTH]);
891 14 LOCAL_ALIGNED_32(uint8_t, dst0, [RGB32_DST_SIZE]);
892 14 LOCAL_ALIGNED_32(uint8_t, dst1, [RGB32_DST_SIZE]);
893
894 14 declare_func(void, const uint8_t *src, uint8_t *dst, int src_size);
895
896
2/2
✓ Branch 1 taken 26880 times.
✓ Branch 2 taken 14 times.
26894 randomize_buffers(src0, RGB32_BENCH_WIDTH);
897 14 memcpy(src1, src0, RGB32_BENCH_WIDTH);
898
899
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
14 if (check_func(rgb32tobgr24, "rgb32tobgr24")) {
900
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 2 times.
20 for (int i = 0; i < FF_ARRAY_ELEMS(rgb32_widths); i++) {
901 18 int out_size = rgb32_widths[i] * 3 / 4;
902 18 memset(dst0, 0xAA, RGB32_DST_SIZE);
903 18 memset(dst1, 0xAA, RGB32_DST_SIZE);
904 18 call_ref(src0, dst0, rgb32_widths[i]);
905 18 call_new(src1, dst1, rgb32_widths[i]);
906
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 if (memcmp(dst0, dst1, out_size) ||
907
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 dst0[out_size] != 0xAA ||
908
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 dst1[out_size] != 0xAA)
909 fail();
910 }
911
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
2 bench_new(src0, dst0, RGB32_BENCH_WIDTH);
912 }
913 #undef RGB32_DST_SIZE
914 #undef RGB32_BENCH_WIDTH
915 }
916 14 report("rgb32tobgr24");
917
918 {
919 /* rgb24tobgr32: 3-byte pixels → 4-byte pixels.
920 * Test widths must be multiples of 3 (one pixel).
921 * Sizes chosen to exercise each codepath tier:
922 * 3 = scalar only (1 pixel)
923 * 12 = scalar only (4 pixels, loop iteration)
924 * 24 = medium only
925 * 36 = medium + scalar
926 * 48 = fast only (exact)
927 * 51 = fast + scalar (skip medium)
928 * 126 = fast + medium + scalar (all tiers)
929 * 1920*3 = fast only (benchmark width)
930 */
931 static const int rgb24to32_widths[] = {3, 12, 24, 36, 48, 51, 126, 1920 * 3};
932 #define RGB24TO32_BENCH_WIDTH (1920 * 3)
933 #define RGB24TO32_DST_SIZE (RGB24TO32_BENCH_WIDTH * 4 / 3 + 8)
934 14 LOCAL_ALIGNED_32(uint8_t, src0, [RGB24TO32_BENCH_WIDTH]);
935 14 LOCAL_ALIGNED_32(uint8_t, src1, [RGB24TO32_BENCH_WIDTH]);
936 14 LOCAL_ALIGNED_32(uint8_t, dst0, [RGB24TO32_DST_SIZE]);
937 14 LOCAL_ALIGNED_32(uint8_t, dst1, [RGB24TO32_DST_SIZE]);
938
939 14 declare_func(void, const uint8_t *src, uint8_t *dst, int src_size);
940
941
2/2
✓ Branch 1 taken 20160 times.
✓ Branch 2 taken 14 times.
20174 randomize_buffers(src0, RGB24TO32_BENCH_WIDTH);
942 14 memcpy(src1, src0, RGB24TO32_BENCH_WIDTH);
943
944
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 12 times.
14 if (check_func(rgb24tobgr32, "rgb24tobgr32")) {
945
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 2 times.
18 for (int i = 0; i < FF_ARRAY_ELEMS(rgb24to32_widths); i++) {
946 16 int out_size = rgb24to32_widths[i] * 4 / 3;
947 16 memset(dst0, 0xAA, RGB24TO32_DST_SIZE);
948 16 memset(dst1, 0xAA, RGB24TO32_DST_SIZE);
949 16 call_ref(src0, dst0, rgb24to32_widths[i]);
950 16 call_new(src1, dst1, rgb24to32_widths[i]);
951
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 if (memcmp(dst0, dst1, out_size) ||
952
1/2
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
16 dst0[out_size] != 0xAA ||
953
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 dst1[out_size] != 0xAA)
954 fail();
955 }
956
1/18
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 59 not taken.
✗ Branch 60 not taken.
2 bench_new(src0, dst0, RGB24TO32_BENCH_WIDTH);
957 }
958 #undef RGB24TO32_DST_SIZE
959 #undef RGB24TO32_BENCH_WIDTH
960 }
961 14 report("rgb24tobgr32");
962
963 14 check_interleaved_to_planar(uyvytoyuv422, "uyvytoyuv422", 1);
964 14 report("uyvytoyuv422");
965 14 check_interleaved_to_planar(yuyvtoyuv422, "yuyvtoyuv422", 2);
966 14 report("yuyvtoyuv422");
967
968 14 check_interleave_bytes();
969 14 report("interleave_bytes");
970
971 14 check_deinterleave_bytes();
972 14 report("deinterleave_bytes");
973
974 14 sws = sws_getContext(MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_RGB24,
975 MAX_LINE_SIZE, MAX_LINE_SIZE, AV_PIX_FMT_YUV420P,
976 SWS_ACCURATE_RND | SWS_BITEXACT, NULL, NULL, NULL);
977
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
14 if (!sws)
978 fail();
979
980 14 check_rgb_to_y(sws);
981 14 report("rgb_to_y");
982
983 14 check_rgb_to_uv(sws);
984 14 report("rgb_to_uv");
985
986 14 check_rgba_to_a(sws);
987 14 report("rgba_to_a");
988
989 14 check_rgb24toyv12(sws);
990 14 report("rgb24toyv12");
991
992 14 sws_freeContext(sws);
993
994 14 check_yuv2packed1();
995 14 report("yuv2packed1");
996
997 14 check_yuv2packed2();
998 14 report("yuv2packed2");
999
1000 14 check_yuv2packedX();
1001 14 report("yuv2packedX");
1002 14 }
1003