Skip to content

Instantly share code, notes, and snippets.

@mildsunrise
Last active May 25, 2025 22:00
Show Gist options
  • Save mildsunrise/7b84b0471d9629e2590948605964b52c to your computer and use it in GitHub Desktop.
Save mildsunrise/7b84b0471d9629e2590948605964b52c to your computer and use it in GitHub Desktop.
pseudocode scraped off H.264 spec (2024/08)
// pseudocode contained in H.264 spec syntax tables:
// - category column becomes a /* C = ... */ comment
// - descriptor column becomes `= DESC('...')`
// - added missing { or } in a few places
// - remove space in "| |" "= =" "! =" "- -" "< =" "> ="
// - prepend _ to 2 identifiers beginning with "3d"
// - prepend "function" to each table
function nal_unit(NumBytesInNALunit) {
forbidden_zero_bit = DESC('f(1)') /* C = All */
nal_ref_idc = DESC('u(2)') /* C = All */
nal_unit_type = DESC('u(5)') /* C = All */
NumBytesInRBSP = 0
nalUnitHeaderBytes = 1
if (nal_unit_type == 14 || nal_unit_type == 20 || nal_unit_type == 21) {
if (nal_unit_type != 21)
svc_extension_flag = DESC('u(1)') /* C = All */
else
avc_3d_extension_flag = DESC('u(1)') /* C = All */
if (svc_extension_flag) {
nal_unit_header_svc_extension() /* specified in Annex F */ /* C = All */
nalUnitHeaderBytes += 3
} else if (avc_3d_extension_flag) {
nal_unit_header_3davc_extension() /* specified in Annex I */
nalUnitHeaderBytes += 2
} else {
nal_unit_header_mvc_extension() /* specified in Annex G */ /* C = All */
nalUnitHeaderBytes += 3
}
}
for (i = nalUnitHeaderBytes; i < NumBytesInNALunit; i++) {
if (i + 2 < NumBytesInNALunit && next_bits(24) == 0x000003) {
rbsp_byte[NumBytesInRBSP++] = DESC('b(8)') /* C = All */
rbsp_byte[NumBytesInRBSP++] = DESC('b(8)') /* C = All */
i += 2
emulation_prevention_three_byte /* equal to 0x03 */ = DESC('f(8)') /* C = All */
} else
rbsp_byte[NumBytesInRBSP++] = DESC('b(8)') /* C = All */
}
}
function seq_parameter_set_rbsp() {
seq_parameter_set_data() /* C = 0 */
rbsp_trailing_bits() /* C = 0 */
}
function seq_parameter_set_data() {
profile_idc = DESC('u(8)') /* C = 0 */
constraint_set0_flag = DESC('u(1)') /* C = 0 */
constraint_set1_flag = DESC('u(1)') /* C = 0 */
constraint_set2_flag = DESC('u(1)') /* C = 0 */
constraint_set3_flag = DESC('u(1)') /* C = 0 */
constraint_set4_flag = DESC('u(1)') /* C = 0 */
constraint_set5_flag = DESC('u(1)') /* C = 0 */
reserved_zero_2bits /* equal to 0 */ = DESC('u(2)') /* C = 0 */
level_idc = DESC('u(8)') /* C = 0 */
seq_parameter_set_id = DESC('ue(v)') /* C = 0 */
if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 || profile_idc == 244 || profile_idc == 44 || profile_idc == 83 || profile_idc == 86 || profile_idc == 118 || profile_idc == 128 || profile_idc == 138 || profile_idc == 139 || profile_idc == 134 || profile_idc == 135) {
chroma_format_idc = DESC('ue(v)') /* C = 0 */
if (chroma_format_idc == 3)
separate_colour_plane_flag = DESC('u(1)') /* C = 0 */
bit_depth_luma_minus8 = DESC('ue(v)') /* C = 0 */
bit_depth_chroma_minus8 = DESC('ue(v)') /* C = 0 */
qpprime_y_zero_transform_bypass_flag = DESC('u(1)') /* C = 0 */
seq_scaling_matrix_present_flag = DESC('u(1)') /* C = 0 */
if (seq_scaling_matrix_present_flag)
for (i = 0; i < ((chroma_format_idc != 3) ? 8 : 12); i++) {
seq_scaling_list_present_flag[i] = DESC('u(1)') /* C = 0 */
if (seq_scaling_list_present_flag[i])
if (i < 6)
scaling_list(ScalingList4x4[i], 16, UseDefaultScalingMatrix4x4Flag[i]) /* C = 0 */
else
scaling_list(ScalingList8x8[i - 6], 64, UseDefaultScalingMatrix8x8Flag[i - 6]) /* C = 0 */
}
}
log2_max_frame_num_minus4 = DESC('ue(v)') /* C = 0 */
pic_order_cnt_type = DESC('ue(v)') /* C = 0 */
if (pic_order_cnt_type == 0)
log2_max_pic_order_cnt_lsb_minus4 = DESC('ue(v)') /* C = 0 */
else if (pic_order_cnt_type == 1) {
delta_pic_order_always_zero_flag = DESC('u(1)') /* C = 0 */
offset_for_non_ref_pic = DESC('se(v)') /* C = 0 */
offset_for_top_to_bottom_field = DESC('se(v)') /* C = 0 */
num_ref_frames_in_pic_order_cnt_cycle = DESC('ue(v)') /* C = 0 */
for (i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)
offset_for_ref_frame[i] = DESC('se(v)') /* C = 0 */
}
max_num_ref_frames = DESC('ue(v)') /* C = 0 */
gaps_in_frame_num_value_allowed_flag = DESC('u(1)') /* C = 0 */
pic_width_in_mbs_minus1 = DESC('ue(v)') /* C = 0 */
pic_height_in_map_units_minus1 = DESC('ue(v)') /* C = 0 */
frame_mbs_only_flag = DESC('u(1)') /* C = 0 */
if (!frame_mbs_only_flag)
mb_adaptive_frame_field_flag = DESC('u(1)') /* C = 0 */
direct_8x8_inference_flag = DESC('u(1)') /* C = 0 */
frame_cropping_flag = DESC('u(1)') /* C = 0 */
if (frame_cropping_flag) {
frame_crop_left_offset = DESC('ue(v)') /* C = 0 */
frame_crop_right_offset = DESC('ue(v)') /* C = 0 */
frame_crop_top_offset = DESC('ue(v)') /* C = 0 */
frame_crop_bottom_offset = DESC('ue(v)') /* C = 0 */
}
vui_parameters_present_flag = DESC('u(1)') /* C = 0 */
if (vui_parameters_present_flag)
vui_parameters() /* C = 0 */
}
function scaling_list(scalingList, sizeOfScalingList, useDefaultScalingMatrixFlag) {
lastScale = 8
nextScale = 8
for (j = 0; j < sizeOfScalingList; j++) {
if (nextScale != 0) {
delta_scale = DESC('se(v)') /* C = 0 | 1 */
nextScale = (lastScale + delta_scale + 256) % 256
useDefaultScalingMatrixFlag = (j == 0 && nextScale == 0)
}
scalingList[j] = (nextScale == 0) ? lastScale : nextScale
lastScale = scalingList[j]
}
}
function seq_parameter_set_extension_rbsp() {
seq_parameter_set_id = DESC('ue(v)') /* C = 10 */
aux_format_idc = DESC('ue(v)') /* C = 10 */
if (aux_format_idc != 0) {
bit_depth_aux_minus8 = DESC('ue(v)') /* C = 10 */
alpha_incr_flag = DESC('u(1)') /* C = 10 */
alpha_opaque_value = DESC('u(v)') /* C = 10 */
alpha_transparent_value = DESC('u(v)') /* C = 10 */
}
additional_extension_flag = DESC('u(1)') /* C = 10 */
rbsp_trailing_bits() /* C = 10 */
}
function subset_seq_parameter_set_rbsp() {
seq_parameter_set_data() /* C = 0 */
if (profile_idc == 83 || profile_idc == 86) {
seq_parameter_set_svc_extension() /* specified in Annex F */ /* C = 0 */
svc_vui_parameters_present_flag = DESC('u(1)') /* C = 0 */
if (svc_vui_parameters_present_flag == 1)
svc_vui_parameters_extension() /* specified in Annex F */ /* C = 0 */
} else if (profile_idc == 118 || profile_idc == 128 || profile_idc == 134) {
bit_equal_to_one /* equal to 1 */ = DESC('f(1)') /* C = 0 */
seq_parameter_set_mvc_extension() /* specified in Annex G */ /* C = 0 */
mvc_vui_parameters_present_flag = DESC('u(1)') /* C = 0 */
if (mvc_vui_parameters_present_flag == 1)
mvc_vui_parameters_extension() /* specified in Annex G */ /* C = 0 */
} else if (profile_idc == 138 || profile_idc == 135) {
bit_equal_to_one /* equal to 1 */ = DESC('f(1)') /* C = 0 */
seq_parameter_set_mvcd_extension() /* specified in Annex H */
} else if (profile_idc == 139) {
bit_equal_to_one /* equal to 1 */ = DESC('f(1)') /* C = 0 */
seq_parameter_set_mvcd_extension() /* specified in Annex H */ /* C = 0 */
seq_parameter_set_3davc_extension() /* specified in Annex I */ /* C = 0 */
}
additional_extension2_flag = DESC('u(1)') /* C = 0 */
if (additional_extension2_flag == 1)
while (more_rbsp_data())
additional_extension2_data_flag = DESC('u(1)') /* C = 0 */
rbsp_trailing_bits() /* C = 0 */
}
function pic_parameter_set_rbsp() {
pic_parameter_set_id = DESC('ue(v)') /* C = 1 */
seq_parameter_set_id = DESC('ue(v)') /* C = 1 */
entropy_coding_mode_flag = DESC('u(1)') /* C = 1 */
bottom_field_pic_order_in_frame_present_flag = DESC('u(1)') /* C = 1 */
num_slice_groups_minus1 = DESC('ue(v)') /* C = 1 */
if (num_slice_groups_minus1 > 0) {
slice_group_map_type = DESC('ue(v)') /* C = 1 */
if (slice_group_map_type == 0)
for (iGroup = 0; iGroup <= num_slice_groups_minus1; iGroup++)
run_length_minus1[iGroup] = DESC('ue(v)') /* C = 1 */
else if (slice_group_map_type == 2)
for (iGroup = 0; iGroup < num_slice_groups_minus1; iGroup++) {
top_left[iGroup] = DESC('ue(v)') /* C = 1 */
bottom_right[iGroup] = DESC('ue(v)') /* C = 1 */
}
else if (slice_group_map_type == 3 || slice_group_map_type == 4 || slice_group_map_type == 5) {
slice_group_change_direction_flag = DESC('u(1)') /* C = 1 */
slice_group_change_rate_minus1 = DESC('ue(v)') /* C = 1 */
} else if (slice_group_map_type == 6) {
pic_size_in_map_units_minus1 = DESC('ue(v)') /* C = 1 */
for (i = 0; i <= pic_size_in_map_units_minus1; i++)
slice_group_id[i] = DESC('u(v)') /* C = 1 */
}
}
num_ref_idx_l0_default_active_minus1 = DESC('ue(v)') /* C = 1 */
num_ref_idx_l1_default_active_minus1 = DESC('ue(v)') /* C = 1 */
weighted_pred_flag = DESC('u(1)') /* C = 1 */
weighted_bipred_idc = DESC('u(2)') /* C = 1 */
pic_init_qp_minus26 = DESC('se(v)') /* C = 1 */
pic_init_qs_minus26 = DESC('se(v)') /* C = 1 */
chroma_qp_index_offset = DESC('se(v)') /* C = 1 */
deblocking_filter_control_present_flag = DESC('u(1)') /* C = 1 */
constrained_intra_pred_flag = DESC('u(1)') /* C = 1 */
redundant_pic_cnt_present_flag = DESC('u(1)') /* C = 1 */
if (more_rbsp_data()) {
transform_8x8_mode_flag = DESC('u(1)') /* C = 1 */
pic_scaling_matrix_present_flag = DESC('u(1)') /* C = 1 */
if (pic_scaling_matrix_present_flag)
for (i = 0; i < 6 + ((chroma_format_idc != 3) ? 2 : 6) * transform_8x8_mode_flag; i++) {
pic_scaling_list_present_flag[i] = DESC('u(1)') /* C = 1 */
if (pic_scaling_list_present_flag[i])
if (i < 6)
scaling_list(ScalingList4x4[i], 16, UseDefaultScalingMatrix4x4Flag[i]) /* C = 1 */
else
scaling_list(ScalingList8x8[i - 6], 64, UseDefaultScalingMatrix8x8Flag[i - 6]) /* C = 1 */
}
second_chroma_qp_index_offset = DESC('se(v)') /* C = 1 */
}
rbsp_trailing_bits() /* C = 1 */
}
function sei_rbsp() {
do
sei_message() /* C = 5 */
while (more_rbsp_data())
rbsp_trailing_bits() /* C = 5 */
}
function sei_message() {
payloadType = 0
while (next_bits(8) == 0xFF) {
ff_byte /* equal to 0xFF */ = DESC('f(8)') /* C = 5 */
payloadType += 255
}
last_payload_type_byte = DESC('u(8)') /* C = 5 */
payloadType += last_payload_type_byte
payloadSize = 0
while (next_bits(8) == 0xFF) {
ff_byte /* equal to 0xFF */ = DESC('f(8)') /* C = 5 */
payloadSize += 255
}
last_payload_size_byte = DESC('u(8)') /* C = 5 */
payloadSize += last_payload_size_byte
sei_payload(payloadType, payloadSize) /* C = 5 */
}
function access_unit_delimiter_rbsp() {
primary_pic_type = DESC('u(3)') /* C = 6 */
rbsp_trailing_bits() /* C = 6 */
}
function end_of_seq_rbsp() {
}
function end_of_stream_rbsp() {
}
function filler_data_rbsp() {
while (next_bits(8) == 0xFF)
ff_byte /* equal to 0xFF */ = DESC('f(8)') /* C = 9 */
rbsp_trailing_bits() /* C = 9 */
}
function slice_layer_without_partitioning_rbsp() {
slice_header() /* C = 2 */
slice_data() /* all categories of slice_data( ) syntax */ /* C = 2 | 3 | 4 */
rbsp_slice_trailing_bits() /* C = 2 */
}
function slice_data_partition_a_layer_rbsp() {
slice_header() /* C = 2 */
slice_id = DESC('ue(v)') /* C = All */
slice_data() /* only category 2 parts of slice_data( ) syntax */ /* C = 2 */
rbsp_slice_trailing_bits() /* C = 2 */
}
function slice_data_partition_b_layer_rbsp() {
slice_id = DESC('ue(v)') /* C = All */
if (separate_colour_plane_flag == 1)
colour_plane_id = DESC('u(2)') /* C = All */
if (redundant_pic_cnt_present_flag)
redundant_pic_cnt = DESC('ue(v)') /* C = All */
slice_data() /* only category 3 parts of slice_data( ) syntax */ /* C = 3 */
rbsp_slice_trailing_bits() /* C = 3 */
}
function slice_data_partition_c_layer_rbsp() {
slice_id = DESC('ue(v)') /* C = All */
if (separate_colour_plane_flag == 1)
colour_plane_id = DESC('u(2)') /* C = All */
if (redundant_pic_cnt_present_flag)
redundant_pic_cnt = DESC('ue(v)') /* C = All */
slice_data() /* only category 4 parts of slice_data( ) syntax */ /* C = 4 */
rbsp_slice_trailing_bits() /* C = 4 */
}
function rbsp_slice_trailing_bits() {
rbsp_trailing_bits() /* C = All */
if (entropy_coding_mode_flag)
while (more_rbsp_trailing_data())
cabac_zero_word /* equal to 0x0000 */ = DESC('f(16)') /* C = All */
}
function rbsp_trailing_bits() {
rbsp_stop_one_bit /* equal to 1 */ = DESC('f(1)') /* C = All */
while (!byte_aligned())
rbsp_alignment_zero_bit /* equal to 0 */ = DESC('f(1)') /* C = All */
}
function prefix_nal_unit_rbsp() {
if (svc_extension_flag)
prefix_nal_unit_svc() /* specified in Annex F */ /* C = 2 */
}
function slice_layer_extension_rbsp() {
if (svc_extension_flag) {
slice_header_in_scalable_extension() /* specified in Annex F */ /* C = 2 */
if (!slice_skip_flag)
slice_data_in_scalable_extension() /* specified in Annex F */ /* C = 2 | 3 | 4 */
} else if (avc_3d_extension_flag) {
slice_header_in_3davc_extension() /* specified in Annex J */ /* C = 2 */
slice_data_in_3davc_extension() /* specified in Annex J */ /* C = 2 | 3 | 4 */
} else {
slice_header() /* C = 2 */
slice_data() /* C = 2 | 3 | 4 */
}
rbsp_slice_trailing_bits() /* C = 2 */
}
function slice_header() {
first_mb_in_slice = DESC('ue(v)') /* C = 2 */
slice_type = DESC('ue(v)') /* C = 2 */
pic_parameter_set_id = DESC('ue(v)') /* C = 2 */
if (separate_colour_plane_flag == 1)
colour_plane_id = DESC('u(2)') /* C = 2 */
frame_num = DESC('u(v)') /* C = 2 */
if (!frame_mbs_only_flag) {
field_pic_flag = DESC('u(1)') /* C = 2 */
if (field_pic_flag)
bottom_field_flag = DESC('u(1)') /* C = 2 */
}
if (IdrPicFlag)
idr_pic_id = DESC('ue(v)') /* C = 2 */
if (pic_order_cnt_type == 0) {
pic_order_cnt_lsb = DESC('u(v)') /* C = 2 */
if (bottom_field_pic_order_in_frame_present_flag && !field_pic_flag)
delta_pic_order_cnt_bottom = DESC('se(v)') /* C = 2 */
}
if (pic_order_cnt_type == 1 && !delta_pic_order_always_zero_flag) {
delta_pic_order_cnt[0] = DESC('se(v)') /* C = 2 */
if (bottom_field_pic_order_in_frame_present_flag && !field_pic_flag)
delta_pic_order_cnt[1] = DESC('se(v)') /* C = 2 */
}
if (redundant_pic_cnt_present_flag)
redundant_pic_cnt = DESC('ue(v)') /* C = 2 */
if (slice_type == B)
direct_spatial_mv_pred_flag = DESC('u(1)') /* C = 2 */
if (slice_type == P || slice_type == SP || slice_type == B) {
num_ref_idx_active_override_flag = DESC('u(1)') /* C = 2 */
if (num_ref_idx_active_override_flag) {
num_ref_idx_l0_active_minus1 = DESC('ue(v)') /* C = 2 */
if (slice_type == B)
num_ref_idx_l1_active_minus1 = DESC('ue(v)') /* C = 2 */
}
}
if (nal_unit_type == 20 || nal_unit_type == 21)
ref_pic_list_mvc_modification() /* specified in Annex G */ /* C = 2 */
else
ref_pic_list_modification() /* C = 2 */
if ((weighted_pred_flag && (slice_type == P || slice_type == SP)) || (weighted_bipred_idc == 1 && slice_type == B))
pred_weight_table() /* C = 2 */
if (nal_ref_idc != 0)
dec_ref_pic_marking() /* C = 2 */
if (entropy_coding_mode_flag && slice_type != I && slice_type != SI)
cabac_init_idc = DESC('ue(v)') /* C = 2 */
slice_qp_delta = DESC('se(v)') /* C = 2 */
if (slice_type == SP || slice_type == SI) {
if (slice_type == SP)
sp_for_switch_flag = DESC('u(1)') /* C = 2 */
slice_qs_delta = DESC('se(v)') /* C = 2 */
}
if (deblocking_filter_control_present_flag) {
disable_deblocking_filter_idc = DESC('ue(v)') /* C = 2 */
if (disable_deblocking_filter_idc != 1) {
slice_alpha_c0_offset_div2 = DESC('se(v)') /* C = 2 */
slice_beta_offset_div2 = DESC('se(v)') /* C = 2 */
}
}
if (num_slice_groups_minus1 > 0 && slice_group_map_type >= 3 && slice_group_map_type <= 5)
slice_group_change_cycle = DESC('u(v)') /* C = 2 */
}
function ref_pic_list_modification() {
if (slice_type % 5 != 2 && slice_type % 5 != 4) {
ref_pic_list_modification_flag_l0 = DESC('u(1)') /* C = 2 */
if (ref_pic_list_modification_flag_l0)
do {
modification_of_pic_nums_idc = DESC('ue(v)') /* C = 2 */
if (modification_of_pic_nums_idc == 0 || modification_of_pic_nums_idc == 1)
abs_diff_pic_num_minus1 = DESC('ue(v)') /* C = 2 */
else if (modification_of_pic_nums_idc == 2)
long_term_pic_num = DESC('ue(v)') /* C = 2 */
} while (modification_of_pic_nums_idc != 3)
}
if (slice_type % 5 == 1) {
ref_pic_list_modification_flag_l1 = DESC('u(1)') /* C = 2 */
if (ref_pic_list_modification_flag_l1)
do {
modification_of_pic_nums_idc = DESC('ue(v)') /* C = 2 */
if (modification_of_pic_nums_idc == 0 || modification_of_pic_nums_idc == 1)
abs_diff_pic_num_minus1 = DESC('ue(v)') /* C = 2 */
else if (modification_of_pic_nums_idc == 2)
long_term_pic_num = DESC('ue(v)') /* C = 2 */
} while (modification_of_pic_nums_idc != 3)
}
}
function pred_weight_table() {
luma_log2_weight_denom = DESC('ue(v)') /* C = 2 */
if (ChromaArrayType != 0)
chroma_log2_weight_denom = DESC('ue(v)') /* C = 2 */
for (i = 0; i <= num_ref_idx_l0_active_minus1; i++) {
luma_weight_l0_flag = DESC('u(1)') /* C = 2 */
if (luma_weight_l0_flag) {
luma_weight_l0[i] = DESC('se(v)') /* C = 2 */
luma_offset_l0[i] = DESC('se(v)') /* C = 2 */
}
if (ChromaArrayType != 0) {
chroma_weight_l0_flag = DESC('u(1)') /* C = 2 */
if (chroma_weight_l0_flag)
for (j = 0; j < 2; j++) {
chroma_weight_l0[i][j] = DESC('se(v)') /* C = 2 */
chroma_offset_l0[i][j] = DESC('se(v)') /* C = 2 */
}
}
}
if (slice_type % 5 == 1)
for (i = 0; i <= num_ref_idx_l1_active_minus1; i++) {
luma_weight_l1_flag = DESC('u(1)') /* C = 2 */
if (luma_weight_l1_flag) {
luma_weight_l1[i] = DESC('se(v)') /* C = 2 */
luma_offset_l1[i] = DESC('se(v)') /* C = 2 */
}
if (ChromaArrayType != 0) {
chroma_weight_l1_flag = DESC('u(1)') /* C = 2 */
if (chroma_weight_l1_flag)
for (j = 0; j < 2; j++) {
chroma_weight_l1[i][j] = DESC('se(v)') /* C = 2 */
chroma_offset_l1[i][j] = DESC('se(v)') /* C = 2 */
}
}
}
}
function dec_ref_pic_marking() {
if (IdrPicFlag) {
no_output_of_prior_pics_flag = DESC('u(1)') /* C = 2 | 5 */
long_term_reference_flag = DESC('u(1)') /* C = 2 | 5 */
} else {
adaptive_ref_pic_marking_mode_flag = DESC('u(1)') /* C = 2 | 5 */
if (adaptive_ref_pic_marking_mode_flag)
do {
memory_management_control_operation = DESC('ue(v)') /* C = 2 | 5 */
if (memory_management_control_operation == 1 || memory_management_control_operation == 3)
difference_of_pic_nums_minus1 = DESC('ue(v)') /* C = 2 | 5 */
if (memory_management_control_operation == 2)
long_term_pic_num = DESC('ue(v)') /* C = 2 | 5 */
if (memory_management_control_operation == 3 || memory_management_control_operation == 6)
long_term_frame_idx = DESC('ue(v)') /* C = 2 | 5 */
if (memory_management_control_operation == 4)
max_long_term_frame_idx_plus1 = DESC('ue(v)') /* C = 2 | 5 */
} while (memory_management_control_operation != 0)
}
}
function slice_data() {
if (entropy_coding_mode_flag)
while (!byte_aligned())
cabac_alignment_one_bit = DESC('f(1)') /* C = 2 */
CurrMbAddr = first_mb_in_slice * (1 + MbaffFrameFlag)
moreDataFlag = 1
prevMbSkipped = 0
do {
if (slice_type != I && slice_type != SI)
if (!entropy_coding_mode_flag) {
mb_skip_run = DESC('ue(v)') /* C = 2 */
prevMbSkipped = (mb_skip_run > 0)
for (i = 0; i < mb_skip_run; i++)
CurrMbAddr = NextMbAddress(CurrMbAddr)
if (mb_skip_run > 0)
moreDataFlag = more_rbsp_data()
} else {
mb_skip_flag = DESC('ae(v)') /* C = 2 */
moreDataFlag = !mb_skip_flag
}
if (moreDataFlag) {
if (MbaffFrameFlag && (CurrMbAddr % 2 == 0 || (CurrMbAddr % 2 == 1 && prevMbSkipped)))
mb_field_decoding_flag = DESC('u(1) | ae(v)') /* C = 2 */
macroblock_layer() /* C = 2 | 3 | 4 */
}
if (!entropy_coding_mode_flag)
moreDataFlag = more_rbsp_data()
else {
if (slice_type != I && slice_type != SI)
prevMbSkipped = mb_skip_flag
if (MbaffFrameFlag && CurrMbAddr % 2 == 0)
moreDataFlag = 1
else {
end_of_slice_flag = DESC('ae(v)') /* C = 2 */
moreDataFlag = !end_of_slice_flag
}
}
CurrMbAddr = NextMbAddress(CurrMbAddr)
} while (moreDataFlag)
}
function macroblock_layer() {
mb_type = DESC('ue(v) | ae(v)') /* C = 2 */
if (mb_type == I_PCM) {
while (!byte_aligned())
pcm_alignment_zero_bit = DESC('f(1)') /* C = 3 */
for (i = 0; i < 256; i++)
pcm_sample_luma[i] = DESC('u(v)') /* C = 3 */
for (i = 0; i < 2 * MbWidthC * MbHeightC; i++)
pcm_sample_chroma[i] = DESC('u(v)') /* C = 3 */
} else {
noSubMbPartSizeLessThan8x8Flag = 1
if (mb_type != I_NxN &&
MbPartPredMode(mb_type, 0) != Intra_16x16 &&
NumMbPart(mb_type) == 4) {
sub_mb_pred(mb_type) /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8) {
if (NumSubMbPart(sub_mb_type[mbPartIdx]) > 1)
noSubMbPartSizeLessThan8x8Flag = 0
} else if (!direct_8x8_inference_flag)
noSubMbPartSizeLessThan8x8Flag = 0
} else {
if (transform_8x8_mode_flag && mb_type == I_NxN)
transform_size_8x8_flag = DESC('u(1) | ae(v)') /* C = 2 */
mb_pred(mb_type) /* C = 2 */
}
if (MbPartPredMode(mb_type, 0) != Intra_16x16) {
coded_block_pattern = DESC('me(v) | ae(v)') /* C = 2 */
if (CodedBlockPatternLuma > 0 &&
transform_8x8_mode_flag && mb_type != I_NxN &&
noSubMbPartSizeLessThan8x8Flag &&
(mb_type != B_Direct_16x16 || direct_8x8_inference_flag))
transform_size_8x8_flag = DESC('u(1) | ae(v)') /* C = 2 */
}
if (CodedBlockPatternLuma > 0 || CodedBlockPatternChroma > 0 ||
MbPartPredMode(mb_type, 0) == Intra_16x16) {
mb_qp_delta = DESC('se(v) | ae(v)') /* C = 2 */
residual(0, 15) /* C = 3 | 4 */
}
}
}
function mb_pred(mb_type) {
if (MbPartPredMode(mb_type, 0) == Intra_4x4 || MbPartPredMode(mb_type, 0) == Intra_8x8 || MbPartPredMode(mb_type, 0) == Intra_16x16) {
if (MbPartPredMode(mb_type, 0) == Intra_4x4)
for (luma4x4BlkIdx = 0; luma4x4BlkIdx < 16; luma4x4BlkIdx++) {
prev_intra4x4_pred_mode_flag[luma4x4BlkIdx] = DESC('u(1) | ae(v)') /* C = 2 */
if (!prev_intra4x4_pred_mode_flag[luma4x4BlkIdx])
rem_intra4x4_pred_mode[luma4x4BlkIdx] = DESC('u(3) | ae(v)') /* C = 2 */
}
if (MbPartPredMode(mb_type, 0) == Intra_8x8)
for (luma8x8BlkIdx = 0; luma8x8BlkIdx < 4; luma8x8BlkIdx++) {
prev_intra8x8_pred_mode_flag[luma8x8BlkIdx] = DESC('u(1) | ae(v)') /* C = 2 */
if (!prev_intra8x8_pred_mode_flag[luma8x8BlkIdx])
rem_intra8x8_pred_mode[luma8x8BlkIdx] = DESC('u(3) | ae(v)') /* C = 2 */
}
if (ChromaArrayType == 1 || ChromaArrayType == 2)
intra_chroma_pred_mode = DESC('ue(v) | ae(v)') /* C = 2 */
} else if (MbPartPredMode(mb_type, 0) != Direct) {
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if ((num_ref_idx_l0_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && MbPartPredMode(mb_type, mbPartIdx) != Pred_L1)
ref_idx_l0[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if ((num_ref_idx_l1_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && MbPartPredMode(mb_type, mbPartIdx) != Pred_L0)
ref_idx_l1[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if (MbPartPredMode(mb_type, mbPartIdx) != Pred_L1)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l0[mbPartIdx][0][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if (MbPartPredMode(mb_type, mbPartIdx) != Pred_L0)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l1[mbPartIdx][0][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
}
}
function sub_mb_pred(mb_type) {
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
sub_mb_type[mbPartIdx] = DESC('ue(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if ((num_ref_idx_l0_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && mb_type != P_8x8ref0 && sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L1)
ref_idx_l0[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if ((num_ref_idx_l1_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L0)
ref_idx_l1[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L1)
for (subMbPartIdx = 0; subMbPartIdx < NumSubMbPart(sub_mb_type[mbPartIdx]); subMbPartIdx++)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l0[mbPartIdx][subMbPartIdx][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L0)
for (subMbPartIdx = 0; subMbPartIdx < NumSubMbPart(sub_mb_type[mbPartIdx]); subMbPartIdx++)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l1[mbPartIdx][subMbPartIdx][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
}
function residual(startIdx, endIdx) {
if (!entropy_coding_mode_flag)
residual_block = residual_block_cavlc
else
residual_block = residual_block_cabac
residual_luma(i16x16DClevel, i16x16AClevel, level4x4, level8x8, startIdx, endIdx) /* C = 3 | 4 */
Intra16x16DCLevel = i16x16DClevel
Intra16x16ACLevel = i16x16AClevel
LumaLevel4x4 = level4x4
LumaLevel8x8 = level8x8
if (ChromaArrayType == 1 || ChromaArrayType == 2) {
NumC8x8 = 4 / (SubWidthC * SubHeightC)
for (iCbCr = 0; iCbCr < 2; iCbCr++)
if ((CodedBlockPatternChroma & 3) && startIdx == 0) /* chroma DC residual present */
residual_block(ChromaDCLevel[iCbCr], 0, 4 * NumC8x8 - 1, 4 * NumC8x8) /* C = 3 | 4 */
else
for (i = 0; i < 4 * NumC8x8; i++)
ChromaDCLevel[iCbCr][i] = 0
for (iCbCr = 0; iCbCr < 2; iCbCr++)
for (i8x8 = 0; i8x8 < NumC8x8; i8x8++)
for (i4x4 = 0; i4x4 < 4; i4x4++)
if (CodedBlockPatternChroma & 2) /* chroma AC residual present */
residual_block(ChromaACLevel[iCbCr][i8x8 * 4 + i4x4], Max(0, startIdx - 1), endIdx - 1, 15) /* C = 3 | 4 */
else
for (i = 0; i < 15; i++)
ChromaACLevel[iCbCr][i8x8 * 4 + i4x4][i] = 0
} else if (ChromaArrayType == 3) {
residual_luma(i16x16DClevel, i16x16AClevel, level4x4, level8x8, startIdx, endIdx) /* C = 3 | 4 */
CbIntra16x16DCLevel = i16x16DClevel
CbIntra16x16ACLevel = i16x16AClevel
CbLevel4x4 = level4x4
CbLevel8x8 = level8x8
residual_luma(i16x16DClevel, i16x16AClevel, level4x4, level8x8, startIdx, endIdx) /* C = 3 | 4 */
CrIntra16x16DCLevel = i16x16DClevel
CrIntra16x16ACLevel = i16x16AClevel
CrLevel4x4 = level4x4
CrLevel8x8 = level8x8
}
}
function residual_luma(i16x16DClevel, i16x16AClevel, level4x4, level8x8, startIdx, endIdx) {
if (startIdx == 0 && MbPartPredMode(mb_type, 0) == Intra_16x16)
residual_block(i16x16DClevel, 0, 15, 16) /* C = 3 */
for (i8x8 = 0; i8x8 < 4; i8x8++)
if (!transform_size_8x8_flag || !entropy_coding_mode_flag)
for (i4x4 = 0; i4x4 < 4; i4x4++) {
if (CodedBlockPatternLuma & (1 << i8x8))
if (MbPartPredMode(mb_type, 0) == Intra_16x16)
residual_block(i16x16AClevel[i8x8 * 4 + i4x4], Max(0, startIdx - 1), endIdx - 1, 15) /* C = 3 */
else
residual_block(level4x4[i8x8 * 4 + i4x4], startIdx, endIdx, 16) /* C = 3 | 4 */
else if (MbPartPredMode(mb_type, 0) == Intra_16x16)
for (i = 0; i < 15; i++)
i16x16AClevel[i8x8 * 4 + i4x4][i] = 0
else
for (i = 0; i < 16; i++)
level4x4[i8x8 * 4 + i4x4][i] = 0
if (!entropy_coding_mode_flag && transform_size_8x8_flag)
for (i = 0; i < 16; i++)
level8x8[i8x8][4 * i + i4x4] = level4x4[i8x8 * 4 + i4x4][i]
}
else if (CodedBlockPatternLuma & (1 << i8x8))
residual_block(level8x8[i8x8], 4 * startIdx, 4 * endIdx + 3, 64) /* C = 3 | 4 */
else
for (i = 0; i < 64; i++)
level8x8[i8x8][i] = 0
}
function residual_block_cavlc(coeffLevel, startIdx, endIdx, maxNumCoeff) {
for (i = 0; i < maxNumCoeff; i++)
coeffLevel[i] = 0
coeff_token = DESC('ce(v)') /* C = 3 | 4 */
if (TotalCoeff(coeff_token) > 0) {
if (TotalCoeff(coeff_token) > 10 && TrailingOnes(coeff_token) < 3)
suffixLength = 1
else
suffixLength = 0
for (i = 0; i < TotalCoeff(coeff_token); i++)
if (i < TrailingOnes(coeff_token)) {
trailing_ones_sign_flag = DESC('u(1)') /* C = 3 | 4 */
levelVal[i] = 1 - 2 * trailing_ones_sign_flag
} else {
level_prefix = DESC('ce(v)') /* C = 3 | 4 */
levelCode = (Min(15, level_prefix) << suffixLength)
if (suffixLength > 0 || level_prefix >= 14) {
level_suffix = DESC('u(v)') /* C = 3 | 4 */
levelCode += level_suffix
}
if (level_prefix >= 15 && suffixLength == 0)
levelCode += 15
if (level_prefix >= 16)
levelCode += (1 << (level_prefix - 3)) - 4096
if (i == TrailingOnes(coeff_token) && TrailingOnes(coeff_token) < 3)
levelCode += 2
if (levelCode % 2 == 0)
levelVal[i] = (levelCode + 2) >> 1
else
levelVal[i] = (-levelCode - 1) >> 1
if (suffixLength == 0)
suffixLength = 1
if (Abs(levelVal[i]) > (3 << (suffixLength - 1)) && suffixLength < 6)
suffixLength++
}
if (TotalCoeff(coeff_token) < endIdx - startIdx + 1) {
total_zeros = DESC('ce(v)') /* C = 3 | 4 */
zerosLeft = total_zeros
} else
zerosLeft = 0
for (i = 0; i < TotalCoeff(coeff_token) - 1; i++) {
if (zerosLeft > 0) {
run_before = DESC('ce(v)') /* C = 3 | 4 */
runVal[i] = run_before
} else
runVal[i] = 0
zerosLeft = zerosLeft - runVal[i]
}
runVal[TotalCoeff(coeff_token) - 1] = zerosLeft
coeffNum = -1
for (i = TotalCoeff(coeff_token) - 1; i >= 0; i--) {
coeffNum += runVal[i] + 1
coeffLevel[startIdx + coeffNum] = levelVal[i]
}
}
}
function residual_block_cabac(coeffLevel, startIdx, endIdx, maxNumCoeff) {
if (maxNumCoeff != 64 || ChromaArrayType == 3)
coded_block_flag = DESC('ae(v)') /* C = 3 | 4 */
for (i = 0; i < maxNumCoeff; i++)
coeffLevel[i] = 0
if (coded_block_flag) {
numCoeff = endIdx + 1
i = startIdx
while (i < numCoeff - 1) {
significant_coeff_flag[i] = DESC('ae(v)') /* C = 3 | 4 */
if (significant_coeff_flag[i]) {
last_significant_coeff_flag[i] = DESC('ae(v)') /* C = 3 | 4 */
if (last_significant_coeff_flag[i])
numCoeff = i + 1
}
i++
}
coeff_abs_level_minus1[numCoeff - 1] = DESC('ae(v)') /* C = 3 | 4 */
coeff_sign_flag[numCoeff - 1] = DESC('ae(v)') /* C = 3 | 4 */
coeffLevel[numCoeff - 1] = (coeff_abs_level_minus1[numCoeff - 1] + 1) * (1 - 2 * coeff_sign_flag[numCoeff - 1])
for (i = numCoeff - 2; i >= startIdx; i--)
if (significant_coeff_flag[i]) {
coeff_abs_level_minus1[i] = DESC('ae(v)') /* C = 3 | 4 */
coeff_sign_flag[i] = DESC('ae(v)') /* C = 3 | 4 */
coeffLevel[i] = (coeff_abs_level_minus1[i] + 1) * (1 - 2 * coeff_sign_flag[i])
}
}
}
function sei_payload(payloadType, payloadSize) {
if (payloadType == 0)
buffering_period(payloadSize) /* C = 5 */
else if (payloadType == 1)
pic_timing(payloadSize) /* C = 5 */
else if (payloadType == 2)
pan_scan_rect(payloadSize) /* C = 5 */
else if (payloadType == 3)
filler_payload(payloadSize) /* C = 5 */
else if (payloadType == 4)
user_data_registered_itu_t_t35(payloadSize) /* C = 5 */
else if (payloadType == 5)
user_data_unregistered(payloadSize) /* C = 5 */
else if (payloadType == 6)
recovery_point(payloadSize) /* C = 5 */
else if (payloadType == 7)
dec_ref_pic_marking_repetition(payloadSize) /* C = 5 */
else if (payloadType == 8)
spare_pic(payloadSize) /* C = 5 */
else if (payloadType == 9)
scene_info(payloadSize) /* C = 5 */
else if (payloadType == 10)
sub_seq_info(payloadSize) /* C = 5 */
else if (payloadType == 11)
sub_seq_layer_characteristics(payloadSize) /* C = 5 */
else if (payloadType == 12)
sub_seq_characteristics(payloadSize) /* C = 5 */
else if (payloadType == 13)
full_frame_freeze(payloadSize) /* C = 5 */
else if (payloadType == 14)
full_frame_freeze_release(payloadSize) /* C = 5 */
else if (payloadType == 15)
full_frame_snapshot(payloadSize) /* C = 5 */
else if (payloadType == 16)
progressive_refinement_segment_start(payloadSize) /* C = 5 */
else if (payloadType == 17)
progressive_refinement_segment_end(payloadSize) /* C = 5 */
else if (payloadType == 18)
motion_constrained_slice_group_set(payloadSize) /* C = 5 */
else if (payloadType == 19)
film_grain_characteristics(payloadSize) /* C = 5 */
else if (payloadType == 20)
deblocking_filter_display_preference(payloadSize) /* C = 5 */
else if (payloadType == 21)
stereo_video_info(payloadSize) /* C = 5 */
else if (payloadType == 22)
post_filter_hint(payloadSize) /* C = 5 */
else if (payloadType == 23)
tone_mapping_info(payloadSize) /* C = 5 */
else if (payloadType == 24)
scalability_info(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 25)
sub_pic_scalable_layer(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 26)
non_required_layer_rep(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 27)
priority_layer_info(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 28)
layers_not_present(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 29)
layer_dependency_change(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 30)
scalable_nesting(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 31)
base_layer_temporal_hrd(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 32)
quality_layer_integrity_check(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 33)
redundant_pic_property(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 34)
tl0_dep_rep_index(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 35)
tl_switching_point(payloadSize) /* specified in Annex F */ /* C = 5 */
else if (payloadType == 36)
parallel_decoding_info(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 37)
mvc_scalable_nesting(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 38)
view_scalability_info(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 39)
multiview_scene_info(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 40)
multiview_acquisition_info(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 41)
non_required_view_component(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 42)
view_dependency_change(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 43)
operation_points_not_present(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 44)
base_view_temporal_hrd(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 45)
frame_packing_arrangement(payloadSize) /* C = 5 */
else if (payloadType == 46)
multiview_view_position(payloadSize) /* specified in Annex G */ /* C = 5 */
else if (payloadType == 47)
display_orientation(payloadSize) /* C = 5 */
else if (payloadType == 48)
mvcd_scalable_nesting(payloadSize) /* specified in Annex H */ /* C = 5 */
else if (payloadType == 49)
mvcd_view_scalability_info(payloadSize) /* specified in Annex H */ /* C = 5 */
else if (payloadType == 50)
depth_representation_info(payloadSize) /* specified in Annex H */ /* C = 5 */
else if (payloadType == 51)
three_dimensional_reference_displays_info(payloadSize) /* specified in Annex H */ /* C = 5 */
else if (payloadType == 52)
depth_timing(payloadSize) /* specified in Annex H */ /* C = 5 */
else if (payloadType == 53)
depth_sampling_info(payloadSize) /* specified in Annex H */ /* C = 5 */
else if (payloadType == 54)
constrained_depth_parameter_set_identifier(payloadSize) /* specified in Annex I */ /* C = 5 */
else if (payloadType == 56)
green_metadata(payloadSize) /* specified in ISO/IEC 23001-11 */ /* C = 5 */
else if (payloadType == 137)
mastering_display_colour_volume(payloadSize) /* C = 5 */
else if (payloadType == 142)
colour_remapping_info(payloadSize) /* C = 5 */
else if (payloadType == 144)
content_light_level_info(payloadSize) /* C = 5 */
else if (payloadType == 147)
alternative_transfer_characteristics(payloadSize) /* C = 5 */
else if (payloadType == 148)
ambient_viewing_environment(payloadSize) /* C = 5 */
else if (payloadType == 149)
content_colour_volume(payloadSize) /* C = 5 */
else if (payloadType == 150)
equirectangular_projection(payloadSize) /* C = 5 */
else if (payloadType == 151)
cubemap_projection(payloadSize) /* C = 5 */
else if (payloadType == 154)
sphere_rotation(payloadSize) /* C = 5 */
else if (payloadType == 155)
regionwise_packing(payloadSize) /* C = 5 */
else if (payloadType == 156)
omni_viewport(payloadSize) /* C = 5 */
else if (payloadType == 181)
alternative_depth_info(payloadSize) /* specified in Annex H */ /* C = 5 */
else if (payloadType == 200)
sei_manifest(payloadSize) /* C = 5 */
else if (payloadType == 201)
sei_prefix_indication(payloadSize) /* C = 5 */
else if (payloadType == 202)
annotated_regions(payloadSize) /* specified in Rec. ITU-T H.274 | ISO/IEC 23002-7 */ /* C = 5 */
else if (payloadType == 210)
nn_post_filter_characteristics(payloadSize) /* specified in Rec. ITU-T H.274 | ISO/IEC 23002-7 */ /* C = 5 */
else if (payloadType == 211)
nn_post_filter_activation(payloadSize) /* specified in Rec. ITU-T H.274 | ISO/IEC 23002-7 */ /* C = 5 */
else if (payloadType == 212)
phase_indication(payloadSize) /* specified in Rec. ITU-T H.274 | ISO/IEC 23002-7 */ /* C = 5 */
else if (payloadType == 205)
shutter_interval_info(payloadSize) /* C = 5 */
else
reserved_sei_message(payloadSize) /* C = 5 */
if (!byte_aligned()) {
bit_equal_to_one /* equal to 1 */ = DESC('f(1)') /* C = 5 */
while (!byte_aligned())
bit_equal_to_zero /* equal to 0 */ = DESC('f(1)') /* C = 5 */
}
}
function buffering_period(payloadSize) {
seq_parameter_set_id = DESC('ue(v)') /* C = 5 */
if (NalHrdBpPresentFlag)
for (SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++) {
initial_cpb_removal_delay[SchedSelIdx] = DESC('u(v)') /* C = 5 */
initial_cpb_removal_delay_offset[SchedSelIdx] = DESC('u(v)') /* C = 5 */
}
if (VclHrdBpPresentFlag)
for (SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++) {
initial_cpb_removal_delay[SchedSelIdx] = DESC('u(v)') /* C = 5 */
initial_cpb_removal_delay_offset[SchedSelIdx] = DESC('u(v)') /* C = 5 */
}
}
function pic_timing(payloadSize) {
if (CpbDpbDelaysPresentFlag) {
cpb_removal_delay = DESC('u(v)') /* C = 5 */
dpb_output_delay = DESC('u(v)') /* C = 5 */
}
if (pic_struct_present_flag) {
pic_struct = DESC('u(4)') /* C = 5 */
for (i = 0; i < NumClockTS; i++) {
clock_timestamp_flag[i] = DESC('u(1)') /* C = 5 */
if (clock_timestamp_flag[i]) {
ct_type = DESC('u(2)') /* C = 5 */
nuit_field_based_flag = DESC('u(1)') /* C = 5 */
counting_type = DESC('u(5)') /* C = 5 */
full_timestamp_flag = DESC('u(1)') /* C = 5 */
discontinuity_flag = DESC('u(1)') /* C = 5 */
cnt_dropped_flag = DESC('u(1)') /* C = 5 */
n_frames = DESC('u(8)') /* C = 5 */
if (full_timestamp_flag) {
seconds_value /* 0..59 */ = DESC('u(6)') /* C = 5 */
minutes_value /* 0..59 */ = DESC('u(6)') /* C = 5 */
hours_value /* 0..23 */ = DESC('u(5)') /* C = 5 */
} else {
seconds_flag = DESC('u(1)') /* C = 5 */
if (seconds_flag) {
seconds_value /* range 0..59 */ = DESC('u(6)') /* C = 5 */
minutes_flag = DESC('u(1)') /* C = 5 */
if (minutes_flag) {
minutes_value /* 0..59 */ = DESC('u(6)') /* C = 5 */
hours_flag = DESC('u(1)') /* C = 5 */
if (hours_flag)
hours_value /* 0..23 */ = DESC('u(5)') /* C = 5 */
}
}
}
if (time_offset_length > 0)
time_offset = DESC('i(v)') /* C = 5 */
}
}
}
}
function pan_scan_rect(payloadSize) {
pan_scan_rect_id = DESC('ue(v)') /* C = 5 */
pan_scan_rect_cancel_flag = DESC('u(1)') /* C = 5 */
if (!pan_scan_rect_cancel_flag) {
pan_scan_cnt_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= pan_scan_cnt_minus1; i++) {
pan_scan_rect_left_offset[i] = DESC('se(v)') /* C = 5 */
pan_scan_rect_right_offset[i] = DESC('se(v)') /* C = 5 */
pan_scan_rect_top_offset[i] = DESC('se(v)') /* C = 5 */
pan_scan_rect_bottom_offset[i] = DESC('se(v)') /* C = 5 */
}
pan_scan_rect_repetition_period = DESC('ue(v)') /* C = 5 */
}
}
function filler_payload(payloadSize) {
for (k = 0; k < payloadSize; k++)
ff_byte /* equal to 0xFF */ = DESC('f(8)') /* C = 5 */
}
function user_data_registered_itu_t_t35(payloadSize) {
itu_t_t35_country_code = DESC('b(8)') /* C = 5 */
if (itu_t_t35_country_code != 0xFF)
i = 1
else {
itu_t_t35_country_code_extension_byte = DESC('b(8)') /* C = 5 */
i = 2
}
do {
itu_t_t35_payload_byte = DESC('b(8)') /* C = 5 */
i++
} while (i < payloadSize)
}
function user_data_unregistered(payloadSize) {
uuid_iso_iec_11578 = DESC('u(128)') /* C = 5 */
for (i = 16; i < payloadSize; i++)
user_data_payload_byte = DESC('b(8)') /* C = 5 */
}
function recovery_point(payloadSize) {
recovery_frame_cnt = DESC('ue(v)') /* C = 5 */
exact_match_flag = DESC('u(1)') /* C = 5 */
broken_link_flag = DESC('u(1)') /* C = 5 */
changing_slice_group_idc = DESC('u(2)') /* C = 5 */
}
function dec_ref_pic_marking_repetition(payloadSize) {
original_idr_flag = DESC('u(1)') /* C = 5 */
original_frame_num = DESC('ue(v)') /* C = 5 */
if (!frame_mbs_only_flag) {
original_field_pic_flag = DESC('u(1)') /* C = 5 */
if (original_field_pic_flag)
original_bottom_field_flag = DESC('u(1)') /* C = 5 */
}
dec_ref_pic_marking() /* C = 5 */
}
function spare_pic(payloadSize) {
target_frame_num = DESC('ue(v)') /* C = 5 */
spare_field_flag = DESC('u(1)') /* C = 5 */
if (spare_field_flag)
target_bottom_field_flag = DESC('u(1)') /* C = 5 */
num_spare_pics_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i < num_spare_pics_minus1 + 1; i++) {
delta_spare_frame_num[i] = DESC('ue(v)') /* C = 5 */
if (spare_field_flag)
spare_bottom_field_flag[i] = DESC('u(1)') /* C = 5 */
spare_area_idc[i] = DESC('ue(v)') /* C = 5 */
if (spare_area_idc[i] == 1)
for (j = 0; j < PicSizeInMapUnits; j++)
spare_unit_flag[i][j] = DESC('u(1)') /* C = 5 */
else if (spare_area_idc[i] == 2) {
mapUnitCnt = 0
for (j = 0; mapUnitCnt < PicSizeInMapUnits; j++) {
zero_run_length[i][j] = DESC('ue(v)') /* C = 5 */
mapUnitCnt += zero_run_length[i][j] + 1
}
}
}
}
function scene_info(payloadSize) {
scene_info_present_flag = DESC('u(1)') /* C = 5 */
if (scene_info_present_flag) {
scene_id = DESC('ue(v)') /* C = 5 */
scene_transition_type = DESC('ue(v)') /* C = 5 */
if (scene_transition_type > 3)
second_scene_id = DESC('ue(v)') /* C = 5 */
}
}
function sub_seq_info(payloadSize) {
sub_seq_layer_num = DESC('ue(v)') /* C = 5 */
sub_seq_id = DESC('ue(v)') /* C = 5 */
first_ref_pic_flag = DESC('u(1)') /* C = 5 */
leading_non_ref_pic_flag = DESC('u(1)') /* C = 5 */
last_pic_flag = DESC('u(1)') /* C = 5 */
sub_seq_frame_num_flag = DESC('u(1)') /* C = 5 */
if (sub_seq_frame_num_flag)
sub_seq_frame_num = DESC('ue(v)') /* C = 5 */
}
function sub_seq_layer_characteristics(payloadSize) {
num_sub_seq_layers_minus1 = DESC('ue(v)') /* C = 5 */
for (layer = 0; layer <= num_sub_seq_layers_minus1; layer++) {
accurate_statistics_flag = DESC('u(1)') /* C = 5 */
average_bit_rate = DESC('u(16)') /* C = 5 */
average_frame_rate = DESC('u(16)') /* C = 5 */
}
}
function sub_seq_characteristics(payloadSize) {
sub_seq_layer_num = DESC('ue(v)') /* C = 5 */
sub_seq_id = DESC('ue(v)') /* C = 5 */
duration_flag = DESC('u(1)') /* C = 5 */
if (duration_flag)
sub_seq_duration = DESC('u(32)') /* C = 5 */
average_rate_flag = DESC('u(1)') /* C = 5 */
if (average_rate_flag) {
accurate_statistics_flag = DESC('u(1)') /* C = 5 */
average_bit_rate = DESC('u(16)') /* C = 5 */
average_frame_rate = DESC('u(16)') /* C = 5 */
}
num_referenced_subseqs = DESC('ue(v)') /* C = 5 */
for (n = 0; n < num_referenced_subseqs; n++) {
ref_sub_seq_layer_num = DESC('ue(v)') /* C = 5 */
ref_sub_seq_id = DESC('ue(v)') /* C = 5 */
ref_sub_seq_direction = DESC('u(1)') /* C = 5 */
}
}
function full_frame_freeze(payloadSize) {
full_frame_freeze_repetition_period = DESC('ue(v)') /* C = 5 */
}
function full_frame_freeze_release(payloadSize) {
}
function full_frame_snapshot(payloadSize) {
snapshot_id = DESC('ue(v)') /* C = 5 */
}
function progressive_refinement_segment_start(payloadSize) {
progressive_refinement_id = DESC('ue(v)') /* C = 5 */
num_refinement_steps_minus1 = DESC('ue(v)') /* C = 5 */
}
function progressive_refinement_segment_end(payloadSize) {
progressive_refinement_id = DESC('ue(v)') /* C = 5 */
}
function motion_constrained_slice_group_set(payloadSize) {
num_slice_groups_in_set_minus1 = DESC('ue(v)') /* C = 5 */
if (num_slice_groups_minus1 > 0)
for (i = 0; i <= num_slice_groups_in_set_minus1; i++)
slice_group_id[i] = DESC('u(v)') /* C = 5 */
exact_sample_value_match_flag = DESC('u(1)') /* C = 5 */
pan_scan_rect_flag = DESC('u(1)') /* C = 5 */
if (pan_scan_rect_flag)
pan_scan_rect_id = DESC('ue(v)') /* C = 5 */
}
function film_grain_characteristics(payloadSize) {
film_grain_characteristics_cancel_flag = DESC('u(1)') /* C = 5 */
if (!film_grain_characteristics_cancel_flag) {
film_grain_model_id = DESC('u(2)') /* C = 5 */
separate_colour_description_present_flag = DESC('u(1)') /* C = 5 */
if (separate_colour_description_present_flag) {
film_grain_bit_depth_luma_minus8 = DESC('u(3)') /* C = 5 */
film_grain_bit_depth_chroma_minus8 = DESC('u(3)') /* C = 5 */
film_grain_full_range_flag = DESC('u(1)') /* C = 5 */
film_grain_colour_primaries = DESC('u(8)') /* C = 5 */
film_grain_transfer_characteristics = DESC('u(8)') /* C = 5 */
film_grain_matrix_coefficients = DESC('u(8)') /* C = 5 */
}
blending_mode_id = DESC('u(2)') /* C = 5 */
log2_scale_factor = DESC('u(4)') /* C = 5 */
for (c = 0; c < 3; c++)
comp_model_present_flag[c] = DESC('u(1)') /* C = 5 */
for (c = 0; c < 3; c++)
if (comp_model_present_flag[c]) {
num_intensity_intervals_minus1[c] = DESC('u(8)') /* C = 5 */
num_model_values_minus1[c] = DESC('u(3)') /* C = 5 */
for (i = 0; i <= num_intensity_intervals_minus1[c]; i++) {
intensity_interval_lower_bound[c][i] = DESC('u(8)') /* C = 5 */
intensity_interval_upper_bound[c][i] = DESC('u(8)') /* C = 5 */
for (j = 0; j <= num_model_values_minus1[c]; j++)
comp_model_value[c][i][j] = DESC('se(v)') /* C = 5 */
}
}
film_grain_characteristics_repetition_period = DESC('ue(v)') /* C = 5 */
}
}
function deblocking_filter_display_preference(payloadSize) {
deblocking_display_preference_cancel_flag = DESC('u(1)') /* C = 5 */
if (!deblocking_display_preference_cancel_flag) {
display_prior_to_deblocking_preferred_flag = DESC('u(1)') /* C = 5 */
dec_frame_buffering_constraint_flag = DESC('u(1)') /* C = 5 */
deblocking_display_preference_repetition_period = DESC('ue(v)') /* C = 5 */
}
}
function stereo_video_info(payloadSize) {
field_views_flag = DESC('u(1)') /* C = 5 */
if (field_views_flag)
top_field_is_left_view_flag = DESC('u(1)') /* C = 5 */
else {
current_frame_is_left_view_flag = DESC('u(1)') /* C = 5 */
next_frame_is_second_view_flag = DESC('u(1)') /* C = 5 */
}
left_view_self_contained_flag = DESC('u(1)') /* C = 5 */
right_view_self_contained_flag = DESC('u(1)') /* C = 5 */
}
function post_filter_hint(payloadSize) {
filter_hint_size_y = DESC('ue(v)') /* C = 5 */
filter_hint_size_x = DESC('ue(v)') /* C = 5 */
filter_hint_type = DESC('u(2)') /* C = 5 */
for (cIdx = 0; cIdx < 3; cIdx++)
for (cy = 0; cy < filter_hint_size_y; cy++)
for (cx = 0; cx < filter_hint_size_x; cx++)
filter_hint_value[cIdx][cx][cy] = DESC('se(v)') /* C = 5 */
additional_extension_flag = DESC('u(1)') /* C = 5 */
}
function tone_mapping_info(payloadSize) {
tone_map_id = DESC('ue(v)') /* C = 5 */
tone_map_cancel_flag = DESC('u(1)') /* C = 5 */
if (!tone_map_cancel_flag) {
tone_map_repetition_period = DESC('ue(v)') /* C = 5 */
coded_data_bit_depth = DESC('u(8)') /* C = 5 */
target_bit_depth = DESC('u(8)') /* C = 5 */
tone_map_model_id = DESC('ue(v)') /* C = 5 */
if (tone_map_model_id == 0) {
min_value = DESC('u(32)') /* C = 5 */
max_value = DESC('u(32)') /* C = 5 */
}
if (tone_map_model_id == 1) {
sigmoid_midpoint = DESC('u(32)') /* C = 5 */
sigmoid_width = DESC('u(32)') /* C = 5 */
}
if (tone_map_model_id == 2)
for (i = 0; i < (1 << target_bit_depth); i++)
start_of_coded_interval[i] = DESC('u(v)') /* C = 5 */
if (tone_map_model_id == 3) {
num_pivots = DESC('u(16)') /* C = 5 */
for (i = 0; i < num_pivots; i++) {
coded_pivot_value[i] = DESC('u(v)') /* C = 5 */
target_pivot_value[i] = DESC('u(v)') /* C = 5 */
}
}
if (tone_map_model_id == 4) {
camera_iso_speed_idc = DESC('u(8)') /* C = 5 */
if (camera_iso_speed_idc == Extended_ISO)
camera_iso_speed_value = DESC('u(32)') /* C = 5 */
exposure_index_idc = DESC('u(8)') /* C = 5 */
if (exposure_index_idc == Extended_ISO)
exposure_index_value = DESC('u(32)') /* C = 5 */
exposure_compensation_value_sign_flag = DESC('u(1)') /* C = 5 */
exposure_compensation_value_numerator = DESC('u(16)') /* C = 5 */
exposure_compensation_value_denom_idc = DESC('u(16)') /* C = 5 */
ref_screen_luminance_white = DESC('u(32)') /* C = 5 */
extended_range_white_level = DESC('u(32)') /* C = 5 */
nominal_black_level_luma_code_value = DESC('u(16)') /* C = 5 */
nominal_white_level_luma_code_value = DESC('u(16)') /* C = 5 */
extended_white_level_luma_code_value = DESC('u(16)') /* C = 5 */
}
}
}
function frame_packing_arrangement(payloadSize) {
frame_packing_arrangement_id = DESC('ue(v)') /* C = 5 */
frame_packing_arrangement_cancel_flag = DESC('u(1)') /* C = 5 */
if (!frame_packing_arrangement_cancel_flag) {
frame_packing_arrangement_type = DESC('u(7)') /* C = 5 */
quincunx_sampling_flag = DESC('u(1)') /* C = 5 */
content_interpretation_type = DESC('u(6)') /* C = 5 */
spatial_flipping_flag = DESC('u(1)') /* C = 5 */
frame0_flipped_flag = DESC('u(1)') /* C = 5 */
field_views_flag = DESC('u(1)') /* C = 5 */
current_frame_is_frame0_flag = DESC('u(1)') /* C = 5 */
frame0_self_contained_flag = DESC('u(1)') /* C = 5 */
frame1_self_contained_flag = DESC('u(1)') /* C = 5 */
if (!quincunx_sampling_flag && frame_packing_arrangement_type != 5) {
frame0_grid_position_x = DESC('u(4)') /* C = 5 */
frame0_grid_position_y = DESC('u(4)') /* C = 5 */
frame1_grid_position_x = DESC('u(4)') /* C = 5 */
frame1_grid_position_y = DESC('u(4)') /* C = 5 */
}
frame_packing_arrangement_reserved_byte = DESC('u(8)') /* C = 5 */
frame_packing_arrangement_repetition_period = DESC('ue(v)') /* C = 5 */
}
frame_packing_arrangement_extension_flag = DESC('u(1)') /* C = 5 */
}
function display_orientation(payloadSize) {
display_orientation_cancel_flag = DESC('u(1)') /* C = 5 */
if (!display_orientation_cancel_flag) {
hor_flip = DESC('u(1)') /* C = 5 */
ver_flip = DESC('u(1)') /* C = 5 */
anticlockwise_rotation = DESC('u(16)') /* C = 5 */
display_orientation_repetition_period = DESC('ue(v)') /* C = 5 */
display_orientation_extension_flag = DESC('u(1)') /* C = 5 */
}
}
function mastering_display_colour_volume(payloadSize) {
for (c = 0; c < 3; c++) {
display_primaries_x[c] = DESC('u(16)') /* C = 5 */
display_primaries_y[c] = DESC('u(16)') /* C = 5 */
}
white_point_x = DESC('u(16)') /* C = 5 */
white_point_y = DESC('u(16)') /* C = 5 */
max_display_mastering_luminance = DESC('u(32)') /* C = 5 */
min_display_mastering_luminance = DESC('u(32)') /* C = 5 */
}
function colour_remapping_info(payloadSize) {
colour_remap_id = DESC('ue(v)') /* C = 5 */
colour_remap_cancel_flag = DESC('u(1)') /* C = 5 */
if (!colour_remap_cancel_flag) {
colour_remap_repetition_period = DESC('ue(v)') /* C = 5 */
colour_remap_video_signal_info_present_flag = DESC('u(1)') /* C = 5 */
if (colour_remap_video_signal_info_present_flag) {
colour_remap_full_range_flag = DESC('u(1)') /* C = 5 */
colour_remap_primaries = DESC('u(8)') /* C = 5 */
colour_remap_transfer_function = DESC('u(8)') /* C = 5 */
colour_remap_matrix_coefficients = DESC('u(8)') /* C = 5 */
}
colour_remap_input_bit_depth = DESC('u(8)') /* C = 5 */
colour_remap_output_bit_depth = DESC('u(8)') /* C = 5 */
for (c = 0; c < 3; c++) {
pre_lut_num_val_minus1[c] = DESC('u(8)') /* C = 5 */
if (pre_lut_num_val_minus1[c] > 0)
for (i = 0; i <= pre_lut_num_val_minus1[c]; i++) {
pre_lut_coded_value[c][i] = DESC('u(v)') /* C = 5 */
pre_lut_target_value[c][i] = DESC('u(v)') /* C = 5 */
}
}
colour_remap_matrix_present_flag = DESC('u(1)') /* C = 5 */
if (colour_remap_matrix_present_flag) {
log2_matrix_denom = DESC('u(4)') /* C = 5 */
for (c = 0; c < 3; c++)
for (i = 0; i < 3; i++)
colour_remap_coeffs[c][i] = DESC('se(v)') /* C = 5 */
}
for (c = 0; c < 3; c++) {
post_lut_num_val_minus1[c] = DESC('u(8)') /* C = 5 */
if (post_lut_num_val_minus1[c] > 0)
for (i = 0; i <= post_lut_num_val_minus1[c]; i++) {
post_lut_coded_value[c][i] = DESC('u(v)') /* C = 5 */
post_lut_target_value[c][i] = DESC('u(v)') /* C = 5 */
}
}
}
}
function content_light_level_info(payloadSize) {
max_content_light_level = DESC('u(16)') /* C = 5 */
max_pic_average_light_level = DESC('u(16)') /* C = 5 */
}
function alternative_transfer_characteristics(payloadSize) {
preferred_transfer_characteristics = DESC('u(8)') /* C = 5 */
}
function content_colour_volume(payloadSize) {
ccv_cancel_flag = DESC('u(1)') /* C = 5 */
if (!ccv_cancel_flag) {
ccv_persistence_flag = DESC('u(1)') /* C = 5 */
ccv_primaries_present_flag = DESC('u(1)') /* C = 5 */
ccv_min_luminance_value_present_flag = DESC('u(1)') /* C = 5 */
ccv_max_luminance_value_present_flag = DESC('u(1)') /* C = 5 */
ccv_avg_luminance_value_present_flag = DESC('u(1)') /* C = 5 */
ccv_reserved_zero_2bits = DESC('u(2)') /* C = 5 */
if (ccv_primaries_present_flag)
for (c = 0; c < 3; c++) {
ccv_primaries_x[c] = DESC('i(32)') /* C = 5 */
ccv_primaries_y[c] = DESC('i(32)') /* C = 5 */
}
if (ccv_min_luminance_value_present_flag)
ccv_min_luminance_value = DESC('u(32)') /* C = 5 */
if (ccv_max_luminance_value_present_flag)
ccv_max_luminance_value = DESC('u(32)') /* C = 5 */
if (ccv_avg_luminance_value_present_flag)
ccv_avg_luminance_value = DESC('u(32)') /* C = 5 */
}
}
function ambient_viewing_environment(payloadSize) {
ambient_illuminance = DESC('u(32)') /* C = 5 */
ambient_light_x = DESC('u(16)') /* C = 5 */
ambient_light_y = DESC('u(16)') /* C = 5 */
}
function equirectangular_projection(payloadSize) {
erp_cancel_flag = DESC('u(1)') /* C = 5 */
if (!erp_cancel_flag) {
erp_persistence_flag = DESC('u(1)') /* C = 5 */
erp_padding_flag = DESC('u(1)') /* C = 5 */
erp_reserved_zero_2bits = DESC('u(2)') /* C = 5 */
if (erp_padding_flag == 1) {
gp_erp_type = DESC('u(3)') /* C = 5 */
left_gb_erp_width = DESC('u(8)') /* C = 5 */
right_gb_erp_width = DESC('u(8)') /* C = 5 */
}
}
}
function cubemap_projection(payloadSize) {
cmp_cancel_flag = DESC('u(1)') /* C = 5 */
if (!cmp_cancel_flag)
cmp_persistence_flag = DESC('u(1)') /* C = 5 */
}
function sphere_rotation(payloadSize) {
sphere_rotation_cancel_flag = DESC('u(1)') /* C = 5 */
if (!sphere_rotation_cancel_flag) {
sphere_rotation_persistence_flag = DESC('u(1)') /* C = 5 */
sphere_rotation_reserved_zero_6bits = DESC('u(6)') /* C = 5 */
yaw_rotation = DESC('i(32)') /* C = 5 */
pitch_rotation = DESC('i(32)') /* C = 5 */
roll_rotation = DESC('i(32)') /* C = 5 */
}
}
function regionwise_packing(payloadSize) {
rwp_cancel_flag = DESC('u(1)') /* C = 5 */
if (!rwp_cancel_flag) {
rwp_persistence_flag = DESC('u(1)') /* C = 5 */
constituent_picture_matching_flag = DESC('u(1)') /* C = 5 */
rwp_reserved_zero_5bits = DESC('u(5)') /* C = 5 */
num_packed_regions = DESC('u(8)') /* C = 5 */
proj_picture_width = DESC('u(32)') /* C = 5 */
proj_picture_height = DESC('u(32)') /* C = 5 */
packed_picture_width = DESC('u(16)') /* C = 5 */
packed_picture_height = DESC('u(16)') /* C = 5 */
for (i = 0; i < num_packed_regions; i++) {
rwp_reserved_zero_4bits[i] = DESC('u(4)') /* C = 5 */
transform_type[i] = DESC('u(3)') /* C = 5 */
guard_band_flag[i] = DESC('u(1)') /* C = 5 */
proj_region_width[i] = DESC('u(32)') /* C = 5 */
proj_region_height[i] = DESC('u(32)') /* C = 5 */
proj_region_top[i] = DESC('u(32)') /* C = 5 */
proj_region_left[i] = DESC('u(32)') /* C = 5 */
packed_region_width[i] = DESC('u(16)') /* C = 5 */
packed_region_height[i] = DESC('u(16)') /* C = 5 */
packed_region_top[i] = DESC('u(16)') /* C = 5 */
packed_region_left[i] = DESC('u(16)') /* C = 5 */
if (guard_band_flag[i]) {
left_gb_width[i] = DESC('u(8)') /* C = 5 */
right_gb_width[i] = DESC('u(8)') /* C = 5 */
top_gb_height[i] = DESC('u(8)') /* C = 5 */
bottom_gb_height[i] = DESC('u(8)') /* C = 5 */
gb_not_used_for_pred_flag[i] = DESC('u(1)') /* C = 5 */
for (j = 0; j < 4; j++)
gb_type[i][j] = DESC('u(3)') /* C = 5 */
rwp_gb_reserved_zero_3bits[i] = DESC('u(3)') /* C = 5 */
}
}
}
}
function omni_viewport(payloadSize) {
omni_viewport_id = DESC('u(10)') /* C = 5 */
omni_viewport_cancel_flag = DESC('u(1)') /* C = 5 */
if (!omni_viewport_cancel_flag) {
omni_viewport_persistence_flag = DESC('u(1)') /* C = 5 */
omni_viewport_cnt_minus1 = DESC('u(4)') /* C = 5 */
for (i = 0; i <= omni_viewport_cnt_minus1; i++) {
omni_viewport_azimuth_centre[i] = DESC('i(32)') /* C = 5 */
omni_viewport_elevation_centre[i] = DESC('i(32)') /* C = 5 */
omni_viewport_tilt_centre[i] = DESC('i(32)') /* C = 5 */
omni_viewport_hor_range[i] = DESC('u(32)') /* C = 5 */
omni_viewport_ver_range[i] = DESC('u(32)') /* C = 5 */
}
}
}
function sei_manifest(payloadSize) {
manifest_num_sei_msg_types = DESC('u(16)') /* C = 5 */
for (i = 0; i < manifest_num_sei_msg_types; i++) {
manifest_sei_payload_type[i] = DESC('u(16)') /* C = 5 */
manifest_sei_description[i] = DESC('u(8)') /* C = 5 */
}
}
function sei_prefix_indication(payloadSize) {
prefix_sei_payload_type = DESC('u(16)') /* C = 5 */
num_sei_prefix_indications_minus1 = DESC('u(8)') /* C = 5 */
for (i = 0; i <= num_sei_prefix_indications_minus1; i++) {
num_bits_in_prefix_indication_minus1[i] = DESC('u(16)') /* C = 5 */
for (j = 0; j <= num_bits_in_prefix_indication_minus1[i]; j++)
sei_prefix_data_bit[i][j] = DESC('u(1)') /* C = 5 */
while (!byte_aligned())
byte_alignment_bit_equal_to_one /* equal to 1 */ = DESC('f(1)') /* C = 5 */
}
}
function shutter_interval_info(payloadSize) {
sii_sub_layer_idx = DESC('ue(v)') /* C = 5 */
if (sii_sub_layer_idx == 0) {
shutter_interval_info_present_flag = DESC('u(1)') /* C = 5 */
if (shutter_interval_info_present_flag) {
sii_time_scale = DESC('u(32)') /* C = 5 */
fixed_shutter_interval_within_cvs_flag = DESC('u(1)') /* C = 5 */
if (fixed_shutter_interval_within_cvs_flag)
sii_num_units_in_shutter_interval = DESC('u(32)') /* C = 5 */
else {
sii_max_sub_layers_minus1 = DESC('u(3)') /* C = 5 */
for (i = 0; i <= sii_max_sub_layers_minus1; i++)
sub_layer_num_units_in_shutter_interval[i] = DESC('u(32)') /* C = 5 */
}
}
}
}
function reserved_sei_message(payloadSize) {
for (i = 0; i < payloadSize; i++)
reserved_sei_message_payload_byte = DESC('b(8)') /* C = 5 */
}
function vui_parameters() {
aspect_ratio_info_present_flag = DESC('u(1)') /* C = 0 */
if (aspect_ratio_info_present_flag) {
aspect_ratio_idc = DESC('u(8)') /* C = 0 */
if (aspect_ratio_idc == Extended_SAR) {
sar_width = DESC('u(16)') /* C = 0 */
sar_height = DESC('u(16)') /* C = 0 */
}
}
overscan_info_present_flag = DESC('u(1)') /* C = 0 */
if (overscan_info_present_flag)
overscan_appropriate_flag = DESC('u(1)') /* C = 0 */
video_signal_type_present_flag = DESC('u(1)') /* C = 0 */
if (video_signal_type_present_flag) {
video_format = DESC('u(3)') /* C = 0 */
video_full_range_flag = DESC('u(1)') /* C = 0 */
colour_description_present_flag = DESC('u(1)') /* C = 0 */
if (colour_description_present_flag) {
colour_primaries = DESC('u(8)') /* C = 0 */
transfer_characteristics = DESC('u(8)') /* C = 0 */
matrix_coefficients = DESC('u(8)') /* C = 0 */
}
}
chroma_loc_info_present_flag = DESC('u(1)') /* C = 0 */
if (chroma_loc_info_present_flag) {
chroma_sample_loc_type_top_field = DESC('ue(v)') /* C = 0 */
chroma_sample_loc_type_bottom_field = DESC('ue(v)') /* C = 0 */
}
timing_info_present_flag = DESC('u(1)') /* C = 0 */
if (timing_info_present_flag) {
num_units_in_tick = DESC('u(32)') /* C = 0 */
time_scale = DESC('u(32)') /* C = 0 */
fixed_frame_rate_flag = DESC('u(1)') /* C = 0 */
}
nal_hrd_parameters_present_flag = DESC('u(1)') /* C = 0 */
if (nal_hrd_parameters_present_flag)
hrd_parameters() /* C = 0 */
vcl_hrd_parameters_present_flag = DESC('u(1)') /* C = 0 */
if (vcl_hrd_parameters_present_flag)
hrd_parameters() /* C = 0 */
if (nal_hrd_parameters_present_flag || vcl_hrd_parameters_present_flag)
low_delay_hrd_flag = DESC('u(1)') /* C = 0 */
pic_struct_present_flag = DESC('u(1)') /* C = 0 */
bitstream_restriction_flag = DESC('u(1)') /* C = 0 */
if (bitstream_restriction_flag) {
motion_vectors_over_pic_boundaries_flag = DESC('u(1)') /* C = 0 */
max_bytes_per_pic_denom = DESC('ue(v)') /* C = 0 */
max_bits_per_mb_denom = DESC('ue(v)') /* C = 0 */
log2_max_mv_length_horizontal = DESC('ue(v)') /* C = 0 */
log2_max_mv_length_vertical = DESC('ue(v)') /* C = 0 */
max_num_reorder_frames = DESC('ue(v)') /* C = 0 */
max_dec_frame_buffering = DESC('ue(v)') /* C = 0 */
}
}
function hrd_parameters() {
cpb_cnt_minus1 = DESC('ue(v)') /* C = 0 | 5 */
bit_rate_scale = DESC('u(4)') /* C = 0 | 5 */
cpb_size_scale = DESC('u(4)') /* C = 0 | 5 */
for (SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++) {
bit_rate_value_minus1[SchedSelIdx] = DESC('ue(v)') /* C = 0 | 5 */
cpb_size_value_minus1[SchedSelIdx] = DESC('ue(v)') /* C = 0 | 5 */
cbr_flag[SchedSelIdx] = DESC('u(1)') /* C = 0 | 5 */
}
initial_cpb_removal_delay_length_minus1 = DESC('u(5)') /* C = 0 | 5 */
cpb_removal_delay_length_minus1 = DESC('u(5)') /* C = 0 | 5 */
dpb_output_delay_length_minus1 = DESC('u(5)') /* C = 0 | 5 */
time_offset_length = DESC('u(5)') /* C = 0 | 5 */
}
function nal_unit_header_svc_extension() {
idr_flag = DESC('u(1)') /* C = All */
priority_id = DESC('u(6)') /* C = All */
no_inter_layer_pred_flag = DESC('u(1)') /* C = All */
dependency_id = DESC('u(3)') /* C = All */
quality_id = DESC('u(4)') /* C = All */
temporal_id = DESC('u(3)') /* C = All */
use_ref_base_pic_flag = DESC('u(1)') /* C = All */
discardable_flag = DESC('u(1)') /* C = All */
output_flag = DESC('u(1)') /* C = All */
reserved_three_2bits = DESC('u(2)') /* C = All */
}
function seq_parameter_set_svc_extension() {
inter_layer_deblocking_filter_control_present_flag = DESC('u(1)') /* C = 0 */
extended_spatial_scalability_idc = DESC('u(2)') /* C = 0 */
if (ChromaArrayType == 1 || ChromaArrayType == 2)
chroma_phase_x_plus1_flag = DESC('u(1)') /* C = 0 */
if (ChromaArrayType == 1)
chroma_phase_y_plus1 = DESC('u(2)') /* C = 0 */
if (extended_spatial_scalability_idc == 1) {
if (ChromaArrayType > 0) {
seq_ref_layer_chroma_phase_x_plus1_flag = DESC('u(1)') /* C = 0 */
seq_ref_layer_chroma_phase_y_plus1 = DESC('u(2)') /* C = 0 */
}
seq_scaled_ref_layer_left_offset = DESC('se(v)') /* C = 0 */
seq_scaled_ref_layer_top_offset = DESC('se(v)') /* C = 0 */
seq_scaled_ref_layer_right_offset = DESC('se(v)') /* C = 0 */
seq_scaled_ref_layer_bottom_offset = DESC('se(v)') /* C = 0 */
}
seq_tcoeff_level_prediction_flag = DESC('u(1)') /* C = 0 */
if (seq_tcoeff_level_prediction_flag) {
adaptive_tcoeff_level_prediction_flag = DESC('u(1)') /* C = 0 */
}
slice_header_restriction_flag = DESC('u(1)') /* C = 0 */
}
function prefix_nal_unit_svc() {
if (nal_ref_idc != 0) {
store_ref_base_pic_flag = DESC('u(1)') /* C = 2 */
if ((use_ref_base_pic_flag || store_ref_base_pic_flag) && !idr_flag)
dec_ref_base_pic_marking() /* C = 2 */
additional_prefix_nal_unit_extension_flag = DESC('u(1)') /* C = 2 */
if (additional_prefix_nal_unit_extension_flag == 1)
while (more_rbsp_data())
additional_prefix_nal_unit_extension_data_flag = DESC('u(1)') /* C = 2 */
rbsp_trailing_bits() /* C = 2 */
} else if (more_rbsp_data()) {
while (more_rbsp_data())
additional_prefix_nal_unit_extension_data_flag = DESC('u(1)') /* C = 2 */
rbsp_trailing_bits() /* C = 2 */
}
}
function slice_header_in_scalable_extension() {
first_mb_in_slice = DESC('ue(v)') /* C = 2 */
slice_type = DESC('ue(v)') /* C = 2 */
pic_parameter_set_id = DESC('ue(v)') /* C = 2 */
if (separate_colour_plane_flag == 1)
colour_plane_id = DESC('u(2)') /* C = 2 */
frame_num = DESC('u(v)') /* C = 2 */
if (!frame_mbs_only_flag) {
field_pic_flag = DESC('u(1)') /* C = 2 */
if (field_pic_flag)
bottom_field_flag = DESC('u(1)') /* C = 2 */
}
if (idr_flag == 1)
idr_pic_id = DESC('ue(v)') /* C = 2 */
if (pic_order_cnt_type == 0) {
pic_order_cnt_lsb = DESC('u(v)') /* C = 2 */
if (bottom_field_pic_order_in_frame_present_flag && !field_pic_flag)
delta_pic_order_cnt_bottom = DESC('se(v)') /* C = 2 */
}
if (pic_order_cnt_type == 1 && !delta_pic_order_always_zero_flag) {
delta_pic_order_cnt[0] = DESC('se(v)') /* C = 2 */
if (bottom_field_pic_order_in_frame_present_flag && !field_pic_flag)
delta_pic_order_cnt[1] = DESC('se(v)') /* C = 2 */
}
if (redundant_pic_cnt_present_flag)
redundant_pic_cnt = DESC('ue(v)') /* C = 2 */
if (quality_id == 0) {
if (slice_type == EB)
direct_spatial_mv_pred_flag = DESC('u(1)') /* C = 2 */
if (slice_type == EP || slice_type == EB) {
num_ref_idx_active_override_flag = DESC('u(1)') /* C = 2 */
if (num_ref_idx_active_override_flag) {
num_ref_idx_l0_active_minus1 = DESC('ue(v)') /* C = 2 */
if (slice_type == EB)
num_ref_idx_l1_active_minus1 = DESC('ue(v)') /* C = 2 */
}
}
ref_pic_list_modification() /* C = 2 */
if ((weighted_pred_flag && slice_type == EP) || (weighted_bipred_idc == 1 && slice_type == EB)) {
if (!no_inter_layer_pred_flag)
base_pred_weight_table_flag = DESC('u(1)') /* C = 2 */
if (no_inter_layer_pred_flag || !base_pred_weight_table_flag)
pred_weight_table() /* C = 2 */
}
if (nal_ref_idc != 0) {
dec_ref_pic_marking() /* C = 2 */
if (!slice_header_restriction_flag) {
store_ref_base_pic_flag = DESC('u(1)') /* C = 2 */
if ((use_ref_base_pic_flag || store_ref_base_pic_flag) && !idr_flag)
dec_ref_base_pic_marking() /* C = 2 */
}
}
}
if (entropy_coding_mode_flag && slice_type != EI)
cabac_init_idc = DESC('ue(v)') /* C = 2 */
slice_qp_delta = DESC('se(v)') /* C = 2 */
if (deblocking_filter_control_present_flag) {
disable_deblocking_filter_idc = DESC('ue(v)') /* C = 2 */
if (disable_deblocking_filter_idc != 1) {
slice_alpha_c0_offset_div2 = DESC('se(v)') /* C = 2 */
slice_beta_offset_div2 = DESC('se(v)') /* C = 2 */
}
}
if (num_slice_groups_minus1 > 0 && slice_group_map_type >= 3 && slice_group_map_type <= 5)
slice_group_change_cycle = DESC('u(v)') /* C = 2 */
if (!no_inter_layer_pred_flag && quality_id == 0) {
ref_layer_dq_id = DESC('ue(v)') /* C = 2 */
if (inter_layer_deblocking_filter_control_present_flag) {
disable_inter_layer_deblocking_filter_idc = DESC('ue(v)') /* C = 2 */
if (disable_inter_layer_deblocking_filter_idc != 1) {
inter_layer_slice_alpha_c0_offset_div2 = DESC('se(v)') /* C = 2 */
inter_layer_slice_beta_offset_div2 = DESC('se(v)') /* C = 2 */
}
}
constrained_intra_resampling_flag = DESC('u(1)') /* C = 2 */
if (extended_spatial_scalability_idc == 2) {
if (ChromaArrayType > 0) {
ref_layer_chroma_phase_x_plus1_flag = DESC('u(1)') /* C = 2 */
ref_layer_chroma_phase_y_plus1 = DESC('u(2)') /* C = 2 */
}
scaled_ref_layer_left_offset = DESC('se(v)') /* C = 2 */
scaled_ref_layer_top_offset = DESC('se(v)') /* C = 2 */
scaled_ref_layer_right_offset = DESC('se(v)') /* C = 2 */
scaled_ref_layer_bottom_offset = DESC('se(v)') /* C = 2 */
}
}
if (!no_inter_layer_pred_flag) {
slice_skip_flag = DESC('u(1)') /* C = 2 */
if (slice_skip_flag)
num_mbs_in_slice_minus1 = DESC('ue(v)') /* C = 2 */
else {
adaptive_base_mode_flag = DESC('u(1)') /* C = 2 */
if (!adaptive_base_mode_flag)
default_base_mode_flag = DESC('u(1)') /* C = 2 */
if (!default_base_mode_flag) {
adaptive_motion_prediction_flag = DESC('u(1)') /* C = 2 */
if (!adaptive_motion_prediction_flag)
default_motion_prediction_flag = DESC('u(1)') /* C = 2 */
}
adaptive_residual_prediction_flag = DESC('u(1)') /* C = 2 */
if (!adaptive_residual_prediction_flag)
default_residual_prediction_flag = DESC('u(1)') /* C = 2 */
}
if (adaptive_tcoeff_level_prediction_flag)
tcoeff_level_prediction_flag = DESC('u(1)') /* C = 2 */
}
if (!slice_header_restriction_flag && !slice_skip_flag) {
scan_idx_start = DESC('u(4)') /* C = 2 */
scan_idx_end = DESC('u(4)') /* C = 2 */
}
}
function dec_ref_base_pic_marking() {
adaptive_ref_base_pic_marking_mode_flag = DESC('u(1)') /* C = 2 */
if (adaptive_ref_base_pic_marking_mode_flag)
do {
memory_management_base_control_operation = DESC('ue(v)') /* C = 2 */
if (memory_management_base_control_operation == 1)
difference_of_base_pic_nums_minus1 = DESC('ue(v)') /* C = 2 */
if (memory_management_base_control_operation == 2)
long_term_base_pic_num = DESC('ue(v)') /* C = 2 */
} while (memory_management_base_control_operation != 0)
}
function slice_data_in_scalable_extension() {
if (entropy_coding_mode_flag)
while (!byte_aligned())
cabac_alignment_one_bit = DESC('f(1)') /* C = 2 */
CurrMbAddr = first_mb_in_slice * (1 + MbaffFrameFlag)
moreDataFlag = 1
prevMbSkipped = 0
do {
if (slice_type != EI)
if (!entropy_coding_mode_flag) {
mb_skip_run = DESC('ue(v)') /* C = 2 */
prevMbSkipped = (mb_skip_run > 0)
for (i = 0; i < mb_skip_run; i++)
CurrMbAddr = NextMbAddress(CurrMbAddr)
if (mb_skip_run > 0)
moreDataFlag = more_rbsp_data()
} else {
mb_skip_flag = DESC('ae(v)') /* C = 2 */
moreDataFlag = !mb_skip_flag
}
if (moreDataFlag) {
if (MbaffFrameFlag && ((CurrMbAddr % 2) == 0 || ((CurrMbAddr % 2) == 1 && prevMbSkipped)))
mb_field_decoding_flag = DESC('u(1) | ae(v)') /* C = 2 */
macroblock_layer_in_scalable_extension() /* C = 2 | 3 | 4 */
}
if (!entropy_coding_mode_flag)
moreDataFlag = more_rbsp_data()
else {
if (slice_type != EI)
prevMbSkipped = mb_skip_flag
if (MbaffFrameFlag && (CurrMbAddr % 2) == 0)
moreDataFlag = 1
else {
end_of_slice_flag = DESC('ae(v)') /* C = 2 */
moreDataFlag = !end_of_slice_flag
}
}
CurrMbAddr = NextMbAddress(CurrMbAddr)
} while (moreDataFlag)
}
function macroblock_layer_in_scalable_extension() {
if (InCropWindow(CurrMbAddr) && adaptive_base_mode_flag)
base_mode_flag = DESC('u(1) | ae(v)') /* C = 2 */
if (!base_mode_flag)
mb_type = DESC('ue(v) | ae(v)') /* C = 2 */
if (mb_type == I_PCM) {
while (!byte_aligned())
pcm_alignment_zero_bit = DESC('f(1)') /* C = 3 */
for (i = 0; i < 256; i++)
pcm_sample_luma[i] = DESC('u(v)') /* C = 3 */
for (i = 0; i < 2 * MbWidthC * MbHeightC; i++)
pcm_sample_chroma[i] = DESC('u(v)') /* C = 3 */
} else {
if (!base_mode_flag) {
noSubMbPartSizeLessThan8x8Flag = 1
if (mb_type != I_NxN &&
MbPartPredMode(mb_type, 0) != Intra_16x16 &&
NumMbPart(mb_type) == 4) {
sub_mb_pred_in_scalable_extension(mb_type) /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8) {
if (NumSubMbPart(sub_mb_type[mbPartIdx]) > 1)
noSubMbPartSizeLessThan8x8Flag = 0
} else if (!direct_8x8_inference_flag)
noSubMbPartSizeLessThan8x8Flag = 0
} else {
if (transform_8x8_mode_flag && mb_type == I_NxN)
transform_size_8x8_flag = DESC('u(1) | ae(v)') /* C = 2 */
mb_pred_in_scalable_extension(mb_type) /* C = 2 */
}
}
if (adaptive_residual_prediction_flag && slice_type != EI &&
InCropWindow(CurrMbAddr) &&
(base_mode_flag ||
(MbPartPredMode(mb_type, 0) != Intra_16x16 &&
MbPartPredMode(mb_type, 0) != Intra_8x8 &&
MbPartPredMode(mb_type, 0) != Intra_4x4)))
residual_prediction_flag = DESC('u(1) | ae(v)') /* C = 2 */
if (scan_idx_end >= scan_idx_start) {
if (base_mode_flag ||
MbPartPredMode(mb_type, 0) != Intra_16x16) {
coded_block_pattern = DESC('me(v) | ae(v)') /* C = 2 */
if (CodedBlockPatternLuma > 0 &&
transform_8x8_mode_flag &&
(base_mode_flag ||
(mb_type != I_NxN &&
noSubMbPartSizeLessThan8x8Flag &&
(mb_type != B_Direct_16x16 ||
direct_8x8_inference_flag))))
transform_size_8x8_flag = DESC('u(1) | ae(v)') /* C = 2 */
}
if (CodedBlockPatternLuma > 0 ||
CodedBlockPatternChroma > 0 ||
MbPartPredMode(mb_type, 0) == Intra_16x16) {
mb_qp_delta = DESC('se(v) | ae(v)') /* C = 2 */
residual(scan_idx_start, scan_idx_end) /* C = 3 | 4 */
}
}
}
}
function mb_pred_in_scalable_extension(mb_type) {
if (MbPartPredMode(mb_type, 0) == Intra_4x4 || MbPartPredMode(mb_type, 0) == Intra_8x8 || MbPartPredMode(mb_type, 0) == Intra_16x16) {
if (MbPartPredMode(mb_type, 0) == Intra_4x4)
for (luma4x4BlkIdx = 0; luma4x4BlkIdx < 16; luma4x4BlkIdx++) {
prev_intra4x4_pred_mode_flag[luma4x4BlkIdx] = DESC('u(1) | ae(v)') /* C = 2 */
if (!prev_intra4x4_pred_mode_flag[luma4x4BlkIdx])
rem_intra4x4_pred_mode[luma4x4BlkIdx] = DESC('u(3) | ae(v)') /* C = 2 */
}
if (MbPartPredMode(mb_type, 0) == Intra_8x8)
for (luma8x8BlkIdx = 0; luma8x8BlkIdx < 4; luma8x8BlkIdx++) {
prev_intra8x8_pred_mode_flag[luma8x8BlkIdx] = DESC('u(1) | ae(v)') /* C = 2 */
if (!prev_intra8x8_pred_mode_flag[luma8x8BlkIdx])
rem_intra8x8_pred_mode[luma8x8BlkIdx] = DESC('u(3) | ae(v)') /* C = 2 */
}
if (ChromaArrayType != 0)
intra_chroma_pred_mode = DESC('ue(v) | ae(v)') /* C = 2 */
} else if (MbPartPredMode(mb_type, 0) != Direct) {
if (InCropWindow(CurrMbAddr) && adaptive_motion_prediction_flag) {
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if (MbPartPredMode(mb_type, mbPartIdx) != Pred_L1)
motion_prediction_flag_l0[mbPartIdx] = DESC('u(1) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if (MbPartPredMode(mb_type, mbPartIdx) != Pred_L0)
motion_prediction_flag_l1[mbPartIdx] = DESC('u(1) | ae(v)') /* C = 2 */
}
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if ((num_ref_idx_l0_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && MbPartPredMode(mb_type, mbPartIdx) != Pred_L1 && !motion_prediction_flag_l0[mbPartIdx])
ref_idx_l0[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if ((num_ref_idx_l1_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && MbPartPredMode(mb_type, mbPartIdx) != Pred_L0 && !motion_prediction_flag_l1[mbPartIdx])
ref_idx_l1[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if (MbPartPredMode(mb_type, mbPartIdx) != Pred_L1)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l0[mbPartIdx][0][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if (MbPartPredMode(mb_type, mbPartIdx) != Pred_L0)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l1[mbPartIdx][0][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
}
}
function sub_mb_pred_in_scalable_extension(mb_type) {
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
sub_mb_type[mbPartIdx] = DESC('ue(v) | ae(v)') /* C = 2 */
if (InCropWindow(CurrMbAddr) && adaptive_motion_prediction_flag) {
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (SubMbPredMode(sub_mb_type[mbPartIdx]) != Direct && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L1)
motion_prediction_flag_l0[mbPartIdx] = DESC('u(1) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (SubMbPredMode(sub_mb_type[mbPartIdx]) != Direct && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L0)
motion_prediction_flag_l1[mbPartIdx] = DESC('u(1) | ae(v)') /* C = 2 */
}
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if ((num_ref_idx_l0_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && mb_type != P_8x8ref0 && sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L1 && !motion_prediction_flag_l0[mbPartIdx])
ref_idx_l0[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if ((num_ref_idx_l1_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L0 && !motion_prediction_flag_l1[mbPartIdx])
ref_idx_l1[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L1)
for (subMbPartIdx = 0; subMbPartIdx < NumSubMbPart(sub_mb_type[mbPartIdx]); subMbPartIdx++)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l0[mbPartIdx][subMbPartIdx][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L0)
for (subMbPartIdx = 0; subMbPartIdx < NumSubMbPart(sub_mb_type[mbPartIdx]); subMbPartIdx++)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l1[mbPartIdx][subMbPartIdx][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
}
function scalability_info(payloadSize) {
temporal_id_nesting_flag = DESC('u(1)') /* C = 5 */
priority_layer_info_present_flag = DESC('u(1)') /* C = 5 */
priority_id_setting_flag = DESC('u(1)') /* C = 5 */
num_layers_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_layers_minus1; i++) {
layer_id[i] = DESC('ue(v)') /* C = 5 */
priority_id[i] = DESC('u(6)') /* C = 5 */
discardable_flag[i] = DESC('u(1)') /* C = 5 */
dependency_id[i] = DESC('u(3)') /* C = 5 */
quality_id[i] = DESC('u(4)') /* C = 5 */
temporal_id[i] = DESC('u(3)') /* C = 5 */
sub_pic_layer_flag[i] = DESC('u(1)') /* C = 5 */
sub_region_layer_flag[i] = DESC('u(1)') /* C = 5 */
iroi_division_info_present_flag[i] = DESC('u(1)') /* C = 5 */
profile_level_info_present_flag[i] = DESC('u(1)') /* C = 5 */
bitrate_info_present_flag[i] = DESC('u(1)') /* C = 5 */
frm_rate_info_present_flag[i] = DESC('u(1)') /* C = 5 */
frm_size_info_present_flag[i] = DESC('u(1)') /* C = 5 */
layer_dependency_info_present_flag[i] = DESC('u(1)') /* C = 5 */
parameter_sets_info_present_flag[i] = DESC('u(1)') /* C = 5 */
bitstream_restriction_info_present_flag[i] = DESC('u(1)') /* C = 5 */
exact_inter_layer_pred_flag[i] = DESC('u(1)') /* C = 5 */
if (sub_pic_layer_flag[i] || iroi_division_info_present_flag[i])
exact_sample_value_match_flag[i] = DESC('u(1)') /* C = 5 */
layer_conversion_flag[i] = DESC('u(1)') /* C = 5 */
layer_output_flag[i] = DESC('u(1)') /* C = 5 */
if (profile_level_info_present_flag[i])
layer_profile_level_idc[i] = DESC('u(24)') /* C = 5 */
if (bitrate_info_present_flag[i]) {
avg_bitrate[i] = DESC('u(16)') /* C = 5 */
max_bitrate_layer[i] = DESC('u(16)') /* C = 5 */
max_bitrate_layer_representation[i] = DESC('u(16)') /* C = 5 */
max_bitrate_calc_window[i] = DESC('u(16)') /* C = 5 */
}
if (frm_rate_info_present_flag[i]) {
constant_frm_rate_idc[i] = DESC('u(2)') /* C = 5 */
avg_frm_rate[i] = DESC('u(16)') /* C = 5 */
}
if (frm_size_info_present_flag[i] || iroi_division_info_present_flag[i]) {
frm_width_in_mbs_minus1[i] = DESC('ue(v)') /* C = 5 */
frm_height_in_mbs_minus1[i] = DESC('ue(v)') /* C = 5 */
}
if (sub_region_layer_flag[i]) {
base_region_layer_id[i] = DESC('ue(v)') /* C = 5 */
dynamic_rect_flag[i] = DESC('u(1)') /* C = 5 */
if (!dynamic_rect_flag[i]) {
horizontal_offset[i] = DESC('u(16)') /* C = 5 */
vertical_offset[i] = DESC('u(16)') /* C = 5 */
region_width[i] = DESC('u(16)') /* C = 5 */
region_height[i] = DESC('u(16)') /* C = 5 */
}
}
if (sub_pic_layer_flag[i])
roi_id[i] = DESC('ue(v)') /* C = 5 */
if (iroi_division_info_present_flag[i]) {
iroi_grid_flag[i] = DESC('u(1)') /* C = 5 */
if (iroi_grid_flag[i]) {
grid_width_in_mbs_minus1[i] = DESC('ue(v)') /* C = 5 */
grid_height_in_mbs_minus1[i] = DESC('ue(v)') /* C = 5 */
} else {
num_rois_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_rois_minus1[i]; j++) {
first_mb_in_roi[i][j] = DESC('ue(v)') /* C = 5 */
roi_width_in_mbs_minus1[i][j] = DESC('ue(v)') /* C = 5 */
roi_height_in_mbs_minus1[i][j] = DESC('ue(v)') /* C = 5 */
}
}
}
if (layer_dependency_info_present_flag[i]) {
num_directly_dependent_layers[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < num_directly_dependent_layers[i]; j++)
directly_dependent_layer_id_delta_minus1[i][j] = DESC('ue(v)') /* C = 5 */
} else
layer_dependency_info_src_layer_id_delta[i] = DESC('ue(v)') /* C = 5 */
if (parameter_sets_info_present_flag[i]) {
num_seq_parameter_sets[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < num_seq_parameter_sets[i]; j++)
seq_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
num_subset_seq_parameter_sets[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < num_subset_seq_parameter_sets[i]; j++)
subset_seq_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
num_pic_parameter_sets_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_pic_parameter_sets_minus1[i]; j++)
pic_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
} else
parameter_sets_info_src_layer_id_delta[i] = DESC('ue(v)') /* C = 5 */
if (bitstream_restriction_info_present_flag[i]) {
motion_vectors_over_pic_boundaries_flag[i] = DESC('u(1)') /* C = 5 */
max_bytes_per_pic_denom[i] = DESC('ue(v)') /* C = 5 */
max_bits_per_mb_denom[i] = DESC('ue(v)') /* C = 5 */
log2_max_mv_length_horizontal[i] = DESC('ue(v)') /* C = 5 */
log2_max_mv_length_vertical[i] = DESC('ue(v)') /* C = 5 */
max_num_reorder_frames[i] = DESC('ue(v)') /* C = 5 */
max_dec_frame_buffering[i] = DESC('ue(v)') /* C = 5 */
}
if (layer_conversion_flag[i]) {
conversion_type_idc[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < 2; j++) {
rewriting_info_flag[i][j] = DESC('u(1)') /* C = 5 */
if (rewriting_info_flag[i][j]) {
rewriting_profile_level_idc[i][j] = DESC('u(24)') /* C = 5 */
rewriting_avg_bitrate[i][j] = DESC('u(16)') /* C = 5 */
rewriting_max_bitrate[i][j] = DESC('u(16)') /* C = 5 */
}
}
}
}
if (priority_layer_info_present_flag) {
pr_num_dids_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= pr_num_dids_minus1; i++) {
pr_dependency_id[i] = DESC('u(3)') /* C = 5 */
pr_num_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= pr_num_minus1[i]; j++) {
pr_id[i][j] = DESC('ue(v)') /* C = 5 */
pr_profile_level_idc[i][j] = DESC('u(24)') /* C = 5 */
pr_avg_bitrate[i][j] = DESC('u(16)') /* C = 5 */
pr_max_bitrate[i][j] = DESC('u(16)') /* C = 5 */
}
}
}
if (priority_id_setting_flag) {
PriorityIdSettingUriIdx = 0
do
priority_id_setting_uri[PriorityIdSettingUriIdx] = DESC('u(8)') /* C = 5 */
while (priority_id_setting_uri[PriorityIdSettingUriIdx++] != 0)
}
}
function sub_pic_scalable_layer(payloadSize) {
layer_id = DESC('ue(v)') /* C = 5 */
}
function non_required_layer_rep(payloadSize) {
num_info_entries_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_info_entries_minus1; i++) {
entry_dependency_id[i] = DESC('u(3)') /* C = 5 */
num_non_required_layer_reps_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_non_required_layer_reps_minus1[i]; j++) {
non_required_layer_rep_dependency_id[i][j] = DESC('u(3)') /* C = 5 */
non_required_layer_rep_quality_id[i][j] = DESC('u(4)') /* C = 5 */
}
}
}
function priority_layer_info(payloadSize) {
pr_dependency_id = DESC('u(3)') /* C = 5 */
num_priority_ids = DESC('u(4)') /* C = 5 */
for (i = 0; i < num_priority_ids; i++) {
alt_priority_id[i] = DESC('u(6)') /* C = 5 */
}
}
function layers_not_present(payloadSize) {
num_layers = DESC('ue(v)') /* C = 5 */
for (i = 0; i < num_layers; i++) {
layer_id[i] = DESC('ue(v)') /* C = 5 */
}
}
function layer_dependency_change(payloadSize) {
num_layers_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_layers_minus1; i++) {
layer_id[i] = DESC('ue(v)') /* C = 5 */
layer_dependency_info_present_flag[i] = DESC('u(1)') /* C = 5 */
if (layer_dependency_info_present_flag[i]) {
num_directly_dependent_layers[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < num_directly_dependent_layers[i]; j++)
directly_dependent_layer_id_delta_minus1[i][j] = DESC('ue(v)') /* C = 5 */
} else {
layer_dependency_info_src_layer_id_delta_minus1[i] = DESC('ue(v)') /* C = 5 */
}
}
}
function scalable_nesting(payloadSize) {
all_layer_representations_in_au_flag = DESC('u(1)') /* C = 5 */
if (all_layer_representations_in_au_flag == 0) {
num_layer_representations_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_layer_representations_minus1; i++) {
sei_dependency_id[i] = DESC('u(3)') /* C = 5 */
sei_quality_id[i] = DESC('u(4)') /* C = 5 */
}
sei_temporal_id = DESC('u(3)') /* C = 5 */
}
while (!byte_aligned())
sei_nesting_zero_bit /* equal to 0 */ = DESC('f(1)') /* C = 5 */
do
sei_message() /* C = 5 */
while (more_rbsp_data())
}
function base_layer_temporal_hrd(payloadSize) {
num_of_temporal_layers_in_base_layer_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_of_temporal_layers_in_base_layer_minus1; i++) {
sei_temporal_id[i] = DESC('u(3)') /* C = 5 */
sei_timing_info_present_flag[i] = DESC('u(1)') /* C = 5 */
if (sei_timing_info_present_flag[i]) {
sei_num_units_in_tick[i] = DESC('u(32)') /* C = 5 */
sei_time_scale[i] = DESC('u(32)') /* C = 5 */
sei_fixed_frame_rate_flag[i] = DESC('u(1)') /* C = 5 */
}
sei_nal_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 5 */
if (sei_nal_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 5 */
sei_vcl_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 5 */
if (sei_vcl_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 5 */
if (sei_nal_hrd_parameters_present_flag[i] || sei_vcl_hrd_parameters_present_flag[i])
sei_low_delay_hrd_flag[i] = DESC('u(1)') /* C = 5 */
sei_pic_struct_present_flag[i] = DESC('u(1)') /* C = 5 */
}
}
function quality_layer_integrity_check(payloadSize) {
num_info_entries_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_info_entries_minus1; i++) {
entry_dependency_id[i] = DESC('u(3)') /* C = 5 */
quality_layer_crc[i] = DESC('u(16)') /* C = 5 */
}
}
function redundant_pic_property(payloadSize) {
num_dIds_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_dIds_minus1; i++) {
dependency_id[i] = DESC('u(3)') /* C = 5 */
num_qIds_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_qIds_minus1[i]; j++) {
quality_id[i][j] = DESC('u(4)') /* C = 5 */
num_redundant_pics_minus1[i][j] = DESC('ue(v)') /* C = 5 */
for (k = 0; k <= num_redundant_pics_minus1[i][j]; k++) {
redundant_pic_cnt_minus1[i][j][k] = DESC('ue(v)') /* C = 5 */
pic_match_flag[i][j][k] = DESC('u(1)') /* C = 5 */
if (!pic_match_flag[i][j][k]) {
mb_type_match_flag[i][j][k] = DESC('u(1)') /* C = 5 */
motion_match_flag[i][j][k] = DESC('u(1)') /* C = 5 */
residual_match_flag[i][j][k] = DESC('u(1)') /* C = 5 */
intra_samples_match_flag[i][j][k] = DESC('u(1)') /* C = 5 */
}
}
}
}
}
function tl0_dep_rep_index(payloadSize) {
tl0_dep_rep_idx = DESC('u(8)') /* C = 5 */
effective_idr_pic_id = DESC('u(16)') /* C = 5 */
}
function tl_switching_point(payloadSize) {
delta_frame_num = DESC('se(v)') /* C = 5 */
}
function svc_vui_parameters_extension() {
vui_ext_num_entries_minus1 = DESC('ue(v)') /* C = 0 */
for (i = 0; i <= vui_ext_num_entries_minus1; i++) {
vui_ext_dependency_id[i] = DESC('u(3)') /* C = 0 */
vui_ext_quality_id[i] = DESC('u(4)') /* C = 0 */
vui_ext_temporal_id[i] = DESC('u(3)') /* C = 0 */
vui_ext_timing_info_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_ext_timing_info_present_flag[i]) {
vui_ext_num_units_in_tick[i] = DESC('u(32)') /* C = 0 */
vui_ext_time_scale[i] = DESC('u(32)') /* C = 0 */
vui_ext_fixed_frame_rate_flag[i] = DESC('u(1)') /* C = 0 */
}
vui_ext_nal_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_ext_nal_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 0 */
vui_ext_vcl_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_ext_vcl_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 0 */
if (vui_ext_nal_hrd_parameters_present_flag[i] || vui_ext_vcl_hrd_parameters_present_flag[i])
vui_ext_low_delay_hrd_flag[i] = DESC('u(1)') /* C = 0 */
vui_ext_pic_struct_present_flag[i] = DESC('u(1)') /* C = 0 */
}
}
function nal_unit_header_mvc_extension() {
non_idr_flag = DESC('u(1)') /* C = All */
priority_id = DESC('u(6)') /* C = All */
view_id = DESC('u(10)') /* C = All */
temporal_id = DESC('u(3)') /* C = All */
anchor_pic_flag = DESC('u(1)') /* C = All */
inter_view_flag = DESC('u(1)') /* C = All */
reserved_one_bit = DESC('u(1)') /* C = All */
}
function seq_parameter_set_mvc_extension() {
num_views_minus1 = DESC('ue(v)') /* C = 0 */
for (i = 0; i <= num_views_minus1; i++)
view_id[i] = DESC('ue(v)') /* C = 0 */
for (i = 1; i <= num_views_minus1; i++) {
num_anchor_refs_l0[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_anchor_refs_l0[i]; j++)
anchor_ref_l0[i][j] = DESC('ue(v)') /* C = 0 */
num_anchor_refs_l1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_anchor_refs_l1[i]; j++)
anchor_ref_l1[i][j] = DESC('ue(v)') /* C = 0 */
}
for (i = 1; i <= num_views_minus1; i++) {
num_non_anchor_refs_l0[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_non_anchor_refs_l0[i]; j++)
non_anchor_ref_l0[i][j] = DESC('ue(v)') /* C = 0 */
num_non_anchor_refs_l1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_non_anchor_refs_l1[i]; j++)
non_anchor_ref_l1[i][j] = DESC('ue(v)') /* C = 0 */
}
num_level_values_signalled_minus1 = DESC('ue(v)') /* C = 0 */
for (i = 0; i <= num_level_values_signalled_minus1; i++) {
level_idc[i] = DESC('u(8)') /* C = 0 */
num_applicable_ops_minus1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j <= num_applicable_ops_minus1[i]; j++) {
applicable_op_temporal_id[i][j] = DESC('u(3)') /* C = 0 */
applicable_op_num_target_views_minus1[i][j] = DESC('ue(v)') /* C = 0 */
for (k = 0; k <= applicable_op_num_target_views_minus1[i][j]; k++)
applicable_op_target_view_id[i][j][k] = DESC('ue(v)') /* C = 0 */
applicable_op_num_views_minus1[i][j] = DESC('ue(v)') /* C = 0 */
}
}
if (profile_idc == 134) {
mfc_format_idc = DESC('u(6)') /* C = 0 */
if (mfc_format_idc == 0 || mfc_format_idc == 1) {
default_grid_position_flag = DESC('u(1)') /* C = 0 */
if (!default_grid_position_flag) {
view0_grid_position_x = DESC('u(4)') /* C = 0 */
view0_grid_position_y = DESC('u(4)') /* C = 0 */
view1_grid_position_x = DESC('u(4)') /* C = 0 */
view1_grid_position_y = DESC('u(4)') /* C = 0 */
}
}
rpu_filter_enabled_flag = DESC('u(1)') /* C = 0 */
if (!frame_mbs_only_flag)
rpu_field_processing_flag = DESC('u(1)') /* C = 0 */
}
}
function ref_pic_list_mvc_modification() {
if (slice_type % 5 != 2 && slice_type % 5 != 4) {
ref_pic_list_modification_flag_l0 = DESC('u(1)') /* C = 2 */
if (ref_pic_list_modification_flag_l0)
do {
modification_of_pic_nums_idc = DESC('ue(v)') /* C = 2 */
if (modification_of_pic_nums_idc == 0 || modification_of_pic_nums_idc == 1)
abs_diff_pic_num_minus1 = DESC('ue(v)') /* C = 2 */
else if (modification_of_pic_nums_idc == 2)
long_term_pic_num = DESC('ue(v)') /* C = 2 */
else if (modification_of_pic_nums_idc == 4 || modification_of_pic_nums_idc == 5)
abs_diff_view_idx_minus1 = DESC('ue(v)') /* C = 2 */
} while (modification_of_pic_nums_idc != 3)
}
if (slice_type % 5 == 1) {
ref_pic_list_modification_flag_l1 = DESC('u(1)') /* C = 2 */
if (ref_pic_list_modification_flag_l1)
do {
modification_of_pic_nums_idc = DESC('ue(v)') /* C = 2 */
if (modification_of_pic_nums_idc == 0 || modification_of_pic_nums_idc == 1)
abs_diff_pic_num_minus1 = DESC('ue(v)') /* C = 2 */
else if (modification_of_pic_nums_idc == 2)
long_term_pic_num = DESC('ue(v)') /* C = 2 */
else if (modification_of_pic_nums_idc == 4 || modification_of_pic_nums_idc == 5)
abs_diff_view_idx_minus1 = DESC('ue(v)') /* C = 2 */
} while (modification_of_pic_nums_idc != 3)
}
}
function parallel_decoding_info(payloadSize) {
seq_parameter_set_id = DESC('ue(v)') /* C = 5 */
for (i = 1; i <= num_views_minus1; i++) {
if (anchor_pic_flag) {
for (j = 0; j <= num_anchor_refs_l0[i]; j++)
pdi_init_delay_anchor_minus2_l0[i][j] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_anchor_refs_l1[i]; j++)
pdi_init_delay_anchor_minus2_l1[i][j] = DESC('ue(v)') /* C = 5 */
}
else {
for (j = 0; j <= num_non_anchor_refs_l0[i]; j++)
pdi_init_delay_non_anchor_minus2_l0[i][j] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_non_anchor_refs_l1[i]; j++)
pdi_init_delay_non_anchor_minus2_l1[i][j] = DESC('ue(v)') /* C = 5 */
}
}
}
function mvc_scalable_nesting(payloadSize) {
operation_point_flag = DESC('u(1)') /* C = 5 */
if (!operation_point_flag) {
all_view_components_in_au_flag = DESC('u(1)') /* C = 5 */
if (!all_view_components_in_au_flag) {
num_view_components_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_view_components_minus1; i++)
sei_view_id[i] = DESC('u(10)') /* C = 5 */
}
} else {
num_view_components_op_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_view_components_op_minus1; i++)
sei_op_view_id[i] = DESC('u(10)') /* C = 5 */
sei_op_temporal_id = DESC('u(3)') /* C = 5 */
}
while (!byte_aligned())
sei_nesting_zero_bit /* equal to 0 */ = DESC('f(1)') /* C = 5 */
sei_message() /* C = 5 */
}
function view_scalability_info(payloadSize) {
num_operation_points_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_operation_points_minus1; i++) {
operation_point_id[i] = DESC('ue(v)') /* C = 5 */
priority_id[i] = DESC('u(5)') /* C = 5 */
temporal_id[i] = DESC('u(3)') /* C = 5 */
num_target_output_views_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_target_output_views_minus1[i]; j++)
view_id[i][j] = DESC('ue(v)') /* C = 5 */
profile_level_info_present_flag[i] = DESC('u(1)') /* C = 5 */
bitrate_info_present_flag[i] = DESC('u(1)') /* C = 5 */
frm_rate_info_present_flag[i] = DESC('u(1)') /* C = 5 */
if (!num_target_output_views_minus1[i])
view_dependency_info_present_flag[i] = DESC('u(1)') /* C = 5 */
parameter_sets_info_present_flag[i] = DESC('u(1)') /* C = 5 */
bitstream_restriction_info_present_flag[i] = DESC('u(1)') /* C = 5 */
if (profile_level_info_present_flag[i])
op_profile_level_idc[i] = DESC('u(24)') /* C = 5 */
if (bitrate_info_present_flag[i]) {
avg_bitrate[i] = DESC('u(16)') /* C = 5 */
max_bitrate[i] = DESC('u(16)') /* C = 5 */
max_bitrate_calc_window[i] = DESC('u(16)') /* C = 5 */
}
if (frm_rate_info_present_flag[i]) {
constant_frm_rate_idc[i] = DESC('u(2)') /* C = 5 */
avg_frm_rate[i] = DESC('u(16)') /* C = 5 */
}
if (view_dependency_info_present_flag[i]) {
num_directly_dependent_views[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < num_directly_dependent_views[i]; j++)
directly_dependent_view_id[i][j] = DESC('ue(v)') /* C = 5 */
} else
view_dependency_info_src_op_id[i] = DESC('ue(v)') /* C = 5 */
if (parameter_sets_info_present_flag[i]) {
num_seq_parameter_sets[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < num_seq_parameter_sets[i]; j++)
seq_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
num_subset_seq_parameter_sets[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < num_subset_seq_parameter_sets[i]; j++)
subset_seq_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
num_pic_parameter_sets_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_pic_parameter_sets_minus1[i]; j++)
pic_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
} else
parameter_sets_info_src_op_id[i] = DESC('ue(v)') /* C = 5 */
if (bitstream_restriction_info_present_flag[i]) {
motion_vectors_over_pic_boundaries_flag[i] = DESC('u(1)') /* C = 5 */
max_bytes_per_pic_denom[i] = DESC('ue(v)') /* C = 5 */
max_bits_per_mb_denom[i] = DESC('ue(v)') /* C = 5 */
log2_max_mv_length_horizontal[i] = DESC('ue(v)') /* C = 5 */
log2_max_mv_length_vertical[i] = DESC('ue(v)') /* C = 5 */
max_num_reorder_frames[i] = DESC('ue(v)') /* C = 5 */
max_dec_frame_buffering[i] = DESC('ue(v)') /* C = 5 */
}
}
}
function multiview_scene_info(payloadSize) {
max_disparity = DESC('ue(v)') /* C = 5 */
}
function multiview_acquisition_info(payloadSize) {
num_views_minus1 = DESC('ue(v)')
intrinsic_param_flag = DESC('u(1)') /* C = 5 */
extrinsic_param_flag = DESC('u(1)') /* C = 5 */
if (instrinsic_param_flag) {
intrinsic_params_equal_flag = DESC('u(1)') /* C = 5 */
prec_focal_length = DESC('ue(v)') /* C = 5 */
prec_principal_point = DESC('ue(v)') /* C = 5 */
prec_skew_factor = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= intrinsic_params_equal_flag ? 0 : num_views_minus1; i++) {
sign_focal_length_x[i] = DESC('u(1)') /* C = 5 */
exponent_focal_length_x[i] = DESC('u(6)') /* C = 5 */
mantissa_focal_length_x[i] = DESC('u(v)') /* C = 5 */
sign_focal_length_y[i] = DESC('u(1)') /* C = 5 */
exponent_focal_length_y[i] = DESC('u(6)') /* C = 5 */
mantissa_focal_length_y[i] = DESC('u(v)') /* C = 5 */
sign_principal_point_x[i] = DESC('u(1)') /* C = 5 */
exponent_principal_point_x[i] = DESC('u(6)') /* C = 5 */
mantissa_principal_point_x[i] = DESC('u(v)') /* C = 5 */
sign_principal_point_y[i] = DESC('u(1)') /* C = 5 */
exponent_principal_point_y[i] = DESC('u(6)') /* C = 5 */
mantissa_principal_point_y[i] = DESC('u(v)') /* C = 5 */
sign_skew_factor[i] = DESC('u(1)') /* C = 5 */
exponent_skew_factor[i] = DESC('u(6)') /* C = 5 */
mantissa_skew_factor[i] = DESC('u(v)') /* C = 5 */
}
}
if (extrinsic_param_flag) {
prec_rotation_param = DESC('ue(v)') /* C = 5 */
prec_translation_param = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_views_minus1; i++) {
for (j = 1; j <= 3; j++) { /* row */
for (k = 1; k <= 3; k++) { /* column */
sign_r[i][j][k] = DESC('u(1)') /* C = 5 */
exponent_r[i][j][k] = DESC('u(6)') /* C = 5 */
mantissa_r[i][j][k] = DESC('u(v)') /* C = 5 */
}
sign_t[i][j] = DESC('u(1)') /* C = 5 */
exponent_t[i][j] = DESC('u(6)') /* C = 5 */
mantissa_t[i][j] = DESC('u(v)') /* C = 5 */
}
}
}
}
function non_required_view_component(payloadSize) {
num_info_entries_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_info_entries_minus1; i++) {
view_order_index[i] = DESC('ue(v)') /* C = 5 */
num_non_required_view_components_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_non_required_view_components_minus1[i]; j++)
index_delta_minus1[i][j] = DESC('ue(v)') /* C = 5 */
}
}
function view_dependency_change(payloadSize) {
seq_parameter_set_id = DESC('ue(v)') /* C = 5 */
anchor_update_flag = DESC('u(1)') /* C = 5 */
non_anchor_update_flag = DESC('u(1)') /* C = 5 */
if (anchor_update_flag)
for (i = 1; i <= num_views_minus1; i++) {
for (j = 0; j < num_anchor_refs_l0[i]; j++)
anchor_ref_l0_flag[i][j] = DESC('u(1)') /* C = 5 */
for (j = 0; j < num_anchor_refs_l1[i]; j++)
anchor_ref_l1_flag[i][j] = DESC('u(1)') /* C = 5 */
}
if (non_anchor_update_flag)
for (i = 1; i <= num_views_minus1; i++) {
for (j = 0; j < num_non_anchor_refs_l0[i]; j++)
non_anchor_ref_l0_flag[i][j] = DESC('u(1)') /* C = 5 */
for (j = 0; j < num_non_anchor_refs_l1[i]; j++)
non_anchor_ref_l1_flag[i][j] = DESC('u(1)') /* C = 5 */
}
}
function operation_point_not_present(payloadSize) {
num_operation_points = DESC('ue(v)') /* C = 5 */
for (k = 0; k < num_operation_points; k++)
operation_point_not_present_id[k] = DESC('ue(v)') /* C = 5 */
}
function base_view_temporal_hrd(payloadSize) {
num_of_temporal_layers_in_base_view_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_of_temporal_layers_in_base_view_minus1; i++) {
sei_mvc_temporal_id[i] = DESC('u(3)') /* C = 5 */
sei_mvc_timing_info_present_flag[i] = DESC('u(1)') /* C = 5 */
if (sei_mvc_timing_info_present_flag[i]) {
sei_mvc_num_units_in_tick[i] = DESC('u(32)') /* C = 5 */
sei_mvc_time_scale[i] = DESC('u(32)') /* C = 5 */
sei_mvc_fixed_frame_rate_flag[i] = DESC('u(1)') /* C = 5 */
}
sei_mvc_nal_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 5 */
if (sei_mvc_nal_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 5 */
sei_mvc_vcl_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 5 */
if (sei_mvc_vcl_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 5 */
if (sei_mvc_nal_hrd_parameters_present_flag[i] || sei_mvc_vcl_hrd_parameters_present_flag[i])
sei_mvc_low_delay_hrd_flag[i] = DESC('u(1)') /* C = 5 */
sei_mvc_pic_struct_present_flag[i] = DESC('u(1)') /* C = 5 */
}
}
function multiview_view_position(payloadSize) {
num_views_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_views_minus1; i++)
view_position[i] = DESC('ue(v)') /* C = 5 */
multiview_view_position_extension_flag = DESC('u(1)') /* C = 5 */
}
function mvc_vui_parameters_extension() {
vui_mvc_num_ops_minus1 = DESC('ue(v)') /* C = 0 */
for (i = 0; i <= vui_mvc_num_ops_minus1; i++) {
vui_mvc_temporal_id[i] = DESC('u(3)') /* C = 0 */
vui_mvc_num_target_output_views_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= vui_mvc_num_target_output_views_minus1[i]; j++)
vui_mvc_view_id[i][j] = DESC('ue(v)') /* C = 5 */
vui_mvc_timing_info_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_mvc_timing_info_present_flag[i]) {
vui_mvc_num_units_in_tick[i] = DESC('u(32)') /* C = 0 */
vui_mvc_time_scale[i] = DESC('u(32)') /* C = 0 */
vui_mvc_fixed_frame_rate_flag[i] = DESC('u(1)') /* C = 0 */
}
vui_mvc_nal_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_mvc_nal_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 0 */
vui_mvc_vcl_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_mvc_vcl_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 0 */
if (vui_mvc_nal_hrd_parameters_present_flag[i] || vui_mvc_vcl_hrd_parameters_present_flag[i])
vui_mvc_low_delay_hrd_flag[i] = DESC('u(1)') /* C = 0 */
vui_mvc_pic_struct_present_flag[i] = DESC('u(1)') /* C = 0 */
}
}
function seq_parameter_set_mvcd_extension() {
num_views_minus1 = DESC('ue(v)') /* C = 0 */
for (i = 0, NumDepthViews = 0; i <= num_views_minus1; i++) {
view_id[i] = DESC('ue(v)') /* C = 0 */
depth_view_present_flag[i] = DESC('u(1)') /* C = 0 */
DepthViewId[NumDepthViews] = view_id[i]
NumDepthViews += depth_view_present_flag[i]
texture_view_present_flag[i] = DESC('u(1)') /* C = 0 */
}
for (i = 1; i <= num_views_minus1; i++)
if (depth_view_present_flag[i]) {
num_anchor_refs_l0[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_anchor_refs_l0[i]; j++)
anchor_ref_l0[i][j] = DESC('ue(v)') /* C = 0 */
num_anchor_refs_l1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_anchor_refs_l1[i]; j++)
anchor_ref_l1[i][j] = DESC('ue(v)') /* C = 0 */
}
for (i = 1; i <= num_views_minus1; i++)
if (depth_view_present_flag[i]) {
num_non_anchor_refs_l0[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_non_anchor_refs_l0[i]; j++)
non_anchor_ref_l0[i][j] = DESC('ue(v)') /* C = 0 */
num_non_anchor_refs_l1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_non_anchor_refs_l1[i]; j++)
non_anchor_ref_l1[i][j] = DESC('ue(v)') /* C = 0 */
}
num_level_values_signalled_minus1 = DESC('ue(v)') /* C = 0 */
for (i = 0; i <= num_level_values_signalled_minus1; i++) {
level_idc[i] = DESC('u(8)') /* C = 0 */
num_applicable_ops_minus1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j <= num_applicable_ops_minus1[i]; j++) {
applicable_op_temporal_id[i][j] = DESC('u(3)') /* C = 0 */
applicable_op_num_target_views_minus1[i][j] = DESC('ue(v)') /* C = 0 */
for (k = 0; k <= applicable_op_num_target_views_minus1[i][j]; k++) {
applicable_op_target_view_id[i][j][k] = DESC('ue(v)') /* C = 0 */
applicable_op_depth_flag[i][j][k] = DESC('u(1)') /* C = 0 */
applicable_op_texture_flag[i][j][k] = DESC('u(1)') /* C = 0 */
}
applicable_op_num_texture_views_minus1[i][j] = DESC('ue(v)') /* C = 0 */
applicable_op_num_depth_views[i][j] = DESC('ue(v)') /* C = 0 */
}
}
mvcd_vui_parameters_present_flag = DESC('u(1)') /* C = 0 */
if (mvcd_vui_parameters_present_flag == 1)
mvcd_vui_parameters_extension()
texture_vui_parameters_present_flag = DESC('u(1)') /* C = 0 */
if (texture_vui_parameters_present_flag == 1)
mvc_vui_parameters_extension() /* C = 0 */
}
function mvcd_view_scalability_info(payloadSize) {
num_operation_points_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_operation_points_minus1; i++) {
operation_point_id[i] = DESC('ue(v)') /* C = 5 */
priority_id[i] = DESC('u(5)') /* C = 5 */
temporal_id[i] = DESC('u(3)') /* C = 5 */
num_target_output_views_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_target_output_views_minus1[i]; j++) {
view_id[i][j] = DESC('ue(v)') /* C = 5 */
mvcd_op_view_info()
}
profile_level_info_present_flag[i] = DESC('u(1)') /* C = 5 */
bitrate_info_present_flag[i] = DESC('u(1)') /* C = 5 */
frm_rate_info_present_flag[i] = DESC('u(1)') /* C = 5 */
if (!num_target_output_views_minus1[i])
view_dependency_info_present_flag[i] = DESC('u(1)') /* C = 5 */
parameter_sets_info_present_flag[i] = DESC('u(1)') /* C = 5 */
bitstream_restriction_info_present_flag[i] = DESC('u(1)') /* C = 5 */
if (profile_level_info_present_flag[i])
op_profile_level_idc[i] = DESC('u(24)') /* C = 5 */
if (bitrate_info_present_flag[i]) {
avg_bitrate[i] = DESC('u(16)') /* C = 5 */
max_bitrate[i] = DESC('u(16)') /* C = 5 */
max_bitrate_calc_window[i] = DESC('u(16)') /* C = 5 */
}
if (frm_rate_info_present_flag[i]) {
constant_frm_rate_idc[i] = DESC('u(2)') /* C = 5 */
avg_frm_rate[i] = DESC('u(16)') /* C = 5 */
}
if (view_dependency_info_present_flag[i]) {
num_directly_dependent_views[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j < num_directly_dependent_views[i]; j++) {
directly_dependent_view_id[i][j] = DESC('ue(v)') /* C = 5 */
mvcd_op_view_info()
}
} else
view_dependency_info_src_op_id[i] = DESC('ue(v)') /* C = 5 */
if (parameter_sets_info_present_flag[i]) {
num_seq_parameter_set_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_seq_parameter_set_minus1[i]; j++)
seq_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
num_subset_seq_parameter_set_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_subset_seq_parameter_set_minus1[i]; j++)
subset_seq_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
num_pic_parameter_set_minus1[i] = DESC('ue(v)') /* C = 5 */
for (j = 0; j <= num_init_pic_parameter_set_minus1[i]; j++)
pic_parameter_set_id_delta[i][j] = DESC('ue(v)') /* C = 5 */
} else
parameter_sets_info_src_op_id[i] = DESC('ue(v)') /* C = 5 */
if (bitstream_restriction_info_present_flag[i]) {
motion_vectors_over_pic_boundaries_flag[i] = DESC('u(1)') /* C = 5 */
max_bytes_per_pic_denom[i] = DESC('ue(v)') /* C = 5 */
max_bits_per_mb_denom[i] = DESC('ue(v)') /* C = 5 */
log2_max_mv_length_horizontal[i] = DESC('ue(v)') /* C = 5 */
log2_max_mv_length_vertical[i] = DESC('ue(v)') /* C = 5 */
num_reorder_frames[i] = DESC('ue(v)') /* C = 5 */
max_dec_frame_buffering[i] = DESC('ue(v)') /* C = 5 */
}
}
}
function mvcd_op_view_info() {
view_info_depth_view_present_flag = DESC('u(1)') /* C = 5 */
if (view_info_depth_view_present_flag)
mvcd_depth_view_flag = DESC('u(1)') /* C = 5 */
view_info_texture_view_present_flag = DESC('u(1)') /* C = 5 */
if (view_info_texture_view_present_flag)
mvcd_texture_view_flag = DESC('u(1)') /* C = 5 */
}
function mvcd_scalable_nesting(payloadSize) {
operation_point_flag = DESC('u(1)') /* C = 5 */
if (!operation_point_flag) {
all_view_components_in_au_flag = DESC('u(1)') /* C = 5 */
if (!all_view_components_in_au_flag) {
num_view_components_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_view_components_minus1; i++) {
sei_view_id[i] = DESC('u(10)') /* C = 5 */
sei_view_applicability_flag[i] = DESC('u(1)') /* C = 5 */
}
}
} else {
sei_op_texture_only_flag = DESC('u(1)') /* C = 5 */
num_view_components_op_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_view_components_op_minus1; i++) {
sei_op_view_id[i] = DESC('u(10)') /* C = 5 */
if (!sei_op_texture_only_flag) {
sei_op_depth_flag[i] = DESC('u(1)')
sei_op_texture_flag[i] = DESC('u(1)')
}
}
sei_op_temporal_id = DESC('u(3)') /* C = 5 */
}
while (!byte_aligned())
sei_nesting_zero_bit /* equal to 0 */ = DESC('f(1)') /* C = 5 */
sei_message() /* C = 5 */
}
function depth_representation_info(payloadSize) {
all_views_equal_flag = DESC('u(1)') /* C = 5 */
if (all_views_equal_flag == 0) {
num_views_minus1 = DESC('ue(v)') /* C = 5 */
numViews = num_views_minus1 + 1
} else
numViews = 1
z_near_flag = DESC('u(1)') /* C = 5 */
z_far_flag = DESC('u(1)') /* C = 5 */
if (z_near_flag || z_far_flag) {
z_axis_equal_flag = DESC('u(1)') /* C = 5 */
if (z_axis_equal_flag)
common_z_axis_reference_view = DESC('ue(v)') /* C = 5 */
}
d_min_flag = DESC('u(1)') /* C = 5 */
d_max_flag = DESC('u(1)') /* C = 5 */
depth_representation_type = DESC('ue(v)') /* C = 5 */
for (i = 0; i < numViews; i++) {
depth_info_view_id[i] = DESC('ue(v)') /* C = 5 */
if ((z_near_flag || z_far_flag) && (z_axis_equal_flag == 0))
z_axis_reference_view[i] = DESC('ue(v)') /* C = 5 */
if (d_min_flag || d_max_flag)
disparity_reference_view[i] = DESC('ue(v)') /* C = 5 */
if (z_near_flag)
depth_representation_sei_element(ZNearSign, ZNearExp, ZNearMantissa, ZNearManLen)
if (z_far_flag)
depth_representation_sei_element(ZFarSign, ZFarExp, ZFarMantissa, ZFarManLen)
if (d_min_flag)
depth_representation_sei_element(DMinSign, DMinExp, DMinMantissa, DMinManLen)
if (d_max_flag)
depth_representation_sei_element(DMaxSign, DMaxExp, DMaxMantissa, DMaxManLen)
}
if (depth_representation_type == 3) {
depth_nonlinear_representation_num_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 1; i <= depth_nonlinear_representation_num_minus1 + 1; i++)
depth_nonlinear_representation_model[i] = DESC('ue(v)') /* C = 5 */
}
}
function depth_representation_sei_element(outSign, outExp, outMantissa, outManLen) {
da_sign_flag = DESC('u(1)') /* C = 5 */
da_exponent = DESC('u(7)') /* C = 5 */
da_mantissa_len_minus1 = DESC('u(5)') /* C = 5 */
da_mantissa = DESC('u(v)') /* C = 5 */
}
function three_dimensional_reference_displays_info(payloadSize) {
prec_ref_baseline = DESC('ue(v)') /* C = 5 */
prec_ref_display_width = DESC('ue(v)') /* C = 5 */
ref_viewing_distance_flag = DESC('u(1)') /* C = 5 */
if (ref_viewing_distance_flag)
prec_ref_viewing_dist = DESC('ue(v)') /* C = 5 */
num_ref_displays_minus1 = DESC('ue(v)') /* C = 5 */
numRefDisplays = num_ref_displays_minus1 + 1
for (i = 0; i < numRefDisplays; i++) {
exponent_ref_baseline[i] = DESC('u(6)') /* C = 5 */
mantissa_ref_baseline[i] = DESC('u(v)') /* C = 5 */
exponent_ref_display_width[i] = DESC('u(6)') /* C = 5 */
mantissa_ref_display_width[i] = DESC('u(v)') /* C = 5 */
if (ref_viewing_distance_flag) {
exponent_ref_viewing_distance[i] = DESC('u(6)') /* C = 5 */
mantissa_ref_viewing_distance[i] = DESC('u(v)') /* C = 5 */
}
additional_shift_present_flag[i] = DESC('u(1)') /* C = 5 */
if (additional_shift_present[i])
num_sample_shift_plus512[i] = DESC('u(10)') /* C = 5 */
}
three_dimensional_reference_displays_extension_flag = DESC('u(1)') /* C = 5 */
}
function depth_timing(payloadSize) {
per_view_depth_timing_flag = DESC('u(1)') /* C = 5 */
if (per_view_depth_timing_flag)
for (i = 0; i < NumDepthViews; i++)
depth_timing_offset()
else
depth_timing_offset()
}
function depth_timing_offset() {
offset_len_minus1 = DESC('u(5)') /* C = 5 */
depth_disp_delay_offset_fp = DESC('u(v)') /* C = 5 */
depth_disp_delay_offset_dp = DESC('u(6)') /* C = 5 */
}
function alternative_depth_info(payloadSize) {
depth_type = DESC('ue(v)') /* C = 5 */
if (depth_type == 0) {
num_constituent_views_gvd_minus1 = DESC('ue(v)') /* C = 5 */
depth_present_gvd_flag = DESC('u(1)') /* C = 5 */
z_gvd_flag = DESC('u(1)') /* C = 5 */
intrinsic_param_gvd_flag = DESC('u(1)') /* C = 5 */
rotation_gvd_flag = DESC('u(1)') /* C = 5 */
translation_gvd_flag = DESC('u(1)') /* C = 5 */
if (z_gvd_flag)
for (i = 0; i <= num_constituent_views_gvd_minus1 + 1; i++) {
sign_gvd_z_near_flag[i] = DESC('u(1)') /* C = 5 */
exp_gvd_z_near[i] = DESC('u(7)') /* C = 5 */
man_len_gvd_z_near_minus1[i] = DESC('u(5)') /* C = 5 */
man_gvd_z_near[i] = DESC('u(v)') /* C = 5 */
sign_gvd_z_far_flag[i] = DESC('u(1)') /* C = 5 */
exp_gvd_z_far[i] = DESC('u(7)') /* C = 5 */
man_len_gvd_z_far_minus1[i] = DESC('u(5)') /* C = 5 */
man_gvd_z_far[i] = DESC('u(v)') /* C = 5 */
}
if (intrinsic_param_gvd_flag) {
prec_gvd_focal_length = DESC('ue(v)') /* C = 5 */
prec_gvd_principal_point = DESC('ue(v)') /* C = 5 */
}
if (rotation_gvd_flag)
prec_gvd_rotation_param = DESC('ue(v)') /* C = 5 */
if (translation_gvd_flag)
prec_gvd_translation_param = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_constituent_views_gvd_minus1 + 1; i++) {
if (intrinsic_param_gvd_flag) {
sign_gvd_focal_length_x[i] = DESC('u(1)') /* C = 5 */
exp_gvd_focal_length_x[i] = DESC('u(6)') /* C = 5 */
man_gvd_focal_length_x[i] = DESC('u(v)') /* C = 5 */
sign_gvd_focal_length_y[i] = DESC('u(1)') /* C = 5 */
exp_gvd_focal_length_y[i] = DESC('u(6)') /* C = 5 */
man_gvd_focal_length_y[i] = DESC('u(v)') /* C = 5 */
sign_gvd_principal_point_x[i] = DESC('u(1)') /* C = 5 */
exp_gvd_principal_point_x[i] = DESC('u(6)') /* C = 5 */
man_gvd_principal_point_x[i] = DESC('u(v)') /* C = 5 */
sign_gvd_principal_point_y[i] = DESC('u(1)') /* C = 5 */
exp_gvd_principal_point_y[i] = DESC('u(6)') /* C = 5 */
man_gvd_principal_point_y[i] = DESC('u(v)') /* C = 5 */
}
if (rotation_gvd_flag)
for (j = 0; j < 3; j++) /* row */
for (k = 0; k < 3; k++) { /* column */
sign_gvd_r[i][j][k] = DESC('u(1)') /* C = 5 */
exp_gvd_r[i][j][k] = DESC('u(6)') /* C = 5 */
man_gvd_r[i][j][k] = DESC('u(v)') /* C = 5 */
}
if (translation_gvd_flag) {
sign_gvd_t_x[i] = DESC('u(1)') /* C = 5 */
exp_gvd_t_x[i] = DESC('u(6)') /* C = 5 */
man_gvd_t_x[i] = DESC('u(v)') /* C = 5 */
}
}
}
}
function depth_sampling_info(payloadSize) {
dttsr_x_mul = DESC('u(16)') /* C = 5 */
dttsr_x_dp = DESC('u(4)') /* C = 5 */
dttsr_y_mul = DESC('u(16)') /* C = 5 */
dttsr_y_dp = DESC('u(4)') /* C = 5 */
per_view_depth_grid_pos_flag = DESC('u(1)') /* C = 5 */
if (per_view_depth_grid_pos_flag) {
num_video_plus_depth_views_minus1 = DESC('ue(v)') /* C = 5 */
for (i = 0; i <= num_video_plus_depth_views_minus1; i++) {
depth_grid_view_id[i] = DESC('ue(v)') /* C = 5 */
depth_grid_position()
}
} else
depth_grid_position()
}
function depth_grid_position() {
depth_grid_pos_x_fp = DESC('u(20)') /* C = 5 */
depth_grid_pos_x_dp = DESC('u(4)') /* C = 5 */
depth_grid_pos_x_sign_flag = DESC('u(1)') /* C = 5 */
depth_grid_pos_y_fp = DESC('u(20)') /* C = 5 */
depth_grid_pos_y_dp = DESC('u(4)') /* C = 5 */
depth_grid_pos_y_sign_flag = DESC('u(1)') /* C = 5 */
}
function mvcd_vui_parameters_extension() {
vui_mvcd_num_ops_minus1 = DESC('ue(v)') /* C = 0 */
for (i = 0; i <= vui_mvcd_num_ops_minus1; i++) {
vui_mvcd_temporal_id[i] = DESC('u(3)') /* C = 0 */
vui_mvcd_num_target_output_views_minus1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j <= vui_mvcd_num_target_output_views_minus1[i]; j++) {
vui_mvcd_view_id[i][j] = DESC('ue(v)') /* C = 0 */
vui_mvcd_depth_flag[i][j] = DESC('u(1)') /* C = 0 */
vui_mvcd_texture_flag[i][j] = DESC('u(1)') /* C = 0 */
}
vui_mvcd_timing_info_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_mvcd_timing_info_present_flag[i]) {
vui_mvcd_num_units_in_tick[i] = DESC('u(32)') /* C = 0 */
vui_mvcd_time_scale[i] = DESC('u(32)') /* C = 0 */
vui_mvcd_fixed_frame_rate_flag[i] = DESC('u(1)') /* C = 0 */
}
vui_mvcd_nal_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_mvcd_nal_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 0 */
vui_mvcd_vcl_hrd_parameters_present_flag[i] = DESC('u(1)') /* C = 0 */
if (vui_mvcd_vcl_hrd_parameters_present_flag[i])
hrd_parameters() /* C = 0 */
if (vui_mvcd_nal_hrd_parameters_present_flag[i] || vui_mvcd_vcl_hrd_parameters_present_flag[i])
vui_mvcd_low_delay_hrd_flag[i] = DESC('u(1)') /* C = 0 */
vui_mvcd_pic_struct_present_flag[i] = DESC('u(1)') /* C = 0 */
}
}
function nal_unit_header_3davc_extension() {
view_idx = DESC('u(8)') /* C = All */
depth_flag = DESC('u(1)') /* C = All */
non_idr_flag = DESC('u(1)') /* C = All */
temporal_id = DESC('u(3)') /* C = All */
anchor_pic_flag = DESC('u(1)') /* C = All */
inter_view_flag = DESC('u(1)') /* C = All */
}
function seq_parameter_set_3davc_extension() {
if (NumDepthViews > 0) {
_3dv_acquisition_idc = DESC('ue(v)') /* C = 0 */
for (i = 0; i < NumDepthViews; i++)
view_id_3dv[i] = DESC('ue(v)') /* C = 0 */
if (_3dv_acquisition_idc ) {
depth_ranges(NumDepthViews, 2, 0)
vsp_param(NumDepthViews, 2, 0)
}
reduced_resolution_flag = DESC('u(1)') /* C = 0 */
if (reduced_resolution_flag) {
depth_pic_width_in_mbs_minus1 = DESC('ue(v)') /* C = 0 */
depth_pic_height_in_map_units_minus1 = DESC('ue(v)') /* C = 0 */
depth_hor_mult_minus1 = DESC('ue(v)') /* C = 0 */
depth_ver_mult_minus1 = DESC('ue(v)') /* C = 0 */
depth_hor_rsh = DESC('ue(v)') /* C = 0 */
depth_ver_rsh = DESC('ue(v)') /* C = 0 */
}
depth_frame_cropping_flag = DESC('u(1)') /* C = 0 */
if (depth_frame_cropping_flag) {
depth_frame_crop_left_offset = DESC('ue(v)') /* C = 0 */
depth_frame_crop_right_offset = DESC('ue(v)') /* C = 0 */
depth_frame_crop_top_offset = DESC('ue(v)') /* C = 0 */
depth_frame_crop_bottom_offset = DESC('ue(v)') /* C = 0 */
}
grid_pos_num_views = DESC('ue(v)') /* C = 0 */
for (i = 0; i < grid_pos_num_views; i++) {
grid_pos_view_id[i] = DESC('ue(v)') /* C = 0 */
grid_pos_x[grid_pos_view_id[i]] = DESC('se(v)') /* C = 0 */
grid_pos_y[grid_pos_view_id[i]] = DESC('se(v)') /* C = 0 */
}
slice_header_prediction_flag = DESC('u(1)') /* C = 0 */
seq_view_synthesis_flag = DESC('u(1)') /* C = 0 */
}
alc_sps_enable_flag = DESC('u(1)') /* C = 0 */
enable_rle_skip_flag = DESC('u(1)') /* C = 0 */
if (!AllViewsPairedFlag) {
for (i = 1; i <= num_views_minus1; i++)
if (texture_view_present_flag[i]) {
num_anchor_refs_l0[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_anchor_refs_l0[i]; j++)
anchor_ref_l0[i][j] = DESC('ue(v)') /* C = 0 */
num_anchor_refs_l1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_anchor_refs_l1[i]; j++)
anchor_ref_l1[i][j] = DESC('ue(v)') /* C = 0 */
}
for (i = 1; i <= num_views_minus1; i++)
if (texture_view_present_flag[i]) {
num_non_anchor_refs_l0[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_non_anchor_refs_l0[i]; j++)
non_anchor_ref_l0[i][j] = DESC('ue(v)') /* C = 0 */
num_non_anchor_refs_l1[i] = DESC('ue(v)') /* C = 0 */
for (j = 0; j < num_non_anchor_refs_l1[i]; j++)
non_anchor_ref_l1[i][j] = DESC('ue(v)') /* C = 0 */
}
}
}
function depth_parameter_set_rbsp() {
depth_parameter_set_id = DESC('ue(v)') /* C = 11 */
pred_direction = DESC('ue(v)') /* C = 11 */
if (pred_direction == 0 || pred_direction == 1) {
ref_dps_id0 = DESC('ue(v)') /* C = 11 */
predWeight0 = 64
}
if (pred_direction == 0) {
ref_dps_id1 = DESC('ue(v)') /* C = 11 */
pred_weight0 = DESC('u(6)') /* C = 11 */
predWeight0 = pred_weight0
}
num_depth_views_minus1 = DESC('ue(v)') /* C = 11 */
depth_ranges(num_depth_views_minus1 + 1, pred_direction, depth_parameter_set_id)
vsp_param_flag = DESC('u(1)') /* C = 11 */
if (vsp_param_flag)
vsp_param(num_depth_views_minus1 + 1, pred_direction, depth_parameter_set_id)
depth_param_additional_extension_flag = DESC('u(1)') /* C = 11 */
nonlinear_depth_representation_num = DESC('ue(v)') /* C = 11 */
for (i = 1; i <= nonlinear_depth_representation_num; i++)
nonlinear_depth_representation_model[i] = DESC('ue(v)') /* C = 11 */
if (depth_param_additional_extension_flag == 1)
while (more_rbsp_data())
depth_param_additional_extension_data_flag = DESC('u(1)') /* C = 11 */
rbsp_trailing_bits()
}
function depth_ranges(numViews, predDirection, index) {
z_near_flag = DESC('u(1)') /* C = 11 */
z_far_flag = DESC('u(1)') /* C = 11 */
if (z_near_flag)
_3dv_acquisition_element(numViews, predDirection, 7, index, ZNearSign, ZNearExp, ZNearMantissa, ZNearManLen)
if (z_far_flag)
_3dv_acquisition_element(numViews, predDirection, 7, index, ZFarSign, ZFarExp, ZFarMantissa, ZFarManLen)
}
function _3dv_acquisition_element(numViews, predDirection, expLen, index, outSign, outExp, outMantissa, outManLen) {
if (numViews > 1)
element_equal_flag = DESC('u(1)') /* C = 11 */
if (element_equal_flag == 0)
numValues = numViews
else
numValues = 1
for (i = 0; i < numValues; i++) {
if (predDirection == 2 && i == 0) {
mantissa_len_minus1 = DESC('u(5)') /* C = 11 */
outManLen[index, i] = manLen = mantissa_len_minus1 + 1
}
if (predDirection == 2) {
sign0 = DESC('u(1)') /* C = 11 */
outSign[index, i] = sign0
exponent0 = DESC('u(v)') /* C = 11 */
outExp[index, i] = exponent0
mantissa0 = DESC('u(v)') /* C = 11 */
outMantissa[index, i] = mantissa0
} else {
skip_flag = DESC('u(1)') /* C = 11 */
if (skip_flag == 0) {
sign1 = DESC('u(1)') /* C = 11 */
outSign[index, i] = sign1
exponent_skip_flag = DESC('u(1)') /* C = 11 */
if (exponent_skip_flag == 0) {
exponent1 = DESC('u(v)') /* C = 11 */
outExp[index, i] = exponent1
} else
outExp[index, i] = outExp[ref_dps_id0, i]
mantissa_diff = DESC('se(v)') /* C = 11 */
if (predDirection == 0)
mantissaPred = ((OutMantissa[ref_dps_id0, i] * predWeight0 + outMantissa[ref_dps_id1, i] * (64 - predWeight0) + 32) >> 6)
else
mantissaPred = outMantissa[ref_dps_id0, i]
outMantissa[index, i] = mantissaPred + mantissa_diff
outManLen[index, i] = outManLen[ref_dps_id0, i]
} else {
outSign[index, i] = outSign[ref_dps_id0, i]
outExp[index, i] = outExp[ref_dps_id0, i]
outMantissa[index, i] = outMantissa[ref_dps_id0, i]
outManLen[index, i] = outManLen[ref_dps_id0, i]
}
}
}
if (element_equal_flag == 1) {
for (i = 1; i < num_views_minus1 + 1 - deltaFlag; i++) {
outSign[index, i] = outSign[index, 0]
outExp[index, i] = outExp[index, 0]
outMantissa[index, i] = outMantissa[index, 0]
outManLen[index, i] = outManLen[index, 0]
}
}
}
function vsp_param(numViews, predDirection, index) {
for (i = 0; i < numViews; i++)
for (j = 0; j < i; j++) {
disparity_diff_wji[j][i] = DESC('ue(v)') /* C = 0 */
disparity_diff_oji[j][i] = DESC('ue(v)') /* C = 0 */
disparity_diff_wij[i][j] = DESC('ue(v)') /* C = 0 */
disparity_diff_oij[i][j] = DESC('ue(v)') /* C = 0 */
}
}
function slice_header_in_3davc_extension() {
first_mb_in_slice = DESC('ue(v)') /* C = 2 */
slice_type = DESC('ue(v)') /* C = 2 */
pic_parameter_set_id = DESC('ue(v)') /* C = 2 */
if (avc_3d_extension_flag && slice_header_prediction_flag != 0) {
pre_slice_header_src = DESC('u(2)') /* C = 2 */
if (slice_type == P || slice_type == SP || slice_type == B) {
pre_ref_lists_src = DESC('u(2)') /* C = 2 */
if (!pre_ref_lists_src) {
num_ref_idx_active_override_flag = DESC('u(1)') /* C = 2 */
if (num_ref_idx_active_override_flag) {
num_ref_idx_l0_active_minus1 = DESC('ue(v)') /* C = 2 */
if (slice_type == B)
num_ref_idx_l1_active_minus1 = DESC('ue(v)') /* C = 2 */
}
ref_pic_list_mvc_modification() /* specified in Annex G */ /* C = 2 */
}
}
if ((weighted_pred_flag && (slice_type == P || slice_type == SP)) || (weighted_bipred_idc == 1 && slice_type == B)) {
pre_pred_weight_table_src = DESC('u(2)') /* C = 2 */
if (!pre_pred_weight_table_src)
pred_weight_table() /* C = 2 */
}
if (nal_ref_idc != 0) {
pre_dec_ref_pic_marking_src = DESC('u(2)') /* C = 2 */
if (!pre_dec_ref_pic_marking_src)
dec_ref_pic_marking() /* C = 2 */
}
slice_qp_delta = DESC('se(v)') /* C = 2 */
} else {
if (separate_colour_plane_flag == 1)
colour_plane_id = DESC('u(2)') /* C = 2 */
frame_num = DESC('u(v)') /* C = 2 */
if (!frame_mbs_only_flag) {
field_pic_flag = DESC('u(1)') /* C = 2 */
if (field_pic_flag)
bottom_field_flag = DESC('u(1)') /* C = 2 */
}
if (IdrPicFlag)
idr_pic_id = DESC('ue(v)') /* C = 2 */
if (pic_order_cnt_type == 0) {
pic_order_cnt_lsb = DESC('u(v)') /* C = 2 */
if (bottom_field_pic_order_in_frame_present_flag && !field_pic_flag)
delta_pic_order_cnt_bottom = DESC('se(v)') /* C = 2 */
}
if (pic_order_cnt_type == 1 && !delta_pic_order_always_zero_flag) {
delta_pic_order_cnt[0] = DESC('se(v)') /* C = 2 */
if (bottom_field_pic_order_in_frame_present_flag && !field_pic_flag)
delta_pic_order_cnt[1] = DESC('se(v)') /* C = 2 */
}
if (redundant_pic_cnt_present_flag)
redundant_pic_cnt = DESC('ue(v)') /* C = 2 */
if (slice_type == B)
direct_spatial_mv_pred_flag = DESC('u(1)') /* C = 2 */
if (slice_type == P || slice_type == SP || slice_type == B) {
num_ref_idx_active_override_flag = DESC('u(1)') /* C = 2 */
if (num_ref_idx_active_override_flag) {
num_ref_idx_l0_active_minus1 = DESC('ue(v)') /* C = 2 */
if (slice_type == B)
num_ref_idx_l1_active_minus1 = DESC('ue(v)') /* C = 2 */
}
}
if (nal_unit_type == 20 || nal_unit_type == 21)
ref_pic_list_mvc_modification() /* specified in Annex G */ /* C = 2 */
else
ref_pic_list_modification() /* C = 2 */
if ((weighted_pred_flag && (slice_type == P || slice_type == SP)) || (weighted_bipred_idc == 1 && slice_type == B))
pred_weight_table() /* C = 2 */
if (nal_ref_idc != 0)
dec_ref_pic_marking() /* C = 2 */
if (entropy_coding_mode_flag && slice_type != I && slice_type != SI)
cabac_init_idc = DESC('ue(v)') /* C = 2 */
slice_qp_delta = DESC('se(v)') /* C = 2 */
if (slice_type == SP || slice_type == SI) {
if (slice_type == SP)
sp_for_switch_flag = DESC('u(1)') /* C = 2 */
slice_qs_delta = DESC('se(v)') /* C = 2 */
}
if (deblocking_filter_control_present_flag) {
disable_deblocking_filter_idc = DESC('ue(v)') /* C = 2 */
if (disable_deblocking_filter_idc != 1) {
slice_alpha_c0_offset_div2 = DESC('se(v)') /* C = 2 */
slice_beta_offset_div2 = DESC('se(v)') /* C = 2 */
}
}
if (num_slice_groups_minus1 > 0 && slice_group_map_type >= 3 && slice_group_map_type <= 5)
slice_group_change_cycle = DESC('u(v)') /* C = 2 */
if (nal_unit_type == 21 && (slice_type != I && slice_type != SI)) {
if (DepthFlag)
depth_weighted_pred_flag = DESC('u(1)') /* C = 2 */
else if (avc_3d_extension_flag) {
dmvp_flag = DESC('u(1)') /* C = 2 */
if (seq_view_synthesis_flag)
slice_vsp_flag = DESC('u(1)') /* C = 2 */
}
if (_3dv_acquisition_idc != 1 && (depth_weighted_pred_flag || dmvp_flag) )
dps_id = DESC('ue(v)') /* C = 2 */
}
}
}
function slice_data_in_3davc_extension() {
if (entropy_coding_mode_flag)
while (!byte_aligned())
cabac_alignment_one_bit = DESC('f(1)') /* C = 2 */
CurrMbAddr = first_mb_in_slice * (1 + MbaffFrameFlag)
moreDataFlag = 1
prevMbSkipped = 0
RunLength = 0
do {
if (slice_type != I && slice_type != SI)
if (!entropy_coding_mode_flag) {
mb_skip_run = DESC('ue(v)') /* C = 2 */
prevMbSkipped = (mb_skip_run > 0)
for (i = 0; i < mb_skip_run; i++)
CurrMbAddr = NextMbAddress(CurrMbAddr)
if (nal_unit_type == 21 && !DepthFlag && mb_skip_run > 0 && VspRefExist)
mb_skip_type_flag = DESC('u(1)') /* C = 2 */
if (mb_skip_run > 0)
moreDataFlag = more_rbsp_data()
} else {
if (nal_unit_type == 21 && !DepthFlag && VspRefExist && leftMbVSSkipped && upMbVSSkipped) {
mb_vsskip_flag = DESC('ae(v)') /* C = 2 */
moreDataFlag = !mb_vsskip_flag
if (!mb_vsskip_flag) {
mb_skip_flag = DESC('ae(v)') /* C = 2 */
moreDataFlag = !mb_skip_flag
}
RunLength = 0
} else {
rleCtx = RLESkipContext()
if (rleCtx && !RunLength) {
mb_skip_run_type = DESC('ae(v)') /* C = 2 */
RunLength = 16
} else if (!rleCtx && RunLength)
RunLength = 0
if (rleCtx && mb_skip_run_type)
RunLength -= 1
else
mb_skip_flag = DESC('ae(v)') /* C = 2 */
if (rleCtx && !mb_skip_flag)
RunLength = 0
moreDataFlag = !mb_skip_flag
if (nal_unit_type == 21 && !DepthFlag && VspRefExist && !mb_skip_flag) {
mb_vsskip_flag = DESC('ae(v)') /* C = 2 */
moreDataFlag = !mb_vsskip_flag
}
}
if (alc_sps_enable_flag && nal_unit_type == 21 && slice_type == P && !DepthFlag && !mb_vsskip_flag && mb_skip_flag == 1)
mb_alc_skip_flag = DESC('ae(v)') /* C = 2 */
}
if (moreDataFlag) {
if (MbaffFrameFlag && (CurrMbAddr % 2 == 0 || (CurrMbAddr % 2 == 1 && prevMbSkipped)))
mb_field_decoding_flag = DESC('u(1) | ae(v)') /* C = 2 */
macroblock_layer_in_3davc_extension() /* C = 2 | 3 | 4 */
}
if (!entropy_coding_mode_flag)
moreDataFlag = more_rbsp_data()
else {
if (slice_type != I && slice_type != SI)
prevMbSkipped = mb_skip_flag || mb_vsskip_flag
if (MbaffFrameFlag && CurrMbAddr % 2 == 0)
moreDataFlag = 1
else {
end_of_slice_flag = DESC('ae(v)') /* C = 2 */
moreDataFlag = !end_of_slice_flag
}
}
CurrMbAddr = NextMbAddress(CurrMbAddr)
} while (moreDataFlag)
}
function macroblock_layer_in_3davc_extension() {
mb_type = DESC('ue(v) | ae(v)') /* C = 2 */
if (nal_unit_type == 21 && !DepthFlag
&& slice_type == B
&& direct_spatial_mv_pred_flag && VspRefExist
&& mb_type == B_Direct_16x16)
mb_direct_type_flag = DESC('u(1) | ae(v)') /* C = 2 */
if (alc_sps_enable_flag && nal_unit_type == 21 &&
slice_type == P && !DepthFlag &&
(mb_type == P_L0_16x16 ||
mb_type == P_L0_L0_16x8 ||
mb_type == P_L0_L0_8x16))
mb_alc_flag = DESC('u(1) | ae(v)') /* C = 2 */
if (mb_type == I_PCM) {
while (!byte_aligned())
pcm_alignment_zero_bit = DESC('f(1)') /* C = 3 */
for (i = 0; i < 256; i++)
pcm_sample_luma[i] = DESC('u(v)') /* C = 3 */
for (i = 0; i < 2 * MbWidthC * MbHeightC; i++)
pcm_sample_chroma[i] = DESC('u(v)') /* C = 3 */
} else {
noSubMbPartSizeLessThan8x8Flag = 1
if (mb_type != I_NxN &&
MbPartPredMode(mb_type, 0) != Intra_16x16 &&
NumMbPart(mb_type) == 4) {
sub_mb_pred_in_3davc_extension(mb_type) /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8) {
if (NumSubMbPart(sub_mb_type[mbPartIdx]) > 1)
noSubMbPartSizeLessThan8x8Flag = 0
} else if (!direct_8x8_inference_flag)
noSubMbPartSizeLessThan8x8Flag = 0
} else {
if (transform_8x8_mode_flag && mb_type == I_NxN)
transform_size_8x8_flag = DESC('u(1) | ae(v)') /* C = 2 */
mb_pred_in_3davc_extension(mb_type) /* C = 2 */
}
if (MbPartPredMode(mb_type, 0) != Intra_16x16) {
coded_block_pattern = DESC('me(v) | ae(v)') /* C = 2 */
if ((CodedBlockPatternLuma > 0 || mb_alc_flag == 1) &&
transform_8x8_mode_flag && mb_type != I_NxN &&
noSubMbPartSizeLessThan8x8Flag &&
(mb_type != B_Direct_16x16 ||
direct_8x8_inference_flag))
transform_size_8x8_flag = DESC('u(1) | ae(v)') /* C = 2 */
}
if (CodedBlockPatternLuma > 0 ||
CodedBlockPatternChroma > 0 ||
MbPartPredMode(mb_type, 0) == Intra_16x16) {
mb_qp_delta = DESC('se(v) | ae(v)') /* C = 2 */
residual(0, 15) /* C = 3 | 4 */
}
}
}
function mb_pred_in_3davc_extension(mb_type) {
if (MbPartPredMode(mb_type, 0) == Intra_4x4 || MbPartPredMode(mb_type, 0) == Intra_8x8 || MbPartPredMode(mb_type, 0) == Intra_16x16) {
if (MbPartPredMode(mb_type, 0) == Intra_4x4)
for (luma4x4BlkIdx = 0; luma4x4BlkIdx < 16; luma4x4BlkIdx++) {
prev_intra4x4_pred_mode_flag[luma4x4BlkIdx] = DESC('u(1) | ae(v)') /* C = 2 */
if (!prev_intra4x4_pred_mode_flag[luma4x4BlkIdx])
rem_intra4x4_pred_mode[luma4x4BlkIdx] = DESC('u(3) | ae(v)') /* C = 2 */
}
if (MbPartPredMode(mb_type, 0) == Intra_8x8)
for (luma8x8BlkIdx = 0; luma8x8BlkIdx < 4; luma8x8BlkIdx++) {
prev_intra8x8_pred_mode_flag[luma8x8BlkIdx] = DESC('u(1) | ae(v)') /* C = 2 */
if (!prev_intra8x8_pred_mode_flag[luma8x8BlkIdx])
rem_intra8x8_pred_mode[luma8x8BlkIdx] = DESC('u(3) | ae(v)') /* C = 2 */
}
if (ChromaArrayType == 1 || ChromaArrayType == 2)
intra_chroma_pred_mode = DESC('ue(v) | ae(v)') /* C = 2 */
} else if (MbPartPredMode(mb_type, 0) != Direct) {
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if ((num_ref_idx_l0_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && MbPartPredMode(mb_type, mbPartIdx) != Pred_L1 && mb_alc_flag == 0) {
ref_idx_l0[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
if (VspRefL0Flag[mbPartIdx] && slice_vsp_flag)
bvsp_flag_l0[mbPartIdx] = DESC('u(1) | ae(v)') /* C = 2 */
}
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if ((num_ref_idx_l1_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && MbPartPredMode(mb_type, mbPartIdx) != Pred_L0) {
ref_idx_l1[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
if (VspRefL1Flag[mbPartIdx] && slice_vsp_flag)
bvsp_flag_l1[mbPartIdx] = DESC('u(1) | ae(v)') /* C = 2 */
}
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if (MbPartPredMode(mb_type, mbPartIdx) != Pred_L1 && (!VspRefL0Flag[mbPartIdx] || !bvsp_flag_l0[mbPartIdx]))
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l0[mbPartIdx][0][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < NumMbPart(mb_type); mbPartIdx++)
if (MbPartPredMode(mb_type, mbPartIdx) != Pred_L0 && (!VspRefL1Flag[mbPartIdx] || !bvsp_flag_l1[mbPartIdx]))
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l1[mbPartIdx][0][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
}
}
function sub_mb_pred_in_3davc_extension(mb_type) {
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
sub_mb_type[mbPartIdx] = DESC('ue(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if ((num_ref_idx_l0_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && mb_type != P_8x8ref0 && sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L1 && mb_alc_flag == 0) {
ref_idx_l0[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
if (VspRefL0Flag[mbPartIdx] && slice_vsp_flag)
bvsp_flag_l0[mbPartIdx] = DESC('u(1) | ae(v)') /* C = 2 */
}
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if ((num_ref_idx_l1_active_minus1 > 0 || mb_field_decoding_flag != field_pic_flag) && sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L0) {
ref_idx_l1[mbPartIdx] = DESC('te(v) | ae(v)') /* C = 2 */
if (VspRefL1Flag[mbPartIdx] && slice_vsp_flag)
bvsp_flag_l1[mbPartIdx] = DESC('u(1) | ae(v)') /* C = 2 */
}
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L1 && (!VspRefL0Flag[mbPartIdx] || !bvsp_flag_l0[mbPartIdx]))
for (subMbPartIdx = 0; subMbPartIdx < NumSubMbPart(sub_mb_type[mbPartIdx]); subMbPartIdx++)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l0[mbPartIdx][subMbPartIdx][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
for (mbPartIdx = 0; mbPartIdx < 4; mbPartIdx++)
if (sub_mb_type[mbPartIdx] != B_Direct_8x8 && SubMbPredMode(sub_mb_type[mbPartIdx]) != Pred_L0 && (!VspRefL1Flag[mbPartIdx] || !bvsp_flag_l1[mbPartIdx]))
for (subMbPartIdx = 0; subMbPartIdx < NumSubMbPart(sub_mb_type[mbPartIdx]); subMbPartIdx++)
for (compIdx = 0; compIdx < 2; compIdx++)
mvd_l1[mbPartIdx][subMbPartIdx][compIdx] = DESC('se(v) | ae(v)') /* C = 2 */
}
function constrained_depth_parameter_set_identifier(payloadSize) {
max_dps_id = DESC('ue(v)') /* C = 5 */
max_dps_id_diff = DESC('ue(v)') /* C = 5 */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment