FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavfilter/x86/vf_idetdsp_init.c
Date: 2026-04-24 05:04:01
Exec Total Coverage
Lines: 10 15 66.7%
Functions: 3 7 42.9%
Branches: 11 36 30.6%

Line Branch Exec Source
1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include "libavutil/attributes.h"
20 #include "libavutil/cpu.h"
21 #include "libavutil/x86/cpu.h"
22 #include "libavfilter/vf_idetdsp.h"
23
24 /* declares main callable idet_filter_line_sse2() */
25 #define FUNC_MAIN_DECL(KIND, SPAN) \
26 int ff_idet_filter_line_##KIND(const uint8_t *a, const uint8_t *b, \
27 const uint8_t *c, int w); \
28 static int idet_filter_line_##KIND(const uint8_t *a, const uint8_t *b, \
29 const uint8_t *c, int w) { \
30 int sum = 0; \
31 const int left_over = w & (SPAN - 1); \
32 w -= left_over; \
33 if (w > 0) \
34 sum += ff_idet_filter_line_##KIND(a, b, c, w); \
35 if (left_over > 0) \
36 sum += ff_idet_filter_line_c(a + w, b + w, c + w, left_over); \
37 return sum; \
38 }
39
40
41 #define FUNC_MAIN_DECL_16bit(KIND, SPAN) \
42 int ff_idet_filter_line_16bit_##KIND(const uint8_t *a, const uint8_t *b, \
43 const uint8_t *c, int w); \
44 static int idet_filter_line_16bit_##KIND(const uint8_t *a, const uint8_t *b, \
45 const uint8_t *c, int w) { \
46 int sum = 0; \
47 const int left_over = w & (SPAN - 1); \
48 const int w_main = w - left_over; \
49 const int offset = w_main << 1; \
50 if (w_main > 0) \
51 sum += ff_idet_filter_line_16bit_##KIND(a, b, c, w_main); \
52 if (left_over > 0) { \
53 sum += ff_idet_filter_line_c_16bit(a + offset, b + offset, c + offset, \
54 left_over); \
55 } \
56 return sum; \
57 }
58
59
2/4
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
4 FUNC_MAIN_DECL(sse2, 16)
60 FUNC_MAIN_DECL_16bit(sse2, 8)
61
62
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
2 FUNC_MAIN_DECL(avx2, 32)
63 FUNC_MAIN_DECL_16bit(avx2, 16)
64
65 FUNC_MAIN_DECL(avx512icl, 64)
66 FUNC_MAIN_DECL_16bit(avx512icl, 32)
67
68 31 av_cold void ff_idet_dsp_init_x86(IDETDSPContext *dsp, int depth)
69 {
70 31 const int cpu_flags = av_get_cpu_flags();
71
72
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 11 times.
31 if (EXTERNAL_SSE2(cpu_flags)) {
73
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
20 dsp->filter_line = depth > 8 ? idet_filter_line_16bit_sse2 : idet_filter_line_sse2;
74 }
75
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 29 times.
31 if (EXTERNAL_AVX2(cpu_flags)) {
76
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 dsp->filter_line = depth > 8 ? idet_filter_line_16bit_avx2 : idet_filter_line_avx2;
77 }
78
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
31 if (EXTERNAL_AVX512ICL(cpu_flags)) {
79 dsp->filter_line = depth > 8 ? idet_filter_line_16bit_avx512icl : idet_filter_line_avx512icl;
80 }
81 31 }
82