FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavfilter/x86/vf_eq_init.c
Date: 2022-12-05 03:11:11
Exec Total Coverage
Lines: 14 14 100.0%
Functions: 2 2 100.0%
Branches: 4 4 100.0%

Line Branch Exec Source
1 /*
2 *
3 * Original MPlayer filters by Richard Felker.
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22 #include "libavutil/attributes.h"
23 #include "libavutil/cpu.h"
24 #include "libavutil/x86/cpu.h"
25 #include "libavutil/x86/asm.h"
26 #include "libavfilter/vf_eq.h"
27
28 extern void ff_process_one_line_sse2(const uint8_t *src, uint8_t *dst, short contrast,
29 short brightness, int w);
30
31 #if HAVE_X86ASM
32 1 static void process_sse2(EQParameters *param, uint8_t *dst, int dst_stride,
33 const uint8_t *src, int src_stride, int w, int h)
34 {
35 1 short contrast = (short) (param->contrast * 256 * 16);
36 1 short brightness = ((short) (100.0 * param->brightness + 100.0) * 511)
37 1 / 200 - 128 - contrast / 32;
38
39
2/2
✓ Branch 0 taken 256 times.
✓ Branch 1 taken 1 times.
257 while (h--) {
40 256 ff_process_one_line_sse2(src, dst, contrast, brightness, w);
41 256 src += src_stride;
42 256 dst += dst_stride;
43 }
44 1 }
45 #endif
46
47 13 av_cold void ff_eq_init_x86(EQContext *eq)
48 {
49 #if HAVE_X86ASM
50 13 int cpu_flags = av_get_cpu_flags();
51
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 4 times.
13 if (EXTERNAL_SSE2(cpu_flags)) {
52 9 eq->process = process_sse2;
53 }
54 #endif
55 13 }
56