14 static const QString
LOC { QStringLiteral(
"HEVCParser ") };
29 r = (v > 0xFFFF) << 4;
31 shift = (v > 0xFF) << 3;
34 shift = (v > 0xF) << 2;
37 shift = (v > 0x3) << 1;
101 return "RSV_IRAP_VCL22";
103 return "RSV_IRAP_VCL23";
119 return "PREFIX_SEI_NUT";
121 return "SUFFIX_SEI_NUT";
127 const uint32_t byte_count,
128 const uint64_t stream_offset)
130 const uint8_t *startP =
bytes;
138 static int nexttime = 60000;
140 if (timer.
elapsed() > nexttime)
142 LOG(VB_GENERAL, LOG_DEBUG,
143 QString(
"Frames %1 KeyFrames %2 | Total Frames %3 KeyFrames %4")
157 const uint8_t *endP =
168 if (!
fillRBSP(startP, endP - startP, found_start_code))
180 if (found_start_code)
188 LOG(VB_GENERAL, LOG_ERR,
189 "HEVCParser::addBytes: Found new start "
190 "code, but previous NAL is incomplete!");
208 if (nal_unit_header & 0x8000)
210 LOG(VB_GENERAL, LOG_ERR,
"HEVCParser::parseNAL: "
211 "NAL header forbidden_zero_bit is not zero!");
220 LOG(VB_RECORD, LOG_INFO,
221 QString(
"nalTemperalId: %1, "
223 "nalUnitType: %3 %4")
245 return startP -
bytes;
508 LOG(VB_RECORD, LOG_DEBUG,
LOC +
577 bool profilePresentFlag,
578 int maxNumSubLayersMinus1)
582 if (profilePresentFlag)
587 for (
int j = 0; j < 32; ++j)
625 bool general_progressive_source_flag = br.
get_bits(1);
626 bool general_interlaced_source_flag = br.
get_bits(1);
627 if (!general_progressive_source_flag &&
628 general_interlaced_source_flag)
639 if (general_profile_idc == 4 ||
640 general_profile_compatibility_flag[4] ||
641 general_profile_idc == 5 ||
642 general_profile_compatibility_flag[5] ||
643 general_profile_idc == 6 ||
644 general_profile_compatibility_flag[6] ||
645 general_profile_idc == 7 ||
646 general_profile_compatibility_flag[7] ||
647 general_profile_idc == 8 ||
648 general_profile_compatibility_flag[8] ||
649 general_profile_idc == 9 ||
650 general_profile_compatibility_flag[9] ||
651 general_profile_idc == 10 ||
652 general_profile_compatibility_flag[10] ||
653 general_profile_idc == 11 ||
654 general_profile_compatibility_flag[11])
666 if (general_profile_idc == 5 ||
667 general_profile_compatibility_flag[5] ||
668 general_profile_idc == 9 ||
669 general_profile_compatibility_flag[9] ||
670 general_profile_idc == 10 ||
671 general_profile_compatibility_flag[10] ||
672 general_profile_idc == 11 ||
673 general_profile_compatibility_flag[11])
689 else if (general_profile_idc == 2 ||
690 general_profile_compatibility_flag[2])
711 if (general_profile_idc == 1 ||
712 general_profile_compatibility_flag[1] ||
713 general_profile_idc == 2 ||
714 general_profile_compatibility_flag[2] ||
715 general_profile_idc == 3 ||
716 general_profile_compatibility_flag[3] ||
717 general_profile_idc == 4 ||
718 general_profile_compatibility_flag[4] ||
719 general_profile_idc == 5 ||
720 general_profile_compatibility_flag[5] ||
721 general_profile_idc == 9 ||
722 general_profile_compatibility_flag[9] ||
723 general_profile_idc == 11 ||
724 general_profile_compatibility_flag[11])
745 std::vector<bool> sub_layer_profile_present_flag;
746 std::vector<bool> sub_layer_level_present_flag;
747 for (i = 0; i < maxNumSubLayersMinus1; ++i)
749 sub_layer_profile_present_flag.push_back(br.
get_bits(1));
750 sub_layer_level_present_flag.push_back( br.
get_bits(1));
753 if (maxNumSubLayersMinus1 > 0)
755 for (i = maxNumSubLayersMinus1; i < 8; ++i)
759 for (i = 0; i < maxNumSubLayersMinus1; ++i)
761 if (sub_layer_profile_present_flag[i])
767 for (
int j = 0; j < 32; ++j)
778 if (sub_layer_profile_idc[i] == 4 ||
779 sub_layer_profile_compatibility_flag[i][4] ||
780 sub_layer_profile_idc[i] == 5 ||
781 sub_layer_profile_compatibility_flag[i][5] ||
782 sub_layer_profile_idc[i] == 6 ||
783 sub_layer_profile_compatibility_flag[i][6] ||
784 sub_layer_profile_idc[i] == 7 ||
785 sub_layer_profile_compatibility_flag[i][7] ||
786 sub_layer_profile_idc[i] == 8 ||
787 sub_layer_profile_compatibility_flag[i][8] ||
788 sub_layer_profile_idc[i] == 9 ||
789 sub_layer_profile_compatibility_flag[i][9] ||
790 sub_layer_profile_idc[i] == 10 ||
791 sub_layer_profile_compatibility_flag[i][10] ||
792 sub_layer_profile_idc[i] == 11 ||
793 sub_layer_profile_compatibility_flag[i][11])
804 if (sub_layer_profile_idc[i] == 5 ||
805 sub_layer_profile_compatibility_flag[i][5] ||
806 sub_layer_profile_idc[i] == 9 ||
807 sub_layer_profile_compatibility_flag[i][9] ||
808 sub_layer_profile_idc[i] == 10 ||
809 sub_layer_profile_compatibility_flag[i][10] ||
810 sub_layer_profile_idc[i] == 11 ||
811 sub_layer_profile_compatibility_flag[i][11])
827 else if(sub_layer_profile_idc[i] == 2 ||
828 sub_layer_profile_compatibility_flag[i][2])
849 if (sub_layer_profile_idc[i] == 1 ||
850 sub_layer_profile_compatibility_flag[i][1] ||
851 sub_layer_profile_idc[i] == 2 ||
852 sub_layer_profile_compatibility_flag[i][2] ||
853 sub_layer_profile_idc[i] == 3 ||
854 sub_layer_profile_compatibility_flag[i][3] ||
855 sub_layer_profile_idc[i] == 4 ||
856 sub_layer_profile_compatibility_flag[i][4] ||
857 sub_layer_profile_idc[i] == 5 ||
858 sub_layer_profile_compatibility_flag[i][5] ||
859 sub_layer_profile_idc[i] == 9 ||
860 sub_layer_profile_compatibility_flag[i][9] ||
861 sub_layer_profile_idc[i] == 11 ||
862 sub_layer_profile_compatibility_flag[i][11])
870 if (sub_layer_level_present_flag[i])
879 uint8_t* &sl, uint8_t &size,
880 std::vector<int16_t> &scaling_list_dc_coef_minus8)
895 scaling_list_dc_coef_minus8 =
901 scaling_list_dc_coef_minus8 =
921 for (sizeId = 0; sizeId < 4; ++sizeId)
923 for (
uint matrixId = 0; matrixId < ((sizeId == 3) ? 2 : 6); ++matrixId)
925 std::vector<int16_t> scaling_list_dc_coef_minus8 {};
926 uint8_t *sl =
nullptr;
929 dest_scaling_list, sl, size,
930 scaling_list_dc_coef_minus8))
932 LOG(VB_RECORD, LOG_WARNING,
LOC +
933 QString(
"Failed to process scaling list params"));
944 if (!getDefaultScalingLists(&sl, sizeId, matrixId))
946 LOG(VB_RECORD, LOG_WARNING,
LOC +
947 QString(
"Failed to process default scaling lists"));
953 scaling_list_dc_coef_minus8[matrixId] = 8;
962 if (!scaling_list_pred_matrix_id_delta)
964 if (!getDefaultScalingLists(&sl, sizeId, matrixId))
966 LOG(VB_RECORD, LOG_WARNING,
LOC +
967 QString(
"Failed to process default "
974 scaling_list_dc_coef_minus8[matrixId] = 8;
979 uint8_t refMatrixId = matrixId -
980 scaling_list_pred_matrix_id_delta;
982 refMatrixId, &temp_sl,
985 LOG(VB_RECORD, LOG_WARNING,
LOC +
986 QString(
"Failed to process scaling "
991 for (i = 0; i < size; ++i)
996 scaling_list_dc_coef_minus8[matrixId] =
997 scaling_list_dc_coef_minus8[refMatrixId];
1010 if (scaling_list_dc_coef_minus8[matrixId] < -7 ||
1011 247 < scaling_list_dc_coef_minus8[matrixId])
1013 LOG(VB_RECORD, LOG_WARNING,
LOC +
1014 QString(
"scaling_list_dc_coef_minus8[%1] %2 "
1015 "outside -7 and 247")
1017 .arg(scaling_list_dc_coef_minus8[matrixId]));
1019 nextCoef = scaling_list_dc_coef_minus8[matrixId] + 8;
1023 for (uint8_t i = 0; i < size; ++i)
1027 if (scaling_list_delta_coef < -128 ||
1028 scaling_list_delta_coef > 127)
1030 LOG(VB_RECORD, LOG_WARNING,
LOC +
1031 QString(
"scaling_list_delta_coef %1 "
1032 "outside -128 and 127")
1033 .arg(scaling_list_delta_coef));
1035 nextCoef = (nextCoef + scaling_list_delta_coef) & 0xff;
1053 int num_short_term_ref_pic_sets,
1054 std::array<HEVCParser::ShortTermRefPicSet,65> & stRPS,
1055 uint8_t max_dec_pic_buffering_minus1)
1057 std::array<bool,16> use_delta_flag {
false };
1058 std::array<bool,16> used_by_curr_pic_flag {
false };
1059 std::array<uint32_t,16> delta_poc_s0_minus1 { 0 };
1060 std::array<uint32_t,16> delta_poc_s1_minus1 { 0 };
1070 bool inter_ref_pic_set_prediction_flag = (stRPSIdx != 0) ?
1073 if (inter_ref_pic_set_prediction_flag)
1084 int delta_idx_minus1 = (stRPSIdx == num_short_term_ref_pic_sets) ?
1086 if (delta_idx_minus1 > stRPSIdx - 1)
1087 LOG(VB_RECORD, LOG_WARNING,
LOC +
1088 QString(
"Invalid delta_idx_minus1? %1").arg(delta_idx_minus1));
1090 int8_t delta_rps_sign = br.
get_bits(1);
1092 if (abs_delta_rps_minus1 > 32767)
1093 LOG(VB_RECORD, LOG_WARNING,
LOC +
1094 QString(
"Invalid abs_delta_rps_minus1"));
1095 int deltaRPS = ( 1 - 2 * delta_rps_sign ) * ( abs_delta_rps_minus1 + 1 );
1101 int RefRPSIdx = stRPSIdx - (delta_idx_minus1 + 1);
1104 for (
int j = 0; j <= RefRPS->NumDeltaPocs; ++j)
1106 used_by_curr_pic_flag[j] = br.
get_bits(1);
1117 if (!used_by_curr_pic_flag[j])
1119 use_delta_flag[j] = br.
get_bits(1);
1123 use_delta_flag[j] =
true;
1130 for (
int k = (RefRPS->NumPositivePics - 1); k >= 0; --k)
1132 int dPoc = RefRPS->DeltaPocS1[k] + deltaRPS;
1133 if (dPoc < 0 && use_delta_flag[RefRPS->NumNegativePics + k])
1135 stRPS[stRPSIdx].DeltaPocS0[i] = dPoc;
1136 stRPS[stRPSIdx].UsedByCurrPicS0[i++] =
1137 used_by_curr_pic_flag[RefRPS->NumNegativePics + k];
1141 if (deltaRPS < 0 && use_delta_flag[RefRPS->NumDeltaPocs])
1143 stRPS[stRPSIdx].DeltaPocS0[i] = deltaRPS;
1144 stRPS[stRPSIdx].UsedByCurrPicS0[i++] =
1145 used_by_curr_pic_flag[RefRPS->NumDeltaPocs];
1148 for (
int j = 0; j < RefRPS->NumNegativePics; ++j)
1150 int dPoc = RefRPS->DeltaPocS0[j] + deltaRPS;
1151 if (dPoc < 0 && use_delta_flag[j])
1153 stRPS[stRPSIdx].DeltaPocS0[i] = dPoc;
1154 stRPS[stRPSIdx].UsedByCurrPicS0[i++] = used_by_curr_pic_flag[j];
1157 stRPS[stRPSIdx].NumNegativePics = i;
1160 for (
int k = (RefRPS->NumNegativePics - 1); k >= 0; --k)
1162 int dPoc = RefRPS->DeltaPocS0[k] + deltaRPS;
1163 if (dPoc > 0 && use_delta_flag[k])
1165 stRPS[stRPSIdx].DeltaPocS1[i] = dPoc;
1166 stRPS[stRPSIdx].UsedByCurrPicS1[i++] = used_by_curr_pic_flag[k];
1170 if (deltaRPS > 0 && use_delta_flag[RefRPS->NumDeltaPocs])
1172 stRPS[stRPSIdx].DeltaPocS1[i] = deltaRPS;
1173 stRPS[stRPSIdx].UsedByCurrPicS1[i++] =
1174 used_by_curr_pic_flag[RefRPS->NumDeltaPocs];
1177 for (
int j = 0; j < RefRPS->NumPositivePics; ++j)
1179 int dPoc = RefRPS->DeltaPocS1[j] + deltaRPS;
1180 if (dPoc > 0 && use_delta_flag[RefRPS->NumNegativePics + j])
1182 stRPS[stRPSIdx].DeltaPocS1[i] = dPoc;
1183 stRPS[stRPSIdx].UsedByCurrPicS1[i++] =
1184 used_by_curr_pic_flag[RefRPS->NumNegativePics + j];
1187 stRPS[stRPSIdx].NumPositivePics= i;
1191 stRPS[stRPSIdx].NumNegativePics = std::min((uint8_t)br.
get_ue_golomb(),
1192 max_dec_pic_buffering_minus1);
1193 stRPS[stRPSIdx].NumPositivePics = std::min((uint8_t)br.
get_ue_golomb(),
1194 max_dec_pic_buffering_minus1);
1196 for (i = 0; i < stRPS[stRPSIdx].NumNegativePics; ++i)
1202 stRPS[stRPSIdx].DeltaPocS0[i] = -(delta_poc_s0_minus1[i] + 1);
1204 stRPS[stRPSIdx].DeltaPocS0[i] = stRPS[stRPSIdx].DeltaPocS0[i - 1] -
1205 (delta_poc_s0_minus1[i] + 1);
1207 for (i = 0; i < stRPS[stRPSIdx].NumPositivePics; ++i)
1213 stRPS[stRPSIdx].DeltaPocS1[i] = delta_poc_s1_minus1[i] + 1;
1215 stRPS[stRPSIdx].DeltaPocS1[i] = stRPS[stRPSIdx].DeltaPocS1[i - 1] +
1216 (delta_poc_s1_minus1[i] + 1);
1225 stRPS[stRPSIdx].NumDeltaPocs = stRPS[stRPSIdx].NumNegativePics +
1226 stRPS[stRPSIdx].NumPositivePics;
1238 slice_segment_data(br);
1239 rbsp_slice_segment_trailing_bits(br);
1250 bool dependent_slice_segment_flag =
false;
1262 LOG(VB_RECORD, LOG_DEBUG,
LOC +
1263 QString(
"PPS Id %1 not valid yet. Skipping parsing of slice.")
1274 dependent_slice_segment_flag = br.
get_bits(1);
1279 uint32_t CtbLog2SizeY = MinCbLog2SizeY +
1281 uint32_t CtbSizeY = 1 << CtbLog2SizeY;
1282 uint32_t PicHeightInCtbsY =
1284 static_cast<double>(CtbSizeY));
1285 uint32_t PicWidthInCtbsY =
1287 static_cast<double>(CtbSizeY));
1296 if (!dependent_slice_segment_flag)
1381 (MaxPicOrderCntLsb / 2)))
1388 (MaxPicOrderCntLsb / 2)))
1400 LOG(VB_RECORD, LOG_INFO,
LOC +
1401 QString(
"picOrderCntVal: %1 = %2 + %3")
1404 .arg(slice_pic_order_cnt_lsb));
1408 #if 0 // We dont' need the rest
1410 if (!short_term_ref_pic_set_sps_flag)
1414 else if(num_short_term_ref_pic_sets > 1)
1418 if (long_term_ref_pics_present_flag)
1420 if (num_long_term_ref_pics_sps > 0)
1425 for (i = 0; i < num_long_term_sps + num_long_term_pics; ++i)
1427 if (i < num_long_term_sps)
1429 if (num_long_term_ref_pics_sps > 1)
1435 br.
get_bits(sps->Log2MaxPicOrderCntLsb);
1439 if (delta_poc_msb_present_flag[i])
1445 if (sps_temporal_mvp_enabled_flag)
1451 #if 0 // We don't need the rest
1452 if (sample_adaptive_offset_enabled_flag)
1455 if (ChromaArrayType != 0)
1460 if (slice_type == P || slice_type == B)
1463 if (num_ref_idx_active_override_flag)
1466 if (slice_type == B)
1471 if (lists_modification_present_flag && NumPicTotalCurr > 1)
1473 ref_pic_lists_modification();
1474 if (slice_type == B)
1479 if (cabac_init_present_flag)
1483 if (slice_temporal_mvp_enabled_flag)
1485 if (slice_type == B)
1489 if (( collocated_from_l0_flag &&
1490 num_ref_idx_l0_active_minus1 > 0) ||
1491 (!collocated_from_l0_flag &&
1492 num_ref_idx_l1_active_minus1 > 0))
1497 if ((weighted_pred_flag && slice_type == P) ||
1498 (weighted_bipred_flag && slice_type == B))
1500 pred_weight_table();
1503 if (motion_vector_resolution_control_idc == 2)
1509 if (pps_slice_chroma_qp_offsets_present_flag)
1514 if (pps_slice_act_qp_offsets_present_flag)
1520 if (chroma_qp_offset_list_enabled_flag)
1524 if (deblocking_filter_override_enabled_flag)
1528 if (deblocking_filter_override_flag)
1531 if (!slice_deblocking_filter_disabled_flag)
1537 if (pps_loop_filter_across_slices_enabled_flag &&
1538 ( slice_sao_luma_flag || slice_sao_chroma_flag ||
1539 !slice_deblocking_filter_disabled_flag))
1545 #if 0 // We don't need the rest
1546 if (tiles_enabled_flag || entropy_coding_sync_enabled_flag)
1549 if (num_entry_point_offsets > 0)
1552 for (i = 0; i < num_entry_point_offsets; ++i)
1558 if (slice_segment_header_extension_present_flag)
1561 for (i = 0; i < slice_segment_header_extension_length; ++i)
1563 slice_segment_header_extension_data_byte[i];
1578 static std::array<ShortTermRefPicSet,65> short_term_ref_pic_set;
1580 static uint sub_layer_size = 0;
1581 static uint8_t* max_dec_pic_buffering_minus1 =
nullptr;
1588 uint max_sub_layers_minus1 = 0;
1591 max_sub_layers_minus1 = ext_or_max_sub_layers_minus1;
1596 LOG(VB_RECORD, LOG_WARNING,
LOC +
1597 QString(
"Could not find VPS[%1]").arg(vps_id));
1598 max_sub_layers_minus1 = ext_or_max_sub_layers_minus1;
1608 max_sub_layers_minus1 = (ext_or_max_sub_layers_minus1 == 7) ?
1609 m_vps[vps_id].max_sub_layers :
1610 ext_or_max_sub_layers_minus1;
1614 if (sub_layer_size <= max_sub_layers_minus1)
1616 delete[] max_dec_pic_buffering_minus1;
1617 sub_layer_size = max_sub_layers_minus1 + 1;
1618 max_dec_pic_buffering_minus1 =
new uint8_t[sub_layer_size];
1621 bool MultiLayerExtSpsFlag =
1622 (
m_nuhLayerId != 0 && ext_or_max_sub_layers_minus1 == 7);
1624 if (!MultiLayerExtSpsFlag)
1629 LOG(VB_RECORD, LOG_WARNING,
LOC +
1630 QString(
"Failed to parse SPS profiel tier level."));
1638 if (MultiLayerExtSpsFlag)
1698 LOG(VB_RECORD, LOG_WARNING,
LOC +
1699 QString(
"SPS log2_max_pic_order_cnt_lsb %1 > 16")
1707 max_sub_layers_minus1); i <= max_sub_layers_minus1; ++i)
1710 if (max_dec_pic_buffering_minus1[i] > 16)
1712 LOG(VB_RECORD, LOG_WARNING,
LOC +
1713 QString(
"max_dec_pic_bufering_minus1[%1] %2 > 16")
1715 .arg(max_dec_pic_buffering_minus1[i]));
1724 if (!sps_sub_layer_ordering_info_present_flag && sps_max_sub_layers_minus1)
1726 for (i = 0; i <= (sps_max_sub_layers_minus1 - 1); ++i)
1728 max_dec_pic_buffering_minus1[i] =
1729 max_dec_pic_buffering_minus1[sps_max_sub_layers_minus1];
1730 max_num_reorder_pics[i] =
1731 max_num_reorder_pics[sps_max_sub_layers_minus1];
1732 max_latency_increase_plus1[i] =
1733 max_latency_increase_plus1[sps_max_sub_layers_minus1];
1751 bool sps_infer_scaling_list_flag = MultiLayerExtSpsFlag ?
1753 if (sps_infer_scaling_list_flag)
1776 if (num_short_term_ref_pic_sets > short_term_ref_pic_set.size() - 1 )
1778 LOG(VB_RECORD, LOG_WARNING,
LOC +
1779 QString(
"num_short_term_ref_pic_sets %1 > 64")
1780 .arg(num_short_term_ref_pic_sets));
1781 num_short_term_ref_pic_sets = short_term_ref_pic_set.size() - 1;
1783 for(i = 0; i < num_short_term_ref_pic_sets; ++i)
1786 short_term_ref_pic_set,
1787 max_dec_pic_buffering_minus1[max_sub_layers_minus1]))
1796 for (i = 0; i < num_long_term_ref_pics_sps; ++i)
1806 LOG(VB_RECORD, LOG_WARNING,
LOC +
1807 QString(
"POC[%1] %2").arg(i).arg(
m_poc[i]));
1840 uint8_t max_sub_layers_minus1 = br.
get_bits(3);
1845 m_vps[vps_id].max_sub_layers = max_sub_layers_minus1 + 1;
1848 LOG(VB_RECORD, LOG_WARNING,
LOC +
1849 QString(
"Failed to parse VPS profile tier level."));
1853 bool vps_sub_layer_ordering_info_present_flag = br.
get_bits(1);
1854 for (i = (vps_sub_layer_ordering_info_present_flag ? 0 :
1855 max_sub_layers_minus1);
1856 i <= max_sub_layers_minus1; ++i)
1866 if (!vps_sub_layer_ordering_info_present_flag &&
1867 max_sub_layers_minus1)
1869 for (i = 0; i <= (max_sub_layers_minus1 - 1); ++i)
1871 max_dec_pic_buffering_minus1[i] =
1872 max_dec_pic_buffering_minus1[max_sub_layers_minus1];
1873 max_num_reorder_pics[i] =
1874 max_num_reorder_pics[max_sub_layers_minus1];
1875 max_latency_increase_plus1[i] =
1876 max_latency_increase_plus1[max_sub_layers_minus1];
1881 uint8_t vps_max_layer_id = br.
get_bits(6);
1883 for (i = 1; i <= vps_num_layer_sets_minus1; ++i)
1885 for (
int j = 0; j <= vps_max_layer_id; ++j)
1890 if (vps_num_layer_sets_minus1 < 0)
1892 LOG(VB_RECORD, LOG_WARNING,
LOC +
1893 QString(
"vps_num_layer_sets_minus1 %1 < 0")
1894 .arg(vps_num_layer_sets_minus1));
1924 LOG(VB_RECORD, LOG_DEBUG,
1925 QString(
"VUI unitsInTick %1 timeScale %2 fixedRate %3")
1930 #if 0 // We don't need the rest.
1932 for (i = 0; i < vps_num_hrd_parameters; ++i)
1936 cprms_present_flag[i] = br.
get_bits(1);
1937 hrd_parameters(cprms_present_flag[i], max_sub_layers_minus1);
1942 #if 0 // We don't need the rest.
1943 bool vps_extension_flag = br.
get_bits(1);
1944 if (vps_extension_flag)
1946 while (!byte_aligned())
1951 vps_extension2_flag = br.
get_bits(1);
1952 if (vps_extension2_flag)
1954 while (more_rbsp_data())
1958 rbsp_trailing_bits();
1976 #if 0 // Rest not needed
1977 sign_data_hiding_enabled_flag;
1978 cabac_init_present_flag;
1979 num_ref_idx_l0_default_active_minus1;
1980 num_ref_idx_l1_default_active_minus1;
1982 constrained_intra_pred_flag;
1983 transform_skip_enabled_flag;
1984 cu_qp_delta_enabled_flag;
1985 if( cu_qp_delta_enabled_flag )
1986 diff_cu_qp_delta_depth;
1989 pps_slice_chroma_qp_offsets_present_flag;
1991 weighted_bipred_flag;
1992 transquant_bypass_enabled_flag;
1994 entropy_coding_sync_enabled_flag;
1995 if( tiles_enabled_flag ) {
1996 num_tile_columns_minus1;
1997 num_tile_rows_minus1;
1998 uniform_spacing_flag;
1999 if( !uniform_spacing_flag ) {
2000 for( i = 0; i < num_tile_columns_minus1; i++ )
2001 column_width_minus1[ i ];
2002 for( i = 0; i < num_tile_rows_minus1; i++ )
2003 row_height_minus1[ i ];
2005 loop_filter_across_tiles_enabled_flag;
2006 pps_loop_filter_across_slices_enabled_flag;
2007 deblocking_filter_control_present_flag;
2008 if( deblocking_filter_control_present_flag ) {
2010 deblocking_filter_override_enabled_flag;
2011 pps_deblocking_filter_disabled_flag;
2012 if( !pps_deblocking_filter_disabled_flag ) {
2013 pps_beta_offset_div2;
2017 pps_scaling_list_data_present_flag;
2018 if( pps_scaling_list_data_present_flag )
2019 scaling_list_data( );
2020 lists_modification_present_flag;
2021 log2_parallel_merge_level_minus2;
2022 slice_segment_header_extension_present_flag;
2023 pps_extension_present_flag;
2024 if( pps_extension_present_flag ) {
2025 pps_range_extension_flag;
2026 pps_multilayer_extension_flag;
2027 pps_3d_extension_flag;
2028 pps_scc_extension_flag;
2029 pps_extension_4bits;
2031 if( pps_range_extension_flag )
2032 pps_range_extension( );
2033 if( pps_multilayer_extension_flag )
2034 pps_multilayer_extension( );
2035 if( pps_3d_extension_flag )
2036 pps_3d_extension( );
2037 if( pps_scc_extension_flag )
2038 pps_scc_extension( );
2039 if( pps_extension_4bits )
2040 while( more_rbsp_data( ) )
2041 pps_extension_data_flag;
2042 rbsp_trailing_bits( )
2051 static const std::array<const uint8_t,5> subwc {1, 2, 2, 1, 1};
2062 static const std::array<const uint8_t,5> subhc {1, 2, 1, 1, 1};