FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/cbs_h266_syntax_template.c
Date: 2026-10-17 12:12:06
Exec Total Coverage
Lines: 1796 2206 81.4%
Functions: 59 62 95.2%
Branches: 1804 3385 53.3%

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 20382 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 10191 times.
20382 fixed(1, rbsp_stop_one_bit, 1);
25
2/2
✓ Branch 1 taken 53656 times.
✓ Branch 2 taken 10191 times.
127694 while (byte_alignment(rw) != 0)
26
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 53656 times.
107312 fixed(1, rbsp_alignment_zero_bit, 0);
27 20382 return 0;
28 }
29
30 43764 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 21882 times.
43764 fixed(1, forbidden_zero_bit, 0);
37
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 21882 times.
43764 flag(nuh_reserved_zero_bit);
38
39
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 21882 times.
43764 u(6, nuh_layer_id, 0, 55);
40
41
2/2
✓ Branch 0 taken 10191 times.
✓ Branch 1 taken 11691 times.
43764 if (expected_nal_unit_type >= 0)
42
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 10191 times.
20382 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 11691 times.
23382 ub(5, nal_unit_type);
45
46
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 21882 times.
43764 u(3, nuh_temporal_id_plus1, 1, 7);
47 43764 return 0;
48 }
49
50 23382 static int FUNC(byte_alignment) (CodedBitstreamContext *ctx, RWContext *rw)
51 {
52 int err;
53
54
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11691 times.
23382 fixed(1, byte_alignment_bit_equal_to_one, 1);
55
2/2
✓ Branch 1 taken 33665 times.
✓ Branch 2 taken 11691 times.
90712 while (byte_alignment(rw) != 0)
56
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 33665 times.
67330 fixed(1, byte_alignment_bit_equal_to_zero, 0);
57 23382 return 0;
58 }
59
60 2668 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 1334 times.
2668 flag(gci_present_flag);
67
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1334 times.
2668 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 6670 times.
✓ Branch 2 taken 1334 times.
16008 while (byte_alignment(rw) != 0)
174
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6670 times.
13340 fixed(1, gci_alignment_zero_bit, 0);
175 2668 return 0;
176 }
177
178 2720 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 1334 times.
✓ Branch 1 taken 26 times.
2720 if (profile_tier_present_flag) {
187
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1334 times.
2668 ub(7, general_profile_idc);
188
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1334 times.
2668 flag(general_tier_flag);
189 }
190
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1360 times.
2720 ub(8, general_level_idc);
191
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1360 times.
2720 flag(ptl_frame_only_constraint_flag);
192
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1360 times.
2720 flag(ptl_multilayer_enabled_flag);
193
2/2
✓ Branch 0 taken 1334 times.
✓ Branch 1 taken 26 times.
2720 if (profile_tier_present_flag) {
194
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1334 times.
2668 CHECK(FUNC(general_constraints_info) (ctx, rw,
195 &current->
196 general_constraints_info));
197 }
198
2/2
✓ Branch 0 taken 1651 times.
✓ Branch 1 taken 1360 times.
6022 for (i = max_num_sub_layers_minus1 - 1; i >= 0; i--)
199
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1651 times.
3302 flags(ptl_sublayer_level_present_flag[i], 1, i);
200
2/2
✓ Branch 1 taken 1553 times.
✓ Branch 2 taken 1360 times.
5826 while (byte_alignment(rw) != 0)
201
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1553 times.
3106 flag(ptl_reserved_zero_bit);
202
2/2
✓ Branch 0 taken 1651 times.
✓ Branch 1 taken 1360 times.
6022 for (i = max_num_sub_layers_minus1 - 1; i >= 0; i--)
203
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1651 times.
3302 if (current->ptl_sublayer_level_present_flag[i])
204 ✗ ubs(8, sublayer_level_idc[i], 1, i);
205
2/2
✓ Branch 0 taken 1334 times.
✓ Branch 1 taken 26 times.
2720 if (profile_tier_present_flag) {
206
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1334 times.
2668 ub(8, ptl_num_sub_profiles);
207
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1334 times.
2668 for (i = 0; i < current->ptl_num_sub_profiles; i++)
208 ✗ ubs(32, general_sub_profile_idc[i], 1, i);
209 }
210 2720 return 0;
211 }
212
213 2544 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.
2544 infer(vui_progressive_source_flag, 0);
218
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_interlaced_source_flag, 0);
219
220
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_non_packed_constraint_flag, 0);
221
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_non_projected_constraint_flag, 0);
222
223
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_aspect_ratio_constant_flag, 0);
224
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_aspect_ratio_idc, 0);
225
226
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_overscan_info_present_flag, 0);
227
228
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_colour_primaries, 2);
229
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_transfer_characteristics, 2);
230
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_matrix_coeffs, 2);
231
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_full_range_flag, 0);
232
233
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_chroma_sample_loc_type_frame, 6);
234
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_chroma_sample_loc_type_top_field, 6);
235
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2544 infer(vui_chroma_sample_loc_type_bottom_field, 6);
236 2544 return 0;
237 }
238
239 62 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 31 times.
62 flag(vui_progressive_source_flag);
246
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 flag(vui_interlaced_source_flag);
247
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 flag(vui_non_packed_constraint_flag);
248
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 flag(vui_non_projected_constraint_flag);
249
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 flag(vui_aspect_ratio_info_present_flag);
250
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 26 times.
62 if (current->vui_aspect_ratio_info_present_flag) {
251
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 flag(vui_aspect_ratio_constant_flag);
252
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ub(8, vui_aspect_ratio_idc);
253
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
10 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 31 times.
62 flag(vui_overscan_info_present_flag);
262
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 26 times.
62 if (current->vui_overscan_info_present_flag)
263
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 flag(vui_overscan_appropriate_flag);
264
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 flag(vui_colour_description_present_flag);
265
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 26 times.
62 if (current->vui_colour_description_present_flag) {
266
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ub(8, vui_colour_primaries);
267 10 av_log(ctx->log_ctx, AV_LOG_DEBUG, "vui_colour_primaries == %d \n",
268 10 current->vui_colour_primaries);
269
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ub(8, vui_transfer_characteristics);
270 10 av_log(ctx->log_ctx, AV_LOG_DEBUG,
271 "vui_transfer_characteristics == %d \n",
272 10 current->vui_transfer_characteristics);
273
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ub(8, vui_matrix_coeffs);
274 10 av_log(ctx->log_ctx, AV_LOG_DEBUG, "vui_matrix_coeffs == %d \n",
275 10 current->vui_matrix_coeffs);
276
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 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 31 times.
62 flag(vui_chroma_loc_info_present_flag);
284
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
62 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
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 26 times.
62 if (current->vui_chroma_loc_info_present_flag) {
291
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
10 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
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ue(vui_chroma_sample_loc_type_top_field, 0, 6);
296
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 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 62 return 0;
308 }
309
310 28 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
2/2
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 9 times.
28 if (!ff_cbs_h2645_payload_extension_present(rw, payload_size, cur_pos))
322 10 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 62 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 62 start_position = bit_position(rw);
354
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 CHECK(FUNC(vui_parameters) (ctx, rw, current, chroma_format_idc));
355 62 current_position = bit_position(rw) - start_position;
356
357
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 17 times.
62 if (current_position < 8 * vui_payload_size) {
358
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
28 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 14 times.
28 fixed(1, vui_payload_bit_equal_to_one, 1);
361
2/2
✓ Branch 1 taken 83 times.
✓ Branch 2 taken 14 times.
194 while (byte_alignment(rw) != 0)
362
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 83 times.
166 fixed(1, vui_payload_bit_equal_to_zero, 0);
363 }
364 62 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; ff_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 2658 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 1312 times.
✓ Branch 1 taken 17 times.
2658 for (i = (sublayer_info_flag ? 0 : max_sublayers_minus1);
401
2/2
✓ Branch 0 taken 1397 times.
✓ Branch 1 taken 1329 times.
5452 i <= max_sublayers_minus1; i++) {
402
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1397 times.
2794 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 1397 times.
2794 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 1397 times.
2794 ues(dpb_max_latency_increase_plus1[i], 0, UINT32_MAX - 1, 1, i);
406 }
407 2658 return 0;
408 }
409
410 132466 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 132466 CodedBitstreamH266Context *h266 = ctx->priv_data;
417 132466 int err, i, j, general_layer_idx = -1, num_direct_ref_layers = 0;
418 132466 const H266RawVPS *vps = h266->vps[sps->sps_video_parameter_set_id];
419
420
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 66233 times.
132466 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 66713 times.
✗ Branch 1 not taken.
133426 for (i = 0; i <= vps->vps_max_layers_minus1; i++) {
427
2/2
✓ Branch 0 taken 66233 times.
✓ Branch 1 taken 480 times.
133426 if (sps->nal_unit_header.nuh_layer_id == vps->vps_layer_id[i]) {
428 132466 general_layer_idx = i;
429 132466 break;
430 }
431 }
432
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 66233 times.
132466 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 67600 times.
✓ Branch 1 taken 66233 times.
267666 for (j = 0; j <= vps->vps_max_layers_minus1; j++) {
439
2/2
✓ Branch 0 taken 480 times.
✓ Branch 1 taken 67120 times.
135200 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 66233 times.
132466 ue(num_ref_entries, 0, VVC_MAX_REF_ENTRIES);
444
2/2
✓ Branch 0 taken 672 times.
✓ Branch 1 taken 65561 times.
132466 if (sps->sps_long_term_ref_pics_flag &&
445
2/2
✓ Branch 0 taken 380 times.
✓ Branch 1 taken 292 times.
1344 rpls_idx < sps->sps_num_ref_pic_lists[list_idx] &&
446
2/2
✓ Branch 0 taken 375 times.
✓ Branch 1 taken 5 times.
760 current->num_ref_entries > 0)
447
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 375 times.
750 flag(ltrp_in_header_flag);
448
2/2
✓ Branch 0 taken 672 times.
✓ Branch 1 taken 65561 times.
132466 if (sps->sps_long_term_ref_pics_flag &&
449
2/2
✓ Branch 0 taken 292 times.
✓ Branch 1 taken 380 times.
1344 rpls_idx == sps->sps_num_ref_pic_lists[list_idx])
450
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
584 infer(ltrp_in_header_flag, 1);
451
2/2
✓ Branch 0 taken 140816 times.
✓ Branch 1 taken 66233 times.
414098 for (i = 0, j = 0; i < current->num_ref_entries; i++) {
452
2/2
✓ Branch 0 taken 1611 times.
✓ Branch 1 taken 139205 times.
281632 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.
278410 infer(inter_layer_ref_pic_flag[i], 0);
456
457
2/2
✓ Branch 0 taken 140606 times.
✓ Branch 1 taken 210 times.
281632 if (!current->inter_layer_ref_pic_flag[i]) {
458
2/2
✓ Branch 0 taken 2648 times.
✓ Branch 1 taken 137958 times.
281212 if (sps->sps_long_term_ref_pics_flag)
459
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2648 times.
5296 flags(st_ref_pic_flag[i], 1, i);
460 else
461
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 35035 times.
275916 infer(st_ref_pic_flag[i], 1);
462
2/2
✓ Branch 0 taken 139816 times.
✓ Branch 1 taken 790 times.
281212 if (current->st_ref_pic_flag[i]) {
463 int abs_delta_poc_st;
464
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 139816 times.
279632 ues(abs_delta_poc_st[i], 0, MAX_UINT_BITS(15), 1, i);
465
2/2
✓ Branch 0 taken 136889 times.
✓ Branch 1 taken 2927 times.
279632 if ((sps->sps_weighted_pred_flag ||
466
3/4
✗ Branch 0 not taken.
✓ Branch 1 taken 136889 times.
✓ Branch 2 taken 1993 times.
✓ Branch 3 taken 934 times.
279632 sps->sps_weighted_bipred_flag) && i != 0)
467 3986 abs_delta_poc_st = current->abs_delta_poc_st[i];
468 else
469 275646 abs_delta_poc_st = current->abs_delta_poc_st[i] + 1;
470
2/2
✓ Branch 0 taken 139428 times.
✓ Branch 1 taken 388 times.
279632 if (abs_delta_poc_st > 0)
471
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 139428 times.
278856 flags(strp_entry_sign_flag[i], 1, i);
472 } else {
473
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 790 times.
1580 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 132466 return 0;
489 }
490
491 19172 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 19172 times.
✓ Branch 1 taken 9586 times.
57516 for (i = 0; i < 2; i++) {
497
4/4
✓ Branch 0 taken 18658 times.
✓ Branch 1 taken 514 times.
✓ Branch 2 taken 9329 times.
✓ Branch 3 taken 9329 times.
38344 if (sps->sps_num_ref_pic_lists[i] > 0 &&
498
3/4
✓ Branch 0 taken 9329 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 9260 times.
18658 (i == 0 || (i == 1 && pps->pps_rpl1_idx_present_flag))) {
499
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9398 times.
18796 flags(rpl_sps_flag[i], 1, i);
500 } else {
501
2/2
✓ Branch 0 taken 514 times.
✓ Branch 1 taken 9260 times.
19548 if (sps->sps_num_ref_pic_lists[i] == 0) {
502
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
1028 infer(rpl_sps_flag[i], 0);
503 } else {
504
2/4
✓ Branch 0 taken 9260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9260 times.
✗ Branch 3 not taken.
18520 if (!pps->pps_rpl1_idx_present_flag && i == 1)
505
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2182 times.
18520 infer(rpl_sps_flag[1], current->rpl_sps_flag[0]);
506 }
507 }
508
2/2
✓ Branch 0 taken 12134 times.
✓ Branch 1 taken 7038 times.
38344 if (current->rpl_sps_flag[i]) {
509
4/4
✓ Branch 0 taken 12064 times.
✓ Branch 1 taken 70 times.
✓ Branch 2 taken 6032 times.
✓ Branch 3 taken 6032 times.
24268 if (sps->sps_num_ref_pic_lists[i] > 1 &&
510
3/4
✓ Branch 0 taken 6032 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 6029 times.
24134 (i == 0 || (i == 1 && pps->pps_rpl1_idx_present_flag))) {
511 12070 uint8_t bits = av_ceil_log2(sps->sps_num_ref_pic_lists[i]);
512
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6035 times.
12070 us(bits, rpl_idx[i], 0, sps->sps_num_ref_pic_lists[i] - 1, 1, i);
513
2/2
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 6029 times.
12198 } else if (sps->sps_num_ref_pic_lists[i] == 1) {
514
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
140 infer(rpl_idx[i], 0);
515
2/4
✓ Branch 0 taken 6029 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6029 times.
✗ Branch 3 not taken.
12058 } else if (i == 1 && !pps->pps_rpl1_idx_present_flag) {
516
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1571 times.
12058 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 24268 memcpy(&current->rpl_ref_list[i],
524 24268 &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 7038 times.
14076 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 38344 ref_list = &current->rpl_ref_list[i];
532
533 38344 num_ltrp_entries = 0;
534
2/2
✓ Branch 0 taken 38954 times.
✓ Branch 1 taken 19172 times.
116252 for (int k = 0; k < ref_list->num_ref_entries; k++) {
535
2/2
✓ Branch 0 taken 38744 times.
✓ Branch 1 taken 210 times.
77908 if (!ref_list->inter_layer_ref_pic_flag[k]) {
536
2/2
✓ Branch 0 taken 790 times.
✓ Branch 1 taken 37954 times.
77488 if (!ref_list->st_ref_pic_flag[k]) {
537 1580 num_ltrp_entries++;
538 }
539 }
540 }
541
542
2/2
✓ Branch 0 taken 790 times.
✓ Branch 1 taken 19172 times.
39924 for (j = 0; j < num_ltrp_entries; j++) {
543
1/2
✓ Branch 0 taken 790 times.
✗ Branch 1 not taken.
1580 if (ref_list->ltrp_in_header_flag) {
544
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 790 times.
1580 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 790 times.
1580 flags(delta_poc_msb_cycle_present_flag[i][j], 2, i, j);
548
2/2
✓ Branch 0 taken 28 times.
✓ Branch 1 taken 762 times.
1580 if (current->delta_poc_msb_cycle_present_flag[i][j]) {
549 56 uint32_t max =
550 56 1 << (32 - sps->sps_log2_max_pic_order_cnt_lsb_minus4 - 4);
551
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
56 ues(delta_poc_msb_cycle_lt[i][j], 0, max, 2, i, j);
552 }
553 }
554 }
555 19172 return 0;
556 }
557
558 72 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 36 times.
72 ub(32, num_units_in_tick);
564
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 u(32, time_scale, 1, MAX_UINT_BITS(32));
565
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 flag(general_nal_hrd_params_present_flag);
566
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 flag(general_vcl_hrd_params_present_flag);
567
568
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 17 times.
72 if (current->general_nal_hrd_params_present_flag ||
569
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
38 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
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
38 infer(general_du_hrd_params_present_flag, 0);
582 }
583 72 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 72 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 104 times.
✓ Branch 1 taken 36 times.
280 for (i = first_sublayer; i <= max_sublayers_minus1; i++) {
616
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 104 times.
208 flags(fixed_pic_rate_general_flag[i], 1, i);
617
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
208 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.
208 infer(fixed_pic_rate_within_cvs_flag[i], 1);
621
1/2
✓ Branch 0 taken 104 times.
✗ Branch 1 not taken.
208 if (current->fixed_pic_rate_within_cvs_flag[i]) {
622
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 104 times.
208 ues(elemental_duration_in_tc_minus1[i], 0, 2047, 1, i);
623
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
208 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
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 19 times.
208 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
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 19 times.
208 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 72 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/3
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 22 times.
52 allocate(current->vps_profile_tier_level,
934 (current->vps_num_ptls_minus1 + 1) *
935 sizeof(*current->vps_profile_tier_level));
936
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (i = 0; i <= current->vps_num_ptls_minus1; i++) {
937
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
104 CHECK(FUNC(profile_tier_level) (ctx, rw,
938 current->vps_profile_tier_level + i,
939 current->vps_pt_present_flag[i],
940 current->vps_ptl_max_tid[i]));
941 }
942
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 26 times.
156 for (i = 0; i < total_num_olss; i++) {
943
1/2
✓ Branch 0 taken 52 times.
✗ Branch 1 not taken.
104 if (current->vps_num_ptls_minus1 > 0 &&
944
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
104 current->vps_num_ptls_minus1 + 1 != total_num_olss) {
945 ✗ us(8, vps_ols_ptl_idx[i], 0, current->vps_num_ptls_minus1, 1, i);
946
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 52 times.
104 } else if (current->vps_num_ptls_minus1 == 0) {
947 ✗ infer(vps_ols_ptl_idx[i], 0);
948 } else {
949
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
104 infer(vps_ols_ptl_idx[i], i);
950 }
951 }
952
953
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 if (!current->vps_each_layer_is_an_ols_flag) {
954 uint16_t vps_num_dpb_params;
955
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ue(vps_num_dpb_params_minus1, 0, num_multi_layer_olss - 1);
956
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_each_layer_is_an_ols_flag)
957 ✗ vps_num_dpb_params = 0;
958 else
959 52 vps_num_dpb_params = current->vps_num_dpb_params_minus1 + 1;
960
961
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 19 times.
52 if (current->vps_max_sublayers_minus1 > 0)
962
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
14 flag(vps_sublayer_dpb_params_present_flag);
963 else
964
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
38 infer(vps_sublayer_dpb_params_present_flag, 0);
965
966
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (i = 0; i < vps_num_dpb_params; i++) {
967
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 19 times.
52 if (!current->vps_default_ptl_dpb_hrd_max_tid_flag)
968
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,
969 1, i);
970 else
971
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
38 infer(vps_dpb_max_tid[i], current->vps_max_sublayers_minus1);
972
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 CHECK(FUNC(dpb_parameters) (ctx, rw, current->vps_dpb_params + i,
973 current->vps_dpb_max_tid[i],
974 current->
975 vps_sublayer_dpb_params_present_flag));
976 }
977
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 26 times.
104 for (i = 0; i < num_multi_layer_olss; i++) {
978
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ues(vps_ols_dpb_pic_width[i], 0, UINT16_MAX, 1, i);
979
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ues(vps_ols_dpb_pic_height[i], 0, UINT16_MAX, 1, i);
980
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ubs(2, vps_ols_dpb_chroma_format[i], 1, i);
981
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 ues(vps_ols_dpb_bitdepth_minus8[i], 0, 8, 1, i);
982
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (vps_num_dpb_params > 1
983 ✗ && vps_num_dpb_params != num_multi_layer_olss)
984 ✗ ues(vps_ols_dpb_params_idx[i], 0, vps_num_dpb_params - 1, 1, i);
985
1/2
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
52 else if (vps_num_dpb_params == 1)
986
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
52 infer(vps_ols_dpb_params_idx[i], 0);
987 else
988 ✗ infer(vps_ols_dpb_params_idx[i], i);
989 }
990
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vps_timing_hrd_params_present_flag);
991
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_timing_hrd_params_present_flag) {
992 ✗ CHECK(FUNC(general_timing_hrd_parameters) (ctx, rw,
993 &current->
994 vps_general_timing_hrd_parameters));
995 ✗ if (current->vps_max_sublayers_minus1 > 0)
996 ✗ flag(vps_sublayer_cpb_params_present_flag);
997 else
998 ✗ infer(vps_sublayer_cpb_params_present_flag, 0);
999 ✗ ue(vps_num_ols_timing_hrd_params_minus1, 0,
1000 num_multi_layer_olss - 1);
1001 ✗ for (i = 0; i <= current->vps_num_ols_timing_hrd_params_minus1; i++) {
1002 uint8_t first_sublayer;
1003 ✗ if (!current->vps_default_ptl_dpb_hrd_max_tid_flag)
1004 ✗ us(3, vps_hrd_max_tid[i], 0,
1005 current->vps_max_sublayers_minus1, 1, i);
1006 else
1007 ✗ infer(vps_hrd_max_tid[i],
1008 current->vps_max_sublayers_minus1);
1009 ✗ first_sublayer = current->vps_sublayer_cpb_params_present_flag ?
1010 0 : current->vps_hrd_max_tid[i];
1011 ✗ CHECK(FUNC(ols_timing_hrd_parameters)
1012 (ctx, rw, &current->vps_ols_timing_hrd_parameters,
1013 first_sublayer, current->vps_max_sublayers_minus1,
1014 &current->vps_general_timing_hrd_parameters));
1015
1016 }
1017 ✗ if (current->vps_num_ols_timing_hrd_params_minus1 > 0 &&
1018 ✗ current->vps_num_ols_timing_hrd_params_minus1 + 1 !=
1019 num_multi_layer_olss) {
1020 ✗ for (i = 0; i < num_multi_layer_olss; i++) {
1021 ✗ ues(vps_ols_timing_hrd_idx[i], 0,
1022 current->vps_num_ols_timing_hrd_params_minus1, 1, i);
1023 }
1024 ✗ } else if (current->vps_num_ols_timing_hrd_params_minus1 == 0) {
1025 ✗ for (i = 0; i < num_multi_layer_olss; i++)
1026 ✗ infer(vps_ols_timing_hrd_idx[i], 0);
1027 } else {
1028 ✗ for (i = 0; i < num_multi_layer_olss; i++)
1029 ✗ infer(vps_ols_timing_hrd_idx[i], i);
1030 }
1031 }
1032 }
1033
1034
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 flag(vps_extension_flag);
1035
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
52 if (current->vps_extension_flag)
1036 ✗ CHECK(FUNC(extension_data) (ctx, rw, &current->extension_data));
1037
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 26 times.
52 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
1038
1039 52 return 0;
1040 }
1041
1042 ✗ static int FUNC(sps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw,
1043 H266RawSPS *current)
1044 {
1045 int err;
1046
1047 ✗ flag(sps_extended_precision_flag);
1048 ✗ if (current->sps_transform_skip_enabled_flag)
1049 ✗ flag(sps_ts_residual_coding_rice_present_in_sh_flag);
1050 else
1051 ✗ infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0);
1052 ✗ flag(sps_rrc_rice_extension_flag);
1053 ✗ flag(sps_persistent_rice_adaptation_enabled_flag);
1054 ✗ flag(sps_reverse_last_sig_coeff_enabled_flag);
1055
1056 ✗ return 0;
1057 }
1058
1059 2606 static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
1060 H266RawSPS *current)
1061 {
1062 2606 CodedBitstreamH266Context *h266 = ctx->priv_data;
1063 int err, i, j, max_width_minus1, max_height_minus1;
1064 unsigned int ctb_log2_size_y, min_cb_log2_size_y,
1065 min_qt_log2_size_intra_y, min_qt_log2_size_inter_y,
1066 ctb_size_y, max_num_merge_cand, tmp_width_val, tmp_height_val;
1067 uint8_t qp_bd_offset, sub_width_c, sub_height_c;
1068
1069 static const uint8_t h266_sub_width_c[] = {
1070 1, 2, 2, 1
1071 };
1072 static const uint8_t h266_sub_height_c[] = {
1073 1, 2, 1, 1
1074 };
1075
1076 2606 HEADER("Sequence Parameter Set");
1077
1078
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 CHECK(FUNC(nal_unit_header) (ctx, rw,
1079 &current->nal_unit_header, VVC_SPS_NUT));
1080
1081
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ub(4, sps_seq_parameter_set_id);
1082
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ub(4, sps_video_parameter_set_id);
1083
4/4
✓ Branch 0 taken 1268 times.
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 214 times.
✓ Branch 3 taken 1054 times.
2606 if (current->sps_video_parameter_set_id == 0 && !h266->vps[0]) {
1084 428 H266RawVPS *vps = av_refstruct_allocz(sizeof(*vps));
1085
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 214 times.
428 if (!vps)
1086 ✗ return AVERROR(ENOMEM);
1087 428 vps->vps_max_layers_minus1 = 0;
1088 428 vps->vps_independent_layer_flag[0] = 1;
1089 428 vps->vps_layer_id[0] = current->nal_unit_header.nuh_layer_id;
1090 428 h266->vps[0] = vps;
1091 }
1092
1093
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 u(3, sps_max_sublayers_minus1, 0, VVC_MAX_SUBLAYERS - 1);
1094
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 u(2, sps_chroma_format_idc, 0, 3);
1095 2606 sub_width_c = h266_sub_width_c[current->sps_chroma_format_idc];
1096 2606 sub_height_c = h266_sub_height_c[current->sps_chroma_format_idc];
1097
1098
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 u(2, sps_log2_ctu_size_minus5, 0, 3);
1099 2606 ctb_log2_size_y = current->sps_log2_ctu_size_minus5 + 5;
1100 2606 ctb_size_y = 1 << ctb_log2_size_y;
1101
1102
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_ptl_dpb_hrd_params_present_flag);
1103
1/2
✓ Branch 0 taken 1303 times.
✗ Branch 1 not taken.
2606 if (current->sps_ptl_dpb_hrd_params_present_flag) {
1104
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 CHECK(FUNC(profile_tier_level) (ctx, rw, &current->profile_tier_level,
1105 1, current->sps_max_sublayers_minus1));
1106 }
1107
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_gdr_enabled_flag);
1108
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_ref_pic_resampling_enabled_flag);
1109
2/2
✓ Branch 0 taken 1270 times.
✓ Branch 1 taken 33 times.
2606 if (current->sps_ref_pic_resampling_enabled_flag)
1110
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1270 times.
2540 flag(sps_res_change_in_clvs_allowed_flag);
1111 else
1112
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
66 infer(sps_res_change_in_clvs_allowed_flag, 0);
1113
1114
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_pic_width_max_in_luma_samples, 1, VVC_MAX_WIDTH);
1115
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_pic_height_max_in_luma_samples, 1, VVC_MAX_HEIGHT);
1116
1117
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_conformance_window_flag);
1118
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 1267 times.
2606 if (current->sps_conformance_window_flag) {
1119 72 uint16_t width = current->sps_pic_width_max_in_luma_samples / sub_width_c;
1120 72 uint16_t height = current->sps_pic_height_max_in_luma_samples / sub_height_c;
1121
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 ue(sps_conf_win_left_offset, 0, width);
1122
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 ue(sps_conf_win_right_offset, 0, width - current->sps_conf_win_left_offset);
1123
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 ue(sps_conf_win_top_offset, 0, height);
1124
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 ue(sps_conf_win_bottom_offset, 0, height - current->sps_conf_win_top_offset);
1125 } else {
1126
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2534 infer(sps_conf_win_left_offset, 0);
1127
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2534 infer(sps_conf_win_right_offset, 0);
1128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2534 infer(sps_conf_win_top_offset, 0);
1129
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
2534 infer(sps_conf_win_bottom_offset, 0);
1130 }
1131
1132 2606 tmp_width_val = AV_CEIL_RSHIFT(current->sps_pic_width_max_in_luma_samples,
1133 ctb_log2_size_y);
1134 2606 tmp_height_val = AV_CEIL_RSHIFT(current->sps_pic_height_max_in_luma_samples,
1135 ctb_log2_size_y);
1136 2606 max_width_minus1 = tmp_width_val - 1;
1137 2606 max_height_minus1 = tmp_height_val - 1;
1138
1139
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 u(1, sps_subpic_info_present_flag, 0, !current->sps_res_change_in_clvs_allowed_flag);
1140
2/2
✓ Branch 0 taken 37 times.
✓ Branch 1 taken 1266 times.
2606 if (current->sps_subpic_info_present_flag) {
1141
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 ue(sps_num_subpics_minus1, 0, VVC_MAX_SLICES - 1);
1142
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (current->sps_num_subpics_minus1 > 0) {
1143
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flag(sps_independent_subpics_flag);
1144
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flag(sps_subpic_same_size_flag);
1145 }
1146
1147
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (current->sps_num_subpics_minus1 > 0) {
1148 74 int wlen = av_ceil_log2(tmp_width_val);
1149 74 int hlen = av_ceil_log2(tmp_height_val);
1150
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
74 infer(sps_subpic_ctu_top_left_x[0], 0);
1151
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
74 infer(sps_subpic_ctu_top_left_y[0], 0);
1152
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (current->sps_pic_width_max_in_luma_samples > ctb_size_y)
1153
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);
1154 else
1155 ✗ infer(sps_subpic_width_minus1[0], max_width_minus1);
1156
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (current->sps_pic_height_max_in_luma_samples > ctb_size_y)
1157
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);
1158 else
1159 ✗ infer(sps_subpic_height_minus1[0], max_height_minus1);
1160
1/2
✓ Branch 0 taken 37 times.
✗ Branch 1 not taken.
74 if (!current->sps_independent_subpics_flag) {
1161
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flags(sps_subpic_treated_as_pic_flag[0], 1, 0);
1162
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flags(sps_loop_filter_across_subpic_enabled_flag[0], 1, 0);
1163 } else {
1164 ✗ infer(sps_subpic_treated_as_pic_flag[0], 1);
1165 ✗ infer(sps_loop_filter_across_subpic_enabled_flag[0], 1);
1166 }
1167
2/2
✓ Branch 0 taken 153 times.
✓ Branch 1 taken 37 times.
380 for (i = 1; i <= current->sps_num_subpics_minus1; i++) {
1168
2/2
✓ Branch 0 taken 118 times.
✓ Branch 1 taken 35 times.
306 if (!current->sps_subpic_same_size_flag) {
1169 236 const int win_right_edge =
1170 236 current->sps_pic_width_max_in_luma_samples -
1171 236 current->sps_conf_win_right_offset * sub_width_c;
1172 236 const int win_bottom_edge =
1173 236 current->sps_pic_height_max_in_luma_samples -
1174 236 current->sps_conf_win_bottom_offset * sub_height_c;
1175 236 const int win_left_edge =
1176 236 current->sps_conf_win_left_offset * sub_width_c;
1177 236 const int win_top_edge =
1178 236 current->sps_conf_win_top_offset * sub_height_c;
1179 236 const int win_left_edge_ctus =
1180 236 AV_CEIL_RSHIFT(win_left_edge, ctb_log2_size_y);
1181 236 const int win_right_edge_ctus =
1182 236 AV_CEIL_RSHIFT(win_right_edge, ctb_log2_size_y);
1183 236 const int win_top_edge_ctus =
1184 236 AV_CEIL_RSHIFT(win_top_edge, ctb_log2_size_y);
1185 236 const int win_bottom_edge_ctus =
1186 236 AV_CEIL_RSHIFT(win_bottom_edge, ctb_log2_size_y);
1187 236 const int min_width =
1188 236 FFMAX(win_left_edge_ctus - current->sps_subpic_ctu_top_left_x[i], 0);
1189 236 const int min_height =
1190 236 FFMAX(win_top_edge_ctus - current->sps_subpic_ctu_top_left_y[i], 0);
1191
1192
1/2
✓ Branch 0 taken 118 times.
✗ Branch 1 not taken.
236 if (current->sps_pic_width_max_in_luma_samples > ctb_size_y)
1193
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);
1194 else
1195 ✗ infer(sps_subpic_ctu_top_left_x[i], 0);
1196
1197
1/2
✓ Branch 0 taken 118 times.
✗ Branch 1 not taken.
236 if (current->sps_pic_height_max_in_luma_samples > ctb_size_y)
1198
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);
1199 else
1200 ✗ infer(sps_subpic_ctu_top_left_y[i], 0);
1201
1202 236 max_width_minus1 = tmp_width_val - current->sps_subpic_ctu_top_left_x[i] - 1;
1203 236 max_height_minus1 = tmp_height_val - current->sps_subpic_ctu_top_left_y[i] - 1;
1204
1205
2/2
✓ Branch 0 taken 86 times.
✓ Branch 1 taken 32 times.
236 if (i < current->sps_num_subpics_minus1 &&
1206
1/2
✓ Branch 0 taken 86 times.
✗ Branch 1 not taken.
172 current->sps_pic_width_max_in_luma_samples > ctb_size_y) {
1207
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);
1208 } else {
1209
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
64 infer(sps_subpic_width_minus1[i], max_width_minus1);
1210 }
1211
1212
2/2
✓ Branch 0 taken 86 times.
✓ Branch 1 taken 32 times.
236 if (i < current->sps_num_subpics_minus1 &&
1213
1/2
✓ Branch 0 taken 86 times.
✗ Branch 1 not taken.
172 current->sps_pic_height_max_in_luma_samples > ctb_size_y) {
1214
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);
1215 } else {
1216
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
64 infer(sps_subpic_height_minus1[i], max_height_minus1);
1217 }
1218 } else {
1219 70 int num_subpic_cols = tmp_width_val /
1220 70 (current->sps_subpic_width_minus1[0] + 1);
1221
1/2
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
70 if (tmp_width_val % (current->sps_subpic_width_minus1[0] + 1) ||
1222
1/2
✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
70 tmp_height_val % (current->sps_subpic_height_minus1[0] + 1) ||
1223 70 current->sps_num_subpics_minus1 !=
1224 70 (num_subpic_cols * tmp_height_val /
1225
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
70 (current->sps_subpic_height_minus1[0] + 1) - 1))
1226 ✗ return AVERROR_INVALIDDATA;
1227
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
70 infer(sps_subpic_ctu_top_left_x[i],
1228 (i % num_subpic_cols) *
1229 (current->sps_subpic_width_minus1[0] + 1));
1230
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
70 infer(sps_subpic_ctu_top_left_y[i],
1231 (i / num_subpic_cols) *
1232 (current->sps_subpic_height_minus1[0] + 1));
1233
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
70 infer(sps_subpic_width_minus1[i],
1234 current->sps_subpic_width_minus1[0]);
1235
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
70 infer(sps_subpic_height_minus1[i],
1236 current->sps_subpic_height_minus1[0]);
1237 }
1238
1/2
✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
306 if (!current->sps_independent_subpics_flag) {
1239
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 flags(sps_subpic_treated_as_pic_flag[i], 1, i);
1240
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
306 flags(sps_loop_filter_across_subpic_enabled_flag[i], 1, i);
1241 } else {
1242 ✗ infer(sps_subpic_treated_as_pic_flag[i], 1);
1243 ✗ infer(sps_loop_filter_across_subpic_enabled_flag[i], 0);
1244 }
1245 }
1246 } else {
1247 ✗ infer(sps_subpic_ctu_top_left_x[0], 0);
1248 ✗ infer(sps_subpic_ctu_top_left_y[0], 0);
1249 ✗ infer(sps_subpic_width_minus1[0], max_width_minus1);
1250 ✗ infer(sps_subpic_height_minus1[0], max_height_minus1);
1251 }
1252
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 ue(sps_subpic_id_len_minus1, 0, 15);
1253 74 if ((1 << (current->sps_subpic_id_len_minus1 + 1)) <
1254
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 37 times.
74 current->sps_num_subpics_minus1 + 1) {
1255 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1256 "sps_subpic_id_len_minus1(%d) is too small\n",
1257 ✗ current->sps_subpic_id_len_minus1);
1258 ✗ return AVERROR_INVALIDDATA;
1259 }
1260
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37 times.
74 flag(sps_subpic_id_mapping_explicitly_signalled_flag);
1261
2/2
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 10 times.
74 if (current->sps_subpic_id_mapping_explicitly_signalled_flag) {
1262
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 27 times.
54 flag(sps_subpic_id_mapping_present_flag);
1263
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 17 times.
54 if (current->sps_subpic_id_mapping_present_flag) {
1264
2/2
✓ Branch 0 taken 50 times.
✓ Branch 1 taken 10 times.
120 for (i = 0; i <= current->sps_num_subpics_minus1; i++) {
1265
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 50 times.
100 ubs(current->sps_subpic_id_len_minus1 + 1,
1266 sps_subpic_id[i], 1, i);
1267 }
1268 }
1269 }
1270 } else {
1271
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2532 infer(sps_num_subpics_minus1, 0);
1272
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2532 infer(sps_independent_subpics_flag, 1);
1273
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2532 infer(sps_subpic_same_size_flag, 0);
1274
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2532 infer(sps_subpic_id_mapping_explicitly_signalled_flag, 0);
1275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2532 infer(sps_subpic_ctu_top_left_x[0], 0);
1276
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2532 infer(sps_subpic_ctu_top_left_y[0], 0);
1277
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2532 infer(sps_subpic_width_minus1[0], max_width_minus1);
1278
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
2532 infer(sps_subpic_height_minus1[0], max_height_minus1);
1279 }
1280
1281
1282
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_bitdepth_minus8, 0, 8);
1283 2606 qp_bd_offset = 6 * current->sps_bitdepth_minus8;
1284
1285
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_entropy_coding_sync_enabled_flag);
1286
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_entry_point_offsets_present_flag);
1287
1288
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 u(4, sps_log2_max_pic_order_cnt_lsb_minus4, 0, 12);
1289
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_poc_msb_cycle_flag);
1290
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1286 times.
2606 if (current->sps_poc_msb_cycle_flag)
1291
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(sps_poc_msb_cycle_len_minus1,
1292 0, 32 - current->sps_log2_max_pic_order_cnt_lsb_minus4 - 5);
1293
1294
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 u(2, sps_num_extra_ph_bytes, 0, 2);
1295
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1303 times.
2606 for (i = 0; i < (current->sps_num_extra_ph_bytes * 8); i++) {
1296 ✗ flags(sps_extra_ph_bit_present_flag[i], 1, i);
1297 }
1298
1299
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 u(2, sps_num_extra_sh_bytes, 0, 2);
1300
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1303 times.
2606 for (i = 0; i < (current->sps_num_extra_sh_bytes * 8); i++) {
1301 ✗ flags(sps_extra_sh_bit_present_flag[i], 1, i);
1302 }
1303
1304
1/2
✓ Branch 0 taken 1303 times.
✗ Branch 1 not taken.
2606 if (current->sps_ptl_dpb_hrd_params_present_flag) {
1305
2/2
✓ Branch 0 taken 374 times.
✓ Branch 1 taken 929 times.
2606 if (current->sps_max_sublayers_minus1 > 0)
1306
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 374 times.
748 flag(sps_sublayer_dpb_params_flag);
1307 else
1308
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 275 times.
1858 infer(sps_sublayer_dpb_params_flag, 0);
1309
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 CHECK(FUNC(dpb_parameters) (ctx, rw, &current->sps_dpb_params,
1310 current->sps_max_sublayers_minus1,
1311 current->sps_sublayer_dpb_params_flag));
1312 }
1313
1314
3/4
✓ Branch 0 taken 46 times.
✓ Branch 1 taken 1257 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1303 times.
2606 ue(sps_log2_min_luma_coding_block_size_minus2,
1315 0, FFMIN(4, current->sps_log2_ctu_size_minus5 + 3));
1316 2606 min_cb_log2_size_y =
1317 2606 current->sps_log2_min_luma_coding_block_size_minus2 + 2;
1318
1319
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_partition_constraints_override_enabled_flag);
1320
1321
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_log2_diff_min_qt_min_cb_intra_slice_luma,
1322 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
1323 2606 min_qt_log2_size_intra_y =
1324 2606 current->sps_log2_diff_min_qt_min_cb_intra_slice_luma +
1325 min_cb_log2_size_y;
1326
1327
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_max_mtt_hierarchy_depth_intra_slice_luma,
1328 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
1329
1330
2/2
✓ Branch 0 taken 1265 times.
✓ Branch 1 taken 38 times.
2606 if (current->sps_max_mtt_hierarchy_depth_intra_slice_luma != 0) {
1331
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1265 times.
2530 ue(sps_log2_diff_max_bt_min_qt_intra_slice_luma,
1332 0, ctb_log2_size_y - min_qt_log2_size_intra_y);
1333
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1265 times.
2530 ue(sps_log2_diff_max_tt_min_qt_intra_slice_luma,
1334 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_y);
1335 } else {
1336
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
76 infer(sps_log2_diff_max_bt_min_qt_intra_slice_luma, 0);
1337
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
76 infer(sps_log2_diff_max_tt_min_qt_intra_slice_luma, 0);
1338 }
1339
1340
2/2
✓ Branch 0 taken 1286 times.
✓ Branch 1 taken 17 times.
2606 if (current->sps_chroma_format_idc != 0) {
1341
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1286 times.
2572 flag(sps_qtbtt_dual_tree_intra_flag);
1342 } else {
1343
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_qtbtt_dual_tree_intra_flag, 0);
1344 }
1345
1346
2/2
✓ Branch 0 taken 476 times.
✓ Branch 1 taken 827 times.
2606 if (current->sps_qtbtt_dual_tree_intra_flag) {
1347
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 476 times.
952 ue(sps_log2_diff_min_qt_min_cb_intra_slice_chroma,
1348 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
1349
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 476 times.
952 ue(sps_max_mtt_hierarchy_depth_intra_slice_chroma,
1350 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
1351
2/2
✓ Branch 0 taken 457 times.
✓ Branch 1 taken 19 times.
952 if (current->sps_max_mtt_hierarchy_depth_intra_slice_chroma != 0) {
1352 914 unsigned int min_qt_log2_size_intra_c =
1353 914 current->sps_log2_diff_min_qt_min_cb_intra_slice_chroma +
1354 min_cb_log2_size_y;
1355
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 457 times.
914 ue(sps_log2_diff_max_bt_min_qt_intra_slice_chroma,
1356 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_c);
1357
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 457 times.
914 ue(sps_log2_diff_max_tt_min_qt_intra_slice_chroma,
1358 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_c);
1359 }
1360 } else {
1361
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1654 infer(sps_log2_diff_min_qt_min_cb_intra_slice_chroma, 0);
1362
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1654 infer(sps_max_mtt_hierarchy_depth_intra_slice_chroma, 0);
1363 }
1364
2/2
✓ Branch 0 taken 846 times.
✓ Branch 1 taken 457 times.
2606 if (current->sps_max_mtt_hierarchy_depth_intra_slice_chroma == 0) {
1365
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1692 infer(sps_log2_diff_max_bt_min_qt_intra_slice_chroma, 0);
1366
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1692 infer(sps_log2_diff_max_tt_min_qt_intra_slice_chroma, 0);
1367 }
1368
1369
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_log2_diff_min_qt_min_cb_inter_slice,
1370 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
1371 2606 min_qt_log2_size_inter_y =
1372 2606 current->sps_log2_diff_min_qt_min_cb_inter_slice + min_cb_log2_size_y;
1373
1374
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_max_mtt_hierarchy_depth_inter_slice,
1375 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
1376
2/2
✓ Branch 0 taken 1265 times.
✓ Branch 1 taken 38 times.
2606 if (current->sps_max_mtt_hierarchy_depth_inter_slice != 0) {
1377
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1265 times.
2530 ue(sps_log2_diff_max_bt_min_qt_inter_slice,
1378 0, ctb_log2_size_y - min_qt_log2_size_inter_y);
1379
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1265 times.
2530 ue(sps_log2_diff_max_tt_min_qt_inter_slice,
1380 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_inter_y);
1381 } else {
1382
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
76 infer(sps_log2_diff_max_bt_min_qt_inter_slice, 0);
1383
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
76 infer(sps_log2_diff_max_tt_min_qt_inter_slice, 0);
1384 }
1385
1386
2/2
✓ Branch 0 taken 1257 times.
✓ Branch 1 taken 46 times.
2606 if (ctb_size_y > 32)
1387
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1257 times.
2514 flag(sps_max_luma_transform_size_64_flag);
1388 else
1389
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
92 infer(sps_max_luma_transform_size_64_flag, 0);
1390
1391
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_transform_skip_enabled_flag);
1392
2/2
✓ Branch 0 taken 471 times.
✓ Branch 1 taken 832 times.
2606 if (current->sps_transform_skip_enabled_flag) {
1393
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 471 times.
942 ue(sps_log2_transform_skip_max_size_minus2, 0, 3);
1394
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 471 times.
942 flag(sps_bdpcm_enabled_flag);
1395 }
1396
1397
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_mts_enabled_flag);
1398
2/2
✓ Branch 0 taken 485 times.
✓ Branch 1 taken 818 times.
2606 if (current->sps_mts_enabled_flag) {
1399
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 485 times.
970 flag(sps_explicit_mts_intra_enabled_flag);
1400
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 485 times.
970 flag(sps_explicit_mts_inter_enabled_flag);
1401 } else {
1402
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1636 infer(sps_explicit_mts_intra_enabled_flag, 0);
1403
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1636 infer(sps_explicit_mts_inter_enabled_flag, 0);
1404 }
1405
1406
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_lfnst_enabled_flag);
1407
1408
2/2
✓ Branch 0 taken 1286 times.
✓ Branch 1 taken 17 times.
2606 if (current->sps_chroma_format_idc != 0) {
1409 uint8_t num_qp_tables;
1410
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1286 times.
2572 flag(sps_joint_cbcr_enabled_flag);
1411
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1286 times.
2572 flag(sps_same_qp_table_for_chroma_flag);
1412
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 1274 times.
2596 num_qp_tables = current->sps_same_qp_table_for_chroma_flag ?
1413
1/2
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
24 1 : (current->sps_joint_cbcr_enabled_flag ? 3 : 2);
1414
2/2
✓ Branch 0 taken 1310 times.
✓ Branch 1 taken 1286 times.
5192 for (i = 0; i < num_qp_tables; i++) {
1415
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1310 times.
2620 ses(sps_qp_table_start_minus26[i], -26 - qp_bd_offset, 36, 1, i);
1416
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1310 times.
2620 ues(sps_num_points_in_qp_table_minus1[i],
1417 0, 36 - current->sps_qp_table_start_minus26[i], 1, i);
1418
2/2
✓ Branch 0 taken 2340 times.
✓ Branch 1 taken 1310 times.
7300 for (j = 0; j <= current->sps_num_points_in_qp_table_minus1[i]; j++) {
1419 4680 uint8_t max = MAX_UINT_BITS(8);
1420
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2340 times.
4680 ues(sps_delta_qp_in_val_minus1[i][j], 0, max, 2, i, j);
1421
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2340 times.
4680 ues(sps_delta_qp_diff_val[i][j], 0, max, 2, i, j);
1422 }
1423 }
1424 } else {
1425
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_joint_cbcr_enabled_flag, 0);
1426
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_same_qp_table_for_chroma_flag, 0);
1427 }
1428
1429
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_sao_enabled_flag);
1430
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_alf_enabled_flag);
1431
4/4
✓ Branch 0 taken 437 times.
✓ Branch 1 taken 866 times.
✓ Branch 2 taken 420 times.
✓ Branch 3 taken 17 times.
2606 if (current->sps_alf_enabled_flag && current->sps_chroma_format_idc)
1432
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 420 times.
840 flag(sps_ccalf_enabled_flag);
1433 else
1434
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 271 times.
1766 infer(sps_ccalf_enabled_flag, 0);
1435
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_lmcs_enabled_flag);
1436
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_weighted_pred_flag);
1437
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_weighted_bipred_flag);
1438
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_long_term_ref_pics_flag);
1439
2/2
✓ Branch 0 taken 35 times.
✓ Branch 1 taken 1268 times.
2606 if (current->sps_video_parameter_set_id > 0)
1440
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 35 times.
70 flag(sps_inter_layer_prediction_enabled_flag);
1441 else
1442
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 329 times.
2536 infer(sps_inter_layer_prediction_enabled_flag, 0);
1443
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_idr_rpl_present_flag);
1444
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_rpl1_same_as_rpl0_flag);
1445
1446
4/4
✓ Branch 0 taken 188 times.
✓ Branch 1 taken 3627 times.
✓ Branch 2 taken 2512 times.
✓ Branch 3 taken 1303 times.
7630 for (i = 0; i < (current->sps_rpl1_same_as_rpl0_flag ? 1 : 2); i++) {
1447
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2512 times.
5024 ues(sps_num_ref_pic_lists[i], 0, VVC_MAX_REF_PIC_LISTS, 1, i);
1448
2/2
✓ Branch 0 taken 59195 times.
✓ Branch 1 taken 2512 times.
123414 for (j = 0; j < current->sps_num_ref_pic_lists[i]; j++)
1449
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 59195 times.
118390 CHECK(FUNC(ref_pic_list_struct) (ctx, rw,
1450 &current->
1451 sps_ref_pic_list_struct[i][j], i,
1452 j, current));
1453 }
1454
1455
2/2
✓ Branch 0 taken 94 times.
✓ Branch 1 taken 1209 times.
2606 if (current->sps_rpl1_same_as_rpl0_flag) {
1456 188 current->sps_num_ref_pic_lists[1] = current->sps_num_ref_pic_lists[0];
1457
2/2
✓ Branch 0 taken 1291 times.
✓ Branch 1 taken 94 times.
2770 for (j = 0; j < current->sps_num_ref_pic_lists[0]; j++)
1458 2582 memcpy(&current->sps_ref_pic_list_struct[1][j],
1459 2582 &current->sps_ref_pic_list_struct[0][j],
1460 sizeof(current->sps_ref_pic_list_struct[0][j]));
1461 }
1462
1463
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_ref_wraparound_enabled_flag);
1464
1465
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_temporal_mvp_enabled_flag);
1466
1/2
✓ Branch 0 taken 1303 times.
✗ Branch 1 not taken.
2606 if (current->sps_temporal_mvp_enabled_flag)
1467
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_sbtmvp_enabled_flag);
1468 else
1469 ✗ infer(sps_sbtmvp_enabled_flag, 0);
1470
1471
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_amvr_enabled_flag);
1472
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_bdof_enabled_flag);
1473
2/2
✓ Branch 0 taken 374 times.
✓ Branch 1 taken 929 times.
2606 if (current->sps_bdof_enabled_flag)
1474
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 374 times.
748 flag(sps_bdof_control_present_in_ph_flag);
1475 else
1476
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 275 times.
1858 infer(sps_bdof_control_present_in_ph_flag, 0);
1477
1478
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_smvd_enabled_flag);
1479
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_dmvr_enabled_flag);
1480
2/2
✓ Branch 0 taken 357 times.
✓ Branch 1 taken 946 times.
2606 if (current->sps_dmvr_enabled_flag)
1481
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 357 times.
714 flag(sps_dmvr_control_present_in_ph_flag);
1482 else
1483
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 278 times.
1892 infer(sps_dmvr_control_present_in_ph_flag, 0);
1484
1485
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_mmvd_enabled_flag);
1486
2/2
✓ Branch 0 taken 1258 times.
✓ Branch 1 taken 45 times.
2606 if (current->sps_mmvd_enabled_flag)
1487
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1258 times.
2516 flag(sps_mmvd_fullpel_only_enabled_flag);
1488 else
1489
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
90 infer(sps_mmvd_fullpel_only_enabled_flag, 0);
1490
1491
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_six_minus_max_num_merge_cand, 0, 5);
1492 2606 max_num_merge_cand = 6 - current->sps_six_minus_max_num_merge_cand;
1493
1494
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_sbt_enabled_flag);
1495
1496
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_affine_enabled_flag);
1497
2/2
✓ Branch 0 taken 490 times.
✓ Branch 1 taken 813 times.
2606 if (current->sps_affine_enabled_flag) {
1498
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 490 times.
980 ue(sps_five_minus_max_num_subblock_merge_cand,
1499 0, 5 - current->sps_sbtmvp_enabled_flag);
1500
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 490 times.
980 flag(sps_6param_affine_enabled_flag);
1501
2/2
✓ Branch 0 taken 485 times.
✓ Branch 1 taken 5 times.
980 if (current->sps_amvr_enabled_flag)
1502
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 485 times.
970 flag(sps_affine_amvr_enabled_flag);
1503 else
1504
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(sps_affine_amvr_enabled_flag, 0);
1505
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 490 times.
980 flag(sps_affine_prof_enabled_flag);
1506
2/2
✓ Branch 0 taken 472 times.
✓ Branch 1 taken 18 times.
980 if (current->sps_affine_prof_enabled_flag)
1507
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 472 times.
944 flag(sps_prof_control_present_in_ph_flag);
1508 else
1509
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
36 infer(sps_prof_control_present_in_ph_flag, 0);
1510 } else {
1511
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1626 infer(sps_6param_affine_enabled_flag, 0);
1512
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1626 infer(sps_affine_amvr_enabled_flag, 0);
1513
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1626 infer(sps_affine_prof_enabled_flag, 0);
1514
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1626 infer(sps_prof_control_present_in_ph_flag, 0);
1515 }
1516
1517
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_bcw_enabled_flag);
1518
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_ciip_enabled_flag);
1519
1520
1/2
✓ Branch 0 taken 1303 times.
✗ Branch 1 not taken.
2606 if (max_num_merge_cand >= 2) {
1521
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_gpm_enabled_flag);
1522
3/4
✓ Branch 0 taken 438 times.
✓ Branch 1 taken 865 times.
✓ Branch 2 taken 438 times.
✗ Branch 3 not taken.
2606 if (current->sps_gpm_enabled_flag && max_num_merge_cand >= 3)
1523
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 438 times.
876 ue(sps_max_num_merge_cand_minus_max_num_gpm_cand,
1524 0, max_num_merge_cand - 2);
1525 } else {
1526 ✗ infer(sps_gpm_enabled_flag, 0);
1527 }
1528
1529
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 ue(sps_log2_parallel_merge_level_minus2, 0, ctb_log2_size_y - 2);
1530
1531
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_isp_enabled_flag);
1532
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_mrl_enabled_flag);
1533
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_mip_enabled_flag);
1534
1535
2/2
✓ Branch 0 taken 1286 times.
✓ Branch 1 taken 17 times.
2606 if (current->sps_chroma_format_idc != 0)
1536
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1286 times.
2572 flag(sps_cclm_enabled_flag);
1537 else
1538
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
34 infer(sps_cclm_enabled_flag, 0);
1539
2/2
✓ Branch 0 taken 1250 times.
✓ Branch 1 taken 53 times.
2606 if (current->sps_chroma_format_idc == 1) {
1540
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1250 times.
2500 flag(sps_chroma_horizontal_collocated_flag);
1541
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1250 times.
2500 flag(sps_chroma_vertical_collocated_flag);
1542 } else {
1543
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
106 infer(sps_chroma_horizontal_collocated_flag, 1);
1544
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
106 infer(sps_chroma_vertical_collocated_flag, 1);
1545 }
1546
1547
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_palette_enabled_flag);
1548
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1279 times.
2606 if (current->sps_chroma_format_idc == 3 &&
1549
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 17 times.
48 !current->sps_max_luma_transform_size_64_flag)
1550
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
14 flag(sps_act_enabled_flag);
1551 else
1552
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2592 infer(sps_act_enabled_flag, 0);
1553
2/2
✓ Branch 0 taken 832 times.
✓ Branch 1 taken 471 times.
2606 if (current->sps_transform_skip_enabled_flag ||
1554
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 832 times.
1664 current->sps_palette_enabled_flag)
1555
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 471 times.
942 ue(sps_min_qp_prime_ts, 0, 8);
1556
1557
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_ibc_enabled_flag);
1558
2/2
✓ Branch 0 taken 29 times.
✓ Branch 1 taken 1274 times.
2606 if (current->sps_ibc_enabled_flag)
1559
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
58 ue(sps_six_minus_max_num_ibc_merge_cand, 0, 5);
1560
1561
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_ladf_enabled_flag);
1562
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1298 times.
2606 if (current->sps_ladf_enabled_flag) {
1563
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ub(2, sps_num_ladf_intervals_minus2);
1564
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 se(sps_ladf_lowest_interval_qp_offset, -63, 63);
1565
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++) {
1566
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
20 ses(sps_ladf_qp_offset[i], -63, 63, 1, i);
1567
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
20 ues(sps_ladf_delta_threshold_minus1[i],
1568 0, (2 << (8 + current->sps_bitdepth_minus8)) - 3, 1, i);
1569 }
1570 }
1571
1572
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_explicit_scaling_list_enabled_flag);
1573
2/2
✓ Branch 0 taken 378 times.
✓ Branch 1 taken 925 times.
2606 if (current->sps_lfnst_enabled_flag &&
1574
2/2
✓ Branch 0 taken 39 times.
✓ Branch 1 taken 339 times.
756 current->sps_explicit_scaling_list_enabled_flag)
1575
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 flag(sps_scaling_matrix_for_lfnst_disabled_flag);
1576
1577
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 1296 times.
2606 if (current->sps_act_enabled_flag &&
1578
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
14 current->sps_explicit_scaling_list_enabled_flag)
1579 ✗ flag(sps_scaling_matrix_for_alternative_colour_space_disabled_flag);
1580 else
1581
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2606 infer(sps_scaling_matrix_for_alternative_colour_space_disabled_flag, 0);
1582
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1303 times.
2606 if (current->sps_scaling_matrix_for_alternative_colour_space_disabled_flag)
1583 ✗ flag(sps_scaling_matrix_designated_colour_space_flag);
1584
1585
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_dep_quant_enabled_flag);
1586
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_sign_data_hiding_enabled_flag);
1587
1588
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_virtual_boundaries_enabled_flag);
1589
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1298 times.
2606 if (current->sps_virtual_boundaries_enabled_flag) {
1590
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 flag(sps_virtual_boundaries_present_flag);
1591
1/2
✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
10 if (current->sps_virtual_boundaries_present_flag) {
1592
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,
1593 0, current->sps_pic_width_max_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS);
1594
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
10 for (i = 0; i < current->sps_num_ver_virtual_boundaries; i++)
1595 ✗ ues(sps_virtual_boundary_pos_x_minus1[i],
1596 0, (current->sps_pic_width_max_in_luma_samples + 7) / 8 - 2,
1597 1, i);
1598
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,
1599 0, current->sps_pic_height_max_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS);
1600
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
10 for (i = 0; i < current->sps_num_hor_virtual_boundaries; i++)
1601 ✗ ues(sps_virtual_boundary_pos_y_minus1[i],
1602 0, (current->sps_pic_height_max_in_luma_samples + 7) /
1603 8 - 2, 1, i);
1604 }
1605 } else {
1606
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2596 infer(sps_virtual_boundaries_present_flag, 0);
1607
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2596 infer(sps_num_ver_virtual_boundaries, 0);
1608
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2596 infer(sps_num_hor_virtual_boundaries, 0);
1609 }
1610
1611
1/2
✓ Branch 0 taken 1303 times.
✗ Branch 1 not taken.
2606 if (current->sps_ptl_dpb_hrd_params_present_flag) {
1612
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_timing_hrd_params_present_flag);
1613
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 1267 times.
2606 if (current->sps_timing_hrd_params_present_flag) {
1614 uint8_t first_sublayer;
1615
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 CHECK(FUNC(general_timing_hrd_parameters) (ctx, rw,
1616 &current->sps_general_timing_hrd_parameters));
1617
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 19 times.
72 if (current->sps_max_sublayers_minus1 > 0)
1618
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 flag(sps_sublayer_cpb_params_present_flag);
1619 else
1620
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
38 infer(sps_sublayer_cpb_params_present_flag, 0);
1621
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 17 times.
72 first_sublayer = current->sps_sublayer_cpb_params_present_flag ?
1622 0 : current->sps_max_sublayers_minus1;
1623
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 CHECK(FUNC(ols_timing_hrd_parameters) (ctx, rw,
1624 &current->sps_ols_timing_hrd_parameters, first_sublayer,
1625 current->sps_max_sublayers_minus1,
1626 &current->sps_general_timing_hrd_parameters));
1627 }
1628 }
1629
1630
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_field_seq_flag);
1631
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_vui_parameters_present_flag);
1632
2/2
✓ Branch 0 taken 31 times.
✓ Branch 1 taken 1272 times.
2606 if (current->sps_vui_parameters_present_flag) {
1633
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 ue(sps_vui_payload_size_minus1, 0, 1023);
1634
2/2
✓ Branch 1 taken 131 times.
✓ Branch 2 taken 31 times.
324 while (byte_alignment(rw) != 0)
1635
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 131 times.
262 fixed(1, sps_vui_alignment_zero_bit, 0);
1636
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
62 CHECK(FUNC(vui_payload) (ctx, rw, &current->vui,
1637 current->sps_vui_payload_size_minus1 + 1,
1638 current->sps_chroma_format_idc));
1639 } else {
1640
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1272 times.
2544 CHECK(FUNC(vui_parameters_default) (ctx, rw, &current->vui));
1641 }
1642
1643
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 flag(sps_extension_flag);
1644
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1303 times.
2606 if (current->sps_extension_flag) {
1645 ✗ flag(sps_range_extension_flag);
1646 ✗ ub(7, sps_extension_7bits);
1647
1648 ✗ if (current->sps_range_extension_flag) {
1649 ✗ if (current->sps_bitdepth_minus8 <= 10 - 8)
1650 ✗ return AVERROR_INVALIDDATA;
1651 ✗ CHECK(FUNC(sps_range_extension)(ctx, rw, current));
1652 } else {
1653 ✗ infer(sps_extended_precision_flag, 0);
1654 ✗ infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0);
1655 ✗ infer(sps_rrc_rice_extension_flag, 0);
1656 ✗ infer(sps_persistent_rice_adaptation_enabled_flag, 0);
1657 ✗ infer(sps_reverse_last_sig_coeff_enabled_flag, 0);
1658 }
1659 } else {
1660
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2606 infer(sps_range_extension_flag, 0);
1661
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2606 infer(sps_extension_7bits, 0);
1662
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2606 infer(sps_extended_precision_flag, 0);
1663
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2606 infer(sps_ts_residual_coding_rice_present_in_sh_flag, 0);
1664
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2606 infer(sps_rrc_rice_extension_flag, 0);
1665
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2606 infer(sps_persistent_rice_adaptation_enabled_flag, 0);
1666
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 335 times.
2606 infer(sps_reverse_last_sig_coeff_enabled_flag, 0);
1667 }
1668
1669
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1303 times.
2606 if (current->sps_extension_7bits)
1670 ✗ CHECK(FUNC(extension_data)(ctx, rw, &current->extension_data));
1671
1672
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1303 times.
2606 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
1673
1674 2606 return 0;
1675 }
1676
1677 3868 static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
1678 H266RawPPS *current)
1679 {
1680 3868 CodedBitstreamH266Context *h266 = ctx->priv_data;
1681 const H266RawSPS *sps;
1682 int err, i;
1683 unsigned int min_cb_size_y, divisor, ctb_size_y,
1684 pic_width_in_ctbs_y, pic_height_in_ctbs_y;
1685 uint8_t sub_width_c, sub_height_c, qp_bd_offset;
1686
1687 static const uint8_t h266_sub_width_c[] = {
1688 1, 2, 2, 1
1689 };
1690 static const uint8_t h266_sub_height_c[] = {
1691 1, 2, 1, 1
1692 };
1693
1694 3868 HEADER("Picture Parameter Set");
1695
1696
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 CHECK(FUNC(nal_unit_header) (ctx, rw,
1697 &current->nal_unit_header, VVC_PPS_NUT));
1698
1699
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 ub(6, pps_pic_parameter_set_id);
1700
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 ub(4, pps_seq_parameter_set_id);
1701 3868 sps = h266->sps[current->pps_seq_parameter_set_id];
1702
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1934 times.
3868 if (!sps) {
1703 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n",
1704 ✗ current->pps_seq_parameter_set_id);
1705 ✗ return AVERROR_INVALIDDATA;
1706 }
1707
1708
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_mixed_nalu_types_in_pic_flag);
1709
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 ue(pps_pic_width_in_luma_samples,
1710 1, sps->sps_pic_width_max_in_luma_samples);
1711
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 ue(pps_pic_height_in_luma_samples,
1712 1, sps->sps_pic_height_max_in_luma_samples);
1713
1714 3868 min_cb_size_y = 1 << (sps->sps_log2_min_luma_coding_block_size_minus2 + 2);
1715 3868 divisor = FFMAX(min_cb_size_y, 8);
1716
1/2
✓ Branch 0 taken 1934 times.
✗ Branch 1 not taken.
3868 if (current->pps_pic_width_in_luma_samples % divisor ||
1717
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1934 times.
3868 current->pps_pic_height_in_luma_samples % divisor) {
1718 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1719 "Invalid dimensions: %ux%u not divisible "
1720 "by %u, MinCbSizeY = %u.\n",
1721 ✗ current->pps_pic_width_in_luma_samples,
1722 ✗ current->pps_pic_height_in_luma_samples, divisor, min_cb_size_y);
1723 ✗ return AVERROR_INVALIDDATA;
1724 }
1725
2/2
✓ Branch 0 taken 1927 times.
✓ Branch 1 taken 7 times.
3868 if (!sps->sps_res_change_in_clvs_allowed_flag &&
1726 3854 (current->pps_pic_width_in_luma_samples !=
1727
1/2
✓ Branch 0 taken 1927 times.
✗ Branch 1 not taken.
3854 sps->sps_pic_width_max_in_luma_samples ||
1728 3854 current->pps_pic_height_in_luma_samples !=
1729
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1927 times.
3854 sps->sps_pic_height_max_in_luma_samples)) {
1730 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1731 "Resolution change is not allowed, "
1732 "in max resolution (%ux%u) mismatched with pps(%ux%u).\n",
1733 ✗ sps->sps_pic_width_max_in_luma_samples,
1734 ✗ sps->sps_pic_height_max_in_luma_samples,
1735 ✗ current->pps_pic_width_in_luma_samples,
1736 ✗ current->pps_pic_height_in_luma_samples);
1737 ✗ return AVERROR_INVALIDDATA;
1738 }
1739
1740 3868 ctb_size_y = 1 << (sps->sps_log2_ctu_size_minus5 + 5);
1741
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 1922 times.
3868 if (sps->sps_ref_wraparound_enabled_flag) {
1742 24 if ((ctb_size_y / min_cb_size_y + 1) >
1743
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
24 (current->pps_pic_width_in_luma_samples / min_cb_size_y - 1)) {
1744 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1745 "Invalid width(%u), ctb_size_y = %u, min_cb_size_y = %u.\n",
1746 ✗ current->pps_pic_width_in_luma_samples,
1747 ctb_size_y, min_cb_size_y);
1748 ✗ return AVERROR_INVALIDDATA;
1749 }
1750 }
1751
1752
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_conformance_window_flag);
1753 3868 if (current->pps_pic_width_in_luma_samples ==
1754
2/2
✓ Branch 0 taken 1929 times.
✓ Branch 1 taken 5 times.
3868 sps->sps_pic_width_max_in_luma_samples &&
1755 3858 current->pps_pic_height_in_luma_samples ==
1756
1/2
✓ Branch 0 taken 1929 times.
✗ Branch 1 not taken.
3858 sps->sps_pic_height_max_in_luma_samples &&
1757
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1929 times.
3858 current->pps_conformance_window_flag) {
1758 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1759 "Conformance window flag should not true.\n");
1760 ✗ return AVERROR_INVALIDDATA;
1761 }
1762
1763 3868 sub_width_c = h266_sub_width_c[sps->sps_chroma_format_idc];
1764 3868 sub_height_c = h266_sub_height_c[sps->sps_chroma_format_idc];
1765
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1934 times.
3868 if (current->pps_conformance_window_flag) {
1766 ✗ ue(pps_conf_win_left_offset, 0, current->pps_pic_width_in_luma_samples);
1767 ✗ ue(pps_conf_win_right_offset,
1768 0, current->pps_pic_width_in_luma_samples);
1769 ✗ ue(pps_conf_win_top_offset, 0, current->pps_pic_height_in_luma_samples);
1770 ✗ ue(pps_conf_win_bottom_offset,
1771 0, current->pps_pic_height_in_luma_samples);
1772 ✗ if (sub_width_c *
1773 ✗ (current->pps_conf_win_left_offset +
1774 ✗ current->pps_conf_win_right_offset) >=
1775 ✗ current->pps_pic_width_in_luma_samples ||
1776 ✗ sub_height_c *
1777 ✗ (current->pps_conf_win_top_offset +
1778 ✗ current->pps_conf_win_bottom_offset) >=
1779 ✗ current->pps_pic_height_in_luma_samples) {
1780 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1781 "Invalid pps conformance window: (%u, %u, %u, %u), "
1782 "resolution is %ux%u, sub wxh is %ux%u.\n",
1783 ✗ current->pps_conf_win_left_offset,
1784 ✗ current->pps_conf_win_right_offset,
1785 ✗ current->pps_conf_win_top_offset,
1786 ✗ current->pps_conf_win_bottom_offset,
1787 ✗ current->pps_pic_width_in_luma_samples,
1788 ✗ current->pps_pic_height_in_luma_samples,
1789 sub_width_c, sub_height_c);
1790 ✗ return AVERROR_INVALIDDATA;
1791 }
1792 } else {
1793 3868 if (current->pps_pic_width_in_luma_samples ==
1794
2/2
✓ Branch 0 taken 1929 times.
✓ Branch 1 taken 5 times.
3868 sps->sps_pic_width_max_in_luma_samples &&
1795 3858 current->pps_pic_height_in_luma_samples ==
1796
1/2
✓ Branch 0 taken 1929 times.
✗ Branch 1 not taken.
3858 sps->sps_pic_height_max_in_luma_samples) {
1797
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3858 infer(pps_conf_win_left_offset, sps->sps_conf_win_left_offset);
1798
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3858 infer(pps_conf_win_right_offset, sps->sps_conf_win_right_offset);
1799
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3858 infer(pps_conf_win_top_offset, sps->sps_conf_win_top_offset);
1800
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3858 infer(pps_conf_win_bottom_offset, sps->sps_conf_win_bottom_offset);
1801 } else {
1802
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(pps_conf_win_left_offset, 0);
1803
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(pps_conf_win_right_offset, 0);
1804
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(pps_conf_win_top_offset, 0);
1805
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
10 infer(pps_conf_win_bottom_offset, 0);
1806 }
1807
1808 }
1809
1810
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_scaling_window_explicit_signalling_flag);
1811
2/2
✓ Branch 0 taken 386 times.
✓ Branch 1 taken 1548 times.
3868 if (!sps->sps_ref_pic_resampling_enabled_flag &&
1812
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 386 times.
772 current->pps_scaling_window_explicit_signalling_flag) {
1813 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1814 "Invalid data: sps_ref_pic_resampling_enabled_flag is false, "
1815 "but pps_scaling_window_explicit_signalling_flag is true.\n");
1816 ✗ return AVERROR_INVALIDDATA;
1817 }
1818
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1934 times.
3868 if (current->pps_scaling_window_explicit_signalling_flag) {
1819 ✗ se(pps_scaling_win_left_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_right_offset,
1823 -current->pps_pic_width_in_luma_samples * 15 / sub_width_c,
1824 current->pps_pic_width_in_luma_samples / sub_width_c);
1825 ✗ se(pps_scaling_win_top_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 ✗ se(pps_scaling_win_bottom_offset,
1829 -current->pps_pic_height_in_luma_samples * 15 / sub_height_c,
1830 current->pps_pic_height_in_luma_samples / sub_height_c);
1831 } else {
1832
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3868 infer(pps_scaling_win_left_offset, current->pps_conf_win_left_offset);
1833
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3868 infer(pps_scaling_win_right_offset, current->pps_conf_win_right_offset);
1834
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3868 infer(pps_scaling_win_top_offset, current->pps_conf_win_top_offset);
1835
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
3868 infer(pps_scaling_win_bottom_offset, current->pps_conf_win_bottom_offset);
1836 }
1837
1838
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_output_flag_present_flag);
1839
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_no_pic_partition_flag);
1840
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_subpic_id_mapping_present_flag);
1841
1842
2/2
✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1917 times.
3868 if (current->pps_subpic_id_mapping_present_flag) {
1843
1/2
✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
34 if (!current->pps_no_pic_partition_flag) {
1844
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(pps_num_subpics_minus1,
1845 sps->sps_num_subpics_minus1, sps->sps_num_subpics_minus1);
1846 } else {
1847 ✗ infer(pps_num_subpics_minus1, 0);
1848 }
1849
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
34 ue(pps_subpic_id_len_minus1, sps->sps_subpic_id_len_minus1,
1850 sps->sps_subpic_id_len_minus1);
1851
2/2
✓ Branch 0 taken 85 times.
✓ Branch 1 taken 17 times.
204 for (i = 0; i <= current->pps_num_subpics_minus1; i++) {
1852
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);
1853 }
1854 }
1855
1856
2/2
✓ Branch 0 taken 2793 times.
✓ Branch 1 taken 1934 times.
9454 for (i = 0; i <= sps->sps_num_subpics_minus1; i++) {
1857
2/2
✓ Branch 0 taken 135 times.
✓ Branch 1 taken 2658 times.
5586 if (sps->sps_subpic_id_mapping_explicitly_signalled_flag)
1858
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
1859 ? current->pps_subpic_id[i]
1860 100 : sps->sps_subpic_id[i];
1861 else
1862 5316 current->sub_pic_id_val[i] = i;
1863 }
1864
1865 3868 pic_width_in_ctbs_y = AV_CEIL_RSHIFT
1866 (current->pps_pic_width_in_luma_samples, (sps->sps_log2_ctu_size_minus5 + 5));
1867 3868 pic_height_in_ctbs_y = AV_CEIL_RSHIFT(
1868 current->pps_pic_height_in_luma_samples,(sps->sps_log2_ctu_size_minus5 + 5));
1869
2/2
✓ Branch 0 taken 445 times.
✓ Branch 1 taken 1489 times.
3868 if (!current->pps_no_pic_partition_flag) {
1870 890 unsigned int exp_tile_width = 0, exp_tile_height = 0;
1871 unsigned int unified_size, remaining_size;
1872
1873
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
890 u(2, pps_log2_ctu_size_minus5,
1874 sps->sps_log2_ctu_size_minus5, sps->sps_log2_ctu_size_minus5);
1875
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
890 ue(pps_num_exp_tile_columns_minus1,
1876 0, FFMIN(pic_width_in_ctbs_y - 1, VVC_MAX_TILE_COLUMNS - 1));
1877
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
890 ue(pps_num_exp_tile_rows_minus1,
1878 0, FFMIN(pic_height_in_ctbs_y - 1, VVC_MAX_TILE_ROWS - 1));
1879
1880
2/2
✓ Branch 0 taken 917 times.
✓ Branch 1 taken 445 times.
2724 for (i = 0; i <= current->pps_num_exp_tile_columns_minus1; i++) {
1881
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 917 times.
1834 ues(pps_tile_column_width_minus1[i],
1882 0, pic_width_in_ctbs_y - exp_tile_width - 1, 1, i);
1883 1834 exp_tile_width += current->pps_tile_column_width_minus1[i] + 1;
1884 }
1885
2/2
✓ Branch 0 taken 1229 times.
✓ Branch 1 taken 445 times.
3348 for (i = 0; i <= current->pps_num_exp_tile_rows_minus1; i++) {
1886
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1229 times.
2458 ues(pps_tile_row_height_minus1[i],
1887 0, pic_height_in_ctbs_y - exp_tile_height - 1, 1, i);
1888 2458 exp_tile_height += current->pps_tile_row_height_minus1[i] + 1;
1889 }
1890
1891 890 remaining_size = pic_width_in_ctbs_y;
1892
2/2
✓ Branch 0 taken 917 times.
✓ Branch 1 taken 445 times.
2724 for (i = 0; i <= current->pps_num_exp_tile_columns_minus1; i++) {
1893
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 917 times.
1834 if (current->pps_tile_column_width_minus1[i] >= remaining_size) {
1894 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1895 "Tile column width(%d) exceeds picture width\n",i);
1896 ✗ return AVERROR_INVALIDDATA;
1897 }
1898 1834 current->col_width_val[i] = current->pps_tile_column_width_minus1[i] + 1;
1899 1834 remaining_size -= (current->pps_tile_column_width_minus1[i] + 1);
1900 }
1901 890 unified_size = current->pps_tile_column_width_minus1[i - 1] + 1;
1902
2/2
✓ Branch 0 taken 829 times.
✓ Branch 1 taken 445 times.
2548 while (remaining_size > 0) {
1903
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 829 times.
1658 if (i == VVC_MAX_TILE_COLUMNS) {
1904 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1905 "Exceeded maximum tile columns (%d) (remaining size: %u)\n",
1906 VVC_MAX_TILE_COLUMNS, remaining_size);
1907 ✗ return AVERROR_INVALIDDATA;
1908 }
1909 1658 unified_size = FFMIN(remaining_size, unified_size);
1910 1658 current->col_width_val[i] = unified_size;
1911 1658 remaining_size -= unified_size;
1912 1658 i++;
1913 }
1914 890 current->num_tile_columns = i;
1915
1916 890 remaining_size = pic_height_in_ctbs_y;
1917
2/2
✓ Branch 0 taken 1229 times.
✓ Branch 1 taken 445 times.
3348 for (i = 0; i <= current->pps_num_exp_tile_rows_minus1; i++) {
1918
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1229 times.
2458 if (current->pps_tile_row_height_minus1[i] >= remaining_size) {
1919 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1920 "Tile row height(%d) exceeds picture height\n",i);
1921 ✗ return AVERROR_INVALIDDATA;
1922 }
1923 2458 current->row_height_val[i] = current->pps_tile_row_height_minus1[i] + 1;
1924 2458 remaining_size -= (current->pps_tile_row_height_minus1[i] + 1);
1925 }
1926 890 unified_size = current->pps_tile_row_height_minus1[i - 1] + 1;
1927
1928
2/2
✓ Branch 0 taken 461 times.
✓ Branch 1 taken 445 times.
1812 while (remaining_size > 0) {
1929
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 461 times.
922 if (i == VVC_MAX_TILE_ROWS) {
1930 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1931 "Exceeded maximum tile rows (%d) (remaining size: %u)\n",
1932 VVC_MAX_TILE_ROWS, remaining_size);
1933 ✗ return AVERROR_INVALIDDATA;
1934 }
1935 922 unified_size = FFMIN(remaining_size, unified_size);
1936 922 current->row_height_val[i] = unified_size;
1937 922 remaining_size -= unified_size;
1938 922 i++;
1939 }
1940 890 current->num_tile_rows=i;
1941
1942 890 current->num_tiles_in_pic = current->num_tile_columns *
1943 890 current->num_tile_rows;
1944
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 445 times.
890 if (current->num_tiles_in_pic > VVC_MAX_TILES_PER_AU) {
1945 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
1946 "NumTilesInPic(%d) > than VVC_MAX_TILES_PER_AU(%d)\n",
1947 ✗ current->num_tiles_in_pic, VVC_MAX_TILES_PER_AU);
1948 ✗ return AVERROR_INVALIDDATA;
1949 }
1950
1951
2/2
✓ Branch 0 taken 440 times.
✓ Branch 1 taken 5 times.
890 if (current->num_tiles_in_pic > 1) {
1952
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
880 flag(pps_loop_filter_across_tiles_enabled_flag);
1953
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
880 flag(pps_rect_slice_flag);
1954 } else {
1955
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
10 infer(pps_loop_filter_across_tiles_enabled_flag, 0);
1956
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
10 infer(pps_rect_slice_flag, 1);
1957 }
1958
2/2
✓ Branch 0 taken 435 times.
✓ Branch 1 taken 10 times.
890 if (current->pps_rect_slice_flag)
1959
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 435 times.
870 flag(pps_single_slice_per_subpic_flag);
1960 else
1961
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
20 infer(pps_single_slice_per_subpic_flag, 1);
1962
2/2
✓ Branch 0 taken 435 times.
✓ Branch 1 taken 10 times.
890 if (current->pps_rect_slice_flag &&
1963
2/2
✓ Branch 0 taken 426 times.
✓ Branch 1 taken 9 times.
1722 !current->pps_single_slice_per_subpic_flag) {
1964 852 int j, num_slices = 0;
1965 852 uint16_t tile_idx = 0, tile_x, tile_y, ctu_x, ctu_y;
1966 uint16_t slice_top_left_ctu_x[VVC_MAX_SLICES];
1967 uint16_t slice_top_left_ctu_y[VVC_MAX_SLICES];
1968
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 426 times.
852 ue(pps_num_slices_in_pic_minus1, 0, VVC_MAX_SLICES - 1);
1969
2/2
✓ Branch 0 taken 402 times.
✓ Branch 1 taken 24 times.
852 if (current->pps_num_slices_in_pic_minus1 > 1)
1970
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 402 times.
804 flag(pps_tile_idx_delta_present_flag);
1971 else
1972
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
48 infer(pps_tile_idx_delta_present_flag, 0);
1973
2/2
✓ Branch 0 taken 1091 times.
✓ Branch 1 taken 426 times.
3034 for (i = 0; i < current->pps_num_slices_in_pic_minus1; i++) {
1974 2182 current->slice_top_left_tile_idx[i] = tile_idx;
1975 2182 tile_x = tile_idx % current->num_tile_columns;
1976 2182 tile_y = tile_idx / current->num_tile_columns;
1977
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1091 times.
2182 if (tile_y >= current->num_tile_rows)
1978 ✗ return AVERROR_INVALIDDATA;
1979
2/2
✓ Branch 0 taken 1032 times.
✓ Branch 1 taken 59 times.
2182 if (tile_x != current->num_tile_columns - 1) {
1980
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1032 times.
2064 ues(pps_slice_width_in_tiles_minus1[i],
1981 0, current->num_tile_columns - 1 - tile_x, 1, i);
1982 } else {
1983
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11 times.
118 infer(pps_slice_width_in_tiles_minus1[i], 0);
1984 }
1985
2/2
✓ Branch 0 taken 996 times.
✓ Branch 1 taken 95 times.
2182 if (tile_y != current->num_tile_rows - 1 &&
1986
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)) {
1987
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 590 times.
1180 ues(pps_slice_height_in_tiles_minus1[i],
1988 0, current->num_tile_rows - 1 - tile_y, 1, i);
1989 } else {
1990
2/2
✓ Branch 0 taken 95 times.
✓ Branch 1 taken 406 times.
1002 if (tile_y == current->num_tile_rows - 1)
1991
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
190 infer(pps_slice_height_in_tiles_minus1[i], 0);
1992 else
1993
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
812 infer(pps_slice_height_in_tiles_minus1[i],
1994 current->pps_slice_height_in_tiles_minus1[i - 1]);
1995 }
1996
1997 2182 ctu_x = ctu_y = 0;
1998
2/2
✓ Branch 0 taken 888 times.
✓ Branch 1 taken 1091 times.
3958 for (j = 0; j < tile_x; j++) {
1999 1776 ctu_x += current->col_width_val[j];
2000 }
2001
2/2
✓ Branch 0 taken 515 times.
✓ Branch 1 taken 1091 times.
3212 for (j = 0; j < tile_y; j++) {
2002 1030 ctu_y += current->row_height_val[j];
2003 }
2004
2/2
✓ Branch 0 taken 667 times.
✓ Branch 1 taken 424 times.
2182 if (current->pps_slice_width_in_tiles_minus1[i] == 0 &&
2005
2/2
✓ Branch 0 taken 640 times.
✓ Branch 1 taken 27 times.
1334 current->pps_slice_height_in_tiles_minus1[i] == 0 &&
2006
2/2
✓ Branch 0 taken 154 times.
✓ Branch 1 taken 486 times.
1280 current->row_height_val[tile_y] > 1) {
2007 int uniform_slice_height, remaining_height_in_ctbs_y;
2008 308 remaining_height_in_ctbs_y =
2009 308 current->row_height_val[tile_y];
2010
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 154 times.
308 ues(pps_num_exp_slices_in_tile[i],
2011 0, current->row_height_val[tile_y] - 1, 1, i);
2012
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
308 if (current->pps_num_exp_slices_in_tile[i] == 0) {
2013 ✗ current->num_slices_in_tile[i] = 1;
2014 ✗ current->slice_height_in_ctus[i] = current->row_height_val[tile_y];
2015 ✗ slice_top_left_ctu_x[i] = ctu_x;
2016 ✗ slice_top_left_ctu_y[i] = ctu_y;
2017 } else {
2018 uint16_t slice_height_in_ctus;
2019 int num_uniform_slices;
2020
2021 308 if (i + current->pps_num_exp_slices_in_tile[i] >
2022
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
308 current->pps_num_slices_in_pic_minus1 + 1)
2023 ✗ return AVERROR_INVALIDDATA;
2024
2025
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];
2026 416 j++) {
2027
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 208 times.
416 ues(pps_exp_slice_height_in_ctus_minus1[i][j], 0,
2028 remaining_height_in_ctbs_y - (current->pps_num_exp_slices_in_tile[i] - j), 2,
2029 i, j);
2030 416 slice_height_in_ctus =
2031 current->
2032 416 pps_exp_slice_height_in_ctus_minus1[i][j] + 1;
2033
2034 416 current->slice_height_in_ctus[i + j] =
2035 slice_height_in_ctus;
2036 416 slice_top_left_ctu_x[i + j] = ctu_x;
2037 416 slice_top_left_ctu_y[i + j] = ctu_y;
2038 416 ctu_y += slice_height_in_ctus;
2039
2040 416 remaining_height_in_ctbs_y -= slice_height_in_ctus;
2041 }
2042
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
308 uniform_slice_height = 1 +
2043 ✗ (j == 0 ? current->row_height_val[tile_y] - 1:
2044 308 current->pps_exp_slice_height_in_ctus_minus1[i][j-1]);
2045
2046 308 num_uniform_slices = (remaining_height_in_ctbs_y + uniform_slice_height - 1)
2047 / uniform_slice_height;
2048 308 if (i + current->pps_num_exp_slices_in_tile[i] + num_uniform_slices >
2049
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
308 current->pps_num_slices_in_pic_minus1 + 1)
2050 ✗ return AVERROR_INVALIDDATA;
2051
2052
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
308 while (remaining_height_in_ctbs_y > uniform_slice_height) {
2053 ✗ current->slice_height_in_ctus[i + j] =
2054 uniform_slice_height;
2055 ✗ slice_top_left_ctu_x[i + j] = ctu_x;
2056 ✗ slice_top_left_ctu_y[i + j] = ctu_y;
2057 ✗ ctu_y += uniform_slice_height;
2058
2059 ✗ remaining_height_in_ctbs_y -= uniform_slice_height;
2060 ✗ j++;
2061 }
2062
2/2
✓ Branch 0 taken 100 times.
✓ Branch 1 taken 54 times.
308 if (remaining_height_in_ctbs_y > 0) {
2063 200 current->slice_height_in_ctus[i + j] =
2064 remaining_height_in_ctbs_y;
2065 200 slice_top_left_ctu_x[i + j] = ctu_x;
2066 200 slice_top_left_ctu_y[i + j] = ctu_y;
2067 200 j++;
2068 }
2069 308 current->num_slices_in_tile[i] = j;
2070 }
2071
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++)
2072 616 current->slice_top_left_tile_idx[i + k] = tile_idx;
2073 308 i += current->num_slices_in_tile[i] - 1;
2074 } else {
2075 1874 uint16_t height = 0;
2076
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
1874 infer(pps_num_exp_slices_in_tile[i], 0);
2077
2/2
✓ Branch 0 taken 513 times.
✓ Branch 1 taken 424 times.
1874 if (current->pps_slice_width_in_tiles_minus1[i] == 0 &&
2078
2/2
✓ Branch 0 taken 486 times.
✓ Branch 1 taken 27 times.
1026 current->pps_slice_height_in_tiles_minus1[i] == 0)
2079 972 current->num_slices_in_tile[i] = 1;
2080
2081 1874 for (j = 0;
2082
2/2
✓ Branch 0 taken 1015 times.
✓ Branch 1 taken 937 times.
3904 j <= current->pps_slice_height_in_tiles_minus1[i];
2083 2030 j++) {
2084 2030 height +=
2085 2030 current->row_height_val[tile_y + j];
2086 }
2087 1874 current->slice_height_in_ctus[i] = height;
2088
2089 1874 slice_top_left_ctu_x[i] = ctu_x;
2090 1874 slice_top_left_ctu_y[i] = ctu_y;
2091 }
2092
1/2
✓ Branch 0 taken 1091 times.
✗ Branch 1 not taken.
2182 if (i < current->pps_num_slices_in_pic_minus1) {
2093
2/2
✓ Branch 0 taken 255 times.
✓ Branch 1 taken 836 times.
2182 if (current->pps_tile_idx_delta_present_flag) {
2094 // Two conditions must be met:
2095 // 1. −NumTilesInPic + 1 <= pps_tile_idx_delta_val[i] <= NumTilesInPic − 1
2096 // 2. 0 <= tile_idx + pps_tile_idx_delta_val[i] <= NumTilesInPic − 1
2097 // Combining these conditions yields: -tile_idx <= pps_tile_idx_delta_val[i] <= NumTilesInPic - 1 - tile_idx
2098
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 255 times.
510 ses(pps_tile_idx_delta_val[i],
2099 -tile_idx, current->num_tiles_in_pic - 1 - tile_idx, 1, i);
2100
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 255 times.
510 if (current->pps_tile_idx_delta_val[i] == 0) {
2101 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
2102 "pps_tile_idx_delta_val[i] shall not be equal to 0.\n");
2103 }
2104 510 tile_idx += current->pps_tile_idx_delta_val[i];
2105 } else {
2106
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
1672 infer(pps_tile_idx_delta_val[i], 0);
2107 1672 tile_idx +=
2108 1672 current->pps_slice_width_in_tiles_minus1[i] + 1;
2109
2/2
✓ Branch 0 taken 382 times.
✓ Branch 1 taken 454 times.
1672 if (tile_idx % current->num_tile_columns == 0) {
2110 764 tile_idx +=
2111 764 current->pps_slice_height_in_tiles_minus1[i] *
2112 764 current->num_tile_columns;
2113 }
2114 }
2115 }
2116 }
2117
1/2
✓ Branch 0 taken 426 times.
✗ Branch 1 not taken.
852 if (i == current->pps_num_slices_in_pic_minus1) {
2118 852 uint16_t height = 0;
2119
2120 852 current->slice_top_left_tile_idx[i] = tile_idx;
2121 852 current->num_slices_in_tile[i] = 1;
2122 852 tile_x = tile_idx % current->num_tile_columns;
2123 852 tile_y = tile_idx / current->num_tile_columns;
2124
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 426 times.
852 if (tile_y >= current->num_tile_rows)
2125 ✗ return AVERROR_INVALIDDATA;
2126
2127 852 ctu_x = 0, ctu_y = 0;
2128
2/2
✓ Branch 0 taken 149 times.
✓ Branch 1 taken 426 times.
1150 for (j = 0; j < tile_x; j++) {
2129 298 ctu_x += current->col_width_val[j];
2130 }
2131
2/2
✓ Branch 0 taken 480 times.
✓ Branch 1 taken 426 times.
1812 for (j = 0; j < tile_y; j++) {
2132 960 ctu_y += current->row_height_val[j];
2133 }
2134 852 slice_top_left_ctu_x[i] = ctu_x;
2135 852 slice_top_left_ctu_y[i] = ctu_y;
2136
2137 852 current->pps_slice_width_in_tiles_minus1[i] =
2138 852 current->num_tile_columns - tile_x - 1;
2139 852 current->pps_slice_height_in_tiles_minus1[i] =
2140 852 current->num_tile_rows - tile_y - 1;
2141
2142
2/2
✓ Branch 0 taken 1142 times.
✓ Branch 1 taken 426 times.
3136 for (j = 0; j <= current->pps_slice_height_in_tiles_minus1[i];
2143 2284 j++) {
2144 2284 height +=
2145 2284 current->row_height_val[tile_y + j];
2146 }
2147 852 current->slice_height_in_ctus[i] = height;
2148
2149
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
852 infer(pps_num_exp_slices_in_tile[i], 0);
2150 }
2151 //now, we got all slice information, let's resolve NumSlicesInSubpic
2152
2/2
✓ Branch 0 taken 1250 times.
✓ Branch 1 taken 426 times.
3352 for (i = 0; i <= sps->sps_num_subpics_minus1; i++) {
2153 2500 current->num_slices_in_subpic[i] = 0;
2154
2/2
✓ Branch 0 taken 4683 times.
✓ Branch 1 taken 1250 times.
11866 for (j = 0; j <= current->pps_num_slices_in_pic_minus1; j++) {
2155 9366 uint16_t pos_x = 0, pos_y = 0;
2156 9366 pos_x = slice_top_left_ctu_x[j];
2157 9366 pos_y = slice_top_left_ctu_y[j];
2158
2/2
✓ Branch 0 taken 3508 times.
✓ Branch 1 taken 1175 times.
9366 if ((pos_x >= sps->sps_subpic_ctu_top_left_x[i]) &&
2159 7016 (pos_x <
2160 7016 sps->sps_subpic_ctu_top_left_x[i] +
2161
2/2
✓ Branch 0 taken 2961 times.
✓ Branch 1 taken 547 times.
7016 sps->sps_subpic_width_minus1[i] + 1) &&
2162
2/2
✓ Branch 0 taken 2083 times.
✓ Branch 1 taken 878 times.
5922 (pos_y >= sps->sps_subpic_ctu_top_left_y[i]) &&
2163 4166 (pos_y < sps->sps_subpic_ctu_top_left_y[i] +
2164
2/2
✓ Branch 0 taken 1671 times.
✓ Branch 1 taken 412 times.
4166 sps->sps_subpic_height_minus1[i] + 1)) {
2165 3342 current->num_slices_in_subpic[i]++;
2166 }
2167 }
2168
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1250 times.
2500 if (!current->num_slices_in_subpic[i])
2169 ✗ return AVERROR_INVALIDDATA;
2170 2500 num_slices += current->num_slices_in_subpic[i];
2171 }
2172
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 426 times.
852 if (current->pps_num_slices_in_pic_minus1 + 1 != num_slices)
2173 ✗ return AVERROR_INVALIDDATA;
2174 } else {
2175
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 19 times.
38 if (current->pps_no_pic_partition_flag)
2176 ✗ infer(pps_num_slices_in_pic_minus1, 0);
2177
1/2
✓ Branch 0 taken 19 times.
✗ Branch 1 not taken.
38 else if (current->pps_single_slice_per_subpic_flag) {
2178
2/2
✓ Branch 0 taken 54 times.
✓ Branch 1 taken 19 times.
146 for (i = 0; i <= sps->sps_num_subpics_minus1; i++)
2179 108 current->num_slices_in_subpic[i] = 1;
2180
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
38 infer(pps_num_slices_in_pic_minus1,
2181 sps->sps_num_subpics_minus1);
2182 }
2183 // else?
2184 }
2185
2/2
✓ Branch 0 taken 435 times.
✓ Branch 1 taken 10 times.
890 if (!current->pps_rect_slice_flag ||
2186
2/2
✓ Branch 0 taken 426 times.
✓ Branch 1 taken 9 times.
870 current->pps_single_slice_per_subpic_flag ||
2187
2/2
✓ Branch 0 taken 402 times.
✓ Branch 1 taken 24 times.
852 current->pps_num_slices_in_pic_minus1 > 0)
2188
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 421 times.
842 flag(pps_loop_filter_across_slices_enabled_flag);
2189 else
2190
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
48 infer(pps_loop_filter_across_slices_enabled_flag, 0);
2191 } else {
2192
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
2978 infer(pps_num_exp_tile_columns_minus1, 0);
2193
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
2978 infer(pps_tile_column_width_minus1[0], pic_width_in_ctbs_y - 1);
2194
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
2978 infer(pps_num_exp_tile_rows_minus1, 0);
2195
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
2978 infer(pps_tile_row_height_minus1[0], pic_height_in_ctbs_y - 1);
2196 2978 current->col_width_val[0] = pic_width_in_ctbs_y;
2197 2978 current->row_height_val[0] = pic_height_in_ctbs_y;
2198 2978 current->num_tile_columns = 1;
2199 2978 current->num_tile_rows = 1;
2200 2978 current->num_tiles_in_pic = 1;
2201 }
2202
2203
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_cabac_init_present_flag);
2204
2/2
✓ Branch 0 taken 3868 times.
✓ Branch 1 taken 1934 times.
11604 for (i = 0; i < 2; i++)
2205
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3868 times.
7736 ues(pps_num_ref_idx_default_active_minus1[i], 0, 14, 1, i);
2206
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_rpl1_idx_present_flag);
2207
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_weighted_pred_flag);
2208
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_weighted_bipred_flag);
2209
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_ref_wraparound_enabled_flag);
2210
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 1922 times.
3868 if (current->pps_ref_wraparound_enabled_flag) {
2211
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 ue(pps_pic_width_minus_wraparound_offset,
2212 0, (current->pps_pic_width_in_luma_samples / min_cb_size_y)
2213 - (ctb_size_y / min_cb_size_y) - 2);
2214 }
2215
2216 3868 qp_bd_offset = 6 * sps->sps_bitdepth_minus8;
2217
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 se(pps_init_qp_minus26, -(26 + qp_bd_offset), 37);
2218
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_cu_qp_delta_enabled_flag);
2219
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_chroma_tool_offsets_present_flag);
2220
2/2
✓ Branch 0 taken 1116 times.
✓ Branch 1 taken 818 times.
3868 if (current->pps_chroma_tool_offsets_present_flag) {
2221
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1116 times.
2232 se(pps_cb_qp_offset, -12, 12);
2222
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1116 times.
2232 se(pps_cr_qp_offset, -12, 12);
2223
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1116 times.
2232 flag(pps_joint_cbcr_qp_offset_present_flag);
2224
2/2
✓ Branch 0 taken 1107 times.
✓ Branch 1 taken 9 times.
2232 if (current->pps_joint_cbcr_qp_offset_present_flag)
2225
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1107 times.
2214 se(pps_joint_cbcr_qp_offset_value, -12, 12);
2226 else
2227
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
18 infer(pps_joint_cbcr_qp_offset_value, 0);
2228
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1116 times.
2232 flag(pps_slice_chroma_qp_offsets_present_flag);
2229
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1116 times.
2232 flag(pps_cu_chroma_qp_offset_list_enabled_flag);
2230
2/2
✓ Branch 0 taken 358 times.
✓ Branch 1 taken 758 times.
2232 if (current->pps_cu_chroma_qp_offset_list_enabled_flag) {
2231
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
716 ue(pps_chroma_qp_offset_list_len_minus1, 0, 5);
2232
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++) {
2233
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1202 times.
2404 ses(pps_cb_qp_offset_list[i], -12, 12, 1, i);
2234
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1202 times.
2404 ses(pps_cr_qp_offset_list[i], -12, 12, 1, i);
2235
1/2
✓ Branch 0 taken 1202 times.
✗ Branch 1 not taken.
2404 if (current->pps_joint_cbcr_qp_offset_present_flag)
2236
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1202 times.
2404 ses(pps_joint_cbcr_qp_offset_list[i], -12, 12, 1, i);
2237 else
2238 ✗ infer(pps_joint_cbcr_qp_offset_list[i], 0);
2239 }
2240 }
2241 } else {
2242
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1636 infer(pps_cb_qp_offset, 0);
2243
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1636 infer(pps_cr_qp_offset, 0);
2244
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1636 infer(pps_joint_cbcr_qp_offset_present_flag, 0);
2245
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1636 infer(pps_joint_cbcr_qp_offset_value, 0);
2246
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1636 infer(pps_slice_chroma_qp_offsets_present_flag, 0);
2247
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 260 times.
1636 infer(pps_cu_chroma_qp_offset_list_enabled_flag, 0);
2248 }
2249
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_deblocking_filter_control_present_flag);
2250
2/2
✓ Branch 0 taken 1158 times.
✓ Branch 1 taken 776 times.
3868 if (current->pps_deblocking_filter_control_present_flag) {
2251
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1158 times.
2316 flag(pps_deblocking_filter_override_enabled_flag);
2252
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1158 times.
2316 flag(pps_deblocking_filter_disabled_flag);
2253
2/2
✓ Branch 0 taken 381 times.
✓ Branch 1 taken 777 times.
2316 if (!current->pps_no_pic_partition_flag &&
2254
2/2
✓ Branch 0 taken 186 times.
✓ Branch 1 taken 195 times.
762 current->pps_deblocking_filter_override_enabled_flag)
2255
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 186 times.
372 flag(pps_dbf_info_in_ph_flag);
2256 else
2257
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1944 infer(pps_dbf_info_in_ph_flag, 0);
2258
2/2
✓ Branch 0 taken 381 times.
✓ Branch 1 taken 777 times.
2316 if (!current->pps_deblocking_filter_disabled_flag) {
2259
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 381 times.
762 se(pps_luma_beta_offset_div2, -12, 12);
2260
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 381 times.
762 se(pps_luma_tc_offset_div2, -12, 12);
2261
2/2
✓ Branch 0 taken 362 times.
✓ Branch 1 taken 19 times.
762 if (current->pps_chroma_tool_offsets_present_flag) {
2262
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 362 times.
724 se(pps_cb_beta_offset_div2, -12, 12);
2263
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 362 times.
724 se(pps_cb_tc_offset_div2, -12, 12);
2264
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 362 times.
724 se(pps_cr_beta_offset_div2, -12, 12);
2265
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 362 times.
724 se(pps_cr_tc_offset_div2, -12, 12);
2266 } else {
2267
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
38 infer(pps_cb_beta_offset_div2,
2268 current->pps_luma_beta_offset_div2);
2269
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
38 infer(pps_cb_tc_offset_div2, current->pps_luma_tc_offset_div2);
2270
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
38 infer(pps_cr_beta_offset_div2,
2271 current->pps_luma_beta_offset_div2);
2272
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
38 infer(pps_cr_tc_offset_div2, current->pps_luma_tc_offset_div2);
2273 }
2274 } else {
2275
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1554 infer(pps_luma_beta_offset_div2, 0);
2276
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1554 infer(pps_luma_tc_offset_div2, 0);
2277
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1554 infer(pps_cb_beta_offset_div2, 0);
2278
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1554 infer(pps_cb_tc_offset_div2, 0);
2279
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1554 infer(pps_cr_beta_offset_div2, 0);
2280
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 257 times.
1554 infer(pps_cr_tc_offset_div2, 0);
2281 }
2282 } else {
2283
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_deblocking_filter_override_enabled_flag, 0);
2284
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_deblocking_filter_disabled_flag, 0);
2285
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_dbf_info_in_ph_flag, 0);
2286
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_luma_beta_offset_div2, 0);
2287
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_luma_tc_offset_div2, 0);
2288
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_cb_beta_offset_div2, 0);
2289
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_cb_tc_offset_div2, 0);
2290
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_cr_beta_offset_div2, 0);
2291
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
1552 infer(pps_cr_tc_offset_div2, 0);
2292 }
2293
2294
2/2
✓ Branch 0 taken 445 times.
✓ Branch 1 taken 1489 times.
3868 if (!current->pps_no_pic_partition_flag) {
2295
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
890 flag(pps_rpl_info_in_ph_flag);
2296
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
890 flag(pps_sao_info_in_ph_flag);
2297
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
890 flag(pps_alf_info_in_ph_flag);
2298
2/2
✓ Branch 0 taken 87 times.
✓ Branch 1 taken 358 times.
890 if ((current->pps_weighted_pred_flag ||
2299
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 87 times.
174 current->pps_weighted_bipred_flag) &&
2300
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 346 times.
716 current->pps_rpl_info_in_ph_flag)
2301
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
24 flag(pps_wp_info_in_ph_flag);
2302
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 445 times.
890 flag(pps_qp_delta_info_in_ph_flag);
2303 }
2304
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_picture_header_extension_present_flag);
2305
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_slice_header_extension_present_flag);
2306
2307
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 flag(pps_extension_flag);
2308
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1934 times.
3868 if (current->pps_extension_flag)
2309 ✗ CHECK(FUNC(extension_data) (ctx, rw, &current->extension_data));
2310
2311
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1934 times.
3868 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
2312 3868 return 0;
2313 }
2314
2315 1380 static int FUNC(alf_data)(CodedBitstreamContext *ctx, RWContext *rw,
2316 H266RawAPS *current)
2317 {
2318 int err, j, k;
2319
2320
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 690 times.
1380 flag(alf_luma_filter_signal_flag);
2321
2322
2/2
✓ Branch 0 taken 670 times.
✓ Branch 1 taken 20 times.
1380 if (current->aps_chroma_present_flag) {
2323
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 670 times.
1340 flag(alf_chroma_filter_signal_flag);
2324
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 670 times.
1340 flag(alf_cc_cb_filter_signal_flag);
2325
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 670 times.
1340 flag(alf_cc_cr_filter_signal_flag);
2326 } else {
2327
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
40 infer(alf_chroma_filter_signal_flag, 0);
2328
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
40 infer(alf_cc_cb_filter_signal_flag, 0);
2329
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
40 infer(alf_cc_cr_filter_signal_flag, 0);
2330 }
2331
2332
2/2
✓ Branch 0 taken 545 times.
✓ Branch 1 taken 145 times.
1380 if (current->alf_luma_filter_signal_flag) {
2333
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 545 times.
1090 flag(alf_luma_clip_flag);
2334
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 545 times.
1090 ue(alf_luma_num_filters_signalled_minus1, 0, VVC_NUM_ALF_FILTERS - 1);
2335
2/2
✓ Branch 0 taken 372 times.
✓ Branch 1 taken 173 times.
1090 if (current->alf_luma_num_filters_signalled_minus1 > 0) {
2336 744 unsigned int bits = av_ceil_log2(current->alf_luma_num_filters_signalled_minus1 + 1);
2337
2/2
✓ Branch 0 taken 9300 times.
✓ Branch 1 taken 372 times.
19344 for (int filt_idx = 0; filt_idx < VVC_NUM_ALF_FILTERS; filt_idx++)
2338
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9300 times.
18600 us(bits, alf_luma_coeff_delta_idx[filt_idx],
2339 0, current->alf_luma_num_filters_signalled_minus1,
2340 1, filt_idx);
2341 }
2342
2/2
✓ Branch 0 taken 3195 times.
✓ Branch 1 taken 545 times.
7480 for (int sf_idx = 0; sf_idx <= current->alf_luma_num_filters_signalled_minus1; sf_idx++)
2343
2/2
✓ Branch 0 taken 38340 times.
✓ Branch 1 taken 3195 times.
83070 for (j = 0; j < 12; j++) {
2344
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38340 times.
76680 ues(alf_luma_coeff_abs[sf_idx][j], 0, 128, 2, sf_idx, j);
2345
2/2
✓ Branch 0 taken 37019 times.
✓ Branch 1 taken 1321 times.
76680 if (current->alf_luma_coeff_abs[sf_idx][j])
2346
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 37019 times.
74038 ubs(1, alf_luma_coeff_sign[sf_idx][j], 2, sf_idx, j);
2347 else
2348
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 325 times.
2642 infer(alf_luma_coeff_sign[sf_idx][j], 0);
2349 }
2350 } else {
2351
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
290 infer(alf_luma_clip_flag, 0);
2352
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
290 infer(alf_luma_num_filters_signalled_minus1, 0);
2353 }
2354
2/2
✓ Branch 0 taken 3340 times.
✓ Branch 1 taken 690 times.
8060 for (int sf_idx = 0; sf_idx <= current->alf_luma_num_filters_signalled_minus1; sf_idx++) {
2355
2/2
✓ Branch 0 taken 40080 times.
✓ Branch 1 taken 3340 times.
86840 for (j = 0; j < 12; j++) {
2356
2/2
✓ Branch 0 taken 27144 times.
✓ Branch 1 taken 12936 times.
80160 if (current->alf_luma_clip_flag)
2357
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 27144 times.
54288 ubs(2, alf_luma_clip_idx[sf_idx][j], 2, sf_idx, j);
2358 else
2359
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1152 times.
25872 infer(alf_luma_clip_idx[sf_idx][j], 0);
2360 }
2361 }
2362
2363
2/2
✓ Branch 0 taken 442 times.
✓ Branch 1 taken 248 times.
1380 if (current->alf_chroma_filter_signal_flag) {
2364
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 442 times.
884 flag(alf_chroma_clip_flag);
2365
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 442 times.
884 ue(alf_chroma_num_alt_filters_minus1, 0, 7);
2366 } else {
2367
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 79 times.
496 infer(alf_chroma_clip_flag, 0);
2368
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 79 times.
496 infer(alf_chroma_num_alt_filters_minus1, 0);
2369 }
2370
2/2
✓ Branch 0 taken 1532 times.
✓ Branch 1 taken 690 times.
4444 for (int alt_idx = 0; alt_idx <= current->alf_chroma_num_alt_filters_minus1; alt_idx++) {
2371
2/2
✓ Branch 0 taken 9192 times.
✓ Branch 1 taken 1532 times.
21448 for (j = 0; j < 6; j++) {
2372
2/2
✓ Branch 0 taken 7704 times.
✓ Branch 1 taken 1488 times.
18384 if (current->alf_chroma_filter_signal_flag)
2373
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7704 times.
15408 ues(alf_chroma_coeff_abs[alt_idx][j], 0, 128, 2, alt_idx, j);
2374 else
2375
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 474 times.
2976 infer(alf_chroma_coeff_abs[alt_idx][j], 0);
2376
2/2
✓ Branch 0 taken 7279 times.
✓ Branch 1 taken 1913 times.
18384 if (current->alf_chroma_coeff_abs[alt_idx][j] > 0)
2377
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7279 times.
14558 ubs(1, alf_chroma_coeff_sign[alt_idx][j], 2, alt_idx, j);
2378 else
2379
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 583 times.
3826 infer(alf_chroma_coeff_sign[alt_idx][j], 0);
2380 }
2381
2/2
✓ Branch 0 taken 9192 times.
✓ Branch 1 taken 1532 times.
21448 for (j = 0; j < 6; j++) {
2382
2/2
✓ Branch 0 taken 6222 times.
✓ Branch 1 taken 2970 times.
18384 if (current->alf_chroma_clip_flag)
2383
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6222 times.
12444 ubs(2, alf_chroma_clip_idx[alt_idx][j], 2, alt_idx, j);
2384 else
2385
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
5940 infer(alf_chroma_clip_idx[alt_idx][j], 0);
2386 }
2387 }
2388
2389
2/2
✓ Branch 0 taken 241 times.
✓ Branch 1 taken 449 times.
1380 if (current->alf_cc_cb_filter_signal_flag)
2390
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 241 times.
482 ue(alf_cc_cb_filters_signalled_minus1, 0, 3);
2391 else
2392
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
898 infer(alf_cc_cb_filters_signalled_minus1, 0);
2393
2/2
✓ Branch 0 taken 1234 times.
✓ Branch 1 taken 690 times.
3848 for (k = 0; k <= current->alf_cc_cb_filters_signalled_minus1; k++) {
2394
2/2
✓ Branch 0 taken 8638 times.
✓ Branch 1 taken 1234 times.
19744 for (j = 0; j < 7; j++) {
2395
2/2
✓ Branch 0 taken 5495 times.
✓ Branch 1 taken 3143 times.
17276 if (current->alf_cc_cb_filter_signal_flag)
2396
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5495 times.
10990 ubs(3, alf_cc_cb_mapped_coeff_abs[k][j], 2, k, j);
2397 else
2398
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 924 times.
6286 infer(alf_cc_cb_mapped_coeff_abs[k][j], 0);
2399
2/2
✓ Branch 0 taken 4626 times.
✓ Branch 1 taken 4012 times.
17276 if (current->alf_cc_cb_mapped_coeff_abs[k][j])
2400
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4626 times.
9252 ubs(1, alf_cc_cb_coeff_sign[k][j], 2, k, j);
2401 else
2402
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1123 times.
8024 infer(alf_cc_cb_coeff_sign[k][j], 0);
2403 }
2404 }
2405
2406
2/2
✓ Branch 0 taken 213 times.
✓ Branch 1 taken 477 times.
1380 if (current->alf_cc_cr_filter_signal_flag)
2407
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 213 times.
426 ue(alf_cc_cr_filters_signalled_minus1, 0, 3);
2408 else
2409
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 141 times.
954 infer(alf_cc_cr_filters_signalled_minus1, 0);
2410
2/2
✓ Branch 0 taken 1164 times.
✓ Branch 1 taken 690 times.
3708 for (k = 0; k < current->alf_cc_cr_filters_signalled_minus1 + 1; k++) {
2411
2/2
✓ Branch 0 taken 8148 times.
✓ Branch 1 taken 1164 times.
18624 for (j = 0; j < 7; j++) {
2412
2/2
✓ Branch 0 taken 4809 times.
✓ Branch 1 taken 3339 times.
16296 if (current->alf_cc_cr_filter_signal_flag)
2413
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4809 times.
9618 ubs(3, alf_cc_cr_mapped_coeff_abs[k][j], 2, k, j);
2414 else
2415
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 987 times.
6678 infer(alf_cc_cr_mapped_coeff_abs[k][j], 0);
2416
2/2
✓ Branch 0 taken 4198 times.
✓ Branch 1 taken 3950 times.
16296 if (current->alf_cc_cr_mapped_coeff_abs[k][j])
2417
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4198 times.
8396 ubs(1, alf_cc_cr_coeff_sign[k][j], 2, k, j);
2418 else
2419
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1121 times.
7900 infer(alf_cc_cr_coeff_sign[k][j], 0);
2420 }
2421 }
2422
2423 1380 return 0;
2424 }
2425
2426 322 static int FUNC(lmcs_data)(CodedBitstreamContext *ctx, RWContext *rw,
2427 H266RawAPS *current)
2428 {
2429 int err, i, lmcs_max_bin_idx;
2430
2431
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 161 times.
322 ue(lmcs_min_bin_idx, 0, 15);
2432
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 161 times.
322 ue(lmcs_delta_max_bin_idx, 0, 15);
2433
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 161 times.
322 ue(lmcs_delta_cw_prec_minus1, 0, 14);
2434
2435 322 lmcs_max_bin_idx = 15 - current->lmcs_delta_max_bin_idx;
2436
2437
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 161 times.
322 if (lmcs_max_bin_idx < current->lmcs_min_bin_idx)
2438 ✗ return AVERROR_INVALIDDATA;
2439
2440
2/2
✓ Branch 0 taken 2239 times.
✓ Branch 1 taken 161 times.
4800 for (i = current->lmcs_min_bin_idx; i <= lmcs_max_bin_idx; i++) {
2441
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2239 times.
4478 ubs(current->lmcs_delta_cw_prec_minus1 + 1, lmcs_delta_abs_cw[i], 1, i);
2442
2/2
✓ Branch 0 taken 2067 times.
✓ Branch 1 taken 172 times.
4478 if (current->lmcs_delta_abs_cw[i] > 0)
2443
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2067 times.
4134 flags(lmcs_delta_sign_cw_flag[i], 1, i);
2444 else
2445
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 33 times.
344 infer(lmcs_delta_sign_cw_flag[i], 0);
2446 }
2447
2448
1/2
✓ Branch 0 taken 161 times.
✗ Branch 1 not taken.
322 if (current->aps_chroma_present_flag) {
2449
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 161 times.
322 ub(3, lmcs_delta_abs_crs);
2450
2/2
✓ Branch 0 taken 159 times.
✓ Branch 1 taken 2 times.
322 if (current->lmcs_delta_abs_crs > 0)
2451
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 159 times.
318 flag(lmcs_delta_sign_crs_flag);
2452 else
2453
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
4 infer(lmcs_delta_sign_crs_flag, 0);
2454 } else {
2455 ✗ infer(lmcs_delta_abs_crs, 0);
2456 ✗ infer(lmcs_delta_sign_crs_flag, 0);
2457 }
2458
2459 322 return 0;
2460 }
2461
2462 72 static int FUNC(scaling_list_data)(CodedBitstreamContext *ctx, RWContext *rw,
2463 H266RawAPS *current)
2464 {
2465 // 7.4.3.4, deriving DiagScanOrder
2466 static const uint8_t diag_scan_order[64][2] = {
2467 { 0, 0, }, { 0, 1, }, { 1, 0, }, { 0, 2, }, { 1, 1, }, { 2, 0, }, { 0, 3, }, { 1, 2, },
2468 { 2, 1, }, { 3, 0, }, { 0, 4, }, { 1, 3, }, { 2, 2, }, { 3, 1, }, { 4, 0, }, { 0, 5, },
2469 { 1, 4, }, { 2, 3, }, { 3, 2, }, { 4, 1, }, { 5, 0, }, { 0, 6, }, { 1, 5, }, { 2, 4, },
2470 { 3, 3, }, { 4, 2, }, { 5, 1, }, { 6, 0, }, { 0, 7, }, { 1, 6, }, { 2, 5, }, { 3, 4, },
2471 { 4, 3, }, { 5, 2, }, { 6, 1, }, { 7, 0, }, { 1, 7, }, { 2, 6, }, { 3, 5, }, { 4, 4, },
2472 { 5, 3, }, { 6, 2, }, { 7, 1, }, { 2, 7, }, { 3, 6, }, { 4, 5, }, { 5, 4, }, { 6, 3, },
2473 { 7, 2, }, { 3, 7, }, { 4, 6, }, { 5, 5, }, { 6, 4, }, { 7, 3, }, { 4, 7, }, { 5, 6, },
2474 { 6, 5, }, { 7, 4, }, { 5, 7, }, { 6, 6, }, { 7, 5, }, { 6, 7, }, { 7, 6, }, { 7, 7, }, };
2475 int err;
2476
2477
2/2
✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 36 times.
2088 for (int id = 0; id < 28; id ++) {
2478
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) {
2479
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 540 times.
1080 flags(scaling_list_copy_mode_flag[id], 1, id);
2480
2/2
✓ Branch 0 taken 218 times.
✓ Branch 1 taken 322 times.
1080 if (!current->scaling_list_copy_mode_flag[id])
2481
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 218 times.
436 flags(scaling_list_pred_mode_flag[id], 1, id);
2482 else
2483
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
644 infer(scaling_list_pred_mode_flag[id], 0);
2484
2/2
✓ Branch 0 taken 218 times.
✓ Branch 1 taken 322 times.
1080 if ((current->scaling_list_copy_mode_flag[id] ||
2485
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]) &&
2486
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) {
2487
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));
2488
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);
2489 }
2490
2/2
✓ Branch 0 taken 218 times.
✓ Branch 1 taken 322 times.
1080 if (!current->scaling_list_copy_mode_flag[id]) {
2491
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);
2492
2/2
✓ Branch 0 taken 52 times.
✓ Branch 1 taken 166 times.
436 if (id > 13) {
2493 104 int idx = id - 14;
2494
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 52 times.
104 ses(scaling_list_dc_coef[idx], -128, 127, 1, idx);
2495 }
2496
2/2
✓ Branch 0 taken 9680 times.
✓ Branch 1 taken 218 times.
19796 for (int i = 0; i < matrix_size * matrix_size; i++) {
2497 19360 int x = diag_scan_order[i][0];
2498 19360 int y = diag_scan_order[i][1];
2499
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))
2500
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9520 times.
19040 ses(scaling_list_delta_coef[id][i], -128, 127, 2, id, i);
2501 }
2502
2/2
✓ Branch 0 taken 244 times.
✓ Branch 1 taken 78 times.
644 } else if (id > 13) {
2503 488 int idx = id - 14;
2504
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 68 times.
488 infer(scaling_list_dc_coef[idx], 0);
2505 }
2506 } else {
2507
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
936 infer(scaling_list_copy_mode_flag[id], 1);
2508
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
936 infer(scaling_list_pred_mode_flag[id], 0);
2509 }
2510 }
2511
2512 72 return 0;
2513 }
2514
2515 1774 static int FUNC(aps)(CodedBitstreamContext *ctx, RWContext *rw,
2516 H266RawAPS *current, int prefix)
2517 {
2518 1774 int aps_id_max = MAX_UINT_BITS(5);
2519 int err;
2520
2521
1/2
✓ Branch 0 taken 887 times.
✗ Branch 1 not taken.
1774 if (prefix)
2522 1774 HEADER("Prefix Adaptation parameter set");
2523 else
2524 ✗ HEADER("Suffix Adaptation parameter set");
2525
2526
2/4
✓ Branch 0 taken 887 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 887 times.
1774 CHECK(FUNC(nal_unit_header)(ctx, rw, &current->nal_unit_header,
2527 prefix ? VVC_PREFIX_APS_NUT
2528 : VVC_SUFFIX_APS_NUT));
2529
2530
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 887 times.
1774 ub(3, aps_params_type);
2531
2/2
✓ Branch 0 taken 197 times.
✓ Branch 1 taken 690 times.
1774 if (current->aps_params_type == VVC_ASP_TYPE_ALF ||
2532
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 161 times.
394 current->aps_params_type == VVC_ASP_TYPE_SCALING)
2533 1452 aps_id_max = 7;
2534
1/2
✓ Branch 0 taken 161 times.
✗ Branch 1 not taken.
322 else if (current->aps_params_type == VVC_ASP_TYPE_LMCS)
2535 322 aps_id_max = 3;
2536
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 887 times.
1774 u(5, aps_adaptation_parameter_set_id, 0, aps_id_max);
2537
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 887 times.
1774 flag(aps_chroma_present_flag);
2538
2/2
✓ Branch 0 taken 690 times.
✓ Branch 1 taken 197 times.
1774 if (current->aps_params_type == VVC_ASP_TYPE_ALF)
2539
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 690 times.
1380 CHECK(FUNC(alf_data)(ctx, rw, current));
2540
2/2
✓ Branch 0 taken 161 times.
✓ Branch 1 taken 36 times.
394 else if(current->aps_params_type == VVC_ASP_TYPE_LMCS)
2541
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 161 times.
322 CHECK(FUNC(lmcs_data)(ctx, rw, current));
2542
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 else if (current->aps_params_type == VVC_ASP_TYPE_SCALING)
2543
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 CHECK(FUNC(scaling_list_data)(ctx, rw, current));
2544
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 887 times.
1774 flag(aps_extension_flag);
2545
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 887 times.
1774 if (current->aps_extension_flag)
2546 ✗ CHECK(FUNC(extension_data) (ctx, rw, &current->extension_data));
2547
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 887 times.
1774 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
2548
2549 1774 return 0;
2550 }
2551
2552 558 static int FUNC(aud) (CodedBitstreamContext *ctx, RWContext *rw,
2553 H266RawAUD *current)
2554 {
2555 int err;
2556
2557 558 HEADER("Access Unit Delimiter");
2558
2559
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 279 times.
558 CHECK(FUNC(nal_unit_header) (ctx, rw,
2560 &current->nal_unit_header, VVC_AUD_NUT));
2561
2562
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 279 times.
558 flag(aud_irap_or_gdr_flag);
2563
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 279 times.
558 u(3, aud_pic_type, 0, 2);
2564
2565
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 279 times.
558 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
2566 558 return 0;
2567 }
2568
2569 388 static int FUNC(pred_weight_table) (CodedBitstreamContext *ctx, RWContext *rw,
2570 const H266RawSPS *sps,
2571 const H266RawPPS *pps,
2572 const H266RefPicLists *ref_lists,
2573 uint8_t num_ref_idx_active[2],
2574 H266RawPredWeightTable *current)
2575 {
2576 int err, i, j;
2577
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 194 times.
388 ue(luma_log2_weight_denom, 0, 7);
2578
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 if (sps->sps_chroma_format_idc != 0) {
2579
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 194 times.
388 se(delta_chroma_log2_weight_denom,
2580 -current->luma_log2_weight_denom,
2581 7 - current->luma_log2_weight_denom);
2582 } else {
2583 ✗ infer(delta_chroma_log2_weight_denom, 0);
2584 }
2585
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 194 times.
388 if (pps->pps_wp_info_in_ph_flag) {
2586 ✗ ue(num_l0_weights, 0,
2587 FFMIN(15, ref_lists->rpl_ref_list[0].num_ref_entries));
2588 ✗ infer(num_weights_l0, current->num_l0_weights);
2589 } else {
2590
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
388 infer(num_weights_l0, num_ref_idx_active[0]);
2591 }
2592
2/2
✓ Branch 0 taken 923 times.
✓ Branch 1 taken 194 times.
2234 for (i = 0; i < current->num_weights_l0; i++) {
2593
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 923 times.
1846 flags(luma_weight_l0_flag[i], 1, i);
2594 }
2595
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 if (sps->sps_chroma_format_idc != 0) {
2596
2/2
✓ Branch 0 taken 923 times.
✓ Branch 1 taken 194 times.
2234 for (i = 0; i < current->num_weights_l0; i++)
2597
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 923 times.
1846 flags(chroma_weight_l0_flag[i], 1, i);
2598 }
2599
2/2
✓ Branch 0 taken 923 times.
✓ Branch 1 taken 194 times.
2234 for (i = 0; i < current->num_weights_l0; i++) {
2600
2/2
✓ Branch 0 taken 535 times.
✓ Branch 1 taken 388 times.
1846 if (current->luma_weight_l0_flag[i]) {
2601
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 535 times.
1070 ses(delta_luma_weight_l0[i], -128, 127, 1, i);
2602
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 535 times.
1070 ses(luma_offset_l0[i], -128, 127, 1, i);
2603 } else {
2604
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
776 infer(delta_luma_weight_l0[i], 0);
2605
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
776 infer(luma_offset_l0[i], 0);
2606 }
2607
2/2
✓ Branch 0 taken 481 times.
✓ Branch 1 taken 442 times.
1846 if (current->chroma_weight_l0_flag[i]) {
2608
2/2
✓ Branch 0 taken 962 times.
✓ Branch 1 taken 481 times.
2886 for (j = 0; j < 2; j++) {
2609
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 962 times.
1924 ses(delta_chroma_weight_l0[i][j], -128, 127, 2, i, j);
2610
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);
2611 }
2612 }
2613 }
2614
2615
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 if (pps->pps_weighted_bipred_flag &&
2616
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 ref_lists->rpl_ref_list[1].num_ref_entries > 0) {
2617
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 194 times.
388 if (pps->pps_wp_info_in_ph_flag) {
2618 ✗ ue(num_l1_weights, 0,
2619 FFMIN(15, ref_lists->rpl_ref_list[1].num_ref_entries));
2620 ✗ infer(num_weights_l1, current->num_l1_weights);
2621 } else {
2622
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
388 infer(num_weights_l1, num_ref_idx_active[1]);
2623 }
2624 } else {
2625 ✗ infer(num_weights_l1, 0);
2626 }
2627
2628
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 194 times.
1994 for (i = 0; i < current->num_weights_l1; i++)
2629
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 803 times.
1606 flags(luma_weight_l1_flag[i], 1, i);
2630
1/2
✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
388 if (sps->sps_chroma_format_idc != 0) {
2631
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 194 times.
1994 for (i = 0; i < current->num_weights_l1; i++)
2632
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 803 times.
1606 flags(chroma_weight_l1_flag[i], 1, i);
2633 }
2634
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 194 times.
1994 for (i = 0; i < current->num_weights_l1; i++) {
2635
2/2
✓ Branch 0 taken 391 times.
✓ Branch 1 taken 412 times.
1606 if (current->luma_weight_l1_flag[i]) {
2636
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
782 ses(delta_luma_weight_l1[i], -128, 127, 1, i);
2637
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
782 ses(luma_offset_l1[i], -128, 127, 1, i);
2638 } else {
2639
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
824 infer(delta_luma_weight_l1[i], 0);
2640
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
824 infer(luma_offset_l1[i], 0);
2641 }
2642
2/2
✓ Branch 0 taken 367 times.
✓ Branch 1 taken 436 times.
1606 if (current->chroma_weight_l1_flag[i]) {
2643
2/2
✓ Branch 0 taken 734 times.
✓ Branch 1 taken 367 times.
2202 for (j = 0; j < 2; j++) {
2644
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 734 times.
1468 ses(delta_chroma_weight_l1[i][j], -128, 127, 2, i, j);
2645
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);
2646 }
2647 }
2648 }
2649 388 return 0;
2650 }
2651
2652 17660 static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw,
2653 H266RawPictureHeader *current) {
2654 17660 CodedBitstreamH266Context *h266 = ctx->priv_data;
2655 const H266RawVPS *vps;
2656 const H266RawSPS *sps;
2657 const H266RawPPS *pps;
2658 int err, i;
2659 unsigned int ctb_log2_size_y, min_cb_log2_size_y,
2660 min_qt_log2_size_intra_y, min_qt_log2_size_inter_y;
2661 uint8_t qp_bd_offset;
2662
2663
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8830 times.
17660 flag(ph_gdr_or_irap_pic_flag);
2664
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8830 times.
17660 flag(ph_non_ref_pic_flag);
2665
2/2
✓ Branch 0 taken 1115 times.
✓ Branch 1 taken 7715 times.
17660 if (current->ph_gdr_or_irap_pic_flag)
2666
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1115 times.
2230 flag(ph_gdr_pic_flag);
2667 else
2668
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1822 times.
15430 infer(ph_gdr_pic_flag, 0);
2669
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8830 times.
17660 flag(ph_inter_slice_allowed_flag);
2670
2/2
✓ Branch 0 taken 7720 times.
✓ Branch 1 taken 1110 times.
17660 if (current->ph_inter_slice_allowed_flag)
2671
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7720 times.
15440 flag(ph_intra_slice_allowed_flag);
2672 else
2673
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2220 infer(ph_intra_slice_allowed_flag, 1);
2674
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8830 times.
17660 ue(ph_pic_parameter_set_id, 0, VVC_MAX_PPS_COUNT - 1);
2675 17660 pps = h266->pps[current->ph_pic_parameter_set_id];
2676
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8830 times.
17660 if (!pps) {
2677 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "PPS id %d not available.\n",
2678 ✗ current->ph_pic_parameter_set_id);
2679 ✗ return AVERROR_INVALIDDATA;
2680 }
2681 17660 sps = h266->sps[pps->pps_seq_parameter_set_id];
2682
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8830 times.
17660 if (!sps) {
2683 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n",
2684 ✗ pps->pps_seq_parameter_set_id);
2685 ✗ return AVERROR_INVALIDDATA;
2686 }
2687 17660 vps = h266->vps[sps->sps_video_parameter_set_id];
2688
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8830 times.
17660 if (!vps) {
2689 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "VPS id %d not available.\n",
2690 ✗ sps->sps_video_parameter_set_id);
2691 ✗ return AVERROR_INVALIDDATA;
2692 }
2693
2694
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8830 times.
17660 ub(sps->sps_log2_max_pic_order_cnt_lsb_minus4 + 4, ph_pic_order_cnt_lsb);
2695
2/2
✓ Branch 0 taken 27 times.
✓ Branch 1 taken 8803 times.
17660 if (current->ph_gdr_pic_flag) {
2696 #ifdef READ
2697 // H.266 7.4.3.8: ph_recovery_poc_cnt shall be in [0, MaxPicOrderCntLsb - 1].
2698 // The range check is deferred to decode_recovery_poc().
2699
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
44 ue(ph_recovery_poc_cnt, 0, UINT32_MAX - 1);
2700 #else
2701
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
10 ue(ph_recovery_poc_cnt, 0,
2702 (1 << (sps->sps_log2_max_pic_order_cnt_lsb_minus4 + 4)) - 1);
2703 #endif
2704 }
2705
2706
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8830 times.
17660 for (i = 0; i < sps->sps_num_extra_ph_bytes * 8; i++) {
2707 ✗ if (sps->sps_extra_ph_bit_present_flag[i])
2708 ✗ flags(ph_extra_bit[i], 1, i);
2709 }
2710
2/2
✓ Branch 0 taken 102 times.
✓ Branch 1 taken 8728 times.
17660 if (sps->sps_poc_msb_cycle_flag) {
2711
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
204 flag(ph_poc_msb_cycle_present_flag);
2712
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 102 times.
204 if (current->ph_poc_msb_cycle_present_flag)
2713 ✗ ub(sps->sps_poc_msb_cycle_len_minus1 + 1, ph_poc_msb_cycle_val);
2714 }
2715
4/4
✓ Branch 0 taken 4231 times.
✓ Branch 1 taken 4599 times.
✓ Branch 2 taken 71 times.
✓ Branch 3 taken 4160 times.
17660 if (sps->sps_alf_enabled_flag && pps->pps_alf_info_in_ph_flag) {
2716
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 71 times.
142 flag(ph_alf_enabled_flag);
2717
2/2
✓ Branch 0 taken 49 times.
✓ Branch 1 taken 22 times.
142 if (current->ph_alf_enabled_flag) {
2718
2719
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 ub(3, ph_num_alf_aps_ids_luma);
2720
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++)
2721
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 51 times.
102 ubs(3, ph_alf_aps_id_luma[i], 1, i);
2722
2723
1/2
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
98 if (sps->sps_chroma_format_idc != 0) {
2724
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 flag(ph_alf_cb_enabled_flag);
2725
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 flag(ph_alf_cr_enabled_flag);
2726 } else {
2727 ✗ infer(ph_alf_cb_enabled_flag, 0);
2728 ✗ infer(ph_alf_cr_enabled_flag, 0);
2729 }
2730
2731
2/2
✓ Branch 0 taken 26 times.
✓ Branch 1 taken 23 times.
98 if (current->ph_alf_cb_enabled_flag
2732
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 24 times.
52 || current->ph_alf_cr_enabled_flag) {
2733
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
50 ub(3, ph_alf_aps_id_chroma);
2734 }
2735
2736
1/2
✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
98 if (sps->sps_ccalf_enabled_flag) {
2737
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 flag(ph_alf_cc_cb_enabled_flag);
2738
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 43 times.
98 if (current->ph_alf_cc_cb_enabled_flag)
2739
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
12 ub(3, ph_alf_cc_cb_aps_id);
2740
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 49 times.
98 flag(ph_alf_cc_cr_enabled_flag);
2741
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 45 times.
98 if (current->ph_alf_cc_cr_enabled_flag)
2742
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
8 ub(3, ph_alf_cc_cr_aps_id);
2743 }
2744 }
2745 } else {
2746
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
17518 infer(ph_alf_enabled_flag, 0);
2747 }
2748
2/2
✓ Branch 0 taken 4594 times.
✓ Branch 1 taken 4236 times.
17660 if (sps->sps_lmcs_enabled_flag) {
2749
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4594 times.
9188 flag(ph_lmcs_enabled_flag);
2750
2/2
✓ Branch 0 taken 1781 times.
✓ Branch 1 taken 2813 times.
9188 if (current->ph_lmcs_enabled_flag) {
2751
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1781 times.
3562 ub(2, ph_lmcs_aps_id);
2752
1/2
✓ Branch 0 taken 1781 times.
✗ Branch 1 not taken.
3562 if (sps->sps_chroma_format_idc != 0)
2753
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1781 times.
3562 flag(ph_chroma_residual_scale_flag);
2754 else
2755 ✗ infer(ph_chroma_residual_scale_flag, 0);
2756 }
2757 } else {
2758
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1290 times.
8472 infer(ph_lmcs_enabled_flag, 0);
2759
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1290 times.
8472 infer(ph_chroma_residual_scale_flag, 0);
2760 }
2761
2762
2/2
✓ Branch 0 taken 605 times.
✓ Branch 1 taken 8225 times.
17660 if (sps->sps_explicit_scaling_list_enabled_flag) {
2763
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 605 times.
1210 flag(ph_explicit_scaling_list_enabled_flag);
2764
1/2
✓ Branch 0 taken 605 times.
✗ Branch 1 not taken.
1210 if (current->ph_explicit_scaling_list_enabled_flag) {
2765 //todo: check the ph_scaling_list_aps_id range, when aps ready
2766
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 605 times.
1210 ub(3, ph_scaling_list_aps_id);
2767 }
2768 } else {
2769
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2018 times.
16450 infer(ph_explicit_scaling_list_enabled_flag, 0);
2770 }
2771
2/2
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 8789 times.
17660 if (sps->sps_virtual_boundaries_enabled_flag &&
2772
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
82 !sps->sps_virtual_boundaries_present_flag) {
2773 ✗ flag(ph_virtual_boundaries_present_flag);
2774 ✗ if (current->ph_virtual_boundaries_present_flag) {
2775 ✗ ue(ph_num_ver_virtual_boundaries,
2776 0, pps->pps_pic_width_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS);
2777 ✗ for (i = 0; i < current->ph_num_ver_virtual_boundaries; i++) {
2778 ✗ ues(ph_virtual_boundary_pos_x_minus1[i],
2779 0, (pps->pps_pic_width_in_luma_samples + 7) / 8 - 2, 1, i);
2780 }
2781 ✗ ue(ph_num_hor_virtual_boundaries,
2782 0, pps->pps_pic_height_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS);
2783 ✗ for (i = 0; i < current->ph_num_hor_virtual_boundaries; i++) {
2784 ✗ ues(ph_virtual_boundary_pos_y_minus1[i],
2785 0, (pps->pps_pic_height_in_luma_samples + 7) / 8 - 2, 1, i);
2786 }
2787 } else {
2788 ✗ infer(ph_num_ver_virtual_boundaries, 0);
2789 ✗ infer(ph_num_hor_virtual_boundaries, 0);
2790 }
2791 }
2792
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 8830 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
17660 if (pps->pps_output_flag_present_flag && !current->ph_non_ref_pic_flag)
2793 ✗ flag(ph_pic_output_flag);
2794 else
2795
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
17660 infer(ph_pic_output_flag, 1);
2796
2/2
✓ Branch 0 taken 67 times.
✓ Branch 1 taken 8763 times.
17660 if (pps->pps_rpl_info_in_ph_flag) {
2797
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 67 times.
134 CHECK(FUNC(ref_pic_lists)
2798 (ctx, rw, sps, pps, &current->ph_ref_pic_lists));
2799 }
2800
2/2
✓ Branch 0 taken 8555 times.
✓ Branch 1 taken 275 times.
17660 if (sps->sps_partition_constraints_override_enabled_flag)
2801
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8555 times.
17110 flag(ph_partition_constraints_override_flag);
2802 else
2803
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
550 infer(ph_partition_constraints_override_flag, 0);
2804
2805 17660 ctb_log2_size_y = sps->sps_log2_ctu_size_minus5 + 5;
2806 17660 min_cb_log2_size_y = sps->sps_log2_min_luma_coding_block_size_minus2 + 2;
2807
2/2
✓ Branch 0 taken 1148 times.
✓ Branch 1 taken 7682 times.
17660 if (current->ph_intra_slice_allowed_flag) {
2808
2/2
✓ Branch 0 taken 39 times.
✓ Branch 1 taken 1109 times.
2296 if (current->ph_partition_constraints_override_flag) {
2809
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_min_qt_min_cb_intra_slice_luma,
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_luma,
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 (current->ph_max_mtt_hierarchy_depth_intra_slice_luma != 0) {
2814 78 min_qt_log2_size_intra_y =
2815 78 current->ph_log2_diff_min_qt_min_cb_intra_slice_luma +
2816 min_cb_log2_size_y;
2817
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,
2818 0, (sps->sps_qtbtt_dual_tree_intra_flag ?
2819 FFMIN(6, ctb_log2_size_y) :
2820 ctb_log2_size_y) - min_qt_log2_size_intra_y);
2821
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_max_tt_min_qt_intra_slice_luma,
2822 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_y);
2823 } else {
2824 ✗ infer(ph_log2_diff_max_bt_min_qt_intra_slice_luma,
2825 sps->sps_log2_diff_max_bt_min_qt_intra_slice_luma);
2826 ✗ infer(ph_log2_diff_max_tt_min_qt_intra_slice_luma,
2827 sps->sps_log2_diff_max_tt_min_qt_intra_slice_luma);
2828 }
2829
1/2
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
78 if (sps->sps_qtbtt_dual_tree_intra_flag) {
2830
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_min_qt_min_cb_intra_slice_chroma,
2831 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
2832
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_max_mtt_hierarchy_depth_intra_slice_chroma,
2833 0, 2 * (ctb_log2_size_y - min_cb_log2_size_y));
2834
1/2
✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
78 if (current->ph_max_mtt_hierarchy_depth_intra_slice_chroma != 0) {
2835 78 unsigned int min_qt_log2_size_intra_c =
2836 78 current->ph_log2_diff_min_qt_min_cb_intra_slice_chroma +
2837 min_cb_log2_size_y;
2838
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_max_bt_min_qt_intra_slice_chroma,
2839 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_c);
2840
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 39 times.
78 ue(ph_log2_diff_max_tt_min_qt_intra_slice_chroma,
2841 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_intra_c);
2842 } else {
2843 ✗ infer(ph_log2_diff_max_bt_min_qt_intra_slice_chroma,
2844 sps->sps_log2_diff_max_bt_min_qt_intra_slice_chroma);
2845 ✗ infer(ph_log2_diff_max_tt_min_qt_intra_slice_chroma,
2846 sps->sps_log2_diff_max_tt_min_qt_intra_slice_chroma);
2847 }
2848 }
2849 } else {
2850
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2218 infer(ph_log2_diff_min_qt_min_cb_intra_slice_luma,
2851 sps->sps_log2_diff_min_qt_min_cb_intra_slice_luma);
2852
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2218 infer(ph_max_mtt_hierarchy_depth_intra_slice_luma,
2853 sps->sps_max_mtt_hierarchy_depth_intra_slice_luma);
2854
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2218 infer(ph_log2_diff_max_bt_min_qt_intra_slice_luma,
2855 sps->sps_log2_diff_max_bt_min_qt_intra_slice_luma);
2856
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2218 infer(ph_log2_diff_max_tt_min_qt_intra_slice_luma,
2857 sps->sps_log2_diff_max_tt_min_qt_intra_slice_luma);
2858
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2218 infer(ph_log2_diff_min_qt_min_cb_intra_slice_chroma,
2859 sps->sps_log2_diff_min_qt_min_cb_intra_slice_chroma);
2860
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2218 infer(ph_max_mtt_hierarchy_depth_intra_slice_chroma,
2861 sps->sps_max_mtt_hierarchy_depth_intra_slice_chroma);
2862
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2218 infer(ph_log2_diff_max_bt_min_qt_intra_slice_chroma,
2863 sps->sps_log2_diff_max_bt_min_qt_intra_slice_chroma);
2864
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2218 infer(ph_log2_diff_max_tt_min_qt_intra_slice_chroma,
2865 sps->sps_log2_diff_max_tt_min_qt_intra_slice_chroma);
2866 }
2867
2868 2296 min_qt_log2_size_intra_y =
2869 2296 current->ph_log2_diff_min_qt_min_cb_intra_slice_luma +
2870 min_cb_log2_size_y;
2871
2/2
✓ Branch 0 taken 71 times.
✓ Branch 1 taken 1077 times.
2296 if (pps->pps_cu_qp_delta_enabled_flag)
2872
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 71 times.
142 ue(ph_cu_qp_delta_subdiv_intra_slice, 0,
2873 2 * (ctb_log2_size_y - min_qt_log2_size_intra_y +
2874 current->ph_max_mtt_hierarchy_depth_intra_slice_luma));
2875 else
2876
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 301 times.
2154 infer(ph_cu_qp_delta_subdiv_intra_slice, 0);
2877
2878
2/2
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 1107 times.
2296 if (pps->pps_cu_chroma_qp_offset_list_enabled_flag)
2879
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
82 ue(ph_cu_chroma_qp_offset_subdiv_intra_slice, 0,
2880 2 * (ctb_log2_size_y - min_qt_log2_size_intra_y +
2881 current->ph_max_mtt_hierarchy_depth_intra_slice_luma));
2882 else
2883
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 303 times.
2214 infer(ph_cu_chroma_qp_offset_subdiv_intra_slice, 0);
2884 }
2885
2/2
✓ Branch 0 taken 7720 times.
✓ Branch 1 taken 1110 times.
17660 if (current->ph_inter_slice_allowed_flag) {
2886
2/2
✓ Branch 0 taken 1884 times.
✓ Branch 1 taken 5836 times.
15440 if (current->ph_partition_constraints_override_flag) {
2887
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1884 times.
3768 ue(ph_log2_diff_min_qt_min_cb_inter_slice,
2888 0, FFMIN(6, ctb_log2_size_y) - min_cb_log2_size_y);
2889 3768 min_qt_log2_size_inter_y =
2890 3768 current->ph_log2_diff_min_qt_min_cb_inter_slice +
2891 min_cb_log2_size_y;
2892
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1884 times.
3768 ue(ph_max_mtt_hierarchy_depth_inter_slice, 0,
2893 2 * (ctb_log2_size_y - min_cb_log2_size_y));
2894
1/2
✓ Branch 0 taken 1884 times.
✗ Branch 1 not taken.
3768 if (current->ph_max_mtt_hierarchy_depth_inter_slice != 0) {
2895
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1884 times.
3768 ue(ph_log2_diff_max_bt_min_qt_inter_slice,
2896 0, ctb_log2_size_y - min_qt_log2_size_inter_y);
2897
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1884 times.
3768 ue(ph_log2_diff_max_tt_min_qt_inter_slice,
2898 0, FFMIN(6, ctb_log2_size_y) - min_qt_log2_size_inter_y);
2899 }
2900 } else {
2901
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1472 times.
11672 infer(ph_log2_diff_min_qt_min_cb_inter_slice,
2902 sps->sps_log2_diff_min_qt_min_cb_inter_slice);
2903 11672 min_qt_log2_size_inter_y =
2904 11672 current->ph_log2_diff_min_qt_min_cb_inter_slice +
2905 min_cb_log2_size_y;
2906
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1472 times.
11672 infer(ph_max_mtt_hierarchy_depth_inter_slice,
2907 sps->sps_max_mtt_hierarchy_depth_inter_slice);
2908
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1472 times.
11672 infer(ph_log2_diff_max_bt_min_qt_inter_slice,
2909 sps->sps_log2_diff_max_bt_min_qt_inter_slice);
2910
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1472 times.
11672 infer(ph_log2_diff_max_tt_min_qt_inter_slice,
2911 sps->sps_log2_diff_max_tt_min_qt_inter_slice);
2912 }
2913
2914
2/2
✓ Branch 0 taken 585 times.
✓ Branch 1 taken 7135 times.
15440 if (pps->pps_cu_qp_delta_enabled_flag)
2915
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 585 times.
1170 ue(ph_cu_qp_delta_subdiv_inter_slice, 0,
2916 2 * (ctb_log2_size_y - min_qt_log2_size_inter_y +
2917 current->ph_max_mtt_hierarchy_depth_inter_slice));
2918 else
2919
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1769 times.
14270 infer(ph_cu_qp_delta_subdiv_inter_slice, 0);
2920
2921
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 7682 times.
15440 if (pps->pps_cu_chroma_qp_offset_list_enabled_flag)
2922
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
76 ue(ph_cu_chroma_qp_offset_subdiv_inter_slice, 0,
2923 2 * (ctb_log2_size_y - min_qt_log2_size_inter_y +
2924 current->ph_max_mtt_hierarchy_depth_inter_slice));
2925 else
2926
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1827 times.
15364 infer(ph_cu_chroma_qp_offset_subdiv_inter_slice, 0);
2927
1/2
✓ Branch 0 taken 7720 times.
✗ Branch 1 not taken.
15440 if (sps->sps_temporal_mvp_enabled_flag) {
2928
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7720 times.
15440 flag(ph_temporal_mvp_enabled_flag);
2929
2/2
✓ Branch 0 taken 7627 times.
✓ Branch 1 taken 93 times.
15440 if (current->ph_temporal_mvp_enabled_flag &&
2930
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 7563 times.
15254 pps->pps_rpl_info_in_ph_flag) {
2931
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)
2932
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 64 times.
128 flag(ph_collocated_from_l0_flag);
2933 else
2934 ✗ infer(ph_collocated_from_l0_flag, 1);
2935
2/2
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 42 times.
128 if ((current->ph_collocated_from_l0_flag &&
2936
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)
2937
1/2
✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
84 || (!current->ph_collocated_from_l0_flag &&
2938
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)) {
2939 124 unsigned int idx =
2940 124 current->ph_collocated_from_l0_flag ? 0 : 1;
2941
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 62 times.
124 ue(ph_collocated_ref_idx, 0,
2942 current->ph_ref_pic_lists.rpl_ref_list[idx].
2943 num_ref_entries - 1);
2944 } else {
2945
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
4 infer(ph_collocated_ref_idx, 0);
2946 }
2947 }
2948 }
2949
2/2
✓ Branch 0 taken 4331 times.
✓ Branch 1 taken 3389 times.
15440 if (sps->sps_mmvd_fullpel_only_enabled_flag)
2950
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4331 times.
8662 flag(ph_mmvd_fullpel_only_flag);
2951 else
2952
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1024 times.
6778 infer(ph_mmvd_fullpel_only_flag, 0);
2953
2/2
✓ Branch 0 taken 64 times.
✓ Branch 1 taken 7656 times.
15440 if (!pps->pps_rpl_info_in_ph_flag ||
2954
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) {
2955
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7720 times.
15440 flag(ph_mvd_l1_zero_flag);
2956
2/2
✓ Branch 0 taken 3949 times.
✓ Branch 1 taken 3771 times.
15440 if (sps->sps_bdof_control_present_in_ph_flag) {
2957
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3949 times.
7898 flag(ph_bdof_disabled_flag);
2958 } else {
2959
1/2
✓ Branch 0 taken 3771 times.
✗ Branch 1 not taken.
7542 if (!sps->sps_bdof_control_present_in_ph_flag)
2960
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1096 times.
7542 infer(ph_bdof_disabled_flag,
2961 1 - sps->sps_bdof_enabled_flag);
2962 else
2963 ✗ infer(ph_bdof_disabled_flag, 1);
2964 }
2965
2/2
✓ Branch 0 taken 3719 times.
✓ Branch 1 taken 4001 times.
15440 if (sps->sps_dmvr_control_present_in_ph_flag) {
2966
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3719 times.
7438 flag(ph_dmvr_disabled_flag);
2967 } else {
2968
1/2
✓ Branch 0 taken 4001 times.
✗ Branch 1 not taken.
8002 if (!sps->sps_dmvr_control_present_in_ph_flag)
2969
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1142 times.
8002 infer(ph_dmvr_disabled_flag,
2970 1 - sps->sps_dmvr_enabled_flag);
2971 else
2972 ✗ infer(ph_dmvr_disabled_flag, 1);
2973 }
2974 } else {
2975 ✗ infer(ph_mvd_l1_zero_flag, 1);
2976 }
2977
2/2
✓ Branch 0 taken 4331 times.
✓ Branch 1 taken 3389 times.
15440 if (sps->sps_prof_control_present_in_ph_flag)
2978
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4331 times.
8662 flag(ph_prof_disabled_flag);
2979 else
2980
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1024 times.
6778 infer(ph_prof_disabled_flag, !sps->sps_affine_prof_enabled_flag);
2981
2/2
✓ Branch 0 taken 7602 times.
✓ Branch 1 taken 118 times.
15440 if ((pps->pps_weighted_pred_flag ||
2982
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 7602 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 118 times.
15440 pps->pps_weighted_bipred_flag) && pps->pps_wp_info_in_ph_flag) {
2983
2984 // if pps->pps_wp_info_in_ph_fla == 1
2985 // pred_weight_table will not use num_ref_idx_active
2986 ✗ uint8_t num_ref_idx_active[2] = { 0, 0 };
2987 ✗ CHECK(FUNC(pred_weight_table)
2988 (ctx, rw, sps, pps, &current->ph_ref_pic_lists,
2989 num_ref_idx_active, &current->ph_pred_weight_table));
2990 }
2991 }
2992
2993 17660 qp_bd_offset = 6 * sps->sps_bitdepth_minus8;
2994
2/2
✓ Branch 0 taken 69 times.
✓ Branch 1 taken 8761 times.
17660 if (pps->pps_qp_delta_info_in_ph_flag)
2995
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),
2996 63 - (26 + pps->pps_init_qp_minus26));
2997
2998
2/2
✓ Branch 0 taken 4326 times.
✓ Branch 1 taken 4504 times.
17660 if (sps->sps_joint_cbcr_enabled_flag)
2999
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4326 times.
8652 flag(ph_joint_cbcr_sign_flag);
3000 else
3001
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1344 times.
9008 infer(ph_joint_cbcr_sign_flag, 0);
3002
4/4
✓ Branch 0 taken 4697 times.
✓ Branch 1 taken 4133 times.
✓ Branch 2 taken 73 times.
✓ Branch 3 taken 4624 times.
17660 if (sps->sps_sao_enabled_flag && pps->pps_sao_info_in_ph_flag) {
3003
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
146 flag(ph_sao_luma_enabled_flag);
3004
1/2
✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
146 if (sps->sps_chroma_format_idc != 0)
3005
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 73 times.
146 flag(ph_sao_chroma_enabled_flag);
3006 else
3007 ✗ infer(ph_sao_chroma_enabled_flag, 0);
3008 } else {
3009
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
17514 infer(ph_sao_luma_enabled_flag, 0);
3010
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
17514 infer(ph_sao_chroma_enabled_flag, 0);
3011 }
3012
3013
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 8817 times.
17660 if (pps->pps_dbf_info_in_ph_flag)
3014
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 flag(ph_deblocking_params_present_flag);
3015 else
3016
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
17634 infer(ph_deblocking_params_present_flag, 0);
3017
3018
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 8817 times.
17660 if (current->ph_deblocking_params_present_flag) {
3019
1/2
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
26 if (!pps->pps_deblocking_filter_disabled_flag) {
3020
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 flag(ph_deblocking_filter_disabled_flag);
3021
1/2
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
26 if (!current->ph_deblocking_filter_disabled_flag) {
3022
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_luma_beta_offset_div2, -12, 12);
3023
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_luma_tc_offset_div2, -12, 12);
3024
1/2
✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
26 if (pps->pps_chroma_tool_offsets_present_flag) {
3025
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_cb_beta_offset_div2, -12, 12);
3026
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_cb_tc_offset_div2, -12, 12);
3027
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_cr_beta_offset_div2, -12, 12);
3028
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 13 times.
26 se(ph_cr_tc_offset_div2, -12, 12);
3029 } else {
3030 ✗ infer(ph_cb_beta_offset_div2,
3031 current->ph_luma_beta_offset_div2);
3032 ✗ infer(ph_cb_tc_offset_div2,
3033 current->ph_luma_tc_offset_div2);
3034 ✗ infer(ph_cr_beta_offset_div2,
3035 current->ph_luma_beta_offset_div2);
3036 ✗ infer(ph_cr_tc_offset_div2,
3037 current->ph_luma_tc_offset_div2);
3038 }
3039 }
3040 } else {
3041 ✗ infer(ph_deblocking_filter_disabled_flag, 0);
3042 }
3043 } else {
3044
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2130 times.
17634 infer(ph_deblocking_filter_disabled_flag, pps->pps_deblocking_filter_disabled_flag);
3045
2/2
✓ Branch 0 taken 4971 times.
✓ Branch 1 taken 3846 times.
17634 if (!current->ph_deblocking_filter_disabled_flag) {
3046
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
9942 infer(ph_luma_beta_offset_div2, pps->pps_luma_beta_offset_div2);
3047
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
9942 infer(ph_luma_tc_offset_div2, pps->pps_luma_tc_offset_div2);
3048
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
9942 infer(ph_cb_beta_offset_div2, pps->pps_cb_beta_offset_div2);
3049
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
9942 infer(ph_cb_tc_offset_div2, pps->pps_cb_tc_offset_div2);
3050
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
9942 infer(ph_cr_beta_offset_div2, pps->pps_cr_beta_offset_div2);
3051
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 850 times.
9942 infer(ph_cr_tc_offset_div2, pps->pps_cr_tc_offset_div2);
3052 }
3053 }
3054
3055
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8830 times.
17660 if (pps->pps_picture_header_extension_present_flag) {
3056 ✗ ue(ph_extension_length, 0, 256);
3057 ✗ for (i = 0; i < current->ph_extension_length; i++)
3058 ✗ us(8, ph_extension_data_byte[i], 0x00, 0xff, 1, i);
3059 }
3060
3061 17660 return 0;
3062 }
3063
3064 490 static int FUNC(ph) (CodedBitstreamContext *ctx, RWContext *rw,
3065 H266RawPH *current)
3066 {
3067 int err;
3068
3069 490 HEADER("Picture Header");
3070
3071
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));
3072
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
490 CHECK(FUNC(picture_header) (ctx, rw, &current->ph_picture_header));
3073
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
490 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
3074 490 return 0;
3075 }
3076
3077 23382 static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw,
3078 H266RawSliceHeader *current)
3079 {
3080 23382 CodedBitstreamH266Context *h266 = ctx->priv_data;
3081 const H266RawSPS *sps;
3082 const H266RawPPS *pps;
3083 const H266RawPictureHeader *ph;
3084 const H266RefPicLists *ref_pic_lists;
3085 int err, i;
3086 uint8_t nal_unit_type, qp_bd_offset;
3087 uint16_t num_slices_in_subpic;
3088
3089 23382 HEADER("Slice Header");
3090
3091
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11691 times.
23382 CHECK(FUNC(nal_unit_header) (ctx, rw, &current->nal_unit_header, -1));
3092
3093
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11691 times.
23382 flag(sh_picture_header_in_slice_header_flag);
3094
2/2
✓ Branch 0 taken 8585 times.
✓ Branch 1 taken 3106 times.
23382 if (current->sh_picture_header_in_slice_header_flag) {
3095 // 7.4.8 if sh_picture_header_in_slice_header_flag is true, we do not have a PH NAL unit
3096
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8585 times.
17170 CHECK(FUNC(picture_header) (ctx, rw, &current->sh_picture_header));
3097 17170 ph = &current->sh_picture_header;
3098 } else {
3099 6212 ph = h266->ph;
3100
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3106 times.
6212 if (!ph) {
3101 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
3102 "Picture header not available.\n");
3103 ✗ return AVERROR_INVALIDDATA;
3104 }
3105 }
3106
3107 23382 pps = h266->pps[ph->ph_pic_parameter_set_id];
3108
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11691 times.
23382 if (!pps) {
3109 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "PPS id %d not available.\n",
3110 ✗ ph->ph_pic_parameter_set_id);
3111 ✗ return AVERROR_INVALIDDATA;
3112 }
3113 23382 sps = h266->sps[pps->pps_seq_parameter_set_id];
3114
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11691 times.
23382 if (!sps) {
3115 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n",
3116 ✗ pps->pps_seq_parameter_set_id);
3117 ✗ return AVERROR_INVALIDDATA;
3118 }
3119
3120
2/2
✓ Branch 0 taken 819 times.
✓ Branch 1 taken 10872 times.
23382 if (sps->sps_subpic_info_present_flag) {
3121
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 819 times.
1638 ub(sps->sps_subpic_id_len_minus1 + 1, sh_subpic_id);
3122
1/2
✓ Branch 0 taken 2982 times.
✗ Branch 1 not taken.
5964 for (i = 0; i <= sps->sps_num_subpics_minus1; i++) {
3123
2/2
✓ Branch 0 taken 819 times.
✓ Branch 1 taken 2163 times.
5964 if (pps->sub_pic_id_val[i] == current->sh_subpic_id) {
3124 1638 current->curr_subpic_idx = i;
3125 1638 break;
3126 }
3127 }
3128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 819 times.
1638 if (i > sps->sps_num_subpics_minus1) {
3129 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "invalid CurrSubpicIdx %d\n", i);
3130 ✗ return AVERROR_INVALIDDATA;
3131 }
3132 } else {
3133 21744 current->curr_subpic_idx = 0;
3134 }
3135
3136 23382 num_slices_in_subpic = pps->num_slices_in_subpic[current->curr_subpic_idx];
3137
3138
4/4
✓ Branch 0 taken 2483 times.
✓ Branch 1 taken 9208 times.
✓ Branch 2 taken 973 times.
✓ Branch 3 taken 1510 times.
23382 if ((pps->pps_rect_slice_flag && num_slices_in_subpic > 1) ||
3139
4/4
✓ Branch 0 taken 9208 times.
✓ Branch 1 taken 973 times.
✓ Branch 2 taken 850 times.
✓ Branch 3 taken 8358 times.
25082 (!pps->pps_rect_slice_flag && pps->num_tiles_in_pic > 1)) {
3140 unsigned int bits, max;
3141
2/2
✓ Branch 0 taken 850 times.
✓ Branch 1 taken 1510 times.
4720 if (!pps->pps_rect_slice_flag) {
3142 1700 bits = av_ceil_log2(pps->num_tiles_in_pic);
3143 1700 max = pps->num_tiles_in_pic - 1;
3144 } else {
3145 3020 bits = av_ceil_log2(num_slices_in_subpic);
3146 3020 max = num_slices_in_subpic - 1;
3147 }
3148
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2360 times.
4720 u(bits, sh_slice_address, 0, max);
3149 } else {
3150
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2122 times.
18662 infer(sh_slice_address, 0);
3151 }
3152
3153
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11691 times.
23382 for (i = 0; i < sps->sps_num_extra_sh_bytes * 8; i++) {
3154 ✗ if (sps->sps_extra_sh_bit_present_flag[i])
3155 ✗ flags(sh_extra_bit[i], 1, i);
3156 }
3157
3158
2/2
✓ Branch 0 taken 9208 times.
✓ Branch 1 taken 2483 times.
23382 if (!pps->pps_rect_slice_flag &&
3159
2/2
✓ Branch 0 taken 800 times.
✓ Branch 1 taken 8408 times.
18416 pps->num_tiles_in_pic - current->sh_slice_address > 1)
3160
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 - current->sh_slice_address);
3161 else
3162
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2428 times.
21782 infer(sh_num_tiles_in_slice_minus1, 0);
3163
3164
2/2
✓ Branch 0 taken 9950 times.
✓ Branch 1 taken 1741 times.
23382 if (ph->ph_inter_slice_allowed_flag)
3165
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9950 times.
19900 ue(sh_slice_type, 0, 2);
3166 else
3167
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 417 times.
3482 infer(sh_slice_type, 2);
3168
3169 23382 nal_unit_type = current->nal_unit_header.nal_unit_type;
3170
6/6
✓ Branch 0 taken 11669 times.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 10003 times.
✓ Branch 3 taken 1666 times.
✓ Branch 4 taken 9954 times.
✓ Branch 5 taken 49 times.
23382 if (nal_unit_type == VVC_IDR_W_RADL || nal_unit_type == VVC_IDR_N_LP ||
3171
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 9947 times.
19908 nal_unit_type == VVC_CRA_NUT || nal_unit_type == VVC_GDR_NUT)
3172
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1744 times.
3488 flag(sh_no_output_of_prior_pics_flag);
3173
3174
2/2
✓ Branch 0 taken 7092 times.
✓ Branch 1 taken 4599 times.
23382 if (sps->sps_alf_enabled_flag) {
3175
2/2
✓ Branch 0 taken 6554 times.
✓ Branch 1 taken 538 times.
14184 if (!pps->pps_alf_info_in_ph_flag) {
3176
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6554 times.
13108 flag(sh_alf_enabled_flag);
3177
2/2
✓ Branch 0 taken 5562 times.
✓ Branch 1 taken 992 times.
13108 if (current->sh_alf_enabled_flag) {
3178
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5562 times.
11124 ub(3, sh_num_alf_aps_ids_luma);
3179
2/2
✓ Branch 0 taken 6880 times.
✓ Branch 1 taken 5562 times.
24884 for (i = 0; i < current->sh_num_alf_aps_ids_luma; i++)
3180
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6880 times.
13760 ubs(3, sh_alf_aps_id_luma[i], 1, i);
3181
3182
2/2
✓ Branch 0 taken 5275 times.
✓ Branch 1 taken 287 times.
11124 if (sps->sps_chroma_format_idc != 0) {
3183
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5275 times.
10550 flag(sh_alf_cb_enabled_flag);
3184
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5275 times.
10550 flag(sh_alf_cr_enabled_flag);
3185 }
3186
2/2
✓ Branch 0 taken 3129 times.
✓ Branch 1 taken 2433 times.
11124 if (current->sh_alf_cb_enabled_flag ||
3187
2/2
✓ Branch 0 taken 711 times.
✓ Branch 1 taken 2418 times.
6258 current->sh_alf_cr_enabled_flag) {
3188
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 3144 times.
6288 ub(3, sh_alf_aps_id_chroma);
3189 }
3190
3191
2/2
✓ Branch 0 taken 5275 times.
✓ Branch 1 taken 287 times.
11124 if (sps->sps_ccalf_enabled_flag) {
3192
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5275 times.
10550 flag(sh_alf_cc_cb_enabled_flag);
3193
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 4472 times.
10550 if (current->sh_alf_cc_cb_enabled_flag)
3194
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 803 times.
1606 ub(3, sh_alf_cc_cb_aps_id);
3195
3196
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5275 times.
10550 flag(sh_alf_cc_cr_enabled_flag);
3197
2/2
✓ Branch 0 taken 683 times.
✓ Branch 1 taken 4592 times.
10550 if (current->sh_alf_cc_cr_enabled_flag)
3198
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 683 times.
1366 ub(3, sh_alf_cc_cr_aps_id);
3199 }
3200 }
3201 } else {
3202
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
1076 infer(sh_alf_enabled_flag, ph->ph_alf_enabled_flag);
3203
2/2
✓ Branch 0 taken 362 times.
✓ Branch 1 taken 176 times.
1076 if (current->sh_alf_enabled_flag) {
3204
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);
3205
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++)
3206
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]);
3207
3208
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
724 infer(sh_alf_cb_enabled_flag, ph->ph_alf_cb_enabled_flag);
3209
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
724 infer(sh_alf_cr_enabled_flag, ph->ph_alf_cr_enabled_flag);
3210
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)
3211
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
340 infer(sh_alf_aps_id_chroma, ph->ph_alf_aps_id_chroma);
3212
3213
1/2
✓ Branch 0 taken 362 times.
✗ Branch 1 not taken.
724 if (sps->sps_ccalf_enabled_flag) {
3214
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);
3215
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 344 times.
724 if (current->sh_alf_cc_cb_enabled_flag)
3216
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);
3217
3218
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);
3219
2/2
✓ Branch 0 taken 12 times.
✓ Branch 1 taken 350 times.
724 if (current->sh_alf_cc_cr_enabled_flag)
3220
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);
3221 }
3222 }
3223 }
3224 }
3225
3226
2/2
✓ Branch 0 taken 8585 times.
✓ Branch 1 taken 3106 times.
23382 if (current->sh_picture_header_in_slice_header_flag) {
3227
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2103 times.
17170 infer(sh_lmcs_used_flag, ph->ph_lmcs_enabled_flag);
3228
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2103 times.
17170 infer(sh_explicit_scaling_list_used_flag,
3229 ph->ph_explicit_scaling_list_enabled_flag);
3230 } else {
3231
2/2
✓ Branch 0 taken 1944 times.
✓ Branch 1 taken 1162 times.
6212 if (ph->ph_lmcs_enabled_flag)
3232
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1944 times.
3888 flag(sh_lmcs_used_flag);
3233 else
3234
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 122 times.
2324 infer(sh_lmcs_used_flag, 0);
3235
3236
2/2
✓ Branch 0 taken 123 times.
✓ Branch 1 taken 2983 times.
6212 if (ph->ph_explicit_scaling_list_enabled_flag)
3237
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 123 times.
246 flag(sh_explicit_scaling_list_used_flag);
3238 else
3239
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 485 times.
5966 infer(sh_explicit_scaling_list_used_flag, 0);
3240 }
3241
3242
4/4
✓ Branch 0 taken 11165 times.
✓ Branch 1 taken 526 times.
✓ Branch 2 taken 11143 times.
✓ Branch 3 taken 22 times.
23382 if (!pps->pps_rpl_info_in_ph_flag &&
3243
2/2
✓ Branch 0 taken 1642 times.
✓ Branch 1 taken 9501 times.
22286 ((nal_unit_type != VVC_IDR_W_RADL &&
3244
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1646 times.
3328 nal_unit_type != VVC_IDR_N_LP) || sps->sps_idr_rpl_present_flag)) {
3245
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9519 times.
19038 CHECK(FUNC(ref_pic_lists)
3246 (ctx, rw, sps, pps, &current->sh_ref_pic_lists));
3247 19038 ref_pic_lists = &current->sh_ref_pic_lists;
3248 } else {
3249 4344 ref_pic_lists = &ph->ph_ref_pic_lists;
3250 }
3251
2/2
✓ Branch 0 taken 9950 times.
✓ Branch 1 taken 1741 times.
23382 if ((current->sh_slice_type != VVC_SLICE_TYPE_I &&
3252
2/2
✓ Branch 0 taken 1628 times.
✓ Branch 1 taken 8322 times.
19900 ref_pic_lists->rpl_ref_list[0].num_ref_entries > 1) ||
3253
2/2
✓ Branch 0 taken 803 times.
✓ Branch 1 taken 2566 times.
6738 (current->sh_slice_type == VVC_SLICE_TYPE_B &&
3254
2/2
✓ Branch 0 taken 30 times.
✓ Branch 1 taken 773 times.
1606 ref_pic_lists->rpl_ref_list[1].num_ref_entries > 1)) {
3255
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8352 times.
16704 flag(sh_num_ref_idx_active_override_flag);
3256
2/2
✓ Branch 0 taken 238 times.
✓ Branch 1 taken 8114 times.
16704 if (current->sh_num_ref_idx_active_override_flag) {
3257 476 for (i = 0;
3258
4/4
✓ Branch 0 taken 495 times.
✓ Branch 1 taken 146 times.
✓ Branch 2 taken 403 times.
✓ Branch 3 taken 238 times.
1282 i < (current->sh_slice_type == VVC_SLICE_TYPE_B ? 2 : 1); i++)
3259
1/2
✓ Branch 0 taken 403 times.
✗ Branch 1 not taken.
806 if (ref_pic_lists->rpl_ref_list[i].num_ref_entries > 1)
3260
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 403 times.
806 ues(sh_num_ref_idx_active_minus1[i], 0, 14, 1, i);
3261 else
3262 ✗ infer(sh_num_ref_idx_active_minus1[i], 0);
3263 }
3264 } else {
3265
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 824 times.
6678 infer(sh_num_ref_idx_active_override_flag, 1);
3266 }
3267
3268
2/2
✓ Branch 0 taken 23382 times.
✓ Branch 1 taken 11691 times.
70146 for (i = 0; i < 2; i++) {
3269
2/2
✓ Branch 0 taken 10070 times.
✓ Branch 1 taken 13312 times.
46764 if (current->sh_slice_type == VVC_SLICE_TYPE_B ||
3270
4/4
✓ Branch 0 taken 6588 times.
✓ Branch 1 taken 3482 times.
✓ Branch 2 taken 3294 times.
✓ Branch 3 taken 3294 times.
20140 (current->sh_slice_type == VVC_SLICE_TYPE_P && i == 0)) {
3271
2/2
✓ Branch 0 taken 2774 times.
✓ Branch 1 taken 13832 times.
33212 if (current->sh_num_ref_idx_active_override_flag) {
3272 5548 current->num_ref_idx_active[i] = current->sh_num_ref_idx_active_minus1[i] + 1;
3273 } else {
3274 27664 current->num_ref_idx_active[i] =
3275 27664 FFMIN(ref_pic_lists->rpl_ref_list[i].num_ref_entries,
3276 pps->pps_num_ref_idx_default_active_minus1[i] + 1);
3277 }
3278
3279
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16606 times.
33212 if (current->num_ref_idx_active[i] <= 0) {
3280 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
3281 "Inter slice but no reference pictures available for RPL%d.\n", i);
3282 ✗ return AVERROR_INVALIDDATA;
3283 }
3284 } else {
3285 13552 current->num_ref_idx_active[i] = 0;
3286 }
3287 }
3288
3289
2/2
✓ Branch 0 taken 9950 times.
✓ Branch 1 taken 1741 times.
23382 if (current->sh_slice_type != VVC_SLICE_TYPE_I) {
3290
2/2
✓ Branch 0 taken 9836 times.
✓ Branch 1 taken 114 times.
19900 if (pps->pps_cabac_init_present_flag)
3291
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9836 times.
19672 flag(sh_cabac_init_flag);
3292 else
3293
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
228 infer(sh_cabac_init_flag, 0);
3294
2/2
✓ Branch 0 taken 9857 times.
✓ Branch 1 taken 93 times.
19900 if (ph->ph_temporal_mvp_enabled_flag) {
3295
2/2
✓ Branch 0 taken 9355 times.
✓ Branch 1 taken 502 times.
19714 if (!pps->pps_rpl_info_in_ph_flag) {
3296
2/2
✓ Branch 0 taken 6070 times.
✓ Branch 1 taken 3285 times.
18710 if (current->sh_slice_type == VVC_SLICE_TYPE_B)
3297
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6070 times.
12140 flag(sh_collocated_from_l0_flag);
3298 else
3299
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1046 times.
6570 infer(sh_collocated_from_l0_flag, 1);
3300
2/2
✓ Branch 0 taken 5348 times.
✓ Branch 1 taken 4007 times.
18710 if ((current->sh_collocated_from_l0_flag &&
3301
2/2
✓ Branch 0 taken 871 times.
✓ Branch 1 taken 4477 times.
10696 current->num_ref_idx_active[0] > 1) ||
3302
2/2
✓ Branch 0 taken 4007 times.
✓ Branch 1 taken 871 times.
9756 (!current->sh_collocated_from_l0_flag &&
3303
2/2
✓ Branch 0 taken 3164 times.
✓ Branch 1 taken 843 times.
23296 current->num_ref_idx_active[1] > 1)) {
3304 15282 unsigned int idx = current->sh_collocated_from_l0_flag ? 0 : 1;
3305
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7641 times.
15282 ue(sh_collocated_ref_idx, 0, current->num_ref_idx_active[idx] - 1);
3306 } else {
3307
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 407 times.
3428 infer(sh_collocated_ref_idx, 0);
3308 }
3309 } else {
3310
2/2
✓ Branch 0 taken 500 times.
✓ Branch 1 taken 2 times.
1004 if (current->sh_slice_type == VVC_SLICE_TYPE_B)
3311
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
1000 infer(sh_collocated_from_l0_flag, ph->ph_collocated_from_l0_flag);
3312 else
3313
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
4 infer(sh_collocated_from_l0_flag, 1);
3314
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
1004 infer(sh_collocated_ref_idx, ph->ph_collocated_ref_idx);
3315 }
3316 }
3317
1/2
✓ Branch 0 taken 9950 times.
✗ Branch 1 not taken.
19900 if (!pps->pps_wp_info_in_ph_flag &&
3318
2/2
✓ Branch 0 taken 194 times.
✓ Branch 1 taken 9756 times.
19900 ((pps->pps_weighted_pred_flag &&
3319
2/2
✓ Branch 0 taken 170 times.
✓ Branch 1 taken 24 times.
388 current->sh_slice_type == VVC_SLICE_TYPE_P) ||
3320
2/2
✓ Branch 0 taken 170 times.
✓ Branch 1 taken 9756 times.
19852 (pps->pps_weighted_bipred_flag &&
3321
1/2
✓ Branch 0 taken 170 times.
✗ Branch 1 not taken.
340 current->sh_slice_type == VVC_SLICE_TYPE_B))) {
3322
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 194 times.
388 CHECK(FUNC(pred_weight_table) (ctx, rw, sps, pps, ref_pic_lists,
3323 current->num_ref_idx_active,
3324 &current->sh_pred_weight_table));
3325 }
3326 }
3327 23382 qp_bd_offset = 6 * sps->sps_bitdepth_minus8;
3328
2/2
✓ Branch 0 taken 11159 times.
✓ Branch 1 taken 532 times.
23382 if (!pps->pps_qp_delta_info_in_ph_flag)
3329
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11159 times.
22318 se(sh_qp_delta, -qp_bd_offset - (26 + pps->pps_init_qp_minus26),
3330 63 - (26 + pps->pps_init_qp_minus26));
3331
2/2
✓ Branch 0 taken 184 times.
✓ Branch 1 taken 11507 times.
23382 if (pps->pps_slice_chroma_qp_offsets_present_flag) {
3332 int8_t off;
3333
3334
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 184 times.
368 se(sh_cb_qp_offset, -12, 12);
3335 368 off = pps->pps_cb_qp_offset + current->sh_cb_qp_offset;
3336
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) {
3337 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
3338 "pps_cb_qp_offset + sh_cb_qp_offset (%d) not in range [-12, 12].\n",
3339 off);
3340 ✗ return AVERROR_INVALIDDATA;
3341 }
3342
3343
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 184 times.
368 se(sh_cr_qp_offset, -12, 12);
3344 368 off = pps->pps_cr_qp_offset + current->sh_cr_qp_offset;
3345
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) {
3346 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
3347 "pps_cr_qp_offset + sh_cr_qp_offset (%d) not in range [-12, 12].\n",
3348 off);
3349 ✗ return AVERROR_INVALIDDATA;
3350 }
3351
3352
2/2
✓ Branch 0 taken 123 times.
✓ Branch 1 taken 61 times.
368 if (sps->sps_joint_cbcr_enabled_flag) {
3353
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 123 times.
246 se(sh_joint_cbcr_qp_offset, -12, 12);
3354 246 off =
3355 246 pps->pps_joint_cbcr_qp_offset_value +
3356 246 current->sh_joint_cbcr_qp_offset;
3357
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) {
3358 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR,
3359 "pps_joint_cbcr_qp_offset_value + sh_joint_cbcr_qp_offset (%d)"
3360 "not in range [-12, 12]. \n", off);
3361 ✗ return AVERROR_INVALIDDATA;
3362 }
3363 } else {
3364
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
122 infer(sh_joint_cbcr_qp_offset, 0);
3365 }
3366 } else {
3367
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
23014 infer(sh_cb_qp_offset, 0);
3368
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
23014 infer(sh_cr_qp_offset, 0);
3369
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
23014 infer(sh_joint_cbcr_qp_offset, 0);
3370 }
3371
2/2
✓ Branch 0 taken 123 times.
✓ Branch 1 taken 11568 times.
23382 if (pps->pps_cu_chroma_qp_offset_list_enabled_flag)
3372
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 123 times.
246 flag(sh_cu_chroma_qp_offset_enabled_flag);
3373 else
3374
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
23136 infer(sh_cu_chroma_qp_offset_enabled_flag, 0);
3375
4/4
✓ Branch 0 taken 7558 times.
✓ Branch 1 taken 4133 times.
✓ Branch 2 taken 7014 times.
✓ Branch 3 taken 544 times.
23382 if (sps->sps_sao_enabled_flag && !pps->pps_sao_info_in_ph_flag) {
3376
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7014 times.
14028 flag(sh_sao_luma_used_flag);
3377
2/2
✓ Branch 0 taken 6692 times.
✓ Branch 1 taken 322 times.
14028 if (sps->sps_chroma_format_idc != 0)
3378
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 6692 times.
13384 flag(sh_sao_chroma_used_flag);
3379 else
3380
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
644 infer(sh_sao_chroma_used_flag, ph->ph_sao_chroma_enabled_flag);
3381 } else {
3382
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1282 times.
9354 infer(sh_sao_luma_used_flag, ph->ph_sao_luma_enabled_flag);
3383
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1282 times.
9354 infer(sh_sao_chroma_used_flag, ph->ph_sao_chroma_enabled_flag);
3384 }
3385
3386
2/2
✓ Branch 0 taken 289 times.
✓ Branch 1 taken 11402 times.
23382 if (pps->pps_deblocking_filter_override_enabled_flag &&
3387
2/2
✓ Branch 0 taken 250 times.
✓ Branch 1 taken 39 times.
578 !pps->pps_dbf_info_in_ph_flag)
3388
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 250 times.
500 flag(sh_deblocking_params_present_flag);
3389 else
3390
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22882 infer(sh_deblocking_params_present_flag, 0);
3391
2/2
✓ Branch 0 taken 250 times.
✓ Branch 1 taken 11441 times.
23382 if (current->sh_deblocking_params_present_flag) {
3392
1/2
✓ Branch 0 taken 250 times.
✗ Branch 1 not taken.
500 if (!pps->pps_deblocking_filter_disabled_flag)
3393
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 250 times.
500 flag(sh_deblocking_filter_disabled_flag);
3394 else
3395 ✗ infer(sh_deblocking_filter_disabled_flag, 0);
3396
2/2
✓ Branch 0 taken 166 times.
✓ Branch 1 taken 84 times.
500 if (!current->sh_deblocking_filter_disabled_flag) {
3397
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 166 times.
332 se(sh_luma_beta_offset_div2, -12, 12);
3398
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 166 times.
332 se(sh_luma_tc_offset_div2, -12, 12);
3399
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 130 times.
332 if (pps->pps_chroma_tool_offsets_present_flag) {
3400
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_cb_beta_offset_div2, -12, 12);
3401
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_cb_tc_offset_div2, -12, 12);
3402
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_cr_beta_offset_div2, -12, 12);
3403
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 36 times.
72 se(sh_cr_tc_offset_div2, -12, 12);
3404 } else {
3405
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
260 infer(sh_cb_beta_offset_div2,
3406 current->sh_luma_beta_offset_div2);
3407
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
260 infer(sh_cb_tc_offset_div2, current->sh_luma_tc_offset_div2);
3408
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
260 infer(sh_cr_beta_offset_div2,
3409 current->sh_luma_beta_offset_div2);
3410
0/2
✗ Branch 0 not taken.
✗ Branch 1 not taken.
260 infer(sh_cr_tc_offset_div2, current->sh_luma_tc_offset_div2);
3411 }
3412 }
3413 } else {
3414
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22882 infer(sh_deblocking_filter_disabled_flag, ph->ph_deblocking_filter_disabled_flag);
3415
2/2
✓ Branch 0 taken 7595 times.
✓ Branch 1 taken 3846 times.
22882 if (!current->sh_deblocking_filter_disabled_flag) {
3416
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
15190 infer(sh_luma_beta_offset_div2, ph->ph_luma_beta_offset_div2);
3417
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
15190 infer(sh_luma_tc_offset_div2, ph->ph_luma_tc_offset_div2);
3418
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
15190 infer(sh_cb_beta_offset_div2, ph->ph_cb_beta_offset_div2);
3419
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
15190 infer(sh_cb_tc_offset_div2, ph->ph_cb_tc_offset_div2);
3420
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
15190 infer(sh_cr_beta_offset_div2, ph->ph_cr_beta_offset_div2);
3421
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1308 times.
15190 infer(sh_cr_tc_offset_div2, ph->ph_cr_tc_offset_div2);
3422 }
3423 }
3424
3425
2/2
✓ Branch 0 taken 7514 times.
✓ Branch 1 taken 4177 times.
23382 if (sps->sps_dep_quant_enabled_flag)
3426
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7514 times.
15028 flag(sh_dep_quant_used_flag);
3427 else
3428
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1280 times.
8354 infer(sh_dep_quant_used_flag, 0);
3429
3430
2/2
✓ Branch 0 taken 275 times.
✓ Branch 1 taken 11416 times.
23382 if (sps->sps_sign_data_hiding_enabled_flag &&
3431
1/2
✓ Branch 0 taken 275 times.
✗ Branch 1 not taken.
550 !current->sh_dep_quant_used_flag)
3432
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 275 times.
550 flag(sh_sign_data_hiding_used_flag);
3433 else
3434
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
22832 infer(sh_sign_data_hiding_used_flag, 0);
3435
3436
2/2
✓ Branch 0 taken 7374 times.
✓ Branch 1 taken 4317 times.
23382 if (sps->sps_transform_skip_enabled_flag &&
3437
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7374 times.
14748 !current->sh_dep_quant_used_flag &&
3438 ✗ !current->sh_sign_data_hiding_used_flag)
3439 ✗ flag(sh_ts_residual_coding_disabled_flag);
3440 else
3441
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
23382 infer(sh_ts_residual_coding_disabled_flag, 0);
3442
3443
1/2
✓ Branch 0 taken 11691 times.
✗ Branch 1 not taken.
23382 if (!current->sh_ts_residual_coding_disabled_flag &&
3444
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11691 times.
23382 sps->sps_ts_residual_coding_rice_present_in_sh_flag)
3445 ✗ ub(3, sh_ts_residual_coding_rice_idx_minus1);
3446 else
3447
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
23382 infer(sh_ts_residual_coding_rice_idx_minus1, 0);
3448
3449
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11691 times.
23382 if (sps->sps_reverse_last_sig_coeff_enabled_flag)
3450 ✗ flag(sh_reverse_last_sig_coeff_flag);
3451 else
3452
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2588 times.
23382 infer(sh_reverse_last_sig_coeff_flag, 0);
3453
3454
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11691 times.
23382 if (pps->pps_slice_header_extension_present_flag) {
3455 ✗ ue(sh_slice_header_extension_length, 0, 256);
3456 ✗ for (i = 0; i < current->sh_slice_header_extension_length; i++)
3457 ✗ us(8, sh_slice_header_extension_data_byte[i], 0x00, 0xff, 1, i);
3458 }
3459
3460 23382 current->num_entry_points = 0;
3461
2/2
✓ Branch 0 taken 11507 times.
✓ Branch 1 taken 184 times.
23382 if (sps->sps_entry_point_offsets_present_flag) {
3462 23014 uint8_t entropy_sync = sps->sps_entropy_coding_sync_enabled_flag;
3463 int height;
3464
2/2
✓ Branch 0 taken 2360 times.
✓ Branch 1 taken 9147 times.
23014 if (pps->pps_rect_slice_flag) {
3465 int width_in_tiles;
3466 4720 int slice_idx = current->sh_slice_address;
3467
2/2
✓ Branch 0 taken 2040 times.
✓ Branch 1 taken 2360 times.
8800 for (i = 0; i < current->curr_subpic_idx; i++) {
3468 4080 slice_idx += pps->num_slices_in_subpic[i];
3469 }
3470
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2360 times.
4720 if (slice_idx > pps->pps_num_slices_in_pic_minus1) {
3471 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid slice address %d\n", slice_idx);
3472 ✗ return AVERROR_INVALIDDATA;
3473 }
3474
3475
2/2
✓ Branch 0 taken 523 times.
✓ Branch 1 taken 1837 times.
4720 if (pps->pps_single_slice_per_subpic_flag) {
3476 int width_in_ctus, height_in_ctus;
3477
2/2
✓ Branch 0 taken 520 times.
✓ Branch 1 taken 3 times.
1046 if (sps->sps_subpic_info_present_flag) {
3478 1040 width_in_ctus = sps->sps_subpic_width_minus1[slice_idx] + 1;
3479 1040 height_in_ctus = sps->sps_subpic_height_minus1[slice_idx] + 1;
3480 } else {
3481 6 const int log2_ctb_size = sps->sps_log2_ctu_size_minus5 + 5;
3482 6 const int ctb_size = 1 << log2_ctb_size;
3483 6 width_in_ctus = (pps->pps_pic_width_in_luma_samples + ctb_size - 1) >> log2_ctb_size;
3484 6 height_in_ctus = (pps->pps_pic_height_in_luma_samples + ctb_size - 1) >> log2_ctb_size;
3485 }
3486
3487 1046 const int subpic_l = sps->sps_subpic_ctu_top_left_x[slice_idx];
3488 1046 const int subpic_r = subpic_l + width_in_ctus;
3489
3490 1046 int ctb_x = 0, tile_x = 0;
3491
3/4
✓ Branch 0 taken 780 times.
✓ Branch 1 taken 523 times.
✓ Branch 2 taken 780 times.
✗ Branch 3 not taken.
2606 for (; ctb_x < subpic_l && tile_x < pps->num_tile_columns; tile_x++)
3492 1560 ctb_x += pps->col_width_val[tile_x];
3493
3494 1046 width_in_tiles = 0;
3495
3/4
✓ Branch 0 taken 526 times.
✓ Branch 1 taken 523 times.
✓ Branch 2 taken 526 times.
✗ Branch 3 not taken.
2098 for (; ctb_x < subpic_r && tile_x < pps->num_tile_columns; tile_x++) {
3496 1052 ctb_x += pps->col_width_val[tile_x];
3497 1052 width_in_tiles++;
3498 }
3499
3500
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 520 times.
1046 if (entropy_sync) {
3501 6 height = height_in_ctus;
3502 } else {
3503 1040 const int subpic_t = sps->sps_subpic_ctu_top_left_y[slice_idx];
3504 1040 const int subpic_b = subpic_t + height_in_ctus;
3505
3506 1040 int ctb_y = 0, tile_y = 0, height_in_tiles;
3507
3/4
✓ Branch 0 taken 260 times.
✓ Branch 1 taken 520 times.
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
1560 for (; ctb_y < subpic_t && tile_y < pps->num_tile_rows; tile_y++)
3508 520 ctb_y += pps->row_height_val[tile_y];
3509
3510 1040 height_in_tiles = 0;
3511
3/4
✓ Branch 0 taken 520 times.
✓ Branch 1 taken 520 times.
✓ Branch 2 taken 520 times.
✗ Branch 3 not taken.
2080 for (; ctb_y < subpic_b && tile_y < pps->num_tile_rows; tile_y++) {
3512 1040 ctb_y += pps->row_height_val[tile_y];
3513 1040 height_in_tiles++;
3514 }
3515
3516 1040 height = height_in_tiles;
3517 }
3518 } else {
3519 3674 width_in_tiles =
3520 3674 pps->pps_slice_width_in_tiles_minus1[slice_idx] + 1;
3521
3522
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1837 times.
3674 if (entropy_sync)
3523 ✗ height = pps->slice_height_in_ctus[slice_idx];
3524 else
3525 3674 height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1;
3526 }
3527
3528 4720 current->num_entry_points = width_in_tiles * height;
3529 } else {
3530 int tile_idx;
3531 int tile_y;
3532 18294 for (tile_idx = current->sh_slice_address;
3533 37388 tile_idx <=
3534 37388 current->sh_slice_address +
3535
2/2
✓ Branch 0 taken 9547 times.
✓ Branch 1 taken 9147 times.
37388 current->sh_num_tiles_in_slice_minus1; tile_idx++) {
3536 19094 tile_y = tile_idx / pps->num_tile_columns;
3537 19094 height = pps->row_height_val[tile_y];
3538
2/2
✓ Branch 0 taken 247 times.
✓ Branch 1 taken 9300 times.
19094 current->num_entry_points += (entropy_sync ? height : 1);
3539 }
3540 }
3541 23014 current->num_entry_points--;
3542
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 11507 times.
23014 if (current->num_entry_points > VVC_MAX_ENTRY_POINTS) {
3543 ✗ av_log(ctx->log_ctx, AV_LOG_ERROR, "Too many entry points: "
3544 "%" PRIu32 ".\n", current->num_entry_points);
3545 ✗ return AVERROR_PATCHWELCOME;
3546 }
3547
2/2
✓ Branch 0 taken 632 times.
✓ Branch 1 taken 10875 times.
23014 if (current->num_entry_points > 0) {
3548
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 632 times.
1264 ue(sh_entry_offset_len_minus1, 0, 31);
3549
2/2
✓ Branch 0 taken 1874 times.
✓ Branch 1 taken 632 times.
5012 for (i = 0; i < current->num_entry_points; i++) {
3550
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1874 times.
3748 ubs(current->sh_entry_offset_len_minus1 + 1,
3551 sh_entry_point_offset_minus1[i], 1, i);
3552 }
3553 }
3554 }
3555
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11691 times.
23382 CHECK(FUNC(byte_alignment) (ctx, rw));
3556
3557 23382 return 0;
3558 }
3559
3560 5509 static int FUNC(sei) (CodedBitstreamContext *ctx, RWContext *rw,
3561 H266RawSEI *current, int prefix)
3562 {
3563 int err;
3564
3565 5509 if (prefix)
3566 243 HEADER("Prefix Supplemental Enhancement Information");
3567 else
3568 5266 HEADER("Suffix Supplemental Enhancement Information");
3569
3570 5509 CHECK(FUNC(nal_unit_header) (ctx, rw, &current->nal_unit_header,
3571 prefix ? VVC_PREFIX_SEI_NUT
3572 : VVC_SUFFIX_SEI_NUT));
3573
3574 5509 CHECK(FUNC_SEI(message_list) (ctx, rw, &current->message_list, prefix));
3575
3576 5509 CHECK(FUNC(rbsp_trailing_bits) (ctx, rw));
3577
3578 5509 return 0;
3579 }
3580