MCPcopy Create free account
hub / github.com/IENT/YUView / parse

Method parse

YUViewLib/src/parser/HEVC/slice_segment_header.cpp:61–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59std::string to_string(SliceType sliceType) { return sliceTypeCoding.getMeaning(sliceType); }
60
61void slice_segment_header::parse(SubByteReaderLogging & reader,
62 bool firstAUInDecodingOrder,
63 int prevTid0PicSlicePicOrderCntLsb,
64 int prevTid0PicPicOrderCntMsb,
65 const nal_unit_header &nalUnitHeader,
66 SPSMap & spsMap,
67 PPSMap & ppsMap,
68 std::shared_ptr<slice_segment_layer_rbsp> firstSliceInSegment)
69{
70 SubByteReaderLoggingSubLevel subLevel(reader, "slice_segment_header()");
71
72 this->first_slice_segment_in_pic_flag = reader.readFlag("first_slice_segment_in_pic_flag");
73
74 if (nalUnitHeader.isIRAP())
75 this->no_output_of_prior_pics_flag = reader.readFlag("no_output_of_prior_pics_flag");
76
77 this->slice_pic_parameter_set_id =
78 reader.readUEV("slice_pic_parameter_set_id", Options().withCheckRange({0, 63}));
79
80 if (ppsMap.count(this->slice_pic_parameter_set_id) == 0)
81 throw std::logic_error("PPS with given slice_pic_parameter_set_id not found.");
82 auto pps = ppsMap[this->slice_pic_parameter_set_id];
83
84 if (spsMap.count(pps->pps_seq_parameter_set_id) == 0)
85 throw std::logic_error("SPS with given pps_seq_parameter_set_id not found.");
86 auto sps = spsMap[pps->pps_seq_parameter_set_id];
87
88 if (!this->first_slice_segment_in_pic_flag)
89 {
90 if (pps->dependent_slice_segments_enabled_flag)
91 this->dependent_slice_segment_flag = reader.readFlag("dependent_slice_segment_flag");
92 auto nrBits = std::ceil(std::log2(sps->PicSizeInCtbsY)); // 7.4.7.1
93 this->slice_segment_address = reader.readBits("slice_segment_address", nrBits);
94 }
95
96 if (!dependent_slice_segment_flag)
97 {
98 for (unsigned int i = 0; i < pps->num_extra_slice_header_bits; i++)
99 this->slice_reserved_flag.push_back(reader.readFlag(formatArray("slice_reserved_flag", i)));
100
101 auto sliceTypeIdx = reader.readUEV(
102 "slice_type",
103 Options().withMeaningMap(sliceTypeCoding.getMeaningMap()).withCheckRange({0, 2}));
104 this->slice_type = sliceTypeCoding.getValue(sliceTypeIdx);
105 if (pps->output_flag_present_flag)
106 this->pic_output_flag = reader.readFlag("pic_output_flag");
107
108 if (sps->separate_colour_plane_flag)
109 this->colour_plane_id = reader.readBits("colour_plane_id", 2);
110
111 if (nalUnitHeader.nal_unit_type != NalType::IDR_W_RADL &&
112 nalUnitHeader.nal_unit_type != NalType::IDR_N_LP)
113 {
114 this->slice_pic_order_cnt_lsb =
115 reader.readBits("slice_pic_order_cnt_lsb",
116 sps->log2_max_pic_order_cnt_lsb_minus4 + 4); // Max 16 bits read
117 this->short_term_ref_pic_set_sps_flag = reader.readFlag("short_term_ref_pic_set_sps_flag");
118

Callers

nothing calls this directly

Calls 12

OptionsClass · 0.85
formatArrayFunction · 0.85
readFlagMethod · 0.80
isIRAPMethod · 0.80
readUEVMethod · 0.80
getMeaningMapMethod · 0.80
NumPicTotalCurrMethod · 0.80
readSEVMethod · 0.80
logCalculatedValueMethod · 0.80
readBitsMethod · 0.45
getValueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected