FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/cbs_h266_syntax_template.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 1611 2150 74.9%
Functions: 59 62 95.2%
Branches: 1615 3350 48.2%

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