FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/h26x/h2656_deblock_template.c
Date: 2024-02-29 09:57:37
Exec Total Coverage
Lines: 57 57 100.0%
Functions: 9 12 75.0%
Branches: 28 28 100.0%

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 21272180 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 42544360 times.
✓ Branch 1 taken 10636090 times.
106360900 for (int d = 0; d < 4; d++) {
30 85088720 const int p3 = P3;
31 85088720 const int p2 = P2;
32 85088720 const int p1 = P1;
33 85088720 const int p0 = P0;
34 85088720 const int q0 = Q0;
35 85088720 const int q1 = Q1;
36 85088720 const int q2 = Q2;
37 85088720 const int q3 = Q3;
38
2/2
✓ Branch 0 taken 42538792 times.
✓ Branch 1 taken 5568 times.
85088720 if (!no_p) {
39 85077584 P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc3, tc3);
40 85077584 P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2);
41 85077584 P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc, tc);
42 }
43
2/2
✓ Branch 0 taken 42538672 times.
✓ Branch 1 taken 5688 times.
85088720 if (!no_q) {
44 85077344 Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc3, tc3);
45 85077344 Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2);
46 85077344 Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc, tc);
47 }
48 85088720 pix += ystride;
49 }
50 21272180 }
51
52 90149310 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 90149310 const int tc_2 = tc >> 1;
56
2/2
✓ Branch 0 taken 180298620 times.
✓ Branch 1 taken 45074655 times.
450746550 for (int d = 0; d < 4; d++) {
57 360597240 const int p2 = P2;
58 360597240 const int p1 = P1;
59 360597240 const int p0 = P0;
60 360597240 const int q0 = Q0;
61 360597240 const int q1 = Q1;
62 360597240 const int q2 = Q2;
63 360597240 int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4;
64
2/2
✓ Branch 0 taken 178452724 times.
✓ Branch 1 taken 1845896 times.
360597240 if (abs(delta0) < 10 * tc) {
65 356905448 delta0 = av_clip(delta0, -tc, tc);
66
2/2
✓ Branch 0 taken 178137343 times.
✓ Branch 1 taken 315381 times.
356905448 if (!no_p)
67 356274686 P0 = av_clip_pixel(p0 + delta0);
68
2/2
✓ Branch 0 taken 178135436 times.
✓ Branch 1 taken 317288 times.
356905448 if (!no_q)
69 356270872 Q0 = av_clip_pixel(q0 - delta0);
70
4/4
✓ Branch 0 taken 178137343 times.
✓ Branch 1 taken 315381 times.
✓ Branch 2 taken 123830636 times.
✓ Branch 3 taken 54306707 times.
356905448 if (!no_p && nd_p > 1) {
71 247661272 const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2);
72 247661272 P1 = av_clip_pixel(p1 + deltap1);
73 }
74
4/4
✓ Branch 0 taken 178135436 times.
✓ Branch 1 taken 317288 times.
✓ Branch 2 taken 120410022 times.
✓ Branch 3 taken 57725414 times.
356905448 if (!no_q && nd_q > 1) {
75 240820044 const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2);
76 240820044 Q1 = av_clip_pixel(q1 + deltaq1);
77 }
78 }
79 360597240 pix += ystride;
80 }
81 90149310 }
82
83 42648744 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 82331136 times.
✓ Branch 1 taken 21324372 times.
207311016 for (int d = 0; d < size; d++) {
87 int delta0;
88 164662272 const int p1 = P1;
89 164662272 const int p0 = P0;
90 164662272 const int q0 = Q0;
91 164662272 const int q1 = Q1;
92 164662272 delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc);
93
2/2
✓ Branch 0 taken 82068480 times.
✓ Branch 1 taken 262656 times.
164662272 if (!no_p)
94 164136960 P0 = av_clip_pixel(p0 + delta0);
95
2/2
✓ Branch 0 taken 82064656 times.
✓ Branch 1 taken 266480 times.
164662272 if (!no_q)
96 164129312 Q0 = av_clip_pixel(q0 - delta0);
97 164662272 pix += ystride;
98 }
99 42648744 }
100