5#include <c++utilities/io/binaryreader.h>
6#include <c++utilities/io/bitreader.h>
9#include <unordered_map>
32 auto buffer = make_unique<char[]>(
size);
33 reader.read(buffer.get(),
size);
34 BitReader bitReader(buffer.get(),
size);
38 bitReader.skipBits(3);
39 if (bitReader.readBits<std::uint8_t>(5) != 7) {
45 id = bitReader.readUnsignedExpGolombCodedBits<
ugolomb>();
60 bitReader.skipBits(1);
62 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
63 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
64 bitReader.skipBits(1);
65 if (bitReader.readBit()) {
66 for (std::uint8_t i = 0; i < 8; ++i) {
68 if (bitReader.readBit()) {
70 bitReader.skipBits(16);
72 bitReader.skipBits(64);
94 bitReader.readUnsignedExpGolombCodedBits<
ugolomb>();
102 bitReader.readUnsignedExpGolombCodedBits<
ugolomb>();
103 bitReader.skipBits(1);
107 mbSize.
setWidth(bitReader.readUnsignedExpGolombCodedBits<std::uint32_t>() + 1);
108 mbSize.
setHeight(bitReader.readUnsignedExpGolombCodedBits<std::uint32_t>() + 1);
112 bitReader.skipBits(1);
115 if (bitReader.readBit()) {
116 cropping.
setLeft(bitReader.readUnsignedExpGolombCodedBits<std::uint32_t>());
117 cropping.
setRight(bitReader.readUnsignedExpGolombCodedBits<std::uint32_t>());
118 cropping.
setTop(bitReader.readUnsignedExpGolombCodedBits<std::uint32_t>());
125 ugolomb croppingScaleX, croppingScaleY;
149 if ((bitReader.readBit())) {
159 if (bitReader.readBit()) {
160 bitReader.skipBits(1);
162 if (bitReader.readBit()) {
163 bitReader.skipBits(4);
164 if (bitReader.readBit()) {
165 bitReader.skipBits(24);
168 if (bitReader.readBit()) {
169 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
170 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
182 if (bitReader.readBit()) {
186 if (bitReader.readBit()) {
191 bitReader.skipBits(1);
197 if (bitReader.readBit()) {
198 bitReader.skipBits(1);
199 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
200 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
201 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
202 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
203 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
204 bitReader.readUnsignedExpGolombCodedBits<std::uint8_t>();
208 }
catch (
const std::ios_base::failure &) {
229 auto buffer = make_unique<char[]>(
size);
230 reader.read(buffer.get(),
size);
231 BitReader bitReader(buffer.get(),
size);
235 bitReader.skipBits(1);
236 if (bitReader.readBits<std::uint8_t>(5) != 8) {
239 id = bitReader.readUnsignedExpGolombCodedBits<
ugolomb>();
240 spsId = bitReader.readUnsignedExpGolombCodedBits<
ugolomb>();
241 bitReader.skipBits(1);
243 }
catch (
const std::ios_base::failure &) {
264 reader.readUnsignedExpGolombCodedBits<std::uint8_t>();
265 reader.readUnsignedExpGolombCodedBits<std::uint8_t>();
InvalidDataException() noexcept
Constructs a new exception.
constexpr bool isNull() const
Returns true if all margins are is 0; otherwise returns false;.
constexpr std::uint32_t right() const
Returns the right margin.
constexpr std::uint32_t left() const
Returns the left margin.
void setRight(std::uint32_t right)
Sets the right margin to right.
constexpr std::uint32_t top() const
Returns the top margin.
constexpr std::uint32_t bottom() const
Returns the bottom margin.
void setLeft(std::uint32_t left)
Sets the left margin to left.
void setTop(std::uint32_t top)
Sets the top margin to top.
void setBottom(std::uint32_t bottom)
Sets the bottom margin to bottom.
NotImplementedException() noexcept
Constructs a new exception.
The Size class defines the size of a two-dimensional object using integer point precision.
constexpr std::uint32_t height() const
Returns the height.
void setWidth(std::uint32_t value)
Sets the width.
constexpr std::uint32_t width() const
Returns the width.
void setHeight(std::uint32_t value)
Sets the height.
TruncatedDataException() noexcept
Constructs a new exception.
Contains all classes and functions of the TagInfo library.
std::uint32_t ugolomb
Type used to store unsigned integer values using golomb coding.
std::int32_t sgolomb
Type used to store signed integer values using golomb coding.
std::uint16_t denominator
constexpr bool isExtended() const
Returns whether numerator and denominator must be read from extended SAR header.
constexpr AspectRatio()
Constructs an invalid aspect ratio.
std::uint8_t initialCpbRemovalDelayLength
std::uint8_t bitRateScale
void parse(CppUtilities::BitReader &reader)
Parses HRD parameters.
std::uint8_t cpbRemovalDelayLength
std::uint8_t timeOffsetLength
std::uint8_t cpbOutputDelayLength
std::uint8_t cpbSizeScale
std::uint8_t picOrderPresent
void parse(CppUtilities::BinaryReader &reader, std::uint32_t maxSize)
Parses the PPS info.
static constexpr std::uint16_t minSize
std::uint8_t deltaPicOrderAlwaysZeroFlag
ugolomb pictureOrderCountType
void parse(CppUtilities::BinaryReader &reader, std::uint32_t maxSize)
Parses the SPS info.
AspectRatio pixelAspectRatio
HrdParameters vclHrdParameters
HrdParameters nalHrdParameters
std::uint8_t frameMbsOnly
std::uint8_t hrdParametersPresent
static constexpr std::uint16_t minSize
ugolomb log2MaxPictureOrderCountLsb
sgolomb offsetForTopToBottomField
std::uint8_t profileConstraints
ugolomb numRefFramesInPicOrderCntCycle
std::uint8_t profileIndication
std::uint8_t levelIndication
sgolomb offsetForNonRefPic
std::uint8_t pictureStructPresent
ugolomb chromaFormatIndication
std::uint8_t fixedFrameRate
std::uint32_t unitsInTick