FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hevc_filter.c
Date: 2021-09-23 20:34:37
Exec Total Coverage
Lines: 542 547 99.1%
Branches: 489 505 96.8%

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 "cabac_functions.h"
29 #include "hevcdec.h"
30
31 #include "bit_depth_template.c"
32
33 #define LUMA 0
34 #define CB 1
35 #define CR 2
36
37 static const uint8_t tctable[54] = {
38 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // QP 0...18
39 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, // QP 19...37
40 5, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24 // QP 38...53
41 };
42
43 static const uint8_t betatable[52] = {
44 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, // QP 0...18
45 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, // QP 19...37
46 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64 // QP 38...51
47 };
48
49 21444446 static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset)
50 {
51 static const int qp_c[] = {
52 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37
53 };
54 int qp, qp_i, offset, idxt;
55
56 // slice qp offset is not used for deblocking
57
2/2
✓ Branch 0 taken 10722223 times.
✓ Branch 1 taken 10722223 times.
21444446 if (c_idx == 1)
58 10722223 offset = s->ps.pps->cb_qp_offset;
59 else
60 10722223 offset = s->ps.pps->cr_qp_offset;
61
62 21444446 qp_i = av_clip(qp_y + offset, 0, 57);
63
2/2
✓ Branch 0 taken 17964718 times.
✓ Branch 1 taken 3479728 times.
21444446 if (s->ps.sps->chroma_format_idc == 1) {
64
2/2
✓ Branch 0 taken 2634798 times.
✓ Branch 1 taken 15329920 times.
17964718 if (qp_i < 30)
65 2634798 qp = qp_i;
66
2/2
✓ Branch 0 taken 153221 times.
✓ Branch 1 taken 15176699 times.
15329920 else if (qp_i > 43)
67 153221 qp = qp_i - 6;
68 else
69 15176699 qp = qp_c[qp_i - 30];
70 } else {
71 3479728 qp = av_clip(qp_i, 0, 51);
72 }
73
74 21444446 idxt = av_clip(qp + DEFAULT_INTRA_TC_OFFSET + tc_offset, 0, 53);
75 21444446 return tctable[idxt];
76 }
77
78 1323158 static int get_qPy_pred(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
79 {
80 1323158 HEVCLocalContext *lc = s->HEVClc;
81 1323158 int ctb_size_mask = (1 << s->ps.sps->log2_ctb_size) - 1;
82 1323158 int MinCuQpDeltaSizeMask = (1 << (s->ps.sps->log2_ctb_size -
83 1323158 s->ps.pps->diff_cu_qp_delta_depth)) - 1;
84 1323158 int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
85 1323158 int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
86 1323158 int min_cb_width = s->ps.sps->min_cb_width;
87 1323158 int x_cb = xQgBase >> s->ps.sps->log2_min_cb_size;
88 1323158 int y_cb = yQgBase >> s->ps.sps->log2_min_cb_size;
89
2/2
✓ Branch 0 taken 909333 times.
✓ Branch 1 taken 413825 times.
2232491 int availableA = (xBase & ctb_size_mask) &&
90
2/2
✓ Branch 0 taken 772839 times.
✓ Branch 1 taken 136494 times.
909333 (xQgBase & ctb_size_mask);
91
2/2
✓ Branch 0 taken 891007 times.
✓ Branch 1 taken 432151 times.
2214165 int availableB = (yBase & ctb_size_mask) &&
92
2/2
✓ Branch 0 taken 769837 times.
✓ Branch 1 taken 121170 times.
891007 (yQgBase & ctb_size_mask);
93 int qPy_pred, qPy_a, qPy_b;
94
95 // qPy_pred
96
5/6
✓ Branch 0 taken 1250170 times.
✓ Branch 1 taken 72988 times.
✓ Branch 2 taken 18262 times.
✓ Branch 3 taken 1231908 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18262 times.
1323158 if (lc->first_qp_group || (!xQgBase && !yQgBase)) {
97 72988 lc->first_qp_group = !lc->tu.is_cu_qp_delta_coded;
98 72988 qPy_pred = s->sh.slice_qp;
99 } else {
100 1250170 qPy_pred = lc->qPy_pred;
101 }
102
103 // qPy_a
104
2/2
✓ Branch 0 taken 550319 times.
✓ Branch 1 taken 772839 times.
1323158 if (availableA == 0)
105 550319 qPy_a = qPy_pred;
106 else
107 772839 qPy_a = s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width];
108
109 // qPy_b
110
2/2
✓ Branch 0 taken 553321 times.
✓ Branch 1 taken 769837 times.
1323158 if (availableB == 0)
111 553321 qPy_b = qPy_pred;
112 else
113 769837 qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
114
115 av_assert2(qPy_a >= -s->ps.sps->qp_bd_offset && qPy_a < 52);
116 av_assert2(qPy_b >= -s->ps.sps->qp_bd_offset && qPy_b < 52);
117
118 1323158 return (qPy_a + qPy_b + 1) >> 1;
119 }
120
121 1323158 void ff_hevc_set_qPy(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
122 {
123 1323158 int qp_y = get_qPy_pred(s, xBase, yBase, log2_cb_size);
124
125
2/2
✓ Branch 0 taken 364452 times.
✓ Branch 1 taken 958706 times.
1323158 if (s->HEVClc->tu.cu_qp_delta != 0) {
126 364452 int off = s->ps.sps->qp_bd_offset;
127
1/2
✓ Branch 0 taken 364452 times.
✗ Branch 1 not taken.
364452 s->HEVClc->qp_y = FFUMOD(qp_y + s->HEVClc->tu.cu_qp_delta + 52 + 2 * off,
128 364452 52 + off) - off;
129 } else
130 958706 s->HEVClc->qp_y = qp_y;
131 1323158 }
132
133 113013688 static int get_qPy(HEVCContext *s, int xC, int yC)
134 {
135 113013688 int log2_min_cb_size = s->ps.sps->log2_min_cb_size;
136 113013688 int x = xC >> log2_min_cb_size;
137 113013688 int y = yC >> log2_min_cb_size;
138 113013688 return s->qp_y_tab[x + y * s->ps.sps->min_cb_width];
139 }
140
141 374467 static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height,
142 ptrdiff_t stride_dst, ptrdiff_t stride_src)
143 {
144 int i, j;
145
146
2/2
✓ Branch 0 taken 54847 times.
✓ Branch 1 taken 319620 times.
374467 if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) {
147
2/2
✓ Branch 0 taken 2383520 times.
✓ Branch 1 taken 54847 times.
2438367 for (i = 0; i < height; i++) {
148
2/2
✓ Branch 0 taken 19065776 times.
✓ Branch 1 taken 2383520 times.
21449296 for (j = 0; j < width; j+=8)
149 19065776 AV_COPY64U(dst+j, src+j);
150 2383520 dst += stride_dst;
151 2383520 src += stride_src;
152 }
153 } else {
154
2/2
✓ Branch 0 taken 16882832 times.
✓ Branch 1 taken 319620 times.
17202452 for (i = 0; i < height; i++) {
155
2/2
✓ Branch 0 taken 85965880 times.
✓ Branch 1 taken 16882832 times.
102848712 for (j = 0; j < width; j+=16)
156 85965880 AV_COPY128(dst+j, src+j);
157 16882832 dst += stride_dst;
158 16882832 src += stride_src;
159 }
160 }
161 374467 }
162
163 1318190 static void copy_pixel(uint8_t *dst, const uint8_t *src, int pixel_shift)
164 {
165
2/2
✓ Branch 0 taken 217738 times.
✓ Branch 1 taken 1100452 times.
1318190 if (pixel_shift)
166 217738 *(uint16_t *)dst = *(uint16_t *)src;
167 else
168 1100452 *dst = *src;
169 1318190 }
170
171 1272445 static void copy_vert(uint8_t *dst, const uint8_t *src,
172 int pixel_shift, int height,
173 ptrdiff_t stride_dst, ptrdiff_t stride_src)
174 {
175 int i;
176
2/2
✓ Branch 0 taken 1095282 times.
✓ Branch 1 taken 177163 times.
1272445 if (pixel_shift == 0) {
177
2/2
✓ Branch 0 taken 51668768 times.
✓ Branch 1 taken 1095282 times.
52764050 for (i = 0; i < height; i++) {
178 51668768 *dst = *src;
179 51668768 dst += stride_dst;
180 51668768 src += stride_src;
181 }
182 } else {
183
2/2
✓ Branch 0 taken 11102224 times.
✓ Branch 1 taken 177163 times.
11279387 for (i = 0; i < height; i++) {
184 11102224 *(uint16_t *)dst = *(uint16_t *)src;
185 11102224 dst += stride_dst;
186 11102224 src += stride_src;
187 }
188 }
189 1272445 }
190
191 484741 static void copy_CTB_to_hv(HEVCContext *s, const uint8_t *src,
192 ptrdiff_t stride_src, int x, int y, int width, int height,
193 int c_idx, int x_ctb, int y_ctb)
194 {
195 484741 int sh = s->ps.sps->pixel_shift;
196 484741 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
197 484741 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
198
199 /* copy horizontal edges */
200 484741 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << sh),
201 484741 src, width << sh);
202 484741 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << sh),
203 484741 src + stride_src * (height - 1), width << sh);
204
205 /* copy vertical edges */
206 484741 copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << sh), src, sh, height, 1 << sh, stride_src);
207
208 484741 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);
209 484741 }
210
211 374467 static void restore_tqb_pixels(HEVCContext *s,
212 uint8_t *src1, const uint8_t *dst1,
213 ptrdiff_t stride_src, ptrdiff_t stride_dst,
214 int x0, int y0, int width, int height, int c_idx)
215 {
216
2/2
✓ Branch 0 taken 370178 times.
✓ Branch 1 taken 4289 times.
374467 if ( s->ps.pps->transquant_bypass_enable_flag ||
217
3/4
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 370074 times.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
370178 (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
218 int x, y;
219 4393 int min_pu_size = 1 << s->ps.sps->log2_min_pu_size;
220 4393 int hshift = s->ps.sps->hshift[c_idx];
221 4393 int vshift = s->ps.sps->vshift[c_idx];
222 4393 int x_min = ((x0 ) >> s->ps.sps->log2_min_pu_size);
223 4393 int y_min = ((y0 ) >> s->ps.sps->log2_min_pu_size);
224 4393 int x_max = ((x0 + width ) >> s->ps.sps->log2_min_pu_size);
225 4393 int y_max = ((y0 + height) >> s->ps.sps->log2_min_pu_size);
226 4393 int len = (min_pu_size >> hshift) << s->ps.sps->pixel_shift;
227
2/2
✓ Branch 0 taken 49472 times.
✓ Branch 1 taken 4393 times.
53865 for (y = y_min; y < y_max; y++) {
228
2/2
✓ Branch 0 taken 632704 times.
✓ Branch 1 taken 49472 times.
682176 for (x = x_min; x < x_max; x++) {
229
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]) {
230 int n;
231 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);
232 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);
233
2/2
✓ Branch 0 taken 704 times.
✓ Branch 1 taken 264 times.
968 for (n = 0; n < (min_pu_size >> vshift); n++) {
234 704 memcpy(src, dst, len);
235 704 src += stride_src;
236 704 dst += stride_dst;
237 }
238 }
239 }
240 }
241 }
242 374467 }
243
244 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
245
246 1176473 static void sao_filter_CTB(HEVCContext *s, int x, int y)
247 {
248 static const uint8_t sao_tab[8] = { 0, 1, 2, 2, 3, 3, 4, 4 };
249 1176473 HEVCLocalContext *lc = s->HEVClc;
250 int c_idx;
251 int edges[4]; // 0 left 1 top 2 right 3 bottom
252 1176473 int x_ctb = x >> s->ps.sps->log2_ctb_size;
253 1176473 int y_ctb = y >> s->ps.sps->log2_ctb_size;
254 1176473 int ctb_addr_rs = y_ctb * s->ps.sps->ctb_width + x_ctb;
255 1176473 int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
256 1176473 SAOParams *sao = &CTB(s->sao, x_ctb, y_ctb);
257 // flags indicating unfilterable edges
258 1176473 uint8_t vert_edge[] = { 0, 0 };
259 1176473 uint8_t horiz_edge[] = { 0, 0 };
260 1176473 uint8_t diag_edge[] = { 0, 0, 0, 0 };
261 1176473 uint8_t lfase = CTB(s->filter_slice_edges, x_ctb, y_ctb);
262
2/2
✓ Branch 0 taken 170200 times.
✓ Branch 1 taken 1006273 times.
1346673 uint8_t no_tile_filter = s->ps.pps->tiles_enabled_flag &&
263
2/2
✓ Branch 0 taken 16664 times.
✓ Branch 1 taken 153536 times.
170200 !s->ps.pps->loop_filter_across_tiles_enabled_flag;
264
4/4
✓ Branch 0 taken 1159809 times.
✓ Branch 1 taken 16664 times.
✓ Branch 2 taken 47410 times.
✓ Branch 3 taken 1112399 times.
1176473 uint8_t restore = no_tile_filter || !lfase;
265 1176473 uint8_t left_tile_edge = 0;
266 1176473 uint8_t right_tile_edge = 0;
267 1176473 uint8_t up_tile_edge = 0;
268 1176473 uint8_t bottom_tile_edge = 0;
269
270 1176473 edges[0] = x_ctb == 0;
271 1176473 edges[1] = y_ctb == 0;
272 1176473 edges[2] = x_ctb == s->ps.sps->ctb_width - 1;
273 1176473 edges[3] = y_ctb == s->ps.sps->ctb_height - 1;
274
275
2/2
✓ Branch 0 taken 64074 times.
✓ Branch 1 taken 1112399 times.
1176473 if (restore) {
276
2/2
✓ Branch 0 taken 60573 times.
✓ Branch 1 taken 3501 times.
64074 if (!edges[0]) {
277
4/4
✓ Branch 0 taken 16242 times.
✓ Branch 1 taken 44331 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 15406 times.
60573 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]];
278
6/6
✓ Branch 0 taken 44331 times.
✓ Branch 1 taken 16242 times.
✓ Branch 2 taken 44124 times.
✓ Branch 3 taken 207 times.
✓ Branch 4 taken 836 times.
✓ Branch 5 taken 59530 times.
60573 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;
279 }
280
2/2
✓ Branch 0 taken 60574 times.
✓ Branch 1 taken 3500 times.
64074 if (!edges[2]) {
281
4/4
✓ Branch 0 taken 16242 times.
✓ Branch 1 taken 44332 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 15406 times.
60574 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]];
282
6/6
✓ Branch 0 taken 44332 times.
✓ Branch 1 taken 16242 times.
✓ Branch 2 taken 44125 times.
✓ Branch 3 taken 207 times.
✓ Branch 4 taken 836 times.
✓ Branch 5 taken 59531 times.
60574 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;
283 }
284
2/2
✓ Branch 0 taken 57980 times.
✓ Branch 1 taken 6094 times.
64074 if (!edges[1]) {
285
4/4
✓ Branch 0 taken 15931 times.
✓ Branch 1 taken 42049 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 14491 times.
57980 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]];
286
6/6
✓ Branch 0 taken 42049 times.
✓ Branch 1 taken 15931 times.
✓ Branch 2 taken 40609 times.
✓ Branch 3 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 55100 times.
57980 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;
287 }
288
2/2
✓ Branch 0 taken 58010 times.
✓ Branch 1 taken 6064 times.
64074 if (!edges[3]) {
289
4/4
✓ Branch 0 taken 15931 times.
✓ Branch 1 taken 42079 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 14491 times.
58010 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]];
290
6/6
✓ Branch 0 taken 42079 times.
✓ Branch 1 taken 15931 times.
✓ Branch 2 taken 40639 times.
✓ Branch 3 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 55130 times.
58010 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;
291 }
292
4/4
✓ Branch 0 taken 60573 times.
✓ Branch 1 taken 3501 times.
✓ Branch 2 taken 55077 times.
✓ Branch 3 taken 5496 times.
64074 if (!edges[0] && !edges[1]) {
293
8/8
✓ Branch 0 taken 39549 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 37965 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 52694 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 51362 times.
55077 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;
294 }
295
4/4
✓ Branch 0 taken 57980 times.
✓ Branch 1 taken 6094 times.
✓ Branch 2 taken 55078 times.
✓ Branch 3 taken 2902 times.
64074 if (!edges[1] && !edges[2]) {
296
8/8
✓ Branch 0 taken 39550 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 37966 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 52695 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 51363 times.
55078 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;
297 }
298
4/4
✓ Branch 0 taken 60574 times.
✓ Branch 1 taken 3500 times.
✓ Branch 2 taken 55107 times.
✓ Branch 3 taken 5467 times.
64074 if (!edges[2] && !edges[3]) {
299
8/8
✓ Branch 0 taken 39579 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 37995 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 52724 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 51392 times.
55107 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;
300 }
301
4/4
✓ Branch 0 taken 60573 times.
✓ Branch 1 taken 3501 times.
✓ Branch 2 taken 55106 times.
✓ Branch 3 taken 5467 times.
64074 if (!edges[0] && !edges[3]) {
302
8/8
✓ Branch 0 taken 39578 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 37994 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 52723 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 51391 times.
55106 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;
303 }
304 }
305
306
4/4
✓ Branch 0 taken 4705700 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 3529323 times.
✓ Branch 3 taken 1176473 times.
4705796 for (c_idx = 0; c_idx < (s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
307 3529323 int x0 = x >> s->ps.sps->hshift[c_idx];
308 3529323 int y0 = y >> s->ps.sps->vshift[c_idx];
309 3529323 ptrdiff_t stride_src = s->frame->linesize[c_idx];
310 3529323 int ctb_size_h = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->hshift[c_idx];
311 3529323 int ctb_size_v = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->vshift[c_idx];
312 3529323 int width = FFMIN(ctb_size_h, (s->ps.sps->width >> s->ps.sps->hshift[c_idx]) - x0);
313 3529323 int height = FFMIN(ctb_size_v, (s->ps.sps->height >> s->ps.sps->vshift[c_idx]) - y0);
314 3529323 int tab = sao_tab[(FFALIGN(width, 8) >> 3) - 1];
315 3529323 uint8_t *src = &s->frame->data[c_idx][y0 * stride_src + (x0 << s->ps.sps->pixel_shift)];
316 ptrdiff_t stride_dst;
317 uint8_t *dst;
318
319
3/3
✓ Branch 0 taken 111043 times.
✓ Branch 1 taken 373698 times.
✓ Branch 2 taken 3044582 times.
3529323 switch (sao->type_idx[c_idx]) {
320 111043 case SAO_BAND:
321 111043 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
322 x_ctb, y_ctb);
323
2/2
✓ Branch 0 taken 110282 times.
✓ Branch 1 taken 761 times.
111043 if (s->ps.pps->transquant_bypass_enable_flag ||
324
3/4
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 110274 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
110282 (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
325 769 dst = lc->edge_emu_buffer;
326 769 stride_dst = 2*MAX_PB_SIZE;
327 769 copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src);
328 769 s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst,
329 769 sao->offset_val[c_idx], sao->band_position[c_idx],
330 width, height);
331 769 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
332 x, y, width, height, c_idx);
333 } else {
334 110274 s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src,
335 110274 sao->offset_val[c_idx], sao->band_position[c_idx],
336 width, height);
337 }
338 111043 sao->type_idx[c_idx] = SAO_APPLIED;
339 111043 break;
340 373698 case SAO_EDGE:
341 {
342 373698 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
343 373698 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
344 373698 int left_edge = edges[0];
345 373698 int top_edge = edges[1];
346 373698 int right_edge = edges[2];
347 373698 int bottom_edge = edges[3];
348 373698 int sh = s->ps.sps->pixel_shift;
349 int left_pixels, right_pixels;
350
351 373698 stride_dst = 2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE;
352 373698 dst = lc->edge_emu_buffer + stride_dst + AV_INPUT_BUFFER_PADDING_SIZE;
353
354
2/2
✓ Branch 0 taken 347971 times.
✓ Branch 1 taken 25727 times.
373698 if (!top_edge) {
355 347971 int left = 1 - left_edge;
356 347971 int right = 1 - right_edge;
357 const uint8_t *src1[2];
358 uint8_t *dst1;
359 int src_idx, pos;
360
361 347971 dst1 = dst - stride_dst - (left << sh);
362 347971 src1[0] = src - stride_src - (left << sh);
363 347971 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0 - left) << sh);
364 347971 pos = 0;
365
2/2
✓ Branch 0 taken 331510 times.
✓ Branch 1 taken 16461 times.
347971 if (left) {
366 331510 src_idx = (CTB(s->sao, x_ctb-1, y_ctb-1).type_idx[c_idx] ==
367 SAO_APPLIED);
368 331510 copy_pixel(dst1, src1[src_idx], sh);
369 331510 pos += (1 << sh);
370 }
371 347971 src_idx = (CTB(s->sao, x_ctb, y_ctb-1).type_idx[c_idx] ==
372 SAO_APPLIED);
373 347971 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
374
2/2
✓ Branch 0 taken 331088 times.
✓ Branch 1 taken 16883 times.
347971 if (right) {
375 331088 pos += width << sh;
376 331088 src_idx = (CTB(s->sao, x_ctb+1, y_ctb-1).type_idx[c_idx] ==
377 SAO_APPLIED);
378 331088 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
379 }
380 }
381
2/2
✓ Branch 0 taken 344065 times.
✓ Branch 1 taken 29633 times.
373698 if (!bottom_edge) {
382 344065 int left = 1 - left_edge;
383 344065 int right = 1 - right_edge;
384 const uint8_t *src1[2];
385 uint8_t *dst1;
386 int src_idx, pos;
387
388 344065 dst1 = dst + height * stride_dst - (left << sh);
389 344065 src1[0] = src + height * stride_src - (left << sh);
390 344065 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0 - left) << sh);
391 344065 pos = 0;
392
2/2
✓ Branch 0 taken 328176 times.
✓ Branch 1 taken 15889 times.
344065 if (left) {
393 328176 src_idx = (CTB(s->sao, x_ctb-1, y_ctb+1).type_idx[c_idx] ==
394 SAO_APPLIED);
395 328176 copy_pixel(dst1, src1[src_idx], sh);
396 328176 pos += (1 << sh);
397 }
398 344065 src_idx = (CTB(s->sao, x_ctb, y_ctb+1).type_idx[c_idx] ==
399 SAO_APPLIED);
400 344065 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
401
2/2
✓ Branch 0 taken 327416 times.
✓ Branch 1 taken 16649 times.
344065 if (right) {
402 327416 pos += width << sh;
403 327416 src_idx = (CTB(s->sao, x_ctb+1, y_ctb+1).type_idx[c_idx] ==
404 SAO_APPLIED);
405 327416 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
406 }
407 }
408 373698 left_pixels = 0;
409
2/2
✓ Branch 0 taken 355244 times.
✓ Branch 1 taken 18454 times.
373698 if (!left_edge) {
410
2/2
✓ Branch 0 taken 302963 times.
✓ Branch 1 taken 52281 times.
355244 if (CTB(s->sao, x_ctb-1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
411 302963 copy_vert(dst - (1 << sh),
412 302963 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh),
413 302963 sh, height, stride_dst, 1 << sh);
414 } else {
415 52281 left_pixels = 1;
416 }
417 }
418 373698 right_pixels = 0;
419
2/2
✓ Branch 0 taken 354703 times.
✓ Branch 1 taken 18995 times.
373698 if (!right_edge) {
420
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 354703 times.
354703 if (CTB(s->sao, x_ctb+1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
421 copy_vert(dst + (width << sh),
422 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) * h + y0) << sh),
423 sh, height, stride_dst, 1 << sh);
424 } else {
425 354703 right_pixels = 1;
426 }
427 }
428
429 373698 copy_CTB(dst - (left_pixels << sh),
430 373698 src - (left_pixels << sh),
431 373698 (width + left_pixels + right_pixels) << sh,
432 height, stride_dst, stride_src);
433
434 373698 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
435 x_ctb, y_ctb);
436 373698 s->hevcdsp.sao_edge_filter[tab](src, dst, stride_src, sao->offset_val[c_idx],
437 sao->eo_class[c_idx], width, height);
438 373698 s->hevcdsp.sao_edge_restore[restore](src, dst,
439 stride_src, stride_dst,
440 sao,
441 edges, width,
442 height, c_idx,
443 vert_edge,
444 horiz_edge,
445 diag_edge);
446 373698 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
447 x, y, width, height, c_idx);
448 373698 sao->type_idx[c_idx] = SAO_APPLIED;
449 373698 break;
450 }
451 }
452 }
453 1176473 }
454
455 2057768 static int get_pcm(HEVCContext *s, int x, int y)
456 {
457 2057768 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
458 int x_pu, y_pu;
459
460
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)
461 return 2;
462
463 2057768 x_pu = x >> log2_min_pu_size;
464 2057768 y_pu = y >> log2_min_pu_size;
465
466
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)
467 1408 return 2;
468 2056360 return s->is_pcm[y_pu * s->ps.sps->min_pu_width + x_pu];
469 }
470
471 #define TC_CALC(qp, bs) \
472 tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + \
473 (tc_offset & -2), \
474 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
475
476 1393494 static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
477 {
478 uint8_t *src;
479 int x, y;
480 int chroma, beta;
481 int32_t c_tc[2], tc[2];
482 1393494 uint8_t no_p[2] = { 0 };
483 1393494 uint8_t no_q[2] = { 0 };
484
485 1393494 int log2_ctb_size = s->ps.sps->log2_ctb_size;
486 int x_end, x_end2, y_end;
487 1393494 int ctb_size = 1 << log2_ctb_size;
488 1393494 int ctb = (x0 >> log2_ctb_size) +
489 1393494 (y0 >> log2_ctb_size) * s->ps.sps->ctb_width;
490 1393494 int cur_tc_offset = s->deblock[ctb].tc_offset;
491 1393494 int cur_beta_offset = s->deblock[ctb].beta_offset;
492 int left_tc_offset, left_beta_offset;
493 int tc_offset, beta_offset;
494 2874369 int pcmf = (s->ps.sps->pcm_enabled_flag &&
495
4/4
✓ Branch 0 taken 87381 times.
✓ Branch 1 taken 1306113 times.
✓ Branch 2 taken 87325 times.
✓ Branch 3 taken 56 times.
2786932 s->ps.sps->pcm.loop_filter_disable_flag) ||
496
2/2
✓ Branch 0 taken 4570 times.
✓ Branch 1 taken 1388868 times.
1393438 s->ps.pps->transquant_bypass_enable_flag;
497
498
2/2
✓ Branch 0 taken 1320880 times.
✓ Branch 1 taken 72614 times.
1393494 if (x0) {
499 1320880 left_tc_offset = s->deblock[ctb - 1].tc_offset;
500 1320880 left_beta_offset = s->deblock[ctb - 1].beta_offset;
501 } else {
502 72614 left_tc_offset = 0;
503 72614 left_beta_offset = 0;
504 }
505
506 1393494 x_end = x0 + ctb_size;
507
2/2
✓ Branch 0 taken 25296 times.
✓ Branch 1 taken 1368198 times.
1393494 if (x_end > s->ps.sps->width)
508 25296 x_end = s->ps.sps->width;
509 1393494 y_end = y0 + ctb_size;
510
2/2
✓ Branch 0 taken 95497 times.
✓ Branch 1 taken 1297997 times.
1393494 if (y_end > s->ps.sps->height)
511 95497 y_end = s->ps.sps->height;
512
513 1393494 tc_offset = cur_tc_offset;
514 1393494 beta_offset = cur_beta_offset;
515
516 1393494 x_end2 = x_end;
517
2/2
✓ Branch 0 taken 1320881 times.
✓ Branch 1 taken 72613 times.
1393494 if (x_end2 != s->ps.sps->width)
518 1320881 x_end2 -= 8;
519
2/2
✓ Branch 0 taken 10011288 times.
✓ Branch 1 taken 1393494 times.
11404782 for (y = y0; y < y_end; y += 8) {
520 // vertical filtering luma
521
4/4
✓ Branch 0 taken 9484917 times.
✓ Branch 1 taken 526371 times.
✓ Branch 2 taken 76063729 times.
✓ Branch 3 taken 10011288 times.
86075017 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
522 76063729 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
523 76063729 const int bs1 = s->vertical_bs[(x + (y + 4) * s->bs_width) >> 2];
524
4/4
✓ Branch 0 taken 58918950 times.
✓ Branch 1 taken 17144779 times.
✓ Branch 2 taken 89289 times.
✓ Branch 3 taken 58829661 times.
76063729 if (bs0 || bs1) {
525 17234068 const int qp = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
526
527 17234068 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
528
529
2/2
✓ Branch 0 taken 17144779 times.
✓ Branch 1 taken 89289 times.
17234068 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
530
2/2
✓ Branch 0 taken 17138114 times.
✓ Branch 1 taken 95954 times.
17234068 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
531 17234068 src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
532
2/2
✓ Branch 0 taken 186079 times.
✓ Branch 1 taken 17047989 times.
17234068 if (pcmf) {
533 186079 no_p[0] = get_pcm(s, x - 1, y);
534 186079 no_p[1] = get_pcm(s, x - 1, y + 4);
535 186079 no_q[0] = get_pcm(s, x, y);
536 186079 no_q[1] = get_pcm(s, x, y + 4);
537 186079 s->hevcdsp.hevc_v_loop_filter_luma_c(src,
538 186079 s->frame->linesize[LUMA],
539 beta, tc, no_p, no_q);
540 } else
541 17047989 s->hevcdsp.hevc_v_loop_filter_luma(src,
542 17047989 s->frame->linesize[LUMA],
543 beta, tc, no_p, no_q);
544 }
545 }
546
547
2/2
✓ Branch 0 taken 118124 times.
✓ Branch 1 taken 9893164 times.
10011288 if(!y)
548 118124 continue;
549
550 // horizontal filtering luma
551
4/4
✓ Branch 0 taken 9376273 times.
✓ Branch 1 taken 516891 times.
✓ Branch 2 taken 75724399 times.
✓ Branch 3 taken 9893164 times.
85617563 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
552 75724399 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
553 75724399 const int bs1 = s->horizontal_bs[((x + 4) + y * s->bs_width) >> 2];
554
4/4
✓ Branch 0 taken 58262970 times.
✓ Branch 1 taken 17461429 times.
✓ Branch 2 taken 105917 times.
✓ Branch 3 taken 58157053 times.
75724399 if (bs0 || bs1) {
555 17567346 const int qp = (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1;
556
557
2/2
✓ Branch 0 taken 15374835 times.
✓ Branch 1 taken 2192511 times.
17567346 tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
558
2/2
✓ Branch 0 taken 15374835 times.
✓ Branch 1 taken 2192511 times.
17567346 beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
559
560 17567346 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
561
2/2
✓ Branch 0 taken 17461429 times.
✓ Branch 1 taken 105917 times.
17567346 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
562
2/2
✓ Branch 0 taken 17446674 times.
✓ Branch 1 taken 120672 times.
17567346 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
563 17567346 src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
564
2/2
✓ Branch 0 taken 187803 times.
✓ Branch 1 taken 17379543 times.
17567346 if (pcmf) {
565 187803 no_p[0] = get_pcm(s, x, y - 1);
566 187803 no_p[1] = get_pcm(s, x + 4, y - 1);
567 187803 no_q[0] = get_pcm(s, x, y);
568 187803 no_q[1] = get_pcm(s, x + 4, y);
569 187803 s->hevcdsp.hevc_h_loop_filter_luma_c(src,
570 187803 s->frame->linesize[LUMA],
571 beta, tc, no_p, no_q);
572 } else
573 17379543 s->hevcdsp.hevc_h_loop_filter_luma(src,
574 17379543 s->frame->linesize[LUMA],
575 beta, tc, no_p, no_q);
576 }
577 }
578 }
579
580
2/2
✓ Branch 0 taken 1393446 times.
✓ Branch 1 taken 48 times.
1393494 if (s->ps.sps->chroma_format_idc) {
581
2/2
✓ Branch 0 taken 2786892 times.
✓ Branch 1 taken 1393446 times.
4180338 for (chroma = 1; chroma <= 2; chroma++) {
582 2786892 int h = 1 << s->ps.sps->hshift[chroma];
583 2786892 int v = 1 << s->ps.sps->vshift[chroma];
584
585 // vertical filtering chroma
586
2/2
✓ Branch 0 taken 10484096 times.
✓ Branch 1 taken 2786892 times.
13270988 for (y = y0; y < y_end; y += (8 * v)) {
587
4/4
✓ Branch 0 taken 539636 times.
✓ Branch 1 taken 9944460 times.
✓ Branch 2 taken 40413066 times.
✓ Branch 3 taken 10484096 times.
50897162 for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
588 40413066 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
589 40413066 const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * s->bs_width) >> 2];
590
591
4/4
✓ Branch 0 taken 34901404 times.
✓ Branch 1 taken 5511662 times.
✓ Branch 2 taken 128350 times.
✓ Branch 3 taken 34773054 times.
40413066 if ((bs0 == 2) || (bs1 == 2)) {
592 5640012 const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
593 5640012 const int qp1 = (get_qPy(s, x - 1, y + (4 * v)) + get_qPy(s, x, y + (4 * v)) + 1) >> 1;
594
595
2/2
✓ Branch 0 taken 5511662 times.
✓ Branch 1 taken 128350 times.
5640012 c_tc[0] = (bs0 == 2) ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
596
2/2
✓ Branch 0 taken 5507378 times.
✓ Branch 1 taken 132634 times.
5640012 c_tc[1] = (bs1 == 2) ? chroma_tc(s, qp1, chroma, tc_offset) : 0;
597 5640012 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)];
598
2/2
✓ Branch 0 taken 70838 times.
✓ Branch 1 taken 5569174 times.
5640012 if (pcmf) {
599 70838 no_p[0] = get_pcm(s, x - 1, y);
600 70838 no_p[1] = get_pcm(s, x - 1, y + (4 * v));
601 70838 no_q[0] = get_pcm(s, x, y);
602 70838 no_q[1] = get_pcm(s, x, y + (4 * v));
603 70838 s->hevcdsp.hevc_v_loop_filter_chroma_c(src,
604 70838 s->frame->linesize[chroma],
605 c_tc, no_p, no_q);
606 } else
607 5569174 s->hevcdsp.hevc_v_loop_filter_chroma(src,
608 5569174 s->frame->linesize[chroma],
609 c_tc, no_p, no_q);
610 }
611 }
612
613
2/2
✓ Branch 0 taken 236224 times.
✓ Branch 1 taken 10247872 times.
10484096 if(!y)
614 236224 continue;
615
616 // horizontal filtering chroma
617
2/2
✓ Branch 0 taken 9727192 times.
✓ Branch 1 taken 520680 times.
10247872 tc_offset = x0 ? left_tc_offset : cur_tc_offset;
618 10247872 x_end2 = x_end;
619
2/2
✓ Branch 0 taken 9727200 times.
✓ Branch 1 taken 520672 times.
10247872 if (x_end != s->ps.sps->width)
620 9727200 x_end2 = x_end - 8 * h;
621
4/4
✓ Branch 0 taken 9727192 times.
✓ Branch 1 taken 520680 times.
✓ Branch 2 taken 40080414 times.
✓ Branch 3 taken 10247872 times.
50328286 for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
622 40080414 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
623 40080414 const int bs1 = s->horizontal_bs[((x + 4 * h) + y * s->bs_width) >> 2];
624
4/4
✓ Branch 0 taken 34866912 times.
✓ Branch 1 taken 5213502 times.
✓ Branch 2 taken 133706 times.
✓ Branch 3 taken 34733206 times.
40080414 if ((bs0 == 2) || (bs1 == 2)) {
625
2/2
✓ Branch 0 taken 5213502 times.
✓ Branch 1 taken 133706 times.
5347208 const int qp0 = bs0 == 2 ? (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1 : 0;
626
2/2
✓ Branch 0 taken 5211904 times.
✓ Branch 1 taken 135304 times.
5347208 const int qp1 = bs1 == 2 ? (get_qPy(s, x + (4 * h), y - 1) + get_qPy(s, x + (4 * h), y) + 1) >> 1 : 0;
627
628
2/2
✓ Branch 0 taken 5213502 times.
✓ Branch 1 taken 133706 times.
5347208 c_tc[0] = bs0 == 2 ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
629
2/2
✓ Branch 0 taken 5211904 times.
✓ Branch 1 taken 135304 times.
5347208 c_tc[1] = bs1 == 2 ? chroma_tc(s, qp1, chroma, cur_tc_offset) : 0;
630 5347208 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)];
631
2/2
✓ Branch 0 taken 69722 times.
✓ Branch 1 taken 5277486 times.
5347208 if (pcmf) {
632 69722 no_p[0] = get_pcm(s, x, y - 1);
633 69722 no_p[1] = get_pcm(s, x + (4 * h), y - 1);
634 69722 no_q[0] = get_pcm(s, x, y);
635 69722 no_q[1] = get_pcm(s, x + (4 * h), y);
636 69722 s->hevcdsp.hevc_h_loop_filter_chroma_c(src,
637 69722 s->frame->linesize[chroma],
638 c_tc, no_p, no_q);
639 } else
640 5277486 s->hevcdsp.hevc_h_loop_filter_chroma(src,
641 5277486 s->frame->linesize[chroma],
642 c_tc, no_p, no_q);
643 }
644 }
645 }
646 }
647 }
648 1393494 }
649
650 226674502 static int boundary_strength(HEVCContext *s, MvField *curr, MvField *neigh,
651 RefPicList *neigh_refPicList)
652 {
653
4/4
✓ Branch 0 taken 144855024 times.
✓ Branch 1 taken 81819478 times.
✓ Branch 2 taken 140524332 times.
✓ Branch 3 taken 4330692 times.
226674502 if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) {
654 // same L0 and L1
655
2/2
✓ Branch 0 taken 138826193 times.
✓ Branch 1 taken 1698139 times.
140524332 if (s->ref->refPicList[0].list[curr->ref_idx[0]] == neigh_refPicList[0].list[neigh->ref_idx[0]] &&
656
2/2
✓ Branch 0 taken 18325892 times.
✓ Branch 1 taken 120500301 times.
138826193 s->ref->refPicList[0].list[curr->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]] &&
657
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]]) {
658
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 ||
659
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) &&
660
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 ||
661
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))
662 410243 return 1;
663 else
664 17777196 return 0;
665
2/2
✓ Branch 0 taken 120638754 times.
✓ Branch 1 taken 1698139 times.
122336893 } else if (neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[0].list[curr->ref_idx[0]] &&
666
2/2
✓ Branch 0 taken 120062401 times.
✓ Branch 1 taken 576353 times.
120638754 neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) {
667
4/4
✓ Branch 0 taken 116459015 times.
✓ Branch 1 taken 3603386 times.
✓ Branch 2 taken 115602363 times.
✓ Branch 3 taken 856652 times.
120062401 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 115129399 times.
✓ Branch 1 taken 472964 times.
✓ Branch 2 taken 149713 times.
✓ Branch 3 taken 114979686 times.
115602363 FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4)
669 5082715 return 1;
670 else
671 114979686 return 0;
672
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]] &&
673
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]]) {
674
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 ||
675
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)
676 74847 return 1;
677 else
678 77090 return 0;
679 } else {
680 2122555 return 1;
681 }
682
4/4
✓ Branch 0 taken 81819478 times.
✓ Branch 1 taken 4330692 times.
✓ Branch 2 taken 77512811 times.
✓ Branch 3 taken 4306667 times.
86150170 } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV
683 Mv A, B;
684 int ref_A, ref_B;
685
686
2/2
✓ Branch 0 taken 66114378 times.
✓ Branch 1 taken 11398433 times.
77512811 if (curr->pred_flag & 1) {
687 66114378 A = curr->mv[0];
688 66114378 ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]];
689 } else {
690 11398433 A = curr->mv[1];
691 11398433 ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]];
692 }
693
694
2/2
✓ Branch 0 taken 66129317 times.
✓ Branch 1 taken 11383494 times.
77512811 if (neigh->pred_flag & 1) {
695 66129317 B = neigh->mv[0];
696 66129317 ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]];
697 } else {
698 11383494 B = neigh->mv[1];
699 11383494 ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]];
700 }
701
702
2/2
✓ Branch 0 taken 73837403 times.
✓ Branch 1 taken 3675408 times.
77512811 if (ref_A == ref_B) {
703
4/4
✓ Branch 0 taken 71990211 times.
✓ Branch 1 taken 1847192 times.
✓ Branch 2 taken 620875 times.
✓ Branch 3 taken 71369336 times.
73837403 if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4)
704 2468067 return 1;
705 else
706 71369336 return 0;
707 } else
708 3675408 return 1;
709 }
710
711 8637359 return 1;
712 }
713
714 19631798 void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
715 int log2_trafo_size)
716 {
717 19631798 HEVCLocalContext *lc = s->HEVClc;
718 19631798 MvField *tab_mvf = s->ref->tab_mvf;
719 19631798 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
720 19631798 int log2_min_tu_size = s->ps.sps->log2_min_tb_size;
721 19631798 int min_pu_width = s->ps.sps->min_pu_width;
722 19631798 int min_tu_width = s->ps.sps->min_tb_width;
723 19631798 int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
724 19631798 (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
725 int boundary_upper, boundary_left;
726 int i, j, bs;
727
728
4/4
✓ Branch 0 taken 19335765 times.
✓ Branch 1 taken 296033 times.
✓ Branch 2 taken 15226789 times.
✓ Branch 3 taken 4108976 times.
19631798 boundary_upper = y0 > 0 && !(y0 & 7);
729
2/2
✓ Branch 0 taken 15226789 times.
✓ Branch 1 taken 4405009 times.
19631798 if (boundary_upper &&
730
2/2
✓ Branch 0 taken 1989147 times.
✓ Branch 1 taken 13237642 times.
15226789 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
731
2/2
✓ Branch 0 taken 501277 times.
✓ Branch 1 taken 1487870 times.
1989147 lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
732
2/2
✓ Branch 0 taken 440177 times.
✓ Branch 1 taken 61100 times.
501277 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
733
2/2
✓ Branch 0 taken 429711 times.
✓ Branch 1 taken 14735978 times.
15165689 (!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
734
2/2
✓ Branch 0 taken 114253 times.
✓ Branch 1 taken 315458 times.
429711 lc->boundary_flags & BOUNDARY_UPPER_TILE &&
735
2/2
✓ Branch 0 taken 19889 times.
✓ Branch 1 taken 94364 times.
114253 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
736 80989 boundary_upper = 0;
737
738
2/2
✓ Branch 0 taken 15145800 times.
✓ Branch 1 taken 4485998 times.
19631798 if (boundary_upper) {
739 30291600 RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ?
740
2/2
✓ Branch 0 taken 2094655 times.
✓ Branch 1 taken 13051145 times.
15145800 ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) :
741 13051145 s->ref->refPicList;
742 15145800 int yp_pu = (y0 - 1) >> log2_min_pu_size;
743 15145800 int yq_pu = y0 >> log2_min_pu_size;
744 15145800 int yp_tu = (y0 - 1) >> log2_min_tu_size;
745 15145800 int yq_tu = y0 >> log2_min_tu_size;
746
747
2/2
✓ Branch 0 taken 47344254 times.
✓ Branch 1 taken 15145800 times.
62490054 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
748 47344254 int x_pu = (x0 + i) >> log2_min_pu_size;
749 47344254 int x_tu = (x0 + i) >> log2_min_tu_size;
750 47344254 MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
751 47344254 MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
752 47344254 uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu];
753 47344254 uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
754
755
4/4
✓ Branch 0 taken 34800236 times.
✓ Branch 1 taken 12544018 times.
✓ Branch 2 taken 1216272 times.
✓ Branch 3 taken 33583964 times.
47344254 if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA)
756 13760290 bs = 2;
757
4/4
✓ Branch 0 taken 26767361 times.
✓ Branch 1 taken 6816603 times.
✓ Branch 2 taken 2727536 times.
✓ Branch 3 taken 24039825 times.
33583964 else if (curr_cbf_luma || top_cbf_luma)
758 9544139 bs = 1;
759 else
760 24039825 bs = boundary_strength(s, curr, top, rpl_top);
761 47344254 s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs;
762 }
763 }
764
765 // bs for vertical TU boundaries
766
4/4
✓ Branch 0 taken 19434406 times.
✓ Branch 1 taken 197392 times.
✓ Branch 2 taken 15325430 times.
✓ Branch 3 taken 4108976 times.
19631798 boundary_left = x0 > 0 && !(x0 & 7);
767
2/2
✓ Branch 0 taken 15325430 times.
✓ Branch 1 taken 4306368 times.
19631798 if (boundary_left &&
768
2/2
✓ Branch 0 taken 2009550 times.
✓ Branch 1 taken 13315880 times.
15325430 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
769
2/2
✓ Branch 0 taken 68545 times.
✓ Branch 1 taken 1941005 times.
2009550 lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
770
2/2
✓ Branch 0 taken 59894 times.
✓ Branch 1 taken 8651 times.
68545 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
771
2/2
✓ Branch 0 taken 441443 times.
✓ Branch 1 taken 14875336 times.
15316779 (!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
772
2/2
✓ Branch 0 taken 59900 times.
✓ Branch 1 taken 381543 times.
441443 lc->boundary_flags & BOUNDARY_LEFT_TILE &&
773
2/2
✓ Branch 0 taken 13608 times.
✓ Branch 1 taken 46292 times.
59900 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
774 22259 boundary_left = 0;
775
776
2/2
✓ Branch 0 taken 15303171 times.
✓ Branch 1 taken 4328627 times.
19631798 if (boundary_left) {
777 30606342 RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ?
778
2/2
✓ Branch 0 taken 245685 times.
✓ Branch 1 taken 15057486 times.
15303171 ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) :
779 15057486 s->ref->refPicList;
780 15303171 int xp_pu = (x0 - 1) >> log2_min_pu_size;
781 15303171 int xq_pu = x0 >> log2_min_pu_size;
782 15303171 int xp_tu = (x0 - 1) >> log2_min_tu_size;
783 15303171 int xq_tu = x0 >> log2_min_tu_size;
784
785
2/2
✓ Branch 0 taken 48296612 times.
✓ Branch 1 taken 15303171 times.
63599783 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
786 48296612 int y_pu = (y0 + i) >> log2_min_pu_size;
787 48296612 int y_tu = (y0 + i) >> log2_min_tu_size;
788 48296612 MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
789 48296612 MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
790 48296612 uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
791 48296612 uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
792
793
4/4
✓ Branch 0 taken 35676894 times.
✓ Branch 1 taken 12619718 times.
✓ Branch 2 taken 1348466 times.
✓ Branch 3 taken 34328428 times.
48296612 if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA)
794 13968184 bs = 2;
795
4/4
✓ Branch 0 taken 27449742 times.
✓ Branch 1 taken 6878686 times.
✓ Branch 2 taken 2758793 times.
✓ Branch 3 taken 24690949 times.
34328428 else if (curr_cbf_luma || left_cbf_luma)
796 9637479 bs = 1;
797 else
798 24690949 bs = boundary_strength(s, curr, left, rpl_left);
799 48296612 s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs;
800 }
801 }
802
803
4/4
✓ Branch 0 taken 10105549 times.
✓ Branch 1 taken 9526249 times.
✓ Branch 2 taken 7305910 times.
✓ Branch 3 taken 2799639 times.
19631798 if (log2_trafo_size > log2_min_pu_size && !is_intra) {
804 7305910 RefPicList *rpl = s->ref->refPicList;
805
806 // bs for TU internal horizontal PU boundaries
807
2/2
✓ Branch 0 taken 9453942 times.
✓ Branch 1 taken 7305910 times.
16759852 for (j = 8; j < (1 << log2_trafo_size); j += 8) {
808 9453942 int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
809 9453942 int yq_pu = (y0 + j) >> log2_min_pu_size;
810
811
2/2
✓ Branch 0 taken 88971864 times.
✓ Branch 1 taken 9453942 times.
98425806 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
812 88971864 int x_pu = (x0 + i) >> log2_min_pu_size;
813 88971864 MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
814 88971864 MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
815
816 88971864 bs = boundary_strength(s, curr, top, rpl);
817 88971864 s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
818 }
819 }
820
821 // bs for TU internal vertical PU boundaries
822
2/2
✓ Branch 0 taken 33519704 times.
✓ Branch 1 taken 7305910 times.
40825614 for (j = 0; j < (1 << log2_trafo_size); j += 4) {
823 33519704 int y_pu = (y0 + j) >> log2_min_pu_size;
824
825
2/2
✓ Branch 0 taken 88971864 times.
✓ Branch 1 taken 33519704 times.
122491568 for (i = 8; i < (1 << log2_trafo_size); i += 8) {
826 88971864 int xp_pu = (x0 + i - 1) >> log2_min_pu_size;
827 88971864 int xq_pu = (x0 + i) >> log2_min_pu_size;
828 88971864 MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
829 88971864 MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
830
831 88971864 bs = boundary_strength(s, curr, left, rpl);
832 88971864 s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
833 }
834 }
835 }
836 19631798 }
837
838 #undef LUMA
839 #undef CB
840 #undef CR
841
842 1395534 void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
843 {
844 1395534 int x_end = x >= s->ps.sps->width - ctb_size;
845 1395534 int skip = 0;
846
1/2
✓ Branch 0 taken 1395534 times.
✗ Branch 1 not taken.
1395534 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
847
5/6
✓ Branch 0 taken 3060 times.
✓ Branch 1 taken 1392474 times.
✓ Branch 2 taken 2040 times.
✓ Branch 3 taken 1020 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2040 times.
1395534 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
848
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1392474 times.
1393494 (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
849
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type != HEVC_SLICE_I) ||
850
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1392474 times.
1393494 (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
851
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type == HEVC_SLICE_B) ||
852
3/4
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1392474 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1020 times.
1394514 (s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
853 1020 ff_hevc_nal_is_nonref(s->nal_unit_type)))
854 2040 skip = 1;
855
856
2/2
✓ Branch 0 taken 1393494 times.
✓ Branch 1 taken 2040 times.
1395534 if (!skip)
857 1393494 deblocking_filter_CTB(s, x, y);
858
4/4
✓ Branch 0 taken 1178544 times.
✓ Branch 1 taken 216990 times.
✓ Branch 2 taken 1176504 times.
✓ Branch 3 taken 2040 times.
2572038 if (s->ps.sps->sao_enabled && !skip) {
859 1176504 int y_end = y >= s->ps.sps->height - ctb_size;
860
4/4
✓ Branch 0 taken 1073777 times.
✓ Branch 1 taken 102727 times.
✓ Branch 2 taken 1018820 times.
✓ Branch 3 taken 54957 times.
1176504 if (y && x)
861 1018820 sao_filter_CTB(s, x - ctb_size, y - ctb_size);
862
4/4
✓ Branch 0 taken 1112867 times.
✓ Branch 1 taken 63637 times.
✓ Branch 2 taken 94018 times.
✓ Branch 3 taken 1018849 times.
1176504 if (x && y_end)
863 94018 sao_filter_CTB(s, x - ctb_size, y);
864
4/4
✓ Branch 0 taken 1073777 times.
✓ Branch 1 taken 102727 times.
✓ Branch 2 taken 54956 times.
✓ Branch 3 taken 1018821 times.
1176504 if (y && x_end) {
865 54956 sao_filter_CTB(s, x, y - ctb_size);
866
2/2
✓ Branch 0 taken 497 times.
✓ Branch 1 taken 54459 times.
54956 if (s->threads_type & FF_THREAD_FRAME )
867 497 ff_thread_report_progress(&s->ref->tf, y, 0);
868 }
869
4/4
✓ Branch 0 taken 63636 times.
✓ Branch 1 taken 1112868 times.
✓ Branch 2 taken 8679 times.
✓ Branch 3 taken 54957 times.
1176504 if (x_end && y_end) {
870 8679 sao_filter_CTB(s, x , y);
871
2/2
✓ Branch 0 taken 31 times.
✓ Branch 1 taken 8648 times.
8679 if (s->threads_type & FF_THREAD_FRAME )
872 31 ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0);
873 }
874
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)
875 ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0);
876 1395534 }
877
878 1395565 void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size)
879 {
880 1395565 int x_end = x_ctb >= s->ps.sps->width - ctb_size;
881 1395565 int y_end = y_ctb >= s->ps.sps->height - ctb_size;
882
4/4
✓ Branch 0 taken 1277321 times.
✓ Branch 1 taken 118244 times.
✓ Branch 2 taken 1214122 times.
✓ Branch 3 taken 63199 times.
1395565 if (y_ctb && x_ctb)
883 1214122 ff_hevc_hls_filter(s, x_ctb - ctb_size, y_ctb - ctb_size, ctb_size);
884
4/4
✓ Branch 0 taken 1277321 times.
✓ Branch 1 taken 118244 times.
✓ Branch 2 taken 63198 times.
✓ Branch 3 taken 1214123 times.
1395565 if (y_ctb && x_end)
885 63198 ff_hevc_hls_filter(s, x_ctb, y_ctb - ctb_size, ctb_size);
886
4/4
✓ Branch 0 taken 1322882 times.
✓ Branch 1 taken 72683 times.
✓ Branch 2 taken 108731 times.
✓ Branch 3 taken 1214151 times.
1395565 if (x_ctb && y_end)
887 108731 ff_hevc_hls_filter(s, x_ctb - ctb_size, y_ctb, ctb_size);
888 1395565 }
889