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

Method parse

YUViewLib/src/parser/Mpeg2/nal_unit_header.cpp:40–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38using namespace parser::reader;
39
40void nal_unit_header::parse(SubByteReaderLogging &reader)
41{
42 SubByteReaderLoggingSubLevel subLevel(reader, "header_code()");
43
44 {
45 Options opt;
46 opt.meaningMap[0] = "picture_start_code";
47 // 01 through AF
48 for (int i = 0x01; i < 0xaf; i++)
49 opt.meaningMap[i] = "slice_start_code - slice " + std::to_string(i);
50 opt.meaningMap[176] = "reserved";
51 opt.meaningMap[177] = "reserved";
52 opt.meaningMap[178] = "user_data_start_code";
53 opt.meaningMap[179] = "sequence_header_code";
54 opt.meaningMap[180] = "sequence_error_code";
55 opt.meaningMap[181] = "extension_start_code";
56 opt.meaningMap[182] = "reserved";
57 opt.meaningMap[183] = "sequence_end_code";
58 opt.meaningMap[184] = "group_start_code";
59 opt.meaningMap[185] = "system start codes";
60
61 this->start_code_value = reader.readBits("start_code_value", 8, opt);
62 }
63
64 if (this->start_code_value == 0)
65 this->nal_unit_type = NalType::PICTURE;
66 else if (this->start_code_value >= 0x01 && this->start_code_value <= 0xaf)
67 {
68 this->nal_unit_type = NalType::SLICE;
69 this->slice_id = this->start_code_value - 1;
70 }
71 else if (this->start_code_value == 0xb0 || this->start_code_value == 0xb1 ||
72 this->start_code_value == 0xb6)
73 this->nal_unit_type = NalType::RESERVED;
74 else if (this->start_code_value == 0xb2)
75 this->nal_unit_type = NalType::USER_DATA;
76 else if (this->start_code_value == 0xb3)
77 this->nal_unit_type = NalType::SEQUENCE_HEADER;
78 else if (this->start_code_value == 0xb4)
79 this->nal_unit_type = NalType::SEQUENCE_ERROR;
80 else if (this->start_code_value == 0xb5)
81 this->nal_unit_type = NalType::EXTENSION_START;
82 else if (this->start_code_value == 0xb7)
83 this->nal_unit_type = NalType::SEQUENCE_END;
84 else if (this->start_code_value == 0xb8)
85 this->nal_unit_type = NalType::GROUP_START;
86 else if (this->start_code_value >= 0xb9)
87 {
88 this->nal_unit_type = NalType::SYSTEM_START_CODE;
89 this->system_start_codes = this->start_code_value - 0xb9;
90 }
91 else
92 this->nal_unit_type = NalType::UNSPECIFIED;
93}
94
95} // namespace parser::mpeg2

Callers

nothing calls this directly

Calls 2

to_stringFunction · 0.50
readBitsMethod · 0.45

Tested by

no test coverage detected