FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavfilter/x86/vf_spp.c
Date: 2025-06-23 20:06:14
Exec Total Coverage
Lines: 4 14 28.6%
Functions: 1 2 50.0%
Branches: 1 4 25.0%

Line Branch Exec Source
1 /*
2 * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21
22 #include "libavutil/attributes.h"
23 #include "libavutil/cpu.h"
24 #include "libavfilter/vf_spp.h"
25
26 #if HAVE_MMX_INLINE
27 static void store_slice_mmx(uint8_t *dst, const int16_t *src,
28 int dst_stride, int src_stride,
29 int width, int height, int log2_scale,
30 const uint8_t dither[8][8])
31 {
32 int y;
33
34 for (y = 0; y < height; y++) {
35 uint8_t *dst1 = dst;
36 const int16_t *src1 = src;
37 __asm__ volatile(
38 "movq (%3), %%mm3 \n"
39 "movq (%3), %%mm4 \n"
40 "movd %4, %%mm2 \n"
41 "pxor %%mm0, %%mm0 \n"
42 "punpcklbw %%mm0, %%mm3 \n"
43 "punpckhbw %%mm0, %%mm4 \n"
44 "psraw %%mm2, %%mm3 \n"
45 "psraw %%mm2, %%mm4 \n"
46 "movd %5, %%mm2 \n"
47 "1: \n"
48 "movq (%0), %%mm0 \n"
49 "movq 8(%0), %%mm1 \n"
50 "paddw %%mm3, %%mm0 \n"
51 "paddw %%mm4, %%mm1 \n"
52 "psraw %%mm2, %%mm0 \n"
53 "psraw %%mm2, %%mm1 \n"
54 "packuswb %%mm1, %%mm0 \n"
55 "movq %%mm0, (%1) \n"
56 "add $16, %0 \n"
57 "add $8, %1 \n"
58 "cmp %2, %1 \n"
59 " jb 1b \n"
60 : "+r" (src1), "+r"(dst1)
61 : "r"(dst + width), "r"(dither[y]), "g"(log2_scale), "g"(MAX_LEVEL - log2_scale)
62 );
63 src += src_stride;
64 dst += dst_stride;
65 }
66 }
67
68 #endif /* HAVE_MMX_INLINE */
69
70 1 av_cold void ff_spp_init_x86(SPPContext *s)
71 {
72 #if HAVE_MMX_INLINE
73 1 int cpu_flags = av_get_cpu_flags();
74
75
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (cpu_flags & AV_CPU_FLAG_MMX) {
76 s->store_slice = store_slice_mmx;
77 }
78 #endif
79 1 }
80