FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavfilter/x86/vf_convolution_init.c
Date: 2024-04-25 15:36:26
Exec Total Coverage
Lines: 6 15 40.0%
Functions: 1 2 50.0%
Branches: 4 16 25.0%

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
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with FFmpeg; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #include "config.h"
21
22 #include "libavutil/attributes.h"
23 #include "libavutil/cpu.h"
24 #include "libavutil/x86/cpu.h"
25 #include "libavfilter/convolution.h"
26
27 void ff_filter_3x3_sse4(uint8_t *dst, int width,
28 float rdiv, float bias, const int *const matrix,
29 const uint8_t *c[], int peak, int radius,
30 int dstride, int stride, int size);
31
32 void ff_filter_sobel_avx512icl(uint8_t *dst, int width,
33 float scale, float delta, const int *const matrix,
34 const uint8_t *c[], int peak, int radius,
35 int dstride, int stride, int size);
36
37 av_cold void ff_convolution_init_x86(ConvolutionContext *s)
38 {
39 #if ARCH_X86_64
40 int i;
41 int cpu_flags = av_get_cpu_flags();
42 for (i = 0; i < 4; i++) {
43 if (s->mode[i] == MATRIX_SQUARE) {
44 if (s->matrix_length[i] == 9 && s->depth == 8) {
45 if (EXTERNAL_SSE4(cpu_flags))
46 s->filter[i] = ff_filter_3x3_sse4;
47 }
48 }
49 }
50 #endif
51 }
52
53 13 av_cold void ff_sobel_init_x86(ConvolutionContext *s, int depth, int nb_planes)
54 {
55 #if ARCH_X86_64
56 13 int cpu_flags = av_get_cpu_flags();
57
2/2
✓ Branch 0 taken 39 times.
✓ Branch 1 taken 13 times.
52 for (int i = 0; i < nb_planes; i++) {
58
1/2
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
39 if (depth == 8) {
59
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
39 if (EXTERNAL_AVX512ICL(cpu_flags))
60 s->filter[i] = ff_filter_sobel_avx512icl;
61 }
62 }
63 #endif
64 13 }
65