FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/tests/checkasm/videodsp.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 1 1 100.0%
Branches: 58 154 37.7%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #include <string.h>
22 #include "checkasm.h"
23 #include "libavcodec/videodsp.h"
24 #include "libavutil/internal.h"
25 #include "libavutil/intreadwrite.h"
26 #include "libavutil/mem_internal.h"
27
28 #define randomize_buffers(w, h) \
29 do { \
30 int i; \
31 for (i = 0; i < w * h * sizeof(*src0); i += 4) \
32 AV_WN32A(((uint8_t *) src0) + i, rnd()); \
33 } while (0)
34
35 #define iter_1d(type, fix, fix_val, var, var_start, var_end) \
36 for (fix = fix_val, var = var_start; var <= var_end; var++) { \
37 call_ref((type *) dst0, (const type *) (src0 + y * pw + x), \
38 bw * sizeof(type), pw * sizeof(type), \
39 bw, bh, x, y, pw, ph); \
40 call_new((type *) dst1, (const type *) (src1 + y * pw + x), \
41 bw * sizeof(type), pw * sizeof(type), \
42 bw, bh, x, y, pw, ph); \
43 if (memcmp(dst0, dst1, bw * bh * sizeof(type))) \
44 fail(); \
45 bench_new((type *) dst1, (const type *) (src1 + y * pw + x),\
46 bw * sizeof(type), pw * sizeof(type), \
47 bw, bh, x, y, pw, ph); \
48 }
49
50 #define check_emu_edge_size(type, src_w, src_h, dst_w, dst_h) \
51 do { \
52 LOCAL_ALIGNED_16(type, src0, [src_w * src_h]); \
53 LOCAL_ALIGNED_16(type, src1, [src_w * src_h]); \
54 int bw = dst_w, bh = dst_h; \
55 int pw = src_w, ph = src_h; \
56 int y, x; \
57 randomize_buffers(src_w, src_h); \
58 memcpy(src1, src0, pw * ph * sizeof(type)); \
59 iter_1d(type, y, 0 - src_h, x, 0 - src_w, src_w - 0); \
60 iter_1d(type, x, src_w - 0, y, 0 - src_h, src_h - 0); \
61 iter_1d(type, y, src_h - 0, x, 0 - src_w, src_w - 0); \
62 iter_1d(type, x, 0 - src_w, y, 0 - src_h, src_h - 0); \
63 } while (0)
64
65 #define check_emu_edge(type) \
66 do { \
67 LOCAL_ALIGNED_16(type, dst0, [64 * 64]); \
68 LOCAL_ALIGNED_16(type, dst1, [64 * 64]); \
69 declare_func_emms(AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT, \
70 void, type *dst, const type *src, \
71 ptrdiff_t dst_linesize, \
72 ptrdiff_t src_linesize, \
73 int block_w, int block_h, \
74 int src_x, int src_y, \
75 int src_w, int src_h); \
76 check_emu_edge_size(type, 16, 1, 64, 64); \
77 check_emu_edge_size(type, 16, 16, 64, 64); \
78 check_emu_edge_size(type, 64, 64, 64, 64); \
79 } while (0)
80
81 13 void checkasm_check_videodsp(void)
82 {
83 VideoDSPContext vdsp;
84
85 13 ff_videodsp_init(&vdsp, 8);
86
2/2
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 10 times.
13 if (check_func(vdsp.emulated_edge_mc, "emulated_edge_mc_8"))
87
56/152
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 1 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 3 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 99 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 99 times.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✓ Branch 36 taken 99 times.
✓ Branch 37 taken 3 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 9 times.
✗ Branch 50 not taken.
✓ Branch 51 taken 9 times.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✓ Branch 68 taken 9 times.
✓ Branch 69 taken 3 times.
✗ Branch 77 not taken.
✓ Branch 78 taken 99 times.
✗ Branch 82 not taken.
✓ Branch 83 taken 99 times.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✓ Branch 100 taken 99 times.
✓ Branch 101 taken 3 times.
✗ Branch 109 not taken.
✓ Branch 110 taken 9 times.
✗ Branch 114 not taken.
✓ Branch 115 taken 9 times.
✗ Branch 124 not taken.
✗ Branch 125 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 128 not taken.
✗ Branch 129 not taken.
✓ Branch 132 taken 9 times.
✓ Branch 133 taken 3 times.
✓ Branch 135 taken 192 times.
✓ Branch 136 taken 3 times.
✗ Branch 144 not taken.
✓ Branch 145 taken 99 times.
✗ Branch 149 not taken.
✓ Branch 150 taken 99 times.
✗ Branch 159 not taken.
✗ Branch 160 not taken.
✗ Branch 161 not taken.
✗ Branch 162 not taken.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✓ Branch 167 taken 99 times.
✓ Branch 168 taken 3 times.
✗ Branch 176 not taken.
✓ Branch 177 taken 99 times.
✗ Branch 181 not taken.
✓ Branch 182 taken 99 times.
✗ Branch 191 not taken.
✗ Branch 192 not taken.
✗ Branch 193 not taken.
✗ Branch 194 not taken.
✗ Branch 195 not taken.
✗ Branch 196 not taken.
✓ Branch 199 taken 99 times.
✓ Branch 200 taken 3 times.
✗ Branch 208 not taken.
✓ Branch 209 taken 99 times.
✗ Branch 213 not taken.
✓ Branch 214 taken 99 times.
✗ Branch 223 not taken.
✗ Branch 224 not taken.
✗ Branch 225 not taken.
✗ Branch 226 not taken.
✗ Branch 227 not taken.
✗ Branch 228 not taken.
✓ Branch 231 taken 99 times.
✓ Branch 232 taken 3 times.
✗ Branch 240 not taken.
✓ Branch 241 taken 99 times.
✗ Branch 245 not taken.
✓ Branch 246 taken 99 times.
✗ Branch 255 not taken.
✗ Branch 256 not taken.
✗ Branch 257 not taken.
✗ Branch 258 not taken.
✗ Branch 259 not taken.
✗ Branch 260 not taken.
✓ Branch 263 taken 99 times.
✓ Branch 264 taken 3 times.
✓ Branch 266 taken 3072 times.
✓ Branch 267 taken 3 times.
✗ Branch 275 not taken.
✓ Branch 276 taken 387 times.
✗ Branch 280 not taken.
✓ Branch 281 taken 387 times.
✗ Branch 290 not taken.
✗ Branch 291 not taken.
✗ Branch 292 not taken.
✗ Branch 293 not taken.
✗ Branch 294 not taken.
✗ Branch 295 not taken.
✓ Branch 298 taken 387 times.
✓ Branch 299 taken 3 times.
✗ Branch 307 not taken.
✓ Branch 308 taken 387 times.
✗ Branch 312 not taken.
✓ Branch 313 taken 387 times.
✗ Branch 322 not taken.
✗ Branch 323 not taken.
✗ Branch 324 not taken.
✗ Branch 325 not taken.
✗ Branch 326 not taken.
✗ Branch 327 not taken.
✓ Branch 330 taken 387 times.
✓ Branch 331 taken 3 times.
✗ Branch 339 not taken.
✓ Branch 340 taken 387 times.
✗ Branch 344 not taken.
✓ Branch 345 taken 387 times.
✗ Branch 354 not taken.
✗ Branch 355 not taken.
✗ Branch 356 not taken.
✗ Branch 357 not taken.
✗ Branch 358 not taken.
✗ Branch 359 not taken.
✓ Branch 362 taken 387 times.
✓ Branch 363 taken 3 times.
✗ Branch 371 not taken.
✓ Branch 372 taken 387 times.
✗ Branch 376 not taken.
✓ Branch 377 taken 387 times.
✗ Branch 386 not taken.
✗ Branch 387 not taken.
✗ Branch 388 not taken.
✗ Branch 389 not taken.
✗ Branch 390 not taken.
✗ Branch 391 not taken.
✓ Branch 394 taken 387 times.
✓ Branch 395 taken 3 times.
5439 check_emu_edge(uint8_t);
88
89 13 report("emulated_edge_mc");
90 13 }
91