FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/cbs_h266_syntax_template.c
Date: 2025-03-08 20:38:41
Exec Total Coverage
Lines: 1722 2164 79.6%
Functions: 59 62 95.2%
Branches: 1744 3348 52.1%

Line Branch Exec Source
1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 19342 static int FUNC(rbsp_trailing_bits) (CodedBitstreamContext *ctx,
20 RWContext *rw)
21 {
22 int err;
23
24
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9671 times.
19342 fixed(1, rbsp_stop_one_bit, 1);
25
2/2
✓ Branch 1 taken 51311 times.
✓ Branch 2 taken 9671 times.
121964 while (byte_alignment(rw) != 0)
26
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 51311 times.
102622 fixed(1, rbsp_alignment_zero_bit, 0);
27 19342 return 0;
28 }
29
30 41672 static int FUNC(nal_unit_header) (CodedBitstreamContext *ctx, RWContext *rw,
31 H266RawNALUnitHeader *current,
32 int expected_nal_unit_type)
33 {
34 int err;
35
36
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 20836 times.
41672 fixed(1, forbidden_zero_bit, 0);
37
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 20836 times.
41672 flag(nuh_reserved_zero_bit);
38
39
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 20836 times.
41672 u(6, nuh_layer_id, 0, 55);
40
41
2/2
✓ Branch 0 taken 9671 times.
✓ Branch 1 taken 11165 times.
41672 if (expected_nal_unit_type >= 0)
42
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9671 times.
19342 u(5, nal_unit_type, expected_nal_unit_type, expected_nal_unit_type);
43 else
44
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11165 times.
22330 ub(5, nal_unit_type);
45
46
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 20836 times.
41672 u(3, nuh_temporal_id_plus1, 1, 7);
47 41672 return 0;
48 }
49
50 22330 static int FUNC(byte_alignment) (CodedBitstreamContext *ctx, RWContext *rw)
51 {
52 int err;
53
54
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11165 times.
22330 fixed(1, byte_alignment_bit_equal_to_one, 1);
55
2/2
✓ Branch 1 taken 32012 times.
✓ Branch 2 taken 11165 times.
86354 while (byte_alignment(rw) != 0)
56
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 32012 times.
64024 fixed(1, byte_alignment_bit_equal_to_zero, 0);
57 22330 return 0;
58 }
59
60 2554 static int FUNC(general_constraints_info) (CodedBitstreamContext *ctx,
61 RWContext *rw,
62 H266GeneralConstraintsInfo *current)
63 {
64 int err, i, num_additional_bits_used;
65
66
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1277 times.
2554 flag(gci_present_flag);
67
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1277 times.
2554 if (current->gci_present_flag) {
68 /* general */
69 flag(gci_intra_only_constraint_flag);
70 flag(gci_all_layers_independent_constraint_flag);
71 flag(gci_one_au_only_constraint_flag);
72
73 /* picture format */
74 u(4, gci_sixteen_minus_max_bitdepth_constraint_idc, 0, 8);
75 ub(2, gci_three_minus_max_chroma_format_constraint_idc);
76
77 /* NAL unit type related */
78 flag(gci_no_mixed_nalu_types_in_pic_constraint_flag);
79 flag(gci_no_trail_constraint_flag);
80 flag(gci_no_stsa_constraint_flag);
81 flag(gci_no_rasl_constraint_flag);
82 flag(gci_no_radl_constraint_flag);
83 flag(gci_no_idr_constraint_flag);
84 flag(gci_no_cra_constraint_flag);
85 flag(gci_no_gdr_constraint_flag);
86 flag(gci_no_aps_constraint_flag);
87 flag(gci_no_idr_rpl_constraint_flag);
88
89 /* tile, slice, subpicture partitioning */
90 flag(gci_one_tile_per_pic_constraint_flag);
91 flag(gci_pic_header_in_slice_header_constraint_flag);
92 flag(gci_one_slice_per_pic_constraint_flag);
93 flag(gci_no_rectangular_slice_constraint_flag);
94 flag(gci_one_slice_per_subpic_constraint_flag);
95 flag(gci_no_subpic_info_constraint_flag);
96
97 /* CTU and block partitioning */
98 ub(2, gci_three_minus_max_log2_ctu_size_constraint_idc);
99 flag(gci_no_partition_constraints_override_constraint_flag);
100 flag(gci_no_mtt_constraint_flag);
101 flag(gci_no_qtbtt_dual_tree_intra_constraint_flag);
102
103 /* intra */
104 flag(gci_no_palette_constraint_flag);
105 flag(gci_no_ibc_constraint_flag);
106 flag(gci_no_isp_constraint_flag);
107 flag(gci_no_mrl_constraint_flag);
108 flag(gci_no_mip_constraint_flag);
109 flag(gci_no_cclm_constraint_flag);
110
111 /* inter */
112 flag(gci_no_ref_pic_resampling_constraint_flag);
113 flag(gci_no_res_change_in_clvs_constraint_flag);
114 flag(gci_no_weighted_prediction_constraint_flag);
115 flag(gci_no_ref_wraparound_constraint_flag);
116 flag(gci_no_temporal_mvp_constraint_flag);
117 flag(gci_no_sbtmvp_constraint_flag);
118 flag(gci_no_amvr_constraint_flag);
119 flag(gci_no_bdof_constraint_flag);
120 flag(gci_no_smvd_constraint_flag);
121 flag(gci_no_dmvr_constraint_flag);
122 flag(gci_no_mmvd_constraint_flag);
123 flag(gci_no_affine_motion_constraint_flag);
124 flag(gci_no_prof_constraint_flag);
125 flag(gci_no_bcw_constraint_flag);
126 flag(gci_no_ciip_constraint_flag);
127 flag(gci_no_gpm_constraint_flag);
128
129 /* transform, quantization, residual */
130 flag(gci_no_luma_transform_size_64_constraint_flag);
131 flag(gci_no_transform_skip_constraint_flag);
132 flag(gci_no_bdpcm_constraint_flag);
133 flag(gci_no_mts_constraint_flag);
134 flag(gci_no_lfnst_constraint_flag);
135 flag(gci_no_joint_cbcr_constraint_flag);
136 flag(gci_no_sbt_constraint_flag);
137 flag(gci_no_act_constraint_flag);
138 flag(gci_no_explicit_scaling_list_constraint_flag);
139 flag(gci_no_dep_quant_constraint_flag);
140 flag(gci_no_sign_data_hiding_constraint_flag);
141 flag(gci_no_cu_qp_delta_constraint_flag);
142 flag(gci_no_chroma_qp_offset_constraint_flag);
143
144 /* loop filter */
145 flag(gci_no_sao_constraint_flag);
146 flag(gci_no_alf_constraint_flag);
147 flag(gci_no_ccalf_constraint_flag);
148 flag(gci_no_lmcs_constraint_flag);
149 flag(gci_no_ladf_constraint_flag);
150 flag(gci_no_virtual_boundaries_constraint_flag);
151 ub(8, gci_num_additional_bits);
152 if (current->gci_num_additional_bits > 5) {
153 flag(gci_all_rap_pictures_constraint_flag);
154 flag(gci_no_extended_precision_processing_constraint_flag);
155 flag(gci_no_ts_residual_coding_rice_constraint_flag);
156 flag(gci_no_rrc_rice_extension_constraint_flag);
157 flag(gci_no_persistent_rice_adaptation_constraint_flag);
158 flag(gci_no_reverse_last_sig_coeff_constraint_flag);
159 num_additional_bits_used = 6;
160 } else {
161 infer(gci_all_rap_pictures_constraint_flag, 0);
162 infer(gci_no_extended_precision_processing_constraint_flag, 0);
163 infer(gci_no_ts_residual_coding_rice_constraint_flag, 0);
164 infer(gci_no_rrc_rice_extension_constraint_flag, 0);
165 infer(gci_no_persistent_rice_adaptation_constraint_flag, 0);
166 infer(gci_no_reverse_last_sig_coeff_constraint_flag, 0);
167 num_additional_bits_used = 0;
168 }
169
170 for (i = 0; i < current->gci_num_additional_bits - num_additional_bits_used; i++)
171 flags(gci_reserved_bit[i], 1, i);
172 }
173
2/2
✓ Branch 1 taken 6385 times.
✓ Branch 2 taken 1277 times.
15324 while (byte_alignment(rw) != 0)
174
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6385 times.
12770 fixed(1, gci_alignment_zero_bit, 0);
175 2554 return 0;
176 }
177
178 2606 static int FUNC(profile_tier_level) (CodedBitstreamContext *ctx,
179 RWContext *rw,
180 H266RawProfileTierLevel *current,
181 int profile_tier_present_flag,
182 int max_num_sub_layers_minus1)
183 {
184 int err, i;
185
186
2/2
✓ Branch 0 taken 1277 times.
✓ Branch 1 taken 26 times.
2606 if (profile_tier_present_flag) {
187
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1277 times.
2554 ub(7, general_profile_idc);
188
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1277 times.
2554 flag(general_tier_flag);
189 }
190
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ub(8, general_level_idc);
191
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(ptl_frame_only_constraint_flag);
192
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(ptl_multilayer_enabled_flag);
193
2/2
✓ Branch 0 taken 1277 times.
✓ Branch 1 taken 26 times.
2606 if (profile_tier_present_flag) {
194
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1277 times.
2554 CHECK(FUNC(general_constraints_info) (ctx, rw,
195 &current->
196 general_constraints_info));
197 }
198
2/2
✓ Branch 0 taken 1555 times.
✓ Branch 1 taken 1303 times.
5716 for (i = max_num_sub_layers_minus1 - 1; i >= 0; i--)
199
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1555 times.
3110 flags(ptl_sublayer_level_present_flag[i], 1, i);
200
2/2
✓ Branch 1 taken 1457 times.
✓ Branch 2 taken 1303 times.
5520 while (byte_alignment(rw) != 0)
201
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1457 times.
2914 flag(ptl_reserved_zero_bit);
202
2/2
✓ Branch 0 taken 1555 times.
✓ Branch 1 taken 1303 times.
5716 for (i = max_num_sub_layers_minus1 - 1; i >= 0; i--)
203
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1555 times.
3110 if (current->ptl_sublayer_level_present_flag[i])
204 ubs(8, sublayer_level_idc[i], 1, i);
205
2/2
✓ Branch 0 taken 1277 times.
✓ Branch 1 taken 26 times.
2606 if (profile_tier_present_flag) {
206
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1277 times.
2554 ub(8, ptl_num_sub_profiles);
207
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1277 times.
2554 for (i = 0; i < current->ptl_num_sub_profiles; i++)
208 ubs(32, general_sub_profile_idc[i], 1, i);
209 }
210 2606 return 0;
211 }
212
213 2440 static int FUNC(vui_parameters_default) (CodedBitstreamContext *ctx,
214 RWContext *rw, H266RawVUI *current)
215 {
216 //defined in D.8
217
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_progressive_source_flag, 0);
218
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_interlaced_source_flag, 0);
219
220
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_non_packed_constraint_flag, 0);
221
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_non_projected_constraint_flag, 0);
222
223
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_aspect_ratio_constant_flag, 0);
224
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_aspect_ratio_idc, 0);
225
226
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_overscan_info_present_flag, 0);
227
228
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_colour_primaries, 2);
229
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_transfer_characteristics, 2);
230
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_matrix_coeffs, 2);
231
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_full_range_flag, 0);
232
233
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_chroma_sample_loc_type_frame, 6);
234
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_chroma_sample_loc_type_top_field, 6);
235
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2440 infer(vui_chroma_sample_loc_type_bottom_field, 6);
236 2440 return 0;
237 }
238
239 52 static int FUNC(vui_parameters) (CodedBitstreamContext *ctx, RWContext *rw,
240 H266RawVUI *current,
241 uint8_t chroma_format_idc)
242 {
243 int err;
244
245
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vui_progressive_source_flag);
246
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vui_interlaced_source_flag);
247
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vui_non_packed_constraint_flag);
248
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vui_non_projected_constraint_flag);
249
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vui_aspect_ratio_info_present_flag);
250
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vui_aspect_ratio_info_present_flag) {
251 flag(vui_aspect_ratio_constant_flag);
252 ub(8, vui_aspect_ratio_idc);
253 if (current->vui_aspect_ratio_idc == 255) {
254 ub(16, vui_sar_width);
255 ub(16, vui_sar_height);
256 }
257 } else {
258
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_aspect_ratio_constant_flag, 0);
259
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_aspect_ratio_idc, 0);
260 }
261
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vui_overscan_info_present_flag);
262
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vui_overscan_info_present_flag)
263 flag(vui_overscan_appropriate_flag);
264
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vui_colour_description_present_flag);
265
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vui_colour_description_present_flag) {
266 ub(8, vui_colour_primaries);
267 av_log(ctx->log_ctx, AV_LOG_DEBUG, "vui_colour_primaries == %d \n",
268 current->vui_colour_primaries);
269 ub(8, vui_transfer_characteristics);
270 av_log(ctx->log_ctx, AV_LOG_DEBUG,
271 "vui_transfer_characteristics == %d \n",
272 current->vui_transfer_characteristics);
273 ub(8, vui_matrix_coeffs);
274 av_log(ctx->log_ctx, AV_LOG_DEBUG, "vui_matrix_coeffs == %d \n",
275 current->vui_matrix_coeffs);
276 flag(vui_full_range_flag);
277 } else {
278
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_colour_primaries, 2);
279
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_transfer_characteristics, 2);
280
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_matrix_coeffs, 2);
281
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_full_range_flag, 0);
282 }
283
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vui_chroma_loc_info_present_flag);
284
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
52 if (chroma_format_idc != 1 && current->vui_chroma_loc_info_present_flag) {
285 av_log(ctx->log_ctx, AV_LOG_ERROR, "chroma_format_idc == %d,"
286 "vui_chroma_loc_info_present_flag can't not be true",
287 chroma_format_idc);
288 return AVERROR_INVALIDDATA;
289 }
290
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vui_chroma_loc_info_present_flag) {
291 if (current->vui_progressive_source_flag &&
292 !current->vui_interlaced_source_flag) {
293 ue(vui_chroma_sample_loc_type_frame, 0, 6);
294 } else {
295 ue(vui_chroma_sample_loc_type_top_field, 0, 6);
296 ue(vui_chroma_sample_loc_type_bottom_field, 0, 6);
297 }
298 } else {
299
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (chroma_format_idc == 1) {
300
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_chroma_sample_loc_type_frame, 6);
301
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_chroma_sample_loc_type_top_field,
302 current->vui_chroma_sample_loc_type_frame);
303
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(vui_chroma_sample_loc_type_bottom_field,
304 current->vui_chroma_sample_loc_type_frame);
305 }
306 }
307 52 return 0;
308 }
309
310 18 static int FUNC(payload_extension) (CodedBitstreamContext *ctx, RWContext *rw,
311 H266RawExtensionData *current,
312 uint32_t payload_size, int cur_pos)
313 {
314 int err;
315 size_t byte_length, k;
316
317 #ifdef READ
318 GetBitContext tmp;
319 int bits_left, payload_zero_bits;
320
321
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
18 if (!cbs_h265_payload_extension_present(rw, payload_size, cur_pos))
322 return 0;
323
324 18 bits_left = 8 * payload_size - cur_pos;
325 18 tmp = *rw;
326
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
18 if (bits_left > 8)
327 skip_bits_long(&tmp, bits_left - 8);
328 18 payload_zero_bits = get_bits(&tmp, FFMIN(bits_left, 8));
329
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
18 if (!payload_zero_bits)
330 return AVERROR_INVALIDDATA;
331 18 payload_zero_bits = ff_ctz(payload_zero_bits);
332 18 current->bit_length = bits_left - payload_zero_bits - 1;
333
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
18 allocate(current->data, (current->bit_length + 7) / 8);
334 #endif
335
336 18 byte_length = (current->bit_length + 7) / 8;
337
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
18 for (k = 0; k < byte_length; k++) {
338 int length = FFMIN(current->bit_length - k * 8, 8);
339 xu(length, reserved_payload_extension_data, current->data[k],
340 0, MAX_UINT_BITS(length), 0);
341 }
342
343 18 return 0;
344 }
345
346 52 static int FUNC(vui_payload) (CodedBitstreamContext *ctx, RWContext *rw,
347 H266RawVUI *current, uint16_t vui_payload_size,
348 uint8_t chroma_format_idc)
349 {
350 int err;
351 int start_position, current_position;
352
353 52 start_position = bit_position(rw);
354
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 CHECK(FUNC(vui_parameters) (ctx, rw, current, chroma_format_idc));
355 52 current_position = bit_position(rw) - start_position;
356
357
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 17 times.
52 if (current_position < 8 * vui_payload_size) {
358
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
18 CHECK(FUNC(payload_extension) (ctx, rw, &current->extension_data,
359 vui_payload_size, current_position));
360
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
18 fixed(1, vui_payload_bit_equal_to_one, 1);
361
2/2
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 9 times.
144 while (byte_alignment(rw) != 0)
362
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 63 times.
126 fixed(1, vui_payload_bit_equal_to_zero, 0);
363 }
364 52 return 0;
365 }
366
367 6 static int FUNC(extension_data) (CodedBitstreamContext *ctx, RWContext *rw,
368 H266RawExtensionData *current)
369 {
370 int err;
371 size_t k;
372 #ifdef READ
373 GetBitContext start;
374 uint8_t bit;
375 4 start = *rw;
376
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
20 for (k = 0; cbs_h2645_read_more_rbsp_data(rw); k++)
377 16 skip_bits(rw, 1);
378 4 current->bit_length = k;
379
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
4 if (k > 0) {
380 4 *rw = start;
381
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
4 allocate(current->data, (current->bit_length + 7) / 8);
382
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
20 for (k = 0; k < current->bit_length; k++) {
383
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
16 xu(1, extension_data, bit, 0, 1, 0);
384 16 current->data[k / 8] |= bit << (7 - k % 8);
385 }
386 }
387 #else
388
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
10 for (k = 0; k < current->bit_length; k++)
389
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
8 xu(1, extension_data, current->data[k / 8] >> (7 - k % 8) & 1, 0, 1, 0);
390 #endif
391 6 return 0;
392 }
393
394 2544 static int FUNC(dpb_parameters) (CodedBitstreamContext *ctx, RWContext *rw,
395 H266DpbParameters *current,
396 uint8_t max_sublayers_minus1,
397 uint8_t sublayer_info_flag)
398 {
399 int err, i;
400
2/2
✓ Branch 0 taken 1255 times.
✓ Branch 1 taken 17 times.
2544 for (i = (sublayer_info_flag ? 0 : max_sublayers_minus1);
401
2/2
✓ Branch 0 taken 1340 times.
✓ Branch 1 taken 1272 times.
5224 i <= max_sublayers_minus1; i++) {
402
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1340 times.
2680 ues(dpb_max_dec_pic_buffering_minus1[i], 0, VVC_MAX_DPB_SIZE - 1, 1, i);
403
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1340 times.
2680 ues(dpb_max_num_reorder_pics[i],
404 0, current->dpb_max_dec_pic_buffering_minus1[i], 1, i);
405
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1340 times.
2680 ues(dpb_max_latency_increase_plus1[i], 0, UINT32_MAX - 1, 1, i);
406 }
407 2544 return 0;
408 }
409
410 129002 static int FUNC(ref_pic_list_struct) (CodedBitstreamContext *ctx,
411 RWContext *rw,
412 H266RefPicListStruct *current,
413 uint8_t list_idx, uint8_t rpls_idx,
414 const H266RawSPS *sps)
415 {
416 129002 CodedBitstreamH266Context *h266 = ctx->priv_data;
417 129002 int err, i, j, general_layer_idx = -1, num_direct_ref_layers = 0;
418 129002 const H266RawVPS *vps = h266->vps[sps->sps_video_parameter_set_id];
419
420
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64501 times.
129002 if (!vps) {
421 av_log(ctx->log_ctx, AV_LOG_ERROR,
422 "VPS id %d not available.\n", sps->sps_video_parameter_set_id);
423 return AVERROR_INVALIDDATA;
424 }
425 //7.4.3.3 (29)
426
1/2
✓ Branch 0 taken 64981 times.
✗ Branch 1 not taken.
129962 for (i = 0; i <= vps->vps_max_layers_minus1; i++) {
427
2/2
✓ Branch 0 taken 64501 times.
✓ Branch 1 taken 480 times.
129962 if (sps->nal_unit_header.nuh_layer_id == vps->vps_layer_id[i]) {
428 129002 general_layer_idx = i;
429 129002 break;
430 }
431 }
432
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64501 times.
129002 if (general_layer_idx < 0) {
433 av_log(ctx->log_ctx, AV_LOG_ERROR, "vps_layer_id %d not available.\n",
434 sps->nal_unit_header.nuh_layer_id);
435 return AVERROR_INVALIDDATA;
436 }
437 //7.4.3.3 (28)
438
2/2
✓ Branch 0 taken 65868 times.
✓ Branch 1 taken 64501 times.
260738 for (j = 0; j <= vps->vps_max_layers_minus1; j++) {
439
2/2
✓ Branch 0 taken 480 times.
✓ Branch 1 taken 65388 times.
131736 if (vps->vps_direct_ref_layer_flag[general_layer_idx][j])
440 960 num_direct_ref_layers++;
441 }
442
443
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 64501 times.
129002 ue(num_ref_entries, 0, VVC_MAX_REF_ENTRIES);
444
2/2
✓ Branch 0 taken 602 times.
✓ Branch 1 taken 63899 times.
129002 if (sps->sps_long_term_ref_pics_flag &&
445
2/2
✓ Branch 0 taken 370 times.
✓ Branch 1 taken 232 times.
1204 rpls_idx < sps->sps_num_ref_pic_lists[list_idx] &&
446
1/2
✓ Branch 0 taken 370 times.
✗ Branch 1 not taken.
740 current->num_ref_entries > 0)
447
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 370 times.
740 flag(ltrp_in_header_flag);
448
2/2
✓ Branch 0 taken 602 times.
✓ Branch 1 taken 63899 times.
129002 if (sps->sps_long_term_ref_pics_flag &&
449
2/2
✓ Branch 0 taken 232 times.
✓ Branch 1 taken 370 times.
1204 rpls_idx == sps->sps_num_ref_pic_lists[list_idx])
450
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
464 infer(ltrp_in_header_flag, 1);
451
2/2
✓ Branch 0 taken 135982 times.
✓ Branch 1 taken 64501 times.
400966 for (i = 0, j = 0; i < current->num_ref_entries; i++) {
452
2/2
✓ Branch 0 taken 1611 times.
✓ Branch 1 taken 134371 times.
271964 if (sps->sps_inter_layer_prediction_enabled_flag)
453
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1611 times.
3222 flags(inter_layer_ref_pic_flag[i], 1, i);
454 else
455
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 34714 times.
268742 infer(inter_layer_ref_pic_flag[i], 0);
456
457
2/2
✓ Branch 0 taken 135772 times.
✓ Branch 1 taken 210 times.
271964 if (!current->inter_layer_ref_pic_flag[i]) {
458
2/2
✓ Branch 0 taken 2583 times.
✓ Branch 1 taken 133189 times.
271544 if (sps->sps_long_term_ref_pics_flag)
459
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2583 times.
5166 flags(st_ref_pic_flag[i], 1, i);
460 else
461
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 35035 times.
266378 infer(st_ref_pic_flag[i], 1);
462
2/2
✓ Branch 0 taken 135012 times.
✓ Branch 1 taken 760 times.
271544 if (current->st_ref_pic_flag[i]) {
463 int abs_delta_poc_st;
464
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 135012 times.
270024 ues(abs_delta_poc_st[i], 0, MAX_UINT_BITS(15), 1, i);
465
2/2
✓ Branch 0 taken 132085 times.
✓ Branch 1 taken 2927 times.
270024 if ((sps->sps_weighted_pred_flag ||
466
3/4
✗ Branch 0 not taken.
✓ Branch 1 taken 132085 times.
✓ Branch 2 taken 1993 times.
✓ Branch 3 taken 934 times.
270024 sps->sps_weighted_bipred_flag) && i != 0)
467 3986 abs_delta_poc_st = current->abs_delta_poc_st[i];
468 else
469 266038 abs_delta_poc_st = current->abs_delta_poc_st[i] + 1;
470
2/2
✓ Branch 0 taken 134624 times.
✓ Branch 1 taken 388 times.
270024 if (abs_delta_poc_st > 0)
471
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 134624 times.
269248 flags(strp_entry_sign_flag[i], 1, i);
472 } else {
473
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 760 times.
1520 if (!current->ltrp_in_header_flag) {
474 uint8_t bits = sps->sps_log2_max_pic_order_cnt_lsb_minus4 + 4;
475 ubs(bits, rpls_poc_lsb_lt[j], 1, j);
476 j++;
477 }
478 }
479 } else {
480
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 210 times.
420 if (num_direct_ref_layers == 0) {
481 av_log(ctx->log_ctx, AV_LOG_ERROR,
482 "num_direct_ref_layers needs > 0.\n");
483 return AVERROR_INVALIDDATA;
484 }
485
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 210 times.
420 ues(ilrp_idx[i], 0, num_direct_ref_layers - 1, 1, i);
486 }
487 }
488 129002 return 0;
489 }
490
491 18186 static int FUNC(ref_pic_lists) (CodedBitstreamContext *ctx, RWContext *rw,
492 const H266RawSPS *sps, const H266RawPPS *pps,
493 H266RefPicLists *current) {
494 const H266RefPicListStruct * ref_list;
495 int err, i, j, num_ltrp_entries;
496
2/2
✓ Branch 0 taken 18186 times.
✓ Branch 1 taken 9093 times.
54558 for (i = 0; i < 2; i++) {
497
4/4
✓ Branch 0 taken 18078 times.
✓ Branch 1 taken 108 times.
✓ Branch 2 taken 9039 times.
✓ Branch 3 taken 9039 times.
36372 if (sps->sps_num_ref_pic_lists[i] > 0 &&
498
3/4
✓ Branch 0 taken 9039 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 8970 times.
18078 (i == 0 || (i == 1 && pps->pps_rpl1_idx_present_flag))) {
499
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9108 times.
18216 flags(rpl_sps_flag[i], 1, i);
500 } else {
501
2/2
✓ Branch 0 taken 108 times.
✓ Branch 1 taken 8970 times.
18156 if (sps->sps_num_ref_pic_lists[i] == 0) {
502
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
216 infer(rpl_sps_flag[i], 0);
503 } else {
504
2/4
✓ Branch 0 taken 8970 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8970 times.
✗ Branch 3 not taken.
17940 if (!pps->pps_rpl1_idx_present_flag && i == 1)
505
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2182 times.
17940 infer(rpl_sps_flag[1], current->rpl_sps_flag[0]);
506 }
507 }
508
2/2
✓ Branch 0 taken 11686 times.
✓ Branch 1 taken 6500 times.
36372 if (current->rpl_sps_flag[i]) {
509
4/4
✓ Branch 0 taken 11676 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 5838 times.
✓ Branch 3 taken 5838 times.
23372 if (sps->sps_num_ref_pic_lists[i] > 1 &&
510
3/4
✓ Branch 0 taken 5838 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 5835 times.
23358 (i == 0 || (i == 1 && pps->pps_rpl1_idx_present_flag))) {
511 11682 uint8_t bits = av_ceil_log2(sps->sps_num_ref_pic_lists[i]);
512
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5841 times.
11682 us(bits, rpl_idx[i], 0, sps->sps_num_ref_pic_lists[i] - 1, 1, i);
513
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 5835 times.
11690 } else if (sps->sps_num_ref_pic_lists[i] == 1) {
514
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
20 infer(rpl_idx[i], 0);
515
2/4
✓ Branch 0 taken 5835 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5835 times.
✗ Branch 3 not taken.
11670 } else if (i == 1 && !pps->pps_rpl1_idx_present_flag) {
516
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1571 times.
11670 infer(rpl_idx[1], current->rpl_idx[0]);
517 } else {
518 //how to handle this? or never happpend?
519 av_log(ctx->log_ctx, AV_LOG_ERROR,
520 "can't infer the rpl_idx[i]\n");
521 return AVERROR_PATCHWELCOME;
522 }
523 23372 memcpy(&current->rpl_ref_list[i],
524 23372 &sps->sps_ref_pic_list_struct[i][current->rpl_idx[i]],
525 sizeof(current->rpl_ref_list[i]));
526 } else {
527
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6500 times.
13000 CHECK(FUNC(ref_pic_list_struct) (ctx, rw, &current->rpl_ref_list[i],
528 i, sps->sps_num_ref_pic_lists[i],
529 sps));
530 }
531 36372 ref_list = &current->rpl_ref_list[i];
532
533 36372 num_ltrp_entries = 0;
534
2/2
✓ Branch 0 taken 36878 times.
✓ Branch 1 taken 18186 times.
110128 for (int k = 0; k < ref_list->num_ref_entries; k++) {
535
2/2
✓ Branch 0 taken 36668 times.
✓ Branch 1 taken 210 times.
73756 if (!ref_list->inter_layer_ref_pic_flag[k]) {
536
2/2
✓ Branch 0 taken 760 times.
✓ Branch 1 taken 35908 times.
73336 if (!ref_list->st_ref_pic_flag[k]) {
537 1520 num_ltrp_entries++;
538 }
539 }
540 }
541
542
2/2
✓ Branch 0 taken 760 times.
✓ Branch 1 taken 18186 times.
37892 for (j = 0; j < num_ltrp_entries; j++) {
543
1/2
✓ Branch 0 taken 760 times.
✗ Branch 1 not taken.
1520 if (ref_list->ltrp_in_header_flag) {
544
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 760 times.
1520 ubs(sps->sps_log2_max_pic_order_cnt_lsb_minus4 + 4,
545 poc_lsb_lt[i][j], 2, i, j);
546 }
547
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 760 times.
1520 flags(delta_poc_msb_cycle_present_flag[i][j], 2, i, j);
548
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 760 times.
1520 if (current->delta_poc_msb_cycle_present_flag[i][j]) {
549 uint32_t max =
550 1 << (32 - sps->sps_log2_max_pic_order_cnt_lsb_minus4 - 4);
551 ues(delta_poc_msb_cycle_lt[i][j], 0, max, 2, i, j);
552 }
553 }
554 }
555 18186 return 0;
556 }
557
558 34 static int FUNC(general_timing_hrd_parameters)(CodedBitstreamContext *ctx,
559 RWContext *rw,
560 H266RawGeneralTimingHrdParameters *current)
561 {
562 int err;
563
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ub(32, num_units_in_tick);
564
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 u(32, time_scale, 1, MAX_UINT_BITS(32));
565
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 flag(general_nal_hrd_params_present_flag);
566
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 flag(general_vcl_hrd_params_present_flag);
567
568
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
34 if (current->general_nal_hrd_params_present_flag ||
569 current->general_vcl_hrd_params_present_flag) {
570
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 flag(general_same_pic_timing_in_all_ols_flag);
571
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 flag(general_du_hrd_params_present_flag);
572
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
34 if (current->general_du_hrd_params_present_flag)
573 ub(8, tick_divisor_minus2);
574
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ub(4, bit_rate_scale);
575
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ub(4, cpb_size_scale);
576
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
34 if (current->general_du_hrd_params_present_flag)
577 ub(4, cpb_size_du_scale);
578
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(hrd_cpb_cnt_minus1, 0, 31);
579 } else {
580 //infer general_same_pic_timing_in_all_ols_flag?
581 infer(general_du_hrd_params_present_flag, 0);
582 }
583 34 return 0;
584 }
585
586 340 static int FUNC(sublayer_hrd_parameters) (CodedBitstreamContext *ctx,
587 RWContext *rw,
588 H266RawSubLayerHRDParameters *current,
589 int sublayer_id,
590 const H266RawGeneralTimingHrdParameters *general)
591 {
592 int err, i;
593
2/2
✓ Branch 0 taken 170 times.
✓ Branch 1 taken 170 times.
680 for (i = 0; i <= general->hrd_cpb_cnt_minus1; i++) {
594
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 170 times.
340 ues(bit_rate_value_minus1[sublayer_id][i], 0, UINT32_MAX - 1, 2,
595 sublayer_id, i);
596
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 170 times.
340 ues(cpb_size_value_minus1[sublayer_id][i], 0, UINT32_MAX - 1, 2,
597 sublayer_id, i);
598
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 170 times.
340 if (general->general_du_hrd_params_present_flag) {
599 ues(cpb_size_du_value_minus1[sublayer_id][i],
600 0, UINT32_MAX - 1, 2, sublayer_id, i);
601 ues(bit_rate_du_value_minus1[sublayer_id][i],
602 0, UINT32_MAX - 1, 2, sublayer_id, i);
603 }
604
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 170 times.
340 flags(cbr_flag[sublayer_id][i], 2, sublayer_id, i);
605 }
606 340 return 0;
607 }
608
609 34 static int FUNC(ols_timing_hrd_parameters) (CodedBitstreamContext *ctx,
610 RWContext *rw, H266RawOlsTimingHrdParameters *current,
611 uint8_t first_sublayer, uint8_t max_sublayers_minus1,
612 const H266RawGeneralTimingHrdParameters *general)
613 {
614 int err, i;
615
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 17 times.
204 for (i = first_sublayer; i <= max_sublayers_minus1; i++) {
616
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
170 flags(fixed_pic_rate_general_flag[i], 1, i);
617
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 85 times.
170 if (!current->fixed_pic_rate_general_flag[i])
618 flags(fixed_pic_rate_within_cvs_flag[i], 1, i);
619 else
620
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
170 infer(fixed_pic_rate_within_cvs_flag[i], 1);
621
1/2
✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
170 if (current->fixed_pic_rate_within_cvs_flag[i]) {
622
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
170 ues(elemental_duration_in_tc_minus1[i], 0, 2047, 1, i);
623
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
170 infer(low_delay_hrd_flag[i], 0);
624 } else if ((general->general_nal_hrd_params_present_flag ||
625 general->general_vcl_hrd_params_present_flag) &&
626 general->hrd_cpb_cnt_minus1 == 0) {
627 flags(low_delay_hrd_flag[i], 1, i);
628 } else {
629 infer(low_delay_hrd_flag[i], 0);
630 }
631
1/2
✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
170 if (general->general_nal_hrd_params_present_flag)
632
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
170 CHECK(FUNC(sublayer_hrd_parameters) (ctx, rw,
633 &current->nal_sub_layer_hrd_parameters,
634 i, general));
635
1/2
✓ Branch 0 taken 85 times.
✗ Branch 1 not taken.
170 if (general->general_vcl_hrd_params_present_flag)
636
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
170 CHECK(FUNC(sublayer_hrd_parameters) (ctx, rw,
637 &current->nal_sub_layer_hrd_parameters,
638 i, general));
639 }
640 34 return 0;
641 }
642
643 6 static int FUNC(opi)(CodedBitstreamContext *ctx, RWContext *rw,
644 H266RawOPI *current)
645 {
646 int err;
647
648 6 HEADER("Operating point information");
649
650
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
6 CHECK(FUNC(nal_unit_header)(ctx, rw,
651 &current->nal_unit_header, VVC_OPI_NUT));
652
653
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
6 flag(opi_ols_info_present_flag);
654
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
6 flag(opi_htid_info_present_flag);
655
656
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
6 if(current->opi_ols_info_present_flag)
657 ue(opi_ols_idx, 0, VVC_MAX_TOTAL_NUM_OLSS - 1);
658
659
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
6 if(current->opi_htid_info_present_flag)
660 ub(3, opi_htid_plus1);
661
662
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
6 flag(opi_extension_flag);
663
1/2
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
6 if (current->opi_extension_flag)
664
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
6 CHECK(FUNC(extension_data) (ctx, rw, &current->extension_data));
665
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
6 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
666
667 6 return 0;
668 }
669
670 10 static int FUNC(dci)(CodedBitstreamContext *ctx, RWContext *rw,
671 H266RawDCI *current)
672 {
673 int err, i;
674
675 10 HEADER("Decoding capability information");
676
677
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 CHECK(FUNC(nal_unit_header)(ctx, rw,
678 &current->nal_unit_header, VVC_DCI_NUT));
679
680
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ub(4, dci_reserved_zero_4bits);
681
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ub(4, dci_num_ptls_minus1);
682
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 5 times.
20 for (i = 0; i <= current->dci_num_ptls_minus1; i++)
683
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 CHECK(FUNC(profile_tier_level)(ctx, rw,
684 current->dci_profile_tier_level + i, 1, 0));
685
686
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 flag(dci_extension_flag);
687
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
10 if (current->dci_extension_flag)
688 CHECK(FUNC(extension_data)(ctx, rw, &current->extension_data));
689
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 CHECK(FUNC(rbsp_trailing_bits)(ctx, rw));
690
691 10 return 0;
692 }
693
694 52 static int FUNC(vps) (CodedBitstreamContext *ctx, RWContext *rw,
695 H266RawVPS *current)
696 {
697 int err, i, j, k;
698 52 uint16_t total_num_olss = 0;
699 52 uint8_t ols_mode_idc = 0;
700 52 uint16_t num_multi_layer_olss = 0;
701 uint8_t layer_included_in_ols_flag[VVC_MAX_TOTAL_NUM_OLSS][VVC_MAX_LAYERS];
702 uint8_t num_ref_layers[VVC_MAX_LAYERS];
703 uint8_t reference_layer_idx[VVC_MAX_LAYERS][VVC_MAX_LAYERS];
704
705 52 HEADER("Video Parameter Set");
706
707
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 CHECK(FUNC(nal_unit_header) (ctx, rw,
708 &current->nal_unit_header, VVC_VPS_NUT));
709
710
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 u(4, vps_video_parameter_set_id, 1, VVC_MAX_VPS_COUNT - 1);
711
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ub(6, vps_max_layers_minus1);
712
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 u(3, vps_max_sublayers_minus1, 0, 6);
713
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (current->vps_max_layers_minus1 > 0
714
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 19 times.
52 && current->vps_max_sublayers_minus1 > 0)
715
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
14 flag(vps_default_ptl_dpb_hrd_max_tid_flag);
716 else
717
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
38 infer(vps_default_ptl_dpb_hrd_max_tid_flag, 1);
718
719
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (current->vps_max_layers_minus1 > 0)
720
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vps_all_independent_layers_flag);
721 else
722 infer(vps_all_independent_layers_flag, 1);
723
724
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (i = 0; i <= current->vps_max_layers_minus1; i++) {
725
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
104 ubs(6, vps_layer_id[i], 1, i);
726
3/4
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 26 times.
104 if (i > 0 && current->vps_layer_id[i] <= current->vps_layer_id[i - 1]) {
727 av_log(ctx->log_ctx, AV_LOG_ERROR,
728 "vps_layer_id[%d](%d) should > vps_layer_id[%d](%d).\n",
729 i, current->vps_layer_id[i], i - 1,
730 current->vps_layer_id[i - 1]);
731 return AVERROR_INVALIDDATA;
732 }
733
3/4
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
104 if (i > 0 && !current->vps_all_independent_layers_flag) {
734
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flags(vps_independent_layer_flag[i], 1, i);
735
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (!current->vps_independent_layer_flag[i]) {
736
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flags(vps_max_tid_ref_present_flag[i], 1, i);
737
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (j = 0; j < i; j++) {
738
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flags(vps_direct_ref_layer_flag[i][j], 2, i, j);
739
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_max_tid_ref_present_flag[i] &&
740 current->vps_direct_ref_layer_flag[i][j]) {
741 ubs(3, vps_max_tid_il_ref_pics_plus1[i][j], 2, i, j);
742 } else {
743
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
52 infer(vps_max_tid_il_ref_pics_plus1[i][j],
744 current->vps_max_sublayers_minus1 + 1);
745 }
746 }
747 } else {
748 for (j = 0; j < i; j++) {
749 infer(vps_direct_ref_layer_flag[i][j], 0);
750 }
751 }
752 } else {
753
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
52 infer(vps_independent_layer_flag[i], 1);
754
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 for (j = 0; j < i; j++) {
755 infer(vps_direct_ref_layer_flag[i][j], 0);
756 }
757 }
758 }
759
760
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (current->vps_max_layers_minus1 > 0) {
761
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_all_independent_layers_flag)
762 flag(vps_each_layer_is_an_ols_flag);
763 else
764
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
52 infer(vps_each_layer_is_an_ols_flag, 0);
765
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (!current->vps_each_layer_is_an_ols_flag) {
766
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (!current->vps_all_independent_layers_flag)
767
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ub(2, vps_ols_mode_idc);
768 else
769 infer(vps_ols_mode_idc, 2);
770
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (current->vps_ols_mode_idc == 2) {
771
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ub(8, vps_num_output_layer_sets_minus2);
772
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (i = 1; i <= current->vps_num_output_layer_sets_minus2 + 1;
773 52 i++)
774
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (j = 0; j <= current->vps_max_layers_minus1; j++)
775
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
104 flags(vps_ols_output_layer_flag[i][j], 2, i, j);
776 }
777 52 ols_mode_idc = current->vps_ols_mode_idc;
778 } else {
779 ols_mode_idc = 4;
780 }
781
3/6
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 26 times.
52 if (ols_mode_idc == 4 || ols_mode_idc == 0 || ols_mode_idc == 1)
782 total_num_olss = current->vps_max_layers_minus1 + 1;
783
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 else if (ols_mode_idc == 2)
784 52 total_num_olss = current->vps_num_output_layer_sets_minus2 + 2;
785 else
786 av_log(ctx->log_ctx, AV_LOG_ERROR,
787 "ols_mode_idc == 3, patch welcome");
788
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 u(8, vps_num_ptls_minus1, 0, total_num_olss - 1);
789 } else {
790 infer(vps_each_layer_is_an_ols_flag, 1);
791 infer(vps_num_ptls_minus1, 0);
792 }
793
794
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (i = 0; i <= current->vps_num_ptls_minus1; i++) {
795
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 if (i > 0)
796
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flags(vps_pt_present_flag[i], 1, i);
797 else
798
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
52 infer(vps_pt_present_flag[i], 1);
799
800
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 38 times.
104 if (!current->vps_default_ptl_dpb_hrd_max_tid_flag)
801
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
28 us(3, vps_ptl_max_tid[i], 0, current->vps_max_sublayers_minus1, 1, i);
802 else
803
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
76 infer(vps_ptl_max_tid[i], current->vps_max_sublayers_minus1);
804 }
805
2/2
✓ Branch 1 taken 163 times.
✓ Branch 2 taken 26 times.
378 while (byte_alignment(rw) != 0)
806
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 163 times.
326 fixed(1, vps_ptl_alignment_zero_bit, 0);
807
808 {
809 //calc NumMultiLayerOlss
810 int m;
811 uint8_t dependency_flag[VVC_MAX_LAYERS][VVC_MAX_LAYERS];
812 uint16_t num_output_layers_in_ols[VVC_MAX_TOTAL_NUM_OLSS];
813 uint8_t num_sub_layers_in_layer_in_ols[VVC_MAX_TOTAL_NUM_OLSS][VVC_MAX_TOTAL_NUM_OLSS];
814 uint8_t output_layer_idx[VVC_MAX_TOTAL_NUM_OLSS][VVC_MAX_LAYERS];
815
816 //7.4.3.3 vps_direct_ref_layer_flag section
817
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (i = 0; i <= current->vps_max_layers_minus1; i++) {
818
2/2
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 52 times.
312 for (j = 0; j <= current->vps_max_layers_minus1; j++) {
819 208 dependency_flag[i][j] = current->vps_direct_ref_layer_flag[i][j];
820
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 104 times.
312 for (k = 0; k < i; k++) {
821
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
104 if (current->vps_direct_ref_layer_flag[i][k] &&
822
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
104 dependency_flag[k][j])
823 dependency_flag[i][j] = 1;
824 }
825 }
826 }
827
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (i = 0; i <= current->vps_max_layers_minus1; i++) {
828 int r;
829
2/2
✓ Branch 0 taken 104 times.
✓ Branch 1 taken 52 times.
312 for (j = 0, r = 0; j <= current->vps_max_layers_minus1; j++) {
830
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 78 times.
208 if (dependency_flag[i][j])
831 52 reference_layer_idx[i][r++] = j;
832 }
833 104 num_ref_layers[i] = r;
834 }
835
836 //7.4.3.3 vps_ols_output_layer_flag section
837 52 num_output_layers_in_ols[0] = 1;
838 52 num_sub_layers_in_layer_in_ols[0][0] =
839 52 current->vps_ptl_max_tid[current->vps_ols_ptl_idx[0]] + 1;
840
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (i = 1; i < total_num_olss; i++) {
841
2/4
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 26 times.
52 if (ols_mode_idc == 4 || ols_mode_idc == 0) {
842 num_output_layers_in_ols[i] = 1;
843 if (current->vps_each_layer_is_an_ols_flag) {
844 num_sub_layers_in_layer_in_ols[i][0] =
845 current->vps_ptl_max_tid[current->vps_ols_ptl_idx[i]] + 1;
846 } else {
847 num_sub_layers_in_layer_in_ols[i][i] =
848 current->vps_ptl_max_tid[current->vps_ols_ptl_idx[i]] + 1;
849 for (k = i - 1; k >= 0; k--) {
850 num_sub_layers_in_layer_in_ols[i][k] = 0;
851 for (m = k + 1; m <= i; m++) {
852 uint8_t max_sublayer_needed =
853 FFMIN(num_sub_layers_in_layer_in_ols[i][m],
854 current->vps_max_tid_il_ref_pics_plus1[m][k]);
855 if (current->vps_direct_ref_layer_flag[m][k] &&
856 num_sub_layers_in_layer_in_ols[i][k] < max_sublayer_needed)
857 num_sub_layers_in_layer_in_ols[i][k] = max_sublayer_needed;
858 }
859 }
860 }
861
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 } else if (current->vps_ols_mode_idc == 1) {
862 num_output_layers_in_ols[i] = i + 1;
863 for (j = 0; j < num_output_layers_in_ols[i]; j++) {
864 num_sub_layers_in_layer_in_ols[i][j] =
865 current->vps_ptl_max_tid[current->vps_ols_ptl_idx[i]] + 1;
866 }
867
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 } else if (current->vps_ols_mode_idc == 2) {
868 52 uint8_t highest_included_layer = 0;
869
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (j = 0; j <= current->vps_max_layers_minus1; j++) {
870 104 layer_included_in_ols_flag[i][j] = 0;
871 104 num_sub_layers_in_layer_in_ols[i][j] = 0;
872 }
873
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (k = 0, j = 0; k <= current->vps_max_layers_minus1; k++) {
874
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
104 if (current->vps_ols_output_layer_flag[i][k]) {
875 104 layer_included_in_ols_flag[i][k] = 1;
876 104 highest_included_layer = k;
877 104 output_layer_idx[i][j] = k;
878 104 num_sub_layers_in_layer_in_ols[i][k] =
879 104 current->vps_ptl_max_tid[current->
880 104 vps_ols_ptl_idx[i]] + 1;
881 104 j++;
882 }
883 }
884 52 num_output_layers_in_ols[i] = j;
885
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (j = 0; j < num_output_layers_in_ols[i]; j++) {
886 104 int idx = output_layer_idx[i][j];
887
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 52 times.
156 for (k = 0; k < num_ref_layers[idx]; k++) {
888
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (!layer_included_in_ols_flag[i][reference_layer_idx[idx][k]])
889 layer_included_in_ols_flag[i][reference_layer_idx[idx][k]] = 1;
890 }
891 }
892
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (k = highest_included_layer - 1; k >= 0; k--) {
893
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (layer_included_in_ols_flag[i][k] &&
894
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 !current->vps_ols_output_layer_flag[i][k]) {
895 for (m = k + 1; m <= highest_included_layer; m++) {
896 uint8_t max_sublayer_needed =
897 FFMIN(num_sub_layers_in_layer_in_ols[i][m],
898 current->vps_max_tid_il_ref_pics_plus1[m][k]);
899 if (current->vps_direct_ref_layer_flag[m][k] &&
900 layer_included_in_ols_flag[i][m] &&
901 num_sub_layers_in_layer_in_ols[i][k] <
902 max_sublayer_needed)
903 num_sub_layers_in_layer_in_ols[i][k] =
904 max_sublayer_needed;
905 }
906 }
907 }
908 }
909
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (!num_output_layers_in_ols[i])
910 return AVERROR_INVALIDDATA;
911 }
912
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (i = 1; i < total_num_olss; i++) {
913 52 int num_layers_in_ols = 0;
914
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_each_layer_is_an_ols_flag) {
915 num_layers_in_ols = 1;
916
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 } else if (current->vps_ols_mode_idc == 0 ||
917
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 current->vps_ols_mode_idc == 1) {
918 num_layers_in_ols = i + 1;
919
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 } else if (current->vps_ols_mode_idc == 2) {
920
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (k = 0, j = 0; k <= current->vps_max_layers_minus1; k++)
921
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
104 if (layer_included_in_ols_flag[i][k])
922 104 j++;
923 52 num_layers_in_ols = j;
924 }
925
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (num_layers_in_ols > 1) {
926 52 num_multi_layer_olss++;
927 }
928 }
929
2/4
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 26 times.
52 if (!current->vps_each_layer_is_an_ols_flag && num_multi_layer_olss == 0)
930 return AVERROR_INVALIDDATA;
931 }
932
933
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (i = 0; i <= current->vps_num_ptls_minus1; i++) {
934
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
104 CHECK(FUNC(profile_tier_level) (ctx, rw,
935 current->vps_profile_tier_level + i,
936 current->vps_pt_present_flag[i],
937 current->vps_ptl_max_tid[i]));
938 }
939
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (i = 0; i < total_num_olss; i++) {
940
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
104 if (current->vps_num_ptls_minus1 > 0 &&
941
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
104 current->vps_num_ptls_minus1 + 1 != total_num_olss) {
942 us(8, vps_ols_ptl_idx[i], 0, current->vps_num_ptls_minus1, 1, i);
943
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
104 } else if (current->vps_num_ptls_minus1 == 0) {
944 infer(vps_ols_ptl_idx[i], 0);
945 } else {
946
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
104 infer(vps_ols_ptl_idx[i], i);
947 }
948 }
949
950
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (!current->vps_each_layer_is_an_ols_flag) {
951 uint16_t vps_num_dpb_params;
952
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ue(vps_num_dpb_params_minus1, 0, num_multi_layer_olss - 1);
953
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_each_layer_is_an_ols_flag)
954 vps_num_dpb_params = 0;
955 else
956 52 vps_num_dpb_params = current->vps_num_dpb_params_minus1 + 1;
957
958
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 19 times.
52 if (current->vps_max_sublayers_minus1 > 0)
959
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
14 flag(vps_sublayer_dpb_params_present_flag);
960 else
961
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
38 infer(vps_sublayer_dpb_params_present_flag, 0);
962
963
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (i = 0; i < vps_num_dpb_params; i++) {
964
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 19 times.
52 if (!current->vps_default_ptl_dpb_hrd_max_tid_flag)
965
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
14 us(3, vps_dpb_max_tid[i], 0, current->vps_max_sublayers_minus1,
966 1, i);
967 else
968
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
38 infer(vps_dpb_max_tid[i], current->vps_max_sublayers_minus1);
969
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 CHECK(FUNC(dpb_parameters) (ctx, rw, current->vps_dpb_params + i,
970 current->vps_dpb_max_tid[i],
971 current->
972 vps_sublayer_dpb_params_present_flag));
973 }
974
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (i = 0; i < num_multi_layer_olss; i++) {
975
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ues(vps_ols_dpb_pic_width[i], 0, UINT16_MAX, 1, i);
976
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ues(vps_ols_dpb_pic_height[i], 0, UINT16_MAX, 1, i);
977
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ubs(2, vps_ols_dpb_chroma_format[i], 1, i);
978
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ues(vps_ols_dpb_bitdepth_minus8[i], 0, 8, 1, i);
979
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (vps_num_dpb_params > 1
980 && vps_num_dpb_params != num_multi_layer_olss)
981 ues(vps_ols_dpb_params_idx[i], 0, vps_num_dpb_params - 1, 1, i);
982
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 else if (vps_num_dpb_params == 1)
983
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
52 infer(vps_ols_dpb_params_idx[i], 0);
984 else
985 infer(vps_ols_dpb_params_idx[i], i);
986 }
987
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vps_timing_hrd_params_present_flag);
988
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_timing_hrd_params_present_flag) {
989 CHECK(FUNC(general_timing_hrd_parameters) (ctx, rw,
990 &current->
991 vps_general_timing_hrd_parameters));
992 if (current->vps_max_sublayers_minus1 > 0)
993 flag(vps_sublayer_cpb_params_present_flag);
994 else
995 infer(vps_sublayer_cpb_params_present_flag, 0);
996 ue(vps_num_ols_timing_hrd_params_minus1, 0,
997 num_multi_layer_olss - 1);
998 for (i = 0; i <= current->vps_num_ols_timing_hrd_params_minus1; i++) {
999 uint8_t first_sublayer;
1000 if (!current->vps_default_ptl_dpb_hrd_max_tid_flag)
1001 us(3, vps_hrd_max_tid[i], 0,
1002 current->vps_max_sublayers_minus1, 1, i);
1003 else
1004 infer(vps_hrd_max_tid[i],
1005 current->vps_max_sublayers_minus1);
1006 first_sublayer = current->vps_sublayer_cpb_params_present_flag ?
1007 0 : current->vps_hrd_max_tid[i];
1008 CHECK(FUNC(ols_timing_hrd_parameters)
1009 (ctx, rw, &current->vps_ols_timing_hrd_parameters,
1010 first_sublayer, current->vps_max_sublayers_minus1,
1011 &current->vps_general_timing_hrd_parameters));
1012
1013 }
1014 if (current->vps_num_ols_timing_hrd_params_minus1 > 0 &&
1015 current->vps_num_ols_timing_hrd_params_minus1 + 1 !=
1016 num_multi_layer_olss) {
1017 for (i = 0; i < num_multi_layer_olss; i++) {
1018 ues(vps_ols_timing_hrd_idx[i], 0,
1019 current->vps_num_ols_timing_hrd_params_minus1, 1, i);
1020 }
1021 } else if (current->vps_num_ols_timing_hrd_params_minus1 == 0) {
1022 for (i = 0; i < num_multi_layer_olss; i++)
1023 infer(vps_ols_timing_hrd_idx[i], 0);
1024 } else {
1025 for (i = 0; i < num_multi_layer_olss; i++)
1026 infer(vps_ols_timing_hrd_idx[i], i);
1027 }
1028 }
1029 }
1030
1031
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vps_extension_flag);
1032
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_extension_flag)
1033 CHECK(FUNC(extension_data) (ctx, rw, &current->extension_data));
1034
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
1035
1036 52 return 0;
1037 }
1038
1039 static int FUNC(sps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw,
1040 H266RawSPS *current)
1041 {
1042 int err;
1043
1044 flag(sps_extended_precision_flag);
1045 if (current->sps_transform_skip_enabled_flag)
1046 flag(sps_ts_residual_coding_rice_present_in_sh_flag);
1047 else
1048 infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0);
1049 flag(sps_rrc_rice_extension_flag);
1050 flag(sps_persistent_rice_adaptation_enabled_flag);
1051 flag(sps_reverse_last_sig_coeff_enabled_flag);
1052
1053 return 0;
1054 }
1055
1056 2492 static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
1057 H266RawSPS *current)
1058 {
1059 2492 CodedBitstreamH266Context *h266 = ctx->priv_data;
1060 int err, i, j, max_width_minus1, max_height_minus1;
1061 unsigned int ctb_log2_size_y, min_cb_log2_size_y,
1062 min_qt_log2_size_intra_y, min_qt_log2_size_inter_y,
1063 ctb_size_y, max_num_merge_cand, tmp_width_val, tmp_height_val;
1064 uint8_t qp_bd_offset, sub_width_c, sub_height_c;
1065
1066 static const uint8_t h266_sub_width_c[] = {
1067 1, 2, 2, 1
1068 };
1069 static const uint8_t h266_sub_height_c[] = {
1070 1, 2, 1, 1
1071 };
1072
1073 2492 HEADER("Sequence Parameter Set");
1074
1075
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 CHECK(FUNC(nal_unit_header) (ctx, rw,
1076 &current->nal_unit_header, VVC_SPS_NUT));
1077
1078
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ub(4, sps_seq_parameter_set_id);
1079
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ub(4, sps_video_parameter_set_id);
1080
4/4
✓ Branch 0 taken 1211 times.
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 180 times.
✓ Branch 3 taken 1031 times.
2492 if (current->sps_video_parameter_set_id == 0 && !h266->vps[0]) {
1081 360 H266RawVPS *vps = av_refstruct_allocz(sizeof(*vps));
1082
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 180 times.
360 if (!vps)
1083 return AVERROR(ENOMEM);
1084 360 vps->vps_max_layers_minus1 = 0;
1085 360 vps->vps_independent_layer_flag[0] = 1;
1086 360 vps->vps_layer_id[0] = current->nal_unit_header.nuh_layer_id;
1087 360 h266->vps[0] = vps;
1088 }
1089
1090
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 u(3, sps_max_sublayers_minus1, 0, VVC_MAX_SUBLAYERS - 1);
1091
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 u(2, sps_chroma_format_idc, 0, 3);
1092 2492 sub_width_c = h266_sub_width_c[current->sps_chroma_format_idc];
1093 2492 sub_height_c = h266_sub_height_c[current->sps_chroma_format_idc];
1094
1095
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 u(2, sps_log2_ctu_size_minus5, 0, 3);
1096 2492 ctb_log2_size_y = current->sps_log2_ctu_size_minus5 + 5;
1097 2492 ctb_size_y = 1 << ctb_log2_size_y;
1098
1099
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_ptl_dpb_hrd_params_present_flag);
1100
1/2
✓ Branch 0 taken 1246 times.
✗ Branch 1 not taken.
2492 if (current->sps_ptl_dpb_hrd_params_present_flag) {
1101
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 CHECK(FUNC(profile_tier_level) (ctx, rw, &current->profile_tier_level,
1102 1, current->sps_max_sublayers_minus1));
1103 }
1104
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_gdr_enabled_flag);
1105
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_ref_pic_resampling_enabled_flag);
1106
2/2
✓ Branch 0 taken 1232 times.
✓ Branch 1 taken 14 times.
2492 if (current->sps_ref_pic_resampling_enabled_flag)
1107
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1232 times.
2464 flag(sps_res_change_in_clvs_allowed_flag);
1108 else
1109
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
28 infer(sps_res_change_in_clvs_allowed_flag, 0);
1110
1111
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_pic_width_max_in_luma_samples, 1, VVC_MAX_WIDTH);
1112
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_pic_height_max_in_luma_samples, 1, VVC_MAX_HEIGHT);
1113
1114
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_conformance_window_flag);
1115
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1229 times.
2492 if (current->sps_conformance_window_flag) {
1116 34 uint16_t width = current->sps_pic_width_max_in_luma_samples / sub_width_c;
1117 34 uint16_t height = current->sps_pic_height_max_in_luma_samples / sub_height_c;
1118
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(sps_conf_win_left_offset, 0, width);
1119
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(sps_conf_win_right_offset, 0, width - current->sps_conf_win_left_offset);
1120
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(sps_conf_win_top_offset, 0, height);
1121
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(sps_conf_win_bottom_offset, 0, height - current->sps_conf_win_top_offset);
1122 } else {
1123
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2458 infer(sps_conf_win_left_offset, 0);
1124
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2458 infer(sps_conf_win_right_offset, 0);
1125
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2458 infer(sps_conf_win_top_offset, 0);
1126
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2458 infer(sps_conf_win_bottom_offset, 0);
1127 }
1128
1129 2492 tmp_width_val = AV_CEIL_RSHIFT(current->sps_pic_width_max_in_luma_samples,
1130 ctb_log2_size_y);
1131 2492 tmp_height_val = AV_CEIL_RSHIFT(current->sps_pic_height_max_in_luma_samples,
1132 ctb_log2_size_y);
1133 2492 max_width_minus1 = tmp_width_val - 1;
1134 2492 max_height_minus1 = tmp_height_val - 1;
1135
1136
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_subpic_info_present_flag);
1137
2/2
✓ Branch 0 taken 37 times.
✓ Branch 1 taken 1209 times.
2492 if (current->sps_subpic_info_present_flag) {
1138
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 ue(sps_num_subpics_minus1, 0, VVC_MAX_SLICES - 1);
1139
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (current->sps_num_subpics_minus1 > 0) {
1140
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flag(sps_independent_subpics_flag);
1141
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flag(sps_subpic_same_size_flag);
1142 }
1143
1144
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (current->sps_num_subpics_minus1 > 0) {
1145 74 int wlen = av_ceil_log2(tmp_width_val);
1146 74 int hlen = av_ceil_log2(tmp_height_val);
1147
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
74 infer(sps_subpic_ctu_top_left_x[0], 0);
1148
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
74 infer(sps_subpic_ctu_top_left_y[0], 0);
1149
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (current->sps_pic_width_max_in_luma_samples > ctb_size_y)
1150
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 us(wlen, sps_subpic_width_minus1[0], 0, max_width_minus1, 1, 0);
1151 else
1152 infer(sps_subpic_width_minus1[0], max_width_minus1);
1153
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (current->sps_pic_height_max_in_luma_samples > ctb_size_y)
1154
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 us(hlen, sps_subpic_height_minus1[0], 0, max_height_minus1, 1, 0);
1155 else
1156 infer(sps_subpic_height_minus1[0], max_height_minus1);
1157
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (!current->sps_independent_subpics_flag) {
1158
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flags(sps_subpic_treated_as_pic_flag[0], 1, 0);
1159
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flags(sps_loop_filter_across_subpic_enabled_flag[0], 1, 0);
1160 } else {
1161 infer(sps_subpic_treated_as_pic_flag[0], 1);
1162 infer(sps_loop_filter_across_subpic_enabled_flag[0], 1);
1163 }
1164
2/2
✓ Branch 0 taken 153 times.
✓ Branch 1 taken 37 times.
380 for (i = 1; i <= current->sps_num_subpics_minus1; i++) {
1165
2/2
✓ Branch 0 taken 118 times.
✓ Branch 1 taken 35 times.
306 if (!current->sps_subpic_same_size_flag) {
1166 236 const int win_right_edge =
1167 236 current->sps_pic_width_max_in_luma_samples -
1168 236 current->sps_conf_win_right_offset * sub_width_c;
1169 236 const int win_bottom_edge =
1170 236 current->sps_pic_height_max_in_luma_samples -
1171 236 current->sps_conf_win_bottom_offset * sub_height_c;
1172 236 const int win_left_edge =
1173 236 current->sps_conf_win_left_offset * sub_width_c;
1174 236 const int win_top_edge =
1175 236 current->sps_conf_win_top_offset * sub_height_c;
1176 236 const int win_left_edge_ctus =
1177 236 AV_CEIL_RSHIFT(win_left_edge, ctb_log2_size_y);
1178 236 const int win_right_edge_ctus =
1179 236 AV_CEIL_RSHIFT(win_right_edge, ctb_log2_size_y);
1180 236 const int win_top_edge_ctus =
1181 236 AV_CEIL_RSHIFT(win_top_edge, ctb_log2_size_y);
1182 236 const int win_bottom_edge_ctus =
1183 236 AV_CEIL_RSHIFT(win_bottom_edge, ctb_log2_size_y);
1184 236 const int min_width =
1185 236 FFMAX(win_left_edge_ctus - current->sps_subpic_ctu_top_left_x[i], 0);
1186 236 const int min_height =
1187 236 FFMAX(win_top_edge_ctus - current->sps_subpic_ctu_top_left_y[i], 0);
1188
1189
1/2
✓ Branch 0 taken 118 times.
✗ Branch 1 not taken.
236 if (current->sps_pic_width_max_in_luma_samples > ctb_size_y)
1190
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 118 times.
236 us(wlen, sps_subpic_ctu_top_left_x[i], 0, win_right_edge_ctus - 1, 1, i);
1191 else
1192 infer(sps_subpic_ctu_top_left_x[i], 0);
1193
1194
1/2
✓ Branch 0 taken 118 times.
✗ Branch 1 not taken.
236 if (current->sps_pic_height_max_in_luma_samples > ctb_size_y)
1195
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 118 times.
236 us(hlen, sps_subpic_ctu_top_left_y[i], 0, win_bottom_edge_ctus - 1, 1, i);
1196 else
1197 infer(sps_subpic_ctu_top_left_y[i], 0);
1198
1199 236 max_width_minus1 = tmp_width_val - current->sps_subpic_ctu_top_left_x[i] - 1;
1200 236 max_height_minus1 = tmp_height_val - current->sps_subpic_ctu_top_left_y[i] - 1;
1201
1202
2/2
✓ Branch 0 taken 86 times.
✓ Branch 1 taken 32 times.
236 if (i < current->sps_num_subpics_minus1 &&
1203
1/2
✓ Branch 0 taken 86 times.
✗ Branch 1 not taken.
172 current->sps_pic_width_max_in_luma_samples > ctb_size_y) {
1204
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 86 times.
172 us(wlen, sps_subpic_width_minus1[i], min_width, max_width_minus1, 1, i);
1205 } else {
1206
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
64 infer(sps_subpic_width_minus1[i], max_width_minus1);
1207 }
1208
1209
2/2
✓ Branch 0 taken 86 times.
✓ Branch 1 taken 32 times.
236 if (i < current->sps_num_subpics_minus1 &&
1210
1/2
✓ Branch 0 taken 86 times.
✗ Branch 1 not taken.
172 current->sps_pic_height_max_in_luma_samples > ctb_size_y) {
1211
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 86 times.
172 us(hlen, sps_subpic_height_minus1[i], min_height, max_height_minus1, 1, i);
1212 } else {
1213
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
64 infer(sps_subpic_height_minus1[i], max_height_minus1);
1214 }
1215 } else {
1216 70 int num_subpic_cols = tmp_width_val /
1217 70 (current->sps_subpic_width_minus1[0] + 1);
1218
1/2
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
70 if (tmp_width_val % (current->sps_subpic_width_minus1[0] + 1) ||
1219
1/2
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
70 tmp_height_val % (current->sps_subpic_width_minus1[0] + 1) ||
1220 70 current->sps_num_subpics_minus1 !=
1221 70 (num_subpic_cols * tmp_height_val /
1222
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
70 (current->sps_subpic_height_minus1[0] + 1) - 1))
1223 return AVERROR_INVALIDDATA;
1224
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
70 infer(sps_subpic_ctu_top_left_x[i],
1225 (i % num_subpic_cols) *
1226 (current->sps_subpic_width_minus1[0] + 1));
1227
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
70 infer(sps_subpic_ctu_top_left_y[i],
1228 (i / num_subpic_cols) *
1229 (current->sps_subpic_height_minus1[0] + 1));
1230
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
70 infer(sps_subpic_width_minus1[i],
1231 current->sps_subpic_width_minus1[0]);
1232
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
70 infer(sps_subpic_height_minus1[i],
1233 current->sps_subpic_height_minus1[0]);
1234 }
1235
1/2
✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
306 if (!current->sps_independent_subpics_flag) {
1236
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 flags(sps_subpic_treated_as_pic_flag[i], 1, i);
1237
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 flags(sps_loop_filter_across_subpic_enabled_flag[i], 1, i);
1238 } else {
1239 infer(sps_subpic_treated_as_pic_flag[i], 1);
1240 infer(sps_loop_filter_across_subpic_enabled_flag[i], 0);
1241 }
1242 }
1243 } else {
1244 infer(sps_subpic_ctu_top_left_x[0], 0);
1245 infer(sps_subpic_ctu_top_left_y[0], 0);
1246 infer(sps_subpic_width_minus1[0], max_width_minus1);
1247 infer(sps_subpic_height_minus1[0], max_height_minus1);
1248 }
1249
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 ue(sps_subpic_id_len_minus1, 0, 15);
1250 74 if ((1 << (current->sps_subpic_id_len_minus1 + 1)) <
1251
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 37 times.
74 current->sps_num_subpics_minus1 + 1) {
1252 av_log(ctx->log_ctx, AV_LOG_ERROR,
1253 "sps_subpic_id_len_minus1(%d) is too small\n",
1254 current->sps_subpic_id_len_minus1);
1255 return AVERROR_INVALIDDATA;
1256 }
1257
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flag(sps_subpic_id_mapping_explicitly_signalled_flag);
1258
2/2
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 10 times.
74 if (current->sps_subpic_id_mapping_explicitly_signalled_flag) {
1259
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
54 flag(sps_subpic_id_mapping_present_flag);
1260
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 17 times.
54 if (current->sps_subpic_id_mapping_present_flag) {
1261
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 10 times.
120 for (i = 0; i <= current->sps_num_subpics_minus1; i++) {
1262
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
100 ubs(current->sps_subpic_id_len_minus1 + 1,
1263 sps_subpic_id[i], 1, i);
1264 }
1265 }
1266 }
1267 } else {
1268
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2418 infer(sps_num_subpics_minus1, 0);
1269
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2418 infer(sps_independent_subpics_flag, 1);
1270
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2418 infer(sps_subpic_same_size_flag, 0);
1271
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2418 infer(sps_subpic_id_mapping_explicitly_signalled_flag, 0);
1272
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2418 infer(sps_subpic_ctu_top_left_x[0], 0);
1273
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2418 infer(sps_subpic_ctu_top_left_y[0], 0);
1274
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2418 infer(sps_subpic_width_minus1[0], max_width_minus1);
1275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2418 infer(sps_subpic_height_minus1[0], max_height_minus1);
1276 }
1277
1278
1279
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_bitdepth_minus8, 0, 8);
1280 2492 qp_bd_offset = 6 * current->sps_bitdepth_minus8;
1281
1282
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_entropy_coding_sync_enabled_flag);
1283
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_entry_point_offsets_present_flag);
1284
1285
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 u(4, sps_log2_max_pic_order_cnt_lsb_minus4, 0, 12);
1286
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_poc_msb_cycle_flag);
1287
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1229 times.
2492 if (current->sps_poc_msb_cycle_flag)
1288
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(sps_poc_msb_cycle_len_minus1,
1289 0, 32 - current->sps_log2_max_pic_order_cnt_lsb_minus4 - 5);
1290
1291
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 u(2, sps_num_extra_ph_bytes, 0, 2);
1292
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1246 times.
2492 for (i = 0; i < (current->sps_num_extra_ph_bytes * 8); i++) {
1293 flags(sps_extra_ph_bit_present_flag[i], 1, i);
1294 }
1295
1296
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 u(2, sps_num_extra_sh_bytes, 0, 2);
1297
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1246 times.
2492 for (i = 0; i < (current->sps_num_extra_sh_bytes * 8); i++) {
1298 flags(sps_extra_sh_bit_present_flag[i], 1, i);
1299 }
1300
1301
1/2
✓ Branch 0 taken 1246 times.
✗ Branch 1 not taken.
2492 if (current->sps_ptl_dpb_hrd_params_present_flag) {
1302
2/2
✓ Branch 0 taken 350 times.
✓ Branch 1 taken 896 times.
2492 if (current->sps_max_sublayers_minus1 > 0)
1303
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 350 times.
700 flag(sps_sublayer_dpb_params_flag);
1304 else
1305
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 275 times.
1792 infer(sps_sublayer_dpb_params_flag, 0);
1306
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 CHECK(FUNC(dpb_parameters) (ctx, rw, &current->sps_dpb_params,
1307 current->sps_max_sublayers_minus1,
1308 current->sps_sublayer_dpb_params_flag));
1309 }
1310
1311
3/4
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1229 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1246 times.
2492 ue(sps_log2_min_luma_coding_block_size_minus2,
1312 0, FFMIN(4, current->sps_log2_ctu_size_minus5 + 3));
1313 2492 min_cb_log2_size_y =
1314 2492 current->sps_log2_min_luma_coding_block_size_minus2 + 2;
1315
1316
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_partition_constraints_override_enabled_flag);
1317
1318
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_log2_diff_min_qt_min_cb_intra_slice_luma,
1319 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
1320 2492 min_qt_log2_size_intra_y =
1321 2492 current->sps_log2_diff_min_qt_min_cb_intra_slice_luma +
1322 min_cb_log2_size_y;
1323
1324
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_max_mtt_hierarchy_depth_intra_slice_luma,
1325 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
1326
1327
2/2
✓ Branch 0 taken 1237 times.
✓ Branch 1 taken 9 times.
2492 if (current->sps_max_mtt_hierarchy_depth_intra_slice_luma != 0) {
1328
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1237 times.
2474 ue(sps_log2_diff_max_bt_min_qt_intra_slice_luma,
1329 0, ctb_log2_size_y - min_qt_log2_size_intra_y);
1330
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1237 times.
2474 ue(sps_log2_diff_max_tt_min_qt_intra_slice_luma,
1331 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_y);
1332 } else {
1333
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
18 infer(sps_log2_diff_max_bt_min_qt_intra_slice_luma, 0);
1334
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
18 infer(sps_log2_diff_max_tt_min_qt_intra_slice_luma, 0);
1335 }
1336
1337
2/2
✓ Branch 0 taken 1229 times.
✓ Branch 1 taken 17 times.
2492 if (current->sps_chroma_format_idc != 0) {
1338
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1229 times.
2458 flag(sps_qtbtt_dual_tree_intra_flag);
1339 } else {
1340
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_qtbtt_dual_tree_intra_flag, 0);
1341 }
1342
1343
2/2
✓ Branch 0 taken 448 times.
✓ Branch 1 taken 798 times.
2492 if (current->sps_qtbtt_dual_tree_intra_flag) {
1344
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 448 times.
896 ue(sps_log2_diff_min_qt_min_cb_intra_slice_chroma,
1345 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
1346
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 448 times.
896 ue(sps_max_mtt_hierarchy_depth_intra_slice_chroma,
1347 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
1348
1/2
✓ Branch 0 taken 448 times.
✗ Branch 1 not taken.
896 if (current->sps_max_mtt_hierarchy_depth_intra_slice_chroma != 0) {
1349 896 unsigned int min_qt_log2_size_intra_c =
1350 896 current->sps_log2_diff_min_qt_min_cb_intra_slice_chroma +
1351 min_cb_log2_size_y;
1352
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 448 times.
896 ue(sps_log2_diff_max_bt_min_qt_intra_slice_chroma,
1353 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_c);
1354
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 448 times.
896 ue(sps_log2_diff_max_tt_min_qt_intra_slice_chroma,
1355 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_c);
1356 }
1357 } else {
1358
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1596 infer(sps_log2_diff_min_qt_min_cb_intra_slice_chroma, 0);
1359
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1596 infer(sps_max_mtt_hierarchy_depth_intra_slice_chroma, 0);
1360 }
1361
2/2
✓ Branch 0 taken 798 times.
✓ Branch 1 taken 448 times.
2492 if (current->sps_max_mtt_hierarchy_depth_intra_slice_chroma == 0) {
1362
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1596 infer(sps_log2_diff_max_bt_min_qt_intra_slice_chroma, 0);
1363
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1596 infer(sps_log2_diff_max_tt_min_qt_intra_slice_chroma, 0);
1364 }
1365
1366
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_log2_diff_min_qt_min_cb_inter_slice,
1367 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
1368 2492 min_qt_log2_size_inter_y =
1369 2492 current->sps_log2_diff_min_qt_min_cb_inter_slice + min_cb_log2_size_y;
1370
1371
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_max_mtt_hierarchy_depth_inter_slice,
1372 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
1373
2/2
✓ Branch 0 taken 1237 times.
✓ Branch 1 taken 9 times.
2492 if (current->sps_max_mtt_hierarchy_depth_inter_slice != 0) {
1374
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1237 times.
2474 ue(sps_log2_diff_max_bt_min_qt_inter_slice,
1375 0, ctb_log2_size_y - min_qt_log2_size_inter_y);
1376
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1237 times.
2474 ue(sps_log2_diff_max_tt_min_qt_inter_slice,
1377 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_inter_y);
1378 } else {
1379
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
18 infer(sps_log2_diff_max_bt_min_qt_inter_slice, 0);
1380
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
18 infer(sps_log2_diff_max_tt_min_qt_inter_slice, 0);
1381 }
1382
1383
2/2
✓ Branch 0 taken 1229 times.
✓ Branch 1 taken 17 times.
2492 if (ctb_size_y > 32)
1384
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1229 times.
2458 flag(sps_max_luma_transform_size_64_flag);
1385 else
1386
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_max_luma_transform_size_64_flag, 0);
1387
1388
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_transform_skip_enabled_flag);
1389
2/2
✓ Branch 0 taken 443 times.
✓ Branch 1 taken 803 times.
2492 if (current->sps_transform_skip_enabled_flag) {
1390
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 443 times.
886 ue(sps_log2_transform_skip_max_size_minus2, 0, 3);
1391
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 443 times.
886 flag(sps_bdpcm_enabled_flag);
1392 }
1393
1394
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_mts_enabled_flag);
1395
2/2
✓ Branch 0 taken 457 times.
✓ Branch 1 taken 789 times.
2492 if (current->sps_mts_enabled_flag) {
1396
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 457 times.
914 flag(sps_explicit_mts_intra_enabled_flag);
1397
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 457 times.
914 flag(sps_explicit_mts_inter_enabled_flag);
1398 } else {
1399
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(sps_explicit_mts_intra_enabled_flag, 0);
1400
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(sps_explicit_mts_inter_enabled_flag, 0);
1401 }
1402
1403
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_lfnst_enabled_flag);
1404
1405
2/2
✓ Branch 0 taken 1229 times.
✓ Branch 1 taken 17 times.
2492 if (current->sps_chroma_format_idc != 0) {
1406 uint8_t num_qp_tables;
1407
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1229 times.
2458 flag(sps_joint_cbcr_enabled_flag);
1408
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1229 times.
2458 flag(sps_same_qp_table_for_chroma_flag);
1409
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 1217 times.
2482 num_qp_tables = current->sps_same_qp_table_for_chroma_flag ?
1410
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
24 1 : (current->sps_joint_cbcr_enabled_flag ? 3 : 2);
1411
2/2
✓ Branch 0 taken 1253 times.
✓ Branch 1 taken 1229 times.
4964 for (i = 0; i < num_qp_tables; i++) {
1412
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1253 times.
2506 ses(sps_qp_table_start_minus26[i], -26 - qp_bd_offset, 36, 1, i);
1413
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1253 times.
2506 ues(sps_num_points_in_qp_table_minus1[i],
1414 0, 36 - current->sps_qp_table_start_minus26[i], 1, i);
1415
2/2
✓ Branch 0 taken 2255 times.
✓ Branch 1 taken 1253 times.
7016 for (j = 0; j <= current->sps_num_points_in_qp_table_minus1[i]; j++) {
1416 4510 uint8_t max = MAX_UINT_BITS(8);
1417
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2255 times.
4510 ues(sps_delta_qp_in_val_minus1[i][j], 0, max, 2, i, j);
1418
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2255 times.
4510 ues(sps_delta_qp_diff_val[i][j], 0, max, 2, i, j);
1419 }
1420 }
1421 } else {
1422
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_joint_cbcr_enabled_flag, 0);
1423
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_same_qp_table_for_chroma_flag, 0);
1424 }
1425
1426
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_sao_enabled_flag);
1427
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_alf_enabled_flag);
1428
4/4
✓ Branch 0 taken 409 times.
✓ Branch 1 taken 837 times.
✓ Branch 2 taken 392 times.
✓ Branch 3 taken 17 times.
2492 if (current->sps_alf_enabled_flag && current->sps_chroma_format_idc)
1429
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 392 times.
784 flag(sps_ccalf_enabled_flag);
1430 else
1431
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 271 times.
1708 infer(sps_ccalf_enabled_flag, 0);
1432
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_lmcs_enabled_flag);
1433
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_weighted_pred_flag);
1434
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_weighted_bipred_flag);
1435
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_long_term_ref_pics_flag);
1436
2/2
✓ Branch 0 taken 35 times.
✓ Branch 1 taken 1211 times.
2492 if (current->sps_video_parameter_set_id > 0)
1437
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
70 flag(sps_inter_layer_prediction_enabled_flag);
1438 else
1439
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 329 times.
2422 infer(sps_inter_layer_prediction_enabled_flag, 0);
1440
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_idr_rpl_present_flag);
1441
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_rpl1_same_as_rpl0_flag);
1442
1443
4/4
✓ Branch 0 taken 180 times.
✓ Branch 1 taken 3468 times.
✓ Branch 2 taken 2402 times.
✓ Branch 3 taken 1246 times.
7296 for (i = 0; i < (current->sps_rpl1_same_as_rpl0_flag ? 1 : 2); i++) {
1444
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2402 times.
4804 ues(sps_num_ref_pic_lists[i], 0, VVC_MAX_REF_PIC_LISTS, 1, i);
1445
2/2
✓ Branch 0 taken 58001 times.
✓ Branch 1 taken 2402 times.
120806 for (j = 0; j < current->sps_num_ref_pic_lists[i]; j++)
1446
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 58001 times.
116002 CHECK(FUNC(ref_pic_list_struct) (ctx, rw,
1447 &current->
1448 sps_ref_pic_list_struct[i][j], i,
1449 j, current));
1450 }
1451
1452
2/2
✓ Branch 0 taken 90 times.
✓ Branch 1 taken 1156 times.
2492 if (current->sps_rpl1_same_as_rpl0_flag) {
1453 180 current->sps_num_ref_pic_lists[1] = current->sps_num_ref_pic_lists[0];
1454
2/2
✓ Branch 0 taken 1287 times.
✓ Branch 1 taken 90 times.
2754 for (j = 0; j < current->sps_num_ref_pic_lists[0]; j++)
1455 2574 memcpy(&current->sps_ref_pic_list_struct[1][j],
1456 2574 &current->sps_ref_pic_list_struct[0][j],
1457 sizeof(current->sps_ref_pic_list_struct[0][j]));
1458 }
1459
1460
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_ref_wraparound_enabled_flag);
1461
1462
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_temporal_mvp_enabled_flag);
1463
1/2
✓ Branch 0 taken 1246 times.
✗ Branch 1 not taken.
2492 if (current->sps_temporal_mvp_enabled_flag)
1464
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_sbtmvp_enabled_flag);
1465 else
1466 infer(sps_sbtmvp_enabled_flag, 0);
1467
1468
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_amvr_enabled_flag);
1469
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_bdof_enabled_flag);
1470
2/2
✓ Branch 0 taken 350 times.
✓ Branch 1 taken 896 times.
2492 if (current->sps_bdof_enabled_flag)
1471
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 350 times.
700 flag(sps_bdof_control_present_in_ph_flag);
1472 else
1473
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 275 times.
1792 infer(sps_bdof_control_present_in_ph_flag, 0);
1474
1475
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_smvd_enabled_flag);
1476
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_dmvr_enabled_flag);
1477
2/2
✓ Branch 0 taken 333 times.
✓ Branch 1 taken 913 times.
2492 if (current->sps_dmvr_enabled_flag)
1478
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 333 times.
666 flag(sps_dmvr_control_present_in_ph_flag);
1479 else
1480
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 278 times.
1826 infer(sps_dmvr_control_present_in_ph_flag, 0);
1481
1482
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_mmvd_enabled_flag);
1483
2/2
✓ Branch 0 taken 1220 times.
✓ Branch 1 taken 26 times.
2492 if (current->sps_mmvd_enabled_flag)
1484
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1220 times.
2440 flag(sps_mmvd_fullpel_only_enabled_flag);
1485 else
1486
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
52 infer(sps_mmvd_fullpel_only_enabled_flag, 0);
1487
1488
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_six_minus_max_num_merge_cand, 0, 5);
1489 2492 max_num_merge_cand = 6 - current->sps_six_minus_max_num_merge_cand;
1490
1491
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_sbt_enabled_flag);
1492
1493
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_affine_enabled_flag);
1494
2/2
✓ Branch 0 taken 457 times.
✓ Branch 1 taken 789 times.
2492 if (current->sps_affine_enabled_flag) {
1495
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 457 times.
914 ue(sps_five_minus_max_num_subblock_merge_cand,
1496 0, 5 - current->sps_sbtmvp_enabled_flag);
1497
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 457 times.
914 flag(sps_6param_affine_enabled_flag);
1498
1/2
✓ Branch 0 taken 457 times.
✗ Branch 1 not taken.
914 if (current->sps_amvr_enabled_flag)
1499
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 457 times.
914 flag(sps_affine_amvr_enabled_flag);
1500 else
1501 infer(sps_affine_amvr_enabled_flag, 0);
1502
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 457 times.
914 flag(sps_affine_prof_enabled_flag);
1503
2/2
✓ Branch 0 taken 448 times.
✓ Branch 1 taken 9 times.
914 if (current->sps_affine_prof_enabled_flag)
1504
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 448 times.
896 flag(sps_prof_control_present_in_ph_flag);
1505 else
1506
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
18 infer(sps_prof_control_present_in_ph_flag, 0);
1507 } else {
1508
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(sps_6param_affine_enabled_flag, 0);
1509
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(sps_affine_amvr_enabled_flag, 0);
1510
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(sps_affine_prof_enabled_flag, 0);
1511
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(sps_prof_control_present_in_ph_flag, 0);
1512 }
1513
1514
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_bcw_enabled_flag);
1515
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_ciip_enabled_flag);
1516
1517
1/2
✓ Branch 0 taken 1246 times.
✗ Branch 1 not taken.
2492 if (max_num_merge_cand >= 2) {
1518
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_gpm_enabled_flag);
1519
3/4
✓ Branch 0 taken 414 times.
✓ Branch 1 taken 832 times.
✓ Branch 2 taken 414 times.
✗ Branch 3 not taken.
2492 if (current->sps_gpm_enabled_flag && max_num_merge_cand >= 3)
1520
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 414 times.
828 ue(sps_max_num_merge_cand_minus_max_num_gpm_cand,
1521 0, max_num_merge_cand - 2);
1522 } else {
1523 infer(sps_gpm_enabled_flag, 0);
1524 }
1525
1526
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 ue(sps_log2_parallel_merge_level_minus2, 0, ctb_log2_size_y - 2);
1527
1528
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_isp_enabled_flag);
1529
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_mrl_enabled_flag);
1530
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_mip_enabled_flag);
1531
1532
2/2
✓ Branch 0 taken 1229 times.
✓ Branch 1 taken 17 times.
2492 if (current->sps_chroma_format_idc != 0)
1533
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1229 times.
2458 flag(sps_cclm_enabled_flag);
1534 else
1535
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_cclm_enabled_flag, 0);
1536
2/2
✓ Branch 0 taken 1212 times.
✓ Branch 1 taken 34 times.
2492 if (current->sps_chroma_format_idc == 1) {
1537
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1212 times.
2424 flag(sps_chroma_horizontal_collocated_flag);
1538
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1212 times.
2424 flag(sps_chroma_vertical_collocated_flag);
1539 } else {
1540
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
68 infer(sps_chroma_horizontal_collocated_flag, 1);
1541
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
68 infer(sps_chroma_vertical_collocated_flag, 1);
1542 }
1543
1544
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_palette_enabled_flag);
1545
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1229 times.
2492 if (current->sps_chroma_format_idc == 3 &&
1546
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
34 !current->sps_max_luma_transform_size_64_flag)
1547 flag(sps_act_enabled_flag);
1548 else
1549
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_act_enabled_flag, 0);
1550
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 443 times.
2492 if (current->sps_transform_skip_enabled_flag ||
1551
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 803 times.
1606 current->sps_palette_enabled_flag)
1552
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 443 times.
886 ue(sps_min_qp_prime_ts, 0, 8);
1553
1554
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_ibc_enabled_flag);
1555
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1236 times.
2492 if (current->sps_ibc_enabled_flag)
1556
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
20 ue(sps_six_minus_max_num_ibc_merge_cand, 0, 5);
1557
1558
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_ladf_enabled_flag);
1559
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1241 times.
2492 if (current->sps_ladf_enabled_flag) {
1560
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ub(2, sps_num_ladf_intervals_minus2);
1561
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 se(sps_ladf_lowest_interval_qp_offset, -63, 63);
1562
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 5 times.
30 for (i = 0; i < current->sps_num_ladf_intervals_minus2 + 1; i++) {
1563
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
20 ses(sps_ladf_qp_offset[i], -63, 63, 1, i);
1564
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
20 ues(sps_ladf_delta_threshold_minus1[i],
1565 0, (2 << (8 + current->sps_bitdepth_minus8)) - 3, 1, i);
1566 }
1567 }
1568
1569
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_explicit_scaling_list_enabled_flag);
1570
2/2
✓ Branch 0 taken 350 times.
✓ Branch 1 taken 896 times.
2492 if (current->sps_lfnst_enabled_flag &&
1571
2/2
✓ Branch 0 taken 39 times.
✓ Branch 1 taken 311 times.
700 current->sps_explicit_scaling_list_enabled_flag)
1572
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 flag(sps_scaling_matrix_for_lfnst_disabled_flag);
1573
1574
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1246 times.
2492 if (current->sps_act_enabled_flag &&
1575 current->sps_explicit_scaling_list_enabled_flag)
1576 flag(sps_scaling_matrix_for_alternative_colour_space_disabled_flag);
1577 else
1578
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_scaling_matrix_for_alternative_colour_space_disabled_flag, 0);
1579
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1246 times.
2492 if (current->sps_scaling_matrix_for_alternative_colour_space_disabled_flag)
1580 flag(sps_scaling_matrix_designated_colour_space_flag);
1581
1582
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_dep_quant_enabled_flag);
1583
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_sign_data_hiding_enabled_flag);
1584
1585
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_virtual_boundaries_enabled_flag);
1586
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1241 times.
2492 if (current->sps_virtual_boundaries_enabled_flag) {
1587
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 flag(sps_virtual_boundaries_present_flag);
1588
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
10 if (current->sps_virtual_boundaries_present_flag) {
1589
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
10 ue(sps_num_ver_virtual_boundaries,
1590 0, current->sps_pic_width_max_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS);
1591
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
10 for (i = 0; i < current->sps_num_ver_virtual_boundaries; i++)
1592 ues(sps_virtual_boundary_pos_x_minus1[i],
1593 0, (current->sps_pic_width_max_in_luma_samples + 7) / 8 - 2,
1594 1, i);
1595
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
10 ue(sps_num_hor_virtual_boundaries,
1596 0, current->sps_pic_height_max_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS);
1597
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
10 for (i = 0; i < current->sps_num_hor_virtual_boundaries; i++)
1598 ues(sps_virtual_boundary_pos_y_minus1[i],
1599 0, (current->sps_pic_height_max_in_luma_samples + 7) /
1600 8 - 2, 1, i);
1601 }
1602 } else {
1603
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2482 infer(sps_virtual_boundaries_present_flag, 0);
1604
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2482 infer(sps_num_ver_virtual_boundaries, 0);
1605
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2482 infer(sps_num_hor_virtual_boundaries, 0);
1606 }
1607
1608
1/2
✓ Branch 0 taken 1246 times.
✗ Branch 1 not taken.
2492 if (current->sps_ptl_dpb_hrd_params_present_flag) {
1609
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_timing_hrd_params_present_flag);
1610
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1229 times.
2492 if (current->sps_timing_hrd_params_present_flag) {
1611 uint8_t first_sublayer;
1612
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 CHECK(FUNC(general_timing_hrd_parameters) (ctx, rw,
1613 &current->sps_general_timing_hrd_parameters));
1614
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
34 if (current->sps_max_sublayers_minus1 > 0)
1615
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 flag(sps_sublayer_cpb_params_present_flag);
1616 else
1617 infer(sps_sublayer_cpb_params_present_flag, 0);
1618
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
34 first_sublayer = current->sps_sublayer_cpb_params_present_flag ?
1619 0 : current->sps_max_sublayers_minus1;
1620
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 CHECK(FUNC(ols_timing_hrd_parameters) (ctx, rw,
1621 &current->sps_ols_timing_hrd_parameters, first_sublayer,
1622 current->sps_max_sublayers_minus1,
1623 &current->sps_general_timing_hrd_parameters));
1624 }
1625 }
1626
1627
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_field_seq_flag);
1628
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_vui_parameters_present_flag);
1629
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 1220 times.
2492 if (current->sps_vui_parameters_present_flag) {
1630
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ue(sps_vui_payload_size_minus1, 0, 1023);
1631
2/2
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 26 times.
244 while (byte_alignment(rw) != 0)
1632
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 96 times.
192 fixed(1, sps_vui_alignment_zero_bit, 0);
1633
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 CHECK(FUNC(vui_payload) (ctx, rw, &current->vui,
1634 current->sps_vui_payload_size_minus1 + 1,
1635 current->sps_chroma_format_idc));
1636 } else {
1637
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1220 times.
2440 CHECK(FUNC(vui_parameters_default) (ctx, rw, &current->vui));
1638 }
1639
1640
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 flag(sps_extension_flag);
1641
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1246 times.
2492 if (current->sps_extension_flag) {
1642 flag(sps_range_extension_flag);
1643 ub(7, sps_extension_7bits);
1644
1645 if (current->sps_range_extension_flag) {
1646 if (current->sps_bitdepth_minus8 <= 10 - 8)
1647 return AVERROR_INVALIDDATA;
1648 CHECK(FUNC(sps_range_extension)(ctx, rw, current));
1649 } else {
1650 infer(sps_extended_precision_flag, 0);
1651 infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0);
1652 infer(sps_rrc_rice_extension_flag, 0);
1653 infer(sps_persistent_rice_adaptation_enabled_flag, 0);
1654 infer(sps_reverse_last_sig_coeff_enabled_flag, 0);
1655 }
1656 } else {
1657
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_range_extension_flag, 0);
1658
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_extension_7bits, 0);
1659
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_extended_precision_flag, 0);
1660
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0);
1661
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_rrc_rice_extension_flag, 0);
1662
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_persistent_rice_adaptation_enabled_flag, 0);
1663
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2492 infer(sps_reverse_last_sig_coeff_enabled_flag, 0);
1664 }
1665
1666
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1246 times.
2492 if (current->sps_extension_7bits)
1667 CHECK(FUNC(extension_data)(ctx, rw, &current->extension_data));
1668
1669
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1246 times.
2492 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
1670
1671 2492 return 0;
1672 }
1673
1674 3754 static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
1675 H266RawPPS *current)
1676 {
1677 3754 CodedBitstreamH266Context *h266 = ctx->priv_data;
1678 const H266RawSPS *sps;
1679 int err, i;
1680 unsigned int min_cb_size_y, divisor, ctb_size_y,
1681 pic_width_in_ctbs_y, pic_height_in_ctbs_y;
1682 uint8_t sub_width_c, sub_height_c, qp_bd_offset;
1683
1684 static const uint8_t h266_sub_width_c[] = {
1685 1, 2, 2, 1
1686 };
1687 static const uint8_t h266_sub_height_c[] = {
1688 1, 2, 1, 1
1689 };
1690
1691 3754 HEADER("Picture Parameter Set");
1692
1693
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 CHECK(FUNC(nal_unit_header) (ctx, rw,
1694 &current->nal_unit_header, VVC_PPS_NUT));
1695
1696
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 ub(6, pps_pic_parameter_set_id);
1697
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 ub(4, pps_seq_parameter_set_id);
1698 3754 sps = h266->sps[current->pps_seq_parameter_set_id];
1699
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1877 times.
3754 if (!sps) {
1700 av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n",
1701 current->pps_seq_parameter_set_id);
1702 return AVERROR_INVALIDDATA;
1703 }
1704
1705
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_mixed_nalu_types_in_pic_flag);
1706
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 ue(pps_pic_width_in_luma_samples,
1707 1, sps->sps_pic_width_max_in_luma_samples);
1708
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 ue(pps_pic_height_in_luma_samples,
1709 1, sps->sps_pic_height_max_in_luma_samples);
1710
1711 3754 min_cb_size_y = 1 << (sps->sps_log2_min_luma_coding_block_size_minus2 + 2);
1712 3754 divisor = FFMAX(min_cb_size_y, 8);
1713
1/2
✓ Branch 0 taken 1877 times.
✗ Branch 1 not taken.
3754 if (current->pps_pic_width_in_luma_samples % divisor ||
1714
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1877 times.
3754 current->pps_pic_height_in_luma_samples % divisor) {
1715 av_log(ctx->log_ctx, AV_LOG_ERROR,
1716 "Invalid dimensions: %ux%u not divisible "
1717 "by %u, MinCbSizeY = %u.\n",
1718 current->pps_pic_width_in_luma_samples,
1719 current->pps_pic_height_in_luma_samples, divisor, min_cb_size_y);
1720 return AVERROR_INVALIDDATA;
1721 }
1722
2/2
✓ Branch 0 taken 1870 times.
✓ Branch 1 taken 7 times.
3754 if (!sps->sps_res_change_in_clvs_allowed_flag &&
1723 3740 (current->pps_pic_width_in_luma_samples !=
1724
1/2
✓ Branch 0 taken 1870 times.
✗ Branch 1 not taken.
3740 sps->sps_pic_width_max_in_luma_samples ||
1725 3740 current->pps_pic_height_in_luma_samples !=
1726
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1870 times.
3740 sps->sps_pic_height_max_in_luma_samples)) {
1727 av_log(ctx->log_ctx, AV_LOG_ERROR,
1728 "Resoltuion change is not allowed, "
1729 "in max resolution (%ux%u) mismatched with pps(%ux%u).\n",
1730 sps->sps_pic_width_max_in_luma_samples,
1731 sps->sps_pic_height_max_in_luma_samples,
1732 current->pps_pic_width_in_luma_samples,
1733 current->pps_pic_height_in_luma_samples);
1734 return AVERROR_INVALIDDATA;
1735 }
1736
1737 3754 ctb_size_y = 1 << (sps->sps_log2_ctu_size_minus5 + 5);
1738
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 1865 times.
3754 if (sps->sps_ref_wraparound_enabled_flag) {
1739 24 if ((ctb_size_y / min_cb_size_y + 1) >
1740
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
24 (current->pps_pic_width_in_luma_samples / min_cb_size_y - 1)) {
1741 av_log(ctx->log_ctx, AV_LOG_ERROR,
1742 "Invalid width(%u), ctb_size_y = %u, min_cb_size_y = %u.\n",
1743 current->pps_pic_width_in_luma_samples,
1744 ctb_size_y, min_cb_size_y);
1745 return AVERROR_INVALIDDATA;
1746 }
1747 }
1748
1749
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_conformance_window_flag);
1750 3754 if (current->pps_pic_width_in_luma_samples ==
1751
2/2
✓ Branch 0 taken 1872 times.
✓ Branch 1 taken 5 times.
3754 sps->sps_pic_width_max_in_luma_samples &&
1752 3744 current->pps_pic_height_in_luma_samples ==
1753
1/2
✓ Branch 0 taken 1872 times.
✗ Branch 1 not taken.
3744 sps->sps_pic_height_max_in_luma_samples &&
1754
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1872 times.
3744 current->pps_conformance_window_flag) {
1755 av_log(ctx->log_ctx, AV_LOG_ERROR,
1756 "Conformance window flag should not true.\n");
1757 return AVERROR_INVALIDDATA;
1758 }
1759
1760 3754 sub_width_c = h266_sub_width_c[sps->sps_chroma_format_idc];
1761 3754 sub_height_c = h266_sub_height_c[sps->sps_chroma_format_idc];
1762
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1877 times.
3754 if (current->pps_conformance_window_flag) {
1763 ue(pps_conf_win_left_offset, 0, current->pps_pic_width_in_luma_samples);
1764 ue(pps_conf_win_right_offset,
1765 0, current->pps_pic_width_in_luma_samples);
1766 ue(pps_conf_win_top_offset, 0, current->pps_pic_height_in_luma_samples);
1767 ue(pps_conf_win_bottom_offset,
1768 0, current->pps_pic_height_in_luma_samples);
1769 if (sub_width_c *
1770 (current->pps_conf_win_left_offset +
1771 current->pps_conf_win_right_offset) >=
1772 current->pps_pic_width_in_luma_samples ||
1773 sub_height_c *
1774 (current->pps_conf_win_top_offset +
1775 current->pps_conf_win_bottom_offset) >=
1776 current->pps_pic_height_in_luma_samples) {
1777 av_log(ctx->log_ctx, AV_LOG_ERROR,
1778 "Invalid pps conformance window: (%u, %u, %u, %u), "
1779 "resolution is %ux%u, sub wxh is %ux%u.\n",
1780 current->pps_conf_win_left_offset,
1781 current->pps_conf_win_right_offset,
1782 current->pps_conf_win_top_offset,
1783 current->pps_conf_win_bottom_offset,
1784 current->pps_pic_width_in_luma_samples,
1785 current->pps_pic_height_in_luma_samples,
1786 sub_width_c, sub_height_c);
1787 return AVERROR_INVALIDDATA;
1788 }
1789 } else {
1790 3754 if (current->pps_pic_width_in_luma_samples ==
1791
2/2
✓ Branch 0 taken 1872 times.
✓ Branch 1 taken 5 times.
3754 sps->sps_pic_width_max_in_luma_samples &&
1792 3744 current->pps_pic_height_in_luma_samples ==
1793
1/2
✓ Branch 0 taken 1872 times.
✗ Branch 1 not taken.
3744 sps->sps_pic_height_max_in_luma_samples) {
1794
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3744 infer(pps_conf_win_left_offset, sps->sps_conf_win_left_offset);
1795
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3744 infer(pps_conf_win_right_offset, sps->sps_conf_win_right_offset);
1796
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3744 infer(pps_conf_win_top_offset, sps->sps_conf_win_top_offset);
1797
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3744 infer(pps_conf_win_bottom_offset, sps->sps_conf_win_bottom_offset);
1798 } else {
1799
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(pps_conf_win_left_offset, 0);
1800
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(pps_conf_win_right_offset, 0);
1801
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(pps_conf_win_top_offset, 0);
1802
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(pps_conf_win_bottom_offset, 0);
1803 }
1804
1805 }
1806
1807
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_scaling_window_explicit_signalling_flag);
1808
2/2
✓ Branch 0 taken 367 times.
✓ Branch 1 taken 1510 times.
3754 if (!sps->sps_ref_pic_resampling_enabled_flag &&
1809
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 367 times.
734 current->pps_scaling_window_explicit_signalling_flag) {
1810 av_log(ctx->log_ctx, AV_LOG_ERROR,
1811 "Invalid data: sps_ref_pic_resampling_enabled_flag is false, "
1812 "but pps_scaling_window_explicit_signalling_flag is true.\n");
1813 return AVERROR_INVALIDDATA;
1814 }
1815
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1877 times.
3754 if (current->pps_scaling_window_explicit_signalling_flag) {
1816 se(pps_scaling_win_left_offset,
1817 -current->pps_pic_width_in_luma_samples * 15 / sub_width_c,
1818 current->pps_pic_width_in_luma_samples / sub_width_c);
1819 se(pps_scaling_win_right_offset,
1820 -current->pps_pic_width_in_luma_samples * 15 / sub_width_c,
1821 current->pps_pic_width_in_luma_samples / sub_width_c);
1822 se(pps_scaling_win_top_offset,
1823 -current->pps_pic_height_in_luma_samples * 15 / sub_height_c,
1824 current->pps_pic_height_in_luma_samples / sub_height_c);
1825 se(pps_scaling_win_bottom_offset,
1826 -current->pps_pic_height_in_luma_samples * 15 / sub_height_c,
1827 current->pps_pic_height_in_luma_samples / sub_height_c);
1828 } else {
1829
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3754 infer(pps_scaling_win_left_offset, current->pps_conf_win_left_offset);
1830
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3754 infer(pps_scaling_win_right_offset, current->pps_conf_win_right_offset);
1831
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3754 infer(pps_scaling_win_top_offset, current->pps_conf_win_top_offset);
1832
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3754 infer(pps_scaling_win_bottom_offset, current->pps_conf_win_bottom_offset);
1833 }
1834
1835
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_output_flag_present_flag);
1836
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_no_pic_partition_flag);
1837
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_subpic_id_mapping_present_flag);
1838
1839
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1860 times.
3754 if (current->pps_subpic_id_mapping_present_flag) {
1840
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
34 if (!current->pps_no_pic_partition_flag) {
1841
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(pps_num_subpics_minus1,
1842 sps->sps_num_subpics_minus1, sps->sps_num_subpics_minus1);
1843 } else {
1844 infer(pps_num_subpics_minus1, 0);
1845 }
1846
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(pps_subpic_id_len_minus1, sps->sps_subpic_id_len_minus1,
1847 sps->sps_subpic_id_len_minus1);
1848
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 17 times.
204 for (i = 0; i <= current->pps_num_subpics_minus1; i++) {
1849
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 85 times.
170 ubs(sps->sps_subpic_id_len_minus1 + 1, pps_subpic_id[i], 1, i);
1850 }
1851 }
1852
1853
2/2
✓ Branch 0 taken 2736 times.
✓ Branch 1 taken 1877 times.
9226 for (i = 0; i <= sps->sps_num_subpics_minus1; i++) {
1854
2/2
✓ Branch 0 taken 135 times.
✓ Branch 1 taken 2601 times.
5472 if (sps->sps_subpic_id_mapping_explicitly_signalled_flag)
1855
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 50 times.
370 current->sub_pic_id_val[i] = current->pps_subpic_id_mapping_present_flag
1856 ? current->pps_subpic_id[i]
1857 100 : sps->sps_subpic_id[i];
1858 else
1859 5202 current->sub_pic_id_val[i] = i;
1860 }
1861
1862 3754 pic_width_in_ctbs_y = AV_CEIL_RSHIFT
1863 (current->pps_pic_width_in_luma_samples, (sps->sps_log2_ctu_size_minus5 + 5));
1864 3754 pic_height_in_ctbs_y = AV_CEIL_RSHIFT(
1865 current->pps_pic_height_in_luma_samples,(sps->sps_log2_ctu_size_minus5 + 5));
1866
2/2
✓ Branch 0 taken 422 times.
✓ Branch 1 taken 1455 times.
3754 if (!current->pps_no_pic_partition_flag) {
1867 844 unsigned int exp_tile_width = 0, exp_tile_height = 0;
1868 unsigned int unified_size, remaining_size;
1869
1870
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 422 times.
844 u(2, pps_log2_ctu_size_minus5,
1871 sps->sps_log2_ctu_size_minus5, sps->sps_log2_ctu_size_minus5);
1872
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 422 times.
844 ue(pps_num_exp_tile_columns_minus1,
1873 0, FFMIN(pic_width_in_ctbs_y - 1, VVC_MAX_TILE_COLUMNS - 1));
1874
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 422 times.
844 ue(pps_num_exp_tile_rows_minus1,
1875 0, FFMIN(pic_height_in_ctbs_y - 1, VVC_MAX_TILE_ROWS - 1));
1876
1877
2/2
✓ Branch 0 taken 875 times.
✓ Branch 1 taken 422 times.
2594 for (i = 0; i <= current->pps_num_exp_tile_columns_minus1; i++) {
1878
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 875 times.
1750 ues(pps_tile_column_width_minus1[i],
1879 0, pic_width_in_ctbs_y - exp_tile_width - 1, 1, i);
1880 1750 exp_tile_width += current->pps_tile_column_width_minus1[i] + 1;
1881 }
1882
2/2
✓ Branch 0 taken 1206 times.
✓ Branch 1 taken 422 times.
3256 for (i = 0; i <= current->pps_num_exp_tile_rows_minus1; i++) {
1883
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1206 times.
2412 ues(pps_tile_row_height_minus1[i],
1884 0, pic_height_in_ctbs_y - exp_tile_height - 1, 1, i);
1885 2412 exp_tile_height += current->pps_tile_row_height_minus1[i] + 1;
1886 }
1887
1888 844 remaining_size = pic_width_in_ctbs_y;
1889
2/2
✓ Branch 0 taken 875 times.
✓ Branch 1 taken 422 times.
2594 for (i = 0; i <= current->pps_num_exp_tile_columns_minus1; i++) {
1890
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 875 times.
1750 if (current->pps_tile_column_width_minus1[i] >= remaining_size) {
1891 av_log(ctx->log_ctx, AV_LOG_ERROR,
1892 "Tile column width(%d) exceeds picture width\n",i);
1893 return AVERROR_INVALIDDATA;
1894 }
1895 1750 current->col_width_val[i] = current->pps_tile_column_width_minus1[i] + 1;
1896 1750 remaining_size -= (current->pps_tile_column_width_minus1[i] + 1);
1897 }
1898 844 unified_size = current->pps_tile_column_width_minus1[i - 1] + 1;
1899
2/2
✓ Branch 0 taken 825 times.
✓ Branch 1 taken 422 times.
2494 while (remaining_size > 0) {
1900
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 825 times.
1650 if (current->num_tile_columns > VVC_MAX_TILE_COLUMNS) {
1901 av_log(ctx->log_ctx, AV_LOG_ERROR,
1902 "NumTileColumns(%d) > than VVC_MAX_TILE_COLUMNS(%d)\n",
1903 current->num_tile_columns, VVC_MAX_TILE_COLUMNS);
1904 return AVERROR_INVALIDDATA;
1905 }
1906 1650 unified_size = FFMIN(remaining_size, unified_size);
1907 1650 current->col_width_val[i] = unified_size;
1908 1650 remaining_size -= unified_size;
1909 1650 i++;
1910 }
1911 844 current->num_tile_columns = i;
1912
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 422 times.
844 if (current->num_tile_columns > VVC_MAX_TILE_COLUMNS) {
1913 av_log(ctx->log_ctx, AV_LOG_ERROR,
1914 "NumTileColumns(%d) > than VVC_MAX_TILE_COLUMNS(%d)\n",
1915 current->num_tile_columns, VVC_MAX_TILE_COLUMNS);
1916 return AVERROR_INVALIDDATA;
1917 }
1918
1919 844 remaining_size = pic_height_in_ctbs_y;
1920
2/2
✓ Branch 0 taken 1206 times.
✓ Branch 1 taken 422 times.
3256 for (i = 0; i <= current->pps_num_exp_tile_rows_minus1; i++) {
1921
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1206 times.
2412 if (current->pps_tile_row_height_minus1[i] >= remaining_size) {
1922 av_log(ctx->log_ctx, AV_LOG_ERROR,
1923 "Tile row height(%d) exceeds picture height\n",i);
1924 return AVERROR_INVALIDDATA;
1925 }
1926 2412 current->row_height_val[i] = current->pps_tile_row_height_minus1[i] + 1;
1927 2412 remaining_size -= (current->pps_tile_row_height_minus1[i] + 1);
1928 }
1929 844 unified_size = current->pps_tile_row_height_minus1[i - 1] + 1;
1930
1931
2/2
✓ Branch 0 taken 457 times.
✓ Branch 1 taken 422 times.
1758 while (remaining_size > 0) {
1932 914 unified_size = FFMIN(remaining_size, unified_size);
1933 914 current->row_height_val[i] = unified_size;
1934 914 remaining_size -= unified_size;
1935 914 i++;
1936 }
1937 844 current->num_tile_rows=i;
1938
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 422 times.
844 if (current->num_tile_rows > VVC_MAX_TILE_ROWS) {
1939 av_log(ctx->log_ctx, AV_LOG_ERROR,
1940 "NumTileRows(%d) > than VVC_MAX_TILE_ROWS(%d)\n",
1941 current->num_tile_rows, VVC_MAX_TILE_ROWS);
1942 return AVERROR_INVALIDDATA;
1943 }
1944
1945 844 current->num_tiles_in_pic = current->num_tile_columns *
1946 844 current->num_tile_rows;
1947
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 422 times.
844 if (current->num_tiles_in_pic > VVC_MAX_TILES_PER_AU) {
1948 av_log(ctx->log_ctx, AV_LOG_ERROR,
1949 "NumTilesInPic(%d) > than VVC_MAX_TILES_PER_AU(%d)\n",
1950 current->num_tiles_in_pic, VVC_MAX_TILES_PER_AU);
1951 return AVERROR_INVALIDDATA;
1952 }
1953
1954
2/2
✓ Branch 0 taken 417 times.
✓ Branch 1 taken 5 times.
844 if (current->num_tiles_in_pic > 1) {
1955
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 417 times.
834 flag(pps_loop_filter_across_tiles_enabled_flag);
1956
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 417 times.
834 flag(pps_rect_slice_flag);
1957 } else {
1958
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
10 infer(pps_loop_filter_across_tiles_enabled_flag, 0);
1959
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
10 infer(pps_rect_slice_flag, 1);
1960 }
1961
2/2
✓ Branch 0 taken 412 times.
✓ Branch 1 taken 10 times.
844 if (current->pps_rect_slice_flag)
1962
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 412 times.
824 flag(pps_single_slice_per_subpic_flag);
1963 else
1964
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
20 infer(pps_single_slice_per_subpic_flag, 1);
1965
2/2
✓ Branch 0 taken 412 times.
✓ Branch 1 taken 10 times.
844 if (current->pps_rect_slice_flag &&
1966
2/2
✓ Branch 0 taken 407 times.
✓ Branch 1 taken 5 times.
1638 !current->pps_single_slice_per_subpic_flag) {
1967 814 int j, num_slices = 0;
1968 814 uint16_t tile_idx = 0, tile_x, tile_y, ctu_x, ctu_y;
1969 uint16_t slice_top_left_ctu_x[VVC_MAX_SLICES];
1970 uint16_t slice_top_left_ctu_y[VVC_MAX_SLICES];
1971
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 407 times.
814 ue(pps_num_slices_in_pic_minus1, 0, VVC_MAX_SLICES - 1);
1972
2/2
✓ Branch 0 taken 402 times.
✓ Branch 1 taken 5 times.
814 if (current->pps_num_slices_in_pic_minus1 > 1)
1973
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 402 times.
804 flag(pps_tile_idx_delta_present_flag);
1974 else
1975
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
10 infer(pps_tile_idx_delta_present_flag, 0);
1976
2/2
✓ Branch 0 taken 1091 times.
✓ Branch 1 taken 407 times.
2996 for (i = 0; i < current->pps_num_slices_in_pic_minus1; i++) {
1977 2182 current->slice_top_left_tile_idx[i] = tile_idx;
1978 2182 tile_x = tile_idx % current->num_tile_columns;
1979 2182 tile_y = tile_idx / current->num_tile_columns;
1980
2/2
✓ Branch 0 taken 1032 times.
✓ Branch 1 taken 59 times.
2182 if (tile_x != current->num_tile_columns - 1) {
1981
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1032 times.
2064 ues(pps_slice_width_in_tiles_minus1[i],
1982 0, current->num_tile_columns - 1, 1, i);
1983 } else {
1984
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
118 infer(pps_slice_width_in_tiles_minus1[i], 0);
1985 }
1986
2/2
✓ Branch 0 taken 996 times.
✓ Branch 1 taken 95 times.
2182 if (tile_y != current->num_tile_rows - 1 &&
1987
4/4
✓ Branch 0 taken 788 times.
✓ Branch 1 taken 208 times.
✓ Branch 2 taken 382 times.
✓ Branch 3 taken 406 times.
1992 (current->pps_tile_idx_delta_present_flag || tile_x == 0)) {
1988
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 590 times.
1180 ues(pps_slice_height_in_tiles_minus1[i],
1989 0, current->num_tile_rows - 1, 1, i);
1990 } else {
1991
2/2
✓ Branch 0 taken 95 times.
✓ Branch 1 taken 406 times.
1002 if (tile_y == current->num_tile_rows - 1)
1992
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
190 infer(pps_slice_height_in_tiles_minus1[i], 0);
1993 else
1994
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
812 infer(pps_slice_height_in_tiles_minus1[i],
1995 current->pps_slice_height_in_tiles_minus1[i - 1]);
1996 }
1997
1998 2182 ctu_x = ctu_y = 0;
1999
2/2
✓ Branch 0 taken 888 times.
✓ Branch 1 taken 1091 times.
3958 for (j = 0; j < tile_x; j++) {
2000 1776 ctu_x += current->col_width_val[j];
2001 }
2002
2/2
✓ Branch 0 taken 515 times.
✓ Branch 1 taken 1091 times.
3212 for (j = 0; j < tile_y; j++) {
2003 1030 ctu_y += current->row_height_val[j];
2004 }
2005
2/2
✓ Branch 0 taken 667 times.
✓ Branch 1 taken 424 times.
2182 if (current->pps_slice_width_in_tiles_minus1[i] == 0 &&
2006
2/2
✓ Branch 0 taken 640 times.
✓ Branch 1 taken 27 times.
1334 current->pps_slice_height_in_tiles_minus1[i] == 0 &&
2007
2/2
✓ Branch 0 taken 154 times.
✓ Branch 1 taken 486 times.
1280 current->row_height_val[tile_y] > 1) {
2008 int uniform_slice_height, remaining_height_in_ctbs_y;
2009 308 remaining_height_in_ctbs_y =
2010 308 current->row_height_val[tile_y];
2011
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
308 ues(pps_num_exp_slices_in_tile[i],
2012 0, current->row_height_val[tile_y] - 1, 1, i);
2013
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
308 if (current->pps_num_exp_slices_in_tile[i] == 0) {
2014 current->num_slices_in_tile[i] = 1;
2015 current->slice_height_in_ctus[i] = current->row_height_val[tile_y];
2016 slice_top_left_ctu_x[i] = ctu_x;
2017 slice_top_left_ctu_y[i] = ctu_y;
2018 } else {
2019 uint16_t slice_height_in_ctus;
2020
2/2
✓ Branch 0 taken 208 times.
✓ Branch 1 taken 154 times.
724 for (j = 0; j < current->pps_num_exp_slices_in_tile[i];
2021 416 j++) {
2022
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 208 times.
416 ues(pps_exp_slice_height_in_ctus_minus1[i][j], 0,
2023 current->row_height_val[tile_y] - 1, 2,
2024 i, j);
2025 416 slice_height_in_ctus =
2026 current->
2027 416 pps_exp_slice_height_in_ctus_minus1[i][j] + 1;
2028
2029 416 current->slice_height_in_ctus[i + j] =
2030 slice_height_in_ctus;
2031 416 slice_top_left_ctu_x[i + j] = ctu_x;
2032 416 slice_top_left_ctu_y[i + j] = ctu_y;
2033 416 ctu_y += slice_height_in_ctus;
2034
2035 416 remaining_height_in_ctbs_y -= slice_height_in_ctus;
2036 }
2037
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
308 uniform_slice_height = 1 +
2038 (j == 0 ? current->row_height_val[tile_y] - 1:
2039 308 current->pps_exp_slice_height_in_ctus_minus1[i][j-1]);
2040
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
308 while (remaining_height_in_ctbs_y > uniform_slice_height) {
2041 current->slice_height_in_ctus[i + j] =
2042 uniform_slice_height;
2043 slice_top_left_ctu_x[i + j] = ctu_x;
2044 slice_top_left_ctu_y[i + j] = ctu_y;
2045 ctu_y += uniform_slice_height;
2046
2047 remaining_height_in_ctbs_y -= uniform_slice_height;
2048 j++;
2049 }
2050
2/2
✓ Branch 0 taken 100 times.
✓ Branch 1 taken 54 times.
308 if (remaining_height_in_ctbs_y > 0) {
2051 200 current->slice_height_in_ctus[i + j] =
2052 remaining_height_in_ctbs_y;
2053 200 slice_top_left_ctu_x[i + j] = ctu_x;
2054 200 slice_top_left_ctu_y[i + j] = ctu_y;
2055 200 j++;
2056 }
2057 308 current->num_slices_in_tile[i] = j;
2058 }
2059
2/2
✓ Branch 0 taken 308 times.
✓ Branch 1 taken 154 times.
924 for (int k = 0; k < current->num_slices_in_tile[i]; k++)
2060 616 current->slice_top_left_tile_idx[i + k] = tile_idx;
2061 308 i += current->num_slices_in_tile[i] - 1;
2062 } else {
2063 1874 uint16_t height = 0;
2064
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
1874 infer(pps_num_exp_slices_in_tile[i], 0);
2065
2/2
✓ Branch 0 taken 513 times.
✓ Branch 1 taken 424 times.
1874 if (current->pps_slice_width_in_tiles_minus1[i] == 0 &&
2066
2/2
✓ Branch 0 taken 486 times.
✓ Branch 1 taken 27 times.
1026 current->pps_slice_height_in_tiles_minus1[i] == 0)
2067 972 current->num_slices_in_tile[i] = 1;
2068
2069 1874 for (j = 0;
2070
2/2
✓ Branch 0 taken 1015 times.
✓ Branch 1 taken 937 times.
3904 j <= current->pps_slice_height_in_tiles_minus1[i];
2071 2030 j++) {
2072 2030 height +=
2073 2030 current->row_height_val[tile_y + j];
2074 }
2075 1874 current->slice_height_in_ctus[i] = height;
2076
2077 1874 slice_top_left_ctu_x[i] = ctu_x;
2078 1874 slice_top_left_ctu_y[i] = ctu_y;
2079 }
2080
1/2
✓ Branch 0 taken 1091 times.
✗ Branch 1 not taken.
2182 if (i < current->pps_num_slices_in_pic_minus1) {
2081
2/2
✓ Branch 0 taken 255 times.
✓ Branch 1 taken 836 times.
2182 if (current->pps_tile_idx_delta_present_flag) {
2082 // Two conditions must be met:
2083 // 1. −NumTilesInPic + 1 <= pps_tile_idx_delta_val[i] <= NumTilesInPic − 1
2084 // 2. 0 <= tile_idx + pps_tile_idx_delta_val[i] <= NumTilesInPic − 1
2085 // Combining these conditions yields: -tile_idx <= pps_tile_idx_delta_val[i] <= NumTilesInPic - 1 - tile_idx
2086
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 255 times.
510 ses(pps_tile_idx_delta_val[i],
2087 -tile_idx, current->num_tiles_in_pic - 1 - tile_idx, 1, i);
2088
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 255 times.
510 if (current->pps_tile_idx_delta_val[i] == 0) {
2089 av_log(ctx->log_ctx, AV_LOG_ERROR,
2090 "pps_tile_idx_delta_val[i] shall not be equal to 0.\n");
2091 }
2092 510 tile_idx += current->pps_tile_idx_delta_val[i];
2093 } else {
2094
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
1672 infer(pps_tile_idx_delta_val[i], 0);
2095 1672 tile_idx +=
2096 1672 current->pps_slice_width_in_tiles_minus1[i] + 1;
2097
2/2
✓ Branch 0 taken 382 times.
✓ Branch 1 taken 454 times.
1672 if (tile_idx % current->num_tile_columns == 0) {
2098 764 tile_idx +=
2099 764 current->pps_slice_height_in_tiles_minus1[i] *
2100 764 current->num_tile_columns;
2101 }
2102 }
2103 }
2104 }
2105
1/2
✓ Branch 0 taken 407 times.
✗ Branch 1 not taken.
814 if (i == current->pps_num_slices_in_pic_minus1) {
2106 814 uint16_t height = 0;
2107
2108 814 current->slice_top_left_tile_idx[i] = tile_idx;
2109 814 current->num_slices_in_tile[i] = 1;
2110 814 tile_x = tile_idx % current->num_tile_columns;
2111 814 tile_y = tile_idx / current->num_tile_columns;
2112
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 407 times.
814 if (tile_y >= current->num_tile_rows)
2113 return AVERROR_INVALIDDATA;
2114
2115 814 ctu_x = 0, ctu_y = 0;
2116
2/2
✓ Branch 0 taken 149 times.
✓ Branch 1 taken 407 times.
1112 for (j = 0; j < tile_x; j++) {
2117 298 ctu_x += current->col_width_val[j];
2118 }
2119
2/2
✓ Branch 0 taken 480 times.
✓ Branch 1 taken 407 times.
1774 for (j = 0; j < tile_y; j++) {
2120 960 ctu_y += current->row_height_val[j];
2121 }
2122 814 slice_top_left_ctu_x[i] = ctu_x;
2123 814 slice_top_left_ctu_y[i] = ctu_y;
2124
2125 814 current->pps_slice_width_in_tiles_minus1[i] =
2126 814 current->num_tile_columns - tile_x - 1;
2127 814 current->pps_slice_height_in_tiles_minus1[i] =
2128 814 current->num_tile_rows - tile_y - 1;
2129
2130
2/2
✓ Branch 0 taken 1123 times.
✓ Branch 1 taken 407 times.
3060 for (j = 0; j <= current->pps_slice_height_in_tiles_minus1[i];
2131 2246 j++) {
2132 2246 height +=
2133 2246 current->row_height_val[tile_y + j];
2134 }
2135 814 current->slice_height_in_ctus[i] = height;
2136
2137
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
814 infer(pps_num_exp_slices_in_tile[i], 0);
2138 }
2139 //now, we got all slice information, let's resolve NumSlicesInSubpic
2140
2/2
✓ Branch 0 taken 1231 times.
✓ Branch 1 taken 407 times.
3276 for (i = 0; i <= sps->sps_num_subpics_minus1; i++) {
2141 2462 current->num_slices_in_subpic[i] = 0;
2142
2/2
✓ Branch 0 taken 4664 times.
✓ Branch 1 taken 1231 times.
11790 for (j = 0; j <= current->pps_num_slices_in_pic_minus1; j++) {
2143 9328 uint16_t pos_x = 0, pos_y = 0;
2144 9328 pos_x = slice_top_left_ctu_x[j];
2145 9328 pos_y = slice_top_left_ctu_y[j];
2146
2/2
✓ Branch 0 taken 3489 times.
✓ Branch 1 taken 1175 times.
9328 if ((pos_x >= sps->sps_subpic_ctu_top_left_x[i]) &&
2147 6978 (pos_x <
2148 6978 sps->sps_subpic_ctu_top_left_x[i] +
2149
2/2
✓ Branch 0 taken 2942 times.
✓ Branch 1 taken 547 times.
6978 sps->sps_subpic_width_minus1[i] + 1) &&
2150
2/2
✓ Branch 0 taken 2064 times.
✓ Branch 1 taken 878 times.
5884 (pos_y >= sps->sps_subpic_ctu_top_left_y[i]) &&
2151 4128 (pos_y < sps->sps_subpic_ctu_top_left_y[i] +
2152
2/2
✓ Branch 0 taken 1652 times.
✓ Branch 1 taken 412 times.
4128 sps->sps_subpic_height_minus1[i] + 1)) {
2153 3304 current->num_slices_in_subpic[i]++;
2154 }
2155 }
2156 2462 num_slices += current->num_slices_in_subpic[i];
2157 }
2158
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 407 times.
814 if (current->pps_num_slices_in_pic_minus1 + 1 != num_slices)
2159 return AVERROR_INVALIDDATA;
2160 } else {
2161
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
30 if (current->pps_no_pic_partition_flag)
2162 infer(pps_num_slices_in_pic_minus1, 0);
2163
1/2
✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
30 else if (current->pps_single_slice_per_subpic_flag) {
2164
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 15 times.
130 for (i = 0; i <= sps->sps_num_subpics_minus1; i++)
2165 100 current->num_slices_in_subpic[i] = 1;
2166
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
30 infer(pps_num_slices_in_pic_minus1,
2167 sps->sps_num_subpics_minus1);
2168 }
2169 // else?
2170 }
2171
2/2
✓ Branch 0 taken 412 times.
✓ Branch 1 taken 10 times.
844 if (!current->pps_rect_slice_flag ||
2172
2/2
✓ Branch 0 taken 407 times.
✓ Branch 1 taken 5 times.
824 current->pps_single_slice_per_subpic_flag ||
2173
2/2
✓ Branch 0 taken 402 times.
✓ Branch 1 taken 5 times.
814 current->pps_num_slices_in_pic_minus1 > 0)
2174
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 417 times.
834 flag(pps_loop_filter_across_slices_enabled_flag);
2175 else
2176
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
10 infer(pps_loop_filter_across_slices_enabled_flag, 0);
2177 } else {
2178
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
2910 infer(pps_num_exp_tile_columns_minus1, 0);
2179
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
2910 infer(pps_tile_column_width_minus1[0], pic_width_in_ctbs_y - 1);
2180
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
2910 infer(pps_num_exp_tile_rows_minus1, 0);
2181
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
2910 infer(pps_tile_row_height_minus1[0], pic_height_in_ctbs_y - 1);
2182 2910 current->col_width_val[0] = pic_width_in_ctbs_y;
2183 2910 current->row_height_val[0] = pic_height_in_ctbs_y;
2184 2910 current->num_tile_columns = 1;
2185 2910 current->num_tile_rows = 1;
2186 2910 current->num_tiles_in_pic = 1;
2187 }
2188
2189
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_cabac_init_present_flag);
2190
2/2
✓ Branch 0 taken 3754 times.
✓ Branch 1 taken 1877 times.
11262 for (i = 0; i < 2; i++)
2191
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3754 times.
7508 ues(pps_num_ref_idx_default_active_minus1[i], 0, 14, 1, i);
2192
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_rpl1_idx_present_flag);
2193
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_weighted_pred_flag);
2194
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_weighted_bipred_flag);
2195
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_ref_wraparound_enabled_flag);
2196
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 1865 times.
3754 if (current->pps_ref_wraparound_enabled_flag) {
2197
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ue(pps_pic_width_minus_wraparound_offset,
2198 0, (current->pps_pic_width_in_luma_samples / min_cb_size_y)
2199 - (ctb_size_y / min_cb_size_y) - 2);
2200 }
2201
2202 3754 qp_bd_offset = 6 * sps->sps_bitdepth_minus8;
2203
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 se(pps_init_qp_minus26, -(26 + qp_bd_offset), 37);
2204
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_cu_qp_delta_enabled_flag);
2205
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_chroma_tool_offsets_present_flag);
2206
2/2
✓ Branch 0 taken 1088 times.
✓ Branch 1 taken 789 times.
3754 if (current->pps_chroma_tool_offsets_present_flag) {
2207
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1088 times.
2176 se(pps_cb_qp_offset, -12, 12);
2208
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1088 times.
2176 se(pps_cr_qp_offset, -12, 12);
2209
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1088 times.
2176 flag(pps_joint_cbcr_qp_offset_present_flag);
2210
2/2
✓ Branch 0 taken 1079 times.
✓ Branch 1 taken 9 times.
2176 if (current->pps_joint_cbcr_qp_offset_present_flag)
2211
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1079 times.
2158 se(pps_joint_cbcr_qp_offset_value, -12, 12);
2212 else
2213
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
18 infer(pps_joint_cbcr_qp_offset_value, 0);
2214
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1088 times.
2176 flag(pps_slice_chroma_qp_offsets_present_flag);
2215
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1088 times.
2176 flag(pps_cu_chroma_qp_offset_list_enabled_flag);
2216
2/2
✓ Branch 0 taken 358 times.
✓ Branch 1 taken 730 times.
2176 if (current->pps_cu_chroma_qp_offset_list_enabled_flag) {
2217
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
716 ue(pps_chroma_qp_offset_list_len_minus1, 0, 5);
2218
2/2
✓ Branch 0 taken 1202 times.
✓ Branch 1 taken 358 times.
3120 for (i = 0; i <= current->pps_chroma_qp_offset_list_len_minus1; i++) {
2219
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1202 times.
2404 ses(pps_cb_qp_offset_list[i], -12, 12, 1, i);
2220
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1202 times.
2404 ses(pps_cr_qp_offset_list[i], -12, 12, 1, i);
2221
1/2
✓ Branch 0 taken 1202 times.
✗ Branch 1 not taken.
2404 if (current->pps_joint_cbcr_qp_offset_present_flag)
2222
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1202 times.
2404 ses(pps_joint_cbcr_qp_offset_list[i], -12, 12, 1, i);
2223 else
2224 infer(pps_joint_cbcr_qp_offset_list[i], 0);
2225 }
2226 }
2227 } else {
2228
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(pps_cb_qp_offset, 0);
2229
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(pps_cr_qp_offset, 0);
2230
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(pps_joint_cbcr_qp_offset_present_flag, 0);
2231
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(pps_joint_cbcr_qp_offset_value, 0);
2232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(pps_slice_chroma_qp_offsets_present_flag, 0);
2233
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1578 infer(pps_cu_chroma_qp_offset_list_enabled_flag, 0);
2234 }
2235
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_deblocking_filter_control_present_flag);
2236
2/2
✓ Branch 0 taken 1130 times.
✓ Branch 1 taken 747 times.
3754 if (current->pps_deblocking_filter_control_present_flag) {
2237
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1130 times.
2260 flag(pps_deblocking_filter_override_enabled_flag);
2238
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1130 times.
2260 flag(pps_deblocking_filter_disabled_flag);
2239
2/2
✓ Branch 0 taken 358 times.
✓ Branch 1 taken 772 times.
2260 if (!current->pps_no_pic_partition_flag &&
2240
2/2
✓ Branch 0 taken 167 times.
✓ Branch 1 taken 191 times.
716 current->pps_deblocking_filter_override_enabled_flag)
2241
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 167 times.
334 flag(pps_dbf_info_in_ph_flag);
2242 else
2243
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1926 infer(pps_dbf_info_in_ph_flag, 0);
2244
2/2
✓ Branch 0 taken 358 times.
✓ Branch 1 taken 772 times.
2260 if (!current->pps_deblocking_filter_disabled_flag) {
2245
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
716 se(pps_luma_beta_offset_div2, -12, 12);
2246
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
716 se(pps_luma_tc_offset_div2, -12, 12);
2247
1/2
✓ Branch 0 taken 358 times.
✗ Branch 1 not taken.
716 if (current->pps_chroma_tool_offsets_present_flag) {
2248
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
716 se(pps_cb_beta_offset_div2, -12, 12);
2249
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
716 se(pps_cb_tc_offset_div2, -12, 12);
2250
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
716 se(pps_cr_beta_offset_div2, -12, 12);
2251
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
716 se(pps_cr_tc_offset_div2, -12, 12);
2252 } else {
2253 infer(pps_cb_beta_offset_div2,
2254 current->pps_luma_beta_offset_div2);
2255 infer(pps_cb_tc_offset_div2, current->pps_luma_tc_offset_div2);
2256 infer(pps_cr_beta_offset_div2,
2257 current->pps_luma_beta_offset_div2);
2258 infer(pps_cr_tc_offset_div2, current->pps_luma_tc_offset_div2);
2259 }
2260 } else {
2261
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1544 infer(pps_luma_beta_offset_div2, 0);
2262
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1544 infer(pps_luma_tc_offset_div2, 0);
2263
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1544 infer(pps_cb_beta_offset_div2, 0);
2264
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1544 infer(pps_cb_tc_offset_div2, 0);
2265
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1544 infer(pps_cr_beta_offset_div2, 0);
2266
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1544 infer(pps_cr_tc_offset_div2, 0);
2267 }
2268 } else {
2269
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_deblocking_filter_override_enabled_flag, 0);
2270
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_deblocking_filter_disabled_flag, 0);
2271
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_dbf_info_in_ph_flag, 0);
2272
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_luma_beta_offset_div2, 0);
2273
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_luma_tc_offset_div2, 0);
2274
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_cb_beta_offset_div2, 0);
2275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_cb_tc_offset_div2, 0);
2276
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_cr_beta_offset_div2, 0);
2277
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1494 infer(pps_cr_tc_offset_div2, 0);
2278 }
2279
2280
2/2
✓ Branch 0 taken 422 times.
✓ Branch 1 taken 1455 times.
3754 if (!current->pps_no_pic_partition_flag) {
2281
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 422 times.
844 flag(pps_rpl_info_in_ph_flag);
2282
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 422 times.
844 flag(pps_sao_info_in_ph_flag);
2283
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 422 times.
844 flag(pps_alf_info_in_ph_flag);
2284
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 358 times.
844 if ((current->pps_weighted_pred_flag ||
2285
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
128 current->pps_weighted_bipred_flag) &&
2286
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 346 times.
716 current->pps_rpl_info_in_ph_flag)
2287
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 flag(pps_wp_info_in_ph_flag);
2288
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 422 times.
844 flag(pps_qp_delta_info_in_ph_flag);
2289 }
2290
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_picture_header_extension_present_flag);
2291
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_slice_header_extension_present_flag);
2292
2293
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 flag(pps_extension_flag);
2294
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1877 times.
3754 if (current->pps_extension_flag)
2295 CHECK(FUNC(extension_data) (ctx, rw, &current->extension_data));
2296
2297
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1877 times.
3754 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
2298 3754 return 0;
2299 }
2300
2301 1328 static int FUNC(alf_data)(CodedBitstreamContext *ctx, RWContext *rw,
2302 H266RawAPS *current)
2303 {
2304 int err, j, k;
2305
2306
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 664 times.
1328 flag(alf_luma_filter_signal_flag);
2307
2308
2/2
✓ Branch 0 taken 644 times.
✓ Branch 1 taken 20 times.
1328 if (current->aps_chroma_present_flag) {
2309
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 644 times.
1288 flag(alf_chroma_filter_signal_flag);
2310
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 644 times.
1288 flag(alf_cc_cb_filter_signal_flag);
2311
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 644 times.
1288 flag(alf_cc_cr_filter_signal_flag);
2312 } else {
2313
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
40 infer(alf_chroma_filter_signal_flag, 0);
2314
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
40 infer(alf_cc_cb_filter_signal_flag, 0);
2315
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
40 infer(alf_cc_cr_filter_signal_flag, 0);
2316 }
2317
2318
2/2
✓ Branch 0 taken 524 times.
✓ Branch 1 taken 140 times.
1328 if (current->alf_luma_filter_signal_flag) {
2319
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 524 times.
1048 flag(alf_luma_clip_flag);
2320
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 524 times.
1048 ue(alf_luma_num_filters_signalled_minus1, 0, VVC_NUM_ALF_FILTERS - 1);
2321
2/2
✓ Branch 0 taken 360 times.
✓ Branch 1 taken 164 times.
1048 if (current->alf_luma_num_filters_signalled_minus1 > 0) {
2322 720 unsigned int bits = av_ceil_log2(current->alf_luma_num_filters_signalled_minus1 + 1);
2323
2/2
✓ Branch 0 taken 9000 times.
✓ Branch 1 taken 360 times.
18720 for (int filt_idx = 0; filt_idx < VVC_NUM_ALF_FILTERS; filt_idx++)
2324
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9000 times.
18000 us(bits, alf_luma_coeff_delta_idx[filt_idx],
2325 0, current->alf_luma_num_filters_signalled_minus1,
2326 1, filt_idx);
2327 }
2328
2/2
✓ Branch 0 taken 3146 times.
✓ Branch 1 taken 524 times.
7340 for (int sf_idx = 0; sf_idx <= current->alf_luma_num_filters_signalled_minus1; sf_idx++)
2329
2/2
✓ Branch 0 taken 37752 times.
✓ Branch 1 taken 3146 times.
81796 for (j = 0; j < 12; j++) {
2330
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37752 times.
75504 ues(alf_luma_coeff_abs[sf_idx][j], 0, 128, 2, sf_idx, j);
2331
2/2
✓ Branch 0 taken 36519 times.
✓ Branch 1 taken 1233 times.
75504 if (current->alf_luma_coeff_abs[sf_idx][j])
2332
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36519 times.
73038 ubs(1, alf_luma_coeff_sign[sf_idx][j], 2, sf_idx, j);
2333 else
2334
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 325 times.
2466 infer(alf_luma_coeff_sign[sf_idx][j], 0);
2335 }
2336 } else {
2337
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
280 infer(alf_luma_clip_flag, 0);
2338
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
280 infer(alf_luma_num_filters_signalled_minus1, 0);
2339 }
2340
2/2
✓ Branch 0 taken 3286 times.
✓ Branch 1 taken 664 times.
7900 for (int sf_idx = 0; sf_idx <= current->alf_luma_num_filters_signalled_minus1; sf_idx++) {
2341
2/2
✓ Branch 0 taken 39432 times.
✓ Branch 1 taken 3286 times.
85436 for (j = 0; j < 12; j++) {
2342
2/2
✓ Branch 0 taken 26568 times.
✓ Branch 1 taken 12864 times.
78864 if (current->alf_luma_clip_flag)
2343
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26568 times.
53136 ubs(2, alf_luma_clip_idx[sf_idx][j], 2, sf_idx, j);
2344 else
2345
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1152 times.
25728 infer(alf_luma_clip_idx[sf_idx][j], 0);
2346 }
2347 }
2348
2349
2/2
✓ Branch 0 taken 421 times.
✓ Branch 1 taken 243 times.
1328 if (current->alf_chroma_filter_signal_flag) {
2350
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 421 times.
842 flag(alf_chroma_clip_flag);
2351
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 421 times.
842 ue(alf_chroma_num_alt_filters_minus1, 0, 7);
2352 } else {
2353
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 79 times.
486 infer(alf_chroma_clip_flag, 0);
2354
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 79 times.
486 infer(alf_chroma_num_alt_filters_minus1, 0);
2355 }
2356
2/2
✓ Branch 0 taken 1444 times.
✓ Branch 1 taken 664 times.
4216 for (int alt_idx = 0; alt_idx <= current->alf_chroma_num_alt_filters_minus1; alt_idx++) {
2357
2/2
✓ Branch 0 taken 8664 times.
✓ Branch 1 taken 1444 times.
20216 for (j = 0; j < 6; j++) {
2358
2/2
✓ Branch 0 taken 7206 times.
✓ Branch 1 taken 1458 times.
17328 if (current->alf_chroma_filter_signal_flag)
2359
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7206 times.
14412 ues(alf_chroma_coeff_abs[alt_idx][j], 0, 128, 2, alt_idx, j);
2360 else
2361
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 474 times.
2916 infer(alf_chroma_coeff_abs[alt_idx][j], 0);
2362
2/2
✓ Branch 0 taken 6842 times.
✓ Branch 1 taken 1822 times.
17328 if (current->alf_chroma_coeff_abs[alt_idx][j] > 0)
2363
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6842 times.
13684 ubs(1, alf_chroma_coeff_sign[alt_idx][j], 2, alt_idx, j);
2364 else
2365
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 583 times.
3644 infer(alf_chroma_coeff_sign[alt_idx][j], 0);
2366 }
2367
2/2
✓ Branch 0 taken 8664 times.
✓ Branch 1 taken 1444 times.
20216 for (j = 0; j < 6; j++) {
2368
2/2
✓ Branch 0 taken 5730 times.
✓ Branch 1 taken 2934 times.
17328 if (current->alf_chroma_clip_flag)
2369
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5730 times.
11460 ubs(2, alf_chroma_clip_idx[alt_idx][j], 2, alt_idx, j);
2370 else
2371
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
5868 infer(alf_chroma_clip_idx[alt_idx][j], 0);
2372 }
2373 }
2374
2375
2/2
✓ Branch 0 taken 239 times.
✓ Branch 1 taken 425 times.
1328 if (current->alf_cc_cb_filter_signal_flag)
2376
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 239 times.
478 ue(alf_cc_cb_filters_signalled_minus1, 0, 3);
2377 else
2378
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
850 infer(alf_cc_cb_filters_signalled_minus1, 0);
2379
2/2
✓ Branch 0 taken 1206 times.
✓ Branch 1 taken 664 times.
3740 for (k = 0; k <= current->alf_cc_cb_filters_signalled_minus1; k++) {
2380
2/2
✓ Branch 0 taken 8442 times.
✓ Branch 1 taken 1206 times.
19296 for (j = 0; j < 7; j++) {
2381
2/2
✓ Branch 0 taken 5467 times.
✓ Branch 1 taken 2975 times.
16884 if (current->alf_cc_cb_filter_signal_flag)
2382
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5467 times.
10934 ubs(3, alf_cc_cb_mapped_coeff_abs[k][j], 2, k, j);
2383 else
2384
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 924 times.
5950 infer(alf_cc_cb_mapped_coeff_abs[k][j], 0);
2385
2/2
✓ Branch 0 taken 4600 times.
✓ Branch 1 taken 3842 times.
16884 if (current->alf_cc_cb_mapped_coeff_abs[k][j])
2386
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4600 times.
9200 ubs(1, alf_cc_cb_coeff_sign[k][j], 2, k, j);
2387 else
2388
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1123 times.
7684 infer(alf_cc_cb_coeff_sign[k][j], 0);
2389 }
2390 }
2391
2392
2/2
✓ Branch 0 taken 211 times.
✓ Branch 1 taken 453 times.
1328 if (current->alf_cc_cr_filter_signal_flag)
2393
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 211 times.
422 ue(alf_cc_cr_filters_signalled_minus1, 0, 3);
2394 else
2395
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 141 times.
906 infer(alf_cc_cr_filters_signalled_minus1, 0);
2396
2/2
✓ Branch 0 taken 1136 times.
✓ Branch 1 taken 664 times.
3600 for (k = 0; k < current->alf_cc_cr_filters_signalled_minus1 + 1; k++) {
2397
2/2
✓ Branch 0 taken 7952 times.
✓ Branch 1 taken 1136 times.
18176 for (j = 0; j < 7; j++) {
2398
2/2
✓ Branch 0 taken 4781 times.
✓ Branch 1 taken 3171 times.
15904 if (current->alf_cc_cr_filter_signal_flag)
2399
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4781 times.
9562 ubs(3, alf_cc_cr_mapped_coeff_abs[k][j], 2, k, j);
2400 else
2401
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 987 times.
6342 infer(alf_cc_cr_mapped_coeff_abs[k][j], 0);
2402
2/2
✓ Branch 0 taken 4172 times.
✓ Branch 1 taken 3780 times.
15904 if (current->alf_cc_cr_mapped_coeff_abs[k][j])
2403
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4172 times.
8344 ubs(1, alf_cc_cr_coeff_sign[k][j], 2, k, j);
2404 else
2405
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1121 times.
7560 infer(alf_cc_cr_coeff_sign[k][j], 0);
2406 }
2407 }
2408
2409 1328 return 0;
2410 }
2411
2412 306 static int FUNC(lmcs_data)(CodedBitstreamContext *ctx, RWContext *rw,
2413 H266RawAPS *current)
2414 {
2415 int err, i, lmcs_max_bin_idx;
2416
2417
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 ue(lmcs_min_bin_idx, 0, 15);
2418
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 ue(lmcs_delta_max_bin_idx, 0, 15);
2419
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 ue(lmcs_delta_cw_prec_minus1, 0, 14);
2420
2421 306 lmcs_max_bin_idx = 15 - current->lmcs_delta_max_bin_idx;
2422
2423
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 153 times.
306 if (lmcs_max_bin_idx < current->lmcs_min_bin_idx)
2424 return AVERROR_INVALIDDATA;
2425
2426
2/2
✓ Branch 0 taken 2119 times.
✓ Branch 1 taken 153 times.
4544 for (i = current->lmcs_min_bin_idx; i <= lmcs_max_bin_idx; i++) {
2427
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2119 times.
4238 ubs(current->lmcs_delta_cw_prec_minus1 + 1, lmcs_delta_abs_cw[i], 1, i);
2428
2/2
✓ Branch 0 taken 1955 times.
✓ Branch 1 taken 164 times.
4238 if (current->lmcs_delta_abs_cw[i] > 0)
2429
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1955 times.
3910 flags(lmcs_delta_sign_cw_flag[i], 1, i);
2430 else
2431
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
328 infer(lmcs_delta_sign_cw_flag[i], 0);
2432 }
2433
2434
1/2
✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
306 if (current->aps_chroma_present_flag) {
2435
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 ub(3, lmcs_delta_abs_crs);
2436
2/2
✓ Branch 0 taken 151 times.
✓ Branch 1 taken 2 times.
306 if (current->lmcs_delta_abs_crs > 0)
2437
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 151 times.
302 flag(lmcs_delta_sign_crs_flag);
2438 else
2439
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
4 infer(lmcs_delta_sign_crs_flag, 0);
2440 } else {
2441 infer(lmcs_delta_abs_crs, 0);
2442 infer(lmcs_delta_sign_crs_flag, 0);
2443 }
2444
2445 306 return 0;
2446 }
2447
2448 72 static int FUNC(scaling_list_data)(CodedBitstreamContext *ctx, RWContext *rw,
2449 H266RawAPS *current)
2450 {
2451 // 7.4.3.4, deriving DiagScanOrder
2452 static const uint8_t diag_scan_order[64][2] = {
2453 { 0, 0, }, { 0, 1, }, { 1, 0, }, { 0, 2, }, { 1, 1, }, { 2, 0, }, { 0, 3, }, { 1, 2, },
2454 { 2, 1, }, { 3, 0, }, { 0, 4, }, { 1, 3, }, { 2, 2, }, { 3, 1, }, { 4, 0, }, { 0, 5, },
2455 { 1, 4, }, { 2, 3, }, { 3, 2, }, { 4, 1, }, { 5, 0, }, { 0, 6, }, { 1, 5, }, { 2, 4, },
2456 { 3, 3, }, { 4, 2, }, { 5, 1, }, { 6, 0, }, { 0, 7, }, { 1, 6, }, { 2, 5, }, { 3, 4, },
2457 { 4, 3, }, { 5, 2, }, { 6, 1, }, { 7, 0, }, { 1, 7, }, { 2, 6, }, { 3, 5, }, { 4, 4, },
2458 { 5, 3, }, { 6, 2, }, { 7, 1, }, { 2, 7, }, { 3, 6, }, { 4, 5, }, { 5, 4, }, { 6, 3, },
2459 { 7, 2, }, { 3, 7, }, { 4, 6, }, { 5, 5, }, { 6, 4, }, { 7, 3, }, { 4, 7, }, { 5, 6, },
2460 { 6, 5, }, { 7, 4, }, { 5, 7, }, { 6, 6, }, { 7, 5, }, { 6, 7, }, { 7, 6, }, { 7, 7, }, };
2461 int err;
2462
2463
2/2
✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 36 times.
2088 for (int id = 0; id < 28; id ++) {
2464
6/6
✓ Branch 0 taken 728 times.
✓ Branch 1 taken 280 times.
✓ Branch 2 taken 494 times.
✓ Branch 3 taken 234 times.
✓ Branch 4 taken 26 times.
✓ Branch 5 taken 468 times.
2016 if (current->aps_chroma_present_flag || id % 3 == 2 || id == 27) {
2465
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 540 times.
1080 flags(scaling_list_copy_mode_flag[id], 1, id);
2466
2/2
✓ Branch 0 taken 218 times.
✓ Branch 1 taken 322 times.
1080 if (!current->scaling_list_copy_mode_flag[id])
2467
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 218 times.
436 flags(scaling_list_pred_mode_flag[id], 1, id);
2468 else
2469
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
644 infer(scaling_list_pred_mode_flag[id], 0);
2470
2/2
✓ Branch 0 taken 218 times.
✓ Branch 1 taken 322 times.
1080 if ((current->scaling_list_copy_mode_flag[id] ||
2471
4/4
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 90 times.
✓ Branch 2 taken 448 times.
✓ Branch 3 taken 2 times.
1080 current->scaling_list_pred_mode_flag[id]) &&
2472
4/4
✓ Branch 0 taken 439 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 428 times.
✓ Branch 3 taken 11 times.
896 id != 0 && id != 2 && id != 8) {
2473
4/4
✓ Branch 0 taken 420 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 70 times.
✓ Branch 3 taken 350 times.
856 int max_id_delta = (id < 2) ? id : ((id < 8) ? (id - 2) : (id - 8));
2474
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 428 times.
856 ues(scaling_list_pred_id_delta[id], 0, max_id_delta, 1, id);
2475 }
2476
2/2
✓ Branch 0 taken 218 times.
✓ Branch 1 taken 322 times.
1080 if (!current->scaling_list_copy_mode_flag[id]) {
2477
4/4
✓ Branch 0 taken 206 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 74 times.
✓ Branch 3 taken 132 times.
436 int matrix_size = id < 2 ? 2 : (id < 8 ? 4 : 8);
2478
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 166 times.
436 if (id > 13) {
2479 104 int idx = id - 14;
2480
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
104 ses(scaling_list_dc_coef[idx], -128, 127, 1, idx);
2481 }
2482
2/2
✓ Branch 0 taken 9680 times.
✓ Branch 1 taken 218 times.
19796 for (int i = 0; i < matrix_size * matrix_size; i++) {
2483 19360 int x = diag_scan_order[i][0];
2484 19360 int y = diag_scan_order[i][1];
2485
6/6
✓ Branch 0 taken 640 times.
✓ Branch 1 taken 9040 times.
✓ Branch 2 taken 320 times.
✓ Branch 3 taken 320 times.
✓ Branch 4 taken 160 times.
✓ Branch 5 taken 160 times.
19360 if (!(id > 25 && x >= 4 && y >= 4))
2486
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9520 times.
19040 ses(scaling_list_delta_coef[id][i], -128, 127, 2, id, i);
2487 }
2488
2/2
✓ Branch 0 taken 244 times.
✓ Branch 1 taken 78 times.
644 } else if (id > 13) {
2489 488 int idx = id - 14;
2490
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 68 times.
488 infer(scaling_list_dc_coef[idx], 0);
2491 }
2492 } else {
2493
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
936 infer(scaling_list_copy_mode_flag[id], 1);
2494
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
936 infer(scaling_list_pred_mode_flag[id], 0);
2495 }
2496 }
2497
2498 72 return 0;
2499 }
2500
2501 1706 static int FUNC(aps)(CodedBitstreamContext *ctx, RWContext *rw,
2502 H266RawAPS *current, int prefix)
2503 {
2504 1706 int aps_id_max = MAX_UINT_BITS(5);
2505 int err;
2506
2507
1/2
✓ Branch 0 taken 853 times.
✗ Branch 1 not taken.
1706 if (prefix)
2508 1706 HEADER("Prefix Adaptation parameter set");
2509 else
2510 HEADER("Suffix Adaptation parameter set");
2511
2512
2/4
✓ Branch 0 taken 853 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 853 times.
1706 CHECK(FUNC(nal_unit_header)(ctx, rw, &current->nal_unit_header,
2513 prefix ? VVC_PREFIX_APS_NUT
2514 : VVC_SUFFIX_APS_NUT));
2515
2516
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 853 times.
1706 ub(3, aps_params_type);
2517
2/2
✓ Branch 0 taken 189 times.
✓ Branch 1 taken 664 times.
1706 if (current->aps_params_type == VVC_ASP_TYPE_ALF ||
2518
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 153 times.
378 current->aps_params_type == VVC_ASP_TYPE_SCALING)
2519 1400 aps_id_max = 7;
2520
1/2
✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
306 else if (current->aps_params_type == VVC_ASP_TYPE_LMCS)
2521 306 aps_id_max = 3;
2522
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 853 times.
1706 u(5, aps_adaptation_parameter_set_id, 0, aps_id_max);
2523
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 853 times.
1706 flag(aps_chroma_present_flag);
2524
2/2
✓ Branch 0 taken 664 times.
✓ Branch 1 taken 189 times.
1706 if (current->aps_params_type == VVC_ASP_TYPE_ALF)
2525
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 664 times.
1328 CHECK(FUNC(alf_data)(ctx, rw, current));
2526
2/2
✓ Branch 0 taken 153 times.
✓ Branch 1 taken 36 times.
378 else if(current->aps_params_type == VVC_ASP_TYPE_LMCS)
2527
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 CHECK(FUNC(lmcs_data)(ctx, rw, current));
2528
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 else if (current->aps_params_type == VVC_ASP_TYPE_SCALING)
2529
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 CHECK(FUNC(scaling_list_data)(ctx, rw, current));
2530
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 853 times.
1706 flag(aps_extension_flag);
2531
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 853 times.
1706 if (current->aps_extension_flag)
2532 CHECK(FUNC(extension_data) (ctx, rw, &current->extension_data));
2533
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 853 times.
1706 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
2534
2535 1706 return 0;
2536 }
2537
2538 130 static int FUNC(aud) (CodedBitstreamContext *ctx, RWContext *rw,
2539 H266RawAUD *current)
2540 {
2541 int err;
2542
2543 130 HEADER("Access Unit Delimiter");
2544
2545
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 65 times.
130 CHECK(FUNC(nal_unit_header) (ctx, rw,
2546 &current->nal_unit_header, VVC_AUD_NUT));
2547
2548
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 65 times.
130 flag(aud_irap_or_gdr_flag);
2549
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 65 times.
130 u(3, aud_pic_type, 0, 2);
2550
2551
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 65 times.
130 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
2552 130 return 0;
2553 }
2554
2555 388 static int FUNC(pred_weight_table) (CodedBitstreamContext *ctx, RWContext *rw,
2556 const H266RawSPS *sps,
2557 const H266RawPPS *pps,
2558 const H266RefPicLists *ref_lists,
2559 uint8_t num_ref_idx_active[2],
2560 H266RawPredWeightTable *current)
2561 {
2562 int err, i, j;
2563
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 194 times.
388 ue(luma_log2_weight_denom, 0, 7);
2564
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 if (sps->sps_chroma_format_idc != 0) {
2565
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 194 times.
388 se(delta_chroma_log2_weight_denom,
2566 -current->luma_log2_weight_denom,
2567 7 - current->luma_log2_weight_denom);
2568 } else {
2569 infer(delta_chroma_log2_weight_denom, 0);
2570 }
2571
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 194 times.
388 if (pps->pps_wp_info_in_ph_flag) {
2572 ue(num_l0_weights, 0,
2573 FFMIN(15, ref_lists->rpl_ref_list[0].num_ref_entries));
2574 infer(num_weights_l0, current->num_l0_weights);
2575 } else {
2576
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
388 infer(num_weights_l0, num_ref_idx_active[0]);
2577 }
2578
2/2
✓ Branch 0 taken 923 times.
✓ Branch 1 taken 194 times.
2234 for (i = 0; i < current->num_weights_l0; i++) {
2579
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 923 times.
1846 flags(luma_weight_l0_flag[i], 1, i);
2580 }
2581
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 if (sps->sps_chroma_format_idc != 0) {
2582
2/2
✓ Branch 0 taken 923 times.
✓ Branch 1 taken 194 times.
2234 for (i = 0; i < current->num_weights_l0; i++)
2583
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 923 times.
1846 flags(chroma_weight_l0_flag[i], 1, i);
2584 }
2585
2/2
✓ Branch 0 taken 923 times.
✓ Branch 1 taken 194 times.
2234 for (i = 0; i < current->num_weights_l0; i++) {
2586
2/2
✓ Branch 0 taken 535 times.
✓ Branch 1 taken 388 times.
1846 if (current->luma_weight_l0_flag[i]) {
2587
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 535 times.
1070 ses(delta_luma_weight_l0[i], -128, 127, 1, i);
2588
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 535 times.
1070 ses(luma_offset_l0[i], -128, 127, 1, i);
2589 } else {
2590
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
776 infer(delta_luma_weight_l0[i], 0);
2591
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
776 infer(luma_offset_l0[i], 0);
2592 }
2593
2/2
✓ Branch 0 taken 481 times.
✓ Branch 1 taken 442 times.
1846 if (current->chroma_weight_l0_flag[i]) {
2594
2/2
✓ Branch 0 taken 962 times.
✓ Branch 1 taken 481 times.
2886 for (j = 0; j < 2; j++) {
2595
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 962 times.
1924 ses(delta_chroma_weight_l0[i][j], -128, 127, 2, i, j);
2596
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 962 times.
1924 ses(delta_chroma_offset_l0[i][j], -4 * 128, 4 * 127, 2, i, j);
2597 }
2598 }
2599 }
2600
2601
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 if (pps->pps_weighted_bipred_flag &&
2602
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 ref_lists->rpl_ref_list[1].num_ref_entries > 0) {
2603
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 194 times.
388 if (pps->pps_wp_info_in_ph_flag) {
2604 ue(num_l1_weights, 0,
2605 FFMIN(15, ref_lists->rpl_ref_list[1].num_ref_entries));
2606 infer(num_weights_l1, current->num_l1_weights);
2607 } else {
2608
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
388 infer(num_weights_l1, num_ref_idx_active[1]);
2609 }
2610 } else {
2611 infer(num_weights_l1, 0);
2612 }
2613
2614
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 194 times.
1994 for (i = 0; i < current->num_weights_l1; i++)
2615
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 803 times.
1606 flags(luma_weight_l1_flag[i], 1, i);
2616
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 if (sps->sps_chroma_format_idc != 0) {
2617
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 194 times.
1994 for (i = 0; i < current->num_weights_l1; i++)
2618
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 803 times.
1606 flags(chroma_weight_l1_flag[i], 1, i);
2619 }
2620
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 194 times.
1994 for (i = 0; i < current->num_weights_l1; i++) {
2621
2/2
✓ Branch 0 taken 391 times.
✓ Branch 1 taken 412 times.
1606 if (current->luma_weight_l1_flag[i]) {
2622
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
782 ses(delta_luma_weight_l1[i], -128, 127, 1, i);
2623
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
782 ses(luma_offset_l1[i], -128, 127, 1, i);
2624 } else {
2625
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
824 infer(delta_luma_weight_l1[i], 0);
2626
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
824 infer(luma_offset_l1[i], 0);
2627 }
2628
2/2
✓ Branch 0 taken 367 times.
✓ Branch 1 taken 436 times.
1606 if (current->chroma_weight_l1_flag[i]) {
2629
2/2
✓ Branch 0 taken 734 times.
✓ Branch 1 taken 367 times.
2202 for (j = 0; j < 2; j++) {
2630
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 734 times.
1468 ses(delta_chroma_weight_l1[i][j], -128, 127, 2, i, j);
2631
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 734 times.
1468 ses(delta_chroma_offset_l1[i][j], -4 * 128, 4 * 127, 2, i, j);
2632 }
2633 }
2634 }
2635 388 return 0;
2636 }
2637
2638 16608 static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw,
2639 H266RawPictureHeader *current) {
2640 16608 CodedBitstreamH266Context *h266 = ctx->priv_data;
2641 const H266RawVPS *vps;
2642 const H266RawSPS *sps;
2643 const H266RawPPS *pps;
2644 int err, i;
2645 unsigned int ctb_log2_size_y, min_cb_log2_size_y,
2646 min_qt_log2_size_intra_y, min_qt_log2_size_inter_y;
2647 uint8_t qp_bd_offset;
2648
2649
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8304 times.
16608 flag(ph_gdr_or_irap_pic_flag);
2650
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8304 times.
16608 flag(ph_non_ref_pic_flag);
2651
2/2
✓ Branch 0 taken 1091 times.
✓ Branch 1 taken 7213 times.
16608 if (current->ph_gdr_or_irap_pic_flag)
2652
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1091 times.
2182 flag(ph_gdr_pic_flag);
2653 else
2654
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1822 times.
14426 infer(ph_gdr_pic_flag, 0);
2655
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8304 times.
16608 flag(ph_inter_slice_allowed_flag);
2656
2/2
✓ Branch 0 taken 7229 times.
✓ Branch 1 taken 1075 times.
16608 if (current->ph_inter_slice_allowed_flag)
2657
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7229 times.
14458 flag(ph_intra_slice_allowed_flag);
2658 else
2659
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2150 infer(ph_intra_slice_allowed_flag, 1);
2660
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8304 times.
16608 ue(ph_pic_parameter_set_id, 0, VVC_MAX_PPS_COUNT - 1);
2661 16608 pps = h266->pps[current->ph_pic_parameter_set_id];
2662
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8304 times.
16608 if (!pps) {
2663 av_log(ctx->log_ctx, AV_LOG_ERROR, "PPS id %d not available.\n",
2664 current->ph_pic_parameter_set_id);
2665 return AVERROR_INVALIDDATA;
2666 }
2667 16608 sps = h266->sps[pps->pps_seq_parameter_set_id];
2668
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8304 times.
16608 if (!sps) {
2669 av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n",
2670 pps->pps_seq_parameter_set_id);
2671 return AVERROR_INVALIDDATA;
2672 }
2673 16608 vps = h266->vps[sps->sps_video_parameter_set_id];
2674
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8304 times.
16608 if (!vps) {
2675 av_log(ctx->log_ctx, AV_LOG_ERROR, "VPS id %d not available.\n",
2676 sps->sps_video_parameter_set_id);
2677 return AVERROR_INVALIDDATA;
2678 }
2679
2680
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8304 times.
16608 ub(sps->sps_log2_max_pic_order_cnt_lsb_minus4 + 4, ph_pic_order_cnt_lsb);
2681
2/2
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 8277 times.
16608 if (current->ph_gdr_pic_flag)
2682
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
54 ue(ph_recovery_poc_cnt, 0,
2683 1 << (sps->sps_log2_max_pic_order_cnt_lsb_minus4 + 4));
2684
2685
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8304 times.
16608 for (i = 0; i < sps->sps_num_extra_ph_bytes * 8; i++) {
2686 if (sps->sps_extra_ph_bit_present_flag[i])
2687 flags(ph_extra_bit[i], 1, i);
2688 }
2689
2/2
✓ Branch 0 taken 102 times.
✓ Branch 1 taken 8202 times.
16608 if (sps->sps_poc_msb_cycle_flag) {
2690
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
204 flag(ph_poc_msb_cycle_present_flag);
2691
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 102 times.
204 if (current->ph_poc_msb_cycle_present_flag)
2692 ub(sps->sps_poc_msb_cycle_len_minus1 + 1, ph_poc_msb_cycle_val);
2693 }
2694
4/4
✓ Branch 0 taken 3985 times.
✓ Branch 1 taken 4319 times.
✓ Branch 2 taken 71 times.
✓ Branch 3 taken 3914 times.
16608 if (sps->sps_alf_enabled_flag && pps->pps_alf_info_in_ph_flag) {
2695
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 71 times.
142 flag(ph_alf_enabled_flag);
2696
2/2
✓ Branch 0 taken 49 times.
✓ Branch 1 taken 22 times.
142 if (current->ph_alf_enabled_flag) {
2697
2698
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 ub(3, ph_num_alf_aps_ids_luma);
2699
2/2
✓ Branch 0 taken 51 times.
✓ Branch 1 taken 49 times.
200 for (i = 0; i < current->ph_num_alf_aps_ids_luma; i++)
2700
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
102 ubs(3, ph_alf_aps_id_luma[i], 1, i);
2701
2702
1/2
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
98 if (sps->sps_chroma_format_idc != 0) {
2703
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 flag(ph_alf_cb_enabled_flag);
2704
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 flag(ph_alf_cr_enabled_flag);
2705 } else {
2706 infer(ph_alf_cb_enabled_flag, 0);
2707 infer(ph_alf_cr_enabled_flag, 0);
2708 }
2709
2710
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 23 times.
98 if (current->ph_alf_cb_enabled_flag
2711
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 24 times.
52 || current->ph_alf_cr_enabled_flag) {
2712
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
50 ub(3, ph_alf_aps_id_chroma);
2713 }
2714
2715
1/2
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
98 if (sps->sps_ccalf_enabled_flag) {
2716
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 flag(ph_alf_cc_cb_enabled_flag);
2717
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 43 times.
98 if (current->ph_alf_cc_cb_enabled_flag)
2718
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 ub(3, ph_alf_cc_cb_aps_id);
2719
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 flag(ph_alf_cc_cr_enabled_flag);
2720
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 45 times.
98 if (current->ph_alf_cc_cr_enabled_flag)
2721
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
8 ub(3, ph_alf_cc_cr_aps_id);
2722 }
2723 }
2724 } else {
2725
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
16466 infer(ph_alf_enabled_flag, 0);
2726 }
2727
2/2
✓ Branch 0 taken 4348 times.
✓ Branch 1 taken 3956 times.
16608 if (sps->sps_lmcs_enabled_flag) {
2728
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4348 times.
8696 flag(ph_lmcs_enabled_flag);
2729
2/2
✓ Branch 0 taken 1762 times.
✓ Branch 1 taken 2586 times.
8696 if (current->ph_lmcs_enabled_flag) {
2730
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1762 times.
3524 ub(2, ph_lmcs_aps_id);
2731
1/2
✓ Branch 0 taken 1762 times.
✗ Branch 1 not taken.
3524 if (sps->sps_chroma_format_idc != 0)
2732
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1762 times.
3524 flag(ph_chroma_residual_scale_flag);
2733 else
2734 infer(ph_chroma_residual_scale_flag, 0);
2735 }
2736 } else {
2737
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1290 times.
7912 infer(ph_lmcs_enabled_flag, 0);
2738
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1290 times.
7912 infer(ph_chroma_residual_scale_flag, 0);
2739 }
2740
2741
2/2
✓ Branch 0 taken 605 times.
✓ Branch 1 taken 7699 times.
16608 if (sps->sps_explicit_scaling_list_enabled_flag) {
2742
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 605 times.
1210 flag(ph_explicit_scaling_list_enabled_flag);
2743
1/2
✓ Branch 0 taken 605 times.
✗ Branch 1 not taken.
1210 if (current->ph_explicit_scaling_list_enabled_flag) {
2744 //todo: check the ph_scaling_list_aps_id range, when aps ready
2745
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 605 times.
1210 ub(3, ph_scaling_list_aps_id);
2746 }
2747 } else {
2748
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2018 times.
15398 infer(ph_explicit_scaling_list_enabled_flag, 0);
2749 }
2750
2/2
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 8263 times.
16608 if (sps->sps_virtual_boundaries_enabled_flag &&
2751
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
82 !sps->sps_virtual_boundaries_present_flag) {
2752 flag(ph_virtual_boundaries_present_flag);
2753 if (current->ph_virtual_boundaries_present_flag) {
2754 ue(ph_num_ver_virtual_boundaries,
2755 0, pps->pps_pic_width_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS);
2756 for (i = 0; i < current->ph_num_ver_virtual_boundaries; i++) {
2757 ues(ph_virtual_boundary_pos_x_minus1[i],
2758 0, (pps->pps_pic_width_in_luma_samples + 7) / 8 - 2, 1, i);
2759 }
2760 ue(ph_num_hor_virtual_boundaries,
2761 0, pps->pps_pic_height_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS);
2762 for (i = 0; i < current->ph_num_hor_virtual_boundaries; i++) {
2763 ues(ph_virtual_boundary_pos_y_minus1[i],
2764 0, (pps->pps_pic_height_in_luma_samples + 7) / 8 - 2, 1, i);
2765 }
2766 } else {
2767 infer(ph_num_ver_virtual_boundaries, 0);
2768 infer(ph_num_hor_virtual_boundaries, 0);
2769 }
2770 }
2771
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 8304 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
16608 if (pps->pps_output_flag_present_flag && !current->ph_non_ref_pic_flag)
2772 flag(ph_pic_output_flag);
2773 else
2774
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
16608 infer(ph_pic_output_flag, 1);
2775
2/2
✓ Branch 0 taken 67 times.
✓ Branch 1 taken 8237 times.
16608 if (pps->pps_rpl_info_in_ph_flag) {
2776
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
134 CHECK(FUNC(ref_pic_lists)
2777 (ctx, rw, sps, pps, &current->ph_ref_pic_lists));
2778 }
2779
2/2
✓ Branch 0 taken 8243 times.
✓ Branch 1 taken 61 times.
16608 if (sps->sps_partition_constraints_override_enabled_flag)
2780
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8243 times.
16486 flag(ph_partition_constraints_override_flag);
2781 else
2782
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
122 infer(ph_partition_constraints_override_flag, 0);
2783
2784 16608 ctb_log2_size_y = sps->sps_log2_ctu_size_minus5 + 5;
2785 16608 min_cb_log2_size_y = sps->sps_log2_min_luma_coding_block_size_minus2 + 2;
2786
2/2
✓ Branch 0 taken 1113 times.
✓ Branch 1 taken 7191 times.
16608 if (current->ph_intra_slice_allowed_flag) {
2787
2/2
✓ Branch 0 taken 39 times.
✓ Branch 1 taken 1074 times.
2226 if (current->ph_partition_constraints_override_flag) {
2788
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_min_qt_min_cb_intra_slice_luma,
2789 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
2790
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_max_mtt_hierarchy_depth_intra_slice_luma,
2791 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
2792
1/2
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
78 if (current->ph_max_mtt_hierarchy_depth_intra_slice_luma != 0) {
2793 78 min_qt_log2_size_intra_y =
2794 78 current->ph_log2_diff_min_qt_min_cb_intra_slice_luma +
2795 min_cb_log2_size_y;
2796
2/4
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 39 times.
78 ue(ph_log2_diff_max_bt_min_qt_intra_slice_luma,
2797 0, (sps->sps_qtbtt_dual_tree_intra_flag ?
2798 FFMIN(6, ctb_log2_size_y) :
2799 ctb_log2_size_y) - min_qt_log2_size_intra_y);
2800
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_max_tt_min_qt_intra_slice_luma,
2801 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_y);
2802 } else {
2803 infer(ph_log2_diff_max_bt_min_qt_intra_slice_luma,
2804 sps->sps_log2_diff_max_bt_min_qt_intra_slice_luma);
2805 infer(ph_log2_diff_max_tt_min_qt_intra_slice_luma,
2806 sps->sps_log2_diff_max_tt_min_qt_intra_slice_luma);
2807 }
2808
1/2
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
78 if (sps->sps_qtbtt_dual_tree_intra_flag) {
2809
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_min_qt_min_cb_intra_slice_chroma,
2810 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
2811
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_max_mtt_hierarchy_depth_intra_slice_chroma,
2812 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
2813
1/2
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
78 if (sps->sps_max_mtt_hierarchy_depth_intra_slice_chroma != 0) {
2814 78 unsigned int min_qt_log2_size_intra_c =
2815 78 current->ph_log2_diff_min_qt_min_cb_intra_slice_chroma +
2816 min_cb_log2_size_y;
2817
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_max_bt_min_qt_intra_slice_chroma,
2818 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_c);
2819
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_max_tt_min_qt_intra_slice_chroma,
2820 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_c);
2821 } else {
2822 infer(ph_log2_diff_max_bt_min_qt_intra_slice_chroma,
2823 sps->sps_log2_diff_max_bt_min_qt_intra_slice_chroma);
2824 infer(ph_log2_diff_max_tt_min_qt_intra_slice_chroma,
2825 sps->sps_log2_diff_max_tt_min_qt_intra_slice_chroma);
2826 }
2827 }
2828 } else {
2829
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2148 infer(ph_log2_diff_min_qt_min_cb_intra_slice_luma,
2830 sps->sps_log2_diff_min_qt_min_cb_intra_slice_luma);
2831
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2148 infer(ph_max_mtt_hierarchy_depth_intra_slice_luma,
2832 sps->sps_max_mtt_hierarchy_depth_intra_slice_luma);
2833
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2148 infer(ph_log2_diff_max_bt_min_qt_intra_slice_luma,
2834 sps->sps_log2_diff_max_bt_min_qt_intra_slice_luma);
2835
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2148 infer(ph_log2_diff_max_tt_min_qt_intra_slice_luma,
2836 sps->sps_log2_diff_max_tt_min_qt_intra_slice_luma);
2837
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2148 infer(ph_log2_diff_min_qt_min_cb_intra_slice_chroma,
2838 sps->sps_log2_diff_min_qt_min_cb_intra_slice_chroma);
2839
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2148 infer(ph_max_mtt_hierarchy_depth_intra_slice_chroma,
2840 sps->sps_max_mtt_hierarchy_depth_intra_slice_chroma);
2841
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2148 infer(ph_log2_diff_max_bt_min_qt_intra_slice_chroma,
2842 sps->sps_log2_diff_max_bt_min_qt_intra_slice_chroma);
2843
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2148 infer(ph_log2_diff_max_tt_min_qt_intra_slice_chroma,
2844 sps->sps_log2_diff_max_tt_min_qt_intra_slice_chroma);
2845 }
2846
2847 2226 min_qt_log2_size_intra_y =
2848 2226 current->ph_log2_diff_min_qt_min_cb_intra_slice_luma +
2849 min_cb_log2_size_y;
2850
2/2
✓ Branch 0 taken 60 times.
✓ Branch 1 taken 1053 times.
2226 if (pps->pps_cu_qp_delta_enabled_flag)
2851
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 60 times.
120 ue(ph_cu_qp_delta_subdiv_intra_slice, 0,
2852 2 * (ctb_log2_size_y - min_qt_log2_size_intra_y +
2853 current->ph_max_mtt_hierarchy_depth_intra_slice_luma));
2854 else
2855
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 301 times.
2106 infer(ph_cu_qp_delta_subdiv_intra_slice, 0);
2856
2857
2/2
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 1072 times.
2226 if (pps->pps_cu_chroma_qp_offset_list_enabled_flag)
2858
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
82 ue(ph_cu_chroma_qp_offset_subdiv_intra_slice, 0,
2859 2 * (ctb_log2_size_y - min_qt_log2_size_intra_y +
2860 current->ph_max_mtt_hierarchy_depth_intra_slice_luma));
2861 else
2862
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2144 infer(ph_cu_chroma_qp_offset_subdiv_intra_slice, 0);
2863 }
2864
2/2
✓ Branch 0 taken 7229 times.
✓ Branch 1 taken 1075 times.
16608 if (current->ph_inter_slice_allowed_flag) {
2865
2/2
✓ Branch 0 taken 1862 times.
✓ Branch 1 taken 5367 times.
14458 if (current->ph_partition_constraints_override_flag) {
2866
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1862 times.
3724 ue(ph_log2_diff_min_qt_min_cb_inter_slice,
2867 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
2868 3724 min_qt_log2_size_inter_y =
2869 3724 current->ph_log2_diff_min_qt_min_cb_inter_slice +
2870 min_cb_log2_size_y;
2871
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1862 times.
3724 ue(ph_max_mtt_hierarchy_depth_inter_slice, 0,
2872 2 * (ctb_log2_size_y - min_cb_log2_size_y));
2873
1/2
✓ Branch 0 taken 1862 times.
✗ Branch 1 not taken.
3724 if (current->ph_max_mtt_hierarchy_depth_inter_slice != 0) {
2874
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1862 times.
3724 ue(ph_log2_diff_max_bt_min_qt_inter_slice,
2875 0, ctb_log2_size_y - min_qt_log2_size_inter_y);
2876
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1862 times.
3724 ue(ph_log2_diff_max_tt_min_qt_inter_slice,
2877 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_inter_y);
2878 }
2879 } else {
2880
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1472 times.
10734 infer(ph_log2_diff_min_qt_min_cb_inter_slice,
2881 sps->sps_log2_diff_min_qt_min_cb_inter_slice);
2882 10734 min_qt_log2_size_inter_y =
2883 10734 current->ph_log2_diff_min_qt_min_cb_inter_slice +
2884 min_cb_log2_size_y;
2885
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1472 times.
10734 infer(ph_max_mtt_hierarchy_depth_inter_slice,
2886 sps->sps_max_mtt_hierarchy_depth_inter_slice);
2887
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1472 times.
10734 infer(ph_log2_diff_max_bt_min_qt_inter_slice,
2888 sps->sps_log2_diff_max_bt_min_qt_inter_slice);
2889
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1472 times.
10734 infer(ph_log2_diff_max_tt_min_qt_inter_slice,
2890 sps->sps_log2_diff_max_tt_min_qt_inter_slice);
2891 }
2892
2893
2/2
✓ Branch 0 taken 382 times.
✓ Branch 1 taken 6847 times.
14458 if (pps->pps_cu_qp_delta_enabled_flag)
2894
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 382 times.
764 ue(ph_cu_qp_delta_subdiv_inter_slice, 0,
2895 2 * (ctb_log2_size_y - min_qt_log2_size_inter_y +
2896 current->ph_max_mtt_hierarchy_depth_inter_slice));
2897 else
2898
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1769 times.
13694 infer(ph_cu_qp_delta_subdiv_inter_slice, 0);
2899
2900
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 7191 times.
14458 if (pps->pps_cu_chroma_qp_offset_list_enabled_flag)
2901
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ue(ph_cu_chroma_qp_offset_subdiv_inter_slice, 0,
2902 2 * (ctb_log2_size_y - min_qt_log2_size_inter_y +
2903 current->ph_max_mtt_hierarchy_depth_inter_slice));
2904 else
2905
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1827 times.
14382 infer(ph_cu_chroma_qp_offset_subdiv_inter_slice, 0);
2906
1/2
✓ Branch 0 taken 7229 times.
✗ Branch 1 not taken.
14458 if (sps->sps_temporal_mvp_enabled_flag) {
2907
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7229 times.
14458 flag(ph_temporal_mvp_enabled_flag);
2908
2/2
✓ Branch 0 taken 7227 times.
✓ Branch 1 taken 2 times.
14458 if (current->ph_temporal_mvp_enabled_flag &&
2909
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 7163 times.
14454 pps->pps_rpl_info_in_ph_flag) {
2910
1/2
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
128 if (current->ph_ref_pic_lists.rpl_ref_list[1].num_ref_entries > 0)
2911
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
128 flag(ph_collocated_from_l0_flag);
2912 else
2913 infer(ph_collocated_from_l0_flag, 1);
2914
2/2
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 42 times.
128 if ((current->ph_collocated_from_l0_flag &&
2915
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
44 current->ph_ref_pic_lists.rpl_ref_list[0].num_ref_entries > 1)
2916
1/2
✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
84 || (!current->ph_collocated_from_l0_flag &&
2917
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 2 times.
208 current->ph_ref_pic_lists.rpl_ref_list[1].num_ref_entries > 1)) {
2918 124 unsigned int idx =
2919 124 current->ph_collocated_from_l0_flag ? 0 : 1;
2920
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 62 times.
124 ue(ph_collocated_ref_idx, 0,
2921 current->ph_ref_pic_lists.rpl_ref_list[idx].
2922 num_ref_entries - 1);
2923 } else {
2924
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
4 infer(ph_collocated_ref_idx, 0);
2925 }
2926 }
2927 }
2928
2/2
✓ Branch 0 taken 4103 times.
✓ Branch 1 taken 3126 times.
14458 if (sps->sps_mmvd_fullpel_only_enabled_flag)
2929
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4103 times.
8206 flag(ph_mmvd_fullpel_only_flag);
2930 else
2931
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1024 times.
6252 infer(ph_mmvd_fullpel_only_flag, 0);
2932
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 7165 times.
14458 if (!pps->pps_rpl_info_in_ph_flag ||
2933
1/2
✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
128 current->ph_ref_pic_lists.rpl_ref_list[1].num_ref_entries > 0) {
2934
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7229 times.
14458 flag(ph_mvd_l1_zero_flag);
2935
2/2
✓ Branch 0 taken 3721 times.
✓ Branch 1 taken 3508 times.
14458 if (sps->sps_bdof_control_present_in_ph_flag) {
2936
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3721 times.
7442 flag(ph_bdof_disabled_flag);
2937 } else {
2938
1/2
✓ Branch 0 taken 3508 times.
✗ Branch 1 not taken.
7016 if (!sps->sps_bdof_control_present_in_ph_flag)
2939
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1096 times.
7016 infer(ph_bdof_disabled_flag,
2940 1 - sps->sps_bdof_enabled_flag);
2941 else
2942 infer(ph_bdof_disabled_flag, 1);
2943 }
2944
2/2
✓ Branch 0 taken 3491 times.
✓ Branch 1 taken 3738 times.
14458 if (sps->sps_dmvr_control_present_in_ph_flag) {
2945
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3491 times.
6982 flag(ph_dmvr_disabled_flag);
2946 } else {
2947
1/2
✓ Branch 0 taken 3738 times.
✗ Branch 1 not taken.
7476 if (!sps->sps_dmvr_control_present_in_ph_flag)
2948
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1142 times.
7476 infer(ph_dmvr_disabled_flag,
2949 1 - sps->sps_dmvr_enabled_flag);
2950 else
2951 infer(ph_dmvr_disabled_flag, 1);
2952 }
2953 } else {
2954 infer(ph_mvd_l1_zero_flag, 1);
2955 }
2956
2/2
✓ Branch 0 taken 4103 times.
✓ Branch 1 taken 3126 times.
14458 if (sps->sps_prof_control_present_in_ph_flag)
2957
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4103 times.
8206 flag(ph_prof_disabled_flag);
2958 else
2959
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1024 times.
6252 infer(ph_prof_disabled_flag, !sps->sps_affine_prof_enabled_flag);
2960
2/2
✓ Branch 0 taken 7111 times.
✓ Branch 1 taken 118 times.
14458 if ((pps->pps_weighted_pred_flag ||
2961
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 7111 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 118 times.
14458 pps->pps_weighted_bipred_flag) && pps->pps_wp_info_in_ph_flag) {
2962
2963 // if pps->pps_wp_info_in_ph_fla == 1
2964 // pred_weight_table will not use num_ref_idx_active
2965 uint8_t num_ref_idx_active[2] = { 0, 0 };
2966 CHECK(FUNC(pred_weight_table)
2967 (ctx, rw, sps, pps, &current->ph_ref_pic_lists,
2968 num_ref_idx_active, &current->ph_pred_weight_table));
2969 }
2970 }
2971
2972 16608 qp_bd_offset = 6 * sps->sps_bitdepth_minus8;
2973
2/2
✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8235 times.
16608 if (pps->pps_qp_delta_info_in_ph_flag)
2974
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
138 se(ph_qp_delta, -qp_bd_offset - (26 + pps->pps_init_qp_minus26),
2975 63 - (26 + pps->pps_init_qp_minus26));
2976
2977
2/2
✓ Branch 0 taken 4080 times.
✓ Branch 1 taken 4224 times.
16608 if (sps->sps_joint_cbcr_enabled_flag)
2978
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4080 times.
8160 flag(ph_joint_cbcr_sign_flag);
2979 else
2980
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1344 times.
8448 infer(ph_joint_cbcr_sign_flag, 0);
2981
4/4
✓ Branch 0 taken 4451 times.
✓ Branch 1 taken 3853 times.
✓ Branch 2 taken 73 times.
✓ Branch 3 taken 4378 times.
16608 if (sps->sps_sao_enabled_flag && pps->pps_sao_info_in_ph_flag) {
2982
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
146 flag(ph_sao_luma_enabled_flag);
2983
1/2
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
146 if (sps->sps_chroma_format_idc != 0)
2984
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
146 flag(ph_sao_chroma_enabled_flag);
2985 else
2986 infer(ph_sao_chroma_enabled_flag, 0);
2987 } else {
2988
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
16462 infer(ph_sao_luma_enabled_flag, 0);
2989
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
16462 infer(ph_sao_chroma_enabled_flag, 0);
2990 }
2991
2992
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 8291 times.
16608 if (pps->pps_dbf_info_in_ph_flag)
2993
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 flag(ph_deblocking_params_present_flag);
2994 else
2995
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
16582 infer(ph_deblocking_params_present_flag, 0);
2996
2997
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 8291 times.
16608 if (current->ph_deblocking_params_present_flag) {
2998
1/2
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
26 if (!pps->pps_deblocking_filter_disabled_flag) {
2999
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 flag(ph_deblocking_filter_disabled_flag);
3000
1/2
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
26 if (!current->ph_deblocking_filter_disabled_flag) {
3001
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_luma_beta_offset_div2, -12, 12);
3002
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_luma_tc_offset_div2, -12, 12);
3003
1/2
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
26 if (pps->pps_chroma_tool_offsets_present_flag) {
3004
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_cb_beta_offset_div2, -12, 12);
3005
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_cb_tc_offset_div2, -12, 12);
3006
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_cr_beta_offset_div2, -12, 12);
3007
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_cr_tc_offset_div2, -12, 12);
3008 } else {
3009 infer(ph_cb_beta_offset_div2,
3010 current->ph_luma_beta_offset_div2);
3011 infer(ph_cb_tc_offset_div2,
3012 current->ph_luma_tc_offset_div2);
3013 infer(ph_cr_beta_offset_div2,
3014 current->ph_luma_beta_offset_div2);
3015 infer(ph_cr_tc_offset_div2,
3016 current->ph_luma_tc_offset_div2);
3017 }
3018 }
3019 } else {
3020 infer(ph_deblocking_filter_disabled_flag, 0);
3021 }
3022 } else {
3023
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
16582 infer(ph_deblocking_filter_disabled_flag, pps->pps_deblocking_filter_disabled_flag);
3024
2/2
✓ Branch 0 taken 4450 times.
✓ Branch 1 taken 3841 times.
16582 if (!current->ph_deblocking_filter_disabled_flag) {
3025
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
8900 infer(ph_luma_beta_offset_div2, pps->pps_luma_beta_offset_div2);
3026
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
8900 infer(ph_luma_tc_offset_div2, pps->pps_luma_tc_offset_div2);
3027
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
8900 infer(ph_cb_beta_offset_div2, pps->pps_cb_beta_offset_div2);
3028
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
8900 infer(ph_cb_tc_offset_div2, pps->pps_cb_tc_offset_div2);
3029
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
8900 infer(ph_cr_beta_offset_div2, pps->pps_cr_beta_offset_div2);
3030
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
8900 infer(ph_cr_tc_offset_div2, pps->pps_cr_tc_offset_div2);
3031 }
3032 }
3033
3034
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8304 times.
16608 if (pps->pps_picture_header_extension_present_flag) {
3035 ue(ph_extension_length, 0, 256);
3036 for (i = 0; i < current->ph_extension_length; i++)
3037 us(8, ph_extension_data_byte[i], 0x00, 0xff, 1, i);
3038 }
3039
3040 16608 return 0;
3041 }
3042
3043 490 static int FUNC(ph) (CodedBitstreamContext *ctx, RWContext *rw,
3044 H266RawPH *current)
3045 {
3046 int err;
3047
3048 490 HEADER("Picture Header");
3049
3050
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
490 CHECK(FUNC(nal_unit_header) (ctx, rw, &current->nal_unit_header, VVC_PH_NUT));
3051
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
490 CHECK(FUNC(picture_header) (ctx, rw, &current->ph_picture_header));
3052
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
490 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
3053 490 return 0;
3054 }
3055
3056 22330 static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
3057 H266RawSliceHeader *current)
3058 {
3059 22330 CodedBitstreamH266Context *h266 = ctx->priv_data;
3060 const H266RawSPS *sps;
3061 const H266RawPPS *pps;
3062 const H266RawPictureHeader *ph;
3063 const H266RefPicLists *ref_pic_lists;
3064 int err, i;
3065 uint8_t nal_unit_type, qp_bd_offset;
3066 uint16_t num_slices_in_subpic;
3067
3068 22330 HEADER("Slice Header");
3069
3070
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11165 times.
22330 CHECK(FUNC(nal_unit_header) (ctx, rw, &current->nal_unit_header, -1));
3071
3072
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11165 times.
22330 flag(sh_picture_header_in_slice_header_flag);
3073
2/2
✓ Branch 0 taken 8059 times.
✓ Branch 1 taken 3106 times.
22330 if (current->sh_picture_header_in_slice_header_flag) {
3074 // 7.4.8 if sh_picture_header_in_slice_header_flag is true, we do not have a PH NAL unit
3075
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8059 times.
16118 CHECK(FUNC(picture_header) (ctx, rw, &current->sh_picture_header));
3076 16118 ph = &current->sh_picture_header;
3077 } else {
3078 6212 ph = h266->ph;
3079
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3106 times.
6212 if (!ph) {
3080 av_log(ctx->log_ctx, AV_LOG_ERROR,
3081 "Picture header not available.\n");
3082 return AVERROR_INVALIDDATA;
3083 }
3084 }
3085
3086 22330 pps = h266->pps[ph->ph_pic_parameter_set_id];
3087
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11165 times.
22330 if (!pps) {
3088 av_log(ctx->log_ctx, AV_LOG_ERROR, "PPS id %d not available.\n",
3089 ph->ph_pic_parameter_set_id);
3090 return AVERROR_INVALIDDATA;
3091 }
3092 22330 sps = h266->sps[pps->pps_seq_parameter_set_id];
3093
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11165 times.
22330 if (!sps) {
3094 av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n",
3095 pps->pps_seq_parameter_set_id);
3096 return AVERROR_INVALIDDATA;
3097 }
3098
3099
2/2
✓ Branch 0 taken 819 times.
✓ Branch 1 taken 10346 times.
22330 if (sps->sps_subpic_info_present_flag) {
3100
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 819 times.
1638 ub(sps->sps_subpic_id_len_minus1 + 1, sh_subpic_id);
3101
1/2
✓ Branch 0 taken 2982 times.
✗ Branch 1 not taken.
5964 for (i = 0; i <= sps->sps_num_subpics_minus1; i++) {
3102
2/2
✓ Branch 0 taken 819 times.
✓ Branch 1 taken 2163 times.
5964 if (pps->sub_pic_id_val[i] == current->sh_subpic_id) {
3103 1638 current->curr_subpic_idx = i;
3104 1638 break;
3105 }
3106 }
3107
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 819 times.
1638 if (i > sps->sps_num_subpics_minus1) {
3108 av_log(ctx->log_ctx, AV_LOG_ERROR, "invalid CurrSubpicIdx %d\n", i);
3109 return AVERROR_INVALIDDATA;
3110 }
3111 } else {
3112 20692 current->curr_subpic_idx = 0;
3113 }
3114
3115 22330 num_slices_in_subpic = pps->num_slices_in_subpic[current->curr_subpic_idx];
3116
3117
4/4
✓ Branch 0 taken 2266 times.
✓ Branch 1 taken 8899 times.
✓ Branch 2 taken 756 times.
✓ Branch 3 taken 1510 times.
22330 if ((pps->pps_rect_slice_flag && num_slices_in_subpic > 1) ||
3118
4/4
✓ Branch 0 taken 8899 times.
✓ Branch 1 taken 756 times.
✓ Branch 2 taken 850 times.
✓ Branch 3 taken 8049 times.
24030 (!pps->pps_rect_slice_flag && pps->num_tiles_in_pic > 1)) {
3119 unsigned int bits, max;
3120
2/2
✓ Branch 0 taken 850 times.
✓ Branch 1 taken 1510 times.
4720 if (!pps->pps_rect_slice_flag) {
3121 1700 bits = av_ceil_log2(pps->num_tiles_in_pic);
3122 1700 max = pps->num_tiles_in_pic - 1;
3123 } else {
3124 3020 bits = av_ceil_log2(num_slices_in_subpic);
3125 3020 max = num_slices_in_subpic - 1;
3126 }
3127
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2360 times.
4720 u(bits, sh_slice_address, 0, max);
3128 } else {
3129
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2122 times.
17610 infer(sh_slice_address, 0);
3130 }
3131
3132
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11165 times.
22330 for (i = 0; i < sps->sps_num_extra_sh_bytes * 8; i++) {
3133 if (sps->sps_extra_sh_bit_present_flag[i])
3134 flags(sh_extra_bit[i], 1, i);
3135 }
3136
3137
2/2
✓ Branch 0 taken 8899 times.
✓ Branch 1 taken 2266 times.
22330 if (!pps->pps_rect_slice_flag &&
3138
2/2
✓ Branch 0 taken 800 times.
✓ Branch 1 taken 8099 times.
17798 pps->num_tiles_in_pic - current->sh_slice_address > 1)
3139
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 800 times.
1600 ue(sh_num_tiles_in_slice_minus1, 0, pps->num_tiles_in_pic - 1);
3140 else
3141
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2428 times.
20730 infer(sh_num_tiles_in_slice_minus1, 0);
3142
3143
2/2
✓ Branch 0 taken 9459 times.
✓ Branch 1 taken 1706 times.
22330 if (ph->ph_inter_slice_allowed_flag)
3144
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9459 times.
18918 ue(sh_slice_type, 0, 2);
3145 else
3146
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 417 times.
3412 infer(sh_slice_type, 2);
3147
3148 22330 nal_unit_type = current->nal_unit_header.nal_unit_type;
3149
6/6
✓ Branch 0 taken 11143 times.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 9510 times.
✓ Branch 3 taken 1633 times.
✓ Branch 4 taken 9463 times.
✓ Branch 5 taken 47 times.
22330 if (nal_unit_type == VVC_IDR_W_RADL || nal_unit_type == VVC_IDR_N_LP ||
3150
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 9456 times.
18926 nal_unit_type == VVC_CRA_NUT || nal_unit_type == VVC_GDR_NUT)
3151
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1709 times.
3418 flag(sh_no_output_of_prior_pics_flag);
3152
3153
2/2
✓ Branch 0 taken 6846 times.
✓ Branch 1 taken 4319 times.
22330 if (sps->sps_alf_enabled_flag) {
3154
2/2
✓ Branch 0 taken 6308 times.
✓ Branch 1 taken 538 times.
13692 if (!pps->pps_alf_info_in_ph_flag) {
3155
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6308 times.
12616 flag(sh_alf_enabled_flag);
3156
2/2
✓ Branch 0 taken 5456 times.
✓ Branch 1 taken 852 times.
12616 if (current->sh_alf_enabled_flag) {
3157
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5456 times.
10912 ub(3, sh_num_alf_aps_ids_luma);
3158
2/2
✓ Branch 0 taken 6718 times.
✓ Branch 1 taken 5456 times.
24348 for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
3159
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6718 times.
13436 ubs(3, sh_alf_aps_id_luma[i], 1, i);
3160
3161
2/2
✓ Branch 0 taken 5169 times.
✓ Branch 1 taken 287 times.
10912 if (sps->sps_chroma_format_idc != 0) {
3162
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5169 times.
10338 flag(sh_alf_cb_enabled_flag);
3163
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5169 times.
10338 flag(sh_alf_cr_enabled_flag);
3164 }
3165
2/2
✓ Branch 0 taken 3079 times.
✓ Branch 1 taken 2377 times.
10912 if (current->sh_alf_cb_enabled_flag ||
3166
2/2
✓ Branch 0 taken 709 times.
✓ Branch 1 taken 2370 times.
6158 current->sh_alf_cr_enabled_flag) {
3167
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3086 times.
6172 ub(3, sh_alf_aps_id_chroma);
3168 }
3169
3170
2/2
✓ Branch 0 taken 5169 times.
✓ Branch 1 taken 287 times.
10912 if (sps->sps_ccalf_enabled_flag) {
3171
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5169 times.
10338 flag(sh_alf_cc_cb_enabled_flag);
3172
2/2
✓ Branch 0 taken 800 times.
✓ Branch 1 taken 4369 times.
10338 if (current->sh_alf_cc_cb_enabled_flag)
3173
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 800 times.
1600 ub(3, sh_alf_cc_cb_aps_id);
3174
3175
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5169 times.
10338 flag(sh_alf_cc_cr_enabled_flag);
3176
2/2
✓ Branch 0 taken 680 times.
✓ Branch 1 taken 4489 times.
10338 if (current->sh_alf_cc_cr_enabled_flag)
3177
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 680 times.
1360 ub(3, sh_alf_cc_cr_aps_id);
3178 }
3179 }
3180 } else {
3181
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
1076 infer(sh_alf_enabled_flag, ph->ph_alf_enabled_flag);
3182
2/2
✓ Branch 0 taken 362 times.
✓ Branch 1 taken 176 times.
1076 if (current->sh_alf_enabled_flag) {
3183
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
724 infer(sh_num_alf_aps_ids_luma, ph->ph_num_alf_aps_ids_luma);
3184
2/2
✓ Branch 0 taken 298 times.
✓ Branch 1 taken 362 times.
1320 for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
3185
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
596 infer(sh_alf_aps_id_luma[i], ph->ph_alf_aps_id_luma[i]);
3186
3187
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
724 infer(sh_alf_cb_enabled_flag, ph->ph_alf_cb_enabled_flag);
3188
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
724 infer(sh_alf_cr_enabled_flag, ph->ph_alf_cr_enabled_flag);
3189
4/4
✓ Branch 0 taken 208 times.
✓ Branch 1 taken 154 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 192 times.
724 if (current->sh_alf_cb_enabled_flag ||current->sh_alf_cr_enabled_flag)
3190
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
340 infer(sh_alf_aps_id_chroma, ph->ph_alf_aps_id_chroma);
3191
3192
1/2
✓ Branch 0 taken 362 times.
✗ Branch 1 not taken.
724 if (sps->sps_ccalf_enabled_flag) {
3193
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
724 infer(sh_alf_cc_cb_enabled_flag, ph->ph_alf_cc_cb_enabled_flag);
3194
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 344 times.
724 if (current->sh_alf_cc_cb_enabled_flag)
3195
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
36 infer(sh_alf_cc_cb_aps_id, ph->ph_alf_cc_cb_aps_id);
3196
3197
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
724 infer(sh_alf_cc_cr_enabled_flag, ph->ph_alf_cc_cr_enabled_flag);
3198
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 350 times.
724 if (current->sh_alf_cc_cr_enabled_flag)
3199
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
24 infer(sh_alf_cc_cr_aps_id, ph->ph_alf_cc_cr_aps_id);
3200 }
3201 }
3202 }
3203 }
3204
3205
2/2
✓ Branch 0 taken 8059 times.
✓ Branch 1 taken 3106 times.
22330 if (current->sh_picture_header_in_slice_header_flag) {
3206
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2103 times.
16118 infer(sh_lmcs_used_flag, ph->ph_lmcs_enabled_flag);
3207
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2103 times.
16118 infer(sh_explicit_scaling_list_used_flag,
3208 ph->ph_explicit_scaling_list_enabled_flag);
3209 } else {
3210
2/2
✓ Branch 0 taken 1944 times.
✓ Branch 1 taken 1162 times.
6212 if (ph->ph_lmcs_enabled_flag)
3211
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1944 times.
3888 flag(sh_lmcs_used_flag);
3212 else
3213
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 122 times.
2324 infer(sh_lmcs_used_flag, 0);
3214
3215
2/2
✓ Branch 0 taken 123 times.
✓ Branch 1 taken 2983 times.
6212 if (ph->ph_explicit_scaling_list_enabled_flag)
3216
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 123 times.
246 flag(sh_explicit_scaling_list_used_flag);
3217 else
3218
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 485 times.
5966 infer(sh_explicit_scaling_list_used_flag, 0);
3219 }
3220
3221
4/4
✓ Branch 0 taken 10639 times.
✓ Branch 1 taken 526 times.
✓ Branch 2 taken 10617 times.
✓ Branch 3 taken 22 times.
22330 if (!pps->pps_rpl_info_in_ph_flag &&
3222
2/2
✓ Branch 0 taken 1609 times.
✓ Branch 1 taken 9008 times.
21234 ((nal_unit_type != VVC_IDR_W_RADL &&
3223
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1613 times.
3262 nal_unit_type != VVC_IDR_N_LP) || sps->sps_idr_rpl_present_flag)) {
3224
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9026 times.
18052 CHECK(FUNC(ref_pic_lists)
3225 (ctx, rw, sps, pps, &current->sh_ref_pic_lists));
3226 18052 ref_pic_lists = &current->sh_ref_pic_lists;
3227 } else {
3228 4278 ref_pic_lists = &ph->ph_ref_pic_lists;
3229 }
3230
2/2
✓ Branch 0 taken 9459 times.
✓ Branch 1 taken 1706 times.
22330 if ((current->sh_slice_type != VVC_SLICE_TYPE_I &&
3231
2/2
✓ Branch 0 taken 1548 times.
✓ Branch 1 taken 7911 times.
18918 ref_pic_lists->rpl_ref_list[0].num_ref_entries > 1) ||
3232
2/2
✓ Branch 0 taken 760 times.
✓ Branch 1 taken 2494 times.
6508 (current->sh_slice_type == VVC_SLICE_TYPE_B &&
3233
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 758 times.
1520 ref_pic_lists->rpl_ref_list[1].num_ref_entries > 1)) {
3234
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7913 times.
15826 flag(sh_num_ref_idx_active_override_flag);
3235
2/2
✓ Branch 0 taken 187 times.
✓ Branch 1 taken 7726 times.
15826 if (current->sh_num_ref_idx_active_override_flag) {
3236 374 for (i = 0;
3237
4/4
✓ Branch 0 taken 495 times.
✓ Branch 1 taken 44 times.
✓ Branch 2 taken 352 times.
✓ Branch 3 taken 187 times.
1078 i < (current->sh_slice_type == VVC_SLICE_TYPE_B ? 2 : 1); i++)
3238
1/2
✓ Branch 0 taken 352 times.
✗ Branch 1 not taken.
704 if (ref_pic_lists->rpl_ref_list[i].num_ref_entries > 1)
3239
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 352 times.
704 ues(sh_num_ref_idx_active_minus1[i], 0, 14, 1, i);
3240 else
3241 infer(sh_num_ref_idx_active_minus1[i], 0);
3242 }
3243 } else {
3244
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 824 times.
6504 infer(sh_num_ref_idx_active_override_flag, 1);
3245 }
3246
3247
2/2
✓ Branch 0 taken 22330 times.
✓ Branch 1 taken 11165 times.
66990 for (i = 0; i < 2; i++) {
3248
2/2
✓ Branch 0 taken 9824 times.
✓ Branch 1 taken 12506 times.
44660 if (current->sh_slice_type == VVC_SLICE_TYPE_B ||
3249
4/4
✓ Branch 0 taken 6412 times.
✓ Branch 1 taken 3412 times.
✓ Branch 2 taken 3206 times.
✓ Branch 3 taken 3206 times.
19648 (current->sh_slice_type == VVC_SLICE_TYPE_P && i == 0)) {
3250
2/2
✓ Branch 0 taken 2656 times.
✓ Branch 1 taken 13056 times.
31424 if (current->sh_num_ref_idx_active_override_flag) {
3251 5312 current->num_ref_idx_active[i] = current->sh_num_ref_idx_active_minus1[i] + 1;
3252 } else {
3253 26112 current->num_ref_idx_active[i] =
3254 26112 FFMIN(ref_pic_lists->rpl_ref_list[i].num_ref_entries,
3255 pps->pps_num_ref_idx_default_active_minus1[i] + 1);
3256 }
3257 } else {
3258 13236 current->num_ref_idx_active[i] = 0;
3259 }
3260 }
3261
3262
2/2
✓ Branch 0 taken 9459 times.
✓ Branch 1 taken 1706 times.
22330 if (current->sh_slice_type != VVC_SLICE_TYPE_I) {
3263
2/2
✓ Branch 0 taken 9345 times.
✓ Branch 1 taken 114 times.
18918 if (pps->pps_cabac_init_present_flag)
3264
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9345 times.
18690 flag(sh_cabac_init_flag);
3265 else
3266
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
228 infer(sh_cabac_init_flag, 0);
3267
2/2
✓ Branch 0 taken 9457 times.
✓ Branch 1 taken 2 times.
18918 if (ph->ph_temporal_mvp_enabled_flag) {
3268
2/2
✓ Branch 0 taken 8955 times.
✓ Branch 1 taken 502 times.
18914 if (!pps->pps_rpl_info_in_ph_flag) {
3269
2/2
✓ Branch 0 taken 5751 times.
✓ Branch 1 taken 3204 times.
17910 if (current->sh_slice_type == VVC_SLICE_TYPE_B)
3270
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5751 times.
11502 flag(sh_collocated_from_l0_flag);
3271 else
3272
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1046 times.
6408 infer(sh_collocated_from_l0_flag, 1);
3273
2/2
✓ Branch 0 taken 5161 times.
✓ Branch 1 taken 3794 times.
17910 if ((current->sh_collocated_from_l0_flag &&
3274
2/2
✓ Branch 0 taken 790 times.
✓ Branch 1 taken 4371 times.
10322 current->num_ref_idx_active[0] > 1) ||
3275
2/2
✓ Branch 0 taken 3794 times.
✓ Branch 1 taken 790 times.
9168 (!current->sh_collocated_from_l0_flag &&
3276
2/2
✓ Branch 0 taken 3050 times.
✓ Branch 1 taken 744 times.
22430 current->num_ref_idx_active[1] > 1)) {
3277 14842 unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1;
3278
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7421 times.
14842 ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] - 1);
3279 } else {
3280
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 407 times.
3068 infer(sh_collocated_ref_idx, 0);
3281 }
3282 } else {
3283
2/2
✓ Branch 0 taken 500 times.
✓ Branch 1 taken 2 times.
1004 if (current->sh_slice_type == VVC_SLICE_TYPE_B)
3284
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
1000 infer(sh_collocated_from_l0_flag, ph->ph_collocated_from_l0_flag);
3285 else
3286
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
4 infer(sh_collocated_from_l0_flag, 1);
3287
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
1004 infer(sh_collocated_ref_idx, ph->ph_collocated_ref_idx);
3288 }
3289 }
3290
1/2
✓ Branch 0 taken 9459 times.
✗ Branch 1 not taken.
18918 if (!pps->pps_wp_info_in_ph_flag &&
3291
2/2
✓ Branch 0 taken 194 times.
✓ Branch 1 taken 9265 times.
18918 ((pps->pps_weighted_pred_flag &&
3292
2/2
✓ Branch 0 taken 170 times.
✓ Branch 1 taken 24 times.
388 current->sh_slice_type == VVC_SLICE_TYPE_P) ||
3293
2/2
✓ Branch 0 taken 170 times.
✓ Branch 1 taken 9265 times.
18870 (pps->pps_weighted_bipred_flag &&
3294
1/2
✓ Branch 0 taken 170 times.
✗ Branch 1 not taken.
340 current->sh_slice_type == VVC_SLICE_TYPE_B))) {
3295
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 194 times.
388 CHECK(FUNC(pred_weight_table) (ctx, rw, sps, pps, ref_pic_lists,
3296 current->num_ref_idx_active,
3297 &current->sh_pred_weight_table));
3298 }
3299 }
3300 22330 qp_bd_offset = 6 * sps->sps_bitdepth_minus8;
3301
2/2
✓ Branch 0 taken 10633 times.
✓ Branch 1 taken 532 times.
22330 if (!pps->pps_qp_delta_info_in_ph_flag)
3302
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 10633 times.
21266 se(sh_qp_delta, -qp_bd_offset - (26 + pps->pps_init_qp_minus26),
3303 63 - (26 + pps->pps_init_qp_minus26));
3304
2/2
✓ Branch 0 taken 184 times.
✓ Branch 1 taken 10981 times.
22330 if (pps->pps_slice_chroma_qp_offsets_present_flag) {
3305 int8_t off;
3306
3307
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 184 times.
368 se(sh_cb_qp_offset, -12, 12);
3308 368 off = pps->pps_cb_qp_offset + current->sh_cb_qp_offset;
3309
2/4
✓ Branch 0 taken 184 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 184 times.
368 if (off < -12 || off > 12) {
3310 av_log(ctx->log_ctx, AV_LOG_ERROR,
3311 "pps_cb_qp_offset + sh_cb_qp_offset (%d) not in range [-12, 12].\n",
3312 off);
3313 return AVERROR_INVALIDDATA;
3314 }
3315
3316
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 184 times.
368 se(sh_cr_qp_offset, -12, 12);
3317 368 off = pps->pps_cr_qp_offset + current->sh_cr_qp_offset;
3318
2/4
✓ Branch 0 taken 184 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 184 times.
368 if (off < -12 || off > 12) {
3319 av_log(ctx->log_ctx, AV_LOG_ERROR,
3320 "pps_cr_qp_offset + sh_cr_qp_offset (%d) not in range [-12, 12].\n",
3321 off);
3322 return AVERROR_INVALIDDATA;
3323 }
3324
3325
2/2
✓ Branch 0 taken 123 times.
✓ Branch 1 taken 61 times.
368 if (sps->sps_joint_cbcr_enabled_flag) {
3326
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 123 times.
246 se(sh_joint_cbcr_qp_offset, -12, 12);
3327 246 off =
3328 246 pps->pps_joint_cbcr_qp_offset_value +
3329 246 current->sh_joint_cbcr_qp_offset;
3330
2/4
✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 123 times.
246 if (off < -12 || off > 12) {
3331 av_log(ctx->log_ctx, AV_LOG_ERROR,
3332 "pps_joint_cbcr_qp_offset_value + sh_joint_cbcr_qp_offset (%d)"
3333 "not in range [-12, 12]. \n", off);
3334 return AVERROR_INVALIDDATA;
3335 }
3336 } else {
3337
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
122 infer(sh_joint_cbcr_qp_offset, 0);
3338 }
3339 } else {
3340
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
21962 infer(sh_cb_qp_offset, 0);
3341
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
21962 infer(sh_cr_qp_offset, 0);
3342
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
21962 infer(sh_joint_cbcr_qp_offset, 0);
3343 }
3344
2/2
✓ Branch 0 taken 123 times.
✓ Branch 1 taken 11042 times.
22330 if (pps->pps_cu_chroma_qp_offset_list_enabled_flag)
3345
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 123 times.
246 flag(sh_cu_chroma_qp_offset_enabled_flag);
3346 else
3347
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22084 infer(sh_cu_chroma_qp_offset_enabled_flag, 0);
3348
4/4
✓ Branch 0 taken 7312 times.
✓ Branch 1 taken 3853 times.
✓ Branch 2 taken 6768 times.
✓ Branch 3 taken 544 times.
22330 if (sps->sps_sao_enabled_flag && !pps->pps_sao_info_in_ph_flag) {
3349
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6768 times.
13536 flag(sh_sao_luma_used_flag);
3350
2/2
✓ Branch 0 taken 6446 times.
✓ Branch 1 taken 322 times.
13536 if (sps->sps_chroma_format_idc != 0)
3351
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6446 times.
12892 flag(sh_sao_chroma_used_flag);
3352 else
3353
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
644 infer(sh_sao_chroma_used_flag, ph->ph_sao_chroma_enabled_flag);
3354 } else {
3355
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1282 times.
8794 infer(sh_sao_luma_used_flag, ph->ph_sao_luma_enabled_flag);
3356
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1282 times.
8794 infer(sh_sao_chroma_used_flag, ph->ph_sao_chroma_enabled_flag);
3357 }
3358
3359
2/2
✓ Branch 0 taken 75 times.
✓ Branch 1 taken 11090 times.
22330 if (pps->pps_deblocking_filter_override_enabled_flag &&
3360
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 39 times.
150 !pps->pps_dbf_info_in_ph_flag)
3361
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 flag(sh_deblocking_params_present_flag);
3362 else
3363
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22258 infer(sh_deblocking_params_present_flag, 0);
3364
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 11129 times.
22330 if (current->sh_deblocking_params_present_flag) {
3365
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 if (!pps->pps_deblocking_filter_disabled_flag)
3366
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 flag(sh_deblocking_filter_disabled_flag);
3367 else
3368 infer(sh_deblocking_filter_disabled_flag, 0);
3369
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 if (!current->sh_deblocking_filter_disabled_flag) {
3370
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_luma_beta_offset_div2, -12, 12);
3371
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_luma_tc_offset_div2, -12, 12);
3372
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 if (pps->pps_chroma_tool_offsets_present_flag) {
3373
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_cb_beta_offset_div2, -12, 12);
3374
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_cb_tc_offset_div2, -12, 12);
3375
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_cr_beta_offset_div2, -12, 12);
3376
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_cr_tc_offset_div2, -12, 12);
3377 } else {
3378 infer(sh_cb_beta_offset_div2,
3379 current->sh_luma_beta_offset_div2);
3380 infer(sh_cb_tc_offset_div2, current->sh_luma_tc_offset_div2);
3381 infer(sh_cr_beta_offset_div2,
3382 current->sh_luma_beta_offset_div2);
3383 infer(sh_cr_tc_offset_div2, current->sh_luma_tc_offset_div2);
3384 }
3385 }
3386 } else {
3387
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22258 infer(sh_deblocking_filter_disabled_flag, ph->ph_deblocking_filter_disabled_flag);
3388
2/2
✓ Branch 0 taken 7288 times.
✓ Branch 1 taken 3841 times.
22258 if (!current->sh_deblocking_filter_disabled_flag) {
3389
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
14576 infer(sh_luma_beta_offset_div2, ph->ph_luma_beta_offset_div2);
3390
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
14576 infer(sh_luma_tc_offset_div2, ph->ph_luma_tc_offset_div2);
3391
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
14576 infer(sh_cb_beta_offset_div2, ph->ph_cb_beta_offset_div2);
3392
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
14576 infer(sh_cb_tc_offset_div2, ph->ph_cb_tc_offset_div2);
3393
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
14576 infer(sh_cr_beta_offset_div2, ph->ph_cr_beta_offset_div2);
3394
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
14576 infer(sh_cr_tc_offset_div2, ph->ph_cr_tc_offset_div2);
3395 }
3396 }
3397
3398
2/2
✓ Branch 0 taken 7263 times.
✓ Branch 1 taken 3902 times.
22330 if (sps->sps_dep_quant_enabled_flag)
3399
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7263 times.
14526 flag(sh_dep_quant_used_flag);
3400 else
3401
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1280 times.
7804 infer(sh_dep_quant_used_flag, 0);
3402
3403
2/2
✓ Branch 0 taken 61 times.
✓ Branch 1 taken 11104 times.
22330 if (sps->sps_sign_data_hiding_enabled_flag &&
3404
1/2
✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
122 !current->sh_dep_quant_used_flag)
3405
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 61 times.
122 flag(sh_sign_data_hiding_used_flag);
3406 else
3407
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22208 infer(sh_sign_data_hiding_used_flag, 0);
3408
3409
2/2
✓ Branch 0 taken 7128 times.
✓ Branch 1 taken 4037 times.
22330 if (sps->sps_transform_skip_enabled_flag &&
3410
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7128 times.
14256 !current->sh_dep_quant_used_flag &&
3411 !current->sh_sign_data_hiding_used_flag)
3412 flag(sh_ts_residual_coding_disabled_flag);
3413 else
3414
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22330 infer(sh_ts_residual_coding_disabled_flag, 0);
3415
3416
1/2
✓ Branch 0 taken 11165 times.
✗ Branch 1 not taken.
22330 if (!current->sh_ts_residual_coding_disabled_flag &&
3417
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11165 times.
22330 sps->sps_ts_residual_coding_rice_present_in_sh_flag)
3418 ub(3, sh_ts_residual_coding_rice_idx_minus1);
3419 else
3420
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22330 infer(sh_ts_residual_coding_rice_idx_minus1, 0);
3421
3422
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11165 times.
22330 if (sps->sps_reverse_last_sig_coeff_enabled_flag)
3423 flag(sh_reverse_last_sig_coeff_flag);
3424 else
3425
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22330 infer(sh_reverse_last_sig_coeff_flag, 0);
3426
3427
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11165 times.
22330 if (pps->pps_slice_header_extension_present_flag) {
3428 ue(sh_slice_header_extension_length, 0, 256);
3429 for (i = 0; i < current->sh_slice_header_extension_length; i++)
3430 us(8, sh_slice_header_extension_data_byte[i], 0x00, 0xff, 1, i);
3431 }
3432
3433 22330 current->num_entry_points = 0;
3434
2/2
✓ Branch 0 taken 10981 times.
✓ Branch 1 taken 184 times.
22330 if (sps->sps_entry_point_offsets_present_flag) {
3435 21962 uint8_t entropy_sync = sps->sps_entropy_coding_sync_enabled_flag;
3436 int height;
3437
2/2
✓ Branch 0 taken 2143 times.
✓ Branch 1 taken 8838 times.
21962 if (pps->pps_rect_slice_flag) {
3438 int width_in_tiles;
3439 4286 int slice_idx = current->sh_slice_address;
3440
2/2
✓ Branch 0 taken 2040 times.
✓ Branch 1 taken 2143 times.
8366 for (i = 0; i < current->curr_subpic_idx; i++) {
3441 4080 slice_idx += pps->num_slices_in_subpic[i];
3442 }
3443 4286 width_in_tiles =
3444 4286 pps->pps_slice_width_in_tiles_minus1[slice_idx] + 1;
3445
3446
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2143 times.
4286 if (entropy_sync)
3447 height = pps->slice_height_in_ctus[slice_idx];
3448 else
3449 4286 height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1;
3450
3451 4286 current->num_entry_points = width_in_tiles * height;
3452 } else {
3453 int tile_idx;
3454 int tile_y;
3455 17676 for (tile_idx = current->sh_slice_address;
3456 36152 tile_idx <=
3457 36152 current->sh_slice_address +
3458
2/2
✓ Branch 0 taken 9238 times.
✓ Branch 1 taken 8838 times.
36152 current->sh_num_tiles_in_slice_minus1; tile_idx++) {
3459 18476 tile_y = tile_idx / pps->num_tile_rows;
3460 18476 height = pps->row_height_val[tile_y];
3461
2/2
✓ Branch 0 taken 247 times.
✓ Branch 1 taken 8991 times.
18476 current->num_entry_points += (entropy_sync ? height : 1);
3462 }
3463 }
3464 21962 current->num_entry_points--;
3465
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10981 times.
21962 if (current->num_entry_points > VVC_MAX_ENTRY_POINTS) {
3466 av_log(ctx->log_ctx, AV_LOG_ERROR, "Too many entry points: "
3467 "%" PRIu32 ".\n", current->num_entry_points);
3468 return AVERROR_PATCHWELCOME;
3469 }
3470
2/2
✓ Branch 0 taken 415 times.
✓ Branch 1 taken 10566 times.
21962 if (current->num_entry_points > 0) {
3471
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 415 times.
830 ue(sh_entry_offset_len_minus1, 0, 31);
3472
2/2
✓ Branch 0 taken 1651 times.
✓ Branch 1 taken 415 times.
4132 for (i = 0; i < current->num_entry_points; i++) {
3473
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1651 times.
3302 ubs(current->sh_entry_offset_len_minus1 + 1,
3474 sh_entry_point_offset_minus1[i], 1, i);
3475 }
3476 }
3477 }
3478
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11165 times.
22330 CHECK(FUNC(byte_alignment) (ctx, rw));
3479
3480 22330 return 0;
3481 }
3482
3483 5351 static int FUNC(sei) (CodedBitstreamContext *ctx, RWContext *rw,
3484 H266RawSEI *current, int prefix)
3485 {
3486 int err;
3487
3488 5351 if (prefix)
3489 192 HEADER("Prefix Supplemental Enhancement Information");
3490 else
3491 5159 HEADER("Suffix Supplemental Enhancement Information");
3492
3493 5351 CHECK(FUNC(nal_unit_header) (ctx, rw, &current->nal_unit_header,
3494 prefix ? VVC_PREFIX_SEI_NUT
3495 : VVC_SUFFIX_SEI_NUT));
3496
3497 5351 CHECK(FUNC_SEI(message_list) (ctx, rw, &current->message_list, prefix));
3498
3499 5351 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
3500
3501 5351 return 0;
3502 }
3503