FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hevc_filter.c
Date: 2023-09-24 13:02:57
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 "threadframe.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 21960318 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 10980159 times.
✓ Branch 1 taken 10980159 times.
21960318 if (c_idx == 1)
56 10980159 offset = s->ps.pps->cb_qp_offset;
57 else
58 10980159 offset = s->ps.pps->cr_qp_offset;
59
60 21960318 qp_i = av_clip(qp_y + offset, 0, 57);
61
2/2
✓ Branch 0 taken 18480590 times.
✓ Branch 1 taken 3479728 times.
21960318 if (s->ps.sps->chroma_format_idc == 1) {
62
2/2
✓ Branch 0 taken 3100597 times.
✓ Branch 1 taken 15379993 times.
18480590 if (qp_i < 30)
63 3100597 qp = qp_i;
64
2/2
✓ Branch 0 taken 153221 times.
✓ Branch 1 taken 15226772 times.
15379993 else if (qp_i > 43)
65 153221 qp = qp_i - 6;
66 else
67 15226772 qp = qp_c[qp_i - 30];
68 } else {
69 3479728 qp = av_clip(qp_i, 0, 51);
70 }
71
72 21960318 idxt = av_clip(qp + DEFAULT_INTRA_TC_OFFSET + tc_offset, 0, 53);
73 21960318 return tctable[idxt];
74 }
75
76 1392233 static int get_qPy_pred(HEVCLocalContext *lc, const HEVCContext *s,
77 int xBase, int yBase, int log2_cb_size)
78 {
79 1392233 int ctb_size_mask = (1 << s->ps.sps->log2_ctb_size) - 1;
80 1392233 int MinCuQpDeltaSizeMask = (1 << (s->ps.sps->log2_ctb_size -
81 1392233 s->ps.pps->diff_cu_qp_delta_depth)) - 1;
82 1392233 int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
83 1392233 int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
84 1392233 int min_cb_width = s->ps.sps->min_cb_width;
85 1392233 int x_cb = xQgBase >> s->ps.sps->log2_min_cb_size;
86 1392233 int y_cb = yQgBase >> s->ps.sps->log2_min_cb_size;
87
2/2
✓ Branch 0 taken 949316 times.
✓ Branch 1 taken 442917 times.
2341549 int availableA = (xBase & ctb_size_mask) &&
88
2/2
✓ Branch 0 taken 812222 times.
✓ Branch 1 taken 137094 times.
949316 (xQgBase & ctb_size_mask);
89
2/2
✓ Branch 0 taken 931595 times.
✓ Branch 1 taken 460638 times.
2323828 int availableB = (yBase & ctb_size_mask) &&
90
2/2
✓ Branch 0 taken 809993 times.
✓ Branch 1 taken 121602 times.
931595 (yQgBase & ctb_size_mask);
91 int qPy_pred, qPy_a, qPy_b;
92
93 // qPy_pred
94
5/6
✓ Branch 0 taken 1304541 times.
✓ Branch 1 taken 87692 times.
✓ Branch 2 taken 18815 times.
✓ Branch 3 taken 1285726 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18815 times.
1392233 if (lc->first_qp_group || (!xQgBase && !yQgBase)) {
95 87692 lc->first_qp_group = !lc->tu.is_cu_qp_delta_coded;
96 87692 qPy_pred = s->sh.slice_qp;
97 } else {
98 1304541 qPy_pred = lc->qPy_pred;
99 }
100
101 // qPy_a
102
2/2
✓ Branch 0 taken 580011 times.
✓ Branch 1 taken 812222 times.
1392233 if (availableA == 0)
103 580011 qPy_a = qPy_pred;
104 else
105 812222 qPy_a = s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width];
106
107 // qPy_b
108
2/2
✓ Branch 0 taken 582240 times.
✓ Branch 1 taken 809993 times.
1392233 if (availableB == 0)
109 582240 qPy_b = qPy_pred;
110 else
111 809993 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 1392233 return (qPy_a + qPy_b + 1) >> 1;
117 }
118
119 1392233 void ff_hevc_set_qPy(HEVCLocalContext *lc, int xBase, int yBase, int log2_cb_size)
120 {
121 1392233 const HEVCContext *const s = lc->parent;
122 1392233 int qp_y = get_qPy_pred(lc, s, xBase, yBase, log2_cb_size);
123
124
2/2
✓ Branch 0 taken 369824 times.
✓ Branch 1 taken 1022409 times.
1392233 if (lc->tu.cu_qp_delta != 0) {
125 369824 int off = s->ps.sps->qp_bd_offset;
126
1/2
✓ Branch 0 taken 369824 times.
✗ Branch 1 not taken.
369824 lc->qp_y = FFUMOD(qp_y + lc->tu.cu_qp_delta + 52 + 2 * off,
127 369824 52 + off) - off;
128 } else
129 1022409 lc->qp_y = qp_y;
130 1392233 }
131
132 114780406 static int get_qPy(const HEVCContext *s, int xC, int yC)
133 {
134 114780406 int log2_min_cb_size = s->ps.sps->log2_min_cb_size;
135 114780406 int x = xC >> log2_min_cb_size;
136 114780406 int y = yC >> log2_min_cb_size;
137 114780406 return s->qp_y_tab[x + y * s->ps.sps->min_cb_width];
138 }
139
140 380716 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 55847 times.
✓ Branch 1 taken 324869 times.
380716 if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) {
146
2/2
✓ Branch 0 taken 2424920 times.
✓ Branch 1 taken 55847 times.
2480767 for (i = 0; i < height; i++) {
147
2/2
✓ Branch 0 taken 16964496 times.
✓ Branch 1 taken 2424920 times.
19389416 for (j = 0; j < width - 7; j+=8)
148 16964496 AV_COPY64U(dst+j, src+j);
149 2424920 dst += stride_dst;
150 2424920 src += stride_src;
151 }
152
2/2
✓ Branch 0 taken 55647 times.
✓ Branch 1 taken 200 times.
55847 if (width&7) {
153 55647 dst += ((width>>3)<<3) - stride_dst * height;
154 55647 src += ((width>>3)<<3) - stride_src * height;
155 55647 width &= 7;
156
2/2
✓ Branch 0 taken 2423320 times.
✓ Branch 1 taken 55647 times.
2478967 for (i = 0; i < height; i++) {
157
2/2
✓ Branch 0 taken 5292160 times.
✓ Branch 1 taken 2423320 times.
7715480 for (j = 0; j < width; j++)
158 5292160 dst[j] = src[j];
159 2423320 dst += stride_dst;
160 2423320 src += stride_src;
161 }
162 }
163 } else {
164
2/2
✓ Branch 0 taken 17107080 times.
✓ Branch 1 taken 324869 times.
17431949 for (i = 0; i < height; i++) {
165
2/2
✓ Branch 0 taken 87005776 times.
✓ Branch 1 taken 17107080 times.
104112856 for (j = 0; j < width; j+=16)
166 87005776 AV_COPY128(dst+j, src+j);
167 17107080 dst += stride_dst;
168 17107080 src += stride_src;
169 }
170 }
171 380716 }
172
173 1341091 static void copy_pixel(uint8_t *dst, const uint8_t *src, int pixel_shift)
174 {
175
2/2
✓ Branch 0 taken 222510 times.
✓ Branch 1 taken 1118581 times.
1341091 if (pixel_shift)
176 222510 *(uint16_t *)dst = *(uint16_t *)src;
177 else
178 1118581 *dst = *src;
179 1341091 }
180
181 1291239 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 1110523 times.
✓ Branch 1 taken 180716 times.
1291239 if (pixel_shift == 0) {
187
2/2
✓ Branch 0 taken 52325936 times.
✓ Branch 1 taken 1110523 times.
53436459 for (i = 0; i < height; i++) {
188 52325936 *dst = *src;
189 52325936 dst += stride_dst;
190 52325936 src += stride_src;
191 }
192 } else {
193
2/2
✓ Branch 0 taken 11257072 times.
✓ Branch 1 taken 180716 times.
11437788 for (i = 0; i < height; i++) {
194 11257072 *(uint16_t *)dst = *(uint16_t *)src;
195 11257072 dst += stride_dst;
196 11257072 src += stride_src;
197 }
198 }
199 1291239 }
200
201 491653 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 491653 int sh = s->ps.sps->pixel_shift;
206 491653 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
207 491653 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
208
209 /* copy horizontal edges */
210 491653 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << sh),
211 491653 src, width << sh);
212 491653 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << sh),
213 491653 src + stride_src * (height - 1), width << sh);
214
215 /* copy vertical edges */
216 491653 copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << sh), src, sh, height, 1 << sh, stride_src);
217
218 491653 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 491653 }
220
221 380716 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 376427 times.
✓ Branch 1 taken 4289 times.
380716 if ( s->ps.pps->transquant_bypass_enable_flag ||
227
3/4
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 376323 times.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
376427 (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 380716 }
253
254 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
255
256 1194693 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 1194693 int x_ctb = x >> s->ps.sps->log2_ctb_size;
262 1194693 int y_ctb = y >> s->ps.sps->log2_ctb_size;
263 1194693 int ctb_addr_rs = y_ctb * s->ps.sps->ctb_width + x_ctb;
264 1194693 int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
265 1194693 SAOParams *sao = &CTB(s->sao, x_ctb, y_ctb);
266 // flags indicating unfilterable edges
267 1194693 uint8_t vert_edge[] = { 0, 0 };
268 1194693 uint8_t horiz_edge[] = { 0, 0 };
269 1194693 uint8_t diag_edge[] = { 0, 0, 0, 0 };
270 1194693 uint8_t lfase = CTB(s->filter_slice_edges, x_ctb, y_ctb);
271
2/2
✓ Branch 0 taken 170200 times.
✓ Branch 1 taken 1024493 times.
1364893 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 1178029 times.
✓ Branch 1 taken 16664 times.
✓ Branch 2 taken 51490 times.
✓ Branch 3 taken 1126539 times.
1194693 uint8_t restore = no_tile_filter || !lfase;
274 1194693 uint8_t left_tile_edge = 0;
275 1194693 uint8_t right_tile_edge = 0;
276 1194693 uint8_t up_tile_edge = 0;
277 1194693 uint8_t bottom_tile_edge = 0;
278
279 1194693 edges[0] = x_ctb == 0;
280 1194693 edges[1] = y_ctb == 0;
281 1194693 edges[2] = x_ctb == s->ps.sps->ctb_width - 1;
282 1194693 edges[3] = y_ctb == s->ps.sps->ctb_height - 1;
283
284
2/2
✓ Branch 0 taken 68154 times.
✓ Branch 1 taken 1126539 times.
1194693 if (restore) {
285
2/2
✓ Branch 0 taken 64585 times.
✓ Branch 1 taken 3569 times.
68154 if (!edges[0]) {
286
4/4
✓ Branch 0 taken 16242 times.
✓ Branch 1 taken 48343 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 15406 times.
64585 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 48343 times.
✓ Branch 1 taken 16242 times.
✓ Branch 2 taken 48136 times.
✓ Branch 3 taken 207 times.
✓ Branch 4 taken 836 times.
✓ Branch 5 taken 63542 times.
64585 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 64586 times.
✓ Branch 1 taken 3568 times.
68154 if (!edges[2]) {
290
4/4
✓ Branch 0 taken 16242 times.
✓ Branch 1 taken 48344 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 15406 times.
64586 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 48344 times.
✓ Branch 1 taken 16242 times.
✓ Branch 2 taken 48137 times.
✓ Branch 3 taken 207 times.
✓ Branch 4 taken 836 times.
✓ Branch 5 taken 63543 times.
64586 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 61940 times.
✓ Branch 1 taken 6214 times.
68154 if (!edges[1]) {
294
4/4
✓ Branch 0 taken 15931 times.
✓ Branch 1 taken 46009 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 14491 times.
61940 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 46009 times.
✓ Branch 1 taken 15931 times.
✓ Branch 2 taken 44569 times.
✓ Branch 3 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 59060 times.
61940 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 61970 times.
✓ Branch 1 taken 6184 times.
68154 if (!edges[3]) {
298
4/4
✓ Branch 0 taken 15931 times.
✓ Branch 1 taken 46039 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 14491 times.
61970 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 46039 times.
✓ Branch 1 taken 15931 times.
✓ Branch 2 taken 44599 times.
✓ Branch 3 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 59090 times.
61970 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 64585 times.
✓ Branch 1 taken 3569 times.
✓ Branch 2 taken 58971 times.
✓ Branch 3 taken 5614 times.
68154 if (!edges[0] && !edges[1]) {
302
8/8
✓ Branch 0 taken 43443 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 41859 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 56588 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 55256 times.
58971 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 61940 times.
✓ Branch 1 taken 6214 times.
✓ Branch 2 taken 58972 times.
✓ Branch 3 taken 2968 times.
68154 if (!edges[1] && !edges[2]) {
305
8/8
✓ Branch 0 taken 43444 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 41860 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 56589 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 55257 times.
58972 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 64586 times.
✓ Branch 1 taken 3568 times.
✓ Branch 2 taken 59001 times.
✓ Branch 3 taken 5585 times.
68154 if (!edges[2] && !edges[3]) {
308
8/8
✓ Branch 0 taken 43473 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 41889 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 56618 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 55286 times.
59001 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 64585 times.
✓ Branch 1 taken 3569 times.
✓ Branch 2 taken 59000 times.
✓ Branch 3 taken 5585 times.
68154 if (!edges[0] && !edges[3]) {
311
8/8
✓ Branch 0 taken 43472 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 41888 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 56617 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 55285 times.
59000 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 4778580 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 3583983 times.
✓ Branch 3 taken 1194693 times.
4778676 for (c_idx = 0; c_idx < (s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
316 3583983 int x0 = x >> s->ps.sps->hshift[c_idx];
317 3583983 int y0 = y >> s->ps.sps->vshift[c_idx];
318 3583983 ptrdiff_t stride_src = s->frame->linesize[c_idx];
319 3583983 int ctb_size_h = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->hshift[c_idx];
320 3583983 int ctb_size_v = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->vshift[c_idx];
321 3583983 int width = FFMIN(ctb_size_h, (s->ps.sps->width >> s->ps.sps->hshift[c_idx]) - x0);
322 3583983 int height = FFMIN(ctb_size_v, (s->ps.sps->height >> s->ps.sps->vshift[c_idx]) - y0);
323 3583983 int tab = sao_tab[(FFALIGN(width, 8) >> 3) - 1];
324 3583983 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 111706 times.
✓ Branch 1 taken 379947 times.
✓ Branch 2 taken 3092330 times.
3583983 switch (sao->type_idx[c_idx]) {
329 111706 case SAO_BAND:
330 111706 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 110945 times.
✓ Branch 1 taken 761 times.
111706 if (s->ps.pps->transquant_bypass_enable_flag ||
333
3/4
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 110937 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
110945 (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 110937 s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src,
344 110937 sao->offset_val[c_idx], sao->band_position[c_idx],
345 width, height);
346 }
347 111706 sao->type_idx[c_idx] = SAO_APPLIED;
348 111706 break;
349 379947 case SAO_EDGE:
350 {
351 379947 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
352 379947 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
353 379947 int left_edge = edges[0];
354 379947 int top_edge = edges[1];
355 379947 int right_edge = edges[2];
356 379947 int bottom_edge = edges[3];
357 379947 int sh = s->ps.sps->pixel_shift;
358 int left_pixels, right_pixels;
359
360 379947 stride_dst = 2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE;
361 379947 dst = lc->edge_emu_buffer + stride_dst + AV_INPUT_BUFFER_PADDING_SIZE;
362
363
2/2
✓ Branch 0 taken 353954 times.
✓ Branch 1 taken 25993 times.
379947 if (!top_edge) {
364 353954 int left = 1 - left_edge;
365 353954 int right = 1 - right_edge;
366 const uint8_t *src1[2];
367 uint8_t *dst1;
368 int src_idx, pos;
369
370 353954 dst1 = dst - stride_dst - (left << sh);
371 353954 src1[0] = src - stride_src - (left << sh);
372 353954 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0 - left) << sh);
373 353954 pos = 0;
374
2/2
✓ Branch 0 taken 337237 times.
✓ Branch 1 taken 16717 times.
353954 if (left) {
375 337237 src_idx = (CTB(s->sao, x_ctb-1, y_ctb-1).type_idx[c_idx] ==
376 SAO_APPLIED);
377 337237 copy_pixel(dst1, src1[src_idx], sh);
378 337237 pos += (1 << sh);
379 }
380 353954 src_idx = (CTB(s->sao, x_ctb, y_ctb-1).type_idx[c_idx] ==
381 SAO_APPLIED);
382 353954 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
383
2/2
✓ Branch 0 taken 336932 times.
✓ Branch 1 taken 17022 times.
353954 if (right) {
384 336932 pos += width << sh;
385 336932 src_idx = (CTB(s->sao, x_ctb+1, y_ctb-1).type_idx[c_idx] ==
386 SAO_APPLIED);
387 336932 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
388 }
389 }
390
2/2
✓ Branch 0 taken 349922 times.
✓ Branch 1 taken 30025 times.
379947 if (!bottom_edge) {
391 349922 int left = 1 - left_edge;
392 349922 int right = 1 - right_edge;
393 const uint8_t *src1[2];
394 uint8_t *dst1;
395 int src_idx, pos;
396
397 349922 dst1 = dst + height * stride_dst - (left << sh);
398 349922 src1[0] = src + height * stride_src - (left << sh);
399 349922 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0 - left) << sh);
400 349922 pos = 0;
401
2/2
✓ Branch 0 taken 333778 times.
✓ Branch 1 taken 16144 times.
349922 if (left) {
402 333778 src_idx = (CTB(s->sao, x_ctb-1, y_ctb+1).type_idx[c_idx] ==
403 SAO_APPLIED);
404 333778 copy_pixel(dst1, src1[src_idx], sh);
405 333778 pos += (1 << sh);
406 }
407 349922 src_idx = (CTB(s->sao, x_ctb, y_ctb+1).type_idx[c_idx] ==
408 SAO_APPLIED);
409 349922 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
410
2/2
✓ Branch 0 taken 333144 times.
✓ Branch 1 taken 16778 times.
349922 if (right) {
411 333144 pos += width << sh;
412 333144 src_idx = (CTB(s->sao, x_ctb+1, y_ctb+1).type_idx[c_idx] ==
413 SAO_APPLIED);
414 333144 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
415 }
416 }
417 379947 left_pixels = 0;
418
2/2
✓ Branch 0 taken 361214 times.
✓ Branch 1 taken 18733 times.
379947 if (!left_edge) {
419
2/2
✓ Branch 0 taken 307933 times.
✓ Branch 1 taken 53281 times.
361214 if (CTB(s->sao, x_ctb-1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
420 307933 copy_vert(dst - (1 << sh),
421 307933 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh),
422 307933 sh, height, stride_dst, 1 << sh);
423 } else {
424 53281 left_pixels = 1;
425 }
426 }
427 379947 right_pixels = 0;
428
2/2
✓ Branch 0 taken 360803 times.
✓ Branch 1 taken 19144 times.
379947 if (!right_edge) {
429
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 360803 times.
360803 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 360803 right_pixels = 1;
435 }
436 }
437
438 379947 copy_CTB(dst - (left_pixels << sh),
439 379947 src - (left_pixels << sh),
440 379947 (width + left_pixels + right_pixels) << sh,
441 height, stride_dst, stride_src);
442
443 379947 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
444 x_ctb, y_ctb);
445 379947 s->hevcdsp.sao_edge_filter[tab](src, dst, stride_src, sao->offset_val[c_idx],
446 sao->eo_class[c_idx], width, height);
447 379947 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 379947 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
456 x, y, width, height, c_idx);
457 379947 sao->type_idx[c_idx] = SAO_APPLIED;
458 379947 break;
459 }
460 }
461 }
462 1194693 }
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 1411714 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 1411714 uint8_t no_p[2] = { 0 };
492 1411714 uint8_t no_q[2] = { 0 };
493
494 1411714 int log2_ctb_size = s->ps.sps->log2_ctb_size;
495 int x_end, x_end2, y_end;
496 1411714 int ctb_size = 1 << log2_ctb_size;
497 1411714 int ctb = (x0 >> log2_ctb_size) +
498 1411714 (y0 >> log2_ctb_size) * s->ps.sps->ctb_width;
499 1411714 int cur_tc_offset = s->deblock[ctb].tc_offset;
500 1411714 int cur_beta_offset = s->deblock[ctb].beta_offset;
501 int left_tc_offset, left_beta_offset;
502 int tc_offset, beta_offset;
503 2910809 int pcmf = (s->ps.sps->pcm_enabled_flag &&
504
4/4
✓ Branch 0 taken 87381 times.
✓ Branch 1 taken 1324333 times.
✓ Branch 2 taken 87325 times.
✓ Branch 3 taken 56 times.
2823372 s->ps.sps->pcm.loop_filter_disable_flag) ||
505
2/2
✓ Branch 0 taken 4570 times.
✓ Branch 1 taken 1407088 times.
1411658 s->ps.pps->transquant_bypass_enable_flag;
506
507
2/2
✓ Branch 0 taken 1338594 times.
✓ Branch 1 taken 73120 times.
1411714 if (x0) {
508 1338594 left_tc_offset = s->deblock[ctb - 1].tc_offset;
509 1338594 left_beta_offset = s->deblock[ctb - 1].beta_offset;
510 } else {
511 73120 left_tc_offset = 0;
512 73120 left_beta_offset = 0;
513 }
514
515 1411714 x_end = x0 + ctb_size;
516
2/2
✓ Branch 0 taken 25312 times.
✓ Branch 1 taken 1386402 times.
1411714 if (x_end > s->ps.sps->width)
517 25312 x_end = s->ps.sps->width;
518 1411714 y_end = y0 + ctb_size;
519
2/2
✓ Branch 0 taken 96185 times.
✓ Branch 1 taken 1315529 times.
1411714 if (y_end > s->ps.sps->height)
520 96185 y_end = s->ps.sps->height;
521
522 1411714 tc_offset = cur_tc_offset;
523 1411714 beta_offset = cur_beta_offset;
524
525 1411714 x_end2 = x_end;
526
2/2
✓ Branch 0 taken 1338595 times.
✓ Branch 1 taken 73119 times.
1411714 if (x_end2 != s->ps.sps->width)
527 1338595 x_end2 -= 8;
528
2/2
✓ Branch 0 taken 10139892 times.
✓ Branch 1 taken 1411714 times.
11551606 for (y = y0; y < y_end; y += 8) {
529 // vertical filtering luma
530
4/4
✓ Branch 0 taken 9609775 times.
✓ Branch 1 taken 530117 times.
✓ Branch 2 taken 77023055 times.
✓ Branch 3 taken 10139892 times.
87162947 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
531 77023055 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
532 77023055 const int bs1 = s->vertical_bs[(x + (y + 4) * s->bs_width) >> 2];
533
4/4
✓ Branch 0 taken 59698194 times.
✓ Branch 1 taken 17324861 times.
✓ Branch 2 taken 89497 times.
✓ Branch 3 taken 59608697 times.
77023055 if (bs0 || bs1) {
534 17414358 const int qp = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
535
536 17414358 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
537
538
2/2
✓ Branch 0 taken 17324861 times.
✓ Branch 1 taken 89497 times.
17414358 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
539
2/2
✓ Branch 0 taken 17318220 times.
✓ Branch 1 taken 96138 times.
17414358 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
540 17414358 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 17228279 times.
17414358 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 17228279 s->hevcdsp.hevc_v_loop_filter_luma(src,
551 17228279 s->frame->linesize[LUMA],
552 beta, tc, no_p, no_q);
553 }
554 }
555
556
2/2
✓ Branch 0 taken 118996 times.
✓ Branch 1 taken 10020896 times.
10139892 if(!y)
557 118996 continue;
558
559 // horizontal filtering luma
560
4/4
✓ Branch 0 taken 9500289 times.
✓ Branch 1 taken 520607 times.
✓ Branch 2 taken 76680991 times.
✓ Branch 3 taken 10020896 times.
86701887 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
561 76680991 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
562 76680991 const int bs1 = s->horizontal_bs[((x + 4) + y * s->bs_width) >> 2];
563
4/4
✓ Branch 0 taken 59034110 times.
✓ Branch 1 taken 17646881 times.
✓ Branch 2 taken 106170 times.
✓ Branch 3 taken 58927940 times.
76680991 if (bs0 || bs1) {
564 17753051 const int qp = (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1;
565
566
2/2
✓ Branch 0 taken 15535287 times.
✓ Branch 1 taken 2217764 times.
17753051 tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
567
2/2
✓ Branch 0 taken 15535287 times.
✓ Branch 1 taken 2217764 times.
17753051 beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
568
569 17753051 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
570
2/2
✓ Branch 0 taken 17646881 times.
✓ Branch 1 taken 106170 times.
17753051 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
571
2/2
✓ Branch 0 taken 17632156 times.
✓ Branch 1 taken 120895 times.
17753051 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
572 17753051 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 17565248 times.
17753051 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 17565248 s->hevcdsp.hevc_h_loop_filter_luma(src,
583 17565248 s->frame->linesize[LUMA],
584 beta, tc, no_p, no_q);
585 }
586 }
587 }
588
589
2/2
✓ Branch 0 taken 1411666 times.
✓ Branch 1 taken 48 times.
1411714 if (s->ps.sps->chroma_format_idc) {
590
2/2
✓ Branch 0 taken 2823332 times.
✓ Branch 1 taken 1411666 times.
4234998 for (chroma = 1; chroma <= 2; chroma++) {
591 2823332 int h = 1 << s->ps.sps->hshift[chroma];
592 2823332 int v = 1 << s->ps.sps->vshift[chroma];
593
594 // vertical filtering chroma
595
2/2
✓ Branch 0 taken 10613240 times.
✓ Branch 1 taken 2823332 times.
13436572 for (y = y0; y < y_end; y += (8 * v)) {
596
4/4
✓ Branch 0 taken 543400 times.
✓ Branch 1 taken 10069840 times.
✓ Branch 2 taken 40892998 times.
✓ Branch 3 taken 10613240 times.
51506238 for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
597 40892998 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
598 40892998 const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * s->bs_width) >> 2];
599
600
4/4
✓ Branch 0 taken 35251772 times.
✓ Branch 1 taken 5641226 times.
✓ Branch 2 taken 128734 times.
✓ Branch 3 taken 35123038 times.
40892998 if ((bs0 == 2) || (bs1 == 2)) {
601 5769960 const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
602 5769960 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 5641226 times.
✓ Branch 1 taken 128734 times.
5769960 c_tc[0] = (bs0 == 2) ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
605
2/2
✓ Branch 0 taken 5636218 times.
✓ Branch 1 taken 133742 times.
5769960 c_tc[1] = (bs1 == 2) ? chroma_tc(s, qp1, chroma, tc_offset) : 0;
606 5769960 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 5699122 times.
5769960 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 5699122 s->hevcdsp.hevc_v_loop_filter_chroma(src,
617 5699122 s->frame->linesize[chroma],
618 c_tc, no_p, no_q);
619 }
620 }
621
622
2/2
✓ Branch 0 taken 237968 times.
✓ Branch 1 taken 10375272 times.
10613240 if(!y)
623 237968 continue;
624
625 // horizontal filtering chroma
626
2/2
✓ Branch 0 taken 9850888 times.
✓ Branch 1 taken 524384 times.
10375272 tc_offset = x0 ? left_tc_offset : cur_tc_offset;
627 10375272 x_end2 = x_end;
628
2/2
✓ Branch 0 taken 9850896 times.
✓ Branch 1 taken 524376 times.
10375272 if (x_end != s->ps.sps->width)
629 9850896 x_end2 = x_end - 8 * h;
630
4/4
✓ Branch 0 taken 9850888 times.
✓ Branch 1 taken 524384 times.
✓ Branch 2 taken 40557630 times.
✓ Branch 3 taken 10375272 times.
50932902 for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
631 40557630 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
632 40557630 const int bs1 = s->horizontal_bs[((x + 4 * h) + y * s->bs_width) >> 2];
633
4/4
✓ Branch 0 taken 35215412 times.
✓ Branch 1 taken 5342218 times.
✓ Branch 2 taken 134102 times.
✓ Branch 3 taken 35081310 times.
40557630 if ((bs0 == 2) || (bs1 == 2)) {
634
2/2
✓ Branch 0 taken 5342218 times.
✓ Branch 1 taken 134102 times.
5476320 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 5340656 times.
✓ Branch 1 taken 135664 times.
5476320 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 5342218 times.
✓ Branch 1 taken 134102 times.
5476320 c_tc[0] = bs0 == 2 ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
638
2/2
✓ Branch 0 taken 5340656 times.
✓ Branch 1 taken 135664 times.
5476320 c_tc[1] = bs1 == 2 ? chroma_tc(s, qp1, chroma, cur_tc_offset) : 0;
639 5476320 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 5406598 times.
5476320 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 5406598 s->hevcdsp.hevc_h_loop_filter_chroma(src,
650 5406598 s->frame->linesize[chroma],
651 c_tc, no_p, no_q);
652 }
653 }
654 }
655 }
656 }
657 1411714 }
658
659 228722991 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 145410402 times.
✓ Branch 1 taken 83312589 times.
✓ Branch 2 taken 141069872 times.
✓ Branch 3 taken 4340530 times.
228722991 if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) {
663 // same L0 and L1
664
2/2
✓ Branch 0 taken 139371733 times.
✓ Branch 1 taken 1698139 times.
141069872 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 121045841 times.
139371733 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 121184294 times.
✓ Branch 1 taken 1698139 times.
122882433 } 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 120607941 times.
✓ Branch 1 taken 576353 times.
121184294 neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) {
676
4/4
✓ Branch 0 taken 116996991 times.
✓ Branch 1 taken 3610950 times.
✓ Branch 2 taken 116139479 times.
✓ Branch 3 taken 857512 times.
120607941 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 115665951 times.
✓ Branch 1 taken 473528 times.
✓ Branch 2 taken 150249 times.
✓ Branch 3 taken 115515702 times.
116139479 FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4)
678 5092239 return 1;
679 else
680 115515702 return 0;
681
2/2
✓ Branch 0 taken 704498 times.
✓ Branch 1 taken 1569994 times.
2274492 } 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 2122555 return 1;
690 }
691
4/4
✓ Branch 0 taken 83312589 times.
✓ Branch 1 taken 4340530 times.
✓ Branch 2 taken 78993850 times.
✓ Branch 3 taken 4318739 times.
87653119 } 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 67549235 times.
✓ Branch 1 taken 11444615 times.
78993850 if (curr->pred_flag & 1) {
696 67549235 A = curr->mv[0];
697 67549235 ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]];
698 } else {
699 11444615 A = curr->mv[1];
700 11444615 ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]];
701 }
702
703
2/2
✓ Branch 0 taken 67564332 times.
✓ Branch 1 taken 11429518 times.
78993850 if (neigh->pred_flag & 1) {
704 67564332 B = neigh->mv[0];
705 67564332 ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]];
706 } else {
707 11429518 B = neigh->mv[1];
708 11429518 ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]];
709 }
710
711
2/2
✓ Branch 0 taken 75315215 times.
✓ Branch 1 taken 3678635 times.
78993850 if (ref_A == ref_B) {
712
4/4
✓ Branch 0 taken 73436017 times.
✓ Branch 1 taken 1879198 times.
✓ Branch 2 taken 626551 times.
✓ Branch 3 taken 72809466 times.
75315215 if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4)
713 2505749 return 1;
714 else
715 72809466 return 0;
716 } else
717 3678635 return 1;
718 }
719
720 8659269 return 1;
721 }
722
723 19763645 void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, int x0, int y0,
724 int log2_trafo_size)
725 {
726 19763645 const HEVCContext *s = lc->parent;
727 19763645 const MvField *tab_mvf = s->ref->tab_mvf;
728 19763645 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
729 19763645 int log2_min_tu_size = s->ps.sps->log2_min_tb_size;
730 19763645 int min_pu_width = s->ps.sps->min_pu_width;
731 19763645 int min_tu_width = s->ps.sps->min_tb_width;
732 19763645 int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
733 19763645 (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 19465843 times.
✓ Branch 1 taken 297802 times.
✓ Branch 2 taken 15331533 times.
✓ Branch 3 taken 4134310 times.
19763645 boundary_upper = y0 > 0 && !(y0 & 7);
738
2/2
✓ Branch 0 taken 15331533 times.
✓ Branch 1 taken 4432112 times.
19763645 if (boundary_upper &&
739
2/2
✓ Branch 0 taken 1999846 times.
✓ Branch 1 taken 13331687 times.
15331533 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
740
2/2
✓ Branch 0 taken 501429 times.
✓ Branch 1 taken 1498417 times.
1999846 lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
741
2/2
✓ Branch 0 taken 440329 times.
✓ Branch 1 taken 61100 times.
501429 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
742
2/2
✓ Branch 0 taken 429711 times.
✓ Branch 1 taken 14840722 times.
15270433 (!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 15250544 times.
✓ Branch 1 taken 4513101 times.
19763645 if (boundary_upper) {
748 30501088 const RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ?
749
2/2
✓ Branch 0 taken 2098913 times.
✓ Branch 1 taken 13151631 times.
15250544 ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) :
750 13151631 s->ref->refPicList;
751 15250544 int yp_pu = (y0 - 1) >> log2_min_pu_size;
752 15250544 int yq_pu = y0 >> log2_min_pu_size;
753 15250544 int yp_tu = (y0 - 1) >> log2_min_tu_size;
754 15250544 int yq_tu = y0 >> log2_min_tu_size;
755
756
2/2
✓ Branch 0 taken 47816142 times.
✓ Branch 1 taken 15250544 times.
63066686 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
757 47816142 int x_pu = (x0 + i) >> log2_min_pu_size;
758 47816142 int x_tu = (x0 + i) >> log2_min_tu_size;
759 47816142 const MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
760 47816142 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
761 47816142 uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu];
762 47816142 uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
763
764
4/4
✓ Branch 0 taken 34994460 times.
✓ Branch 1 taken 12821682 times.
✓ Branch 2 taken 1226306 times.
✓ Branch 3 taken 33768154 times.
47816142 if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA)
765 14047988 bs = 2;
766
4/4
✓ Branch 0 taken 26922071 times.
✓ Branch 1 taken 6846083 times.
✓ Branch 2 taken 2738763 times.
✓ Branch 3 taken 24183308 times.
33768154 else if (curr_cbf_luma || top_cbf_luma)
767 9584846 bs = 1;
768 else
769 24183308 bs = boundary_strength(s, curr, top, rpl_top);
770 47816142 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 19564981 times.
✓ Branch 1 taken 198664 times.
✓ Branch 2 taken 15430671 times.
✓ Branch 3 taken 4134310 times.
19763645 boundary_left = x0 > 0 && !(x0 & 7);
776
2/2
✓ Branch 0 taken 15430671 times.
✓ Branch 1 taken 4332974 times.
19763645 if (boundary_left &&
777
2/2
✓ Branch 0 taken 2020355 times.
✓ Branch 1 taken 13410316 times.
15430671 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
778
2/2
✓ Branch 0 taken 68545 times.
✓ Branch 1 taken 1951810 times.
2020355 lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
779
2/2
✓ Branch 0 taken 59894 times.
✓ Branch 1 taken 8651 times.
68545 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
780
2/2
✓ Branch 0 taken 441443 times.
✓ Branch 1 taken 14980577 times.
15422020 (!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 15408412 times.
✓ Branch 1 taken 4355233 times.
19763645 if (boundary_left) {
786 30816824 const RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ?
787
2/2
✓ Branch 0 taken 246139 times.
✓ Branch 1 taken 15162273 times.
15408412 ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) :
788 15162273 s->ref->refPicList;
789 15408412 int xp_pu = (x0 - 1) >> log2_min_pu_size;
790 15408412 int xq_pu = x0 >> log2_min_pu_size;
791 15408412 int xp_tu = (x0 - 1) >> log2_min_tu_size;
792 15408412 int xq_tu = x0 >> log2_min_tu_size;
793
794
2/2
✓ Branch 0 taken 48773968 times.
✓ Branch 1 taken 15408412 times.
64182380 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
795 48773968 int y_pu = (y0 + i) >> log2_min_pu_size;
796 48773968 int y_tu = (y0 + i) >> log2_min_tu_size;
797 48773968 const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
798 48773968 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
799 48773968 uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
800 48773968 uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
801
802
4/4
✓ Branch 0 taken 35874518 times.
✓ Branch 1 taken 12899450 times.
✓ Branch 2 taken 1358220 times.
✓ Branch 3 taken 34516298 times.
48773968 if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA)
803 14257670 bs = 2;
804
4/4
✓ Branch 0 taken 27607546 times.
✓ Branch 1 taken 6908752 times.
✓ Branch 2 taken 2769615 times.
✓ Branch 3 taken 24837931 times.
34516298 else if (curr_cbf_luma || left_cbf_luma)
805 9678367 bs = 1;
806 else
807 24837931 bs = boundary_strength(s, curr, left, rpl_left);
808 48773968 s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs;
809 }
810 }
811
812
4/4
✓ Branch 0 taken 10186728 times.
✓ Branch 1 taken 9576917 times.
✓ Branch 2 taken 7334386 times.
✓ Branch 3 taken 2852342 times.
19763645 if (log2_trafo_size > log2_min_pu_size && !is_intra) {
813 7334386 const RefPicList *rpl = s->ref->refPicList;
814
815 // bs for TU internal horizontal PU boundaries
816
2/2
✓ Branch 0 taken 9525849 times.
✓ Branch 1 taken 7334386 times.
16860235 for (j = 8; j < (1 << log2_trafo_size); j += 8) {
817 9525849 int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
818 9525849 int yq_pu = (y0 + j) >> log2_min_pu_size;
819
820
2/2
✓ Branch 0 taken 89850876 times.
✓ Branch 1 taken 9525849 times.
99376725 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
821 89850876 int x_pu = (x0 + i) >> log2_min_pu_size;
822 89850876 const MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
823 89850876 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
824
825 89850876 bs = boundary_strength(s, curr, top, rpl);
826 89850876 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 33720470 times.
✓ Branch 1 taken 7334386 times.
41054856 for (j = 0; j < (1 << log2_trafo_size); j += 4) {
832 33720470 int y_pu = (y0 + j) >> log2_min_pu_size;
833
834
2/2
✓ Branch 0 taken 89850876 times.
✓ Branch 1 taken 33720470 times.
123571346 for (i = 8; i < (1 << log2_trafo_size); i += 8) {
835 89850876 int xp_pu = (x0 + i - 1) >> log2_min_pu_size;
836 89850876 int xq_pu = (x0 + i) >> log2_min_pu_size;
837 89850876 const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
838 89850876 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
839
840 89850876 bs = boundary_strength(s, curr, left, rpl);
841 89850876 s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
842 }
843 }
844 }
845 19763645 }
846
847 #undef LUMA
848 #undef CB
849 #undef CR
850
851 1413754 void ff_hevc_hls_filter(HEVCLocalContext *lc, int x, int y, int ctb_size)
852 {
853 1413754 const HEVCContext *const s = lc->parent;
854 1413754 int x_end = x >= s->ps.sps->width - ctb_size;
855 1413754 int skip = 0;
856
1/2
✓ Branch 0 taken 1413754 times.
✗ Branch 1 not taken.
1413754 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
857
5/6
✓ Branch 0 taken 3060 times.
✓ Branch 1 taken 1410694 times.
✓ Branch 2 taken 2040 times.
✓ Branch 3 taken 1020 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2040 times.
1413754 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
858
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1410694 times.
1411714 (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 1410694 times.
1411714 (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 1410694 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1020 times.
1412734 (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 1411714 times.
✓ Branch 1 taken 2040 times.
1413754 if (!skip)
867 1411714 deblocking_filter_CTB(s, x, y);
868
4/4
✓ Branch 0 taken 1196764 times.
✓ Branch 1 taken 216990 times.
✓ Branch 2 taken 1194724 times.
✓ Branch 3 taken 2040 times.
2608478 if (s->ps.sps->sao_enabled && !skip) {
869 1194724 int y_end = y >= s->ps.sps->height - ctb_size;
870
4/4
✓ Branch 0 taken 1091125 times.
✓ Branch 1 taken 103599 times.
✓ Branch 2 taken 1035692 times.
✓ Branch 3 taken 55433 times.
1194724 if (y && x)
871 1035692 sao_filter_CTB(lc, s, x - ctb_size, y - ctb_size);
872
4/4
✓ Branch 0 taken 1130581 times.
✓ Branch 1 taken 64143 times.
✓ Branch 2 taken 94860 times.
✓ Branch 3 taken 1035721 times.
1194724 if (x && y_end)
873 94860 sao_filter_CTB(lc, s, x - ctb_size, y);
874
4/4
✓ Branch 0 taken 1091125 times.
✓ Branch 1 taken 103599 times.
✓ Branch 2 taken 55432 times.
✓ Branch 3 taken 1035693 times.
1194724 if (y && x_end) {
875 55432 sao_filter_CTB(lc, s, x, y - ctb_size);
876
2/2
✓ Branch 0 taken 497 times.
✓ Branch 1 taken 54935 times.
55432 if (s->threads_type & FF_THREAD_FRAME )
877 497 ff_thread_report_progress(&s->ref->tf, y, 0);
878 }
879
4/4
✓ Branch 0 taken 64142 times.
✓ Branch 1 taken 1130582 times.
✓ Branch 2 taken 8709 times.
✓ Branch 3 taken 55433 times.
1194724 if (x_end && y_end) {
880 8709 sao_filter_CTB(lc, s, x , y);
881
2/2
✓ Branch 0 taken 31 times.
✓ Branch 1 taken 8678 times.
8709 if (s->threads_type & FF_THREAD_FRAME )
882 31 ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0);
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_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0);
886 1413754 }
887
888 1413785 void ff_hevc_hls_filters(HEVCLocalContext *lc, int x_ctb, int y_ctb, int ctb_size)
889 {
890 1413785 int x_end = x_ctb >= lc->parent->ps.sps->width - ctb_size;
891 1413785 int y_end = y_ctb >= lc->parent->ps.sps->height - ctb_size;
892
4/4
✓ Branch 0 taken 1294669 times.
✓ Branch 1 taken 119116 times.
✓ Branch 2 taken 1230994 times.
✓ Branch 3 taken 63675 times.
1413785 if (y_ctb && x_ctb)
893 1230994 ff_hevc_hls_filter(lc, x_ctb - ctb_size, y_ctb - ctb_size, ctb_size);
894
4/4
✓ Branch 0 taken 1294669 times.
✓ Branch 1 taken 119116 times.
✓ Branch 2 taken 63674 times.
✓ Branch 3 taken 1230995 times.
1413785 if (y_ctb && x_end)
895 63674 ff_hevc_hls_filter(lc, x_ctb, y_ctb - ctb_size, ctb_size);
896
4/4
✓ Branch 0 taken 1340596 times.
✓ Branch 1 taken 73189 times.
✓ Branch 2 taken 109573 times.
✓ Branch 3 taken 1231023 times.
1413785 if (x_ctb && y_end)
897 109573 ff_hevc_hls_filter(lc, x_ctb - ctb_size, y_ctb, ctb_size);
898 1413785 }
899