FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hevc_filter.c
Date: 2024-04-19 17:50:32
Exec Total Coverage
Lines: 551 556 99.1%
Functions: 16 16 100.0%
Branches: 495 511 96.9%

Line Branch Exec Source
1 /*
2 * HEVC video decoder
3 *
4 * Copyright (C) 2012 - 2013 Guillaume Martres
5 * Copyright (C) 2013 Seppo Tomperi
6 * Copyright (C) 2013 Wassim Hamidouche
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 #include "libavutil/common.h"
26 #include "libavutil/internal.h"
27
28 #include "hevcdec.h"
29 #include "progressframe.h"
30
31 #define LUMA 0
32 #define CB 1
33 #define CR 2
34
35 static const uint8_t tctable[54] = {
36 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // QP 0...18
37 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, // QP 19...37
38 5, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24 // QP 38...53
39 };
40
41 static const uint8_t betatable[52] = {
42 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, // QP 0...18
43 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, // QP 19...37
44 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64 // QP 38...51
45 };
46
47 21970238 static int chroma_tc(const HEVCContext *s, int qp_y, int c_idx, int tc_offset)
48 {
49 static const int qp_c[] = {
50 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37
51 };
52 int qp, qp_i, offset, idxt;
53
54 // slice qp offset is not used for deblocking
55
2/2
✓ Branch 0 taken 10985119 times.
✓ Branch 1 taken 10985119 times.
21970238 if (c_idx == 1)
56 10985119 offset = s->ps.pps->cb_qp_offset;
57 else
58 10985119 offset = s->ps.pps->cr_qp_offset;
59
60 21970238 qp_i = av_clip(qp_y + offset, 0, 57);
61
2/2
✓ Branch 0 taken 18490510 times.
✓ Branch 1 taken 3479728 times.
21970238 if (s->ps.sps->chroma_format_idc == 1) {
62
2/2
✓ Branch 0 taken 3108829 times.
✓ Branch 1 taken 15381681 times.
18490510 if (qp_i < 30)
63 3108829 qp = qp_i;
64
2/2
✓ Branch 0 taken 153405 times.
✓ Branch 1 taken 15228276 times.
15381681 else if (qp_i > 43)
65 153405 qp = qp_i - 6;
66 else
67 15228276 qp = qp_c[qp_i - 30];
68 } else {
69 3479728 qp = av_clip(qp_i, 0, 51);
70 }
71
72 21970238 idxt = av_clip(qp + DEFAULT_INTRA_TC_OFFSET + tc_offset, 0, 53);
73 21970238 return tctable[idxt];
74 }
75
76 1398029 static int get_qPy_pred(HEVCLocalContext *lc, const HEVCContext *s,
77 int xBase, int yBase, int log2_cb_size)
78 {
79 1398029 int ctb_size_mask = (1 << s->ps.sps->log2_ctb_size) - 1;
80 1398029 int MinCuQpDeltaSizeMask = (1 << (s->ps.sps->log2_ctb_size -
81 1398029 s->ps.pps->diff_cu_qp_delta_depth)) - 1;
82 1398029 int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
83 1398029 int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
84 1398029 int min_cb_width = s->ps.sps->min_cb_width;
85 1398029 int x_cb = xQgBase >> s->ps.sps->log2_min_cb_size;
86 1398029 int y_cb = yQgBase >> s->ps.sps->log2_min_cb_size;
87
2/2
✓ Branch 0 taken 952743 times.
✓ Branch 1 taken 445286 times.
2350772 int availableA = (xBase & ctb_size_mask) &&
88
2/2
✓ Branch 0 taken 815537 times.
✓ Branch 1 taken 137206 times.
952743 (xQgBase & ctb_size_mask);
89
2/2
✓ Branch 0 taken 935004 times.
✓ Branch 1 taken 463025 times.
2333033 int availableB = (yBase & ctb_size_mask) &&
90
2/2
✓ Branch 0 taken 813265 times.
✓ Branch 1 taken 121739 times.
935004 (yQgBase & ctb_size_mask);
91 int qPy_pred, qPy_a, qPy_b;
92
93 // qPy_pred
94
5/6
✓ Branch 0 taken 1308570 times.
✓ Branch 1 taken 89459 times.
✓ Branch 2 taken 18859 times.
✓ Branch 3 taken 1289711 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18859 times.
1398029 if (lc->first_qp_group || (!xQgBase && !yQgBase)) {
95 89459 lc->first_qp_group = !lc->tu.is_cu_qp_delta_coded;
96 89459 qPy_pred = s->sh.slice_qp;
97 } else {
98 1308570 qPy_pred = lc->qPy_pred;
99 }
100
101 // qPy_a
102
2/2
✓ Branch 0 taken 582492 times.
✓ Branch 1 taken 815537 times.
1398029 if (availableA == 0)
103 582492 qPy_a = qPy_pred;
104 else
105 815537 qPy_a = s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width];
106
107 // qPy_b
108
2/2
✓ Branch 0 taken 584764 times.
✓ Branch 1 taken 813265 times.
1398029 if (availableB == 0)
109 584764 qPy_b = qPy_pred;
110 else
111 813265 qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
112
113 av_assert2(qPy_a >= -s->ps.sps->qp_bd_offset && qPy_a < 52);
114 av_assert2(qPy_b >= -s->ps.sps->qp_bd_offset && qPy_b < 52);
115
116 1398029 return (qPy_a + qPy_b + 1) >> 1;
117 }
118
119 1398029 void ff_hevc_set_qPy(HEVCLocalContext *lc, int xBase, int yBase, int log2_cb_size)
120 {
121 1398029 const HEVCContext *const s = lc->parent;
122 1398029 int qp_y = get_qPy_pred(lc, s, xBase, yBase, log2_cb_size);
123
124
2/2
✓ Branch 0 taken 370889 times.
✓ Branch 1 taken 1027140 times.
1398029 if (lc->tu.cu_qp_delta != 0) {
125 370889 int off = s->ps.sps->qp_bd_offset;
126
1/2
✓ Branch 0 taken 370889 times.
✗ Branch 1 not taken.
370889 lc->qp_y = FFUMOD(qp_y + lc->tu.cu_qp_delta + 52 + 2 * off,
127 370889 52 + off) - off;
128 } else
129 1027140 lc->qp_y = qp_y;
130 1398029 }
131
132 114844916 static int get_qPy(const HEVCContext *s, int xC, int yC)
133 {
134 114844916 int log2_min_cb_size = s->ps.sps->log2_min_cb_size;
135 114844916 int x = xC >> log2_min_cb_size;
136 114844916 int y = yC >> log2_min_cb_size;
137 114844916 return s->qp_y_tab[x + y * s->ps.sps->min_cb_width];
138 }
139
140 381293 static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height,
141 ptrdiff_t stride_dst, ptrdiff_t stride_src)
142 {
143 int i, j;
144
145
2/2
✓ Branch 0 taken 55930 times.
✓ Branch 1 taken 325363 times.
381293 if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) {
146
2/2
✓ Branch 0 taken 2429296 times.
✓ Branch 1 taken 55930 times.
2485226 for (i = 0; i < height; i++) {
147
2/2
✓ Branch 0 taken 17008720 times.
✓ Branch 1 taken 2429296 times.
19438016 for (j = 0; j < width - 7; j+=8)
148 17008720 AV_COPY64U(dst+j, src+j);
149 2429296 dst += stride_dst;
150 2429296 src += stride_src;
151 }
152
2/2
✓ Branch 0 taken 55730 times.
✓ Branch 1 taken 200 times.
55930 if (width&7) {
153 55730 dst += ((width>>3)<<3) - stride_dst * height;
154 55730 src += ((width>>3)<<3) - stride_src * height;
155 55730 width &= 7;
156
2/2
✓ Branch 0 taken 2427696 times.
✓ Branch 1 taken 55730 times.
2483426 for (i = 0; i < height; i++) {
157
2/2
✓ Branch 0 taken 5304696 times.
✓ Branch 1 taken 2427696 times.
7732392 for (j = 0; j < width; j++)
158 5304696 dst[j] = src[j];
159 2427696 dst += stride_dst;
160 2427696 src += stride_src;
161 }
162 }
163 } else {
164
2/2
✓ Branch 0 taken 17136480 times.
✓ Branch 1 taken 325363 times.
17461843 for (i = 0; i < height; i++) {
165
2/2
✓ Branch 0 taken 87179528 times.
✓ Branch 1 taken 17136480 times.
104316008 for (j = 0; j < width; j+=16)
166 87179528 AV_COPY128(dst+j, src+j);
167 17136480 dst += stride_dst;
168 17136480 src += stride_src;
169 }
170 }
171 381293 }
172
173 1343125 static void copy_pixel(uint8_t *dst, const uint8_t *src, int pixel_shift)
174 {
175
2/2
✓ Branch 0 taken 223258 times.
✓ Branch 1 taken 1119867 times.
1343125 if (pixel_shift)
176 223258 *(uint16_t *)dst = *(uint16_t *)src;
177 else
178 1119867 *dst = *src;
179 1343125 }
180
181 1293049 static void copy_vert(uint8_t *dst, const uint8_t *src,
182 int pixel_shift, int height,
183 ptrdiff_t stride_dst, ptrdiff_t stride_src)
184 {
185 int i;
186
2/2
✓ Branch 0 taken 1111619 times.
✓ Branch 1 taken 181430 times.
1293049 if (pixel_shift == 0) {
187
2/2
✓ Branch 0 taken 52394960 times.
✓ Branch 1 taken 1111619 times.
53506579 for (i = 0; i < height; i++) {
188 52394960 *dst = *src;
189 52394960 dst += stride_dst;
190 52394960 src += stride_src;
191 }
192 } else {
193
2/2
✓ Branch 0 taken 11292912 times.
✓ Branch 1 taken 181430 times.
11474342 for (i = 0; i < height; i++) {
194 11292912 *(uint16_t *)dst = *(uint16_t *)src;
195 11292912 dst += stride_dst;
196 11292912 src += stride_src;
197 }
198 }
199 1293049 }
200
201 492320 static void copy_CTB_to_hv(const HEVCContext *s, const uint8_t *src,
202 ptrdiff_t stride_src, int x, int y, int width, int height,
203 int c_idx, int x_ctb, int y_ctb)
204 {
205 492320 int sh = s->ps.sps->pixel_shift;
206 492320 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
207 492320 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
208
209 /* copy horizontal edges */
210 492320 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << sh),
211 492320 src, width << sh);
212 492320 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << sh),
213 492320 src + stride_src * (height - 1), width << sh);
214
215 /* copy vertical edges */
216 492320 copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << sh), src, sh, height, 1 << sh, stride_src);
217
218 492320 copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 1) * h + y) << sh), src + ((width - 1) << sh), sh, height, 1 << sh, stride_src);
219 492320 }
220
221 381293 static void restore_tqb_pixels(const HEVCContext *s,
222 uint8_t *src1, const uint8_t *dst1,
223 ptrdiff_t stride_src, ptrdiff_t stride_dst,
224 int x0, int y0, int width, int height, int c_idx)
225 {
226
2/2
✓ Branch 0 taken 377004 times.
✓ Branch 1 taken 4289 times.
381293 if ( s->ps.pps->transquant_bypass_enable_flag ||
227
3/4
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 376900 times.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
377004 (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
228 int x, y;
229 4393 int min_pu_size = 1 << s->ps.sps->log2_min_pu_size;
230 4393 int hshift = s->ps.sps->hshift[c_idx];
231 4393 int vshift = s->ps.sps->vshift[c_idx];
232 4393 int x_min = ((x0 ) >> s->ps.sps->log2_min_pu_size);
233 4393 int y_min = ((y0 ) >> s->ps.sps->log2_min_pu_size);
234 4393 int x_max = ((x0 + width ) >> s->ps.sps->log2_min_pu_size);
235 4393 int y_max = ((y0 + height) >> s->ps.sps->log2_min_pu_size);
236 4393 int len = (min_pu_size >> hshift) << s->ps.sps->pixel_shift;
237
2/2
✓ Branch 0 taken 49472 times.
✓ Branch 1 taken 4393 times.
53865 for (y = y_min; y < y_max; y++) {
238
2/2
✓ Branch 0 taken 632704 times.
✓ Branch 1 taken 49472 times.
682176 for (x = x_min; x < x_max; x++) {
239
2/2
✓ Branch 0 taken 264 times.
✓ Branch 1 taken 632440 times.
632704 if (s->is_pcm[y * s->ps.sps->min_pu_width + x]) {
240 int n;
241 264 uint8_t *src = src1 + (((y << s->ps.sps->log2_min_pu_size) - y0) >> vshift) * stride_src + ((((x << s->ps.sps->log2_min_pu_size) - x0) >> hshift) << s->ps.sps->pixel_shift);
242 264 const uint8_t *dst = dst1 + (((y << s->ps.sps->log2_min_pu_size) - y0) >> vshift) * stride_dst + ((((x << s->ps.sps->log2_min_pu_size) - x0) >> hshift) << s->ps.sps->pixel_shift);
243
2/2
✓ Branch 0 taken 704 times.
✓ Branch 1 taken 264 times.
968 for (n = 0; n < (min_pu_size >> vshift); n++) {
244 704 memcpy(src, dst, len);
245 704 src += stride_src;
246 704 dst += stride_dst;
247 }
248 }
249 }
250 }
251 }
252 381293 }
253
254 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
255
256 1196103 static void sao_filter_CTB(HEVCLocalContext *lc, const HEVCContext *s, int x, int y)
257 {
258 static const uint8_t sao_tab[8] = { 0, 1, 2, 2, 3, 3, 4, 4 };
259 int c_idx;
260 int edges[4]; // 0 left 1 top 2 right 3 bottom
261 1196103 int x_ctb = x >> s->ps.sps->log2_ctb_size;
262 1196103 int y_ctb = y >> s->ps.sps->log2_ctb_size;
263 1196103 int ctb_addr_rs = y_ctb * s->ps.sps->ctb_width + x_ctb;
264 1196103 int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
265 1196103 SAOParams *sao = &CTB(s->sao, x_ctb, y_ctb);
266 // flags indicating unfilterable edges
267 1196103 uint8_t vert_edge[] = { 0, 0 };
268 1196103 uint8_t horiz_edge[] = { 0, 0 };
269 1196103 uint8_t diag_edge[] = { 0, 0, 0, 0 };
270 1196103 uint8_t lfase = CTB(s->filter_slice_edges, x_ctb, y_ctb);
271
2/2
✓ Branch 0 taken 170200 times.
✓ Branch 1 taken 1025903 times.
1366303 uint8_t no_tile_filter = s->ps.pps->tiles_enabled_flag &&
272
2/2
✓ Branch 0 taken 16664 times.
✓ Branch 1 taken 153536 times.
170200 !s->ps.pps->loop_filter_across_tiles_enabled_flag;
273
4/4
✓ Branch 0 taken 1179439 times.
✓ Branch 1 taken 16664 times.
✓ Branch 2 taken 52450 times.
✓ Branch 3 taken 1126989 times.
1196103 uint8_t restore = no_tile_filter || !lfase;
274 1196103 uint8_t left_tile_edge = 0;
275 1196103 uint8_t right_tile_edge = 0;
276 1196103 uint8_t up_tile_edge = 0;
277 1196103 uint8_t bottom_tile_edge = 0;
278
279 1196103 edges[0] = x_ctb == 0;
280 1196103 edges[1] = y_ctb == 0;
281 1196103 edges[2] = x_ctb == s->ps.sps->ctb_width - 1;
282 1196103 edges[3] = y_ctb == s->ps.sps->ctb_height - 1;
283
284
2/2
✓ Branch 0 taken 69114 times.
✓ Branch 1 taken 1126989 times.
1196103 if (restore) {
285
2/2
✓ Branch 0 taken 65478 times.
✓ Branch 1 taken 3636 times.
69114 if (!edges[0]) {
286
4/4
✓ Branch 0 taken 16242 times.
✓ Branch 1 taken 49236 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 15406 times.
65478 left_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]];
287
6/6
✓ Branch 0 taken 49236 times.
✓ Branch 1 taken 16242 times.
✓ Branch 2 taken 49029 times.
✓ Branch 3 taken 207 times.
✓ Branch 4 taken 836 times.
✓ Branch 5 taken 64435 times.
65478 vert_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb)) || left_tile_edge;
288 }
289
2/2
✓ Branch 0 taken 65479 times.
✓ Branch 1 taken 3635 times.
69114 if (!edges[2]) {
290
4/4
✓ Branch 0 taken 16242 times.
✓ Branch 1 taken 49237 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 15406 times.
65479 right_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs+1]];
291
6/6
✓ Branch 0 taken 49237 times.
✓ Branch 1 taken 16242 times.
✓ Branch 2 taken 49030 times.
✓ Branch 3 taken 207 times.
✓ Branch 4 taken 836 times.
✓ Branch 5 taken 64436 times.
65479 vert_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb)) || right_tile_edge;
292 }
293
2/2
✓ Branch 0 taken 62780 times.
✓ Branch 1 taken 6334 times.
69114 if (!edges[1]) {
294
4/4
✓ Branch 0 taken 15931 times.
✓ Branch 1 taken 46849 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 14491 times.
62780 up_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs - s->ps.sps->ctb_width]];
295
6/6
✓ Branch 0 taken 46849 times.
✓ Branch 1 taken 15931 times.
✓ Branch 2 taken 45409 times.
✓ Branch 3 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 59900 times.
62780 horiz_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb, y_ctb - 1)) || up_tile_edge;
296 }
297
2/2
✓ Branch 0 taken 62810 times.
✓ Branch 1 taken 6304 times.
69114 if (!edges[3]) {
298
4/4
✓ Branch 0 taken 15931 times.
✓ Branch 1 taken 46879 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 14491 times.
62810 bottom_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs + s->ps.sps->ctb_width]];
299
6/6
✓ Branch 0 taken 46879 times.
✓ Branch 1 taken 15931 times.
✓ Branch 2 taken 45439 times.
✓ Branch 3 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 59930 times.
62810 horiz_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb, y_ctb + 1)) || bottom_tile_edge;
300 }
301
4/4
✓ Branch 0 taken 65478 times.
✓ Branch 1 taken 3636 times.
✓ Branch 2 taken 59755 times.
✓ Branch 3 taken 5723 times.
69114 if (!edges[0] && !edges[1]) {
302
8/8
✓ Branch 0 taken 44227 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 42643 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 57372 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 56040 times.
59755 diag_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb - 1)) || left_tile_edge || up_tile_edge;
303 }
304
4/4
✓ Branch 0 taken 62780 times.
✓ Branch 1 taken 6334 times.
✓ Branch 2 taken 59756 times.
✓ Branch 3 taken 3024 times.
69114 if (!edges[1] && !edges[2]) {
305
8/8
✓ Branch 0 taken 44228 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 42644 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 57373 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 56041 times.
59756 diag_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb - 1)) || right_tile_edge || up_tile_edge;
306 }
307
4/4
✓ Branch 0 taken 65479 times.
✓ Branch 1 taken 3635 times.
✓ Branch 2 taken 59785 times.
✓ Branch 3 taken 5694 times.
69114 if (!edges[2] && !edges[3]) {
308
8/8
✓ Branch 0 taken 44257 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 42673 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 57402 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 56070 times.
59785 diag_edge[2] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb + 1)) || right_tile_edge || bottom_tile_edge;
309 }
310
4/4
✓ Branch 0 taken 65478 times.
✓ Branch 1 taken 3636 times.
✓ Branch 2 taken 59784 times.
✓ Branch 3 taken 5694 times.
69114 if (!edges[0] && !edges[3]) {
311
8/8
✓ Branch 0 taken 44256 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 42672 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 57401 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 56069 times.
59784 diag_edge[3] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb + 1)) || left_tile_edge || bottom_tile_edge;
312 }
313 }
314
315
4/4
✓ Branch 0 taken 4784220 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 3588213 times.
✓ Branch 3 taken 1196103 times.
4784316 for (c_idx = 0; c_idx < (s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
316 3588213 int x0 = x >> s->ps.sps->hshift[c_idx];
317 3588213 int y0 = y >> s->ps.sps->vshift[c_idx];
318 3588213 ptrdiff_t stride_src = s->frame->linesize[c_idx];
319 3588213 int ctb_size_h = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->hshift[c_idx];
320 3588213 int ctb_size_v = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->vshift[c_idx];
321 3588213 int width = FFMIN(ctb_size_h, (s->ps.sps->width >> s->ps.sps->hshift[c_idx]) - x0);
322 3588213 int height = FFMIN(ctb_size_v, (s->ps.sps->height >> s->ps.sps->vshift[c_idx]) - y0);
323 3588213 int tab = sao_tab[(FFALIGN(width, 8) >> 3) - 1];
324 3588213 uint8_t *src = &s->frame->data[c_idx][y0 * stride_src + (x0 << s->ps.sps->pixel_shift)];
325 ptrdiff_t stride_dst;
326 uint8_t *dst;
327
328
3/3
✓ Branch 0 taken 111796 times.
✓ Branch 1 taken 380524 times.
✓ Branch 2 taken 3095893 times.
3588213 switch (sao->type_idx[c_idx]) {
329 111796 case SAO_BAND:
330 111796 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
331 x_ctb, y_ctb);
332
2/2
✓ Branch 0 taken 111035 times.
✓ Branch 1 taken 761 times.
111796 if (s->ps.pps->transquant_bypass_enable_flag ||
333
3/4
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 111027 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
111035 (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
334 769 dst = lc->edge_emu_buffer;
335 769 stride_dst = 2*MAX_PB_SIZE;
336 769 copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src);
337 769 s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst,
338 769 sao->offset_val[c_idx], sao->band_position[c_idx],
339 width, height);
340 769 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
341 x, y, width, height, c_idx);
342 } else {
343 111027 s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src,
344 111027 sao->offset_val[c_idx], sao->band_position[c_idx],
345 width, height);
346 }
347 111796 sao->type_idx[c_idx] = SAO_APPLIED;
348 111796 break;
349 380524 case SAO_EDGE:
350 {
351 380524 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
352 380524 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
353 380524 int left_edge = edges[0];
354 380524 int top_edge = edges[1];
355 380524 int right_edge = edges[2];
356 380524 int bottom_edge = edges[3];
357 380524 int sh = s->ps.sps->pixel_shift;
358 int left_pixels, right_pixels;
359
360 380524 stride_dst = 2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE;
361 380524 dst = lc->edge_emu_buffer + stride_dst + AV_INPUT_BUFFER_PADDING_SIZE;
362
363
2/2
✓ Branch 0 taken 354492 times.
✓ Branch 1 taken 26032 times.
380524 if (!top_edge) {
364 354492 int left = 1 - left_edge;
365 354492 int right = 1 - right_edge;
366 const uint8_t *src1[2];
367 uint8_t *dst1;
368 int src_idx, pos;
369
370 354492 dst1 = dst - stride_dst - (left << sh);
371 354492 src1[0] = src - stride_src - (left << sh);
372 354492 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0 - left) << sh);
373 354492 pos = 0;
374
2/2
✓ Branch 0 taken 337757 times.
✓ Branch 1 taken 16735 times.
354492 if (left) {
375 337757 src_idx = (CTB(s->sao, x_ctb-1, y_ctb-1).type_idx[c_idx] ==
376 SAO_APPLIED);
377 337757 copy_pixel(dst1, src1[src_idx], sh);
378 337757 pos += (1 << sh);
379 }
380 354492 src_idx = (CTB(s->sao, x_ctb, y_ctb-1).type_idx[c_idx] ==
381 SAO_APPLIED);
382 354492 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
383
2/2
✓ Branch 0 taken 337433 times.
✓ Branch 1 taken 17059 times.
354492 if (right) {
384 337433 pos += width << sh;
385 337433 src_idx = (CTB(s->sao, x_ctb+1, y_ctb-1).type_idx[c_idx] ==
386 SAO_APPLIED);
387 337433 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
388 }
389 }
390
2/2
✓ Branch 0 taken 350451 times.
✓ Branch 1 taken 30073 times.
380524 if (!bottom_edge) {
391 350451 int left = 1 - left_edge;
392 350451 int right = 1 - right_edge;
393 const uint8_t *src1[2];
394 uint8_t *dst1;
395 int src_idx, pos;
396
397 350451 dst1 = dst + height * stride_dst - (left << sh);
398 350451 src1[0] = src + height * stride_src - (left << sh);
399 350451 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0 - left) << sh);
400 350451 pos = 0;
401
2/2
✓ Branch 0 taken 334292 times.
✓ Branch 1 taken 16159 times.
350451 if (left) {
402 334292 src_idx = (CTB(s->sao, x_ctb-1, y_ctb+1).type_idx[c_idx] ==
403 SAO_APPLIED);
404 334292 copy_pixel(dst1, src1[src_idx], sh);
405 334292 pos += (1 << sh);
406 }
407 350451 src_idx = (CTB(s->sao, x_ctb, y_ctb+1).type_idx[c_idx] ==
408 SAO_APPLIED);
409 350451 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
410
2/2
✓ Branch 0 taken 333643 times.
✓ Branch 1 taken 16808 times.
350451 if (right) {
411 333643 pos += width << sh;
412 333643 src_idx = (CTB(s->sao, x_ctb+1, y_ctb+1).type_idx[c_idx] ==
413 SAO_APPLIED);
414 333643 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
415 }
416 }
417 380524 left_pixels = 0;
418
2/2
✓ Branch 0 taken 361773 times.
✓ Branch 1 taken 18751 times.
380524 if (!left_edge) {
419
2/2
✓ Branch 0 taken 308409 times.
✓ Branch 1 taken 53364 times.
361773 if (CTB(s->sao, x_ctb-1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
420 308409 copy_vert(dst - (1 << sh),
421 308409 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh),
422 308409 sh, height, stride_dst, 1 << sh);
423 } else {
424 53364 left_pixels = 1;
425 }
426 }
427 380524 right_pixels = 0;
428
2/2
✓ Branch 0 taken 361341 times.
✓ Branch 1 taken 19183 times.
380524 if (!right_edge) {
429
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 361341 times.
361341 if (CTB(s->sao, x_ctb+1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
430 copy_vert(dst + (width << sh),
431 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) * h + y0) << sh),
432 sh, height, stride_dst, 1 << sh);
433 } else {
434 361341 right_pixels = 1;
435 }
436 }
437
438 380524 copy_CTB(dst - (left_pixels << sh),
439 380524 src - (left_pixels << sh),
440 380524 (width + left_pixels + right_pixels) << sh,
441 height, stride_dst, stride_src);
442
443 380524 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
444 x_ctb, y_ctb);
445 380524 s->hevcdsp.sao_edge_filter[tab](src, dst, stride_src, sao->offset_val[c_idx],
446 sao->eo_class[c_idx], width, height);
447 380524 s->hevcdsp.sao_edge_restore[restore](src, dst,
448 stride_src, stride_dst,
449 sao,
450 edges, width,
451 height, c_idx,
452 vert_edge,
453 horiz_edge,
454 diag_edge);
455 380524 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
456 x, y, width, height, c_idx);
457 380524 sao->type_idx[c_idx] = SAO_APPLIED;
458 380524 break;
459 }
460 }
461 }
462 1196103 }
463
464 2057768 static int get_pcm(const HEVCContext *s, int x, int y)
465 {
466 2057768 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
467 int x_pu, y_pu;
468
469
2/4
✓ Branch 0 taken 2057768 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2057768 times.
2057768 if (x < 0 || y < 0)
470 return 2;
471
472 2057768 x_pu = x >> log2_min_pu_size;
473 2057768 y_pu = y >> log2_min_pu_size;
474
475
3/4
✓ Branch 0 taken 2057768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1408 times.
✓ Branch 3 taken 2056360 times.
2057768 if (x_pu >= s->ps.sps->min_pu_width || y_pu >= s->ps.sps->min_pu_height)
476 1408 return 2;
477 2056360 return s->is_pcm[y_pu * s->ps.sps->min_pu_width + x_pu];
478 }
479
480 #define TC_CALC(qp, bs) \
481 tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + \
482 (tc_offset & -2), \
483 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
484
485 1413124 static void deblocking_filter_CTB(const HEVCContext *s, int x0, int y0)
486 {
487 uint8_t *src;
488 int x, y;
489 int chroma, beta;
490 int32_t c_tc[2], tc[2];
491 1413124 uint8_t no_p[2] = { 0 };
492 1413124 uint8_t no_q[2] = { 0 };
493
494 1413124 int log2_ctb_size = s->ps.sps->log2_ctb_size;
495 int x_end, x_end2, y_end;
496 1413124 int ctb_size = 1 << log2_ctb_size;
497 1413124 int ctb = (x0 >> log2_ctb_size) +
498 1413124 (y0 >> log2_ctb_size) * s->ps.sps->ctb_width;
499 1413124 int cur_tc_offset = s->deblock[ctb].tc_offset;
500 1413124 int cur_beta_offset = s->deblock[ctb].beta_offset;
501 int left_tc_offset, left_beta_offset;
502 int tc_offset, beta_offset;
503 2913629 int pcmf = (s->ps.sps->pcm_enabled_flag &&
504
4/4
✓ Branch 0 taken 87381 times.
✓ Branch 1 taken 1325743 times.
✓ Branch 2 taken 87325 times.
✓ Branch 3 taken 56 times.
2826192 s->ps.sps->pcm.loop_filter_disable_flag) ||
505
2/2
✓ Branch 0 taken 4570 times.
✓ Branch 1 taken 1408498 times.
1413068 s->ps.pps->transquant_bypass_enable_flag;
506
507
2/2
✓ Branch 0 taken 1339887 times.
✓ Branch 1 taken 73237 times.
1413124 if (x0) {
508 1339887 left_tc_offset = s->deblock[ctb - 1].tc_offset;
509 1339887 left_beta_offset = s->deblock[ctb - 1].beta_offset;
510 } else {
511 73237 left_tc_offset = 0;
512 73237 left_beta_offset = 0;
513 }
514
515 1413124 x_end = x0 + ctb_size;
516
2/2
✓ Branch 0 taken 25412 times.
✓ Branch 1 taken 1387712 times.
1413124 if (x_end > s->ps.sps->width)
517 25412 x_end = s->ps.sps->width;
518 1413124 y_end = y0 + ctb_size;
519
2/2
✓ Branch 0 taken 96215 times.
✓ Branch 1 taken 1316909 times.
1413124 if (y_end > s->ps.sps->height)
520 96215 y_end = s->ps.sps->height;
521
522 1413124 tc_offset = cur_tc_offset;
523 1413124 beta_offset = cur_beta_offset;
524
525 1413124 x_end2 = x_end;
526
2/2
✓ Branch 0 taken 1339888 times.
✓ Branch 1 taken 73236 times.
1413124 if (x_end2 != s->ps.sps->width)
527 1339888 x_end2 -= 8;
528
2/2
✓ Branch 0 taken 10151142 times.
✓ Branch 1 taken 1413124 times.
11564266 for (y = y0; y < y_end; y += 8) {
529 // vertical filtering luma
530
4/4
✓ Branch 0 taken 9620090 times.
✓ Branch 1 taken 531052 times.
✓ Branch 2 taken 77110520 times.
✓ Branch 3 taken 10151142 times.
87261662 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
531 77110520 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
532 77110520 const int bs1 = s->vertical_bs[(x + (y + 4) * s->bs_width) >> 2];
533
4/4
✓ Branch 0 taken 59774987 times.
✓ Branch 1 taken 17335533 times.
✓ Branch 2 taken 89497 times.
✓ Branch 3 taken 59685490 times.
77110520 if (bs0 || bs1) {
534 17425030 const int qp = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
535
536 17425030 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
537
538
2/2
✓ Branch 0 taken 17335533 times.
✓ Branch 1 taken 89497 times.
17425030 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
539
2/2
✓ Branch 0 taken 17328892 times.
✓ Branch 1 taken 96138 times.
17425030 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
540 17425030 src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
541
2/2
✓ Branch 0 taken 186079 times.
✓ Branch 1 taken 17238951 times.
17425030 if (pcmf) {
542 186079 no_p[0] = get_pcm(s, x - 1, y);
543 186079 no_p[1] = get_pcm(s, x - 1, y + 4);
544 186079 no_q[0] = get_pcm(s, x, y);
545 186079 no_q[1] = get_pcm(s, x, y + 4);
546 186079 s->hevcdsp.hevc_v_loop_filter_luma_c(src,
547 186079 s->frame->linesize[LUMA],
548 beta, tc, no_p, no_q);
549 } else
550 17238951 s->hevcdsp.hevc_v_loop_filter_luma(src,
551 17238951 s->frame->linesize[LUMA],
552 beta, tc, no_p, no_q);
553 }
554 }
555
556
2/2
✓ Branch 0 taken 119206 times.
✓ Branch 1 taken 10031936 times.
10151142 if(!y)
557 119206 continue;
558
559 // horizontal filtering luma
560
4/4
✓ Branch 0 taken 9510415 times.
✓ Branch 1 taken 521521 times.
✓ Branch 2 taken 76767751 times.
✓ Branch 3 taken 10031936 times.
86799687 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
561 76767751 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
562 76767751 const int bs1 = s->horizontal_bs[((x + 4) + y * s->bs_width) >> 2];
563
4/4
✓ Branch 0 taken 59109207 times.
✓ Branch 1 taken 17658544 times.
✓ Branch 2 taken 106170 times.
✓ Branch 3 taken 59003037 times.
76767751 if (bs0 || bs1) {
564 17764714 const int qp = (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1;
565
566
2/2
✓ Branch 0 taken 15545537 times.
✓ Branch 1 taken 2219177 times.
17764714 tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
567
2/2
✓ Branch 0 taken 15545537 times.
✓ Branch 1 taken 2219177 times.
17764714 beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
568
569 17764714 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
570
2/2
✓ Branch 0 taken 17658544 times.
✓ Branch 1 taken 106170 times.
17764714 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
571
2/2
✓ Branch 0 taken 17643819 times.
✓ Branch 1 taken 120895 times.
17764714 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
572 17764714 src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
573
2/2
✓ Branch 0 taken 187803 times.
✓ Branch 1 taken 17576911 times.
17764714 if (pcmf) {
574 187803 no_p[0] = get_pcm(s, x, y - 1);
575 187803 no_p[1] = get_pcm(s, x + 4, y - 1);
576 187803 no_q[0] = get_pcm(s, x, y);
577 187803 no_q[1] = get_pcm(s, x + 4, y);
578 187803 s->hevcdsp.hevc_h_loop_filter_luma_c(src,
579 187803 s->frame->linesize[LUMA],
580 beta, tc, no_p, no_q);
581 } else
582 17576911 s->hevcdsp.hevc_h_loop_filter_luma(src,
583 17576911 s->frame->linesize[LUMA],
584 beta, tc, no_p, no_q);
585 }
586 }
587 }
588
589
2/2
✓ Branch 0 taken 1413076 times.
✓ Branch 1 taken 48 times.
1413124 if (s->ps.sps->chroma_format_idc) {
590
2/2
✓ Branch 0 taken 2826152 times.
✓ Branch 1 taken 1413076 times.
4239228 for (chroma = 1; chroma <= 2; chroma++) {
591 2826152 int h = 1 << s->ps.sps->hshift[chroma];
592 2826152 int v = 1 << s->ps.sps->vshift[chroma];
593
594 // vertical filtering chroma
595
2/2
✓ Branch 0 taken 10624520 times.
✓ Branch 1 taken 2826152 times.
13450672 for (y = y0; y < y_end; y += (8 * v)) {
596
4/4
✓ Branch 0 taken 544336 times.
✓ Branch 1 taken 10080184 times.
✓ Branch 2 taken 40936382 times.
✓ Branch 3 taken 10624520 times.
51560902 for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
597 40936382 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
598 40936382 const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * s->bs_width) >> 2];
599
600
4/4
✓ Branch 0 taken 35292648 times.
✓ Branch 1 taken 5643734 times.
✓ Branch 2 taken 128734 times.
✓ Branch 3 taken 35163914 times.
40936382 if ((bs0 == 2) || (bs1 == 2)) {
601 5772468 const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
602 5772468 const int qp1 = (get_qPy(s, x - 1, y + (4 * v)) + get_qPy(s, x, y + (4 * v)) + 1) >> 1;
603
604
2/2
✓ Branch 0 taken 5643734 times.
✓ Branch 1 taken 128734 times.
5772468 c_tc[0] = (bs0 == 2) ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
605
2/2
✓ Branch 0 taken 5638726 times.
✓ Branch 1 taken 133742 times.
5772468 c_tc[1] = (bs1 == 2) ? chroma_tc(s, qp1, chroma, tc_offset) : 0;
606 5772468 src = &s->frame->data[chroma][(y >> s->ps.sps->vshift[chroma]) * s->frame->linesize[chroma] + ((x >> s->ps.sps->hshift[chroma]) << s->ps.sps->pixel_shift)];
607
2/2
✓ Branch 0 taken 70838 times.
✓ Branch 1 taken 5701630 times.
5772468 if (pcmf) {
608 70838 no_p[0] = get_pcm(s, x - 1, y);
609 70838 no_p[1] = get_pcm(s, x - 1, y + (4 * v));
610 70838 no_q[0] = get_pcm(s, x, y);
611 70838 no_q[1] = get_pcm(s, x, y + (4 * v));
612 70838 s->hevcdsp.hevc_v_loop_filter_chroma_c(src,
613 70838 s->frame->linesize[chroma],
614 c_tc, no_p, no_q);
615 } else
616 5701630 s->hevcdsp.hevc_v_loop_filter_chroma(src,
617 5701630 s->frame->linesize[chroma],
618 c_tc, no_p, no_q);
619 }
620 }
621
622
2/2
✓ Branch 0 taken 238388 times.
✓ Branch 1 taken 10386132 times.
10624520 if(!y)
623 238388 continue;
624
625 // horizontal filtering chroma
626
2/2
✓ Branch 0 taken 9860854 times.
✓ Branch 1 taken 525278 times.
10386132 tc_offset = x0 ? left_tc_offset : cur_tc_offset;
627 10386132 x_end2 = x_end;
628
2/2
✓ Branch 0 taken 9860862 times.
✓ Branch 1 taken 525270 times.
10386132 if (x_end != s->ps.sps->width)
629 9860862 x_end2 = x_end - 8 * h;
630
4/4
✓ Branch 0 taken 9860854 times.
✓ Branch 1 taken 525278 times.
✓ Branch 2 taken 40600310 times.
✓ Branch 3 taken 10386132 times.
50986442 for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
631 40600310 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
632 40600310 const int bs1 = s->horizontal_bs[((x + 4 * h) + y * s->bs_width) >> 2];
633
4/4
✓ Branch 0 taken 35255640 times.
✓ Branch 1 taken 5344670 times.
✓ Branch 2 taken 134102 times.
✓ Branch 3 taken 35121538 times.
40600310 if ((bs0 == 2) || (bs1 == 2)) {
634
2/2
✓ Branch 0 taken 5344670 times.
✓ Branch 1 taken 134102 times.
5478772 const int qp0 = bs0 == 2 ? (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1 : 0;
635
2/2
✓ Branch 0 taken 5343108 times.
✓ Branch 1 taken 135664 times.
5478772 const int qp1 = bs1 == 2 ? (get_qPy(s, x + (4 * h), y - 1) + get_qPy(s, x + (4 * h), y) + 1) >> 1 : 0;
636
637
2/2
✓ Branch 0 taken 5344670 times.
✓ Branch 1 taken 134102 times.
5478772 c_tc[0] = bs0 == 2 ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
638
2/2
✓ Branch 0 taken 5343108 times.
✓ Branch 1 taken 135664 times.
5478772 c_tc[1] = bs1 == 2 ? chroma_tc(s, qp1, chroma, cur_tc_offset) : 0;
639 5478772 src = &s->frame->data[chroma][(y >> s->ps.sps->vshift[1]) * s->frame->linesize[chroma] + ((x >> s->ps.sps->hshift[1]) << s->ps.sps->pixel_shift)];
640
2/2
✓ Branch 0 taken 69722 times.
✓ Branch 1 taken 5409050 times.
5478772 if (pcmf) {
641 69722 no_p[0] = get_pcm(s, x, y - 1);
642 69722 no_p[1] = get_pcm(s, x + (4 * h), y - 1);
643 69722 no_q[0] = get_pcm(s, x, y);
644 69722 no_q[1] = get_pcm(s, x + (4 * h), y);
645 69722 s->hevcdsp.hevc_h_loop_filter_chroma_c(src,
646 69722 s->frame->linesize[chroma],
647 c_tc, no_p, no_q);
648 } else
649 5409050 s->hevcdsp.hevc_h_loop_filter_chroma(src,
650 5409050 s->frame->linesize[chroma],
651 c_tc, no_p, no_q);
652 }
653 }
654 }
655 }
656 }
657 1413124 }
658
659 229027203 static int boundary_strength(const HEVCContext *s, const MvField *curr, const MvField *neigh,
660 const RefPicList *neigh_refPicList)
661 {
662
4/4
✓ Branch 0 taken 145509534 times.
✓ Branch 1 taken 83517669 times.
✓ Branch 2 taken 141166124 times.
✓ Branch 3 taken 4343410 times.
229027203 if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) {
663 // same L0 and L1
664
2/2
✓ Branch 0 taken 139467841 times.
✓ Branch 1 taken 1698283 times.
141166124 if (s->ref->refPicList[0].list[curr->ref_idx[0]] == neigh_refPicList[0].list[neigh->ref_idx[0]] &&
665
2/2
✓ Branch 0 taken 18325892 times.
✓ Branch 1 taken 121141949 times.
139467841 s->ref->refPicList[0].list[curr->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]] &&
666
2/2
✓ Branch 0 taken 18187439 times.
✓ Branch 1 taken 138453 times.
18325892 neigh_refPicList[0].list[neigh->ref_idx[0]] == neigh_refPicList[1].list[neigh->ref_idx[1]]) {
667
4/4
✓ Branch 0 taken 17897806 times.
✓ Branch 1 taken 289633 times.
✓ Branch 2 taken 17826743 times.
✓ Branch 3 taken 71063 times.
18187439 if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 ||
668
4/4
✓ Branch 0 taken 17767568 times.
✓ Branch 1 taken 59175 times.
✓ Branch 2 taken 13332 times.
✓ Branch 3 taken 17754236 times.
17826743 FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) &&
669
4/4
✓ Branch 0 taken 180411 times.
✓ Branch 1 taken 252792 times.
✓ Branch 2 taken 119748 times.
✓ Branch 3 taken 60663 times.
433203 (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 ||
670
4/4
✓ Branch 0 taken 45021 times.
✓ Branch 1 taken 74727 times.
✓ Branch 2 taken 22061 times.
✓ Branch 3 taken 22960 times.
119748 FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4))
671 410243 return 1;
672 else
673 17777196 return 0;
674
2/2
✓ Branch 0 taken 121280402 times.
✓ Branch 1 taken 1698283 times.
122978685 } else if (neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[0].list[curr->ref_idx[0]] &&
675
2/2
✓ Branch 0 taken 120703313 times.
✓ Branch 1 taken 577089 times.
121280402 neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) {
676
4/4
✓ Branch 0 taken 117092283 times.
✓ Branch 1 taken 3611030 times.
✓ Branch 2 taken 116234771 times.
✓ Branch 3 taken 857512 times.
120703313 if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 ||
677
4/4
✓ Branch 0 taken 115761243 times.
✓ Branch 1 taken 473528 times.
✓ Branch 2 taken 150249 times.
✓ Branch 3 taken 115610994 times.
116234771 FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4)
678 5092319 return 1;
679 else
680 115610994 return 0;
681
2/2
✓ Branch 0 taken 704498 times.
✓ Branch 1 taken 1570874 times.
2275372 } else if (neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[0].list[curr->ref_idx[0]] &&
682
2/2
✓ Branch 0 taken 151937 times.
✓ Branch 1 taken 552561 times.
704498 neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) {
683
4/4
✓ Branch 0 taken 100560 times.
✓ Branch 1 taken 51377 times.
✓ Branch 2 taken 88008 times.
✓ Branch 3 taken 12552 times.
151937 if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 ||
684
4/4
✓ Branch 0 taken 80010 times.
✓ Branch 1 taken 7998 times.
✓ Branch 2 taken 2920 times.
✓ Branch 3 taken 77090 times.
88008 FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)
685 74847 return 1;
686 else
687 77090 return 0;
688 } else {
689 2123435 return 1;
690 }
691
4/4
✓ Branch 0 taken 83517669 times.
✓ Branch 1 taken 4343410 times.
✓ Branch 2 taken 79195530 times.
✓ Branch 3 taken 4322139 times.
87861079 } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV
692 Mv A, B;
693 int ref_A, ref_B;
694
695
2/2
✓ Branch 0 taken 67716707 times.
✓ Branch 1 taken 11478823 times.
79195530 if (curr->pred_flag & 1) {
696 67716707 A = curr->mv[0];
697 67716707 ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]];
698 } else {
699 11478823 A = curr->mv[1];
700 11478823 ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]];
701 }
702
703
2/2
✓ Branch 0 taken 67731844 times.
✓ Branch 1 taken 11463686 times.
79195530 if (neigh->pred_flag & 1) {
704 67731844 B = neigh->mv[0];
705 67731844 ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]];
706 } else {
707 11463686 B = neigh->mv[1];
708 11463686 ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]];
709 }
710
711
2/2
✓ Branch 0 taken 75515223 times.
✓ Branch 1 taken 3680307 times.
79195530 if (ref_A == ref_B) {
712
4/4
✓ Branch 0 taken 73634809 times.
✓ Branch 1 taken 1880414 times.
✓ Branch 2 taken 626951 times.
✓ Branch 3 taken 73007858 times.
75515223 if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4)
713 2507365 return 1;
714 else
715 73007858 return 0;
716 } else
717 3680307 return 1;
718 }
719
720 8665549 return 1;
721 }
722
723 19776946 void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, int x0, int y0,
724 int log2_trafo_size)
725 {
726 19776946 const HEVCContext *s = lc->parent;
727 19776946 const MvField *tab_mvf = s->ref->tab_mvf;
728 19776946 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
729 19776946 int log2_min_tu_size = s->ps.sps->log2_min_tb_size;
730 19776946 int min_pu_width = s->ps.sps->min_pu_width;
731 19776946 int min_tu_width = s->ps.sps->min_tb_width;
732 19776946 int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
733 19776946 (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
734 int boundary_upper, boundary_left;
735 int i, j, bs;
736
737
4/4
✓ Branch 0 taken 19478801 times.
✓ Branch 1 taken 298145 times.
✓ Branch 2 taken 15341863 times.
✓ Branch 3 taken 4136938 times.
19776946 boundary_upper = y0 > 0 && !(y0 & 7);
738
2/2
✓ Branch 0 taken 15341863 times.
✓ Branch 1 taken 4435083 times.
19776946 if (boundary_upper &&
739
2/2
✓ Branch 0 taken 2005754 times.
✓ Branch 1 taken 13336109 times.
15341863 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
740
2/2
✓ Branch 0 taken 501651 times.
✓ Branch 1 taken 1504103 times.
2005754 lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
741
2/2
✓ Branch 0 taken 440551 times.
✓ Branch 1 taken 61100 times.
501651 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
742
2/2
✓ Branch 0 taken 429711 times.
✓ Branch 1 taken 14851052 times.
15280763 (!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
743
2/2
✓ Branch 0 taken 114253 times.
✓ Branch 1 taken 315458 times.
429711 lc->boundary_flags & BOUNDARY_UPPER_TILE &&
744
2/2
✓ Branch 0 taken 19889 times.
✓ Branch 1 taken 94364 times.
114253 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
745 80989 boundary_upper = 0;
746
747
2/2
✓ Branch 0 taken 15260874 times.
✓ Branch 1 taken 4516072 times.
19776946 if (boundary_upper) {
748 30521748 const RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ?
749
2/2
✓ Branch 0 taken 2099545 times.
✓ Branch 1 taken 13161329 times.
15260874 ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) :
750 13161329 s->ref->refPicList;
751 15260874 int yp_pu = (y0 - 1) >> log2_min_pu_size;
752 15260874 int yq_pu = y0 >> log2_min_pu_size;
753 15260874 int yp_tu = (y0 - 1) >> log2_min_tu_size;
754 15260874 int yq_tu = y0 >> log2_min_tu_size;
755
756
2/2
✓ Branch 0 taken 47859034 times.
✓ Branch 1 taken 15260874 times.
63119908 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
757 47859034 int x_pu = (x0 + i) >> log2_min_pu_size;
758 47859034 int x_tu = (x0 + i) >> log2_min_tu_size;
759 47859034 const MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
760 47859034 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
761 47859034 uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu];
762 47859034 uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
763
764
4/4
✓ Branch 0 taken 35030112 times.
✓ Branch 1 taken 12828922 times.
✓ Branch 2 taken 1226518 times.
✓ Branch 3 taken 33803594 times.
47859034 if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA)
765 14055440 bs = 2;
766
4/4
✓ Branch 0 taken 26951645 times.
✓ Branch 1 taken 6851949 times.
✓ Branch 2 taken 2742587 times.
✓ Branch 3 taken 24209058 times.
33803594 else if (curr_cbf_luma || top_cbf_luma)
767 9594536 bs = 1;
768 else
769 24209058 bs = boundary_strength(s, curr, top, rpl_top);
770 47859034 s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs;
771 }
772 }
773
774 // bs for vertical TU boundaries
775
4/4
✓ Branch 0 taken 19578110 times.
✓ Branch 1 taken 198836 times.
✓ Branch 2 taken 15441172 times.
✓ Branch 3 taken 4136938 times.
19776946 boundary_left = x0 > 0 && !(x0 & 7);
776
2/2
✓ Branch 0 taken 15441172 times.
✓ Branch 1 taken 4335774 times.
19776946 if (boundary_left &&
777
2/2
✓ Branch 0 taken 2026352 times.
✓ Branch 1 taken 13414820 times.
15441172 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
778
2/2
✓ Branch 0 taken 68551 times.
✓ Branch 1 taken 1957801 times.
2026352 lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
779
2/2
✓ Branch 0 taken 59900 times.
✓ Branch 1 taken 8651 times.
68551 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
780
2/2
✓ Branch 0 taken 441443 times.
✓ Branch 1 taken 14991078 times.
15432521 (!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
781
2/2
✓ Branch 0 taken 59900 times.
✓ Branch 1 taken 381543 times.
441443 lc->boundary_flags & BOUNDARY_LEFT_TILE &&
782
2/2
✓ Branch 0 taken 13608 times.
✓ Branch 1 taken 46292 times.
59900 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
783 22259 boundary_left = 0;
784
785
2/2
✓ Branch 0 taken 15418913 times.
✓ Branch 1 taken 4358033 times.
19776946 if (boundary_left) {
786 30837826 const RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ?
787
2/2
✓ Branch 0 taken 246153 times.
✓ Branch 1 taken 15172760 times.
15418913 ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) :
788 15172760 s->ref->refPicList;
789 15418913 int xp_pu = (x0 - 1) >> log2_min_pu_size;
790 15418913 int xq_pu = x0 >> log2_min_pu_size;
791 15418913 int xp_tu = (x0 - 1) >> log2_min_tu_size;
792 15418913 int xq_tu = x0 >> log2_min_tu_size;
793
794
2/2
✓ Branch 0 taken 48818270 times.
✓ Branch 1 taken 15418913 times.
64237183 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
795 48818270 int y_pu = (y0 + i) >> log2_min_pu_size;
796 48818270 int y_tu = (y0 + i) >> log2_min_tu_size;
797 48818270 const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
798 48818270 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
799 48818270 uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
800 48818270 uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
801
802
4/4
✓ Branch 0 taken 35911460 times.
✓ Branch 1 taken 12906810 times.
✓ Branch 2 taken 1358424 times.
✓ Branch 3 taken 34553036 times.
48818270 if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA)
803 14265234 bs = 2;
804
4/4
✓ Branch 0 taken 27638240 times.
✓ Branch 1 taken 6914796 times.
✓ Branch 2 taken 2773007 times.
✓ Branch 3 taken 24865233 times.
34553036 else if (curr_cbf_luma || left_cbf_luma)
805 9687803 bs = 1;
806 else
807 24865233 bs = boundary_strength(s, curr, left, rpl_left);
808 48818270 s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs;
809 }
810 }
811
812
4/4
✓ Branch 0 taken 10194773 times.
✓ Branch 1 taken 9582173 times.
✓ Branch 2 taken 7340755 times.
✓ Branch 3 taken 2854018 times.
19776946 if (log2_trafo_size > log2_min_pu_size && !is_intra) {
813 7340755 const RefPicList *rpl = s->ref->refPicList;
814
815 // bs for TU internal horizontal PU boundaries
816
2/2
✓ Branch 0 taken 9538806 times.
✓ Branch 1 taken 7340755 times.
16879561 for (j = 8; j < (1 << log2_trafo_size); j += 8) {
817 9538806 int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
818 9538806 int yq_pu = (y0 + j) >> log2_min_pu_size;
819
820
2/2
✓ Branch 0 taken 89976456 times.
✓ Branch 1 taken 9538806 times.
99515262 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
821 89976456 int x_pu = (x0 + i) >> log2_min_pu_size;
822 89976456 const MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
823 89976456 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
824
825 89976456 bs = boundary_strength(s, curr, top, rpl);
826 89976456 s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
827 }
828 }
829
830 // bs for TU internal vertical PU boundaries
831
2/2
✓ Branch 0 taken 33759122 times.
✓ Branch 1 taken 7340755 times.
41099877 for (j = 0; j < (1 << log2_trafo_size); j += 4) {
832 33759122 int y_pu = (y0 + j) >> log2_min_pu_size;
833
834
2/2
✓ Branch 0 taken 89976456 times.
✓ Branch 1 taken 33759122 times.
123735578 for (i = 8; i < (1 << log2_trafo_size); i += 8) {
835 89976456 int xp_pu = (x0 + i - 1) >> log2_min_pu_size;
836 89976456 int xq_pu = (x0 + i) >> log2_min_pu_size;
837 89976456 const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
838 89976456 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
839
840 89976456 bs = boundary_strength(s, curr, left, rpl);
841 89976456 s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
842 }
843 }
844 }
845 19776946 }
846
847 #undef LUMA
848 #undef CB
849 #undef CR
850
851 1415164 void ff_hevc_hls_filter(HEVCLocalContext *lc, int x, int y, int ctb_size)
852 {
853 1415164 const HEVCContext *const s = lc->parent;
854 1415164 int x_end = x >= s->ps.sps->width - ctb_size;
855 1415164 int skip = 0;
856
1/2
✓ Branch 0 taken 1415164 times.
✗ Branch 1 not taken.
1415164 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
857
5/6
✓ Branch 0 taken 3060 times.
✓ Branch 1 taken 1412104 times.
✓ Branch 2 taken 2040 times.
✓ Branch 3 taken 1020 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2040 times.
1415164 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
858
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1412104 times.
1413124 (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
859
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type != HEVC_SLICE_I) ||
860
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1412104 times.
1413124 (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
861
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type == HEVC_SLICE_B) ||
862
3/4
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1412104 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1020 times.
1414144 (s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
863 1020 ff_hevc_nal_is_nonref(s->nal_unit_type)))
864 2040 skip = 1;
865
866
2/2
✓ Branch 0 taken 1413124 times.
✓ Branch 1 taken 2040 times.
1415164 if (!skip)
867 1413124 deblocking_filter_CTB(s, x, y);
868
4/4
✓ Branch 0 taken 1198174 times.
✓ Branch 1 taken 216990 times.
✓ Branch 2 taken 1196134 times.
✓ Branch 3 taken 2040 times.
2611298 if (s->ps.sps->sao_enabled && !skip) {
869 1196134 int y_end = y >= s->ps.sps->height - ctb_size;
870
4/4
✓ Branch 0 taken 1092325 times.
✓ Branch 1 taken 103809 times.
✓ Branch 2 taken 1036796 times.
✓ Branch 3 taken 55529 times.
1196134 if (y && x)
871 1036796 sao_filter_CTB(lc, s, x - ctb_size, y - ctb_size);
872
4/4
✓ Branch 0 taken 1131874 times.
✓ Branch 1 taken 64260 times.
✓ Branch 2 taken 95049 times.
✓ Branch 3 taken 1036825 times.
1196134 if (x && y_end)
873 95049 sao_filter_CTB(lc, s, x - ctb_size, y);
874
4/4
✓ Branch 0 taken 1092325 times.
✓ Branch 1 taken 103809 times.
✓ Branch 2 taken 55528 times.
✓ Branch 3 taken 1036797 times.
1196134 if (y && x_end) {
875 55528 sao_filter_CTB(lc, s, x, y - ctb_size);
876
2/2
✓ Branch 0 taken 513 times.
✓ Branch 1 taken 55015 times.
55528 if (s->threads_type & FF_THREAD_FRAME )
877 513 ff_progress_frame_report(&s->ref->tf, y);
878 }
879
4/4
✓ Branch 0 taken 64259 times.
✓ Branch 1 taken 1131875 times.
✓ Branch 2 taken 8730 times.
✓ Branch 3 taken 55529 times.
1196134 if (x_end && y_end) {
880 8730 sao_filter_CTB(lc, s, x , y);
881
2/2
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8698 times.
8730 if (s->threads_type & FF_THREAD_FRAME )
882 32 ff_progress_frame_report(&s->ref->tf, y + ctb_size);
883 }
884
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 219030 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
219030 } else if (s->threads_type & FF_THREAD_FRAME && x_end)
885 ff_progress_frame_report(&s->ref->tf, y + ctb_size - 4);
886 1415164 }
887
888 1415195 void ff_hevc_hls_filters(HEVCLocalContext *lc, int x_ctb, int y_ctb, int ctb_size)
889 {
890 1415195 int x_end = x_ctb >= lc->parent->ps.sps->width - ctb_size;
891 1415195 int y_end = y_ctb >= lc->parent->ps.sps->height - ctb_size;
892
4/4
✓ Branch 0 taken 1295869 times.
✓ Branch 1 taken 119326 times.
✓ Branch 2 taken 1232098 times.
✓ Branch 3 taken 63771 times.
1415195 if (y_ctb && x_ctb)
893 1232098 ff_hevc_hls_filter(lc, x_ctb - ctb_size, y_ctb - ctb_size, ctb_size);
894
4/4
✓ Branch 0 taken 1295869 times.
✓ Branch 1 taken 119326 times.
✓ Branch 2 taken 63770 times.
✓ Branch 3 taken 1232099 times.
1415195 if (y_ctb && x_end)
895 63770 ff_hevc_hls_filter(lc, x_ctb, y_ctb - ctb_size, ctb_size);
896
4/4
✓ Branch 0 taken 1341889 times.
✓ Branch 1 taken 73306 times.
✓ Branch 2 taken 109762 times.
✓ Branch 3 taken 1232127 times.
1415195 if (x_ctb && y_end)
897 109762 ff_hevc_hls_filter(lc, x_ctb - ctb_size, y_ctb, ctb_size);
898 1415195 }
899