Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * VVC filters DSP | ||
3 | * | ||
4 | * Copyright (C) 2022 Nuo Mi | ||
5 | * | ||
6 | * This file is part of FFmpeg. | ||
7 | * | ||
8 | * FFmpeg is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU Lesser General Public | ||
10 | * License as published by the Free Software Foundation; either | ||
11 | * version 2.1 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * FFmpeg is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * Lesser General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU Lesser General Public | ||
19 | * License along with FFmpeg; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #include "libavcodec/h26x/h2656_sao_template.c" | ||
24 | |||
25 | 380220 | static void FUNC(lmcs_filter_luma)(uint8_t *_dst, ptrdiff_t dst_stride, const int width, const int height, const void *_lut) | |
26 | { | ||
27 | 380220 | const pixel *lut = _lut; | |
28 | 380220 | pixel *dst = (pixel*)_dst; | |
29 | 380220 | dst_stride /= sizeof(pixel); | |
30 | |||
31 |
2/2✓ Branch 0 taken 6825656 times.
✓ Branch 1 taken 190110 times.
|
14031532 | for (int y = 0; y < height; y++) { |
32 |
2/2✓ Branch 0 taken 536579296 times.
✓ Branch 1 taken 6825656 times.
|
1086809904 | for (int x = 0; x < width; x++) |
33 | 1073158592 | dst[x] = lut[dst[x]]; | |
34 | 13651312 | dst += dst_stride; | |
35 | } | ||
36 | 380220 | } | |
37 | |||
38 | 8017559040 | static av_always_inline int16_t FUNC(alf_clip)(pixel curr, pixel v0, pixel v1, int16_t clip) | |
39 | { | ||
40 | 8017559040 | return av_clip(v0 - curr, -clip, clip) + av_clip(v1 - curr, -clip, clip); | |
41 | } | ||
42 | |||
43 | 34962 | static void FUNC(alf_filter_luma)(uint8_t *_dst, ptrdiff_t dst_stride, const uint8_t *_src, ptrdiff_t src_stride, | |
44 | const int width, const int height, const int16_t *filter, const int16_t *clip, const int vb_pos) | ||
45 | { | ||
46 | 34962 | const pixel *src = (pixel *)_src; | |
47 | 34962 | const int shift = 7; | |
48 | 34962 | const int offset = 1 << ( shift - 1 ); | |
49 | 34962 | const int vb_above = vb_pos - 4; | |
50 | 34962 | const int vb_below = vb_pos + 3; | |
51 | |||
52 | 34962 | dst_stride /= sizeof(pixel); | |
53 | 34962 | src_stride /= sizeof(pixel); | |
54 | |||
55 |
2/2✓ Branch 0 taken 520604 times.
✓ Branch 1 taken 17481 times.
|
1076170 | for (int y = 0; y < height; y += ALF_BLOCK_SIZE) { |
56 |
2/2✓ Branch 0 taken 16146592 times.
✓ Branch 1 taken 520604 times.
|
33334392 | for (int x = 0; x < width; x += ALF_BLOCK_SIZE) { |
57 | 32293184 | const pixel *s0 = src + y * src_stride + x; | |
58 | 32293184 | const pixel *s1 = s0 + src_stride; | |
59 | 32293184 | const pixel *s2 = s0 - src_stride; | |
60 | 32293184 | const pixel *s3 = s1 + src_stride; | |
61 | 32293184 | const pixel *s4 = s2 - src_stride; | |
62 | 32293184 | const pixel *s5 = s3 + src_stride; | |
63 | 32293184 | const pixel *s6 = s4 - src_stride; | |
64 | |||
65 |
2/2✓ Branch 0 taken 64586368 times.
✓ Branch 1 taken 16146592 times.
|
161465920 | for (int i = 0; i < ALF_BLOCK_SIZE; i++) { |
66 | 129172736 | pixel *dst = (pixel *)_dst + (y + i) * dst_stride + x; | |
67 | |||
68 | 129172736 | const pixel *p0 = s0 + i * src_stride; | |
69 | 129172736 | const pixel *p1 = s1 + i * src_stride; | |
70 | 129172736 | const pixel *p2 = s2 + i * src_stride; | |
71 | 129172736 | const pixel *p3 = s3 + i * src_stride; | |
72 | 129172736 | const pixel *p4 = s4 + i * src_stride; | |
73 | 129172736 | const pixel *p5 = s5 + i * src_stride; | |
74 | 129172736 | const pixel *p6 = s6 + i * src_stride; | |
75 | |||
76 |
4/4✓ Branch 0 taken 62832000 times.
✓ Branch 1 taken 1754368 times.
✓ Branch 2 taken 438592 times.
✓ Branch 3 taken 62393408 times.
|
129172736 | const int is_near_vb_above = (y + i < vb_pos) && (y + i >= vb_pos - 1); |
77 |
4/4✓ Branch 0 taken 1754368 times.
✓ Branch 1 taken 62832000 times.
✓ Branch 2 taken 438592 times.
✓ Branch 3 taken 1315776 times.
|
129172736 | const int is_near_vb_below = (y + i >= vb_pos) && (y + i <= vb_pos); |
78 |
4/4✓ Branch 0 taken 64147776 times.
✓ Branch 1 taken 438592 times.
✓ Branch 2 taken 438592 times.
✓ Branch 3 taken 63709184 times.
|
129172736 | const int is_near_vb = is_near_vb_above || is_near_vb_below; |
79 | |||
80 |
4/4✓ Branch 0 taken 62832000 times.
✓ Branch 1 taken 1754368 times.
✓ Branch 2 taken 1754368 times.
✓ Branch 3 taken 61077632 times.
|
129172736 | if ((y + i < vb_pos) && ((y + i) >= vb_above)) { |
81 |
2/2✓ Branch 0 taken 438592 times.
✓ Branch 1 taken 1315776 times.
|
3508736 | p1 = (y + i == vb_pos - 1) ? p0 : p1; |
82 |
2/2✓ Branch 0 taken 877184 times.
✓ Branch 1 taken 877184 times.
|
3508736 | p3 = (y + i >= vb_pos - 2) ? p1 : p3; |
83 |
2/2✓ Branch 0 taken 1315776 times.
✓ Branch 1 taken 438592 times.
|
3508736 | p5 = (y + i >= vb_pos - 3) ? p3 : p5; |
84 | |||
85 |
2/2✓ Branch 0 taken 438592 times.
✓ Branch 1 taken 1315776 times.
|
3508736 | p2 = (y + i == vb_pos - 1) ? p0 : p2; |
86 |
2/2✓ Branch 0 taken 877184 times.
✓ Branch 1 taken 877184 times.
|
3508736 | p4 = (y + i >= vb_pos - 2) ? p2 : p4; |
87 |
2/2✓ Branch 0 taken 1315776 times.
✓ Branch 1 taken 438592 times.
|
3508736 | p6 = (y + i >= vb_pos - 3) ? p4 : p6; |
88 |
3/4✓ Branch 0 taken 1754368 times.
✓ Branch 1 taken 61077632 times.
✓ Branch 2 taken 1754368 times.
✗ Branch 3 not taken.
|
125664000 | } else if ((y + i >= vb_pos) && ((y + i) <= vb_below)) { |
89 |
2/2✓ Branch 0 taken 438592 times.
✓ Branch 1 taken 1315776 times.
|
3508736 | p2 = (y + i == vb_pos ) ? p0 : p2; |
90 |
2/2✓ Branch 0 taken 877184 times.
✓ Branch 1 taken 877184 times.
|
3508736 | p4 = (y + i <= vb_pos + 1) ? p2 : p4; |
91 |
2/2✓ Branch 0 taken 1315776 times.
✓ Branch 1 taken 438592 times.
|
3508736 | p6 = (y + i <= vb_pos + 2) ? p4 : p6; |
92 | |||
93 |
2/2✓ Branch 0 taken 438592 times.
✓ Branch 1 taken 1315776 times.
|
3508736 | p1 = (y + i == vb_pos ) ? p0 : p1; |
94 |
2/2✓ Branch 0 taken 877184 times.
✓ Branch 1 taken 877184 times.
|
3508736 | p3 = (y + i <= vb_pos + 1) ? p1 : p3; |
95 |
2/2✓ Branch 0 taken 1315776 times.
✓ Branch 1 taken 438592 times.
|
3508736 | p5 = (y + i <= vb_pos + 2) ? p3 : p5; |
96 | } | ||
97 | |||
98 |
2/2✓ Branch 0 taken 258345472 times.
✓ Branch 1 taken 64586368 times.
|
645863680 | for (int j = 0; j < ALF_BLOCK_SIZE; j++) { |
99 | 516690944 | int sum = 0; | |
100 | 516690944 | const pixel curr = *p0; | |
101 | |||
102 | 516690944 | sum += filter[0] * FUNC(alf_clip)(curr, p5[+0], p6[+0], clip[0]); | |
103 | 516690944 | sum += filter[1] * FUNC(alf_clip)(curr, p3[+1], p4[-1], clip[1]); | |
104 | 516690944 | sum += filter[2] * FUNC(alf_clip)(curr, p3[+0], p4[+0], clip[2]); | |
105 | 516690944 | sum += filter[3] * FUNC(alf_clip)(curr, p3[-1], p4[+1], clip[3]); | |
106 | 516690944 | sum += filter[4] * FUNC(alf_clip)(curr, p1[+2], p2[-2], clip[4]); | |
107 | 516690944 | sum += filter[5] * FUNC(alf_clip)(curr, p1[+1], p2[-1], clip[5]); | |
108 | 516690944 | sum += filter[6] * FUNC(alf_clip)(curr, p1[+0], p2[+0], clip[6]); | |
109 | 516690944 | sum += filter[7] * FUNC(alf_clip)(curr, p1[-1], p2[+1], clip[7]); | |
110 | 516690944 | sum += filter[8] * FUNC(alf_clip)(curr, p1[-2], p2[+2], clip[8]); | |
111 | 516690944 | sum += filter[9] * FUNC(alf_clip)(curr, p0[+3], p0[-3], clip[9]); | |
112 | 516690944 | sum += filter[10] * FUNC(alf_clip)(curr, p0[+2], p0[-2], clip[10]); | |
113 | 516690944 | sum += filter[11] * FUNC(alf_clip)(curr, p0[+1], p0[-1], clip[11]); | |
114 | |||
115 |
2/2✓ Branch 0 taken 254836736 times.
✓ Branch 1 taken 3508736 times.
|
516690944 | if (!is_near_vb) |
116 | 509673472 | sum = (sum + offset) >> shift; | |
117 | else | ||
118 | 7017472 | sum = (sum + (1 << ((shift + 3) - 1))) >> (shift + 3); | |
119 | 516690944 | sum += curr; | |
120 | 516690944 | dst[j] = CLIP(sum); | |
121 | |||
122 | 516690944 | p0++; | |
123 | 516690944 | p1++; | |
124 | 516690944 | p2++; | |
125 | 516690944 | p3++; | |
126 | 516690944 | p4++; | |
127 | 516690944 | p5++; | |
128 | 516690944 | p6++; | |
129 | } | ||
130 | } | ||
131 | 32293184 | filter += ALF_NUM_COEFF_LUMA; | |
132 | 32293184 | clip += ALF_NUM_COEFF_LUMA; | |
133 | } | ||
134 | } | ||
135 | 34962 | } | |
136 | |||
137 | 41162 | static void FUNC(alf_filter_chroma)(uint8_t* _dst, ptrdiff_t dst_stride, const uint8_t* _src, ptrdiff_t src_stride, | |
138 | const int width, const int height, const int16_t* filter, const int16_t* clip, const int vb_pos) | ||
139 | { | ||
140 | 41162 | const pixel *src = (pixel *)_src; | |
141 | 41162 | const int shift = 7; | |
142 | 41162 | const int offset = 1 << ( shift - 1 ); | |
143 | 41162 | const int vb_above = vb_pos - 2; | |
144 | 41162 | const int vb_below = vb_pos + 1; | |
145 | |||
146 | 41162 | dst_stride /= sizeof(pixel); | |
147 | 41162 | src_stride /= sizeof(pixel); | |
148 | |||
149 |
2/2✓ Branch 0 taken 405381 times.
✓ Branch 1 taken 20581 times.
|
851924 | for (int y = 0; y < height; y += ALF_BLOCK_SIZE) { |
150 |
2/2✓ Branch 0 taken 9464936 times.
✓ Branch 1 taken 405381 times.
|
19740634 | for (int x = 0; x < width; x += ALF_BLOCK_SIZE) { |
151 | 18929872 | const pixel *s0 = src + y * src_stride + x; | |
152 | 18929872 | const pixel *s1 = s0 + src_stride; | |
153 | 18929872 | const pixel *s2 = s0 - src_stride; | |
154 | 18929872 | const pixel *s3 = s1 + src_stride; | |
155 | 18929872 | const pixel *s4 = s2 - src_stride; | |
156 | 18929872 | const pixel *s5 = s3 + src_stride; | |
157 | 18929872 | const pixel *s6 = s4 - src_stride; | |
158 | |||
159 |
2/2✓ Branch 0 taken 37859744 times.
✓ Branch 1 taken 9464936 times.
|
94649360 | for (int i = 0; i < ALF_BLOCK_SIZE; i++) { |
160 | 75719488 | pixel *dst = (pixel *)_dst + (y + i) * dst_stride + x; | |
161 | |||
162 | 75719488 | const pixel *p0 = s0 + i * src_stride; | |
163 | 75719488 | const pixel *p1 = s1 + i * src_stride; | |
164 | 75719488 | const pixel *p2 = s2 + i * src_stride; | |
165 | 75719488 | const pixel *p3 = s3 + i * src_stride; | |
166 | 75719488 | const pixel *p4 = s4 + i * src_stride; | |
167 | 75719488 | const pixel *p5 = s5 + i * src_stride; | |
168 | 75719488 | const pixel *p6 = s6 + i * src_stride; | |
169 | |||
170 |
4/4✓ Branch 0 taken 37148100 times.
✓ Branch 1 taken 711644 times.
✓ Branch 2 taken 355822 times.
✓ Branch 3 taken 36792278 times.
|
75719488 | const int is_near_vb_above = (y + i < vb_pos) && (y + i >= vb_pos - 1); |
171 |
4/4✓ Branch 0 taken 711644 times.
✓ Branch 1 taken 37148100 times.
✓ Branch 2 taken 355822 times.
✓ Branch 3 taken 355822 times.
|
75719488 | const int is_near_vb_below = (y + i >= vb_pos) && (y + i <= vb_pos); |
172 |
4/4✓ Branch 0 taken 37503922 times.
✓ Branch 1 taken 355822 times.
✓ Branch 2 taken 355822 times.
✓ Branch 3 taken 37148100 times.
|
75719488 | const int is_near_vb = is_near_vb_above || is_near_vb_below; |
173 | |||
174 |
4/4✓ Branch 0 taken 37148100 times.
✓ Branch 1 taken 711644 times.
✓ Branch 2 taken 711644 times.
✓ Branch 3 taken 36436456 times.
|
75719488 | if ((y + i < vb_pos) && ((y + i) >= vb_above)) { |
175 |
2/2✓ Branch 0 taken 355822 times.
✓ Branch 1 taken 355822 times.
|
1423288 | p1 = (y + i == vb_pos - 1) ? p0 : p1; |
176 |
1/2✓ Branch 0 taken 711644 times.
✗ Branch 1 not taken.
|
1423288 | p3 = (y + i >= vb_pos - 2) ? p1 : p3; |
177 |
1/2✓ Branch 0 taken 711644 times.
✗ Branch 1 not taken.
|
1423288 | p5 = (y + i >= vb_pos - 3) ? p3 : p5; |
178 | |||
179 |
2/2✓ Branch 0 taken 355822 times.
✓ Branch 1 taken 355822 times.
|
1423288 | p2 = (y + i == vb_pos - 1) ? p0 : p2; |
180 |
1/2✓ Branch 0 taken 711644 times.
✗ Branch 1 not taken.
|
1423288 | p4 = (y + i >= vb_pos - 2) ? p2 : p4; |
181 |
1/2✓ Branch 0 taken 711644 times.
✗ Branch 1 not taken.
|
1423288 | p6 = (y + i >= vb_pos - 3) ? p4 : p6; |
182 |
3/4✓ Branch 0 taken 711644 times.
✓ Branch 1 taken 36436456 times.
✓ Branch 2 taken 711644 times.
✗ Branch 3 not taken.
|
74296200 | } else if ((y + i >= vb_pos) && ((y + i) <= vb_below)) { |
183 |
2/2✓ Branch 0 taken 355822 times.
✓ Branch 1 taken 355822 times.
|
1423288 | p2 = (y + i == vb_pos ) ? p0 : p2; |
184 |
1/2✓ Branch 0 taken 711644 times.
✗ Branch 1 not taken.
|
1423288 | p4 = (y + i <= vb_pos + 1) ? p2 : p4; |
185 |
1/2✓ Branch 0 taken 711644 times.
✗ Branch 1 not taken.
|
1423288 | p6 = (y + i <= vb_pos + 2) ? p4 : p6; |
186 | |||
187 |
2/2✓ Branch 0 taken 355822 times.
✓ Branch 1 taken 355822 times.
|
1423288 | p1 = (y + i == vb_pos ) ? p0 : p1; |
188 |
1/2✓ Branch 0 taken 711644 times.
✗ Branch 1 not taken.
|
1423288 | p3 = (y + i <= vb_pos + 1) ? p1 : p3; |
189 |
1/2✓ Branch 0 taken 711644 times.
✗ Branch 1 not taken.
|
1423288 | p5 = (y + i <= vb_pos + 2) ? p3 : p5; |
190 | } | ||
191 | |||
192 |
2/2✓ Branch 0 taken 151438976 times.
✓ Branch 1 taken 37859744 times.
|
378597440 | for (int j = 0; j < ALF_BLOCK_SIZE; j++) { |
193 | 302877952 | int sum = 0; | |
194 | 302877952 | const pixel curr = *p0; | |
195 | |||
196 | 302877952 | sum += filter[0] * FUNC(alf_clip)(curr, p3[+0], p4[+0], clip[0]); | |
197 | 302877952 | sum += filter[1] * FUNC(alf_clip)(curr, p1[+1], p2[-1], clip[1]); | |
198 | 302877952 | sum += filter[2] * FUNC(alf_clip)(curr, p1[+0], p2[+0], clip[2]); | |
199 | 302877952 | sum += filter[3] * FUNC(alf_clip)(curr, p1[-1], p2[+1], clip[3]); | |
200 | 302877952 | sum += filter[4] * FUNC(alf_clip)(curr, p0[+2], p0[-2], clip[4]); | |
201 | 302877952 | sum += filter[5] * FUNC(alf_clip)(curr, p0[+1], p0[-1], clip[5]); | |
202 | |||
203 |
2/2✓ Branch 0 taken 148592400 times.
✓ Branch 1 taken 2846576 times.
|
302877952 | if (!is_near_vb) |
204 | 297184800 | sum = (sum + offset) >> shift; | |
205 | else | ||
206 | 5693152 | sum = (sum + (1 << ((shift + 3) - 1))) >> (shift + 3); | |
207 | 302877952 | sum += curr; | |
208 | 302877952 | dst[j] = CLIP(sum); | |
209 | |||
210 | 302877952 | p0++; | |
211 | 302877952 | p1++; | |
212 | 302877952 | p2++; | |
213 | 302877952 | p3++; | |
214 | 302877952 | p4++; | |
215 | 302877952 | p5++; | |
216 | 302877952 | p6++; | |
217 | } | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | 41162 | } | |
222 | |||
223 | 16704 | static void FUNC(alf_filter_cc)(uint8_t *_dst, ptrdiff_t dst_stride, const uint8_t *_luma, const ptrdiff_t luma_stride, | |
224 | const int width, const int height, const int hs, const int vs, const int16_t *filter, const int vb_pos) | ||
225 | { | ||
226 | 16704 | const ptrdiff_t stride = luma_stride / sizeof(pixel); | |
227 | |||
228 | 16704 | dst_stride /= sizeof(pixel); | |
229 | |||
230 |
2/2✓ Branch 0 taken 652124 times.
✓ Branch 1 taken 8352 times.
|
1320952 | for (int y = 0; y < height; y++) { |
231 |
2/2✓ Branch 0 taken 60583680 times.
✓ Branch 1 taken 652124 times.
|
122471608 | for (int x = 0; x < width; x++) { |
232 | 121167360 | int sum = 0; | |
233 | 121167360 | pixel *dst = (pixel *)_dst + y * dst_stride + x; | |
234 | 121167360 | const pixel *src = (pixel *)_luma + (y << vs) * stride + (x << hs); | |
235 | |||
236 | 121167360 | const pixel *s0 = src - stride; | |
237 | 121167360 | const pixel *s1 = src; | |
238 | 121167360 | const pixel *s2 = src + stride; | |
239 | 121167360 | const pixel *s3 = src + 2 * stride; | |
240 | |||
241 | 121167360 | const int pos = y << vs; | |
242 |
6/6✓ Branch 0 taken 38562816 times.
✓ Branch 1 taken 22020864 times.
✓ Branch 2 taken 38280192 times.
✓ Branch 3 taken 282624 times.
✓ Branch 4 taken 282624 times.
✓ Branch 5 taken 37997568 times.
|
121167360 | if (!vs && (pos == vb_pos || pos == vb_pos + 1)) |
243 | 1130496 | continue; | |
244 | |||
245 |
3/4✓ Branch 0 taken 59419296 times.
✓ Branch 1 taken 599136 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 59419296 times.
|
120036864 | if (pos == (vb_pos - 2) || pos == (vb_pos + 1)) |
246 | 1198272 | s3 = s2; | |
247 |
4/4✓ Branch 0 taken 59136672 times.
✓ Branch 1 taken 282624 times.
✓ Branch 2 taken 316512 times.
✓ Branch 3 taken 58820160 times.
|
118838592 | else if (pos == (vb_pos - 1) || pos == vb_pos) |
248 | 1198272 | s3 = s2 = s0 = s1; | |
249 | |||
250 | |||
251 | 120036864 | sum += filter[0] * (*s0 - *src); | |
252 | 120036864 | sum += filter[1] * (*(s1 - 1) - *src); | |
253 | 120036864 | sum += filter[2] * (*(s1 + 1) - *src); | |
254 | 120036864 | sum += filter[3] * (*(s2 - 1) - *src); | |
255 | 120036864 | sum += filter[4] * (*s2 - *src); | |
256 | 120036864 | sum += filter[5] * (*(s2 + 1) - *src); | |
257 | 120036864 | sum += filter[6] * (*s3 - *src); | |
258 | 120036864 | sum = av_clip((sum + 64) >> 7, -(1 << (BIT_DEPTH - 1)), (1 << (BIT_DEPTH - 1)) - 1); | |
259 | 120036864 | sum += *dst; | |
260 | 120036864 | *dst = av_clip_pixel(sum); | |
261 | } | ||
262 | } | ||
263 | 16704 | } | |
264 | |||
265 | #define ALF_DIR_VERT 0 | ||
266 | #define ALF_DIR_HORZ 1 | ||
267 | #define ALF_DIR_DIGA0 2 | ||
268 | #define ALF_DIR_DIGA1 3 | ||
269 | |||
270 | 32293184 | static void FUNC(alf_get_idx)(int *class_idx, int *transpose_idx, const int *sum, const int ac) | |
271 | { | ||
272 | static const int arg_var[] = {0, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4 }; | ||
273 | |||
274 | int hv0, hv1, dir_hv, d0, d1, dir_d, hvd1, hvd0, sum_hv, dir1; | ||
275 | |||
276 | 32293184 | dir_hv = sum[ALF_DIR_VERT] <= sum[ALF_DIR_HORZ]; | |
277 | 32293184 | hv1 = FFMAX(sum[ALF_DIR_VERT], sum[ALF_DIR_HORZ]); | |
278 | 32293184 | hv0 = FFMIN(sum[ALF_DIR_VERT], sum[ALF_DIR_HORZ]); | |
279 | |||
280 | 32293184 | dir_d = sum[ALF_DIR_DIGA0] <= sum[ALF_DIR_DIGA1]; | |
281 | 32293184 | d1 = FFMAX(sum[ALF_DIR_DIGA0], sum[ALF_DIR_DIGA1]); | |
282 | 32293184 | d0 = FFMIN(sum[ALF_DIR_DIGA0], sum[ALF_DIR_DIGA1]); | |
283 | |||
284 | //promote to avoid overflow | ||
285 | 32293184 | dir1 = (uint64_t)d1 * hv0 <= (uint64_t)hv1 * d0; | |
286 |
2/2✓ Branch 0 taken 11930544 times.
✓ Branch 1 taken 4216048 times.
|
32293184 | hvd1 = dir1 ? hv1 : d1; |
287 |
2/2✓ Branch 0 taken 11930544 times.
✓ Branch 1 taken 4216048 times.
|
32293184 | hvd0 = dir1 ? hv0 : d0; |
288 | |||
289 | 32293184 | sum_hv = sum[ALF_DIR_HORZ] + sum[ALF_DIR_VERT]; | |
290 | 32293184 | *class_idx = arg_var[av_clip_uintp2(sum_hv * ac >> (BIT_DEPTH - 1), 4)]; | |
291 |
2/2✓ Branch 0 taken 3185473 times.
✓ Branch 1 taken 12961119 times.
|
32293184 | if (hvd1 * 2 > 9 * hvd0) |
292 | 6370946 | *class_idx += ((dir1 << 1) + 2) * 5; | |
293 |
2/2✓ Branch 0 taken 4293836 times.
✓ Branch 1 taken 8667283 times.
|
25922238 | else if (hvd1 > 2 * hvd0) |
294 | 8587672 | *class_idx += ((dir1 << 1) + 1) * 5; | |
295 | |||
296 | 32293184 | *transpose_idx = dir_d * 2 + dir_hv; | |
297 | 32293184 | } | |
298 | |||
299 | 34962 | static void FUNC(alf_classify)(int *class_idx, int *transpose_idx, | |
300 | const uint8_t *_src, const ptrdiff_t _src_stride, const int width, const int height, | ||
301 | const int vb_pos, int *gradient_tmp) | ||
302 | { | ||
303 | int *grad; | ||
304 | |||
305 | 34962 | const int h = height + ALF_GRADIENT_BORDER * 2; | |
306 | 34962 | const int w = width + ALF_GRADIENT_BORDER * 2; | |
307 | 34962 | const int size = (ALF_BLOCK_SIZE + ALF_GRADIENT_BORDER * 2) / ALF_GRADIENT_STEP; | |
308 | 34962 | const int gstride = (w / ALF_GRADIENT_STEP) * ALF_NUM_DIR; | |
309 | |||
310 | 34962 | const pixel *src = (const pixel *)_src; | |
311 | 34962 | const ptrdiff_t src_stride = _src_stride / sizeof(pixel); | |
312 | 34962 | src -= (ALF_GRADIENT_BORDER + 1) * src_stride + ALF_GRADIENT_BORDER; | |
313 | |||
314 | 34962 | grad = gradient_tmp; | |
315 |
2/2✓ Branch 0 taken 1076170 times.
✓ Branch 1 taken 17481 times.
|
2187302 | for (int y = 0; y < h; y += ALF_GRADIENT_STEP) { |
316 | 2152340 | const pixel *s0 = src + y * src_stride; | |
317 | 2152340 | const pixel *s1 = s0 + src_stride; | |
318 | 2152340 | const pixel *s2 = s1 + src_stride; | |
319 | 2152340 | const pixel *s3 = s2 + src_stride; | |
320 | |||
321 |
2/2✓ Branch 0 taken 14014 times.
✓ Branch 1 taken 1062156 times.
|
2152340 | if (y == vb_pos) //above |
322 | 28028 | s3 = s2; | |
323 |
2/2✓ Branch 0 taken 14014 times.
✓ Branch 1 taken 1048142 times.
|
2124312 | else if (y == vb_pos + ALF_GRADIENT_BORDER) |
324 | 28028 | s0 = s1; | |
325 | |||
326 |
2/2✓ Branch 0 taken 68907540 times.
✓ Branch 1 taken 1076170 times.
|
139967420 | for (int x = 0; x < w; x += ALF_GRADIENT_STEP) { |
327 | //two points a time | ||
328 | 137815080 | const pixel *a0 = s0 + x; | |
329 | 137815080 | const pixel *p0 = s1 + x; | |
330 | 137815080 | const pixel *b0 = s2 + x; | |
331 | 137815080 | const int val0 = (*p0) << 1; | |
332 | |||
333 | 137815080 | const pixel *a1 = s1 + x + 1; | |
334 | 137815080 | const pixel *p1 = s2 + x + 1; | |
335 | 137815080 | const pixel *b1 = s3 + x + 1; | |
336 | 137815080 | const int val1 = (*p1) << 1; | |
337 | |||
338 | 137815080 | grad[ALF_DIR_VERT] = FFABS(val0 - *a0 - *b0) + FFABS(val1 - *a1 - *b1); | |
339 | 137815080 | grad[ALF_DIR_HORZ] = FFABS(val0 - *(p0 - 1) - *(p0 + 1)) + FFABS(val1 - *(p1 - 1) - *(p1 + 1)); | |
340 | 137815080 | grad[ALF_DIR_DIGA0] = FFABS(val0 - *(a0 - 1) - *(b0 + 1)) + FFABS(val1 - *(a1 - 1) - *(b1 + 1)); | |
341 | 137815080 | grad[ALF_DIR_DIGA1] = FFABS(val0 - *(a0 + 1) - *(b0 - 1)) + FFABS(val1 - *(a1 + 1) - *(b1 - 1)); | |
342 | 137815080 | grad += ALF_NUM_DIR; | |
343 | } | ||
344 | } | ||
345 | |||
346 |
2/2✓ Branch 0 taken 520604 times.
✓ Branch 1 taken 17481 times.
|
1076170 | for (int y = 0; y < height ; y += ALF_BLOCK_SIZE ) { |
347 | 1041208 | int start = 0; | |
348 | 1041208 | int end = (ALF_BLOCK_SIZE + ALF_GRADIENT_BORDER * 2) / ALF_GRADIENT_STEP; | |
349 | 1041208 | int ac = 2; | |
350 |
2/2✓ Branch 0 taken 14014 times.
✓ Branch 1 taken 506590 times.
|
1041208 | if (y + ALF_BLOCK_SIZE == vb_pos) { |
351 | 28028 | end -= ALF_GRADIENT_BORDER / ALF_GRADIENT_STEP; | |
352 | 28028 | ac = 3; | |
353 |
2/2✓ Branch 0 taken 14014 times.
✓ Branch 1 taken 492576 times.
|
1013180 | } else if (y == vb_pos) { |
354 | 28028 | start += ALF_GRADIENT_BORDER / ALF_GRADIENT_STEP; | |
355 | 28028 | ac = 3; | |
356 | } | ||
357 |
2/2✓ Branch 0 taken 16146592 times.
✓ Branch 1 taken 520604 times.
|
33334392 | for (int x = 0; x < width; x += ALF_BLOCK_SIZE) { |
358 | 32293184 | const int xg = x / ALF_GRADIENT_STEP; | |
359 | 32293184 | const int yg = y / ALF_GRADIENT_STEP; | |
360 | 32293184 | int sum[ALF_NUM_DIR] = { 0 }; | |
361 | |||
362 | 32293184 | grad = gradient_tmp + (yg + start) * gstride + xg * ALF_NUM_DIR; | |
363 | //todo: optimize this loop | ||
364 |
2/2✓ Branch 0 taken 63709184 times.
✓ Branch 1 taken 16146592 times.
|
159711552 | for (int i = start; i < end; i++) { |
365 |
2/2✓ Branch 0 taken 254836736 times.
✓ Branch 1 taken 63709184 times.
|
637091840 | for (int j = 0; j < size; j++) { |
366 | 509673472 | sum[ALF_DIR_VERT] += grad[ALF_DIR_VERT]; | |
367 | 509673472 | sum[ALF_DIR_HORZ] += grad[ALF_DIR_HORZ]; | |
368 | 509673472 | sum[ALF_DIR_DIGA0] += grad[ALF_DIR_DIGA0]; | |
369 | 509673472 | sum[ALF_DIR_DIGA1] += grad[ALF_DIR_DIGA1]; | |
370 | 509673472 | grad += ALF_NUM_DIR; | |
371 | } | ||
372 | 127418368 | grad += gstride - size * ALF_NUM_DIR; | |
373 | } | ||
374 | 32293184 | FUNC(alf_get_idx)(class_idx, transpose_idx, sum, ac); | |
375 | |||
376 | 32293184 | class_idx++; | |
377 | 32293184 | transpose_idx++; | |
378 | } | ||
379 | } | ||
380 | |||
381 | 34962 | } | |
382 | |||
383 | 34962 | static void FUNC(alf_recon_coeff_and_clip)(int16_t *coeff, int16_t *clip, | |
384 | const int *class_idx, const int *transpose_idx, const int size, | ||
385 | const int16_t *coeff_set, const uint8_t *clip_idx_set, const uint8_t *class_to_filt) | ||
386 | { | ||
387 | const static int index[][ALF_NUM_COEFF_LUMA] = { | ||
388 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, | ||
389 | { 9, 4, 10, 8, 1, 5, 11, 7, 3, 0, 2, 6 }, | ||
390 | { 0, 3, 2, 1, 8, 7, 6, 5, 4, 9, 10, 11 }, | ||
391 | { 9, 8, 10, 4, 3, 7, 11, 5, 1, 0, 2, 6 }, | ||
392 | }; | ||
393 | |||
394 | 34962 | const int16_t clip_set[] = { | |
395 | 1 << BIT_DEPTH, 1 << (BIT_DEPTH - 3), 1 << (BIT_DEPTH - 5), 1 << (BIT_DEPTH - 7) | ||
396 | }; | ||
397 | |||
398 |
2/2✓ Branch 0 taken 16146592 times.
✓ Branch 1 taken 17481 times.
|
32328146 | for (int i = 0; i < size; i++) { |
399 | 32293184 | const int16_t *src_coeff = coeff_set + class_to_filt[class_idx[i]] * ALF_NUM_COEFF_LUMA; | |
400 | 32293184 | const uint8_t *clip_idx = clip_idx_set + class_idx[i] * ALF_NUM_COEFF_LUMA; | |
401 | |||
402 |
2/2✓ Branch 0 taken 193759104 times.
✓ Branch 1 taken 16146592 times.
|
419811392 | for (int j = 0; j < ALF_NUM_COEFF_LUMA; j++) { |
403 | 387518208 | const int idx = index[transpose_idx[i]][j]; | |
404 | 387518208 | *coeff++ = src_coeff[idx]; | |
405 | 387518208 | *clip++ = clip_set[clip_idx[idx]]; | |
406 | } | ||
407 | } | ||
408 | 34962 | } | |
409 | |||
410 | #undef ALF_DIR_HORZ | ||
411 | #undef ALF_DIR_VERT | ||
412 | #undef ALF_DIR_DIGA0 | ||
413 | #undef ALF_DIR_DIGA1 | ||
414 | |||
415 | // line zero | ||
416 | #define P7 pix[-8 * xstride] | ||
417 | #define P6 pix[-7 * xstride] | ||
418 | #define P5 pix[-6 * xstride] | ||
419 | #define P4 pix[-5 * xstride] | ||
420 | #define P3 pix[-4 * xstride] | ||
421 | #define P2 pix[-3 * xstride] | ||
422 | #define P1 pix[-2 * xstride] | ||
423 | #define P0 pix[-1 * xstride] | ||
424 | #define Q0 pix[0 * xstride] | ||
425 | #define Q1 pix[1 * xstride] | ||
426 | #define Q2 pix[2 * xstride] | ||
427 | #define Q3 pix[3 * xstride] | ||
428 | #define Q4 pix[4 * xstride] | ||
429 | #define Q5 pix[5 * xstride] | ||
430 | #define Q6 pix[6 * xstride] | ||
431 | #define Q7 pix[7 * xstride] | ||
432 | #define P(x) pix[(-(x)-1) * xstride] | ||
433 | #define Q(x) pix[(x) * xstride] | ||
434 | |||
435 | // line three. used only for deblocking decision | ||
436 | #define TP7 pix[-8 * xstride + 3 * ystride] | ||
437 | #define TP6 pix[-7 * xstride + 3 * ystride] | ||
438 | #define TP5 pix[-6 * xstride + 3 * ystride] | ||
439 | #define TP4 pix[-5 * xstride + 3 * ystride] | ||
440 | #define TP3 pix[-4 * xstride + 3 * ystride] | ||
441 | #define TP2 pix[-3 * xstride + 3 * ystride] | ||
442 | #define TP1 pix[-2 * xstride + 3 * ystride] | ||
443 | #define TP0 pix[-1 * xstride + 3 * ystride] | ||
444 | #define TQ0 pix[0 * xstride + 3 * ystride] | ||
445 | #define TQ1 pix[1 * xstride + 3 * ystride] | ||
446 | #define TQ2 pix[2 * xstride + 3 * ystride] | ||
447 | #define TQ3 pix[3 * xstride + 3 * ystride] | ||
448 | #define TQ4 pix[4 * xstride + 3 * ystride] | ||
449 | #define TQ5 pix[5 * xstride + 3 * ystride] | ||
450 | #define TQ6 pix[6 * xstride + 3 * ystride] | ||
451 | #define TQ7 pix[7 * xstride + 3 * ystride] | ||
452 | #define TP(x) pix[(-(x)-1) * xstride + 3 * ystride] | ||
453 | #define TQ(x) pix[(x) * xstride + 3 * ystride] | ||
454 | |||
455 | #define FP3 pix[-4 * xstride + 1 * ystride] | ||
456 | #define FP2 pix[-3 * xstride + 1 * ystride] | ||
457 | #define FP1 pix[-2 * xstride + 1 * ystride] | ||
458 | #define FP0 pix[-1 * xstride + 1 * ystride] | ||
459 | #define FQ0 pix[0 * xstride + 1 * ystride] | ||
460 | #define FQ1 pix[1 * xstride + 1 * ystride] | ||
461 | #define FQ2 pix[2 * xstride + 1 * ystride] | ||
462 | #define FQ3 pix[3 * xstride + 1 * ystride] | ||
463 | |||
464 | #include "libavcodec/h26x/h2656_deblock_template.c" | ||
465 | |||
466 | 1367762 | static void FUNC(loop_filter_luma_large)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride, const int32_t tc, | |
467 | const uint8_t no_p, const uint8_t no_q, const uint8_t max_len_p, const uint8_t max_len_q) | ||
468 | { | ||
469 |
2/2✓ Branch 0 taken 2735524 times.
✓ Branch 1 taken 683881 times.
|
6838810 | for (int d = 0; d < 4; d++) { |
470 | 5471048 | const int p6 = P6; | |
471 | 5471048 | const int p5 = P5; | |
472 | 5471048 | const int p4 = P4; | |
473 | 5471048 | const int p3 = P3; | |
474 | 5471048 | const int p2 = P2; | |
475 | 5471048 | const int p1 = P1; | |
476 | 5471048 | const int p0 = P0; | |
477 | 5471048 | const int q0 = Q0; | |
478 | 5471048 | const int q1 = Q1; | |
479 | 5471048 | const int q2 = Q2; | |
480 | 5471048 | const int q3 = Q3; | |
481 | 5471048 | const int q4 = Q4; | |
482 | 5471048 | const int q5 = Q5; | |
483 | 5471048 | const int q6 = Q6; | |
484 | int m; | ||
485 |
4/4✓ Branch 0 taken 415440 times.
✓ Branch 1 taken 2320084 times.
✓ Branch 2 taken 235756 times.
✓ Branch 3 taken 179684 times.
|
5471048 | if (max_len_p == 5 && max_len_q == 5) |
486 | 471512 | m = (p4 + p3 + 2 * (p2 + p1 + p0 + q0 + q1 + q2) + q3 + q4 + 8) >> 4; | |
487 |
2/2✓ Branch 0 taken 1133860 times.
✓ Branch 1 taken 1365908 times.
|
4999536 | else if (max_len_p == max_len_q) |
488 | 2267720 | m = (p6 + p5 + p4 + p3 + p2 + p1 + 2 * (p0 + q0) + q1 + q2 + q3 + q4 + q5 + q6 + 8) >> 4; | |
489 |
2/2✓ Branch 0 taken 265300 times.
✓ Branch 1 taken 1100608 times.
|
2731816 | else if (max_len_p + max_len_q == 12) |
490 | 530600 | m = (p5 + p4 + p3 + p2 + 2 * (p1 + p0 + q0 + q1) + q2 + q3 + q4 + q5 + 8) >> 4; | |
491 |
2/2✓ Branch 0 taken 259072 times.
✓ Branch 1 taken 841536 times.
|
2201216 | else if (max_len_p + max_len_q == 8) |
492 | 518144 | m = (p3 + p2 + p1 + p0 + q0 + q1 + q2 + q3 + 4) >> 3; | |
493 |
2/2✓ Branch 0 taken 617740 times.
✓ Branch 1 taken 223796 times.
|
1683072 | else if (max_len_q == 7) |
494 | 1235480 | m = (2 * (p2 + p1 + p0 + q0) + p0 + p1 + q1 + q2 + q3 + q4 + q5 + q6 + 8) >> 4; | |
495 | else | ||
496 | 447592 | m = (p6 + p5 + p4 + p3 + p2 + p1 + 2 * (q2 + q1 + q0 + p0) + q0 + q1 + 8) >> 4; | |
497 |
1/2✓ Branch 0 taken 2735524 times.
✗ Branch 1 not taken.
|
5471048 | if (!no_p) { |
498 | 5471048 | const int refp = (P(max_len_p) + P(max_len_p - 1) + 1) >> 1; | |
499 |
2/2✓ Branch 0 taken 826460 times.
✓ Branch 1 taken 1909064 times.
|
5471048 | if (max_len_p == 3) { |
500 | 1652920 | P0 = p0 + av_clip(((m * 53 + refp * 11 + 32) >> 6) - p0, -(tc * 6 >> 1), (tc * 6 >> 1)); | |
501 | 1652920 | P1 = p1 + av_clip(((m * 32 + refp * 32 + 32) >> 6) - p1, -(tc * 4 >> 1), (tc * 4 >> 1)); | |
502 | 1652920 | P2 = p2 + av_clip(((m * 11 + refp * 53 + 32) >> 6) - p2, -(tc * 2 >> 1), (tc * 2 >> 1)); | |
503 |
2/2✓ Branch 0 taken 415440 times.
✓ Branch 1 taken 1493624 times.
|
3818128 | } else if (max_len_p == 5) { |
504 | 830880 | P0 = p0 + av_clip(((m * 58 + refp * 6 + 32) >> 6) - p0, -(tc * 6 >> 1), (tc * 6 >> 1)); | |
505 | 830880 | P1 = p1 + av_clip(((m * 45 + refp * 19 + 32) >> 6) - p1, -(tc * 5 >> 1), (tc * 5 >> 1)); | |
506 | 830880 | P2 = p2 + av_clip(((m * 32 + refp * 32 + 32) >> 6) - p2, -(tc * 4 >> 1), (tc * 4 >> 1)); | |
507 | 830880 | P3 = p3 + av_clip(((m * 19 + refp * 45 + 32) >> 6) - p3, -(tc * 3 >> 1), (tc * 3 >> 1)); | |
508 | 830880 | P4 = p4 + av_clip(((m * 6 + refp * 58 + 32) >> 6) - p4, -(tc * 2 >> 1), (tc * 2 >> 1)); | |
509 | } else { | ||
510 | 2987248 | P0 = p0 + av_clip(((m * 59 + refp * 5 + 32) >> 6) - p0, -(tc * 6 >> 1), (tc * 6 >> 1)); | |
511 | 2987248 | P1 = p1 + av_clip(((m * 50 + refp * 14 + 32) >> 6) - p1, -(tc * 5 >> 1), (tc * 5 >> 1)); | |
512 | 2987248 | P2 = p2 + av_clip(((m * 41 + refp * 23 + 32) >> 6) - p2, -(tc * 4 >> 1), (tc * 4 >> 1)); | |
513 | 2987248 | P3 = p3 + av_clip(((m * 32 + refp * 32 + 32) >> 6) - p3, -(tc * 3 >> 1), (tc * 3 >> 1)); | |
514 | 2987248 | P4 = p4 + av_clip(((m * 23 + refp * 41 + 32) >> 6) - p4, -(tc * 2 >> 1), (tc * 2 >> 1)); | |
515 | 2987248 | P5 = p5 + av_clip(((m * 14 + refp * 50 + 32) >> 6) - p5, -(tc * 1 >> 1), (tc * 1 >> 1)); | |
516 | 2987248 | P6 = p6 + av_clip(((m * 5 + refp * 59 + 32) >> 6) - p6, -(tc * 1 >> 1), (tc * 1 >> 1)); | |
517 | } | ||
518 | } | ||
519 |
1/2✓ Branch 0 taken 2735524 times.
✗ Branch 1 not taken.
|
5471048 | if (!no_q) { |
520 | 5471048 | const int refq = (Q(max_len_q) + Q(max_len_q - 1) + 1) >> 1; | |
521 |
2/2✓ Branch 0 taken 274148 times.
✓ Branch 1 taken 2461376 times.
|
5471048 | if (max_len_q == 3) { |
522 | 548296 | Q0 = q0 + av_clip(((m * 53 + refq * 11 + 32) >> 6) - q0, -(tc * 6 >> 1), (tc * 6 >> 1)); | |
523 | 548296 | Q1 = q1 + av_clip(((m * 32 + refq * 32 + 32) >> 6) - q1, -(tc * 4 >> 1), (tc * 4 >> 1)); | |
524 | 548296 | Q2 = q2 + av_clip(((m * 11 + refq * 53 + 32) >> 6) - q2, -(tc * 2 >> 1), (tc * 2 >> 1)); | |
525 |
2/2✓ Branch 0 taken 580444 times.
✓ Branch 1 taken 1880932 times.
|
4922752 | } else if (max_len_q == 5) { |
526 | 1160888 | Q0 = q0 + av_clip(((m * 58 + refq * 6 + 32) >> 6) - q0, -(tc * 6 >> 1), (tc * 6 >> 1)); | |
527 | 1160888 | Q1 = q1 + av_clip(((m * 45 + refq * 19 + 32) >> 6) - q1, -(tc * 5 >> 1), (tc * 5 >> 1)); | |
528 | 1160888 | Q2 = q2 + av_clip(((m * 32 + refq * 32 + 32) >> 6) - q2, -(tc * 4 >> 1), (tc * 4 >> 1)); | |
529 | 1160888 | Q3 = q3 + av_clip(((m * 19 + refq * 45 + 32) >> 6) - q3, -(tc * 3 >> 1), (tc * 3 >> 1)); | |
530 | 1160888 | Q4 = q4 + av_clip(((m * 6 + refq * 58 + 32) >> 6) - q4, -(tc * 2 >> 1), (tc * 2 >> 1)); | |
531 | } else { | ||
532 | 3761864 | Q0 = q0 + av_clip(((m * 59 + refq * 5 + 32) >> 6) - q0, -(tc * 6 >> 1), (tc * 6 >> 1)); | |
533 | 3761864 | Q1 = q1 + av_clip(((m * 50 + refq * 14 + 32) >> 6) - q1, -(tc * 5 >> 1), (tc * 5 >> 1)); | |
534 | 3761864 | Q2 = q2 + av_clip(((m * 41 + refq * 23 + 32) >> 6) - q2, -(tc * 4 >> 1), (tc * 4 >> 1)); | |
535 | 3761864 | Q3 = q3 + av_clip(((m * 32 + refq * 32 + 32) >> 6) - q3, -(tc * 3 >> 1), (tc * 3 >> 1)); | |
536 | 3761864 | Q4 = q4 + av_clip(((m * 23 + refq * 41 + 32) >> 6) - q4, -(tc * 2 >> 1), (tc * 2 >> 1)); | |
537 | 3761864 | Q5 = q5 + av_clip(((m * 14 + refq * 50 + 32) >> 6) - q5, -(tc * 1 >> 1), (tc * 1 >> 1)); | |
538 | 3761864 | Q6 = q6 + av_clip(((m * 5 + refq * 59 + 32) >> 6) - q6, -(tc * 1 >> 1), (tc * 1 >> 1)); | |
539 | } | ||
540 | |||
541 | } | ||
542 | 5471048 | pix += ystride; | |
543 | } | ||
544 | 1367762 | } | |
545 | |||
546 | 6221380 | static void FUNC(vvc_loop_filter_luma)(uint8_t* _pix, ptrdiff_t _xstride, ptrdiff_t _ystride, | |
547 | const int32_t *_beta, const int32_t *_tc, const uint8_t *_no_p, const uint8_t *_no_q, | ||
548 | const uint8_t *_max_len_p, const uint8_t *_max_len_q, const int hor_ctu_edge) | ||
549 | { | ||
550 | 6221380 | const ptrdiff_t xstride = _xstride / sizeof(pixel); | |
551 | 6221380 | const ptrdiff_t ystride = _ystride / sizeof(pixel); | |
552 | |||
553 |
2/2✓ Branch 0 taken 6221380 times.
✓ Branch 1 taken 3110690 times.
|
18664140 | for (int i = 0; i < 2; i++) { |
554 | #if BIT_DEPTH < 10 | ||
555 | 31856 | const int tc = (_tc[i] + (1 << (9 - BIT_DEPTH))) >> (10 - BIT_DEPTH); | |
556 | #else | ||
557 | 12410904 | const int tc = _tc[i] << (BIT_DEPTH - 10); | |
558 | #endif | ||
559 |
2/2✓ Branch 0 taken 6097542 times.
✓ Branch 1 taken 123838 times.
|
12442760 | if (tc) { |
560 | 12195084 | pixel* pix = (pixel*)_pix + i * 4 * ystride; | |
561 | 12195084 | const int dp0 = abs(P2 - 2 * P1 + P0); | |
562 | 12195084 | const int dq0 = abs(Q2 - 2 * Q1 + Q0); | |
563 | 12195084 | const int dp3 = abs(TP2 - 2 * TP1 + TP0); | |
564 | 12195084 | const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0); | |
565 | 12195084 | const int d0 = dp0 + dq0; | |
566 | 12195084 | const int d3 = dp3 + dq3; | |
567 | 12195084 | const int tc25 = ((tc * 5 + 1) >> 1); | |
568 | |||
569 | 12195084 | const int no_p = _no_p[i]; | |
570 | 12195084 | const int no_q = _no_q[i]; | |
571 | |||
572 | 12195084 | int max_len_p = _max_len_p[i]; | |
573 | 12195084 | int max_len_q = _max_len_q[i]; | |
574 | |||
575 |
4/4✓ Branch 0 taken 1877745 times.
✓ Branch 1 taken 4219797 times.
✓ Branch 2 taken 1483605 times.
✓ Branch 3 taken 394140 times.
|
12195084 | const int large_p = (max_len_p > 3 && !hor_ctu_edge); |
576 | 12195084 | const int large_q = max_len_q > 3; | |
577 | |||
578 | 12195084 | const int beta = _beta[i] << BIT_DEPTH - 8; | |
579 | 12195084 | const int beta_3 = beta >> 3; | |
580 | 12195084 | const int beta_2 = beta >> 2; | |
581 | |||
582 |
4/4✓ Branch 0 taken 4613937 times.
✓ Branch 1 taken 1483605 times.
✓ Branch 2 taken 748257 times.
✓ Branch 3 taken 3865680 times.
|
12195084 | if (large_p || large_q) { |
583 |
2/2✓ Branch 0 taken 1483605 times.
✓ Branch 1 taken 748257 times.
|
4463724 | const int dp0l = large_p ? ((dp0 + abs(P5 - 2 * P4 + P3) + 1) >> 1) : dp0; |
584 |
2/2✓ Branch 0 taken 1861077 times.
✓ Branch 1 taken 370785 times.
|
4463724 | const int dq0l = large_q ? ((dq0 + abs(Q5 - 2 * Q4 + Q3) + 1) >> 1) : dq0; |
585 |
2/2✓ Branch 0 taken 1483605 times.
✓ Branch 1 taken 748257 times.
|
4463724 | const int dp3l = large_p ? ((dp3 + abs(TP5 - 2 * TP4 + TP3) + 1) >> 1) : dp3; |
586 |
2/2✓ Branch 0 taken 1861077 times.
✓ Branch 1 taken 370785 times.
|
4463724 | const int dq3l = large_q ? ((dq3 + abs(TQ5 - 2 * TQ4 + TQ3) + 1) >> 1) : dq3; |
587 | 4463724 | const int d0l = dp0l + dq0l; | |
588 | 4463724 | const int d3l = dp3l + dq3l; | |
589 | 4463724 | const int beta53 = beta * 3 >> 5; | |
590 | 4463724 | const int beta_4 = beta >> 4; | |
591 |
2/2✓ Branch 0 taken 1483605 times.
✓ Branch 1 taken 748257 times.
|
4463724 | max_len_p = large_p ? max_len_p : 3; |
592 |
2/2✓ Branch 0 taken 1861077 times.
✓ Branch 1 taken 370785 times.
|
4463724 | max_len_q = large_q ? max_len_q : 3; |
593 | |||
594 |
2/2✓ Branch 0 taken 2088454 times.
✓ Branch 1 taken 143408 times.
|
4463724 | if (d0l + d3l < beta) { |
595 |
2/2✓ Branch 0 taken 1129796 times.
✓ Branch 1 taken 958658 times.
|
4176908 | const int sp0l = abs(P3 - P0) + (max_len_p == 7 ? abs(P7 - P6 - P5 + P4) : 0); |
596 |
2/2✓ Branch 0 taken 1406765 times.
✓ Branch 1 taken 681689 times.
|
4176908 | const int sq0l = abs(Q0 - Q3) + (max_len_q == 7 ? abs(Q4 - Q5 - Q6 + Q7) : 0); |
597 |
2/2✓ Branch 0 taken 1129796 times.
✓ Branch 1 taken 958658 times.
|
4176908 | const int sp3l = abs(TP3 - TP0) + (max_len_p == 7 ? abs(TP7 - TP6 - TP5 + TP4) : 0); |
598 |
2/2✓ Branch 0 taken 1406765 times.
✓ Branch 1 taken 681689 times.
|
4176908 | const int sq3l = abs(TQ0 - TQ3) + (max_len_q == 7 ? abs(TQ4 - TQ5 - TQ6 + TQ7) : 0); |
599 |
2/2✓ Branch 0 taken 1395445 times.
✓ Branch 1 taken 693009 times.
|
4176908 | const int sp0 = large_p ? ((sp0l + abs(P3 - P(max_len_p)) + 1) >> 1) : sp0l; |
600 |
2/2✓ Branch 0 taken 1395445 times.
✓ Branch 1 taken 693009 times.
|
4176908 | const int sp3 = large_p ? ((sp3l + abs(TP3 - TP(max_len_p)) + 1) >> 1) : sp3l; |
601 |
2/2✓ Branch 0 taken 1757265 times.
✓ Branch 1 taken 331189 times.
|
4176908 | const int sq0 = large_q ? ((sq0l + abs(Q3 - Q(max_len_q)) + 1) >> 1) : sq0l; |
602 |
2/2✓ Branch 0 taken 1757265 times.
✓ Branch 1 taken 331189 times.
|
4176908 | const int sq3 = large_q ? ((sq3l + abs(TQ3 - TQ(max_len_q)) + 1) >> 1) : sq3l; |
603 |
4/4✓ Branch 0 taken 848076 times.
✓ Branch 1 taken 1240378 times.
✓ Branch 2 taken 846133 times.
✓ Branch 3 taken 1943 times.
|
4176908 | if (sp0 + sq0 < beta53 && abs(P0 - Q0) < tc25 && |
604 |
4/4✓ Branch 0 taken 747660 times.
✓ Branch 1 taken 98473 times.
✓ Branch 2 taken 747073 times.
✓ Branch 3 taken 587 times.
|
1692266 | sp3 + sq3 < beta53 && abs(TP0 - TQ0) < tc25 && |
605 |
4/4✓ Branch 0 taken 705522 times.
✓ Branch 1 taken 41551 times.
✓ Branch 2 taken 683881 times.
✓ Branch 3 taken 21641 times.
|
1494146 | (d0l << 1) < beta_4 && (d3l << 1) < beta_4) { |
606 | 1367762 | FUNC(loop_filter_luma_large)(pix, xstride, ystride, tc, no_p, no_q, max_len_p, max_len_q); | |
607 | 1367762 | continue; | |
608 | } | ||
609 | } | ||
610 | } | ||
611 |
2/2✓ Branch 0 taken 3993591 times.
✓ Branch 1 taken 1420070 times.
|
10827322 | if (d0 + d3 < beta) { |
612 |
3/4✓ Branch 0 taken 2975490 times.
✓ Branch 1 taken 1018101 times.
✓ Branch 2 taken 2975490 times.
✗ Branch 3 not taken.
|
7987182 | if (max_len_p > 2 && max_len_q > 2 && |
613 |
4/4✓ Branch 0 taken 994195 times.
✓ Branch 1 taken 1981295 times.
✓ Branch 2 taken 984230 times.
✓ Branch 3 taken 9965 times.
|
5950980 | abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 && |
614 |
4/4✓ Branch 0 taken 746133 times.
✓ Branch 1 taken 238097 times.
✓ Branch 2 taken 743701 times.
✓ Branch 3 taken 2432 times.
|
1968460 | abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 && |
615 |
4/4✓ Branch 0 taken 732769 times.
✓ Branch 1 taken 10932 times.
✓ Branch 2 taken 728143 times.
✓ Branch 3 taken 4626 times.
|
1487402 | (d0 << 1) < beta_2 && (d3 << 1) < beta_2) { |
616 | 1456286 | FUNC(loop_filter_luma_strong)(pix, xstride, ystride, tc, tc << 1, tc * 3, no_p, no_q); | |
617 | } else { | ||
618 | 6530896 | int nd_p = 1; | |
619 | 6530896 | int nd_q = 1; | |
620 |
3/4✓ Branch 0 taken 2406823 times.
✓ Branch 1 taken 858625 times.
✓ Branch 2 taken 2406823 times.
✗ Branch 3 not taken.
|
6530896 | if (max_len_p > 1 && max_len_q > 1) { |
621 |
2/2✓ Branch 0 taken 1946790 times.
✓ Branch 1 taken 460033 times.
|
4813646 | if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3)) |
622 | 3893580 | nd_p = 2; | |
623 |
2/2✓ Branch 0 taken 1874648 times.
✓ Branch 1 taken 532175 times.
|
4813646 | if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3)) |
624 | 3749296 | nd_q = 2; | |
625 | } | ||
626 | 6530896 | FUNC(loop_filter_luma_weak)(pix, xstride, ystride, tc, beta, no_p, no_q, nd_p, nd_q); | |
627 | } | ||
628 | } | ||
629 | } | ||
630 | } | ||
631 | 6221380 | } | |
632 | |||
633 | 2580734 | static void FUNC(loop_filter_chroma_strong)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride, | |
634 | const int size, const int32_t tc, const uint8_t no_p, const uint8_t no_q) | ||
635 | { | ||
636 |
2/2✓ Branch 0 taken 2874144 times.
✓ Branch 1 taken 1290367 times.
|
8329022 | for (int d = 0; d < size; d++) { |
637 | 5748288 | const int p3 = P3; | |
638 | 5748288 | const int p2 = P2; | |
639 | 5748288 | const int p1 = P1; | |
640 | 5748288 | const int p0 = P0; | |
641 | 5748288 | const int q0 = Q0; | |
642 | 5748288 | const int q1 = Q1; | |
643 | 5748288 | const int q2 = Q2; | |
644 | 5748288 | const int q3 = Q3; | |
645 |
1/2✓ Branch 0 taken 2874144 times.
✗ Branch 1 not taken.
|
5748288 | if (!no_p) { |
646 | 5748288 | P0 = av_clip((p3 + p2 + p1 + 2 * p0 + q0 + q1 + q2 + 4) >> 3, p0 - tc, p0 + tc); | |
647 | 5748288 | P1 = av_clip((2 * p3 + p2 + 2 * p1 + p0 + q0 + q1 + 4) >> 3, p1 - tc, p1 + tc); | |
648 | 5748288 | P2 = av_clip((3 * p3 + 2 * p2 + p1 + p0 + q0 + 4) >> 3, p2 - tc, p2 + tc ); | |
649 | } | ||
650 |
1/2✓ Branch 0 taken 2874144 times.
✗ Branch 1 not taken.
|
5748288 | if (!no_q) { |
651 | 5748288 | Q0 = av_clip((p2 + p1 + p0 + 2 * q0 + q1 + q2 + q3 + 4) >> 3, q0 - tc, q0 + tc); | |
652 | 5748288 | Q1 = av_clip((p1 + p0 + q0 + 2 * q1 + q2 + 2 * q3 + 4) >> 3, q1 - tc, q1 + tc); | |
653 | 5748288 | Q2 = av_clip((p0 + q0 + q1 + 2 * q2 + 3 * q3 + 4) >> 3, q2 - tc, q2 + tc); | |
654 | } | ||
655 | 5748288 | pix += ystride; | |
656 | } | ||
657 | 2580734 | } | |
658 | |||
659 | 467506 | static void FUNC(loop_filter_chroma_strong_one_side)(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride, | |
660 | const int size, const int32_t tc, const uint8_t no_p, const uint8_t no_q) | ||
661 | { | ||
662 |
2/2✓ Branch 0 taken 511328 times.
✓ Branch 1 taken 233753 times.
|
1490162 | for (int d = 0; d < size; d++) { |
663 | 1022656 | const int p1 = P1; | |
664 | 1022656 | const int p0 = P0; | |
665 | 1022656 | const int q0 = Q0; | |
666 | 1022656 | const int q1 = Q1; | |
667 | 1022656 | const int q2 = Q2; | |
668 | 1022656 | const int q3 = Q3; | |
669 |
1/2✓ Branch 0 taken 511328 times.
✗ Branch 1 not taken.
|
1022656 | if (!no_p) { |
670 | 1022656 | P0 = av_clip((3 * p1 + 2 * p0 + q0 + q1 + q2 + 4) >> 3, p0 - tc, p0 + tc); | |
671 | } | ||
672 |
1/2✓ Branch 0 taken 511328 times.
✗ Branch 1 not taken.
|
1022656 | if (!no_q) { |
673 | 1022656 | Q0 = av_clip((2 * p1 + p0 + 2 * q0 + q1 + q2 + q3 + 4) >> 3, q0 - tc, q0 + tc); | |
674 | 1022656 | Q1 = av_clip((p1 + p0 + q0 + 2 * q1 + q2 + 2 * q3 + 4) >> 3, q1 - tc, q1 + tc); | |
675 | 1022656 | Q2 = av_clip((p0 + q0 + q1 + 2 * q2 + 3 * q3 + 4) >> 3, q2 - tc, q2 + tc); | |
676 | } | ||
677 | 1022656 | pix += ystride; | |
678 | } | ||
679 | 467506 | } | |
680 | |||
681 | 1903456 | static void FUNC(vvc_loop_filter_chroma)(uint8_t *_pix, const ptrdiff_t _xstride, const ptrdiff_t _ystride, | |
682 | const int32_t *_beta, const int32_t *_tc, const uint8_t *_no_p, const uint8_t *_no_q, | ||
683 | const uint8_t *_max_len_p, const uint8_t *_max_len_q, const int shift) | ||
684 | { | ||
685 | 1903456 | const ptrdiff_t xstride = _xstride / sizeof(pixel); | |
686 | 1903456 | const ptrdiff_t ystride = _ystride / sizeof(pixel); | |
687 |
2/2✓ Branch 0 taken 690843 times.
✓ Branch 1 taken 260885 times.
|
1903456 | const int size = shift ? 2 : 4; |
688 | 1903456 | const int end = 8 / size; // 8 samples a loop | |
689 | |||
690 |
2/2✓ Branch 0 taken 3285142 times.
✓ Branch 1 taken 951728 times.
|
8473740 | for (int i = 0; i < end; i++) { |
691 | #if BIT_DEPTH < 10 | ||
692 | 23504 | const int tc = (_tc[i] + (1 << (9 - BIT_DEPTH))) >> (10 - BIT_DEPTH); | |
693 | #else | ||
694 | 6546780 | const int tc = _tc[i] << (BIT_DEPTH - 10); | |
695 | #endif | ||
696 |
2/2✓ Branch 0 taken 3141554 times.
✓ Branch 1 taken 143588 times.
|
6570284 | if (tc) { |
697 | 6283108 | pixel *pix = (pixel *)_pix + i * size * ystride; | |
698 | 6283108 | const uint8_t no_p = _no_p[i]; | |
699 | 6283108 | const uint8_t no_q = _no_q[i]; | |
700 | |||
701 | 6283108 | const int beta = _beta[i] << (BIT_DEPTH - 8); | |
702 | 6283108 | const int beta_3 = beta >> 3; | |
703 | 6283108 | const int beta_2 = beta >> 2; | |
704 | |||
705 | 6283108 | const int tc25 = ((tc * 5 + 1) >> 1); | |
706 | |||
707 | 6283108 | uint8_t max_len_p = _max_len_p[i]; | |
708 | 6283108 | uint8_t max_len_q = _max_len_q[i]; | |
709 | |||
710 |
3/4✓ Branch 0 taken 3067201 times.
✓ Branch 1 taken 74353 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3067201 times.
|
6283108 | if (!max_len_p || !max_len_q) |
711 | 148706 | continue; | |
712 | |||
713 |
2/2✓ Branch 0 taken 2248349 times.
✓ Branch 1 taken 818852 times.
|
6134402 | if (max_len_q == 3){ |
714 |
2/2✓ Branch 0 taken 1833784 times.
✓ Branch 1 taken 414565 times.
|
4496698 | const int p1n = shift ? FP1 : TP1; |
715 |
4/4✓ Branch 0 taken 1966234 times.
✓ Branch 1 taken 282115 times.
✓ Branch 2 taken 1590352 times.
✓ Branch 3 taken 375882 times.
|
4496698 | const int p2n = max_len_p == 1 ? p1n : (shift ? FP2 : TP2); |
716 |
2/2✓ Branch 0 taken 1833784 times.
✓ Branch 1 taken 414565 times.
|
4496698 | const int p0n = shift ? FP0 : TP0; |
717 |
2/2✓ Branch 0 taken 1833784 times.
✓ Branch 1 taken 414565 times.
|
4496698 | const int q0n = shift ? FQ0 : TQ0; |
718 |
2/2✓ Branch 0 taken 1833784 times.
✓ Branch 1 taken 414565 times.
|
4496698 | const int q1n = shift ? FQ1 : TQ1; |
719 |
2/2✓ Branch 0 taken 1833784 times.
✓ Branch 1 taken 414565 times.
|
4496698 | const int q2n = shift ? FQ2 : TQ2; |
720 |
2/2✓ Branch 0 taken 282115 times.
✓ Branch 1 taken 1966234 times.
|
4496698 | const int p3 = max_len_p == 1 ? P1 : P3; |
721 |
2/2✓ Branch 0 taken 282115 times.
✓ Branch 1 taken 1966234 times.
|
4496698 | const int p2 = max_len_p == 1 ? P1 : P2; |
722 | 4496698 | const int p1 = P1; | |
723 | 4496698 | const int p0 = P0; | |
724 | 4496698 | const int dp0 = abs(p2 - 2 * p1 + p0); | |
725 | 4496698 | const int dq0 = abs(Q2 - 2 * Q1 + Q0); | |
726 | |||
727 | 4496698 | const int dp1 = abs(p2n - 2 * p1n + p0n); | |
728 | 4496698 | const int dq1 = abs(q2n - 2 * q1n + q0n); | |
729 | 4496698 | const int d0 = dp0 + dq0; | |
730 | 4496698 | const int d1 = dp1 + dq1; | |
731 | |||
732 |
2/2✓ Branch 0 taken 2118593 times.
✓ Branch 1 taken 129756 times.
|
4496698 | if (d0 + d1 < beta) { |
733 |
4/4✓ Branch 0 taken 1842904 times.
✓ Branch 1 taken 275689 times.
✓ Branch 2 taken 1558136 times.
✓ Branch 3 taken 284768 times.
|
4237186 | const int p3n = max_len_p == 1 ? p1n : (shift ? FP3 : TP3); |
734 |
2/2✓ Branch 0 taken 1799256 times.
✓ Branch 1 taken 319337 times.
|
4237186 | const int q3n = shift ? FQ3 : TQ3; |
735 |
4/4✓ Branch 0 taken 1898875 times.
✓ Branch 1 taken 219718 times.
✓ Branch 2 taken 1587412 times.
✓ Branch 3 taken 311463 times.
|
7412010 | const int dsam0 = (d0 << 1) < beta_2 && (abs(p3 - p0) + abs(Q0 - Q3) < beta_3) && |
736 |
2/2✓ Branch 0 taken 1582197 times.
✓ Branch 1 taken 5215 times.
|
3174824 | abs(p0 - Q0) < tc25; |
737 |
4/4✓ Branch 0 taken 1900887 times.
✓ Branch 1 taken 217706 times.
✓ Branch 2 taken 1589916 times.
✓ Branch 3 taken 310971 times.
|
7417018 | const int dsam1 = (d1 << 1) < beta_2 && (abs(p3n - p0n) + abs(q0n - q3n) < beta_3) && |
738 |
2/2✓ Branch 0 taken 1584437 times.
✓ Branch 1 taken 5479 times.
|
3179832 | abs(p0n - q0n) < tc25; |
739 |
4/4✓ Branch 0 taken 1582197 times.
✓ Branch 1 taken 536396 times.
✓ Branch 2 taken 58077 times.
✓ Branch 3 taken 1524120 times.
|
4237186 | if (!dsam0 || !dsam1) |
740 | 1188946 | max_len_p = max_len_q = 1; | |
741 | } else { | ||
742 | 259512 | max_len_p = max_len_q = 1; | |
743 | } | ||
744 | } | ||
745 | |||
746 |
3/4✓ Branch 0 taken 1290367 times.
✓ Branch 1 taken 1776834 times.
✓ Branch 2 taken 1290367 times.
✗ Branch 3 not taken.
|
6134402 | if (max_len_p == 3 && max_len_q == 3) |
747 | 2580734 | FUNC(loop_filter_chroma_strong)(pix, xstride, ystride, size, tc, no_p, no_q); | |
748 |
2/2✓ Branch 0 taken 233753 times.
✓ Branch 1 taken 1543081 times.
|
3553668 | else if (max_len_q == 3) |
749 | 467506 | FUNC(loop_filter_chroma_strong_one_side)(pix, xstride, ystride, size, tc, no_p, no_q); | |
750 | else | ||
751 | 3086162 | FUNC(loop_filter_chroma_weak)(pix, xstride, ystride, size, tc, no_p, no_q); | |
752 | } | ||
753 | } | ||
754 | 1903456 | } | |
755 | |||
756 | 975946 | static void FUNC(vvc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride, | |
757 | const int32_t *beta, const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q, | ||
758 | const uint8_t *max_len_p, const uint8_t *max_len_q, int shift) | ||
759 | { | ||
760 | 975946 | FUNC(vvc_loop_filter_chroma)(pix, stride, sizeof(pixel), beta, tc, | |
761 | no_p, no_q, max_len_p, max_len_q, shift); | ||
762 | 975946 | } | |
763 | |||
764 | 927510 | static void FUNC(vvc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride, | |
765 | const int32_t *beta, const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q, | ||
766 | const uint8_t *max_len_p, const uint8_t *max_len_q, int shift) | ||
767 | { | ||
768 | 927510 | FUNC(vvc_loop_filter_chroma)(pix, sizeof(pixel), stride, beta, tc, | |
769 | no_p, no_q, max_len_p, max_len_q, shift); | ||
770 | 927510 | } | |
771 | |||
772 | 3194932 | static void FUNC(vvc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, | |
773 | const int32_t *beta, const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q, | ||
774 | const uint8_t *max_len_p, const uint8_t *max_len_q, const int hor_ctu_edge) | ||
775 | { | ||
776 | 3194932 | FUNC(vvc_loop_filter_luma)(pix, stride, sizeof(pixel), beta, tc, | |
777 | no_p, no_q, max_len_p, max_len_q, hor_ctu_edge); | ||
778 | 3194932 | } | |
779 | |||
780 | 3026448 | static void FUNC(vvc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride, | |
781 | const int32_t *beta, const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q, | ||
782 | const uint8_t *max_len_p, const uint8_t *max_len_q, const int hor_ctu_edge) | ||
783 | { | ||
784 | 3026448 | FUNC(vvc_loop_filter_luma)(pix, sizeof(pixel), stride, beta, tc, | |
785 | no_p, no_q, max_len_p, max_len_q, hor_ctu_edge); | ||
786 | 3026448 | } | |
787 | |||
788 | ✗ | static int FUNC(vvc_loop_ladf_level)(const uint8_t *_pix, const ptrdiff_t _xstride, const ptrdiff_t _ystride) | |
789 | { | ||
790 | ✗ | const pixel *pix = (pixel *)_pix; | |
791 | ✗ | const ptrdiff_t xstride = _xstride / sizeof(pixel); | |
792 | ✗ | const ptrdiff_t ystride = _ystride / sizeof(pixel); | |
793 | ✗ | return (P0 + TP0 + Q0 + TQ0) >> 2; | |
794 | } | ||
795 | |||
796 | ✗ | static int FUNC(vvc_h_loop_ladf_level)(const uint8_t *pix, ptrdiff_t stride) | |
797 | { | ||
798 | ✗ | return FUNC(vvc_loop_ladf_level)(pix, stride, sizeof(pixel)); | |
799 | } | ||
800 | |||
801 | ✗ | static int FUNC(vvc_v_loop_ladf_level)(const uint8_t *pix, ptrdiff_t stride) | |
802 | { | ||
803 | ✗ | return FUNC(vvc_loop_ladf_level)(pix, sizeof(pixel), stride); | |
804 | } | ||
805 | |||
806 | #undef P7 | ||
807 | #undef P6 | ||
808 | #undef P5 | ||
809 | #undef P4 | ||
810 | #undef P3 | ||
811 | #undef P2 | ||
812 | #undef P1 | ||
813 | #undef P0 | ||
814 | #undef Q0 | ||
815 | #undef Q1 | ||
816 | #undef Q2 | ||
817 | #undef Q3 | ||
818 | #undef Q4 | ||
819 | #undef Q5 | ||
820 | #undef Q6 | ||
821 | #undef Q7 | ||
822 | |||
823 | #undef TP7 | ||
824 | #undef TP6 | ||
825 | #undef TP5 | ||
826 | #undef TP4 | ||
827 | #undef TP3 | ||
828 | #undef TP2 | ||
829 | #undef TP1 | ||
830 | #undef TP0 | ||
831 | #undef TQ0 | ||
832 | #undef TQ1 | ||
833 | #undef TQ2 | ||
834 | #undef TQ3 | ||
835 | #undef TQ4 | ||
836 | #undef TQ5 | ||
837 | #undef TQ6 | ||
838 | #undef TQ7 | ||
839 | |||
840 | 2134 | static void FUNC(ff_vvc_lmcs_dsp_init)(VVCLMCSDSPContext *const lmcs) | |
841 | { | ||
842 | 2134 | lmcs->filter = FUNC(lmcs_filter_luma); | |
843 | 2134 | } | |
844 | |||
845 | 2134 | static void FUNC(ff_vvc_lf_dsp_init)(VVCLFDSPContext *const lf) | |
846 | { | ||
847 | 2134 | lf->ladf_level[0] = FUNC(vvc_h_loop_ladf_level); | |
848 | 2134 | lf->ladf_level[1] = FUNC(vvc_v_loop_ladf_level); | |
849 | 2134 | lf->filter_luma[0] = FUNC(vvc_h_loop_filter_luma); | |
850 | 2134 | lf->filter_luma[1] = FUNC(vvc_v_loop_filter_luma); | |
851 | 2134 | lf->filter_chroma[0] = FUNC(vvc_h_loop_filter_chroma); | |
852 | 2134 | lf->filter_chroma[1] = FUNC(vvc_v_loop_filter_chroma); | |
853 | 2134 | } | |
854 | |||
855 | 2134 | static void FUNC(ff_vvc_sao_dsp_init)(VVCSAODSPContext *const sao) | |
856 | { | ||
857 |
2/2✓ Branch 0 taken 9603 times.
✓ Branch 1 taken 1067 times.
|
21340 | for (int i = 0; i < FF_ARRAY_ELEMS(sao->band_filter); i++) |
858 | 19206 | sao->band_filter[i] = FUNC(sao_band_filter); | |
859 |
2/2✓ Branch 0 taken 9603 times.
✓ Branch 1 taken 1067 times.
|
21340 | for (int i = 0; i < FF_ARRAY_ELEMS(sao->edge_filter); i++) |
860 | 19206 | sao->edge_filter[i] = FUNC(sao_edge_filter); | |
861 | 2134 | sao->edge_restore[0] = FUNC(sao_edge_restore_0); | |
862 | 2134 | sao->edge_restore[1] = FUNC(sao_edge_restore_1); | |
863 | 2134 | } | |
864 | |||
865 | 2134 | static void FUNC(ff_vvc_alf_dsp_init)(VVCALFDSPContext *const alf) | |
866 | { | ||
867 | 2134 | alf->filter[LUMA] = FUNC(alf_filter_luma); | |
868 | 2134 | alf->filter[CHROMA] = FUNC(alf_filter_chroma); | |
869 | 2134 | alf->filter_cc = FUNC(alf_filter_cc); | |
870 | 2134 | alf->classify = FUNC(alf_classify); | |
871 | 2134 | alf->recon_coeff_and_clip = FUNC(alf_recon_coeff_and_clip); | |
872 | 2134 | } | |
873 |