FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/cbs_h266_syntax_template.c
Date: 2024-05-04 02:01:39
Exec Total Coverage
Lines: 1556 2139 72.7%
Functions: 62 66 93.9%
Branches: 1579 3362 47.0%

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