FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/hevc_filter.c
Date: 2022-01-23 21:51:25
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 "hevcdec.h"
29
30 #define LUMA 0
31 #define CB 1
32 #define CR 2
33
34 static const uint8_t tctable[54] = {
35 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, // QP 0...18
36 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, // QP 19...37
37 5, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24 // QP 38...53
38 };
39
40 static const uint8_t betatable[52] = {
41 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, // QP 0...18
42 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, // QP 19...37
43 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64 // QP 38...51
44 };
45
46 21488892 static int chroma_tc(HEVCContext *s, int qp_y, int c_idx, int tc_offset)
47 {
48 static const int qp_c[] = {
49 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37
50 };
51 int qp, qp_i, offset, idxt;
52
53 // slice qp offset is not used for deblocking
54
2/2
✓ Branch 0 taken 10744446 times.
✓ Branch 1 taken 10744446 times.
21488892 if (c_idx == 1)
55 10744446 offset = s->ps.pps->cb_qp_offset;
56 else
57 10744446 offset = s->ps.pps->cr_qp_offset;
58
59 21488892 qp_i = av_clip(qp_y + offset, 0, 57);
60
2/2
✓ Branch 0 taken 18009164 times.
✓ Branch 1 taken 3479728 times.
21488892 if (s->ps.sps->chroma_format_idc == 1) {
61
2/2
✓ Branch 0 taken 2677555 times.
✓ Branch 1 taken 15331609 times.
18009164 if (qp_i < 30)
62 2677555 qp = qp_i;
63
2/2
✓ Branch 0 taken 153221 times.
✓ Branch 1 taken 15178388 times.
15331609 else if (qp_i > 43)
64 153221 qp = qp_i - 6;
65 else
66 15178388 qp = qp_c[qp_i - 30];
67 } else {
68 3479728 qp = av_clip(qp_i, 0, 51);
69 }
70
71 21488892 idxt = av_clip(qp + DEFAULT_INTRA_TC_OFFSET + tc_offset, 0, 53);
72 21488892 return tctable[idxt];
73 }
74
75 1333400 static int get_qPy_pred(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
76 {
77 1333400 HEVCLocalContext *lc = s->HEVClc;
78 1333400 int ctb_size_mask = (1 << s->ps.sps->log2_ctb_size) - 1;
79 1333400 int MinCuQpDeltaSizeMask = (1 << (s->ps.sps->log2_ctb_size -
80 1333400 s->ps.pps->diff_cu_qp_delta_depth)) - 1;
81 1333400 int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
82 1333400 int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
83 1333400 int min_cb_width = s->ps.sps->min_cb_width;
84 1333400 int x_cb = xQgBase >> s->ps.sps->log2_min_cb_size;
85 1333400 int y_cb = yQgBase >> s->ps.sps->log2_min_cb_size;
86
2/2
✓ Branch 0 taken 913888 times.
✓ Branch 1 taken 419512 times.
2247288 int availableA = (xBase & ctb_size_mask) &&
87
2/2
✓ Branch 0 taken 777394 times.
✓ Branch 1 taken 136494 times.
913888 (xQgBase & ctb_size_mask);
88
2/2
✓ Branch 0 taken 895677 times.
✓ Branch 1 taken 437723 times.
2229077 int availableB = (yBase & ctb_size_mask) &&
89
2/2
✓ Branch 0 taken 774507 times.
✓ Branch 1 taken 121170 times.
895677 (yQgBase & ctb_size_mask);
90 int qPy_pred, qPy_a, qPy_b;
91
92 // qPy_pred
93
5/6
✓ Branch 0 taken 1260324 times.
✓ Branch 1 taken 73076 times.
✓ Branch 2 taken 18266 times.
✓ Branch 3 taken 1242058 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18266 times.
1333400 if (lc->first_qp_group || (!xQgBase && !yQgBase)) {
94 73076 lc->first_qp_group = !lc->tu.is_cu_qp_delta_coded;
95 73076 qPy_pred = s->sh.slice_qp;
96 } else {
97 1260324 qPy_pred = lc->qPy_pred;
98 }
99
100 // qPy_a
101
2/2
✓ Branch 0 taken 556006 times.
✓ Branch 1 taken 777394 times.
1333400 if (availableA == 0)
102 556006 qPy_a = qPy_pred;
103 else
104 777394 qPy_a = s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width];
105
106 // qPy_b
107
2/2
✓ Branch 0 taken 558893 times.
✓ Branch 1 taken 774507 times.
1333400 if (availableB == 0)
108 558893 qPy_b = qPy_pred;
109 else
110 774507 qPy_b = s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
111
112 av_assert2(qPy_a >= -s->ps.sps->qp_bd_offset && qPy_a < 52);
113 av_assert2(qPy_b >= -s->ps.sps->qp_bd_offset && qPy_b < 52);
114
115 1333400 return (qPy_a + qPy_b + 1) >> 1;
116 }
117
118 1333400 void ff_hevc_set_qPy(HEVCContext *s, int xBase, int yBase, int log2_cb_size)
119 {
120 1333400 int qp_y = get_qPy_pred(s, xBase, yBase, log2_cb_size);
121
122
2/2
✓ Branch 0 taken 368173 times.
✓ Branch 1 taken 965227 times.
1333400 if (s->HEVClc->tu.cu_qp_delta != 0) {
123 368173 int off = s->ps.sps->qp_bd_offset;
124
1/2
✓ Branch 0 taken 368173 times.
✗ Branch 1 not taken.
368173 s->HEVClc->qp_y = FFUMOD(qp_y + s->HEVClc->tu.cu_qp_delta + 52 + 2 * off,
125 368173 52 + off) - off;
126 } else
127 965227 s->HEVClc->qp_y = qp_y;
128 1333400 }
129
130 113190418 static int get_qPy(HEVCContext *s, int xC, int yC)
131 {
132 113190418 int log2_min_cb_size = s->ps.sps->log2_min_cb_size;
133 113190418 int x = xC >> log2_min_cb_size;
134 113190418 int y = yC >> log2_min_cb_size;
135 113190418 return s->qp_y_tab[x + y * s->ps.sps->min_cb_width];
136 }
137
138 375226 static void copy_CTB(uint8_t *dst, const uint8_t *src, int width, int height,
139 ptrdiff_t stride_dst, ptrdiff_t stride_src)
140 {
141 int i, j;
142
143
2/2
✓ Branch 0 taken 55075 times.
✓ Branch 1 taken 320151 times.
375226 if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) {
144
2/2
✓ Branch 0 taken 2390496 times.
✓ Branch 1 taken 55075 times.
2445571 for (i = 0; i < height; i++) {
145
2/2
✓ Branch 0 taken 19127280 times.
✓ Branch 1 taken 2390496 times.
21517776 for (j = 0; j < width; j+=8)
146 19127280 AV_COPY64U(dst+j, src+j);
147 2390496 dst += stride_dst;
148 2390496 src += stride_src;
149 }
150 } else {
151
2/2
✓ Branch 0 taken 16899504 times.
✓ Branch 1 taken 320151 times.
17219655 for (i = 0; i < height; i++) {
152
2/2
✓ Branch 0 taken 86048600 times.
✓ Branch 1 taken 16899504 times.
102948104 for (j = 0; j < width; j+=16)
153 86048600 AV_COPY128(dst+j, src+j);
154 16899504 dst += stride_dst;
155 16899504 src += stride_src;
156 }
157 }
158 375226 }
159
160 1321226 static void copy_pixel(uint8_t *dst, const uint8_t *src, int pixel_shift)
161 {
162
2/2
✓ Branch 0 taken 220774 times.
✓ Branch 1 taken 1100452 times.
1321226 if (pixel_shift)
163 220774 *(uint16_t *)dst = *(uint16_t *)src;
164 else
165 1100452 *dst = *src;
166 1321226 }
167
168 1274494 static void copy_vert(uint8_t *dst, const uint8_t *src,
169 int pixel_shift, int height,
170 ptrdiff_t stride_dst, ptrdiff_t stride_src)
171 {
172 int i;
173
2/2
✓ Branch 0 taken 1095282 times.
✓ Branch 1 taken 179212 times.
1274494 if (pixel_shift == 0) {
174
2/2
✓ Branch 0 taken 51668768 times.
✓ Branch 1 taken 1095282 times.
52764050 for (i = 0; i < height; i++) {
175 51668768 *dst = *src;
176 51668768 dst += stride_dst;
177 51668768 src += stride_src;
178 }
179 } else {
180
2/2
✓ Branch 0 taken 11166192 times.
✓ Branch 1 taken 179212 times.
11345404 for (i = 0; i < height; i++) {
181 11166192 *(uint16_t *)dst = *(uint16_t *)src;
182 11166192 dst += stride_dst;
183 11166192 src += stride_src;
184 }
185 }
186 1274494 }
187
188 485500 static void copy_CTB_to_hv(HEVCContext *s, const uint8_t *src,
189 ptrdiff_t stride_src, int x, int y, int width, int height,
190 int c_idx, int x_ctb, int y_ctb)
191 {
192 485500 int sh = s->ps.sps->pixel_shift;
193 485500 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
194 485500 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
195
196 /* copy horizontal edges */
197 485500 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) * w + x) << sh),
198 485500 src, width << sh);
199 485500 memcpy(s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) * w + x) << sh),
200 485500 src + stride_src * (height - 1), width << sh);
201
202 /* copy vertical edges */
203 485500 copy_vert(s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) * h + y) << sh), src, sh, height, 1 << sh, stride_src);
204
205 485500 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);
206 485500 }
207
208 375226 static void restore_tqb_pixels(HEVCContext *s,
209 uint8_t *src1, const uint8_t *dst1,
210 ptrdiff_t stride_src, ptrdiff_t stride_dst,
211 int x0, int y0, int width, int height, int c_idx)
212 {
213
2/2
✓ Branch 0 taken 370937 times.
✓ Branch 1 taken 4289 times.
375226 if ( s->ps.pps->transquant_bypass_enable_flag ||
214
3/4
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 370833 times.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
370937 (s->ps.sps->pcm.loop_filter_disable_flag && s->ps.sps->pcm_enabled_flag)) {
215 int x, y;
216 4393 int min_pu_size = 1 << s->ps.sps->log2_min_pu_size;
217 4393 int hshift = s->ps.sps->hshift[c_idx];
218 4393 int vshift = s->ps.sps->vshift[c_idx];
219 4393 int x_min = ((x0 ) >> s->ps.sps->log2_min_pu_size);
220 4393 int y_min = ((y0 ) >> s->ps.sps->log2_min_pu_size);
221 4393 int x_max = ((x0 + width ) >> s->ps.sps->log2_min_pu_size);
222 4393 int y_max = ((y0 + height) >> s->ps.sps->log2_min_pu_size);
223 4393 int len = (min_pu_size >> hshift) << s->ps.sps->pixel_shift;
224
2/2
✓ Branch 0 taken 49472 times.
✓ Branch 1 taken 4393 times.
53865 for (y = y_min; y < y_max; y++) {
225
2/2
✓ Branch 0 taken 632704 times.
✓ Branch 1 taken 49472 times.
682176 for (x = x_min; x < x_max; x++) {
226
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]) {
227 int n;
228 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);
229 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);
230
2/2
✓ Branch 0 taken 704 times.
✓ Branch 1 taken 264 times.
968 for (n = 0; n < (min_pu_size >> vshift); n++) {
231 704 memcpy(src, dst, len);
232 704 src += stride_src;
233 704 dst += stride_dst;
234 }
235 }
236 }
237 }
238 }
239 375226 }
240
241 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
242
243 1180553 static void sao_filter_CTB(HEVCContext *s, int x, int y)
244 {
245 static const uint8_t sao_tab[8] = { 0, 1, 2, 2, 3, 3, 4, 4 };
246 1180553 HEVCLocalContext *lc = s->HEVClc;
247 int c_idx;
248 int edges[4]; // 0 left 1 top 2 right 3 bottom
249 1180553 int x_ctb = x >> s->ps.sps->log2_ctb_size;
250 1180553 int y_ctb = y >> s->ps.sps->log2_ctb_size;
251 1180553 int ctb_addr_rs = y_ctb * s->ps.sps->ctb_width + x_ctb;
252 1180553 int ctb_addr_ts = s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
253 1180553 SAOParams *sao = &CTB(s->sao, x_ctb, y_ctb);
254 // flags indicating unfilterable edges
255 1180553 uint8_t vert_edge[] = { 0, 0 };
256 1180553 uint8_t horiz_edge[] = { 0, 0 };
257 1180553 uint8_t diag_edge[] = { 0, 0, 0, 0 };
258 1180553 uint8_t lfase = CTB(s->filter_slice_edges, x_ctb, y_ctb);
259
2/2
✓ Branch 0 taken 170200 times.
✓ Branch 1 taken 1010353 times.
1350753 uint8_t no_tile_filter = s->ps.pps->tiles_enabled_flag &&
260
2/2
✓ Branch 0 taken 16664 times.
✓ Branch 1 taken 153536 times.
170200 !s->ps.pps->loop_filter_across_tiles_enabled_flag;
261
4/4
✓ Branch 0 taken 1163889 times.
✓ Branch 1 taken 16664 times.
✓ Branch 2 taken 51490 times.
✓ Branch 3 taken 1112399 times.
1180553 uint8_t restore = no_tile_filter || !lfase;
262 1180553 uint8_t left_tile_edge = 0;
263 1180553 uint8_t right_tile_edge = 0;
264 1180553 uint8_t up_tile_edge = 0;
265 1180553 uint8_t bottom_tile_edge = 0;
266
267 1180553 edges[0] = x_ctb == 0;
268 1180553 edges[1] = y_ctb == 0;
269 1180553 edges[2] = x_ctb == s->ps.sps->ctb_width - 1;
270 1180553 edges[3] = y_ctb == s->ps.sps->ctb_height - 1;
271
272
2/2
✓ Branch 0 taken 68154 times.
✓ Branch 1 taken 1112399 times.
1180553 if (restore) {
273
2/2
✓ Branch 0 taken 64585 times.
✓ Branch 1 taken 3569 times.
68154 if (!edges[0]) {
274
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]];
275
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;
276 }
277
2/2
✓ Branch 0 taken 64586 times.
✓ Branch 1 taken 3568 times.
68154 if (!edges[2]) {
278
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]];
279
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;
280 }
281
2/2
✓ Branch 0 taken 61940 times.
✓ Branch 1 taken 6214 times.
68154 if (!edges[1]) {
282
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]];
283
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;
284 }
285
2/2
✓ Branch 0 taken 61970 times.
✓ Branch 1 taken 6184 times.
68154 if (!edges[3]) {
286
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]];
287
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;
288 }
289
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]) {
290
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;
291 }
292
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]) {
293
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;
294 }
295
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]) {
296
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;
297 }
298
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]) {
299
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;
300 }
301 }
302
303
4/4
✓ Branch 0 taken 4722020 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 3541563 times.
✓ Branch 3 taken 1180553 times.
4722116 for (c_idx = 0; c_idx < (s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
304 3541563 int x0 = x >> s->ps.sps->hshift[c_idx];
305 3541563 int y0 = y >> s->ps.sps->vshift[c_idx];
306 3541563 ptrdiff_t stride_src = s->frame->linesize[c_idx];
307 3541563 int ctb_size_h = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->hshift[c_idx];
308 3541563 int ctb_size_v = (1 << (s->ps.sps->log2_ctb_size)) >> s->ps.sps->vshift[c_idx];
309 3541563 int width = FFMIN(ctb_size_h, (s->ps.sps->width >> s->ps.sps->hshift[c_idx]) - x0);
310 3541563 int height = FFMIN(ctb_size_v, (s->ps.sps->height >> s->ps.sps->vshift[c_idx]) - y0);
311 3541563 int tab = sao_tab[(FFALIGN(width, 8) >> 3) - 1];
312 3541563 uint8_t *src = &s->frame->data[c_idx][y0 * stride_src + (x0 << s->ps.sps->pixel_shift)];
313 ptrdiff_t stride_dst;
314 uint8_t *dst;
315
316
3/3
✓ Branch 0 taken 111043 times.
✓ Branch 1 taken 374457 times.
✓ Branch 2 taken 3056063 times.
3541563 switch (sao->type_idx[c_idx]) {
317 111043 case SAO_BAND:
318 111043 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
319 x_ctb, y_ctb);
320
2/2
✓ Branch 0 taken 110282 times.
✓ Branch 1 taken 761 times.
111043 if (s->ps.pps->transquant_bypass_enable_flag ||
321
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)) {
322 769 dst = lc->edge_emu_buffer;
323 769 stride_dst = 2*MAX_PB_SIZE;
324 769 copy_CTB(dst, src, width << s->ps.sps->pixel_shift, height, stride_dst, stride_src);
325 769 s->hevcdsp.sao_band_filter[tab](src, dst, stride_src, stride_dst,
326 769 sao->offset_val[c_idx], sao->band_position[c_idx],
327 width, height);
328 769 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
329 x, y, width, height, c_idx);
330 } else {
331 110274 s->hevcdsp.sao_band_filter[tab](src, src, stride_src, stride_src,
332 110274 sao->offset_val[c_idx], sao->band_position[c_idx],
333 width, height);
334 }
335 111043 sao->type_idx[c_idx] = SAO_APPLIED;
336 111043 break;
337 374457 case SAO_EDGE:
338 {
339 374457 int w = s->ps.sps->width >> s->ps.sps->hshift[c_idx];
340 374457 int h = s->ps.sps->height >> s->ps.sps->vshift[c_idx];
341 374457 int left_edge = edges[0];
342 374457 int top_edge = edges[1];
343 374457 int right_edge = edges[2];
344 374457 int bottom_edge = edges[3];
345 374457 int sh = s->ps.sps->pixel_shift;
346 int left_pixels, right_pixels;
347
348 374457 stride_dst = 2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE;
349 374457 dst = lc->edge_emu_buffer + stride_dst + AV_INPUT_BUFFER_PADDING_SIZE;
350
351
2/2
✓ Branch 0 taken 348730 times.
✓ Branch 1 taken 25727 times.
374457 if (!top_edge) {
352 348730 int left = 1 - left_edge;
353 348730 int right = 1 - right_edge;
354 const uint8_t *src1[2];
355 uint8_t *dst1;
356 int src_idx, pos;
357
358 348730 dst1 = dst - stride_dst - (left << sh);
359 348730 src1[0] = src - stride_src - (left << sh);
360 348730 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) * w + x0 - left) << sh);
361 348730 pos = 0;
362
2/2
✓ Branch 0 taken 332269 times.
✓ Branch 1 taken 16461 times.
348730 if (left) {
363 332269 src_idx = (CTB(s->sao, x_ctb-1, y_ctb-1).type_idx[c_idx] ==
364 SAO_APPLIED);
365 332269 copy_pixel(dst1, src1[src_idx], sh);
366 332269 pos += (1 << sh);
367 }
368 348730 src_idx = (CTB(s->sao, x_ctb, y_ctb-1).type_idx[c_idx] ==
369 SAO_APPLIED);
370 348730 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
371
2/2
✓ Branch 0 taken 331847 times.
✓ Branch 1 taken 16883 times.
348730 if (right) {
372 331847 pos += width << sh;
373 331847 src_idx = (CTB(s->sao, x_ctb+1, y_ctb-1).type_idx[c_idx] ==
374 SAO_APPLIED);
375 331847 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
376 }
377 }
378
2/2
✓ Branch 0 taken 344824 times.
✓ Branch 1 taken 29633 times.
374457 if (!bottom_edge) {
379 344824 int left = 1 - left_edge;
380 344824 int right = 1 - right_edge;
381 const uint8_t *src1[2];
382 uint8_t *dst1;
383 int src_idx, pos;
384
385 344824 dst1 = dst + height * stride_dst - (left << sh);
386 344824 src1[0] = src + height * stride_src - (left << sh);
387 344824 src1[1] = s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) * w + x0 - left) << sh);
388 344824 pos = 0;
389
2/2
✓ Branch 0 taken 328935 times.
✓ Branch 1 taken 15889 times.
344824 if (left) {
390 328935 src_idx = (CTB(s->sao, x_ctb-1, y_ctb+1).type_idx[c_idx] ==
391 SAO_APPLIED);
392 328935 copy_pixel(dst1, src1[src_idx], sh);
393 328935 pos += (1 << sh);
394 }
395 344824 src_idx = (CTB(s->sao, x_ctb, y_ctb+1).type_idx[c_idx] ==
396 SAO_APPLIED);
397 344824 memcpy(dst1 + pos, src1[src_idx] + pos, width << sh);
398
2/2
✓ Branch 0 taken 328175 times.
✓ Branch 1 taken 16649 times.
344824 if (right) {
399 328175 pos += width << sh;
400 328175 src_idx = (CTB(s->sao, x_ctb+1, y_ctb+1).type_idx[c_idx] ==
401 SAO_APPLIED);
402 328175 copy_pixel(dst1 + pos, src1[src_idx] + pos, sh);
403 }
404 }
405 374457 left_pixels = 0;
406
2/2
✓ Branch 0 taken 356003 times.
✓ Branch 1 taken 18454 times.
374457 if (!left_edge) {
407
2/2
✓ Branch 0 taken 303494 times.
✓ Branch 1 taken 52509 times.
356003 if (CTB(s->sao, x_ctb-1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
408 303494 copy_vert(dst - (1 << sh),
409 303494 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) * h + y0) << sh),
410 303494 sh, height, stride_dst, 1 << sh);
411 } else {
412 52509 left_pixels = 1;
413 }
414 }
415 374457 right_pixels = 0;
416
2/2
✓ Branch 0 taken 355462 times.
✓ Branch 1 taken 18995 times.
374457 if (!right_edge) {
417
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 355462 times.
355462 if (CTB(s->sao, x_ctb+1, y_ctb).type_idx[c_idx] == SAO_APPLIED) {
418 copy_vert(dst + (width << sh),
419 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) * h + y0) << sh),
420 sh, height, stride_dst, 1 << sh);
421 } else {
422 355462 right_pixels = 1;
423 }
424 }
425
426 374457 copy_CTB(dst - (left_pixels << sh),
427 374457 src - (left_pixels << sh),
428 374457 (width + left_pixels + right_pixels) << sh,
429 height, stride_dst, stride_src);
430
431 374457 copy_CTB_to_hv(s, src, stride_src, x0, y0, width, height, c_idx,
432 x_ctb, y_ctb);
433 374457 s->hevcdsp.sao_edge_filter[tab](src, dst, stride_src, sao->offset_val[c_idx],
434 sao->eo_class[c_idx], width, height);
435 374457 s->hevcdsp.sao_edge_restore[restore](src, dst,
436 stride_src, stride_dst,
437 sao,
438 edges, width,
439 height, c_idx,
440 vert_edge,
441 horiz_edge,
442 diag_edge);
443 374457 restore_tqb_pixels(s, src, dst, stride_src, stride_dst,
444 x, y, width, height, c_idx);
445 374457 sao->type_idx[c_idx] = SAO_APPLIED;
446 374457 break;
447 }
448 }
449 }
450 1180553 }
451
452 2057768 static int get_pcm(HEVCContext *s, int x, int y)
453 {
454 2057768 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
455 int x_pu, y_pu;
456
457
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)
458 return 2;
459
460 2057768 x_pu = x >> log2_min_pu_size;
461 2057768 y_pu = y >> log2_min_pu_size;
462
463
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)
464 1408 return 2;
465 2056360 return s->is_pcm[y_pu * s->ps.sps->min_pu_width + x_pu];
466 }
467
468 #define TC_CALC(qp, bs) \
469 tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + \
470 (tc_offset & -2), \
471 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
472
473 1397574 static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
474 {
475 uint8_t *src;
476 int x, y;
477 int chroma, beta;
478 int32_t c_tc[2], tc[2];
479 1397574 uint8_t no_p[2] = { 0 };
480 1397574 uint8_t no_q[2] = { 0 };
481
482 1397574 int log2_ctb_size = s->ps.sps->log2_ctb_size;
483 int x_end, x_end2, y_end;
484 1397574 int ctb_size = 1 << log2_ctb_size;
485 1397574 int ctb = (x0 >> log2_ctb_size) +
486 1397574 (y0 >> log2_ctb_size) * s->ps.sps->ctb_width;
487 1397574 int cur_tc_offset = s->deblock[ctb].tc_offset;
488 1397574 int cur_beta_offset = s->deblock[ctb].beta_offset;
489 int left_tc_offset, left_beta_offset;
490 int tc_offset, beta_offset;
491 2882529 int pcmf = (s->ps.sps->pcm_enabled_flag &&
492
4/4
✓ Branch 0 taken 87381 times.
✓ Branch 1 taken 1310193 times.
✓ Branch 2 taken 87325 times.
✓ Branch 3 taken 56 times.
2795092 s->ps.sps->pcm.loop_filter_disable_flag) ||
493
2/2
✓ Branch 0 taken 4570 times.
✓ Branch 1 taken 1392948 times.
1397518 s->ps.pps->transquant_bypass_enable_flag;
494
495
2/2
✓ Branch 0 taken 1324892 times.
✓ Branch 1 taken 72682 times.
1397574 if (x0) {
496 1324892 left_tc_offset = s->deblock[ctb - 1].tc_offset;
497 1324892 left_beta_offset = s->deblock[ctb - 1].beta_offset;
498 } else {
499 72682 left_tc_offset = 0;
500 72682 left_beta_offset = 0;
501 }
502
503 1397574 x_end = x0 + ctb_size;
504
2/2
✓ Branch 0 taken 25296 times.
✓ Branch 1 taken 1372278 times.
1397574 if (x_end > s->ps.sps->width)
505 25296 x_end = s->ps.sps->width;
506 1397574 y_end = y0 + ctb_size;
507
2/2
✓ Branch 0 taken 95497 times.
✓ Branch 1 taken 1302077 times.
1397574 if (y_end > s->ps.sps->height)
508 95497 y_end = s->ps.sps->height;
509
510 1397574 tc_offset = cur_tc_offset;
511 1397574 beta_offset = cur_beta_offset;
512
513 1397574 x_end2 = x_end;
514
2/2
✓ Branch 0 taken 1324893 times.
✓ Branch 1 taken 72681 times.
1397574 if (x_end2 != s->ps.sps->width)
515 1324893 x_end2 -= 8;
516
2/2
✓ Branch 0 taken 10027608 times.
✓ Branch 1 taken 1397574 times.
11425182 for (y = y0; y < y_end; y += 8) {
517 // vertical filtering luma
518
4/4
✓ Branch 0 taken 9500965 times.
✓ Branch 1 taken 526643 times.
✓ Branch 2 taken 76128737 times.
✓ Branch 3 taken 10027608 times.
86156345 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
519 76128737 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
520 76128737 const int bs1 = s->vertical_bs[(x + (y + 4) * s->bs_width) >> 2];
521
4/4
✓ Branch 0 taken 58961555 times.
✓ Branch 1 taken 17167182 times.
✓ Branch 2 taken 89322 times.
✓ Branch 3 taken 58872233 times.
76128737 if (bs0 || bs1) {
522 17256504 const int qp = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
523
524 17256504 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
525
526
2/2
✓ Branch 0 taken 17167182 times.
✓ Branch 1 taken 89322 times.
17256504 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
527
2/2
✓ Branch 0 taken 17160513 times.
✓ Branch 1 taken 95991 times.
17256504 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
528 17256504 src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
529
2/2
✓ Branch 0 taken 186079 times.
✓ Branch 1 taken 17070425 times.
17256504 if (pcmf) {
530 186079 no_p[0] = get_pcm(s, x - 1, y);
531 186079 no_p[1] = get_pcm(s, x - 1, y + 4);
532 186079 no_q[0] = get_pcm(s, x, y);
533 186079 no_q[1] = get_pcm(s, x, y + 4);
534 186079 s->hevcdsp.hevc_v_loop_filter_luma_c(src,
535 186079 s->frame->linesize[LUMA],
536 beta, tc, no_p, no_q);
537 } else
538 17070425 s->hevcdsp.hevc_v_loop_filter_luma(src,
539 17070425 s->frame->linesize[LUMA],
540 beta, tc, no_p, no_q);
541 }
542 }
543
544
2/2
✓ Branch 0 taken 118244 times.
✓ Branch 1 taken 9909364 times.
10027608 if(!y)
545 118244 continue;
546
547 // horizontal filtering luma
548
4/4
✓ Branch 0 taken 9392203 times.
✓ Branch 1 taken 517161 times.
✓ Branch 2 taken 75789199 times.
✓ Branch 3 taken 9909364 times.
85698563 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
549 75789199 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
550 75789199 const int bs1 = s->horizontal_bs[((x + 4) + y * s->bs_width) >> 2];
551
4/4
✓ Branch 0 taken 58306446 times.
✓ Branch 1 taken 17482753 times.
✓ Branch 2 taken 105984 times.
✓ Branch 3 taken 58200462 times.
75789199 if (bs0 || bs1) {
552 17588737 const int qp = (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1;
553
554
2/2
✓ Branch 0 taken 15390971 times.
✓ Branch 1 taken 2197766 times.
17588737 tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
555
2/2
✓ Branch 0 taken 15390971 times.
✓ Branch 1 taken 2197766 times.
17588737 beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
556
557 17588737 beta = betatable[av_clip(qp + beta_offset, 0, MAX_QP)];
558
2/2
✓ Branch 0 taken 17482753 times.
✓ Branch 1 taken 105984 times.
17588737 tc[0] = bs0 ? TC_CALC(qp, bs0) : 0;
559
2/2
✓ Branch 0 taken 17468043 times.
✓ Branch 1 taken 120694 times.
17588737 tc[1] = bs1 ? TC_CALC(qp, bs1) : 0;
560 17588737 src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->ps.sps->pixel_shift)];
561
2/2
✓ Branch 0 taken 187803 times.
✓ Branch 1 taken 17400934 times.
17588737 if (pcmf) {
562 187803 no_p[0] = get_pcm(s, x, y - 1);
563 187803 no_p[1] = get_pcm(s, x + 4, y - 1);
564 187803 no_q[0] = get_pcm(s, x, y);
565 187803 no_q[1] = get_pcm(s, x + 4, y);
566 187803 s->hevcdsp.hevc_h_loop_filter_luma_c(src,
567 187803 s->frame->linesize[LUMA],
568 beta, tc, no_p, no_q);
569 } else
570 17400934 s->hevcdsp.hevc_h_loop_filter_luma(src,
571 17400934 s->frame->linesize[LUMA],
572 beta, tc, no_p, no_q);
573 }
574 }
575 }
576
577
2/2
✓ Branch 0 taken 1397526 times.
✓ Branch 1 taken 48 times.
1397574 if (s->ps.sps->chroma_format_idc) {
578
2/2
✓ Branch 0 taken 2795052 times.
✓ Branch 1 taken 1397526 times.
4192578 for (chroma = 1; chroma <= 2; chroma++) {
579 2795052 int h = 1 << s->ps.sps->hshift[chroma];
580 2795052 int v = 1 << s->ps.sps->vshift[chroma];
581
582 // vertical filtering chroma
583
2/2
✓ Branch 0 taken 10500416 times.
✓ Branch 1 taken 2795052 times.
13295468 for (y = y0; y < y_end; y += (8 * v)) {
584
4/4
✓ Branch 0 taken 539908 times.
✓ Branch 1 taken 9960508 times.
✓ Branch 2 taken 40445434 times.
✓ Branch 3 taken 10500416 times.
50945850 for (x = x0 ? x0 : 8 * h; x < x_end; x += (8 * h)) {
585 40445434 const int bs0 = s->vertical_bs[(x + y * s->bs_width) >> 2];
586 40445434 const int bs1 = s->vertical_bs[(x + (y + (4 * v)) * s->bs_width) >> 2];
587
588
4/4
✓ Branch 0 taken 34922594 times.
✓ Branch 1 taken 5522840 times.
✓ Branch 2 taken 128404 times.
✓ Branch 3 taken 34794190 times.
40445434 if ((bs0 == 2) || (bs1 == 2)) {
589 5651244 const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
590 5651244 const int qp1 = (get_qPy(s, x - 1, y + (4 * v)) + get_qPy(s, x, y + (4 * v)) + 1) >> 1;
591
592
2/2
✓ Branch 0 taken 5522840 times.
✓ Branch 1 taken 128404 times.
5651244 c_tc[0] = (bs0 == 2) ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
593
2/2
✓ Branch 0 taken 5518572 times.
✓ Branch 1 taken 132672 times.
5651244 c_tc[1] = (bs1 == 2) ? chroma_tc(s, qp1, chroma, tc_offset) : 0;
594 5651244 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)];
595
2/2
✓ Branch 0 taken 70838 times.
✓ Branch 1 taken 5580406 times.
5651244 if (pcmf) {
596 70838 no_p[0] = get_pcm(s, x - 1, y);
597 70838 no_p[1] = get_pcm(s, x - 1, y + (4 * v));
598 70838 no_q[0] = get_pcm(s, x, y);
599 70838 no_q[1] = get_pcm(s, x, y + (4 * v));
600 70838 s->hevcdsp.hevc_v_loop_filter_chroma_c(src,
601 70838 s->frame->linesize[chroma],
602 c_tc, no_p, no_q);
603 } else
604 5580406 s->hevcdsp.hevc_v_loop_filter_chroma(src,
605 5580406 s->frame->linesize[chroma],
606 c_tc, no_p, no_q);
607 }
608 }
609
610
2/2
✓ Branch 0 taken 236464 times.
✓ Branch 1 taken 10263952 times.
10500416 if(!y)
611 236464 continue;
612
613 // horizontal filtering chroma
614
2/2
✓ Branch 0 taken 9743004 times.
✓ Branch 1 taken 520948 times.
10263952 tc_offset = x0 ? left_tc_offset : cur_tc_offset;
615 10263952 x_end2 = x_end;
616
2/2
✓ Branch 0 taken 9743012 times.
✓ Branch 1 taken 520940 times.
10263952 if (x_end != s->ps.sps->width)
617 9743012 x_end2 = x_end - 8 * h;
618
4/4
✓ Branch 0 taken 9743004 times.
✓ Branch 1 taken 520948 times.
✓ Branch 2 taken 40112574 times.
✓ Branch 3 taken 10263952 times.
50376526 for (x = x0 ? x0 - 8 * h : 0; x < x_end2; x += (8 * h)) {
619 40112574 const int bs0 = s->horizontal_bs[( x + y * s->bs_width) >> 2];
620 40112574 const int bs1 = s->horizontal_bs[((x + 4 * h) + y * s->bs_width) >> 2];
621
4/4
✓ Branch 0 taken 34888038 times.
✓ Branch 1 taken 5224536 times.
✓ Branch 2 taken 133752 times.
✓ Branch 3 taken 34754286 times.
40112574 if ((bs0 == 2) || (bs1 == 2)) {
622
2/2
✓ Branch 0 taken 5224536 times.
✓ Branch 1 taken 133752 times.
5358288 const int qp0 = bs0 == 2 ? (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1 : 0;
623
2/2
✓ Branch 0 taken 5222944 times.
✓ Branch 1 taken 135344 times.
5358288 const int qp1 = bs1 == 2 ? (get_qPy(s, x + (4 * h), y - 1) + get_qPy(s, x + (4 * h), y) + 1) >> 1 : 0;
624
625
2/2
✓ Branch 0 taken 5224536 times.
✓ Branch 1 taken 133752 times.
5358288 c_tc[0] = bs0 == 2 ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
626
2/2
✓ Branch 0 taken 5222944 times.
✓ Branch 1 taken 135344 times.
5358288 c_tc[1] = bs1 == 2 ? chroma_tc(s, qp1, chroma, cur_tc_offset) : 0;
627 5358288 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)];
628
2/2
✓ Branch 0 taken 69722 times.
✓ Branch 1 taken 5288566 times.
5358288 if (pcmf) {
629 69722 no_p[0] = get_pcm(s, x, y - 1);
630 69722 no_p[1] = get_pcm(s, x + (4 * h), y - 1);
631 69722 no_q[0] = get_pcm(s, x, y);
632 69722 no_q[1] = get_pcm(s, x + (4 * h), y);
633 69722 s->hevcdsp.hevc_h_loop_filter_chroma_c(src,
634 69722 s->frame->linesize[chroma],
635 c_tc, no_p, no_q);
636 } else
637 5288566 s->hevcdsp.hevc_h_loop_filter_chroma(src,
638 5288566 s->frame->linesize[chroma],
639 c_tc, no_p, no_q);
640 }
641 }
642 }
643 }
644 }
645 1397574 }
646
647 226767198 static int boundary_strength(HEVCContext *s, MvField *curr, MvField *neigh,
648 RefPicList *neigh_refPicList)
649 {
650
4/4
✓ Branch 0 taken 144855024 times.
✓ Branch 1 taken 81912174 times.
✓ Branch 2 taken 140524332 times.
✓ Branch 3 taken 4330692 times.
226767198 if (curr->pred_flag == PF_BI && neigh->pred_flag == PF_BI) {
651 // same L0 and L1
652
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]] &&
653
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]] &&
654
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]]) {
655
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 ||
656
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) &&
657
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 ||
658
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))
659 410243 return 1;
660 else
661 17777196 return 0;
662
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]] &&
663
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]]) {
664
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 ||
665
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)
666 5082715 return 1;
667 else
668 114979686 return 0;
669
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]] &&
670
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]]) {
671
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 ||
672
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)
673 74847 return 1;
674 else
675 77090 return 0;
676 } else {
677 2122555 return 1;
678 }
679
4/4
✓ Branch 0 taken 81912174 times.
✓ Branch 1 taken 4330692 times.
✓ Branch 2 taken 77605507 times.
✓ Branch 3 taken 4306667 times.
86242866 } else if ((curr->pred_flag != PF_BI) && (neigh->pred_flag != PF_BI)){ // 1 MV
680 Mv A, B;
681 int ref_A, ref_B;
682
683
2/2
✓ Branch 0 taken 66207074 times.
✓ Branch 1 taken 11398433 times.
77605507 if (curr->pred_flag & 1) {
684 66207074 A = curr->mv[0];
685 66207074 ref_A = s->ref->refPicList[0].list[curr->ref_idx[0]];
686 } else {
687 11398433 A = curr->mv[1];
688 11398433 ref_A = s->ref->refPicList[1].list[curr->ref_idx[1]];
689 }
690
691
2/2
✓ Branch 0 taken 66222013 times.
✓ Branch 1 taken 11383494 times.
77605507 if (neigh->pred_flag & 1) {
692 66222013 B = neigh->mv[0];
693 66222013 ref_B = neigh_refPicList[0].list[neigh->ref_idx[0]];
694 } else {
695 11383494 B = neigh->mv[1];
696 11383494 ref_B = neigh_refPicList[1].list[neigh->ref_idx[1]];
697 }
698
699
2/2
✓ Branch 0 taken 73930099 times.
✓ Branch 1 taken 3675408 times.
77605507 if (ref_A == ref_B) {
700
4/4
✓ Branch 0 taken 72078188 times.
✓ Branch 1 taken 1851911 times.
✓ Branch 2 taken 622011 times.
✓ Branch 3 taken 71456177 times.
73930099 if (FFABS(A.x - B.x) >= 4 || FFABS(A.y - B.y) >= 4)
701 2473922 return 1;
702 else
703 71456177 return 0;
704 } else
705 3675408 return 1;
706 }
707
708 8637359 return 1;
709 }
710
711 19643951 void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0,
712 int log2_trafo_size)
713 {
714 19643951 HEVCLocalContext *lc = s->HEVClc;
715 19643951 MvField *tab_mvf = s->ref->tab_mvf;
716 19643951 int log2_min_pu_size = s->ps.sps->log2_min_pu_size;
717 19643951 int log2_min_tu_size = s->ps.sps->log2_min_tb_size;
718 19643951 int min_pu_width = s->ps.sps->min_pu_width;
719 19643951 int min_tu_width = s->ps.sps->min_tb_width;
720 19643951 int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
721 19643951 (x0 >> log2_min_pu_size)].pred_flag == PF_INTRA;
722 int boundary_upper, boundary_left;
723 int i, j, bs;
724
725
4/4
✓ Branch 0 taken 19347738 times.
✓ Branch 1 taken 296213 times.
✓ Branch 2 taken 15237488 times.
✓ Branch 3 taken 4110250 times.
19643951 boundary_upper = y0 > 0 && !(y0 & 7);
726
2/2
✓ Branch 0 taken 15237488 times.
✓ Branch 1 taken 4406463 times.
19643951 if (boundary_upper &&
727
2/2
✓ Branch 0 taken 1999846 times.
✓ Branch 1 taken 13237642 times.
15237488 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
728
2/2
✓ Branch 0 taken 501429 times.
✓ Branch 1 taken 1498417 times.
1999846 lc->boundary_flags & BOUNDARY_UPPER_SLICE &&
729
2/2
✓ Branch 0 taken 440329 times.
✓ Branch 1 taken 61100 times.
501429 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
730
2/2
✓ Branch 0 taken 429711 times.
✓ Branch 1 taken 14746677 times.
15176388 (!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
731
2/2
✓ Branch 0 taken 114253 times.
✓ Branch 1 taken 315458 times.
429711 lc->boundary_flags & BOUNDARY_UPPER_TILE &&
732
2/2
✓ Branch 0 taken 19889 times.
✓ Branch 1 taken 94364 times.
114253 (y0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
733 80989 boundary_upper = 0;
734
735
2/2
✓ Branch 0 taken 15156499 times.
✓ Branch 1 taken 4487452 times.
19643951 if (boundary_upper) {
736 30312998 RefPicList *rpl_top = (lc->boundary_flags & BOUNDARY_UPPER_SLICE) ?
737
2/2
✓ Branch 0 taken 2094807 times.
✓ Branch 1 taken 13061692 times.
15156499 ff_hevc_get_ref_list(s, s->ref, x0, y0 - 1) :
738 13061692 s->ref->refPicList;
739 15156499 int yp_pu = (y0 - 1) >> log2_min_pu_size;
740 15156499 int yq_pu = y0 >> log2_min_pu_size;
741 15156499 int yp_tu = (y0 - 1) >> log2_min_tu_size;
742 15156499 int yq_tu = y0 >> log2_min_tu_size;
743
744
2/2
✓ Branch 0 taken 47388798 times.
✓ Branch 1 taken 15156499 times.
62545297 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
745 47388798 int x_pu = (x0 + i) >> log2_min_pu_size;
746 47388798 int x_tu = (x0 + i) >> log2_min_tu_size;
747 47388798 MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
748 47388798 MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
749 47388798 uint8_t top_cbf_luma = s->cbf_luma[yp_tu * min_tu_width + x_tu];
750 47388798 uint8_t curr_cbf_luma = s->cbf_luma[yq_tu * min_tu_width + x_tu];
751
752
4/4
✓ Branch 0 taken 34820640 times.
✓ Branch 1 taken 12568158 times.
✓ Branch 2 taken 1216688 times.
✓ Branch 3 taken 33603952 times.
47388798 if (curr->pred_flag == PF_INTRA || top->pred_flag == PF_INTRA)
753 13784846 bs = 2;
754
4/4
✓ Branch 0 taken 26773705 times.
✓ Branch 1 taken 6830247 times.
✓ Branch 2 taken 2729887 times.
✓ Branch 3 taken 24043818 times.
33603952 else if (curr_cbf_luma || top_cbf_luma)
755 9560134 bs = 1;
756 else
757 24043818 bs = boundary_strength(s, curr, top, rpl_top);
758 47388798 s->horizontal_bs[((x0 + i) + y0 * s->bs_width) >> 2] = bs;
759 }
760 }
761
762 // bs for vertical TU boundaries
763
4/4
✓ Branch 0 taken 19446485 times.
✓ Branch 1 taken 197466 times.
✓ Branch 2 taken 15336235 times.
✓ Branch 3 taken 4110250 times.
19643951 boundary_left = x0 > 0 && !(x0 & 7);
764
2/2
✓ Branch 0 taken 15336235 times.
✓ Branch 1 taken 4307716 times.
19643951 if (boundary_left &&
765
2/2
✓ Branch 0 taken 2020355 times.
✓ Branch 1 taken 13315880 times.
15336235 ((!s->sh.slice_loop_filter_across_slices_enabled_flag &&
766
2/2
✓ Branch 0 taken 68545 times.
✓ Branch 1 taken 1951810 times.
2020355 lc->boundary_flags & BOUNDARY_LEFT_SLICE &&
767
2/2
✓ Branch 0 taken 59894 times.
✓ Branch 1 taken 8651 times.
68545 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0) ||
768
2/2
✓ Branch 0 taken 441443 times.
✓ Branch 1 taken 14886141 times.
15327584 (!s->ps.pps->loop_filter_across_tiles_enabled_flag &&
769
2/2
✓ Branch 0 taken 59900 times.
✓ Branch 1 taken 381543 times.
441443 lc->boundary_flags & BOUNDARY_LEFT_TILE &&
770
2/2
✓ Branch 0 taken 13608 times.
✓ Branch 1 taken 46292 times.
59900 (x0 % (1 << s->ps.sps->log2_ctb_size)) == 0)))
771 22259 boundary_left = 0;
772
773
2/2
✓ Branch 0 taken 15313976 times.
✓ Branch 1 taken 4329975 times.
19643951 if (boundary_left) {
774 30627952 RefPicList *rpl_left = (lc->boundary_flags & BOUNDARY_LEFT_SLICE) ?
775
2/2
✓ Branch 0 taken 245685 times.
✓ Branch 1 taken 15068291 times.
15313976 ff_hevc_get_ref_list(s, s->ref, x0 - 1, y0) :
776 15068291 s->ref->refPicList;
777 15313976 int xp_pu = (x0 - 1) >> log2_min_pu_size;
778 15313976 int xq_pu = x0 >> log2_min_pu_size;
779 15313976 int xp_tu = (x0 - 1) >> log2_min_tu_size;
780 15313976 int xq_tu = x0 >> log2_min_tu_size;
781
782
2/2
✓ Branch 0 taken 48341572 times.
✓ Branch 1 taken 15313976 times.
63655548 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
783 48341572 int y_pu = (y0 + i) >> log2_min_pu_size;
784 48341572 int y_tu = (y0 + i) >> log2_min_tu_size;
785 48341572 MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
786 48341572 MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
787 48341572 uint8_t left_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xp_tu];
788 48341572 uint8_t curr_cbf_luma = s->cbf_luma[y_tu * min_tu_width + xq_tu];
789
790
4/4
✓ Branch 0 taken 35697452 times.
✓ Branch 1 taken 12644120 times.
✓ Branch 2 taken 1348922 times.
✓ Branch 3 taken 34348530 times.
48341572 if (curr->pred_flag == PF_INTRA || left->pred_flag == PF_INTRA)
791 13993042 bs = 2;
792
4/4
✓ Branch 0 taken 27456125 times.
✓ Branch 1 taken 6892405 times.
✓ Branch 2 taken 2761305 times.
✓ Branch 3 taken 24694820 times.
34348530 else if (curr_cbf_luma || left_cbf_luma)
793 9653710 bs = 1;
794 else
795 24694820 bs = boundary_strength(s, curr, left, rpl_left);
796 48341572 s->vertical_bs[(x0 + (y0 + i) * s->bs_width) >> 2] = bs;
797 }
798 }
799
800
4/4
✓ Branch 0 taken 10115154 times.
✓ Branch 1 taken 9528797 times.
✓ Branch 2 taken 7309963 times.
✓ Branch 3 taken 2805191 times.
19643951 if (log2_trafo_size > log2_min_pu_size && !is_intra) {
801 7309963 RefPicList *rpl = s->ref->refPicList;
802
803 // bs for TU internal horizontal PU boundaries
804
2/2
✓ Branch 0 taken 9460067 times.
✓ Branch 1 taken 7309963 times.
16770030 for (j = 8; j < (1 << log2_trafo_size); j += 8) {
805 9460067 int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
806 9460067 int yq_pu = (y0 + j) >> log2_min_pu_size;
807
808
2/2
✓ Branch 0 taken 89014280 times.
✓ Branch 1 taken 9460067 times.
98474347 for (i = 0; i < (1 << log2_trafo_size); i += 4) {
809 89014280 int x_pu = (x0 + i) >> log2_min_pu_size;
810 89014280 MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
811 89014280 MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
812
813 89014280 bs = boundary_strength(s, curr, top, rpl);
814 89014280 s->horizontal_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
815 }
816 }
817
818 // bs for TU internal vertical PU boundaries
819
2/2
✓ Branch 0 taken 33540060 times.
✓ Branch 1 taken 7309963 times.
40850023 for (j = 0; j < (1 << log2_trafo_size); j += 4) {
820 33540060 int y_pu = (y0 + j) >> log2_min_pu_size;
821
822
2/2
✓ Branch 0 taken 89014280 times.
✓ Branch 1 taken 33540060 times.
122554340 for (i = 8; i < (1 << log2_trafo_size); i += 8) {
823 89014280 int xp_pu = (x0 + i - 1) >> log2_min_pu_size;
824 89014280 int xq_pu = (x0 + i) >> log2_min_pu_size;
825 89014280 MvField *left = &tab_mvf[y_pu * min_pu_width + xp_pu];
826 89014280 MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
827
828 89014280 bs = boundary_strength(s, curr, left, rpl);
829 89014280 s->vertical_bs[((x0 + i) + (y0 + j) * s->bs_width) >> 2] = bs;
830 }
831 }
832 }
833 19643951 }
834
835 #undef LUMA
836 #undef CB
837 #undef CR
838
839 1399614 void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size)
840 {
841 1399614 int x_end = x >= s->ps.sps->width - ctb_size;
842 1399614 int skip = 0;
843
1/2
✓ Branch 0 taken 1399614 times.
✗ Branch 1 not taken.
1399614 if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
844
5/6
✓ Branch 0 taken 3060 times.
✓ Branch 1 taken 1396554 times.
✓ Branch 2 taken 2040 times.
✓ Branch 3 taken 1020 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2040 times.
1399614 (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) ||
845
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1396554 times.
1397574 (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA &&
846
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type != HEVC_SLICE_I) ||
847
2/2
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1396554 times.
1397574 (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR &&
848
1/2
✓ Branch 0 taken 1020 times.
✗ Branch 1 not taken.
1020 s->sh.slice_type == HEVC_SLICE_B) ||
849
3/4
✓ Branch 0 taken 1020 times.
✓ Branch 1 taken 1396554 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1020 times.
1398594 (s->avctx->skip_loop_filter >= AVDISCARD_NONREF &&
850 1020 ff_hevc_nal_is_nonref(s->nal_unit_type)))
851 2040 skip = 1;
852
853
2/2
✓ Branch 0 taken 1397574 times.
✓ Branch 1 taken 2040 times.
1399614 if (!skip)
854 1397574 deblocking_filter_CTB(s, x, y);
855
4/4
✓ Branch 0 taken 1182624 times.
✓ Branch 1 taken 216990 times.
✓ Branch 2 taken 1180584 times.
✓ Branch 3 taken 2040 times.
2580198 if (s->ps.sps->sao_enabled && !skip) {
856 1180584 int y_end = y >= s->ps.sps->height - ctb_size;
857
4/4
✓ Branch 0 taken 1077737 times.
✓ Branch 1 taken 102847 times.
✓ Branch 2 taken 1022714 times.
✓ Branch 3 taken 55023 times.
1180584 if (y && x)
858 1022714 sao_filter_CTB(s, x - ctb_size, y - ctb_size);
859
4/4
✓ Branch 0 taken 1116879 times.
✓ Branch 1 taken 63705 times.
✓ Branch 2 taken 94136 times.
✓ Branch 3 taken 1022743 times.
1180584 if (x && y_end)
860 94136 sao_filter_CTB(s, x - ctb_size, y);
861
4/4
✓ Branch 0 taken 1077737 times.
✓ Branch 1 taken 102847 times.
✓ Branch 2 taken 55022 times.
✓ Branch 3 taken 1022715 times.
1180584 if (y && x_end) {
862 55022 sao_filter_CTB(s, x, y - ctb_size);
863
2/2
✓ Branch 0 taken 497 times.
✓ Branch 1 taken 54525 times.
55022 if (s->threads_type & FF_THREAD_FRAME )
864 497 ff_thread_report_progress(&s->ref->tf, y, 0);
865 }
866
4/4
✓ Branch 0 taken 63704 times.
✓ Branch 1 taken 1116880 times.
✓ Branch 2 taken 8681 times.
✓ Branch 3 taken 55023 times.
1180584 if (x_end && y_end) {
867 8681 sao_filter_CTB(s, x , y);
868
2/2
✓ Branch 0 taken 31 times.
✓ Branch 1 taken 8650 times.
8681 if (s->threads_type & FF_THREAD_FRAME )
869 31 ff_thread_report_progress(&s->ref->tf, y + ctb_size, 0);
870 }
871
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)
872 ff_thread_report_progress(&s->ref->tf, y + ctb_size - 4, 0);
873 1399614 }
874
875 1399645 void ff_hevc_hls_filters(HEVCContext *s, int x_ctb, int y_ctb, int ctb_size)
876 {
877 1399645 int x_end = x_ctb >= s->ps.sps->width - ctb_size;
878 1399645 int y_end = y_ctb >= s->ps.sps->height - ctb_size;
879
4/4
✓ Branch 0 taken 1281281 times.
✓ Branch 1 taken 118364 times.
✓ Branch 2 taken 1218016 times.
✓ Branch 3 taken 63265 times.
1399645 if (y_ctb && x_ctb)
880 1218016 ff_hevc_hls_filter(s, x_ctb - ctb_size, y_ctb - ctb_size, ctb_size);
881
4/4
✓ Branch 0 taken 1281281 times.
✓ Branch 1 taken 118364 times.
✓ Branch 2 taken 63264 times.
✓ Branch 3 taken 1218017 times.
1399645 if (y_ctb && x_end)
882 63264 ff_hevc_hls_filter(s, x_ctb, y_ctb - ctb_size, ctb_size);
883
4/4
✓ Branch 0 taken 1326894 times.
✓ Branch 1 taken 72751 times.
✓ Branch 2 taken 108849 times.
✓ Branch 3 taken 1218045 times.
1399645 if (x_ctb && y_end)
884 108849 ff_hevc_hls_filter(s, x_ctb - ctb_size, y_ctb, ctb_size);
885 1399645 }
886