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

Method parse

YUViewLib/src/parser/VVC/slice_header.cpp:55–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53using namespace parser::reader;
54
55void slice_header::parse(SubByteReaderLogging & reader,
56 NalType nal_unit_type,
57 VPSMap & vpsMap,
58 SPSMap & spsMap,
59 PPSMap & ppsMap,
60 std::shared_ptr<slice_layer_rbsp> sliceLayer,
61 std::shared_ptr<picture_header_structure> picHeader)
62{
63 SubByteReaderLoggingSubLevel subLevel(reader, "slice_header");
64
65 this->sh_picture_header_in_slice_header_flag =
66 reader.readFlag("sh_picture_header_in_slice_header_flag");
67 if (this->sh_picture_header_in_slice_header_flag)
68 {
69 this->picture_header_structure_instance = std::make_shared<picture_header_structure>();
70 this->picture_header_structure_instance->parse(reader, vpsMap, spsMap, ppsMap, sliceLayer);
71 picHeader = this->picture_header_structure_instance;
72 }
73
74 if (!picHeader)
75 throw std::logic_error("No picture_header_structure given for parsing of slice_header.");
76
77 if (ppsMap.count(picHeader->ph_pic_parameter_set_id) == 0)
78 throw std::logic_error("PPS with given ph_pic_parameter_set_id not found.");
79 auto pps = ppsMap[picHeader->ph_pic_parameter_set_id];
80
81 if (spsMap.count(pps->pps_seq_parameter_set_id) == 0)
82 throw std::logic_error("SPS with given pps_seq_parameter_set_id not found.");
83 auto sps = spsMap[pps->pps_seq_parameter_set_id];
84
85 auto CurrSubpicIdx = 0u;
86 if (sps->sps_subpic_info_present_flag)
87 {
88 auto nrBits = sps->sps_subpic_id_len_minus1 + 1;
89 this->sh_subpic_id = reader.readBits("sh_subpic_id", nrBits);
90
91 for (unsigned i = 0; i < pps->SubpicIdVal.size(); i++)
92 {
93 if (pps->SubpicIdVal.at(i) == this->sh_subpic_id)
94 {
95 CurrSubpicIdx = i;
96 break;
97 }
98 }
99 }
100
101 if ((pps->pps_rect_slice_flag && pps->NumSlicesInSubpic[CurrSubpicIdx] > 1) ||
102 (!pps->pps_rect_slice_flag && pps->NumTilesInPic > 1))
103 {
104 unsigned nrBits;
105 Options opt;
106 if (!pps->pps_rect_slice_flag)
107 {
108 nrBits = std::ceil(std::log2(pps->NumTilesInPic));
109 opt = Options().withCheckRange({0, pps->NumTilesInPic - 1});
110 }
111 else
112 {

Callers

nothing calls this directly

Calls 9

OptionsClass · 0.85
formatArrayFunction · 0.85
readFlagMethod · 0.80
readUEVMethod · 0.80
getActiveRefPixListMethod · 0.80
readSEVMethod · 0.80
readBitsMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected