88 if (spsData.
size() < 4) {
89 if (error_message) *error_message =
"SPS data too small";
93 BitReader br(spsData);
97 fl::u8 nalType = nalHeader & 0x1F;
107 info.
level = level_idc;
110 fl::u32 chromaFormatIdc = 1;
111 if (profile_idc == 100 || profile_idc == 110 || profile_idc == 122 ||
112 profile_idc == 244 || profile_idc == 44 || profile_idc == 83 ||
113 profile_idc == 86 || profile_idc == 118 || profile_idc == 128 ||
114 profile_idc == 138 || profile_idc == 139 || profile_idc == 134 ||
115 profile_idc == 135) {
116 chromaFormatIdc = br.readUE();
117 if (chromaFormatIdc == 3) {
124 fl::u32 seqScalingMatrixPresent = br.readBits(1);
125 if (seqScalingMatrixPresent) {
126 int limit = (chromaFormatIdc != 3) ? 8 : 12;
127 for (
int i = 0; i < limit; i++) {
128 if (br.readBits(1)) {
129 skipScalingList(br, (i < 6) ? 16 : 64);
136 fl::u32 picOrderCntType = br.readUE();
137 if (picOrderCntType == 0) {
139 }
else if (picOrderCntType == 1) {
143 fl::u32 numRefFramesInPoc = br.readUE();
144 for (fl::u32 i = 0; i < numRefFramesInPoc; i++) {
152 fl::u32 picWidthInMbs = br.readUE() + 1;
153 fl::u32 picHeightInMapUnits = br.readUE() + 1;
155 fl::u32 frameMbsOnly = br.readBits(1);
163 fl::u32 cropLeft = 0, cropRight = 0, cropTop = 0, cropBottom = 0;
164 fl::u32 frameCropping = br.readBits(1);
166 cropLeft = br.readUE();
167 cropRight = br.readUE();
168 cropTop = br.readUE();
169 cropBottom = br.readUE();
173 fl::u32
width = picWidthInMbs * 16;
174 fl::u32
height = (2 - frameMbsOnly) * picHeightInMapUnits * 16;
177 fl::u32 cropUnitX = 1, cropUnitY = 2 - frameMbsOnly;
178 if (chromaFormatIdc == 1) {
181 }
else if (chromaFormatIdc == 2) {
186 width -= (cropLeft + cropRight) * cropUnitX;
187 height -= (cropTop + cropBottom) * cropUnitY;