FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hevc/filter.c
Date: 2024-07-16 12:46:59
Exec Total Coverage
Lines: 558 563 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 21973458 static int chroma_tc(const HEVCPPS *pps, const HEVCSPS *sps,
48 int qp_y, int c_idx, int tc_offset)
49 {
50 static const int qp_c[] = {
51 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37
52 };
53 int qp, qp_i, offset, idxt;
54
55 // slice qp offset is not used for deblocking
56
2/2
✓ Branch 0 taken 10986729 times.
✓ Branch 1 taken 10986729 times.
21973458 if (c_idx == 1)
57 10986729 offset = pps->cb_qp_offset;
58 else
59 10986729 offset = pps->cr_qp_offset;
60
61 21973458 qp_i = av_clip(qp_y + offset, 0, 57);
62
2/2
✓ Branch 0 taken 18493730 times.
✓ Branch 1 taken 3479728 times.
21973458 if (sps->chroma_format_idc == 1) {
63
2/2
✓ Branch 0 taken 3111793 times.
✓ Branch 1 taken 15381937 times.
18493730 if (qp_i < 30)
64 3111793 qp = qp_i;
65
2/2
✓ Branch 0 taken 153405 times.
✓ Branch 1 taken 15228532 times.
15381937 else if (qp_i > 43)
66 153405 qp = qp_i - 6;
67 else
68 15228532 qp = qp_c[qp_i - 30];
69 } else {
70 3479728 qp = av_clip(qp_i, 0, 51);
71 }
72
73 21973458 idxt = av_clip(qp + DEFAULT_INTRA_TC_OFFSET + tc_offset, 0, 53);
74 21973458 return tctable[idxt];
75 }
76
77 1400979 static int get_qPy_pred(HEVCLocalContext *lc, const HEVCContext *s,
78 const HEVCPPS *pps, const HEVCSPS *sps,
79 int xBase, int yBase, int log2_cb_size)
80 {
81 1400979 int ctb_size_mask = (1 << sps->log2_ctb_size) - 1;
82 1400979 int MinCuQpDeltaSizeMask = (1 << (sps->log2_ctb_size -
83 1400979 pps->diff_cu_qp_delta_depth)) - 1;
84 1400979 int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
85 1400979 int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
86 1400979 int min_cb_width = sps->min_cb_width;
87 1400979 int x_cb = xQgBase >> sps->log2_min_cb_size;
88 1400979 int y_cb = yQgBase >> sps->log2_min_cb_size;
89
2/2
✓ Branch 0 taken 953904 times.
✓ Branch 1 taken 447075 times.
2354883 int availableA = (xBase & ctb_size_mask) &&
90
2/2
✓ Branch 0 taken 816698 times.
✓ Branch 1 taken 137206 times.
953904 (xQgBase & ctb_size_mask);
91
2/2
✓ Branch 0 taken 936253 times.
✓ Branch 1 taken 464726 times.
2337232 int availableB = (yBase & ctb_size_mask) &&
92
2/2
✓ Branch 0 taken 814514 times.
✓ Branch 1 taken 121739 times.
936253 (yQgBase & ctb_size_mask);
93 int qPy_pred, qPy_a, qPy_b;
94
95 // qPy_pred
96
5/6
✓ Branch 0 taken 1311513 times.
✓ Branch 1 taken 89466 times.
✓ Branch 2 taken 18914 times.
✓ Branch 3 taken 1292599 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18914 times.
1400979 if (lc->first_qp_group || (!xQgBase && !yQgBase)) {
97 89466 lc->first_qp_group = !lc->tu.is_cu_qp_delta_coded;
98 89466 qPy_pred = s->sh.slice_qp;
99 } else {
100 1311513 qPy_pred = lc->qPy_pred;
101 }
102
103 // qPy_a
104
2/2
✓ Branch 0 taken 584281 times.
✓ Branch 1 taken 816698 times.
1400979 if (availableA == 0)
105 584281 qPy_a = qPy_pred;
106 else
107 816698 qPy_a = s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width];
108
109 // qPy_b
110
2/2
✓ Branch 0 taken 586465 times.
✓ Branch 1 taken 814514 times.
1400979 if (availableB == 0)
111 586465 qPy_b = qPy_pred;
112 else
113 814514 qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
114
115 av_assert2(qPy_a >= -sps->qp_bd_offset && qPy_a < 52);
116 av_assert2(qPy_b >= -sps->qp_bd_offset && qPy_b < 52);
117
118 1400979 return (qPy_a + qPy_b + 1) >> 1;
119 }
120
121 1400979 void ff_hevc_set_qPy(HEVCLocalContext *lc, const HEVCPPS *pps,
122 int xBase, int yBase, int log2_cb_size)
123 {
124 1400979 const HEVCSPS *const sps = pps->sps;
125 1400979 const HEVCContext *const s = lc->parent;
126 1400979 int qp_y = get_qPy_pred(lc, s, pps, sps, xBase, yBase, log2_cb_size);
127
128
2/2
✓ Branch 0 taken 370939 times.
✓ Branch 1 taken 1030040 times.
1400979 if (lc->tu.cu_qp_delta != 0) {
129 370939 int off = sps->qp_bd_offset;
130
1/2
✓ Branch 0 taken 370939 times.
✗ Branch 1 not taken.
370939 lc->qp_y = FFUMOD(qp_y + lc->tu.cu_qp_delta + 52 + 2 * off,
131 370939 52 + off) - off;
132 } else
133 1030040 lc->qp_y = qp_y;
134 1400979 }
135
136 114866670 static int get_qPy(const HEVCSPS *sps, const int8_t *qp_y_tab, int xC, int yC)
137 {
138 114866670 int log2_min_cb_size = sps->log2_min_cb_size;
139 114866670 int x = xC >> log2_min_cb_size;
140 114866670 int y = yC >> log2_min_cb_size;
141 114866670 return qp_y_tab[x + y * sps->min_cb_width];
142 }
143
144 381345 static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height,
145 ptrdiff_t stride_dst, ptrdiff_t stride_src)
146 {
147 int i, j;
148
149
2/2
✓ Branch 0 taken 55942 times.
✓ Branch 1 taken 325403 times.
381345 if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) {
150
2/2
✓ Branch 0 taken 2429792 times.
✓ Branch 1 taken 55942 times.
2485734 for (i = 0; i < height; i++) {
151
2/2
✓ Branch 0 taken 17011408 times.
✓ Branch 1 taken 2429792 times.
19441200 for (j = 0; j < width - 7; j+=8)
152 17011408 AV_COPY64U(dst+j, src+j);
153 2429792 dst += stride_dst;
154 2429792 src += stride_src;
155 }
156
2/2
✓ Branch 0 taken 55742 times.
✓ Branch 1 taken 200 times.
55942 if (width&7) {
157 55742 dst += ((width>>3)<<3) - stride_dst * height;
158 55742 src += ((width>>3)<<3) - stride_src * height;
159 55742 width &= 7;
160
2/2
✓ Branch 0 taken 2428192 times.
✓ Branch 1 taken 55742 times.
2483934 for (i = 0; i < height; i++) {
161
2/2
✓ Branch 0 taken 5305624 times.
✓ Branch 1 taken 2428192 times.
7733816 for (j = 0; j < width; j++)
162 5305624 dst[j] = src[j];
163 2428192 dst += stride_dst;
164 2428192 src += stride_src;
165 }
166 }
167 } else {
168
2/2
✓ Branch 0 taken 17137648 times.
✓ Branch 1 taken 325403 times.
17463051 for (i = 0; i < height; i++) {
169
2/2
✓ Branch 0 taken 87182552 times.
✓ Branch 1 taken 17137648 times.
104320200 for (j = 0; j < width; j+=16)
170 87182552 AV_COPY128(dst+j, src+j);
171 17137648 dst += stride_dst;
172 17137648 src += stride_src;
173 }
174 }
175 381345 }
176
177 1343253 static void copy_pixel(uint8_t *dst, const uint8_t *src, int pixel_shift)
178 {
179
2/2
✓ Branch 0 taken 223258 times.
✓ Branch 1 taken 1119995 times.
1343253 if (pixel_shift)
180 223258 *(uint16_t *)dst = *(uint16_t *)src;
181 else
182 1119995 *dst = *src;
183 1343253 }
184
185 1293193 static void copy_vert(uint8_t *dst, const uint8_t *src,
186 int pixel_shift, int height,
187 ptrdiff_t stride_dst, ptrdiff_t stride_src)
188 {
189 int i;
190
2/2
✓ Branch 0 taken 1111763 times.
✓ Branch 1 taken 181430 times.
1293193 if (pixel_shift == 0) {
191
2/2
✓ Branch 0 taken 52399728 times.
✓ Branch 1 taken 1111763 times.
53511491 for (i = 0; i < height; i++) {
192 52399728 *dst = *src;
193 52399728 dst += stride_dst;
194 52399728 src += stride_src;
195 }
196 } else {
197
2/2
✓ Branch 0 taken 11292912 times.
✓ Branch 1 taken 181430 times.
11474342 for (i = 0; i < height; i++) {
198 11292912 *(uint16_t *)dst = *(uint16_t *)src;
199 11292912 dst += stride_dst;
200 11292912 src += stride_src;
201 }
202 }
203 1293193 }
204
205 492376 static void copy_CTB_to_hv(const HEVCContext *s, const HEVCSPS *sps,
206 const uint8_t *src,
207 ptrdiff_t stride_src, int x, int y, int width, int height,
208 int c_idx, int x_ctb, int y_ctb)
209 {
210 492376 int sh = sps->pixel_shift;
211 492376 int w = sps->width >> sps->hshift[c_idx];
212 492376 int h = sps->height >> sps->vshift[c_idx];
213
214 /* copy horizontal edges */
215 492376 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << sh),
216 492376 src, width << sh);
217 492376 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << sh),
218 492376 src + stride_src * (height - 1), width << sh);
219
220 /* copy vertical edges */
221 492376 copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << sh), src, sh, height, 1 << sh, stride_src);
222
223 492376 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);
224 492376 }
225
226 381345 static void restore_tqb_pixels(const HEVCContext *s,
227 const HEVCPPS *pps, const HEVCSPS *sps,
228 uint8_t *src1, const uint8_t *dst1,
229 ptrdiff_t stride_src, ptrdiff_t stride_dst,
230 int x0, int y0, int width, int height, int c_idx)
231 {
232
2/2
✓ Branch 0 taken 377056 times.
✓ Branch 1 taken 4289 times.
381345 if (pps->transquant_bypass_enable_flag ||
233
3/4
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 376952 times.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
377056 (sps->pcm_loop_filter_disabled && sps->pcm_enabled)) {
234 int x, y;
235 4393 int min_pu_size = 1 << sps->log2_min_pu_size;
236 4393 int hshift = sps->hshift[c_idx];
237 4393 int vshift = sps->vshift[c_idx];
238 4393 int x_min = ((x0 ) >> sps->log2_min_pu_size);
239 4393 int y_min = ((y0 ) >> sps->log2_min_pu_size);
240 4393 int x_max = ((x0 + width ) >> sps->log2_min_pu_size);
241 4393 int y_max = ((y0 + height) >> sps->log2_min_pu_size);
242 4393 int len = (min_pu_size >> hshift) << sps->pixel_shift;
243
2/2
✓ Branch 0 taken 49472 times.
✓ Branch 1 taken 4393 times.
53865 for (y = y_min; y < y_max; y++) {
244
2/2
✓ Branch 0 taken 632704 times.
✓ Branch 1 taken 49472 times.
682176 for (x = x_min; x < x_max; x++) {
245
2/2
✓ Branch 0 taken 264 times.
✓ Branch 1 taken 632440 times.
632704 if (s->is_pcm[y * sps->min_pu_width + x]) {
246 int n;
247 264 uint8_t *src = src1 +
248 264 (((y << sps->log2_min_pu_size) - y0) >> vshift) * stride_src +
249 264 ((((x << sps->log2_min_pu_size) - x0) >> hshift) << sps->pixel_shift);
250 264 const uint8_t *dst = dst1 +
251 264 (((y << sps->log2_min_pu_size) - y0) >> vshift) * stride_dst +
252 264 ((((x << sps->log2_min_pu_size) - x0) >> hshift) << sps->pixel_shift);
253
254
2/2
✓ Branch 0 taken 704 times.
✓ Branch 1 taken 264 times.
968 for (n = 0; n < (min_pu_size >> vshift); n++) {
255 704 memcpy(src, dst, len);
256 704 src += stride_src;
257 704 dst += stride_dst;
258 }
259 }
260 }
261 }
262 }
263 381345 }
264
265 #define CTB(tab, x, y) ((tab)[(y) * sps->ctb_width + (x)])
266
267 1197661 static void sao_filter_CTB(HEVCLocalContext *lc, const HEVCContext *s,
268 const HEVCPPS *pps, const HEVCSPS *sps,
269 int x, int y)
270 {
271 static const uint8_t sao_tab[8] = { 0, 1, 2, 2, 3, 3, 4, 4 };
272 int c_idx;
273 int edges[4]; // 0 left 1 top 2 right 3 bottom
274 1197661 int x_ctb = x >> sps->log2_ctb_size;
275 1197661 int y_ctb = y >> sps->log2_ctb_size;
276 1197661 int ctb_addr_rs = y_ctb * sps->ctb_width + x_ctb;
277 1197661 int ctb_addr_ts = pps->ctb_addr_rs_to_ts[ctb_addr_rs];
278 1197661 SAOParams *sao = &CTB(s->sao, x_ctb, y_ctb);
279 // flags indicating unfilterable edges
280 1197661 uint8_t vert_edge[] = { 0, 0 };
281 1197661 uint8_t horiz_edge[] = { 0, 0 };
282 1197661 uint8_t diag_edge[] = { 0, 0, 0, 0 };
283 1197661 uint8_t lfase = CTB(s->filter_slice_edges, x_ctb, y_ctb);
284
2/2
✓ Branch 0 taken 170200 times.
✓ Branch 1 taken 1027461 times.
1367861 uint8_t no_tile_filter = pps->tiles_enabled_flag &&
285
2/2
✓ Branch 0 taken 16664 times.
✓ Branch 1 taken 153536 times.
170200 !pps->loop_filter_across_tiles_enabled_flag;
286
4/4
✓ Branch 0 taken 1180997 times.
✓ Branch 1 taken 16664 times.
✓ Branch 2 taken 52450 times.
✓ Branch 3 taken 1128547 times.
1197661 uint8_t restore = no_tile_filter || !lfase;
287 1197661 uint8_t left_tile_edge = 0;
288 1197661 uint8_t right_tile_edge = 0;
289 1197661 uint8_t up_tile_edge = 0;
290 1197661 uint8_t bottom_tile_edge = 0;
291
292 1197661 edges[0] = x_ctb == 0;
293 1197661 edges[1] = y_ctb == 0;
294 1197661 edges[2] = x_ctb == sps->ctb_width - 1;
295 1197661 edges[3] = y_ctb == sps->ctb_height - 1;
296
297
2/2
✓ Branch 0 taken 69114 times.
✓ Branch 1 taken 1128547 times.
1197661 if (restore) {
298
2/2
✓ Branch 0 taken 65478 times.
✓ Branch 1 taken 3636 times.
69114 if (!edges[0]) {
299
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 && pps->tile_id[ctb_addr_ts] != pps->tile_id[pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]];
300
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;
301 }
302
2/2
✓ Branch 0 taken 65479 times.
✓ Branch 1 taken 3635 times.
69114 if (!edges[2]) {
303
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 && pps->tile_id[ctb_addr_ts] != pps->tile_id[pps->ctb_addr_rs_to_ts[ctb_addr_rs+1]];
304
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;
305 }
306
2/2
✓ Branch 0 taken 62780 times.
✓ Branch 1 taken 6334 times.
69114 if (!edges[1]) {
307
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 && pps->tile_id[ctb_addr_ts] != pps->tile_id[pps->ctb_addr_rs_to_ts[ctb_addr_rs - sps->ctb_width]];
308
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;
309 }
310
2/2
✓ Branch 0 taken 62810 times.
✓ Branch 1 taken 6304 times.
69114 if (!edges[3]) {
311
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 && pps->tile_id[ctb_addr_ts] != pps->tile_id[pps->ctb_addr_rs_to_ts[ctb_addr_rs + sps->ctb_width]];
312
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;
313 }
314
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]) {
315
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;
316 }
317
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]) {
318
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;
319 }
320
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]) {
321
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;
322 }
323
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]) {
324
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;
325 }
326 }
327
328
4/4
✓ Branch 0 taken 4790452 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 3592887 times.
✓ Branch 3 taken 1197661 times.
4790548 for (c_idx = 0; c_idx < (sps->chroma_format_idc ? 3 : 1); c_idx++) {
329 3592887 int x0 = x >> sps->hshift[c_idx];
330 3592887 int y0 = y >> sps->vshift[c_idx];
331 3592887 ptrdiff_t stride_src = s->cur_frame->f->linesize[c_idx];
332 3592887 int ctb_size_h = (1 << (sps->log2_ctb_size)) >> sps->hshift[c_idx];
333 3592887 int ctb_size_v = (1 << (sps->log2_ctb_size)) >> sps->vshift[c_idx];
334 3592887 int width = FFMIN(ctb_size_h, (sps->width >> sps->hshift[c_idx]) - x0);
335 3592887 int height = FFMIN(ctb_size_v, (sps->height >> sps->vshift[c_idx]) - y0);
336 3592887 int tab = sao_tab[(FFALIGN(width, 8) >> 3) - 1];
337 3592887 uint8_t *src = &s->cur_frame->f->data[c_idx][y0 * stride_src + (x0 << sps->pixel_shift)];
338 ptrdiff_t stride_dst;
339 uint8_t *dst;
340
341
3/3
✓ Branch 0 taken 111800 times.
✓ Branch 1 taken 380576 times.
✓ Branch 2 taken 3100511 times.
3592887 switch (sao->type_idx[c_idx]) {
342 111800 case SAO_BAND:
343 111800 copy_CTB_to_hv(s, sps, src, stride_src, x0, y0, width, height, c_idx,
344 x_ctb, y_ctb);
345
2/2
✓ Branch 0 taken 111039 times.
✓ Branch 1 taken 761 times.
111800 if (pps->transquant_bypass_enable_flag ||
346
3/4
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 111031 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
111039 (sps->pcm_loop_filter_disabled && sps->pcm_enabled)) {
347 769 dst = lc->edge_emu_buffer;
348 769 stride_dst = 2*MAX_PB_SIZE;
349 769 copy_CTB(dst, src, width << sps->pixel_shift, height, stride_dst, stride_src);
350 769 s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst,
351 769 sao->offset_val[c_idx], sao->band_position[c_idx],
352 width, height);
353 769 restore_tqb_pixels(s, pps, sps, src, dst, stride_src, stride_dst,
354 x, y, width, height, c_idx);
355 } else {
356 111031 s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src,
357 111031 sao->offset_val[c_idx], sao->band_position[c_idx],
358 width, height);
359 }
360 111800 sao->type_idx[c_idx] = SAO_APPLIED;
361 111800 break;
362 380576 case SAO_EDGE:
363 {
364 380576 int w = sps->width >> sps->hshift[c_idx];
365 380576 int h = sps->height >> sps->vshift[c_idx];
366 380576 int left_edge = edges[0];
367 380576 int top_edge = edges[1];
368 380576 int right_edge = edges[2];
369 380576 int bottom_edge = edges[3];
370 380576 int sh = sps->pixel_shift;
371 int left_pixels, right_pixels;
372
373 380576 stride_dst = 2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE;
374 380576 dst = lc->edge_emu_buffer + stride_dst + AV_INPUT_BUFFER_PADDING_SIZE;
375
376
2/2
✓ Branch 0 taken 354532 times.
✓ Branch 1 taken 26044 times.
380576 if (!top_edge) {
377 354532 int left = 1 - left_edge;
378 354532 int right = 1 - right_edge;
379 const uint8_t *src1[2];
380 uint8_t *dst1;
381 int src_idx, pos;
382
383 354532 dst1 = dst - stride_dst - (left << sh);
384 354532 src1[0] = src - stride_src - (left << sh);
385 354532 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0 - left) << sh);
386 354532 pos = 0;
387
2/2
✓ Branch 0 taken 337791 times.
✓ Branch 1 taken 16741 times.
354532 if (left) {
388 337791 src_idx = (CTB(s->sao, x_ctb-1, y_ctb-1).type_idx[c_idx] ==
389 SAO_APPLIED);
390 337791 copy_pixel(dst1, src1[src_idx], sh);
391 337791 pos += (1 << sh);
392 }
393 354532 src_idx = (CTB(s->sao, x_ctb, y_ctb-1).type_idx[c_idx] ==
394 SAO_APPLIED);
395 354532 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
396
2/2
✓ Branch 0 taken 337466 times.
✓ Branch 1 taken 17066 times.
354532 if (right) {
397 337466 pos += width << sh;
398 337466 src_idx = (CTB(s->sao, x_ctb+1, y_ctb-1).type_idx[c_idx] ==
399 SAO_APPLIED);
400 337466 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
401 }
402 }
403
2/2
✓ Branch 0 taken 350488 times.
✓ Branch 1 taken 30088 times.
380576 if (!bottom_edge) {
404 350488 int left = 1 - left_edge;
405 350488 int right = 1 - right_edge;
406 const uint8_t *src1[2];
407 uint8_t *dst1;
408 int src_idx, pos;
409
410 350488 dst1 = dst + height * stride_dst - (left << sh);
411 350488 src1[0] = src + height * stride_src - (left << sh);
412 350488 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0 - left) << sh);
413 350488 pos = 0;
414
2/2
✓ Branch 0 taken 334323 times.
✓ Branch 1 taken 16165 times.
350488 if (left) {
415 334323 src_idx = (CTB(s->sao, x_ctb-1, y_ctb+1).type_idx[c_idx] ==
416 SAO_APPLIED);
417 334323 copy_pixel(dst1, src1[src_idx], sh);
418 334323 pos += (1 << sh);
419 }
420 350488 src_idx = (CTB(s->sao, x_ctb, y_ctb+1).type_idx[c_idx] ==
421 SAO_APPLIED);
422 350488 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
423
2/2
✓ Branch 0 taken 333673 times.
✓ Branch 1 taken 16815 times.
350488 if (right) {
424 333673 pos += width << sh;
425 333673 src_idx = (CTB(s->sao, x_ctb+1, y_ctb+1).type_idx[c_idx] ==
426 SAO_APPLIED);
427 333673 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
428 }
429 }
430 380576 left_pixels = 0;
431
2/2
✓ Branch 0 taken 361817 times.
✓ Branch 1 taken 18759 times.
380576 if (!left_edge) {
432
2/2
✓ Branch 0 taken 308441 times.
✓ Branch 1 taken 53376 times.
361817 if (CTB(s->sao, x_ctb-1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
433 308441 copy_vert(dst - (1 << sh),
434 308441 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh),
435 308441 sh, height, stride_dst, 1 << sh);
436 } else {
437 53376 left_pixels = 1;
438 }
439 }
440 380576 right_pixels = 0;
441
2/2
✓ Branch 0 taken 361384 times.
✓ Branch 1 taken 19192 times.
380576 if (!right_edge) {
442
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 361384 times.
361384 if (CTB(s->sao, x_ctb+1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
443 copy_vert(dst + (width << sh),
444 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) * h + y0) << sh),
445 sh, height, stride_dst, 1 << sh);
446 } else {
447 361384 right_pixels = 1;
448 }
449 }
450
451 380576 copy_CTB(dst - (left_pixels << sh),
452 380576 src - (left_pixels << sh),
453 380576 (width + left_pixels + right_pixels) << sh,
454 height, stride_dst, stride_src);
455
456 380576 copy_CTB_to_hv(s, sps, src, stride_src, x0, y0, width, height, c_idx,
457 x_ctb, y_ctb);
458 380576 s->hevcdsp.sao_edge_filter[tab](src, dst, stride_src, sao->offset_val[c_idx],
459 sao->eo_class[c_idx], width, height);
460 380576 s->hevcdsp.sao_edge_restore[restore](src, dst,
461 stride_src, stride_dst,
462 sao,
463 edges, width,
464 height, c_idx,
465 vert_edge,
466 horiz_edge,
467 diag_edge);
468 380576 restore_tqb_pixels(s, pps, sps, src, dst, stride_src, stride_dst,
469 x, y, width, height, c_idx);
470 380576 sao->type_idx[c_idx] = SAO_APPLIED;
471 380576 break;
472 }
473 }
474 }
475 1197661 }
476
477 2057768 static int get_pcm(const HEVCSPS *sps, const uint8_t *is_pcm, int x, int y)
478 {
479 2057768 int log2_min_pu_size = sps->log2_min_pu_size;
480 int x_pu, y_pu;
481
482
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)
483 return 2;
484
485 2057768 x_pu = x >> log2_min_pu_size;
486 2057768 y_pu = y >> log2_min_pu_size;
487
488
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 >= sps->min_pu_width || y_pu >= sps->min_pu_height)
489 1408 return 2;
490 2056360 return is_pcm[y_pu * sps->min_pu_width + x_pu];
491 }
492
493 #define TC_CALC(qp, bs) \
494 tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + \
495 (tc_offset & -2), \
496 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
497
498 1414682 static void deblocking_filter_CTB(const HEVCContext *s,
499 const HEVCPPS *pps, const HEVCSPS *sps,
500 int x0, int y0)
501 {
502 1414682 uint8_t **data = s->cur_frame->f->data;
503 1414682 int *linesize = s->cur_frame->f->linesize;
504
505 uint8_t *src;
506 int x, y;
507 int chroma, beta;
508 int32_t c_tc[2], tc[2];
509 1414682 uint8_t no_p[2] = { 0 };
510 1414682 uint8_t no_q[2] = { 0 };
511
512 1414682 int log2_ctb_size = sps->log2_ctb_size;
513 int x_end, x_end2, y_end;
514 1414682 int ctb_size = 1 << log2_ctb_size;
515 1414682 int ctb = (x0 >> log2_ctb_size) +
516 1414682 (y0 >> log2_ctb_size) * sps->ctb_width;
517 1414682 int cur_tc_offset = s->deblock[ctb].tc_offset;
518 1414682 int cur_beta_offset = s->deblock[ctb].beta_offset;
519 int left_tc_offset, left_beta_offset;
520 int tc_offset, beta_offset;
521 2916745 int pcmf = (sps->pcm_enabled &&
522
4/4
✓ Branch 0 taken 87381 times.
✓ Branch 1 taken 1327301 times.
✓ Branch 2 taken 87325 times.
✓ Branch 3 taken 56 times.
2829308 sps->pcm_loop_filter_disabled) ||
523
2/2
✓ Branch 0 taken 4570 times.
✓ Branch 1 taken 1410056 times.
1414626 pps->transquant_bypass_enable_flag;
524
525
2/2
✓ Branch 0 taken 1341390 times.
✓ Branch 1 taken 73292 times.
1414682 if (x0) {
526 1341390 left_tc_offset = s->deblock[ctb - 1].tc_offset;
527 1341390 left_beta_offset = s->deblock[ctb - 1].beta_offset;
528 } else {
529 73292 left_tc_offset = 0;
530 73292 left_beta_offset = 0;
531 }
532
533 1414682 x_end = x0 + ctb_size;
534
2/2
✓ Branch 0 taken 25416 times.
✓ Branch 1 taken 1389266 times.
1414682 if (x_end > sps->width)
535 25416 x_end = sps->width;
536 1414682 y_end = y0 + ctb_size;
537
2/2
✓ Branch 0 taken 96312 times.
✓ Branch 1 taken 1318370 times.
1414682 if (y_end > sps->height)
538 96312 y_end = sps->height;
539
540 1414682 tc_offset = cur_tc_offset;
541 1414682 beta_offset = cur_beta_offset;
542
543 1414682 x_end2 = x_end;
544
2/2
✓ Branch 0 taken 1341391 times.
✓ Branch 1 taken 73291 times.
1414682 if (x_end2 != sps->width)
545 1341391 x_end2 -= 8;
546
2/2
✓ Branch 0 taken 10163502 times.
✓ Branch 1 taken 1414682 times.
11578184 for (y = y0; y < y_end; y += 8) {
547 // vertical filtering luma
548
4/4
✓ Branch 0 taken 9632015 times.
✓ Branch 1 taken 531487 times.
✓ Branch 2 taken 77208845 times.
✓ Branch 3 taken 10163502 times.
87372347 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
549 77208845 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
550 77208845 const int bs1 = s->vertical_bs[(x + (y + 4) * s->bs_width) >> 2];
551
4/4
✓ Branch 0 taken 59869698 times.
✓ Branch 1 taken 17339147 times.
✓ Branch 2 taken 89497 times.
✓ Branch 3 taken 59780201 times.
77208845 if (bs0 || bs1) {
552 17428644 const int qp = (get_qPy(sps, s->qp_y_tab, x - 1, y) +
553 17428644 get_qPy(sps, s->qp_y_tab, x, y) + 1) >> 1;
554
555 17428644 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
556
557
2/2
✓ Branch 0 taken 17339147 times.
✓ Branch 1 taken 89497 times.
17428644 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
558
2/2
✓ Branch 0 taken 17332506 times.
✓ Branch 1 taken 96138 times.
17428644 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
559 17428644 src = &data[LUMA][y * linesize[LUMA] + (x << sps->pixel_shift)];
560
2/2
✓ Branch 0 taken 186079 times.
✓ Branch 1 taken 17242565 times.
17428644 if (pcmf) {
561 186079 no_p[0] = get_pcm(sps, s->is_pcm, x - 1, y);
562 186079 no_p[1] = get_pcm(sps, s->is_pcm, x - 1, y + 4);
563 186079 no_q[0] = get_pcm(sps, s->is_pcm, x, y);
564 186079 no_q[1] = get_pcm(sps, s->is_pcm, x, y + 4);
565 186079 s->hevcdsp.hevc_v_loop_filter_luma_c(src, linesize[LUMA],
566 beta, tc, no_p, no_q);
567 } else
568 17242565 s->hevcdsp.hevc_v_loop_filter_luma(src, linesize[LUMA],
569 beta, tc, no_p, no_q);
570 }
571 }
572
573
2/2
✓ Branch 0 taken 119303 times.
✓ Branch 1 taken 10044199 times.
10163502 if(!y)
574 119303 continue;
575
576 // horizontal filtering luma
577
4/4
✓ Branch 0 taken 9522247 times.
✓ Branch 1 taken 521952 times.
✓ Branch 2 taken 76865739 times.
✓ Branch 3 taken 10044199 times.
86909938 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
578 76865739 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
579 76865739 const int bs1 = s->horizontal_bs[((x + 4) + y * s->bs_width) >> 2];
580
4/4
✓ Branch 0 taken 59203162 times.
✓ Branch 1 taken 17662577 times.
✓ Branch 2 taken 106170 times.
✓ Branch 3 taken 59096992 times.
76865739 if (bs0 || bs1) {
581 17768747 const int qp = (get_qPy(sps, s->qp_y_tab, x, y - 1) +
582 17768747 get_qPy(sps, s->qp_y_tab, x, y) + 1) >> 1;
583
584
2/2
✓ Branch 0 taken 15549090 times.
✓ Branch 1 taken 2219657 times.
17768747 tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
585
2/2
✓ Branch 0 taken 15549090 times.
✓ Branch 1 taken 2219657 times.
17768747 beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
586
587 17768747 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
588
2/2
✓ Branch 0 taken 17662577 times.
✓ Branch 1 taken 106170 times.
17768747 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
589
2/2
✓ Branch 0 taken 17647852 times.
✓ Branch 1 taken 120895 times.
17768747 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
590 17768747 src = &data[LUMA][y * linesize[LUMA] + (x << sps->pixel_shift)];
591
2/2
✓ Branch 0 taken 187803 times.
✓ Branch 1 taken 17580944 times.
17768747 if (pcmf) {
592 187803 no_p[0] = get_pcm(sps, s->is_pcm, x, y - 1);
593 187803 no_p[1] = get_pcm(sps, s->is_pcm, x + 4, y - 1);
594 187803 no_q[0] = get_pcm(sps, s->is_pcm, x, y);
595 187803 no_q[1] = get_pcm(sps, s->is_pcm, x + 4, y);
596 187803 s->hevcdsp.hevc_h_loop_filter_luma_c(src, linesize[LUMA],
597 beta, tc, no_p, no_q);
598 } else
599 17580944 s->hevcdsp.hevc_h_loop_filter_luma(src, linesize[LUMA],
600 beta, tc, no_p, no_q);
601 }
602 }
603 }
604
605
2/2
✓ Branch 0 taken 1414634 times.
✓ Branch 1 taken 48 times.
1414682 if (sps->chroma_format_idc) {
606
2/2
✓ Branch 0 taken 2829268 times.
✓ Branch 1 taken 1414634 times.
4243902 for (chroma = 1; chroma <= 2; chroma++) {
607 2829268 int h = 1 << sps->hshift[chroma];
608 2829268 int v = 1 << sps->vshift[chroma];
609
610 // vertical filtering chroma
611
2/2
✓ Branch 0 taken 10636970 times.
✓ Branch 1 taken 2829268 times.
13466238 for (y = y0; y < y_end; y += (8 * v)) {
612
4/4
✓ Branch 0 taken 544774 times.
✓ Branch 1 taken 10092196 times.
✓ Branch 2 taken 40985684 times.
✓ Branch 3 taken 10636970 times.
51622654 for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
613 40985684 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
614 40985684 const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * s->bs_width) >> 2];
615
616
4/4
✓ Branch 0 taken 35341132 times.
✓ Branch 1 taken 5644552 times.
✓ Branch 2 taken 128736 times.
✓ Branch 3 taken 35212396 times.
40985684 if ((bs0 == 2) || (bs1 == 2)) {
617 5773288 const int qp0 = (get_qPy(sps, s->qp_y_tab, x - 1, y) +
618 5773288 get_qPy(sps, s->qp_y_tab, x, y) + 1) >> 1;
619 5773288 const int qp1 = (get_qPy(sps, s->qp_y_tab, x - 1, y + (4 * v)) +
620 5773288 get_qPy(sps, s->qp_y_tab, x, y + (4 * v)) + 1) >> 1;
621
622
2/2
✓ Branch 0 taken 5644552 times.
✓ Branch 1 taken 128736 times.
5773288 c_tc[0] = (bs0 == 2) ? chroma_tc(pps, sps, qp0, chroma, tc_offset) : 0;
623
2/2
✓ Branch 0 taken 5639538 times.
✓ Branch 1 taken 133750 times.
5773288 c_tc[1] = (bs1 == 2) ? chroma_tc(pps, sps, qp1, chroma, tc_offset) : 0;
624 5773288 src = &data[chroma][(y >> sps->vshift[chroma]) * linesize[chroma] + ((x >> sps->hshift[chroma]) << sps->pixel_shift)];
625
2/2
✓ Branch 0 taken 70838 times.
✓ Branch 1 taken 5702450 times.
5773288 if (pcmf) {
626 70838 no_p[0] = get_pcm(sps, s->is_pcm, x - 1, y);
627 70838 no_p[1] = get_pcm(sps, s->is_pcm, x - 1, y + (4 * v));
628 70838 no_q[0] = get_pcm(sps, s->is_pcm, x, y);
629 70838 no_q[1] = get_pcm(sps, s->is_pcm, x, y + (4 * v));
630 70838 s->hevcdsp.hevc_v_loop_filter_chroma_c(src, linesize[chroma],
631 c_tc, no_p, no_q);
632 } else
633 5702450 s->hevcdsp.hevc_v_loop_filter_chroma(src, linesize[chroma],
634 c_tc, no_p, no_q);
635 }
636 }
637
638
2/2
✓ Branch 0 taken 238582 times.
✓ Branch 1 taken 10398388 times.
10636970 if(!y)
639 238582 continue;
640
641 // horizontal filtering chroma
642
2/2
✓ Branch 0 taken 9872680 times.
✓ Branch 1 taken 525708 times.
10398388 tc_offset = x0 ? left_tc_offset : cur_tc_offset;
643 10398388 x_end2 = x_end;
644
2/2
✓ Branch 0 taken 9872688 times.
✓ Branch 1 taken 525700 times.
10398388 if (x_end != sps->width)
645 9872688 x_end2 = x_end - 8 * h;
646
4/4
✓ Branch 0 taken 9872680 times.
✓ Branch 1 taken 525708 times.
✓ Branch 2 taken 40649278 times.
✓ Branch 3 taken 10398388 times.
51047666 for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
647 40649278 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
648 40649278 const int bs1 = s->horizontal_bs[((x + 4 * h) + y * s->bs_width) >> 2];
649
4/4
✓ Branch 0 taken 35303810 times.
✓ Branch 1 taken 5345468 times.
✓ Branch 2 taken 134106 times.
✓ Branch 3 taken 35169704 times.
40649278 if ((bs0 == 2) || (bs1 == 2)) {
650 5345468 const int qp0 = bs0 == 2 ? (get_qPy(sps, s->qp_y_tab, x, y - 1) +
651
2/2
✓ Branch 0 taken 5345468 times.
✓ Branch 1 taken 134106 times.
10825042 get_qPy(sps, s->qp_y_tab, x, y) + 1) >> 1 : 0;
652 5343900 const int qp1 = bs1 == 2 ? (get_qPy(sps, s->qp_y_tab, x + (4 * h), y - 1) +
653
2/2
✓ Branch 0 taken 5343900 times.
✓ Branch 1 taken 135674 times.
10823474 get_qPy(sps, s->qp_y_tab, x + (4 * h), y) + 1) >> 1 : 0;
654
655
2/2
✓ Branch 0 taken 5345468 times.
✓ Branch 1 taken 134106 times.
5479574 c_tc[0] = bs0 == 2 ? chroma_tc(pps, sps, qp0, chroma, tc_offset) : 0;
656
2/2
✓ Branch 0 taken 5343900 times.
✓ Branch 1 taken 135674 times.
5479574 c_tc[1] = bs1 == 2 ? chroma_tc(pps, sps, qp1, chroma, cur_tc_offset) : 0;
657 5479574 src = &data[chroma][(y >> sps->vshift[1]) * linesize[chroma] + ((x >> sps->hshift[1]) << sps->pixel_shift)];
658
2/2
✓ Branch 0 taken 69722 times.
✓ Branch 1 taken 5409852 times.
5479574 if (pcmf) {
659 69722 no_p[0] = get_pcm(sps, s->is_pcm, x, y - 1);
660 69722 no_p[1] = get_pcm(sps, s->is_pcm, x + (4 * h), y - 1);
661 69722 no_q[0] = get_pcm(sps, s->is_pcm, x, y);
662 69722 no_q[1] = get_pcm(sps, s->is_pcm, x + (4 * h), y);
663 69722 s->hevcdsp.hevc_h_loop_filter_chroma_c(src, linesize[chroma],
664 c_tc, no_p, no_q);
665 } else
666 5409852 s->hevcdsp.hevc_h_loop_filter_chroma(src, linesize[chroma],
667 c_tc, no_p, no_q);
668 }
669 }
670 }
671 }
672 }
673 1414682 }
674
675 229411053 static int boundary_strength(const HEVCContext *s, const MvField *curr, const MvField *neigh,
676 const RefPicList *neigh_refPicList)
677 {
678
4/4
✓ Branch 0 taken 145648622 times.
✓ Branch 1 taken 83762431 times.
✓ Branch 2 taken 141303586 times.
✓ Branch 3 taken 4345036 times.
229411053 if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) {
679 // same L0 and L1
680
2/2
✓ Branch 0 taken 139605303 times.
✓ Branch 1 taken 1698283 times.
141303586 if (s->cur_frame->refPicList[0].list[curr->ref_idx[0]] == neigh_refPicList[0].list[neigh->ref_idx[0]] &&
681
2/2
✓ Branch 0 taken 18325892 times.
✓ Branch 1 taken 121279411 times.
139605303 s->cur_frame->refPicList[0].list[curr->ref_idx[0]] == s->cur_frame->refPicList[1].list[curr->ref_idx[1]] &&
682
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]]) {
683
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 ||
684
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) &&
685
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 ||
686
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))
687 410243 return 1;
688 else
689 17777196 return 0;
690
2/2
✓ Branch 0 taken 121417864 times.
✓ Branch 1 taken 1698283 times.
123116147 } else if (neigh_refPicList[0].list[neigh->ref_idx[0]] == s->cur_frame->refPicList[0].list[curr->ref_idx[0]] &&
691
2/2
✓ Branch 0 taken 120840775 times.
✓ Branch 1 taken 577089 times.
121417864 neigh_refPicList[1].list[neigh->ref_idx[1]] == s->cur_frame->refPicList[1].list[curr->ref_idx[1]]) {
692
4/4
✓ Branch 0 taken 117227235 times.
✓ Branch 1 taken 3613540 times.
✓ Branch 2 taken 116369263 times.
✓ Branch 3 taken 857972 times.
120840775 if (FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 ||
693
4/4
✓ Branch 0 taken 115895565 times.
✓ Branch 1 taken 473698 times.
✓ Branch 2 taken 150353 times.
✓ Branch 3 taken 115745212 times.
116369263 FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4)
694 5095563 return 1;
695 else
696 115745212 return 0;
697
2/2
✓ Branch 0 taken 704498 times.
✓ Branch 1 taken 1570874 times.
2275372 } else if (neigh_refPicList[1].list[neigh->ref_idx[1]] == s->cur_frame->refPicList[0].list[curr->ref_idx[0]] &&
698
2/2
✓ Branch 0 taken 151937 times.
✓ Branch 1 taken 552561 times.
704498 neigh_refPicList[0].list[neigh->ref_idx[0]] == s->cur_frame->refPicList[1].list[curr->ref_idx[1]]) {
699
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 ||
700
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)
701 74847 return 1;
702 else
703 77090 return 0;
704 } else {
705 2123435 return 1;
706 }
707
4/4
✓ Branch 0 taken 83762431 times.
✓ Branch 1 taken 4345036 times.
✓ Branch 2 taken 79438494 times.
✓ Branch 3 taken 4323937 times.
88107467 } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV
708 Mv A, B;
709 int ref_A, ref_B;
710
711
2/2
✓ Branch 0 taken 67955829 times.
✓ Branch 1 taken 11482665 times.
79438494 if (curr->pred_flag & 1) {
712 67955829 A = curr->mv[0];
713 67955829 ref_A = s->cur_frame->refPicList[0].list[curr->ref_idx[0]];
714 } else {
715 11482665 A = curr->mv[1];
716 11482665 ref_A = s->cur_frame->refPicList[1].list[curr->ref_idx[1]];
717 }
718
719
2/2
✓ Branch 0 taken 67970960 times.
✓ Branch 1 taken 11467534 times.
79438494 if (neigh->pred_flag & 1) {
720 67970960 B = neigh->mv[0];
721 67970960 ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]];
722 } else {
723 11467534 B = neigh->mv[1];
724 11467534 ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]];
725 }
726
727
2/2
✓ Branch 0 taken 75758177 times.
✓ Branch 1 taken 3680317 times.
79438494 if (ref_A == ref_B) {
728
4/4
✓ Branch 0 taken 73877615 times.
✓ Branch 1 taken 1880562 times.
✓ Branch 2 taken 627067 times.
✓ Branch 3 taken 73250548 times.
75758177 if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4)
729 2507629 return 1;
730 else
731 73250548 return 0;
732 } else
733 3680317 return 1;
734 }
735
736 8668973 return 1;
737 }
738
739 19784770 void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, const HEVCPPS *pps,
740 int x0, int y0, int log2_trafo_size)
741 {
742 19784770 const HEVCSPS *const sps = pps->sps;
743 19784770 const HEVCContext *s = lc->parent;
744 19784770 const MvField *tab_mvf = s->cur_frame->tab_mvf;
745 19784770 int log2_min_pu_size = sps->log2_min_pu_size;
746 19784770 int log2_min_tu_size = sps->log2_min_tb_size;
747 19784770 int min_pu_width = sps->min_pu_width;
748 19784770 int min_tu_width = sps->min_tb_width;
749 19784770 int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
750 19784770 (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
751 int boundary_upper, boundary_left;
752 int i, j, bs;
753
754
4/4
✓ Branch 0 taken 19486440 times.
✓ Branch 1 taken 298330 times.
✓ Branch 2 taken 15347370 times.
✓ Branch 3 taken 4139070 times.
19784770 boundary_upper = y0 > 0 && !(y0 & 7);
755
2/2
✓ Branch 0 taken 15347370 times.
✓ Branch 1 taken 4437400 times.
19784770 if (boundary_upper &&
756
2/2
✓ Branch 0 taken 2005754 times.
✓ Branch 1 taken 13341616 times.
15347370 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
757
2/2
✓ Branch 0 taken 501651 times.
✓ Branch 1 taken 1504103 times.
2005754 lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
758
2/2
✓ Branch 0 taken 440551 times.
✓ Branch 1 taken 61100 times.
501651 (y0 % (1 << sps->log2_ctb_size)) == 0) ||
759
2/2
✓ Branch 0 taken 429711 times.
✓ Branch 1 taken 14856559 times.
15286270 (!pps->loop_filter_across_tiles_enabled_flag &&
760
2/2
✓ Branch 0 taken 114253 times.
✓ Branch 1 taken 315458 times.
429711 lc->boundary_flags & BOUNDARY_UPPER_TILE &&
761
2/2
✓ Branch 0 taken 19889 times.
✓ Branch 1 taken 94364 times.
114253 (y0 % (1 << sps->log2_ctb_size)) == 0)))
762 80989 boundary_upper = 0;
763
764
2/2
✓ Branch 0 taken 15266381 times.
✓ Branch 1 taken 4518389 times.
19784770 if (boundary_upper) {
765 30532762 const RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ?
766
2/2
✓ Branch 0 taken 2102073 times.
✓ Branch 1 taken 13164308 times.
15266381 ff_hevc_get_ref_list(s, s->cur_frame, x0, y0 - 1) :
767 13164308 s->cur_frame->refPicList;
768 15266381 int yp_pu = (y0 - 1) >> log2_min_pu_size;
769 15266381 int yq_pu = y0 >> log2_min_pu_size;
770 15266381 int yp_tu = (y0 - 1) >> log2_min_tu_size;
771 15266381 int yq_tu = y0 >> log2_min_tu_size;
772
773
2/2
✓ Branch 0 taken 47889826 times.
✓ Branch 1 taken 15266381 times.
63156207 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
774 47889826 int x_pu = (x0 + i) >> log2_min_pu_size;
775 47889826 int x_tu = (x0 + i) >> log2_min_tu_size;
776 47889826 const MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
777 47889826 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
778 47889826 uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu];
779 47889826 uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
780
781
4/4
✓ Branch 0 taken 35057892 times.
✓ Branch 1 taken 12831934 times.
✓ Branch 2 taken 1226588 times.
✓ Branch 3 taken 33831304 times.
47889826 if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA)
782 14058522 bs = 2;
783
4/4
✓ Branch 0 taken 26978773 times.
✓ Branch 1 taken 6852531 times.
✓ Branch 2 taken 2743061 times.
✓ Branch 3 taken 24235712 times.
33831304 else if (curr_cbf_luma || top_cbf_luma)
784 9595592 bs = 1;
785 else
786 24235712 bs = boundary_strength(s, curr, top, rpl_top);
787 47889826 s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs;
788 }
789 }
790
791 // bs for vertical TU boundaries
792
4/4
✓ Branch 0 taken 19585794 times.
✓ Branch 1 taken 198976 times.
✓ Branch 2 taken 15446724 times.
✓ Branch 3 taken 4139070 times.
19784770 boundary_left = x0 > 0 && !(x0 & 7);
793
2/2
✓ Branch 0 taken 15446724 times.
✓ Branch 1 taken 4338046 times.
19784770 if (boundary_left &&
794
2/2
✓ Branch 0 taken 2026352 times.
✓ Branch 1 taken 13420372 times.
15446724 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
795
2/2
✓ Branch 0 taken 68551 times.
✓ Branch 1 taken 1957801 times.
2026352 lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
796
2/2
✓ Branch 0 taken 59900 times.
✓ Branch 1 taken 8651 times.
68551 (x0 % (1 << sps->log2_ctb_size)) == 0) ||
797
2/2
✓ Branch 0 taken 441443 times.
✓ Branch 1 taken 14996630 times.
15438073 (!pps->loop_filter_across_tiles_enabled_flag &&
798
2/2
✓ Branch 0 taken 59900 times.
✓ Branch 1 taken 381543 times.
441443 lc->boundary_flags & BOUNDARY_LEFT_TILE &&
799
2/2
✓ Branch 0 taken 13608 times.
✓ Branch 1 taken 46292 times.
59900 (x0 % (1 << sps->log2_ctb_size)) == 0)))
800 22259 boundary_left = 0;
801
802
2/2
✓ Branch 0 taken 15424465 times.
✓ Branch 1 taken 4360305 times.
19784770 if (boundary_left) {
803 30848930 const RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ?
804
2/2
✓ Branch 0 taken 246505 times.
✓ Branch 1 taken 15177960 times.
15424465 ff_hevc_get_ref_list(s, s->cur_frame, x0 - 1, y0) :
805 15177960 s->cur_frame->refPicList;
806 15424465 int xp_pu = (x0 - 1) >> log2_min_pu_size;
807 15424465 int xq_pu = x0 >> log2_min_pu_size;
808 15424465 int xp_tu = (x0 - 1) >> log2_min_tu_size;
809 15424465 int xq_tu = x0 >> log2_min_tu_size;
810
811
2/2
✓ Branch 0 taken 48849736 times.
✓ Branch 1 taken 15424465 times.
64274201 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
812 48849736 int y_pu = (y0 + i) >> log2_min_pu_size;
813 48849736 int y_tu = (y0 + i) >> log2_min_tu_size;
814 48849736 const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
815 48849736 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
816 48849736 uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
817 48849736 uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
818
819
4/4
✓ Branch 0 taken 35939870 times.
✓ Branch 1 taken 12909866 times.
✓ Branch 2 taken 1358498 times.
✓ Branch 3 taken 34581372 times.
48849736 if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA)
820 14268364 bs = 2;
821
4/4
✓ Branch 0 taken 27665974 times.
✓ Branch 1 taken 6915398 times.
✓ Branch 2 taken 2773489 times.
✓ Branch 3 taken 24892485 times.
34581372 else if (curr_cbf_luma || left_cbf_luma)
822 9688887 bs = 1;
823 else
824 24892485 bs = boundary_strength(s, curr, left, rpl_left);
825 48849736 s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs;
826 }
827 }
828
829
4/4
✓ Branch 0 taken 10198333 times.
✓ Branch 1 taken 9586437 times.
✓ Branch 2 taken 7343861 times.
✓ Branch 3 taken 2854472 times.
19784770 if (log2_trafo_size > log2_min_pu_size && !is_intra) {
830 7343861 const RefPicList *rpl = s->cur_frame->refPicList;
831
832 // bs for TU internal horizontal PU boundaries
833
2/2
✓ Branch 0 taken 9550310 times.
✓ Branch 1 taken 7343861 times.
16894171 for (j = 8; j < (1 << log2_trafo_size); j += 8) {
834 9550310 int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
835 9550310 int yq_pu = (y0 + j) >> log2_min_pu_size;
836
837
2/2
✓ Branch 0 taken 90141428 times.
✓ Branch 1 taken 9550310 times.
99691738 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
838 90141428 int x_pu = (x0 + i) >> log2_min_pu_size;
839 90141428 const MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
840 90141428 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
841
842 90141428 bs = boundary_strength(s, curr, top, rpl);
843 90141428 s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
844 }
845 }
846
847 // bs for TU internal vertical PU boundaries
848
2/2
✓ Branch 0 taken 33788342 times.
✓ Branch 1 taken 7343861 times.
41132203 for (j = 0; j < (1 << log2_trafo_size); j += 4) {
849 33788342 int y_pu = (y0 + j) >> log2_min_pu_size;
850
851
2/2
✓ Branch 0 taken 90141428 times.
✓ Branch 1 taken 33788342 times.
123929770 for (i = 8; i < (1 << log2_trafo_size); i += 8) {
852 90141428 int xp_pu = (x0 + i - 1) >> log2_min_pu_size;
853 90141428 int xq_pu = (x0 + i) >> log2_min_pu_size;
854 90141428 const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
855 90141428 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
856
857 90141428 bs = boundary_strength(s, curr, left, rpl);
858 90141428 s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
859 }
860 }
861 }
862 19784770 }
863
864 #undef LUMA
865 #undef CB
866 #undef CR
867
868 1416722 void ff_hevc_hls_filter(HEVCLocalContext *lc, const HEVCPPS *pps,
869 int x, int y, int ctb_size)
870 {
871 1416722 const HEVCSPS *const sps = pps->sps;
872 1416722 const HEVCContext *const s = lc->parent;
873 1416722 int x_end = x >= sps->width - ctb_size;
874 1416722 int skip = 0;
875
1/2
✓ Branch 0 taken 1416722 times.
✗ Branch 1 not taken.
1416722 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
876
5/6
✓ Branch 0 taken 3060 times.
✓ Branch 1 taken 1413662 times.
✓ Branch 2 taken 2040 times.
✓ Branch 3 taken 1020 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2040 times.
1416722 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
877
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1413662 times.
1414682 (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
878
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type != HEVC_SLICE_I) ||
879
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1413662 times.
1414682 (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
880
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type == HEVC_SLICE_B) ||
881
3/4
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1413662 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1020 times.
1415702 (s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
882 1020 ff_hevc_nal_is_nonref(s->nal_unit_type)))
883 2040 skip = 1;
884
885
2/2
✓ Branch 0 taken 1414682 times.
✓ Branch 1 taken 2040 times.
1416722 if (!skip)
886 1414682 deblocking_filter_CTB(s, pps, sps, x, y);
887
4/4
✓ Branch 0 taken 1199732 times.
✓ Branch 1 taken 216990 times.
✓ Branch 2 taken 1197692 times.
✓ Branch 3 taken 2040 times.
2614414 if (sps->sao_enabled && !skip) {
888 1197692 int y_end = y >= sps->height - ctb_size;
889
4/4
✓ Branch 0 taken 1093786 times.
✓ Branch 1 taken 103906 times.
✓ Branch 2 taken 1038206 times.
✓ Branch 3 taken 55580 times.
1197692 if (y && x)
890 1038206 sao_filter_CTB(lc, s, pps, sps, x - ctb_size, y - ctb_size);
891
4/4
✓ Branch 0 taken 1133377 times.
✓ Branch 1 taken 64315 times.
✓ Branch 2 taken 95142 times.
✓ Branch 3 taken 1038235 times.
1197692 if (x && y_end)
892 95142 sao_filter_CTB(lc, s, pps, sps, x - ctb_size, y);
893
4/4
✓ Branch 0 taken 1093786 times.
✓ Branch 1 taken 103906 times.
✓ Branch 2 taken 55579 times.
✓ Branch 3 taken 1038207 times.
1197692 if (y && x_end) {
894 55579 sao_filter_CTB(lc, s, pps, sps, x, y - ctb_size);
895
2/2
✓ Branch 0 taken 513 times.
✓ Branch 1 taken 55066 times.
55579 if (s->avctx->active_thread_type & FF_THREAD_FRAME )
896 513 ff_progress_frame_report(&s->cur_frame->tf, y);
897 }
898
4/4
✓ Branch 0 taken 64314 times.
✓ Branch 1 taken 1133378 times.
✓ Branch 2 taken 8734 times.
✓ Branch 3 taken 55580 times.
1197692 if (x_end && y_end) {
899 8734 sao_filter_CTB(lc, s, pps, sps, x , y);
900
2/2
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8702 times.
8734 if (s->avctx->active_thread_type & FF_THREAD_FRAME )
901 32 ff_progress_frame_report(&s->cur_frame->tf, y + ctb_size);
902 }
903
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 219030 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
219030 } else if (s->avctx->active_thread_type & FF_THREAD_FRAME && x_end)
904 ff_progress_frame_report(&s->cur_frame->tf, y + ctb_size - 4);
905 1416722 }
906
907 1416753 void ff_hevc_hls_filters(HEVCLocalContext *lc, const HEVCPPS *pps,
908 int x_ctb, int y_ctb, int ctb_size)
909 {
910 1416753 int x_end = x_ctb >= pps->sps->width - ctb_size;
911 1416753 int y_end = y_ctb >= pps->sps->height - ctb_size;
912
4/4
✓ Branch 0 taken 1297330 times.
✓ Branch 1 taken 119423 times.
✓ Branch 2 taken 1233508 times.
✓ Branch 3 taken 63822 times.
1416753 if (y_ctb && x_ctb)
913 1233508 ff_hevc_hls_filter(lc, pps, x_ctb - ctb_size, y_ctb - ctb_size, ctb_size);
914
4/4
✓ Branch 0 taken 1297330 times.
✓ Branch 1 taken 119423 times.
✓ Branch 2 taken 63821 times.
✓ Branch 3 taken 1233509 times.
1416753 if (y_ctb && x_end)
915 63821 ff_hevc_hls_filter(lc, pps, x_ctb, y_ctb - ctb_size, ctb_size);
916
4/4
✓ Branch 0 taken 1343392 times.
✓ Branch 1 taken 73361 times.
✓ Branch 2 taken 109855 times.
✓ Branch 3 taken 1233537 times.
1416753 if (x_ctb && y_end)
917 109855 ff_hevc_hls_filter(lc, pps, x_ctb - ctb_size, y_ctb, ctb_size);
918 1416753 }
919