FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/x86/huffyuvencdsp_init.c
Date: 2026-04-29 00:23:12
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 1 1 100.0%
Branches: 9 12 75.0%

Line Branch Exec Source
1 /*
2 * SIMD-optimized HuffYUV 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/huffyuvencdsp.h"
29
30 void ff_diff_int16_sse2(uint16_t *dst, const uint16_t *src1, const uint16_t *src2,
31 unsigned mask, int w);
32 void ff_diff_int16_avx2(uint16_t *dst, const uint16_t *src1, const uint16_t *src2,
33 unsigned mask, int w);
34 void ff_sub_hfyu_median_pred_int16_sse2(uint16_t *dst, const uint16_t *src1, const uint16_t *src2,
35 unsigned mask, int w, int *left, int *left_top);
36 void ff_sub_hfyu_median_pred_int16_avx2(uint16_t *dst, const uint16_t *src1, const uint16_t *src2,
37 unsigned mask, int w, int *left, int *left_top);
38
39 88 av_cold void ff_huffyuvencdsp_init_x86(HuffYUVEncDSPContext *c, int bpp, int width)
40 {
41 88 int cpu_flags = av_get_cpu_flags();
42
43
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 48 times.
88 if (EXTERNAL_SSE2(cpu_flags)) {
44 40 c->diff_int16 = ff_diff_int16_sse2;
45
3/4
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
40 if (bpp < 16 && width >= 8)
46 20 c->sub_hfyu_median_pred_int16 = ff_sub_hfyu_median_pred_int16_sse2;
47 }
48
49
3/4
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 84 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
88 if (EXTERNAL_AVX2_FAST(cpu_flags)) {
50 4 c->diff_int16 = ff_diff_int16_avx2;
51
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (width >= 16)
52 4 c->sub_hfyu_median_pred_int16 = ff_sub_hfyu_median_pred_int16_avx2;
53 }
54 88 }
55