| 44 | using namespace reader; |
| 45 | |
| 46 | SEIParsingResult buffering_period::parse(reader::SubByteReaderLogging & reader, |
| 47 | bool reparse, |
| 48 | SPSMap & spsMap, |
| 49 | std::shared_ptr<seq_parameter_set_rbsp> associatedSPS) |
| 50 | { |
| 51 | (void)associatedSPS; |
| 52 | |
| 53 | std::unique_ptr<SubByteReaderLoggingSubLevel> subLevel; |
| 54 | if (reparse) |
| 55 | reader.stashAndReplaceCurrentTreeItem(this->reparseTreeItem); |
| 56 | else |
| 57 | subLevel.reset(new SubByteReaderLoggingSubLevel(reader, "buffering_period()")); |
| 58 | |
| 59 | if (!reparse) |
| 60 | { |
| 61 | this->seq_parameter_set_id = reader.readUEV("seq_parameter_set_id"); |
| 62 | if (spsMap.count(this->seq_parameter_set_id) == 0) |
| 63 | { |
| 64 | this->reparseTreeItem = reader.getCurrentItemTree(); |
| 65 | return SEIParsingResult::WAIT_FOR_PARAMETER_SETS; |
| 66 | } |
| 67 | } |
| 68 | else |
| 69 | { |
| 70 | if (spsMap.count(this->seq_parameter_set_id) == 0) |
| 71 | throw std::logic_error("SPS with the given seq_parameter_set_id not found"); |
| 72 | } |
| 73 | auto refSPS = spsMap.at(this->seq_parameter_set_id); |
| 74 | |
| 75 | if (refSPS->seqParameterSetData.vuiParameters.nal_hrd_parameters_present_flag) |
| 76 | { |
| 77 | auto cpb_cnt_minus1 = refSPS->seqParameterSetData.vuiParameters.nalHrdParameters.cpb_cnt_minus1; |
| 78 | for (unsigned SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++) |
| 79 | { |
| 80 | int nrBits = refSPS->seqParameterSetData.vuiParameters.nalHrdParameters |
| 81 | .initial_cpb_removal_delay_length_minus1 + |
| 82 | 1; |
| 83 | this->initial_cpb_removal_delay.push_back( |
| 84 | reader.readBits(formatArray("initial_cpb_removal_delay", SchedSelIdx), nrBits)); |
| 85 | this->initial_cpb_removal_delay_offset.push_back( |
| 86 | reader.readBits(formatArray("initial_cpb_removal_delay_offset", SchedSelIdx), nrBits)); |
| 87 | } |
| 88 | } |
| 89 | bool VclHrdBpPresentFlag = |
| 90 | refSPS->seqParameterSetData.vuiParameters.vcl_hrd_parameters_present_flag; |
| 91 | if (VclHrdBpPresentFlag) |
| 92 | { |
| 93 | auto cpb_cnt_minus1 = refSPS->seqParameterSetData.vuiParameters.vclHrdParameters.cpb_cnt_minus1; |
| 94 | for (unsigned SchedSelIdx = 0; SchedSelIdx <= cpb_cnt_minus1; SchedSelIdx++) |
| 95 | { |
| 96 | this->initial_cpb_removal_delay.push_back( |
| 97 | reader.readBits(formatArray("initial_cpb_removal_delay", SchedSelIdx), 5)); |
| 98 | this->initial_cpb_removal_delay_offset.push_back( |
| 99 | reader.readBits(formatArray("initial_cpb_removal_delay_offset", SchedSelIdx), 5)); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | reader.popTreeItem(); |
nothing calls this directly
no test coverage detected