FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/tests/checkasm/sw_gbrp.c
Date: 2024-05-03 15:42:48
Exec Total Coverage
Lines: 199 207 96.1%
Functions: 5 5 100.0%
Branches: 94 134 70.1%

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/swscale.h"
28 #include "libswscale/swscale_internal.h"
29
30 #include "checkasm.h"
31
32 #define randomize_buffers(buf, size) \
33 do { \
34 int j; \
35 for (j = 0; j < size; j+=4) \
36 AV_WN32(buf + j, rnd()); \
37 } while (0)
38
39 static const int planar_fmts[] = {
40 AV_PIX_FMT_GBRP,
41 AV_PIX_FMT_GBRP9BE,
42 AV_PIX_FMT_GBRP9LE,
43 AV_PIX_FMT_GBRP10BE,
44 AV_PIX_FMT_GBRP10LE,
45 AV_PIX_FMT_GBRP12BE,
46 AV_PIX_FMT_GBRP12LE,
47 AV_PIX_FMT_GBRP14BE,
48 AV_PIX_FMT_GBRP14LE,
49 AV_PIX_FMT_GBRAP,
50 AV_PIX_FMT_GBRAP10BE,
51 AV_PIX_FMT_GBRAP10LE,
52 AV_PIX_FMT_GBRAP12BE,
53 AV_PIX_FMT_GBRAP12LE,
54 AV_PIX_FMT_GBRP16BE,
55 AV_PIX_FMT_GBRP16LE,
56 AV_PIX_FMT_GBRAP16BE,
57 AV_PIX_FMT_GBRAP16LE,
58 AV_PIX_FMT_GBRPF32BE,
59 AV_PIX_FMT_GBRPF32LE,
60 AV_PIX_FMT_GBRAPF32BE,
61 AV_PIX_FMT_GBRAPF32LE
62 };
63
64 13 static void check_output_yuv2gbrp(void)
65 {
66 struct SwsContext *ctx;
67 const AVPixFmtDescriptor *desc;
68 int fmi, fsi, isi, i;
69 int dstW, byte_size, luma_filter_size, chr_filter_size;
70 #define LARGEST_FILTER 16
71 #define FILTER_SIZES 4
72 static const int filter_sizes[] = {1, 4, 8, 16};
73 #define LARGEST_INPUT_SIZE 512
74 #define INPUT_SIZES 6
75 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
76 uint8_t *dst0[4];
77 uint8_t *dst1[4];
78
79 13 declare_func(void, void *c, const int16_t *lumFilter,
80 const int16_t **lumSrcx, int lumFilterSize,
81 const int16_t *chrFilter, const int16_t **chrUSrcx,
82 const int16_t **chrVSrcx, int chrFilterSize,
83 const int16_t **alpSrcx, uint8_t **dest,
84 int dstW, int y);
85
86 const int16_t *luma[LARGEST_FILTER];
87 const int16_t *chru[LARGEST_FILTER];
88 const int16_t *chrv[LARGEST_FILTER];
89 const int16_t *alpha[LARGEST_FILTER];
90
91 13 LOCAL_ALIGNED_8(int16_t, luma_filter, [LARGEST_FILTER]);
92 13 LOCAL_ALIGNED_8(int16_t, chr_filter, [LARGEST_FILTER]);
93
94 13 LOCAL_ALIGNED_8(int32_t, src_y, [LARGEST_FILTER * LARGEST_INPUT_SIZE]);
95 13 LOCAL_ALIGNED_8(int32_t, src_u, [LARGEST_FILTER * LARGEST_INPUT_SIZE]);
96 13 LOCAL_ALIGNED_8(int32_t, src_v, [LARGEST_FILTER * LARGEST_INPUT_SIZE]);
97 13 LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_FILTER * LARGEST_INPUT_SIZE]);
98
99 13 LOCAL_ALIGNED_8(uint8_t, dst0_r, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
100 13 LOCAL_ALIGNED_8(uint8_t, dst0_g, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
101 13 LOCAL_ALIGNED_8(uint8_t, dst0_b, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
102 13 LOCAL_ALIGNED_8(uint8_t, dst0_a, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
103
104 13 LOCAL_ALIGNED_8(uint8_t, dst1_r, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
105 13 LOCAL_ALIGNED_8(uint8_t, dst1_g, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
106 13 LOCAL_ALIGNED_8(uint8_t, dst1_b, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
107 13 LOCAL_ALIGNED_8(uint8_t, dst1_a, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
108
109
2/2
✓ Branch 1 taken 106496 times.
✓ Branch 2 taken 13 times.
106509 randomize_buffers((uint8_t*)src_y, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int32_t));
110
2/2
✓ Branch 1 taken 106496 times.
✓ Branch 2 taken 13 times.
106509 randomize_buffers((uint8_t*)src_u, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int32_t));
111
2/2
✓ Branch 1 taken 106496 times.
✓ Branch 2 taken 13 times.
106509 randomize_buffers((uint8_t*)src_v, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int32_t));
112
2/2
✓ Branch 1 taken 106496 times.
✓ Branch 2 taken 13 times.
106509 randomize_buffers((uint8_t*)src_a, LARGEST_FILTER * LARGEST_INPUT_SIZE * sizeof(int32_t));
113
2/2
✓ Branch 1 taken 104 times.
✓ Branch 2 taken 13 times.
117 randomize_buffers((uint8_t*)luma_filter, LARGEST_FILTER * sizeof(int16_t));
114
2/2
✓ Branch 1 taken 104 times.
✓ Branch 2 taken 13 times.
117 randomize_buffers((uint8_t*)chr_filter, LARGEST_FILTER * sizeof(int16_t));
115
116 13 dst0[0] = (uint8_t*)dst0_g;
117 13 dst0[1] = (uint8_t*)dst0_b;
118 13 dst0[2] = (uint8_t*)dst0_r;
119 13 dst0[3] = (uint8_t*)dst0_a;
120
121 13 dst1[0] = (uint8_t*)dst1_g;
122 13 dst1[1] = (uint8_t*)dst1_b;
123 13 dst1[2] = (uint8_t*)dst1_r;
124 13 dst1[3] = (uint8_t*)dst1_a;
125
126
2/2
✓ Branch 0 taken 208 times.
✓ Branch 1 taken 13 times.
221 for (i = 0; i < LARGEST_FILTER; i++) {
127 208 luma[i] = (int16_t *)(src_y + i*LARGEST_INPUT_SIZE);
128 208 chru[i] = (int16_t *)(src_u + i*LARGEST_INPUT_SIZE);
129 208 chrv[i] = (int16_t *)(src_v + i*LARGEST_INPUT_SIZE);
130 208 alpha[i] = (int16_t *)(src_a + i*LARGEST_INPUT_SIZE);
131 }
132
133 13 ctx = sws_alloc_context();
134
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
13 if (sws_init_context(ctx, NULL, NULL) < 0)
135 fail();
136
137 13 ctx->flags |= SWS_FULL_CHR_H_INT;
138 13 ctx->yuv2rgb_y_offset = rnd();
139 13 ctx->yuv2rgb_y_coeff = rnd();
140 13 ctx->yuv2rgb_v2r_coeff = rnd();
141 13 ctx->yuv2rgb_v2g_coeff = rnd();
142 13 ctx->yuv2rgb_u2g_coeff = rnd();
143 13 ctx->yuv2rgb_u2b_coeff = rnd();
144
145
2/2
✓ Branch 0 taken 286 times.
✓ Branch 1 taken 13 times.
299 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
146
2/2
✓ Branch 0 taken 1144 times.
✓ Branch 1 taken 286 times.
1430 for (fsi = 0; fsi < FILTER_SIZES; fsi++) {
147
2/2
✓ Branch 0 taken 6864 times.
✓ Branch 1 taken 1144 times.
8008 for (isi = 0; isi < INPUT_SIZES; isi++ ) {
148 6864 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
149 6864 ctx->dstFormat = planar_fmts[fmi];
150
151 6864 dstW = input_sizes[isi];
152 6864 luma_filter_size = filter_sizes[fsi];
153 6864 chr_filter_size = filter_sizes[fsi];
154
155
2/2
✓ Branch 0 taken 1248 times.
✓ Branch 1 taken 5616 times.
6864 if (desc->comp[0].depth > 16) {
156 1248 byte_size = 4;
157
2/2
✓ Branch 0 taken 4992 times.
✓ Branch 1 taken 624 times.
5616 } else if (desc->comp[0].depth > 8) {
158 4992 byte_size = 2;
159 } else {
160 624 byte_size = 1;
161 }
162
163 6864 ff_sws_init_scale(ctx);
164
2/2
✓ Branch 3 taken 2112 times.
✓ Branch 4 taken 4752 times.
6864 if (check_func(ctx->yuv2anyX, "yuv2%s_full_X_%d_%d", desc->name, luma_filter_size, dstW)) {
165
2/2
✓ Branch 0 taken 8448 times.
✓ Branch 1 taken 2112 times.
10560 for (i = 0; i < 4; i ++) {
166 8448 memset(dst0[i], 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t));
167 8448 memset(dst1[i], 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t));
168 }
169
170 2112 call_ref(ctx, luma_filter, luma, luma_filter_size,
171 chr_filter, chru, chrv, chr_filter_size,
172 alpha, dst0, dstW, 0);
173 2112 call_new(ctx, luma_filter, luma, luma_filter_size,
174 chr_filter, chru, chrv, chr_filter_size,
175 alpha, dst1, dstW, 0);
176
177
1/2
✓ Branch 0 taken 2112 times.
✗ Branch 1 not taken.
2112 if (memcmp(dst0[0], dst1[0], dstW * byte_size) ||
178
1/2
✓ Branch 0 taken 2112 times.
✗ Branch 1 not taken.
2112 memcmp(dst0[1], dst1[1], dstW * byte_size) ||
179
1/2
✓ Branch 0 taken 2112 times.
✗ Branch 1 not taken.
2112 memcmp(dst0[2], dst1[2], dstW * byte_size) ||
180
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2112 times.
2112 memcmp(dst0[3], dst1[3], dstW * byte_size) )
181 fail();
182
183
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 2112 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
2112 bench_new(ctx, luma_filter, luma, luma_filter_size,
184 chr_filter, chru, chrv, chr_filter_size,
185 alpha, dst1, dstW, 0);
186 }
187 }
188 }
189 }
190 13 sws_freeContext(ctx);
191 13 }
192
193 #undef LARGEST_INPUT_SIZE
194 #undef INPUT_SIZES
195
196 13 static void check_input_planar_rgb_to_y(void)
197 {
198 struct SwsContext *ctx;
199 const AVPixFmtDescriptor *desc;
200 int fmi, isi;
201 int dstW, byte_size;
202 #define LARGEST_INPUT_SIZE 512
203 #define INPUT_SIZES 6
204 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
205 uint8_t *src[4];
206 13 int32_t rgb2yuv[9] = {0};
207
208 13 declare_func(void, uint8_t *dst, uint8_t *src[4], int w, int32_t *rgb2yuv);
209
210 13 LOCAL_ALIGNED_8(int32_t, src_r, [LARGEST_INPUT_SIZE]);
211 13 LOCAL_ALIGNED_8(int32_t, src_g, [LARGEST_INPUT_SIZE]);
212 13 LOCAL_ALIGNED_8(int32_t, src_b, [LARGEST_INPUT_SIZE]);
213 13 LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_INPUT_SIZE]);
214
215 13 LOCAL_ALIGNED_8(uint8_t, dst0_y, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
216 13 LOCAL_ALIGNED_8(uint8_t, dst1_y, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
217
218
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_r, LARGEST_INPUT_SIZE * sizeof(int32_t));
219
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_g, LARGEST_INPUT_SIZE * sizeof(int32_t));
220
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_b, LARGEST_INPUT_SIZE * sizeof(int32_t));
221
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_a, LARGEST_INPUT_SIZE * sizeof(int32_t));
222
2/2
✓ Branch 1 taken 117 times.
✓ Branch 2 taken 13 times.
130 randomize_buffers((uint8_t*)rgb2yuv, 9 * sizeof(int32_t));
223
224 13 src[0] = (uint8_t*)src_g;
225 13 src[1] = (uint8_t*)src_b;
226 13 src[2] = (uint8_t*)src_r;
227 13 src[3] = (uint8_t*)src_a;
228
229 13 ctx = sws_alloc_context();
230
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
13 if (sws_init_context(ctx, NULL, NULL) < 0)
231 fail();
232
233
2/2
✓ Branch 0 taken 286 times.
✓ Branch 1 taken 13 times.
299 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
234
2/2
✓ Branch 0 taken 1716 times.
✓ Branch 1 taken 286 times.
2002 for (isi = 0; isi < INPUT_SIZES; isi++ ) {
235 1716 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
236 1716 ctx->srcFormat = planar_fmts[fmi];
237 1716 ctx->dstFormat = AV_PIX_FMT_YUVA444P16;
238 1716 byte_size = 2;
239 1716 dstW = input_sizes[isi];
240
241 1716 ff_sws_init_scale(ctx);
242
2/2
✓ Branch 3 taken 420 times.
✓ Branch 4 taken 1296 times.
1716 if(check_func(ctx->readLumPlanar, "planar_%s_to_y_%d", desc->name, dstW)) {
243 420 memset(dst0_y, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t));
244 420 memset(dst1_y, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t));
245
246 420 call_ref(dst0_y, src, dstW, rgb2yuv);
247 420 call_new(dst1_y, src, dstW, rgb2yuv);
248
249
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 420 times.
420 if (memcmp(dst0_y, dst1_y, dstW * byte_size))
250 fail();
251
252
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 420 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
420 bench_new(dst1_y, src, dstW, rgb2yuv);
253
254 }
255 }
256 }
257 13 sws_freeContext(ctx);
258 13 }
259
260 #undef LARGEST_INPUT_SIZE
261 #undef INPUT_SIZES
262
263 13 static void check_input_planar_rgb_to_uv(void)
264 {
265 struct SwsContext *ctx;
266 const AVPixFmtDescriptor *desc;
267 int fmi, isi;
268 int dstW, byte_size;
269 #define LARGEST_INPUT_SIZE 512
270 #define INPUT_SIZES 6
271 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
272 uint8_t *src[4];
273 13 int32_t rgb2yuv[9] = {0};
274
275 13 declare_func(void, uint8_t *dstU, uint8_t *dstV,
276 uint8_t *src[4], int w, int32_t *rgb2yuv);
277
278 13 LOCAL_ALIGNED_8(int32_t, src_r, [LARGEST_INPUT_SIZE]);
279 13 LOCAL_ALIGNED_8(int32_t, src_g, [LARGEST_INPUT_SIZE]);
280 13 LOCAL_ALIGNED_8(int32_t, src_b, [LARGEST_INPUT_SIZE]);
281 13 LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_INPUT_SIZE]);
282
283 13 LOCAL_ALIGNED_8(uint8_t, dst0_u, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
284 13 LOCAL_ALIGNED_8(uint8_t, dst0_v, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
285
286 13 LOCAL_ALIGNED_8(uint8_t, dst1_u, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
287 13 LOCAL_ALIGNED_8(uint8_t, dst1_v, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
288
289
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_r, LARGEST_INPUT_SIZE * sizeof(int32_t));
290
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_g, LARGEST_INPUT_SIZE * sizeof(int32_t));
291
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_b, LARGEST_INPUT_SIZE * sizeof(int32_t));
292
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_a, LARGEST_INPUT_SIZE * sizeof(int32_t));
293
2/2
✓ Branch 1 taken 117 times.
✓ Branch 2 taken 13 times.
130 randomize_buffers((uint8_t*)rgb2yuv, 9 * sizeof(int32_t));
294
295 13 src[0] = (uint8_t*)src_g;
296 13 src[1] = (uint8_t*)src_b;
297 13 src[2] = (uint8_t*)src_r;
298 13 src[3] = (uint8_t*)src_a;
299
300 13 ctx = sws_alloc_context();
301
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
13 if (sws_init_context(ctx, NULL, NULL) < 0)
302 fail();
303
304
2/2
✓ Branch 0 taken 286 times.
✓ Branch 1 taken 13 times.
299 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
305
2/2
✓ Branch 0 taken 1716 times.
✓ Branch 1 taken 286 times.
2002 for (isi = 0; isi < INPUT_SIZES; isi++ ) {
306 1716 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
307 1716 ctx->srcFormat = planar_fmts[fmi];
308 1716 ctx->dstFormat = AV_PIX_FMT_YUVA444P16;
309 1716 byte_size = 2;
310 1716 dstW = input_sizes[isi];
311
312 1716 ff_sws_init_scale(ctx);
313
2/2
✓ Branch 3 taken 528 times.
✓ Branch 4 taken 1188 times.
1716 if(check_func(ctx->readChrPlanar, "planar_%s_to_uv_%d", desc->name, dstW)) {
314 528 memset(dst0_u, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t));
315 528 memset(dst0_v, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t));
316 528 memset(dst1_u, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t));
317 528 memset(dst1_v, 0xFF, LARGEST_INPUT_SIZE * sizeof(int32_t));
318
319 528 call_ref(dst0_u, dst0_v, src, dstW, rgb2yuv);
320 528 call_new(dst1_u, dst1_v, src, dstW, rgb2yuv);
321
322
1/2
✓ Branch 0 taken 528 times.
✗ Branch 1 not taken.
528 if (memcmp(dst0_u, dst1_u, dstW * byte_size) ||
323
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 528 times.
528 memcmp(dst0_v, dst1_v, dstW * byte_size))
324 fail();
325
326
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 528 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
528 bench_new(dst1_u, dst1_v, src, dstW, rgb2yuv);
327 }
328 }
329 }
330 13 sws_freeContext(ctx);
331 13 }
332
333 #undef LARGEST_INPUT_SIZE
334 #undef INPUT_SIZES
335
336 13 static void check_input_planar_rgb_to_a(void)
337 {
338 struct SwsContext *ctx;
339 const AVPixFmtDescriptor *desc;
340 int fmi, isi;
341 int dstW, byte_size;
342 #define LARGEST_INPUT_SIZE 512
343 #define INPUT_SIZES 6
344 static const int input_sizes[] = {8, 24, 128, 144, 256, 512};
345 uint8_t *src[4];
346 13 int32_t rgb2yuv[9] = {0};
347
348 13 declare_func(void, uint8_t *dst, uint8_t *src[4], int w, int32_t *rgb2yuv);
349
350 13 LOCAL_ALIGNED_8(int32_t, src_r, [LARGEST_INPUT_SIZE]);
351 13 LOCAL_ALIGNED_8(int32_t, src_g, [LARGEST_INPUT_SIZE]);
352 13 LOCAL_ALIGNED_8(int32_t, src_b, [LARGEST_INPUT_SIZE]);
353 13 LOCAL_ALIGNED_8(int32_t, src_a, [LARGEST_INPUT_SIZE]);
354
355 13 LOCAL_ALIGNED_8(uint8_t, dst0_a, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
356 13 LOCAL_ALIGNED_8(uint8_t, dst1_a, [LARGEST_INPUT_SIZE * sizeof(int32_t)]);
357
358
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_r, LARGEST_INPUT_SIZE * sizeof(int32_t));
359
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_g, LARGEST_INPUT_SIZE * sizeof(int32_t));
360
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_b, LARGEST_INPUT_SIZE * sizeof(int32_t));
361
2/2
✓ Branch 1 taken 6656 times.
✓ Branch 2 taken 13 times.
6669 randomize_buffers((uint8_t*)src_a, LARGEST_INPUT_SIZE * sizeof(int32_t));
362
2/2
✓ Branch 1 taken 117 times.
✓ Branch 2 taken 13 times.
130 randomize_buffers((uint8_t*)rgb2yuv, 9 * sizeof(int32_t));
363
364 13 src[0] = (uint8_t*)src_g;
365 13 src[1] = (uint8_t*)src_b;
366 13 src[2] = (uint8_t*)src_r;
367 13 src[3] = (uint8_t*)src_a;
368
369 13 ctx = sws_alloc_context();
370
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
13 if (sws_init_context(ctx, NULL, NULL) < 0)
371 fail();
372
373
2/2
✓ Branch 0 taken 286 times.
✓ Branch 1 taken 13 times.
299 for (fmi = 0; fmi < FF_ARRAY_ELEMS(planar_fmts); fmi++) {
374
2/2
✓ Branch 0 taken 1716 times.
✓ Branch 1 taken 286 times.
2002 for (isi = 0; isi < INPUT_SIZES; isi++ ) {
375 1716 desc = av_pix_fmt_desc_get(planar_fmts[fmi]);
376
2/2
✓ Branch 0 taken 1014 times.
✓ Branch 1 taken 702 times.
1716 if (!(desc->flags & AV_PIX_FMT_FLAG_ALPHA))
377 1014 continue;
378
379 702 ctx->srcFormat = planar_fmts[fmi];
380 702 ctx->dstFormat = AV_PIX_FMT_YUVA444P16;
381 702 byte_size = 2;
382 702 dstW = input_sizes[isi];
383
384 702 ff_sws_init_scale(ctx);
385
2/2
✓ Branch 3 taken 174 times.
✓ Branch 4 taken 528 times.
702 if(check_func(ctx->readAlpPlanar, "planar_%s_to_a_%d", desc->name, dstW)) {
386 174 memset(dst0_a, 0x00, LARGEST_INPUT_SIZE * sizeof(int32_t));
387 174 memset(dst1_a, 0x00, LARGEST_INPUT_SIZE * sizeof(int32_t));
388
389 174 call_ref(dst0_a, src, dstW, rgb2yuv);
390 174 call_new(dst1_a, src, dstW, rgb2yuv);
391
392
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 174 times.
174 if (memcmp(dst0_a, dst1_a, dstW * byte_size))
393 fail();
394
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 174 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
174 bench_new(dst1_a, src, dstW, rgb2yuv);
395 }
396 }
397 }
398 13 sws_freeContext(ctx);
399 13 }
400
401 13 void checkasm_check_sw_gbrp(void)
402 {
403 13 check_output_yuv2gbrp();
404 13 report("output_yuv2gbrp");
405
406 13 check_input_planar_rgb_to_y();
407 13 report("input_planar_rgb_y");
408
409 13 check_input_planar_rgb_to_uv();
410 13 report("input_planar_rgb_uv");
411
412 13 check_input_planar_rgb_to_a();
413 13 report("input_planar_rgb_a");
414 13 }
415