FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hevc_filter.c
Date: 2022-11-26 13:19:19
Exec Total Coverage
Lines: 551 556 99.1%
Branches: 495 511 96.9%

Line Branch Exec Source
1 /*
2 * HEVC video decoder
3 *
4 * Copyright (C) 2012 - 2013 Guillaume Martres
5 * Copyright (C) 2013 Seppo Tomperi
6 * Copyright (C) 2013 Wassim Hamidouche
7 *
8 * This file is part of FFmpeg.
9 *
10 * FFmpeg is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * FFmpeg is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with FFmpeg; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25 #include "libavutil/common.h"
26 #include "libavutil/internal.h"
27
28 #include "hevcdec.h"
29 #include "threadframe.h"
30
31 #define LUMA 0
32 #define CB 1
33 #define CR 2
34
35 static const uint8_t tctable[54] = {
36 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // QP 0...18
37 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, // QP 19...37
38 5, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24 // QP 38...53
39 };
40
41 static const uint8_t betatable[52] = {
42 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, // QP 0...18
43 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, // QP 19...37
44 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64 // QP 38...51
45 };
46
47 21802476 static int chroma_tc(const HEVCContext *s, int qp_y, int c_idx, int tc_offset)
48 {
49 static const int qp_c[] = {
50 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37
51 };
52 int qp, qp_i, offset, idxt;
53
54 // slice qp offset is not used for deblocking
55
2/2
✓ Branch 0 taken 10901238 times.
✓ Branch 1 taken 10901238 times.
21802476 if (c_idx == 1)
56 10901238 offset = s->ps.pps->cb_qp_offset;
57 else
58 10901238 offset = s->ps.pps->cr_qp_offset;
59
60 21802476 qp_i = av_clip(qp_y + offset, 0, 57);
61
2/2
✓ Branch 0 taken 18322748 times.
✓ Branch 1 taken 3479728 times.
21802476 if (s->ps.sps->chroma_format_idc == 1) {
62
2/2
✓ Branch 0 taken 2947419 times.
✓ Branch 1 taken 15375329 times.
18322748 if (qp_i < 30)
63 2947419 qp = qp_i;
64
2/2
✓ Branch 0 taken 153221 times.
✓ Branch 1 taken 15222108 times.
15375329 else if (qp_i > 43)
65 153221 qp = qp_i - 6;
66 else
67 15222108 qp = qp_c[qp_i - 30];
68 } else {
69 3479728 qp = av_clip(qp_i, 0, 51);
70 }
71
72 21802476 idxt = av_clip(qp + DEFAULT_INTRA_TC_OFFSET + tc_offset, 0, 53);
73 21802476 return tctable[idxt];
74 }
75
76 1351388 static int get_qPy_pred(HEVCLocalContext *lc, const HEVCContext *s,
77 int xBase, int yBase, int log2_cb_size)
78 {
79 1351388 int ctb_size_mask = (1 << s->ps.sps->log2_ctb_size) - 1;
80 1351388 int MinCuQpDeltaSizeMask = (1 << (s->ps.sps->log2_ctb_size -
81 1351388 s->ps.pps->diff_cu_qp_delta_depth)) - 1;
82 1351388 int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
83 1351388 int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
84 1351388 int min_cb_width = s->ps.sps->min_cb_width;
85 1351388 int x_cb = xQgBase >> s->ps.sps->log2_min_cb_size;
86 1351388 int y_cb = yQgBase >> s->ps.sps->log2_min_cb_size;
87
2/2
✓ Branch 0 taken 923504 times.
✓ Branch 1 taken 427884 times.
2274892 int availableA = (xBase & ctb_size_mask) &&
88
2/2
✓ Branch 0 taken 786410 times.
✓ Branch 1 taken 137094 times.
923504 (xQgBase & ctb_size_mask);
89
2/2
✓ Branch 0 taken 905287 times.
✓ Branch 1 taken 446101 times.
2256675 int availableB = (yBase & ctb_size_mask) &&
90
2/2
✓ Branch 0 taken 783685 times.
✓ Branch 1 taken 121602 times.
905287 (yQgBase & ctb_size_mask);
91 int qPy_pred, qPy_a, qPy_b;
92
93 // qPy_pred
94
5/6
✓ Branch 0 taken 1263730 times.
✓ Branch 1 taken 87658 times.
✓ Branch 2 taken 18268 times.
✓ Branch 3 taken 1245462 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18268 times.
1351388 if (lc->first_qp_group || (!xQgBase && !yQgBase)) {
95 87658 lc->first_qp_group = !lc->tu.is_cu_qp_delta_coded;
96 87658 qPy_pred = s->sh.slice_qp;
97 } else {
98 1263730 qPy_pred = lc->qPy_pred;
99 }
100
101 // qPy_a
102
2/2
✓ Branch 0 taken 564978 times.
✓ Branch 1 taken 786410 times.
1351388 if (availableA == 0)
103 564978 qPy_a = qPy_pred;
104 else
105 786410 qPy_a = s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width];
106
107 // qPy_b
108
2/2
✓ Branch 0 taken 567703 times.
✓ Branch 1 taken 783685 times.
1351388 if (availableB == 0)
109 567703 qPy_b = qPy_pred;
110 else
111 783685 qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
112
113 av_assert2(qPy_a >= -s->ps.sps->qp_bd_offset && qPy_a < 52);
114 av_assert2(qPy_b >= -s->ps.sps->qp_bd_offset && qPy_b < 52);
115
116 1351388 return (qPy_a + qPy_b + 1) >> 1;
117 }
118
119 1351388 void ff_hevc_set_qPy(HEVCLocalContext *lc, int xBase, int yBase, int log2_cb_size)
120 {
121 1351388 const HEVCContext *const s = lc->parent;
122 1351388 int qp_y = get_qPy_pred(lc, s, xBase, yBase, log2_cb_size);
123
124
2/2
✓ Branch 0 taken 368705 times.
✓ Branch 1 taken 982683 times.
1351388 if (lc->tu.cu_qp_delta != 0) {
125 368705 int off = s->ps.sps->qp_bd_offset;
126
1/2
✓ Branch 0 taken 368705 times.
✗ Branch 1 not taken.
368705 lc->qp_y = FFUMOD(qp_y + lc->tu.cu_qp_delta + 52 + 2 * off,
127 368705 52 + off) - off;
128 } else
129 982683 lc->qp_y = qp_y;
130 1351388 }
131
132 114184184 static int get_qPy(const HEVCContext *s, int xC, int yC)
133 {
134 114184184 int log2_min_cb_size = s->ps.sps->log2_min_cb_size;
135 114184184 int x = xC >> log2_min_cb_size;
136 114184184 int y = yC >> log2_min_cb_size;
137 114184184 return s->qp_y_tab[x + y * s->ps.sps->min_cb_width];
138 }
139
140 376228 static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height,
141 ptrdiff_t stride_dst, ptrdiff_t stride_src)
142 {
143 int i, j;
144
145
2/2
✓ Branch 0 taken 55171 times.
✓ Branch 1 taken 321057 times.
376228 if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) {
146
2/2
✓ Branch 0 taken 2394912 times.
✓ Branch 1 taken 55171 times.
2450083 for (i = 0; i < height; i++) {
147
2/2
✓ Branch 0 taken 16774992 times.
✓ Branch 1 taken 2394912 times.
19169904 for (j = 0; j < width - 7; j+=8)
148 16774992 AV_COPY64U(dst+j, src+j);
149 2394912 dst += stride_dst;
150 2394912 src += stride_src;
151 }
152
2/2
✓ Branch 0 taken 54971 times.
✓ Branch 1 taken 200 times.
55171 if (width&7) {
153 54971 dst += ((width>>3)<<3) - stride_dst * height;
154 54971 src += ((width>>3)<<3) - stride_src * height;
155 54971 width &= 7;
156
2/2
✓ Branch 0 taken 2393312 times.
✓ Branch 1 taken 54971 times.
2448283 for (i = 0; i < height; i++) {
157
2/2
✓ Branch 0 taken 5232592 times.
✓ Branch 1 taken 2393312 times.
7625904 for (j = 0; j < width; j++)
158 5232592 dst[j] = src[j];
159 2393312 dst += stride_dst;
160 2393312 src += stride_src;
161 }
162 }
163 } else {
164
2/2
✓ Branch 0 taken 16952624 times.
✓ Branch 1 taken 321057 times.
17273681 for (i = 0; i < height; i++) {
165
2/2
✓ Branch 0 taken 86387288 times.
✓ Branch 1 taken 16952624 times.
103339912 for (j = 0; j < width; j+=16)
166 86387288 AV_COPY128(dst+j, src+j);
167 16952624 dst += stride_dst;
168 16952624 src += stride_src;
169 }
170 }
171 376228 }
172
173 1324839 static void copy_pixel(uint8_t *dst, const uint8_t *src, int pixel_shift)
174 {
175
2/2
✓ Branch 0 taken 222166 times.
✓ Branch 1 taken 1102673 times.
1324839 if (pixel_shift)
176 222166 *(uint16_t *)dst = *(uint16_t *)src;
177 else
178 1102673 *dst = *src;
179 1324839 }
180
181 1278083 static void copy_vert(uint8_t *dst, const uint8_t *src,
182 int pixel_shift, int height,
183 ptrdiff_t stride_dst, ptrdiff_t stride_src)
184 {
185 int i;
186
2/2
✓ Branch 0 taken 1097811 times.
✓ Branch 1 taken 180272 times.
1278083 if (pixel_shift == 0) {
187
2/2
✓ Branch 0 taken 51798240 times.
✓ Branch 1 taken 1097811 times.
52896051 for (i = 0; i < height; i++) {
188 51798240 *dst = *src;
189 51798240 dst += stride_dst;
190 51798240 src += stride_src;
191 }
192 } else {
193
2/2
✓ Branch 0 taken 11234032 times.
✓ Branch 1 taken 180272 times.
11414304 for (i = 0; i < height; i++) {
194 11234032 *(uint16_t *)dst = *(uint16_t *)src;
195 11234032 dst += stride_dst;
196 11234032 src += stride_src;
197 }
198 }
199 1278083 }
200
201 486860 static void copy_CTB_to_hv(const HEVCContext *s, const uint8_t *src,
202 ptrdiff_t stride_src, int x, int y, int width, int height,
203 int c_idx, int x_ctb, int y_ctb)
204 {
205 486860 int sh = s->ps.sps->pixel_shift;
206 486860 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
207 486860 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
208
209 /* copy horizontal edges */
210 486860 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << sh),
211 486860 src, width << sh);
212 486860 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << sh),
213 486860 src + stride_src * (height - 1), width << sh);
214
215 /* copy vertical edges */
216 486860 copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << sh), src, sh, height, 1 << sh, stride_src);
217
218 486860 copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 1) * h + y) << sh), src + ((width - 1) << sh), sh, height, 1 << sh, stride_src);
219 486860 }
220
221 376228 static void restore_tqb_pixels(const HEVCContext *s,
222 uint8_t *src1, const uint8_t *dst1,
223 ptrdiff_t stride_src, ptrdiff_t stride_dst,
224 int x0, int y0, int width, int height, int c_idx)
225 {
226
2/2
✓ Branch 0 taken 371939 times.
✓ Branch 1 taken 4289 times.
376228 if ( s->ps.pps->transquant_bypass_enable_flag ||
227
3/4
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 371835 times.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
371939 (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
228 int x, y;
229 4393 int min_pu_size = 1 << s->ps.sps->log2_min_pu_size;
230 4393 int hshift = s->ps.sps->hshift[c_idx];
231 4393 int vshift = s->ps.sps->vshift[c_idx];
232 4393 int x_min = ((x0 ) >> s->ps.sps->log2_min_pu_size);
233 4393 int y_min = ((y0 ) >> s->ps.sps->log2_min_pu_size);
234 4393 int x_max = ((x0 + width ) >> s->ps.sps->log2_min_pu_size);
235 4393 int y_max = ((y0 + height) >> s->ps.sps->log2_min_pu_size);
236 4393 int len = (min_pu_size >> hshift) << s->ps.sps->pixel_shift;
237
2/2
✓ Branch 0 taken 49472 times.
✓ Branch 1 taken 4393 times.
53865 for (y = y_min; y < y_max; y++) {
238
2/2
✓ Branch 0 taken 632704 times.
✓ Branch 1 taken 49472 times.
682176 for (x = x_min; x < x_max; x++) {
239
2/2
✓ Branch 0 taken 264 times.
✓ Branch 1 taken 632440 times.
632704 if (s->is_pcm[y * s->ps.sps->min_pu_width + x]) {
240 int n;
241 264 uint8_t *src = src1 + (((y << s->ps.sps->log2_min_pu_size) - y0) >> vshift) * stride_src + ((((x << s->ps.sps->log2_min_pu_size) - x0) >> hshift) << s->ps.sps->pixel_shift);
242 264 const uint8_t *dst = dst1 + (((y << s->ps.sps->log2_min_pu_size) - y0) >> vshift) * stride_dst + ((((x << s->ps.sps->log2_min_pu_size) - x0) >> hshift) << s->ps.sps->pixel_shift);
243
2/2
✓ Branch 0 taken 704 times.
✓ Branch 1 taken 264 times.
968 for (n = 0; n < (min_pu_size >> vshift); n++) {
244 704 memcpy(src, dst, len);
245 704 src += stride_src;
246 704 dst += stride_dst;
247 }
248 }
249 }
250 }
251 }
252 376228 }
253
254 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
255
256 1185401 static void sao_filter_CTB(HEVCLocalContext *lc, const HEVCContext *s, int x, int y)
257 {
258 static const uint8_t sao_tab[8] = { 0, 1, 2, 2, 3, 3, 4, 4 };
259 int c_idx;
260 int edges[4]; // 0 left 1 top 2 right 3 bottom
261 1185401 int x_ctb = x >> s->ps.sps->log2_ctb_size;
262 1185401 int y_ctb = y >> s->ps.sps->log2_ctb_size;
263 1185401 int ctb_addr_rs = y_ctb * s->ps.sps->ctb_width + x_ctb;
264 1185401 int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
265 1185401 SAOParams *sao = &CTB(s->sao, x_ctb, y_ctb);
266 // flags indicating unfilterable edges
267 1185401 uint8_t vert_edge[] = { 0, 0 };
268 1185401 uint8_t horiz_edge[] = { 0, 0 };
269 1185401 uint8_t diag_edge[] = { 0, 0, 0, 0 };
270 1185401 uint8_t lfase = CTB(s->filter_slice_edges, x_ctb, y_ctb);
271
2/2
✓ Branch 0 taken 170200 times.
✓ Branch 1 taken 1015201 times.
1355601 uint8_t no_tile_filter = s->ps.pps->tiles_enabled_flag &&
272
2/2
✓ Branch 0 taken 16664 times.
✓ Branch 1 taken 153536 times.
170200 !s->ps.pps->loop_filter_across_tiles_enabled_flag;
273
4/4
✓ Branch 0 taken 1168737 times.
✓ Branch 1 taken 16664 times.
✓ Branch 2 taken 51490 times.
✓ Branch 3 taken 1117247 times.
1185401 uint8_t restore = no_tile_filter || !lfase;
274 1185401 uint8_t left_tile_edge = 0;
275 1185401 uint8_t right_tile_edge = 0;
276 1185401 uint8_t up_tile_edge = 0;
277 1185401 uint8_t bottom_tile_edge = 0;
278
279 1185401 edges[0] = x_ctb == 0;
280 1185401 edges[1] = y_ctb == 0;
281 1185401 edges[2] = x_ctb == s->ps.sps->ctb_width - 1;
282 1185401 edges[3] = y_ctb == s->ps.sps->ctb_height - 1;
283
284
2/2
✓ Branch 0 taken 68154 times.
✓ Branch 1 taken 1117247 times.
1185401 if (restore) {
285
2/2
✓ Branch 0 taken 64585 times.
✓ Branch 1 taken 3569 times.
68154 if (!edges[0]) {
286
4/4
✓ Branch 0 taken 16242 times.
✓ Branch 1 taken 48343 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 15406 times.
64585 left_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]];
287
6/6
✓ Branch 0 taken 48343 times.
✓ Branch 1 taken 16242 times.
✓ Branch 2 taken 48136 times.
✓ Branch 3 taken 207 times.
✓ Branch 4 taken 836 times.
✓ Branch 5 taken 63542 times.
64585 vert_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb)) || left_tile_edge;
288 }
289
2/2
✓ Branch 0 taken 64586 times.
✓ Branch 1 taken 3568 times.
68154 if (!edges[2]) {
290
4/4
✓ Branch 0 taken 16242 times.
✓ Branch 1 taken 48344 times.
✓ Branch 2 taken 836 times.
✓ Branch 3 taken 15406 times.
64586 right_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs+1]];
291
6/6
✓ Branch 0 taken 48344 times.
✓ Branch 1 taken 16242 times.
✓ Branch 2 taken 48137 times.
✓ Branch 3 taken 207 times.
✓ Branch 4 taken 836 times.
✓ Branch 5 taken 63543 times.
64586 vert_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb)) || right_tile_edge;
292 }
293
2/2
✓ Branch 0 taken 61940 times.
✓ Branch 1 taken 6214 times.
68154 if (!edges[1]) {
294
4/4
✓ Branch 0 taken 15931 times.
✓ Branch 1 taken 46009 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 14491 times.
61940 up_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs - s->ps.sps->ctb_width]];
295
6/6
✓ Branch 0 taken 46009 times.
✓ Branch 1 taken 15931 times.
✓ Branch 2 taken 44569 times.
✓ Branch 3 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 59060 times.
61940 horiz_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb, y_ctb - 1)) || up_tile_edge;
296 }
297
2/2
✓ Branch 0 taken 61970 times.
✓ Branch 1 taken 6184 times.
68154 if (!edges[3]) {
298
4/4
✓ Branch 0 taken 15931 times.
✓ Branch 1 taken 46039 times.
✓ Branch 2 taken 1440 times.
✓ Branch 3 taken 14491 times.
61970 bottom_tile_edge = no_tile_filter && s->ps.pps->tile_id[ctb_addr_ts] != s->ps.pps->tile_id[s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs + s->ps.sps->ctb_width]];
299
6/6
✓ Branch 0 taken 46039 times.
✓ Branch 1 taken 15931 times.
✓ Branch 2 taken 44599 times.
✓ Branch 3 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 59090 times.
61970 horiz_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb, y_ctb + 1)) || bottom_tile_edge;
300 }
301
4/4
✓ Branch 0 taken 64585 times.
✓ Branch 1 taken 3569 times.
✓ Branch 2 taken 58971 times.
✓ Branch 3 taken 5614 times.
68154 if (!edges[0] && !edges[1]) {
302
8/8
✓ Branch 0 taken 43443 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 41859 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 56588 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 55256 times.
58971 diag_edge[0] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb - 1)) || left_tile_edge || up_tile_edge;
303 }
304
4/4
✓ Branch 0 taken 61940 times.
✓ Branch 1 taken 6214 times.
✓ Branch 2 taken 58972 times.
✓ Branch 3 taken 2968 times.
68154 if (!edges[1] && !edges[2]) {
305
8/8
✓ Branch 0 taken 43444 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 41860 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 56589 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 55257 times.
58972 diag_edge[1] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb - 1)) || right_tile_edge || up_tile_edge;
306 }
307
4/4
✓ Branch 0 taken 64586 times.
✓ Branch 1 taken 3568 times.
✓ Branch 2 taken 59001 times.
✓ Branch 3 taken 5585 times.
68154 if (!edges[2] && !edges[3]) {
308
8/8
✓ Branch 0 taken 43473 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 41889 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 56618 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 55286 times.
59001 diag_edge[2] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb + 1, y_ctb + 1)) || right_tile_edge || bottom_tile_edge;
309 }
310
4/4
✓ Branch 0 taken 64585 times.
✓ Branch 1 taken 3569 times.
✓ Branch 2 taken 59000 times.
✓ Branch 3 taken 5585 times.
68154 if (!edges[0] && !edges[3]) {
311
8/8
✓ Branch 0 taken 43472 times.
✓ Branch 1 taken 15528 times.
✓ Branch 2 taken 41888 times.
✓ Branch 3 taken 1584 times.
✓ Branch 4 taken 56617 times.
✓ Branch 5 taken 799 times.
✓ Branch 6 taken 1332 times.
✓ Branch 7 taken 55285 times.
59000 diag_edge[3] = (!lfase && CTB(s->tab_slice_address, x_ctb, y_ctb) != CTB(s->tab_slice_address, x_ctb - 1, y_ctb + 1)) || left_tile_edge || bottom_tile_edge;
312 }
313 }
314
315
4/4
✓ Branch 0 taken 4741412 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 3556107 times.
✓ Branch 3 taken 1185401 times.
4741508 for (c_idx = 0; c_idx < (s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
316 3556107 int x0 = x >> s->ps.sps->hshift[c_idx];
317 3556107 int y0 = y >> s->ps.sps->vshift[c_idx];
318 3556107 ptrdiff_t stride_src = s->frame->linesize[c_idx];
319 3556107 int ctb_size_h = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->hshift[c_idx];
320 3556107 int ctb_size_v = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->vshift[c_idx];
321 3556107 int width = FFMIN(ctb_size_h, (s->ps.sps->width >> s->ps.sps->hshift[c_idx]) - x0);
322 3556107 int height = FFMIN(ctb_size_v, (s->ps.sps->height >> s->ps.sps->vshift[c_idx]) - y0);
323 3556107 int tab = sao_tab[(FFALIGN(width, 8) >> 3) - 1];
324 3556107 uint8_t *src = &s->frame->data[c_idx][y0 * stride_src + (x0 << s->ps.sps->pixel_shift)];
325 ptrdiff_t stride_dst;
326 uint8_t *dst;
327
328
3/3
✓ Branch 0 taken 111401 times.
✓ Branch 1 taken 375459 times.
✓ Branch 2 taken 3069247 times.
3556107 switch (sao->type_idx[c_idx]) {
329 111401 case SAO_BAND:
330 111401 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
331 x_ctb, y_ctb);
332
2/2
✓ Branch 0 taken 110640 times.
✓ Branch 1 taken 761 times.
111401 if (s->ps.pps->transquant_bypass_enable_flag ||
333
3/4
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 110632 times.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
110640 (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
334 769 dst = lc->edge_emu_buffer;
335 769 stride_dst = 2*MAX_PB_SIZE;
336 769 copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src);
337 769 s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst,
338 769 sao->offset_val[c_idx], sao->band_position[c_idx],
339 width, height);
340 769 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
341 x, y, width, height, c_idx);
342 } else {
343 110632 s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src,
344 110632 sao->offset_val[c_idx], sao->band_position[c_idx],
345 width, height);
346 }
347 111401 sao->type_idx[c_idx] = SAO_APPLIED;
348 111401 break;
349 375459 case SAO_EDGE:
350 {
351 375459 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
352 375459 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
353 375459 int left_edge = edges[0];
354 375459 int top_edge = edges[1];
355 375459 int right_edge = edges[2];
356 375459 int bottom_edge = edges[3];
357 375459 int sh = s->ps.sps->pixel_shift;
358 int left_pixels, right_pixels;
359
360 375459 stride_dst = 2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE;
361 375459 dst = lc->edge_emu_buffer + stride_dst + AV_INPUT_BUFFER_PADDING_SIZE;
362
363
2/2
✓ Branch 0 taken 349701 times.
✓ Branch 1 taken 25758 times.
375459 if (!top_edge) {
364 349701 int left = 1 - left_edge;
365 349701 int right = 1 - right_edge;
366 const uint8_t *src1[2];
367 uint8_t *dst1;
368 int src_idx, pos;
369
370 349701 dst1 = dst - stride_dst - (left << sh);
371 349701 src1[0] = src - stride_src - (left << sh);
372 349701 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0 - left) << sh);
373 349701 pos = 0;
374
2/2
✓ Branch 0 taken 333210 times.
✓ Branch 1 taken 16491 times.
349701 if (left) {
375 333210 src_idx = (CTB(s->sao, x_ctb-1, y_ctb-1).type_idx[c_idx] ==
376 SAO_APPLIED);
377 333210 copy_pixel(dst1, src1[src_idx], sh);
378 333210 pos += (1 << sh);
379 }
380 349701 src_idx = (CTB(s->sao, x_ctb, y_ctb-1).type_idx[c_idx] ==
381 SAO_APPLIED);
382 349701 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
383
2/2
✓ Branch 0 taken 332759 times.
✓ Branch 1 taken 16942 times.
349701 if (right) {
384 332759 pos += width << sh;
385 332759 src_idx = (CTB(s->sao, x_ctb+1, y_ctb-1).type_idx[c_idx] ==
386 SAO_APPLIED);
387 332759 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
388 }
389 }
390
2/2
✓ Branch 0 taken 345748 times.
✓ Branch 1 taken 29711 times.
375459 if (!bottom_edge) {
391 345748 int left = 1 - left_edge;
392 345748 int right = 1 - right_edge;
393 const uint8_t *src1[2];
394 uint8_t *dst1;
395 int src_idx, pos;
396
397 345748 dst1 = dst + height * stride_dst - (left << sh);
398 345748 src1[0] = src + height * stride_src - (left << sh);
399 345748 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0 - left) << sh);
400 345748 pos = 0;
401
2/2
✓ Branch 0 taken 329829 times.
✓ Branch 1 taken 15919 times.
345748 if (left) {
402 329829 src_idx = (CTB(s->sao, x_ctb-1, y_ctb+1).type_idx[c_idx] ==
403 SAO_APPLIED);
404 329829 copy_pixel(dst1, src1[src_idx], sh);
405 329829 pos += (1 << sh);
406 }
407 345748 src_idx = (CTB(s->sao, x_ctb, y_ctb+1).type_idx[c_idx] ==
408 SAO_APPLIED);
409 345748 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
410
2/2
✓ Branch 0 taken 329041 times.
✓ Branch 1 taken 16707 times.
345748 if (right) {
411 329041 pos += width << sh;
412 329041 src_idx = (CTB(s->sao, x_ctb+1, y_ctb+1).type_idx[c_idx] ==
413 SAO_APPLIED);
414 329041 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
415 }
416 }
417 375459 left_pixels = 0;
418
2/2
✓ Branch 0 taken 356968 times.
✓ Branch 1 taken 18491 times.
375459 if (!left_edge) {
419
2/2
✓ Branch 0 taken 304363 times.
✓ Branch 1 taken 52605 times.
356968 if (CTB(s->sao, x_ctb-1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
420 304363 copy_vert(dst - (1 << sh),
421 304363 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh),
422 304363 sh, height, stride_dst, 1 << sh);
423 } else {
424 52605 left_pixels = 1;
425 }
426 }
427 375459 right_pixels = 0;
428
2/2
✓ Branch 0 taken 356403 times.
✓ Branch 1 taken 19056 times.
375459 if (!right_edge) {
429
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 356403 times.
356403 if (CTB(s->sao, x_ctb+1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
430 copy_vert(dst + (width << sh),
431 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) * h + y0) << sh),
432 sh, height, stride_dst, 1 << sh);
433 } else {
434 356403 right_pixels = 1;
435 }
436 }
437
438 375459 copy_CTB(dst - (left_pixels << sh),
439 375459 src - (left_pixels << sh),
440 375459 (width + left_pixels + right_pixels) << sh,
441 height, stride_dst, stride_src);
442
443 375459 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
444 x_ctb, y_ctb);
445 375459 s->hevcdsp.sao_edge_filter[tab](src, dst, stride_src, sao->offset_val[c_idx],
446 sao->eo_class[c_idx], width, height);
447 375459 s->hevcdsp.sao_edge_restore[restore](src, dst,
448 stride_src, stride_dst,
449 sao,
450 edges, width,
451 height, c_idx,
452 vert_edge,
453 horiz_edge,
454 diag_edge);
455 375459 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
456 x, y, width, height, c_idx);
457 375459 sao->type_idx[c_idx] = SAO_APPLIED;
458 375459 break;
459 }
460 }
461 }
462 1185401 }
463
464 2057768 static int get_pcm(const HEVCContext *s, int x, int y)
465 {
466 2057768 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
467 int x_pu, y_pu;
468
469
2/4
✓ Branch 0 taken 2057768 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2057768 times.
2057768 if (x < 0 || y < 0)
470 return 2;
471
472 2057768 x_pu = x >> log2_min_pu_size;
473 2057768 y_pu = y >> log2_min_pu_size;
474
475
3/4
✓ Branch 0 taken 2057768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1408 times.
✓ Branch 3 taken 2056360 times.
2057768 if (x_pu >= s->ps.sps->min_pu_width || y_pu >= s->ps.sps->min_pu_height)
476 1408 return 2;
477 2056360 return s->is_pcm[y_pu * s->ps.sps->min_pu_width + x_pu];
478 }
479
480 #define TC_CALC(qp, bs) \
481 tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + \
482 (tc_offset & -2), \
483 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
484
485 1402422 static void deblocking_filter_CTB(const HEVCContext *s, int x0, int y0)
486 {
487 uint8_t *src;
488 int x, y;
489 int chroma, beta;
490 int32_t c_tc[2], tc[2];
491 1402422 uint8_t no_p[2] = { 0 };
492 1402422 uint8_t no_q[2] = { 0 };
493
494 1402422 int log2_ctb_size = s->ps.sps->log2_ctb_size;
495 int x_end, x_end2, y_end;
496 1402422 int ctb_size = 1 << log2_ctb_size;
497 1402422 int ctb = (x0 >> log2_ctb_size) +
498 1402422 (y0 >> log2_ctb_size) * s->ps.sps->ctb_width;
499 1402422 int cur_tc_offset = s->deblock[ctb].tc_offset;
500 1402422 int cur_beta_offset = s->deblock[ctb].beta_offset;
501 int left_tc_offset, left_beta_offset;
502 int tc_offset, beta_offset;
503 2892225 int pcmf = (s->ps.sps->pcm_enabled_flag &&
504
4/4
✓ Branch 0 taken 87381 times.
✓ Branch 1 taken 1315041 times.
✓ Branch 2 taken 87325 times.
✓ Branch 3 taken 56 times.
2804788 s->ps.sps->pcm.loop_filter_disable_flag) ||
505
2/2
✓ Branch 0 taken 4570 times.
✓ Branch 1 taken 1397796 times.
1402366 s->ps.pps->transquant_bypass_enable_flag;
506
507
2/2
✓ Branch 0 taken 1329624 times.
✓ Branch 1 taken 72798 times.
1402422 if (x0) {
508 1329624 left_tc_offset = s->deblock[ctb - 1].tc_offset;
509 1329624 left_beta_offset = s->deblock[ctb - 1].beta_offset;
510 } else {
511 72798 left_tc_offset = 0;
512 72798 left_beta_offset = 0;
513 }
514
515 1402422 x_end = x0 + ctb_size;
516
2/2
✓ Branch 0 taken 25296 times.
✓ Branch 1 taken 1377126 times.
1402422 if (x_end > s->ps.sps->width)
517 25296 x_end = s->ps.sps->width;
518 1402422 y_end = y0 + ctb_size;
519
2/2
✓ Branch 0 taken 95617 times.
✓ Branch 1 taken 1306805 times.
1402422 if (y_end > s->ps.sps->height)
520 95617 y_end = s->ps.sps->height;
521
522 1402422 tc_offset = cur_tc_offset;
523 1402422 beta_offset = cur_beta_offset;
524
525 1402422 x_end2 = x_end;
526
2/2
✓ Branch 0 taken 1329625 times.
✓ Branch 1 taken 72797 times.
1402422 if (x_end2 != s->ps.sps->width)
527 1329625 x_end2 -= 8;
528
2/2
✓ Branch 0 taken 10066152 times.
✓ Branch 1 taken 1402422 times.
11468574 for (y = y0; y < y_end; y += 8) {
529 // vertical filtering luma
530
4/4
✓ Branch 0 taken 9538585 times.
✓ Branch 1 taken 527567 times.
✓ Branch 2 taken 76436165 times.
✓ Branch 3 taken 10066152 times.
86502317 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
531 76436165 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
532 76436165 const int bs1 = s->vertical_bs[(x + (y + 4) * s->bs_width) >> 2];
533
4/4
✓ Branch 0 taken 59177804 times.
✓ Branch 1 taken 17258361 times.
✓ Branch 2 taken 89497 times.
✓ Branch 3 taken 59088307 times.
76436165 if (bs0 || bs1) {
534 17347858 const int qp = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
535
536 17347858 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
537
538
2/2
✓ Branch 0 taken 17258361 times.
✓ Branch 1 taken 89497 times.
17347858 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
539
2/2
✓ Branch 0 taken 17251720 times.
✓ Branch 1 taken 96138 times.
17347858 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
540 17347858 src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
541
2/2
✓ Branch 0 taken 186079 times.
✓ Branch 1 taken 17161779 times.
17347858 if (pcmf) {
542 186079 no_p[0] = get_pcm(s, x - 1, y);
543 186079 no_p[1] = get_pcm(s, x - 1, y + 4);
544 186079 no_q[0] = get_pcm(s, x, y);
545 186079 no_q[1] = get_pcm(s, x, y + 4);
546 186079 s->hevcdsp.hevc_v_loop_filter_luma_c(src,
547 186079 s->frame->linesize[LUMA],
548 beta, tc, no_p, no_q);
549 } else
550 17161779 s->hevcdsp.hevc_v_loop_filter_luma(src,
551 17161779 s->frame->linesize[LUMA],
552 beta, tc, no_p, no_q);
553 }
554 }
555
556
2/2
✓ Branch 0 taken 118428 times.
✓ Branch 1 taken 9947724 times.
10066152 if(!y)
557 118428 continue;
558
559 // horizontal filtering luma
560
4/4
✓ Branch 0 taken 9429645 times.
✓ Branch 1 taken 518079 times.
✓ Branch 2 taken 76096079 times.
✓ Branch 3 taken 9947724 times.
86043803 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
561 76096079 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
562 76096079 const int bs1 = s->horizontal_bs[((x + 4) + y * s->bs_width) >> 2];
563
4/4
✓ Branch 0 taken 58521697 times.
✓ Branch 1 taken 17574382 times.
✓ Branch 2 taken 106170 times.
✓ Branch 3 taken 58415527 times.
76096079 if (bs0 || bs1) {
564 17680552 const int qp = (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1;
565
566
2/2
✓ Branch 0 taken 15471643 times.
✓ Branch 1 taken 2208909 times.
17680552 tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
567
2/2
✓ Branch 0 taken 15471643 times.
✓ Branch 1 taken 2208909 times.
17680552 beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
568
569 17680552 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
570
2/2
✓ Branch 0 taken 17574382 times.
✓ Branch 1 taken 106170 times.
17680552 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
571
2/2
✓ Branch 0 taken 17559657 times.
✓ Branch 1 taken 120895 times.
17680552 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
572 17680552 src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
573
2/2
✓ Branch 0 taken 187803 times.
✓ Branch 1 taken 17492749 times.
17680552 if (pcmf) {
574 187803 no_p[0] = get_pcm(s, x, y - 1);
575 187803 no_p[1] = get_pcm(s, x + 4, y - 1);
576 187803 no_q[0] = get_pcm(s, x, y);
577 187803 no_q[1] = get_pcm(s, x + 4, y);
578 187803 s->hevcdsp.hevc_h_loop_filter_luma_c(src,
579 187803 s->frame->linesize[LUMA],
580 beta, tc, no_p, no_q);
581 } else
582 17492749 s->hevcdsp.hevc_h_loop_filter_luma(src,
583 17492749 s->frame->linesize[LUMA],
584 beta, tc, no_p, no_q);
585 }
586 }
587 }
588
589
2/2
✓ Branch 0 taken 1402374 times.
✓ Branch 1 taken 48 times.
1402422 if (s->ps.sps->chroma_format_idc) {
590
2/2
✓ Branch 0 taken 2804748 times.
✓ Branch 1 taken 1402374 times.
4207122 for (chroma = 1; chroma <= 2; chroma++) {
591 2804748 int h = 1 << s->ps.sps->hshift[chroma];
592 2804748 int v = 1 << s->ps.sps->vshift[chroma];
593
594 // vertical filtering chroma
595
2/2
✓ Branch 0 taken 10538960 times.
✓ Branch 1 taken 2804748 times.
13343708 for (y = y0; y < y_end; y += (8 * v)) {
596
4/4
✓ Branch 0 taken 540832 times.
✓ Branch 1 taken 9998128 times.
✓ Branch 2 taken 40598686 times.
✓ Branch 3 taken 10538960 times.
51137646 for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
597 40598686 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
598 40598686 const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * s->bs_width) >> 2];
599
600
4/4
✓ Branch 0 taken 34997282 times.
✓ Branch 1 taken 5601404 times.
✓ Branch 2 taken 128472 times.
✓ Branch 3 taken 34868810 times.
40598686 if ((bs0 == 2) || (bs1 == 2)) {
601 5729876 const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
602 5729876 const int qp1 = (get_qPy(s, x - 1, y + (4 * v)) + get_qPy(s, x, y + (4 * v)) + 1) >> 1;
603
604
2/2
✓ Branch 0 taken 5601404 times.
✓ Branch 1 taken 128472 times.
5729876 c_tc[0] = (bs0 == 2) ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
605
2/2
✓ Branch 0 taken 5597142 times.
✓ Branch 1 taken 132734 times.
5729876 c_tc[1] = (bs1 == 2) ? chroma_tc(s, qp1, chroma, tc_offset) : 0;
606 5729876 src = &s->frame->data[chroma][(y >> s->ps.sps->vshift[chroma]) * s->frame->linesize[chroma] + ((x >> s->ps.sps->hshift[chroma]) << s->ps.sps->pixel_shift)];
607
2/2
✓ Branch 0 taken 70838 times.
✓ Branch 1 taken 5659038 times.
5729876 if (pcmf) {
608 70838 no_p[0] = get_pcm(s, x - 1, y);
609 70838 no_p[1] = get_pcm(s, x - 1, y + (4 * v));
610 70838 no_q[0] = get_pcm(s, x, y);
611 70838 no_q[1] = get_pcm(s, x, y + (4 * v));
612 70838 s->hevcdsp.hevc_v_loop_filter_chroma_c(src,
613 70838 s->frame->linesize[chroma],
614 c_tc, no_p, no_q);
615 } else
616 5659038 s->hevcdsp.hevc_v_loop_filter_chroma(src,
617 5659038 s->frame->linesize[chroma],
618 c_tc, no_p, no_q);
619 }
620 }
621
622
2/2
✓ Branch 0 taken 236832 times.
✓ Branch 1 taken 10302128 times.
10538960 if(!y)
623 236832 continue;
624
625 // horizontal filtering chroma
626
2/2
✓ Branch 0 taken 9780268 times.
✓ Branch 1 taken 521860 times.
10302128 tc_offset = x0 ? left_tc_offset : cur_tc_offset;
627 10302128 x_end2 = x_end;
628
2/2
✓ Branch 0 taken 9780276 times.
✓ Branch 1 taken 521852 times.
10302128 if (x_end != s->ps.sps->width)
629 9780276 x_end2 = x_end - 8 * h;
630
4/4
✓ Branch 0 taken 9780268 times.
✓ Branch 1 taken 521860 times.
✓ Branch 2 taken 40265278 times.
✓ Branch 3 taken 10302128 times.
50567406 for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
631 40265278 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
632 40265278 const int bs1 = s->horizontal_bs[((x + 4 * h) + y * s->bs_width) >> 2];
633
4/4
✓ Branch 0 taken 34962528 times.
✓ Branch 1 taken 5302750 times.
✓ Branch 2 taken 133824 times.
✓ Branch 3 taken 34828704 times.
40265278 if ((bs0 == 2) || (bs1 == 2)) {
634
2/2
✓ Branch 0 taken 5302750 times.
✓ Branch 1 taken 133824 times.
5436574 const int qp0 = bs0 == 2 ? (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1 : 0;
635
2/2
✓ Branch 0 taken 5301180 times.
✓ Branch 1 taken 135394 times.
5436574 const int qp1 = bs1 == 2 ? (get_qPy(s, x + (4 * h), y - 1) + get_qPy(s, x + (4 * h), y) + 1) >> 1 : 0;
636
637
2/2
✓ Branch 0 taken 5302750 times.
✓ Branch 1 taken 133824 times.
5436574 c_tc[0] = bs0 == 2 ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
638
2/2
✓ Branch 0 taken 5301180 times.
✓ Branch 1 taken 135394 times.
5436574 c_tc[1] = bs1 == 2 ? chroma_tc(s, qp1, chroma, cur_tc_offset) : 0;
639 5436574 src = &s->frame->data[chroma][(y >> s->ps.sps->vshift[1]) * s->frame->linesize[chroma] + ((x >> s->ps.sps->hshift[1]) << s->ps.sps->pixel_shift)];
640
2/2
✓ Branch 0 taken 69722 times.
✓ Branch 1 taken 5366852 times.
5436574 if (pcmf) {
641 69722 no_p[0] = get_pcm(s, x, y - 1);
642 69722 no_p[1] = get_pcm(s, x + (4 * h), y - 1);
643 69722 no_q[0] = get_pcm(s, x, y);
644 69722 no_q[1] = get_pcm(s, x + (4 * h), y);
645 69722 s->hevcdsp.hevc_h_loop_filter_chroma_c(src,
646 69722 s->frame->linesize[chroma],
647 c_tc, no_p, no_q);
648 } else
649 5366852 s->hevcdsp.hevc_h_loop_filter_chroma(src,
650 5366852 s->frame->linesize[chroma],
651 c_tc, no_p, no_q);
652 }
653 }
654 }
655 }
656 }
657 1402422 }
658
659 226846373 static int boundary_strength(const HEVCContext *s, const MvField *curr, const MvField *neigh,
660 const RefPicList *neigh_refPicList)
661 {
662
4/4
✓ Branch 0 taken 144855024 times.
✓ Branch 1 taken 81991349 times.
✓ Branch 2 taken 140524332 times.
✓ Branch 3 taken 4330692 times.
226846373 if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) {
663 // same L0 and L1
664
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]] &&
665
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]] &&
666
2/2
✓ Branch 0 taken 18187439 times.
✓ Branch 1 taken 138453 times.
18325892 neigh_refPicList[0].list[neigh->ref_idx[0]] == neigh_refPicList[1].list[neigh->ref_idx[1]]) {
667
4/4
✓ Branch 0 taken 17897806 times.
✓ Branch 1 taken 289633 times.
✓ Branch 2 taken 17826743 times.
✓ Branch 3 taken 71063 times.
18187439 if ((FFABS(neigh->mv[0].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[0].y) >= 4 ||
668
4/4
✓ Branch 0 taken 17767568 times.
✓ Branch 1 taken 59175 times.
✓ Branch 2 taken 13332 times.
✓ Branch 3 taken 17754236 times.
17826743 FFABS(neigh->mv[1].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[1].y) >= 4) &&
669
4/4
✓ Branch 0 taken 180411 times.
✓ Branch 1 taken 252792 times.
✓ Branch 2 taken 119748 times.
✓ Branch 3 taken 60663 times.
433203 (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 ||
670
4/4
✓ Branch 0 taken 45021 times.
✓ Branch 1 taken 74727 times.
✓ Branch 2 taken 22061 times.
✓ Branch 3 taken 22960 times.
119748 FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4))
671 410243 return 1;
672 else
673 17777196 return 0;
674
2/2
✓ Branch 0 taken 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]] &&
675
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]]) {
676
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 ||
677
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)
678 5082715 return 1;
679 else
680 114979686 return 0;
681
2/2
✓ Branch 0 taken 704498 times.
✓ Branch 1 taken 1569994 times.
2274492 } else if (neigh_refPicList[1].list[neigh->ref_idx[1]] == s->ref->refPicList[0].list[curr->ref_idx[0]] &&
682
2/2
✓ Branch 0 taken 151937 times.
✓ Branch 1 taken 552561 times.
704498 neigh_refPicList[0].list[neigh->ref_idx[0]] == s->ref->refPicList[1].list[curr->ref_idx[1]]) {
683
4/4
✓ Branch 0 taken 100560 times.
✓ Branch 1 taken 51377 times.
✓ Branch 2 taken 88008 times.
✓ Branch 3 taken 12552 times.
151937 if (FFABS(neigh->mv[1].x - curr->mv[0].x) >= 4 || FFABS(neigh->mv[1].y - curr->mv[0].y) >= 4 ||
684
4/4
✓ Branch 0 taken 80010 times.
✓ Branch 1 taken 7998 times.
✓ Branch 2 taken 2920 times.
✓ Branch 3 taken 77090 times.
88008 FFABS(neigh->mv[0].x - curr->mv[1].x) >= 4 || FFABS(neigh->mv[0].y - curr->mv[1].y) >= 4)
685 74847 return 1;
686 else
687 77090 return 0;
688 } else {
689 2122555 return 1;
690 }
691
4/4
✓ Branch 0 taken 81991349 times.
✓ Branch 1 taken 4330692 times.
✓ Branch 2 taken 77684682 times.
✓ Branch 3 taken 4306667 times.
86322041 } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV
692 Mv A, B;
693 int ref_A, ref_B;
694
695
2/2
✓ Branch 0 taken 66286249 times.
✓ Branch 1 taken 11398433 times.
77684682 if (curr->pred_flag & 1) {
696 66286249 A = curr->mv[0];
697 66286249 ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]];
698 } else {
699 11398433 A = curr->mv[1];
700 11398433 ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]];
701 }
702
703
2/2
✓ Branch 0 taken 66301188 times.
✓ Branch 1 taken 11383494 times.
77684682 if (neigh->pred_flag & 1) {
704 66301188 B = neigh->mv[0];
705 66301188 ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]];
706 } else {
707 11383494 B = neigh->mv[1];
708 11383494 ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]];
709 }
710
711
2/2
✓ Branch 0 taken 74006917 times.
✓ Branch 1 taken 3677765 times.
77684682 if (ref_A == ref_B) {
712
4/4
✓ Branch 0 taken 72149393 times.
✓ Branch 1 taken 1857524 times.
✓ Branch 2 taken 622813 times.
✓ Branch 3 taken 71526580 times.
74006917 if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4)
713 2480337 return 1;
714 else
715 71526580 return 0;
716 } else
717 3677765 return 1;
718 }
719
720 8637359 return 1;
721 }
722
723 19715312 void ff_hevc_deblocking_boundary_strengths(HEVCLocalContext *lc, int x0, int y0,
724 int log2_trafo_size)
725 {
726 19715312 const HEVCContext *s = lc->parent;
727 19715312 const MvField *tab_mvf = s->ref->tab_mvf;
728 19715312 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
729 19715312 int log2_min_tu_size = s->ps.sps->log2_min_tb_size;
730 19715312 int min_pu_width = s->ps.sps->min_pu_width;
731 19715312 int min_tu_width = s->ps.sps->min_tb_width;
732 19715312 int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
733 19715312 (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
734 int boundary_upper, boundary_left;
735 int i, j, bs;
736
737
4/4
✓ Branch 0 taken 19418577 times.
✓ Branch 1 taken 296735 times.
✓ Branch 2 taken 15288015 times.
✓ Branch 3 taken 4130562 times.
19715312 boundary_upper = y0 > 0 && !(y0 & 7);
738
2/2
✓ Branch 0 taken 15288015 times.
✓ Branch 1 taken 4427297 times.
19715312 if (boundary_upper &&
739
2/2
✓ Branch 0 taken 1999846 times.
✓ Branch 1 taken 13288169 times.
15288015 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
740
2/2
✓ Branch 0 taken 501429 times.
✓ Branch 1 taken 1498417 times.
1999846 lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
741
2/2
✓ Branch 0 taken 440329 times.
✓ Branch 1 taken 61100 times.
501429 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
742
2/2
✓ Branch 0 taken 429711 times.
✓ Branch 1 taken 14797204 times.
15226915 (!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
743
2/2
✓ Branch 0 taken 114253 times.
✓ Branch 1 taken 315458 times.
429711 lc->boundary_flags & BOUNDARY_UPPER_TILE &&
744
2/2
✓ Branch 0 taken 19889 times.
✓ Branch 1 taken 94364 times.
114253 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
745 80989 boundary_upper = 0;
746
747
2/2
✓ Branch 0 taken 15207026 times.
✓ Branch 1 taken 4508286 times.
19715312 if (boundary_upper) {
748 30414052 const RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ?
749
2/2
✓ Branch 0 taken 2096646 times.
✓ Branch 1 taken 13110380 times.
15207026 ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) :
750 13110380 s->ref->refPicList;
751 15207026 int yp_pu = (y0 - 1) >> log2_min_pu_size;
752 15207026 int yq_pu = y0 >> log2_min_pu_size;
753 15207026 int yp_tu = (y0 - 1) >> log2_min_tu_size;
754 15207026 int yq_tu = y0 >> log2_min_tu_size;
755
756
2/2
✓ Branch 0 taken 47576490 times.
✓ Branch 1 taken 15207026 times.
62783516 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
757 47576490 int x_pu = (x0 + i) >> log2_min_pu_size;
758 47576490 int x_tu = (x0 + i) >> log2_min_tu_size;
759 47576490 const MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
760 47576490 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
761 47576490 uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu];
762 47576490 uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
763
764
4/4
✓ Branch 0 taken 34834570 times.
✓ Branch 1 taken 12741920 times.
✓ Branch 2 taken 1217490 times.
✓ Branch 3 taken 33617080 times.
47576490 if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA)
765 13959410 bs = 2;
766
4/4
✓ Branch 0 taken 26784587 times.
✓ Branch 1 taken 6832493 times.
✓ Branch 2 taken 2731257 times.
✓ Branch 3 taken 24053330 times.
33617080 else if (curr_cbf_luma || top_cbf_luma)
767 9563750 bs = 1;
768 else
769 24053330 bs = boundary_strength(s, curr, top, rpl_top);
770 47576490 s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs;
771 }
772 }
773
774 // bs for vertical TU boundaries
775
4/4
✓ Branch 0 taken 19517489 times.
✓ Branch 1 taken 197823 times.
✓ Branch 2 taken 15386927 times.
✓ Branch 3 taken 4130562 times.
19715312 boundary_left = x0 > 0 && !(x0 & 7);
776
2/2
✓ Branch 0 taken 15386927 times.
✓ Branch 1 taken 4328385 times.
19715312 if (boundary_left &&
777
2/2
✓ Branch 0 taken 2020355 times.
✓ Branch 1 taken 13366572 times.
15386927 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
778
2/2
✓ Branch 0 taken 68545 times.
✓ Branch 1 taken 1951810 times.
2020355 lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
779
2/2
✓ Branch 0 taken 59894 times.
✓ Branch 1 taken 8651 times.
68545 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
780
2/2
✓ Branch 0 taken 441443 times.
✓ Branch 1 taken 14936833 times.
15378276 (!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
781
2/2
✓ Branch 0 taken 59900 times.
✓ Branch 1 taken 381543 times.
441443 lc->boundary_flags & BOUNDARY_LEFT_TILE &&
782
2/2
✓ Branch 0 taken 13608 times.
✓ Branch 1 taken 46292 times.
59900 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
783 22259 boundary_left = 0;
784
785
2/2
✓ Branch 0 taken 15364668 times.
✓ Branch 1 taken 4350644 times.
19715312 if (boundary_left) {
786 30729336 const RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ?
787
2/2
✓ Branch 0 taken 245895 times.
✓ Branch 1 taken 15118773 times.
15364668 ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) :
788 15118773 s->ref->refPicList;
789 15364668 int xp_pu = (x0 - 1) >> log2_min_pu_size;
790 15364668 int xq_pu = x0 >> log2_min_pu_size;
791 15364668 int xp_tu = (x0 - 1) >> log2_min_tu_size;
792 15364668 int xq_tu = x0 >> log2_min_tu_size;
793
794
2/2
✓ Branch 0 taken 48530360 times.
✓ Branch 1 taken 15364668 times.
63895028 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
795 48530360 int y_pu = (y0 + i) >> log2_min_pu_size;
796 48530360 int y_tu = (y0 + i) >> log2_min_tu_size;
797 48530360 const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
798 48530360 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
799 48530360 uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
800 48530360 uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
801
802
4/4
✓ Branch 0 taken 35711544 times.
✓ Branch 1 taken 12818816 times.
✓ Branch 2 taken 1349466 times.
✓ Branch 3 taken 34362078 times.
48530360 if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA)
803 14168282 bs = 2;
804
4/4
✓ Branch 0 taken 27467420 times.
✓ Branch 1 taken 6894658 times.
✓ Branch 2 taken 2762489 times.
✓ Branch 3 taken 24704931 times.
34362078 else if (curr_cbf_luma || left_cbf_luma)
805 9657147 bs = 1;
806 else
807 24704931 bs = boundary_strength(s, curr, left, rpl_left);
808 48530360 s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs;
809 }
810 }
811
812
4/4
✓ Branch 0 taken 10145891 times.
✓ Branch 1 taken 9569421 times.
✓ Branch 2 taken 7313148 times.
✓ Branch 3 taken 2832743 times.
19715312 if (log2_trafo_size > log2_min_pu_size && !is_intra) {
813 7313148 const RefPicList *rpl = s->ref->refPicList;
814
815 // bs for TU internal horizontal PU boundaries
816
2/2
✓ Branch 0 taken 9463452 times.
✓ Branch 1 taken 7313148 times.
16776600 for (j = 8; j < (1 << log2_trafo_size); j += 8) {
817 9463452 int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
818 9463452 int yq_pu = (y0 + j) >> log2_min_pu_size;
819
820
2/2
✓ Branch 0 taken 89044056 times.
✓ Branch 1 taken 9463452 times.
98507508 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
821 89044056 int x_pu = (x0 + i) >> log2_min_pu_size;
822 89044056 const MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
823 89044056 const MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
824
825 89044056 bs = boundary_strength(s, curr, top, rpl);
826 89044056 s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
827 }
828 }
829
830 // bs for TU internal vertical PU boundaries
831
2/2
✓ Branch 0 taken 33553200 times.
✓ Branch 1 taken 7313148 times.
40866348 for (j = 0; j < (1 << log2_trafo_size); j += 4) {
832 33553200 int y_pu = (y0 + j) >> log2_min_pu_size;
833
834
2/2
✓ Branch 0 taken 89044056 times.
✓ Branch 1 taken 33553200 times.
122597256 for (i = 8; i < (1 << log2_trafo_size); i += 8) {
835 89044056 int xp_pu = (x0 + i - 1) >> log2_min_pu_size;
836 89044056 int xq_pu = (x0 + i) >> log2_min_pu_size;
837 89044056 const MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
838 89044056 const MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
839
840 89044056 bs = boundary_strength(s, curr, left, rpl);
841 89044056 s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
842 }
843 }
844 }
845 19715312 }
846
847 #undef LUMA
848 #undef CB
849 #undef CR
850
851 1404462 void ff_hevc_hls_filter(HEVCLocalContext *lc, int x, int y, int ctb_size)
852 {
853 1404462 const HEVCContext *const s = lc->parent;
854 1404462 int x_end = x >= s->ps.sps->width - ctb_size;
855 1404462 int skip = 0;
856
1/2
✓ Branch 0 taken 1404462 times.
✗ Branch 1 not taken.
1404462 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
857
5/6
✓ Branch 0 taken 3060 times.
✓ Branch 1 taken 1401402 times.
✓ Branch 2 taken 2040 times.
✓ Branch 3 taken 1020 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2040 times.
1404462 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
858
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1401402 times.
1402422 (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
859
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type != HEVC_SLICE_I) ||
860
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1401402 times.
1402422 (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
861
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type == HEVC_SLICE_B) ||
862
3/4
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1401402 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1020 times.
1403442 (s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
863 1020 ff_hevc_nal_is_nonref(s->nal_unit_type)))
864 2040 skip = 1;
865
866
2/2
✓ Branch 0 taken 1402422 times.
✓ Branch 1 taken 2040 times.
1404462 if (!skip)
867 1402422 deblocking_filter_CTB(s, x, y);
868
4/4
✓ Branch 0 taken 1187472 times.
✓ Branch 1 taken 216990 times.
✓ Branch 2 taken 1185432 times.
✓ Branch 3 taken 2040 times.
2589894 if (s->ps.sps->sao_enabled && !skip) {
869 1185432 int y_end = y >= s->ps.sps->height - ctb_size;
870
4/4
✓ Branch 0 taken 1082401 times.
✓ Branch 1 taken 103031 times.
✓ Branch 2 taken 1027268 times.
✓ Branch 3 taken 55133 times.
1185432 if (y && x)
871 1027268 sao_filter_CTB(lc, s, x - ctb_size, y - ctb_size);
872
4/4
✓ Branch 0 taken 1121611 times.
✓ Branch 1 taken 63821 times.
✓ Branch 2 taken 94314 times.
✓ Branch 3 taken 1027297 times.
1185432 if (x && y_end)
873 94314 sao_filter_CTB(lc, s, x - ctb_size, y);
874
4/4
✓ Branch 0 taken 1082401 times.
✓ Branch 1 taken 103031 times.
✓ Branch 2 taken 55132 times.
✓ Branch 3 taken 1027269 times.
1185432 if (y && x_end) {
875 55132 sao_filter_CTB(lc, s, x, y - ctb_size);
876
2/2
✓ Branch 0 taken 497 times.
✓ Branch 1 taken 54635 times.
55132 if (s->threads_type & FF_THREAD_FRAME )
877 497 ff_thread_report_progress(&s->ref->tf, y, 0);
878 }
879
4/4
✓ Branch 0 taken 63820 times.
✓ Branch 1 taken 1121612 times.
✓ Branch 2 taken 8687 times.
✓ Branch 3 taken 55133 times.
1185432 if (x_end && y_end) {
880 8687 sao_filter_CTB(lc, s, x , y);
881
2/2
✓ Branch 0 taken 31 times.
✓ Branch 1 taken 8656 times.
8687 if (s->threads_type & FF_THREAD_FRAME )
882 31 ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0);
883 }
884
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 219030 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
219030 } else if (s->threads_type & FF_THREAD_FRAME && x_end)
885 ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0);
886 1404462 }
887
888 1404493 void ff_hevc_hls_filters(HEVCLocalContext *lc, int x_ctb, int y_ctb, int ctb_size)
889 {
890 1404493 int x_end = x_ctb >= lc->parent->ps.sps->width - ctb_size;
891 1404493 int y_end = y_ctb >= lc->parent->ps.sps->height - ctb_size;
892
4/4
✓ Branch 0 taken 1285945 times.
✓ Branch 1 taken 118548 times.
✓ Branch 2 taken 1222570 times.
✓ Branch 3 taken 63375 times.
1404493 if (y_ctb && x_ctb)
893 1222570 ff_hevc_hls_filter(lc, x_ctb - ctb_size, y_ctb - ctb_size, ctb_size);
894
4/4
✓ Branch 0 taken 1285945 times.
✓ Branch 1 taken 118548 times.
✓ Branch 2 taken 63374 times.
✓ Branch 3 taken 1222571 times.
1404493 if (y_ctb && x_end)
895 63374 ff_hevc_hls_filter(lc, x_ctb, y_ctb - ctb_size, ctb_size);
896
4/4
✓ Branch 0 taken 1331626 times.
✓ Branch 1 taken 72867 times.
✓ Branch 2 taken 109027 times.
✓ Branch 3 taken 1222599 times.
1404493 if (x_ctb && y_end)
897 109027 ff_hevc_hls_filter(lc, x_ctb - ctb_size, y_ctb, ctb_size);
898 1404493 }
899