FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/tests/checkasm/h263dsp.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 20 21 95.2%
Functions: 2 2 100.0%
Branches: 10 18 55.6%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2024 RĂ©mi Denis-Courmont
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
23 #include "checkasm.h"
24
25 #include "libavcodec/h263dsp.h"
26 #include "libavutil/mem.h"
27 #include "libavutil/mem_internal.h"
28
29 typedef void (*filter)(uint8_t *src, int stride, int qscale);
30
31 26 static void check_loop_filter(char dim, filter func)
32 {
33 26 LOCAL_ALIGNED_16(uint8_t, buf0, [32 * 32]);
34 26 LOCAL_ALIGNED_16(uint8_t, buf1, [32 * 32]);
35 26 int qscale = rnd() % 32;
36
37
2/2
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 2 times.
26 declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, int, int);
38
39
2/2
✓ Branch 0 taken 832 times.
✓ Branch 1 taken 26 times.
858 for (size_t y = 0; y < 32; y++)
40
2/2
✓ Branch 0 taken 26624 times.
✓ Branch 1 taken 832 times.
27456 for (size_t x = 0; x < 32; x++)
41 26624 buf0[y * 32 + x] = buf1[y * 32 + x] = rnd();
42
43
2/2
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 22 times.
26 if (check_func(func, "h263dsp.%c_loop_filter", dim)) {
44 4 call_ref(buf0 + 8 * 33, 32, qscale);
45 4 call_new(buf1 + 8 * 33, 32, qscale);
46
47
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (memcmp(buf0, buf1, 32 * 32))
48 fail();
49
50
1/8
✗ Branch 1 not taken.
✓ Branch 2 taken 4 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.
4 bench_new(buf1 + 8 * 33, 32, 1);
51 }
52 26 }
53
54 13 void checkasm_check_h263dsp(void)
55 {
56 H263DSPContext ctx;
57
58 13 ff_h263dsp_init(&ctx);
59 13 check_loop_filter('h', ctx.h263_h_loop_filter);
60 13 check_loop_filter('v', ctx.h263_v_loop_filter);
61 13 report("loop_filter");
62 13 }
63