FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/h26x/h2656_deblock_template.c
Date: 2024-07-26 21:54:09
Exec Total Coverage
Lines: 57 57 100.0%
Functions: 6 9 66.7%
Branches: 20 28 71.4%

Line Branch Exec Source
1
2 /*
3 * HEVC/VVC deblocking dsp template
4 *
5 * Copyright (C) 2024 Nuo Mi
6 * Copyright (C) 2012 - 2013 Guillaume Martres
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 1479278 static void FUNC(loop_filter_luma_strong)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride,
26 const int32_t tc, const int32_t tc2, const int tc3,
27 const uint8_t no_p, const uint8_t no_q)
28 {
29
2/2
✓ Branch 0 taken 2958556 times.
✓ Branch 1 taken 739639 times.
7396390 for (int d = 0; d < 4; d++) {
30 5917112 const int p3 = P3;
31 5917112 const int p2 = P2;
32 5917112 const int p1 = P1;
33 5917112 const int p0 = P0;
34 5917112 const int q0 = Q0;
35 5917112 const int q1 = Q1;
36 5917112 const int q2 = Q2;
37 5917112 const int q3 = Q3;
38
1/2
✓ Branch 0 taken 2958556 times.
✗ Branch 1 not taken.
5917112 if (!no_p) {
39 5917112 P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc3, tc3);
40 5917112 P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2);
41 5917112 P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc, tc);
42 }
43
1/2
✓ Branch 0 taken 2958556 times.
✗ Branch 1 not taken.
5917112 if (!no_q) {
44 5917112 Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc3, tc3);
45 5917112 Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2);
46 5917112 Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc, tc);
47 }
48 5917112 pix += ystride;
49 }
50 1479278 }
51
52 6629722 static void FUNC(loop_filter_luma_weak)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride,
53 const int32_t tc, const int32_t beta, const uint8_t no_p, const uint8_t no_q, const int nd_p, const int nd_q)
54 {
55 6629722 const int tc_2 = tc >> 1;
56
2/2
✓ Branch 0 taken 13259444 times.
✓ Branch 1 taken 3314861 times.
33148610 for (int d = 0; d < 4; d++) {
57 26518888 const int p2 = P2;
58 26518888 const int p1 = P1;
59 26518888 const int p0 = P0;
60 26518888 const int q0 = Q0;
61 26518888 const int q1 = Q1;
62 26518888 const int q2 = Q2;
63 26518888 int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4;
64
2/2
✓ Branch 0 taken 13252748 times.
✓ Branch 1 taken 6696 times.
26518888 if (abs(delta0) < 10 * tc) {
65 26505496 delta0 = av_clip(delta0, -tc, tc);
66
1/2
✓ Branch 0 taken 13252748 times.
✗ Branch 1 not taken.
26505496 if (!no_p)
67 26505496 P0 = av_clip_pixel(p0 + delta0);
68
1/2
✓ Branch 0 taken 13252748 times.
✗ Branch 1 not taken.
26505496 if (!no_q)
69 26505496 Q0 = av_clip_pixel(q0 - delta0);
70
3/4
✓ Branch 0 taken 13252748 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7899304 times.
✓ Branch 3 taken 5353444 times.
26505496 if (!no_p && nd_p > 1) {
71 15798608 const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2);
72 15798608 P1 = av_clip_pixel(p1 + deltap1);
73 }
74
3/4
✓ Branch 0 taken 13252748 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7605737 times.
✓ Branch 3 taken 5647011 times.
26505496 if (!no_q && nd_q > 1) {
75 15211474 const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2);
76 15211474 Q1 = av_clip_pixel(q1 + deltaq1);
77 }
78 }
79 26518888 pix += ystride;
80 }
81 6629722 }
82
83 3139830 static void FUNC(loop_filter_chroma_weak)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride,
84 const int size, const int32_t tc, const uint8_t no_p, const uint8_t no_q)
85 {
86
2/2
✓ Branch 0 taken 3749320 times.
✓ Branch 1 taken 1569915 times.
10638470 for (int d = 0; d < size; d++) {
87 int delta0;
88 7498640 const int p1 = P1;
89 7498640 const int p0 = P0;
90 7498640 const int q0 = Q0;
91 7498640 const int q1 = Q1;
92 7498640 delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc);
93
1/2
✓ Branch 0 taken 3749320 times.
✗ Branch 1 not taken.
7498640 if (!no_p)
94 7498640 P0 = av_clip_pixel(p0 + delta0);
95
1/2
✓ Branch 0 taken 3749320 times.
✗ Branch 1 not taken.
7498640 if (!no_q)
96 7498640 Q0 = av_clip_pixel(q0 - delta0);
97 7498640 pix += ystride;
98 }
99 3139830 }
100