FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/x86/lossless_videoencdsp_init.c
Date: 2026-01-23 19:11:46
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 1 1 100.0%
Branches: 7 8 87.5%

Line Branch Exec Source
1 /*
2 * SIMD-optimized lossless video encoding functions
3 * Copyright (c) 2000, 2001 Fabrice Bellard
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5 *
6 * MMX optimization by Nick Kurshev <nickols_k@mail.ru>
7 *
8 * This file is part of FFmpeg.
9 *
10 * FFmpeg is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * FFmpeg is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with FFmpeg; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25 #include "libavutil/attributes.h"
26 #include "libavutil/cpu.h"
27 #include "libavutil/x86/cpu.h"
28 #include "libavcodec/lossless_videoencdsp.h"
29
30 void ff_diff_bytes_sse2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
31 intptr_t w);
32 void ff_diff_bytes_avx2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
33 intptr_t w);
34
35 void ff_sub_median_pred_sse2(uint8_t *dst, const uint8_t *src1,
36 const uint8_t *src2, intptr_t w,
37 int *left, int *left_top);
38
39 void ff_sub_left_predict_avx(uint8_t *dst, const uint8_t *src,
40 ptrdiff_t stride, ptrdiff_t width, int height);
41
42 211 av_cold void ff_llvidencdsp_init_x86(LLVidEncDSPContext *c)
43 {
44 211 int cpu_flags = av_get_cpu_flags();
45
46
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 201 times.
211 if (EXTERNAL_SSE2(cpu_flags)) {
47 10 c->sub_median_pred = ff_sub_median_pred_sse2;
48 10 c->diff_bytes = ff_diff_bytes_sse2;
49 }
50
51
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 208 times.
211 if (EXTERNAL_AVX(cpu_flags)) {
52 3 c->sub_left_predict = ff_sub_left_predict_avx;
53 }
54
55
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 210 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
211 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
56 1 c->diff_bytes = ff_diff_bytes_avx2;
57 }
58 211 }
59