| 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 | 1832034 | 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 3664068 times.
✓ Branch 1 taken 916017 times.
|
9160170 | for (int d = 0; d < 4; d++) { |
| 30 | 7328136 | const int p3 = P3; | |
| 31 | 7328136 | const int p2 = P2; | |
| 32 | 7328136 | const int p1 = P1; | |
| 33 | 7328136 | const int p0 = P0; | |
| 34 | 7328136 | const int q0 = Q0; | |
| 35 | 7328136 | const int q1 = Q1; | |
| 36 | 7328136 | const int q2 = Q2; | |
| 37 | 7328136 | const int q3 = Q3; | |
| 38 |
2/2✓ Branch 0 taken 3646268 times.
✓ Branch 1 taken 17800 times.
|
7328136 | if (!no_p) { |
| 39 | 7292536 | P0 = p0 + av_clip(((p2 + 2 * p1 + 2 * p0 + 2 * q0 + q1 + 4) >> 3) - p0, -tc3, tc3); | |
| 40 | 7292536 | P1 = p1 + av_clip(((p2 + p1 + p0 + q0 + 2) >> 2) - p1, -tc2, tc2); | |
| 41 | 7292536 | P2 = p2 + av_clip(((2 * p3 + 3 * p2 + p1 + p0 + q0 + 4) >> 3) - p2, -tc, tc); | |
| 42 | } | ||
| 43 |
2/2✓ Branch 0 taken 3647728 times.
✓ Branch 1 taken 16340 times.
|
7328136 | if (!no_q) { |
| 44 | 7295456 | Q0 = q0 + av_clip(((p1 + 2 * p0 + 2 * q0 + 2 * q1 + q2 + 4) >> 3) - q0, -tc3, tc3); | |
| 45 | 7295456 | Q1 = q1 + av_clip(((p0 + q0 + q1 + q2 + 2) >> 2) - q1, -tc2, tc2); | |
| 46 | 7295456 | Q2 = q2 + av_clip(((2 * q3 + 3 * q2 + q1 + q0 + p0 + 4) >> 3) - q2, -tc, tc); | |
| 47 | } | ||
| 48 | 7328136 | pix += ystride; | |
| 49 | } | ||
| 50 | 1832034 | } | |
| 51 | |||
| 52 | 8230794 | 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 | 8230794 | const int tc_2 = tc >> 1; | |
| 56 |
2/2✓ Branch 0 taken 16461588 times.
✓ Branch 1 taken 4115397 times.
|
41153970 | for (int d = 0; d < 4; d++) { |
| 57 | 32923176 | const int p2 = P2; | |
| 58 | 32923176 | const int p1 = P1; | |
| 59 | 32923176 | const int p0 = P0; | |
| 60 | 32923176 | const int q0 = Q0; | |
| 61 | 32923176 | const int q1 = Q1; | |
| 62 | 32923176 | const int q2 = Q2; | |
| 63 | 32923176 | int delta0 = (9 * (q0 - p0) - 3 * (q1 - p1) + 8) >> 4; | |
| 64 |
2/2✓ Branch 0 taken 16445907 times.
✓ Branch 1 taken 15681 times.
|
32923176 | if (abs(delta0) < 10 * tc) { |
| 65 | 32891814 | delta0 = av_clip(delta0, -tc, tc); | |
| 66 |
2/2✓ Branch 0 taken 16420223 times.
✓ Branch 1 taken 25684 times.
|
32891814 | if (!no_p) |
| 67 | 32840446 | P0 = av_clip_pixel(p0 + delta0); | |
| 68 |
2/2✓ Branch 0 taken 16422922 times.
✓ Branch 1 taken 22985 times.
|
32891814 | if (!no_q) |
| 69 | 32845844 | Q0 = av_clip_pixel(q0 - delta0); | |
| 70 |
4/4✓ Branch 0 taken 16420223 times.
✓ Branch 1 taken 25684 times.
✓ Branch 2 taken 8906661 times.
✓ Branch 3 taken 7513562 times.
|
32891814 | if (!no_p && nd_p > 1) { |
| 71 | 17813322 | const int deltap1 = av_clip((((p2 + p0 + 1) >> 1) - p1 + delta0) >> 1, -tc_2, tc_2); | |
| 72 | 17813322 | P1 = av_clip_pixel(p1 + deltap1); | |
| 73 | } | ||
| 74 |
4/4✓ Branch 0 taken 16422922 times.
✓ Branch 1 taken 22985 times.
✓ Branch 2 taken 8542029 times.
✓ Branch 3 taken 7880893 times.
|
32891814 | if (!no_q && nd_q > 1) { |
| 75 | 17084058 | const int deltaq1 = av_clip((((q2 + q0 + 1) >> 1) - q1 - delta0) >> 1, -tc_2, tc_2); | |
| 76 | 17084058 | Q1 = av_clip_pixel(q1 + deltaq1); | |
| 77 | } | ||
| 78 | } | ||
| 79 | 32923176 | pix += ystride; | |
| 80 | } | ||
| 81 | 8230794 | } | |
| 82 | |||
| 83 | 4993630 | 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 6024930 times.
✓ Branch 1 taken 2496815 times.
|
17043490 | for (int d = 0; d < size; d++) { |
| 87 | int delta0; | ||
| 88 | 12049860 | const int p1 = P1; | |
| 89 | 12049860 | const int p0 = P0; | |
| 90 | 12049860 | const int q0 = Q0; | |
| 91 | 12049860 | const int q1 = Q1; | |
| 92 | 12049860 | delta0 = av_clip((((q0 - p0) * 4) + p1 - q1 + 4) >> 3, -tc, tc); | |
| 93 |
2/2✓ Branch 0 taken 5983002 times.
✓ Branch 1 taken 41928 times.
|
12049860 | if (!no_p) |
| 94 | 11966004 | P0 = av_clip_pixel(p0 + delta0); | |
| 95 |
2/2✓ Branch 0 taken 5975706 times.
✓ Branch 1 taken 49224 times.
|
12049860 | if (!no_q) |
| 96 | 11951412 | Q0 = av_clip_pixel(q0 - delta0); | |
| 97 | 12049860 | pix += ystride; | |
| 98 | } | ||
| 99 | 4993630 | } | |
| 100 |