| 45 | using namespace reader; |
| 46 | |
| 47 | void pic_parameter_set_rbsp::parse(reader::SubByteReaderLogging &reader, SPSMap &spsMap) |
| 48 | { |
| 49 | SubByteReaderLoggingSubLevel subLevel(reader, "pic_parameter_set_rbsp()"); |
| 50 | |
| 51 | this->pic_parameter_set_id = |
| 52 | reader.readUEV("pic_parameter_set_id", Options().withCheckRange({0, 255})); |
| 53 | this->seq_parameter_set_id = |
| 54 | reader.readUEV("seq_parameter_set_id", Options().withCheckRange({0, 31})); |
| 55 | |
| 56 | // Get the referenced sps |
| 57 | if (spsMap.count(this->seq_parameter_set_id) == 0) |
| 58 | throw std::logic_error("The signaled SPS was not found in the bitstream."); |
| 59 | auto refSPS = spsMap.at(this->seq_parameter_set_id); |
| 60 | |
| 61 | this->entropy_coding_mode_flag = |
| 62 | reader.readFlag("entropy_coding_mode_flag", Options().withMeaningVector({"CAVLC", "CABAC"})); |
| 63 | this->bottom_field_pic_order_in_frame_present_flag = |
| 64 | reader.readFlag("bottom_field_pic_order_in_frame_present_flag"); |
| 65 | this->num_slice_groups_minus1 = reader.readUEV("num_slice_groups_minus1"); |
| 66 | if (this->num_slice_groups_minus1 > 0) |
| 67 | { |
| 68 | this->slice_group_map_type = |
| 69 | reader.readUEV("slice_group_map_type", Options().withCheckRange({0, 6})); |
| 70 | if (this->slice_group_map_type == 0) |
| 71 | { |
| 72 | for (unsigned iGroup = 0; iGroup <= this->num_slice_groups_minus1; iGroup++) |
| 73 | this->run_length_minus1[iGroup] = reader.readUEV(formatArray("run_length_minus1", iGroup)); |
| 74 | } |
| 75 | else if (this->slice_group_map_type == 2) |
| 76 | { |
| 77 | for (unsigned iGroup = 0; iGroup < this->num_slice_groups_minus1; iGroup++) |
| 78 | { |
| 79 | this->top_left[iGroup] = reader.readUEV(formatArray("top_left", iGroup)); |
| 80 | this->bottom_right[iGroup] = reader.readUEV(formatArray("bottom_right", iGroup)); |
| 81 | } |
| 82 | } |
| 83 | else if (this->slice_group_map_type == 3 || this->slice_group_map_type == 4 || |
| 84 | this->slice_group_map_type == 5) |
| 85 | { |
| 86 | this->slice_group_change_direction_flag = |
| 87 | reader.readFlag("slice_group_change_direction_flag"); |
| 88 | this->slice_group_change_rate_minus1 = reader.readUEV("slice_group_change_rate_minus1"); |
| 89 | this->SliceGroupChangeRate = slice_group_change_rate_minus1 + 1; |
| 90 | } |
| 91 | else if (this->slice_group_map_type == 6) |
| 92 | { |
| 93 | this->pic_size_in_map_units_minus1 = reader.readUEV("pic_size_in_map_units_minus1"); |
| 94 | for (unsigned i = 0; i <= this->pic_size_in_map_units_minus1; i++) |
| 95 | { |
| 96 | auto nrBits = std::ceil(std::log2(this->num_slice_groups_minus1 + 1)); |
| 97 | this->slice_group_id.push_back(reader.readBits(formatArray("slice_group_id", i), nrBits)); |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | this->num_ref_idx_l0_default_active_minus1 = |
| 102 | reader.readUEV("num_ref_idx_l0_default_active_minus1", Options().withCheckRange({0, 31})); |
| 103 | this->num_ref_idx_l1_default_active_minus1 = |
| 104 | reader.readUEV("num_ref_idx_l1_default_active_minus1", Options().withCheckRange({0, 31})); |
nothing calls this directly
no test coverage detected