1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** |
---|
35 | \file SEIread.cpp |
---|
36 | \brief reading functionality for SEI messages |
---|
37 | */ |
---|
38 | |
---|
39 | #include "TLibCommon/CommonDef.h" |
---|
40 | #include "TLibCommon/TComBitStream.h" |
---|
41 | #include "TLibCommon/SEI.h" |
---|
42 | #include "TLibCommon/TComSlice.h" |
---|
43 | #include "SyntaxElementParser.h" |
---|
44 | #include "SEIread.h" |
---|
45 | |
---|
46 | //! \ingroup TLibDecoder |
---|
47 | //! \{ |
---|
48 | |
---|
49 | #if ENC_DEC_TRACE |
---|
50 | Void xTraceSEIHeader() |
---|
51 | { |
---|
52 | fprintf( g_hTrace, "=========== SEI message ===========\n"); |
---|
53 | } |
---|
54 | |
---|
55 | Void xTraceSEIMessageType(SEI::PayloadType payloadType) |
---|
56 | { |
---|
57 | switch (payloadType) |
---|
58 | { |
---|
59 | case SEI::DECODED_PICTURE_HASH: |
---|
60 | fprintf( g_hTrace, "=========== Decoded picture hash SEI message ===========\n"); |
---|
61 | break; |
---|
62 | case SEI::USER_DATA_UNREGISTERED: |
---|
63 | fprintf( g_hTrace, "=========== User Data Unregistered SEI message ===========\n"); |
---|
64 | break; |
---|
65 | case SEI::ACTIVE_PARAMETER_SETS: |
---|
66 | fprintf( g_hTrace, "=========== Active Parameter sets SEI message ===========\n"); |
---|
67 | break; |
---|
68 | case SEI::BUFFERING_PERIOD: |
---|
69 | fprintf( g_hTrace, "=========== Buffering period SEI message ===========\n"); |
---|
70 | break; |
---|
71 | case SEI::PICTURE_TIMING: |
---|
72 | fprintf( g_hTrace, "=========== Picture timing SEI message ===========\n"); |
---|
73 | break; |
---|
74 | case SEI::RECOVERY_POINT: |
---|
75 | fprintf( g_hTrace, "=========== Recovery point SEI message ===========\n"); |
---|
76 | break; |
---|
77 | case SEI::FRAME_PACKING: |
---|
78 | fprintf( g_hTrace, "=========== Frame Packing Arrangement SEI message ===========\n"); |
---|
79 | break; |
---|
80 | case SEI::DISPLAY_ORIENTATION: |
---|
81 | fprintf( g_hTrace, "=========== Display Orientation SEI message ===========\n"); |
---|
82 | break; |
---|
83 | case SEI::TEMPORAL_LEVEL0_INDEX: |
---|
84 | fprintf( g_hTrace, "=========== Temporal Level Zero Index SEI message ===========\n"); |
---|
85 | break; |
---|
86 | case SEI::REGION_REFRESH_INFO: |
---|
87 | fprintf( g_hTrace, "=========== Gradual Decoding Refresh Information SEI message ===========\n"); |
---|
88 | break; |
---|
89 | case SEI::DECODING_UNIT_INFO: |
---|
90 | fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); |
---|
91 | break; |
---|
92 | case SEI::TONE_MAPPING_INFO: |
---|
93 | fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); |
---|
94 | break; |
---|
95 | case SEI::SOP_DESCRIPTION: |
---|
96 | fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); |
---|
97 | break; |
---|
98 | case SEI::SCALABLE_NESTING: |
---|
99 | fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); |
---|
100 | break; |
---|
101 | #if H_MV |
---|
102 | case SEI::SUB_BITSTREAM_PROPERTY: |
---|
103 | fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n"); |
---|
104 | break; |
---|
105 | #endif |
---|
106 | default: |
---|
107 | fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); |
---|
108 | break; |
---|
109 | } |
---|
110 | } |
---|
111 | #endif |
---|
112 | |
---|
113 | /** |
---|
114 | * unmarshal a single SEI message from bitstream bs |
---|
115 | */ |
---|
116 | void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps) |
---|
117 | { |
---|
118 | setBitstream(bs); |
---|
119 | |
---|
120 | assert(!m_pcBitstream->getNumBitsUntilByteAligned()); |
---|
121 | do |
---|
122 | { |
---|
123 | xReadSEImessage(seis, nalUnitType, sps); |
---|
124 | /* SEI messages are an integer number of bytes, something has failed |
---|
125 | * in the parsing if bitstream not byte-aligned */ |
---|
126 | assert(!m_pcBitstream->getNumBitsUntilByteAligned()); |
---|
127 | } while (m_pcBitstream->getNumBitsLeft() > 8); |
---|
128 | |
---|
129 | UInt rbspTrailingBits; |
---|
130 | READ_CODE(8, rbspTrailingBits, "rbsp_trailing_bits"); |
---|
131 | assert(rbspTrailingBits == 0x80); |
---|
132 | } |
---|
133 | |
---|
134 | Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps) |
---|
135 | { |
---|
136 | #if ENC_DEC_TRACE |
---|
137 | xTraceSEIHeader(); |
---|
138 | #endif |
---|
139 | Int payloadType = 0; |
---|
140 | UInt val = 0; |
---|
141 | |
---|
142 | do |
---|
143 | { |
---|
144 | READ_CODE (8, val, "payload_type"); |
---|
145 | payloadType += val; |
---|
146 | } while (val==0xFF); |
---|
147 | |
---|
148 | UInt payloadSize = 0; |
---|
149 | do |
---|
150 | { |
---|
151 | READ_CODE (8, val, "payload_size"); |
---|
152 | payloadSize += val; |
---|
153 | } while (val==0xFF); |
---|
154 | |
---|
155 | #if ENC_DEC_TRACE |
---|
156 | xTraceSEIMessageType((SEI::PayloadType)payloadType); |
---|
157 | #endif |
---|
158 | |
---|
159 | /* extract the payload for this single SEI message. |
---|
160 | * This allows greater safety in erroneous parsing of an SEI message |
---|
161 | * from affecting subsequent messages. |
---|
162 | * After parsing the payload, bs needs to be restored as the primary |
---|
163 | * bitstream. |
---|
164 | */ |
---|
165 | TComInputBitstream *bs = getBitstream(); |
---|
166 | setBitstream(bs->extractSubstream(payloadSize * 8)); |
---|
167 | |
---|
168 | SEI *sei = NULL; |
---|
169 | |
---|
170 | if(nalUnitType == NAL_UNIT_PREFIX_SEI) |
---|
171 | { |
---|
172 | switch (payloadType) |
---|
173 | { |
---|
174 | case SEI::USER_DATA_UNREGISTERED: |
---|
175 | sei = new SEIuserDataUnregistered; |
---|
176 | xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize); |
---|
177 | break; |
---|
178 | case SEI::ACTIVE_PARAMETER_SETS: |
---|
179 | sei = new SEIActiveParameterSets; |
---|
180 | xParseSEIActiveParameterSets((SEIActiveParameterSets&) *sei, payloadSize); |
---|
181 | break; |
---|
182 | case SEI::DECODING_UNIT_INFO: |
---|
183 | if (!sps) |
---|
184 | { |
---|
185 | printf ("Warning: Found Decoding unit SEI message, but no active SPS is available. Ignoring."); |
---|
186 | } |
---|
187 | else |
---|
188 | { |
---|
189 | sei = new SEIDecodingUnitInfo; |
---|
190 | xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps); |
---|
191 | } |
---|
192 | break; |
---|
193 | case SEI::BUFFERING_PERIOD: |
---|
194 | if (!sps) |
---|
195 | { |
---|
196 | printf ("Warning: Found Buffering period SEI message, but no active SPS is available. Ignoring."); |
---|
197 | } |
---|
198 | else |
---|
199 | { |
---|
200 | sei = new SEIBufferingPeriod; |
---|
201 | xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps); |
---|
202 | } |
---|
203 | break; |
---|
204 | case SEI::PICTURE_TIMING: |
---|
205 | if (!sps) |
---|
206 | { |
---|
207 | printf ("Warning: Found Picture timing SEI message, but no active SPS is available. Ignoring."); |
---|
208 | } |
---|
209 | else |
---|
210 | { |
---|
211 | sei = new SEIPictureTiming; |
---|
212 | xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps); |
---|
213 | } |
---|
214 | break; |
---|
215 | case SEI::RECOVERY_POINT: |
---|
216 | sei = new SEIRecoveryPoint; |
---|
217 | xParseSEIRecoveryPoint((SEIRecoveryPoint&) *sei, payloadSize); |
---|
218 | break; |
---|
219 | case SEI::FRAME_PACKING: |
---|
220 | sei = new SEIFramePacking; |
---|
221 | xParseSEIFramePacking((SEIFramePacking&) *sei, payloadSize); |
---|
222 | break; |
---|
223 | case SEI::DISPLAY_ORIENTATION: |
---|
224 | sei = new SEIDisplayOrientation; |
---|
225 | xParseSEIDisplayOrientation((SEIDisplayOrientation&) *sei, payloadSize); |
---|
226 | break; |
---|
227 | case SEI::TEMPORAL_LEVEL0_INDEX: |
---|
228 | sei = new SEITemporalLevel0Index; |
---|
229 | xParseSEITemporalLevel0Index((SEITemporalLevel0Index&) *sei, payloadSize); |
---|
230 | break; |
---|
231 | case SEI::REGION_REFRESH_INFO: |
---|
232 | sei = new SEIGradualDecodingRefreshInfo; |
---|
233 | xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); |
---|
234 | break; |
---|
235 | case SEI::TONE_MAPPING_INFO: |
---|
236 | sei = new SEIToneMappingInfo; |
---|
237 | xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); |
---|
238 | break; |
---|
239 | case SEI::SOP_DESCRIPTION: |
---|
240 | sei = new SEISOPDescription; |
---|
241 | xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize); |
---|
242 | break; |
---|
243 | case SEI::SCALABLE_NESTING: |
---|
244 | sei = new SEIScalableNesting; |
---|
245 | xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps); |
---|
246 | break; |
---|
247 | #if H_MV |
---|
248 | case SEI::SUB_BITSTREAM_PROPERTY: |
---|
249 | sei = new SEISubBitstreamProperty; |
---|
250 | xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei); |
---|
251 | break; |
---|
252 | #endif |
---|
253 | default: |
---|
254 | for (UInt i = 0; i < payloadSize; i++) |
---|
255 | { |
---|
256 | UInt seiByte; |
---|
257 | READ_CODE (8, seiByte, "unknown prefix SEI payload byte"); |
---|
258 | } |
---|
259 | printf ("Unknown prefix SEI message (payloadType = %d) was found!\n", payloadType); |
---|
260 | } |
---|
261 | } |
---|
262 | else |
---|
263 | { |
---|
264 | switch (payloadType) |
---|
265 | { |
---|
266 | case SEI::USER_DATA_UNREGISTERED: |
---|
267 | sei = new SEIuserDataUnregistered; |
---|
268 | xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize); |
---|
269 | break; |
---|
270 | case SEI::DECODED_PICTURE_HASH: |
---|
271 | sei = new SEIDecodedPictureHash; |
---|
272 | xParseSEIDecodedPictureHash((SEIDecodedPictureHash&) *sei, payloadSize); |
---|
273 | break; |
---|
274 | default: |
---|
275 | for (UInt i = 0; i < payloadSize; i++) |
---|
276 | { |
---|
277 | UInt seiByte; |
---|
278 | READ_CODE (8, seiByte, "unknown suffix SEI payload byte"); |
---|
279 | } |
---|
280 | printf ("Unknown suffix SEI message (payloadType = %d) was found!\n", payloadType); |
---|
281 | } |
---|
282 | } |
---|
283 | if (sei != NULL) |
---|
284 | { |
---|
285 | seis.push_back(sei); |
---|
286 | } |
---|
287 | |
---|
288 | /* By definition the underlying bitstream terminates in a byte-aligned manner. |
---|
289 | * 1. Extract all bar the last MIN(bitsremaining,nine) bits as reserved_payload_extension_data |
---|
290 | * 2. Examine the final 8 bits to determine the payload_bit_equal_to_one marker |
---|
291 | * 3. Extract the remainingreserved_payload_extension_data bits. |
---|
292 | * |
---|
293 | * If there are fewer than 9 bits available, extract them. |
---|
294 | */ |
---|
295 | Int payloadBitsRemaining = getBitstream()->getNumBitsLeft(); |
---|
296 | if (payloadBitsRemaining) /* more_data_in_payload() */ |
---|
297 | { |
---|
298 | for (; payloadBitsRemaining > 9; payloadBitsRemaining--) |
---|
299 | { |
---|
300 | UInt reservedPayloadExtensionData; |
---|
301 | READ_CODE (1, reservedPayloadExtensionData, "reserved_payload_extension_data"); |
---|
302 | } |
---|
303 | |
---|
304 | /* 2 */ |
---|
305 | Int finalBits = getBitstream()->peekBits(payloadBitsRemaining); |
---|
306 | Int finalPayloadBits = 0; |
---|
307 | for (Int mask = 0xff; finalBits & (mask >> finalPayloadBits); finalPayloadBits++) |
---|
308 | { |
---|
309 | continue; |
---|
310 | } |
---|
311 | |
---|
312 | /* 3 */ |
---|
313 | for (; payloadBitsRemaining > 9 - finalPayloadBits; payloadBitsRemaining--) |
---|
314 | { |
---|
315 | UInt reservedPayloadExtensionData; |
---|
316 | READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data"); |
---|
317 | } |
---|
318 | |
---|
319 | UInt dummy; |
---|
320 | READ_FLAG (dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--; |
---|
321 | while (payloadBitsRemaining) |
---|
322 | { |
---|
323 | READ_FLAG (dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--; |
---|
324 | } |
---|
325 | } |
---|
326 | |
---|
327 | /* restore primary bitstream for sei_message */ |
---|
328 | getBitstream()->deleteFifo(); |
---|
329 | delete getBitstream(); |
---|
330 | setBitstream(bs); |
---|
331 | } |
---|
332 | |
---|
333 | /** |
---|
334 | * parse bitstream bs and unpack a user_data_unregistered SEI message |
---|
335 | * of payloasSize bytes into sei. |
---|
336 | */ |
---|
337 | Void SEIReader::xParseSEIuserDataUnregistered(SEIuserDataUnregistered &sei, UInt payloadSize) |
---|
338 | { |
---|
339 | assert(payloadSize >= 16); |
---|
340 | UInt val; |
---|
341 | |
---|
342 | for (UInt i = 0; i < 16; i++) |
---|
343 | { |
---|
344 | READ_CODE (8, val, "uuid_iso_iec_11578"); |
---|
345 | sei.uuid_iso_iec_11578[i] = val; |
---|
346 | } |
---|
347 | |
---|
348 | sei.userDataLength = payloadSize - 16; |
---|
349 | if (!sei.userDataLength) |
---|
350 | { |
---|
351 | sei.userData = 0; |
---|
352 | return; |
---|
353 | } |
---|
354 | |
---|
355 | sei.userData = new UChar[sei.userDataLength]; |
---|
356 | for (UInt i = 0; i < sei.userDataLength; i++) |
---|
357 | { |
---|
358 | READ_CODE (8, val, "user_data" ); |
---|
359 | sei.userData[i] = val; |
---|
360 | } |
---|
361 | } |
---|
362 | |
---|
363 | /** |
---|
364 | * parse bitstream bs and unpack a decoded picture hash SEI message |
---|
365 | * of payloadSize bytes into sei. |
---|
366 | */ |
---|
367 | Void SEIReader::xParseSEIDecodedPictureHash(SEIDecodedPictureHash& sei, UInt /*payloadSize*/) |
---|
368 | { |
---|
369 | UInt val; |
---|
370 | READ_CODE (8, val, "hash_type"); |
---|
371 | sei.method = static_cast<SEIDecodedPictureHash::Method>(val); |
---|
372 | for(Int yuvIdx = 0; yuvIdx < 3; yuvIdx++) |
---|
373 | { |
---|
374 | if(SEIDecodedPictureHash::MD5 == sei.method) |
---|
375 | { |
---|
376 | for (UInt i = 0; i < 16; i++) |
---|
377 | { |
---|
378 | READ_CODE(8, val, "picture_md5"); |
---|
379 | sei.digest[yuvIdx][i] = val; |
---|
380 | } |
---|
381 | } |
---|
382 | else if(SEIDecodedPictureHash::CRC == sei.method) |
---|
383 | { |
---|
384 | READ_CODE(16, val, "picture_crc"); |
---|
385 | sei.digest[yuvIdx][0] = val >> 8 & 0xFF; |
---|
386 | sei.digest[yuvIdx][1] = val & 0xFF; |
---|
387 | } |
---|
388 | else if(SEIDecodedPictureHash::CHECKSUM == sei.method) |
---|
389 | { |
---|
390 | READ_CODE(32, val, "picture_checksum"); |
---|
391 | sei.digest[yuvIdx][0] = (val>>24) & 0xff; |
---|
392 | sei.digest[yuvIdx][1] = (val>>16) & 0xff; |
---|
393 | sei.digest[yuvIdx][2] = (val>>8) & 0xff; |
---|
394 | sei.digest[yuvIdx][3] = val & 0xff; |
---|
395 | } |
---|
396 | } |
---|
397 | } |
---|
398 | Void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, UInt /*payloadSize*/) |
---|
399 | { |
---|
400 | UInt val; |
---|
401 | READ_CODE(4, val, "active_vps_id"); sei.activeVPSId = val; |
---|
402 | READ_FLAG( val, "full_random_access_flag"); sei.m_fullRandomAccessFlag = val ? true : false; |
---|
403 | READ_FLAG( val, "no_param_set_update_flag"); sei.m_noParamSetUpdateFlag = val ? true : false; |
---|
404 | READ_UVLC( val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val; |
---|
405 | |
---|
406 | sei.activeSeqParamSetId.resize(sei.numSpsIdsMinus1 + 1); |
---|
407 | for (Int i=0; i < (sei.numSpsIdsMinus1 + 1); i++) |
---|
408 | { |
---|
409 | READ_UVLC(val, "active_seq_param_set_id"); sei.activeSeqParamSetId[i] = val; |
---|
410 | } |
---|
411 | |
---|
412 | UInt uibits = m_pcBitstream->getNumBitsUntilByteAligned(); |
---|
413 | |
---|
414 | while(uibits--) |
---|
415 | { |
---|
416 | READ_FLAG(val, "alignment_bit"); |
---|
417 | } |
---|
418 | } |
---|
419 | |
---|
420 | Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt /*payloadSize*/, TComSPS *sps) |
---|
421 | { |
---|
422 | UInt val; |
---|
423 | READ_UVLC(val, "decoding_unit_idx"); |
---|
424 | sei.m_decodingUnitIdx = val; |
---|
425 | |
---|
426 | TComVUI *vui = sps->getVuiParameters(); |
---|
427 | if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) |
---|
428 | { |
---|
429 | READ_CODE( ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay"); |
---|
430 | sei.m_duSptCpbRemovalDelay = val; |
---|
431 | } |
---|
432 | else |
---|
433 | { |
---|
434 | sei.m_duSptCpbRemovalDelay = 0; |
---|
435 | } |
---|
436 | READ_FLAG( val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = val ? true : false; |
---|
437 | if(sei.m_dpbOutputDuDelayPresentFlag) |
---|
438 | { |
---|
439 | READ_CODE(vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay"); |
---|
440 | sei.m_picSptDpbOutputDuDelay = val; |
---|
441 | } |
---|
442 | xParseByteAlign(); |
---|
443 | } |
---|
444 | |
---|
445 | Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt /*payloadSize*/, TComSPS *sps) |
---|
446 | { |
---|
447 | Int i, nalOrVcl; |
---|
448 | UInt code; |
---|
449 | |
---|
450 | TComVUI *pVUI = sps->getVuiParameters(); |
---|
451 | TComHRD *pHRD = pVUI->getHrdParameters(); |
---|
452 | |
---|
453 | READ_UVLC( code, "bp_seq_parameter_set_id" ); sei.m_bpSeqParameterSetId = code; |
---|
454 | if( !pHRD->getSubPicCpbParamsPresentFlag() ) |
---|
455 | { |
---|
456 | READ_FLAG( code, "irap_cpb_params_present_flag" ); sei.m_rapCpbParamsPresentFlag = code; |
---|
457 | } |
---|
458 | if( sei.m_rapCpbParamsPresentFlag ) |
---|
459 | { |
---|
460 | READ_CODE( pHRD->getCpbRemovalDelayLengthMinus1() + 1, code, "cpb_delay_offset" ); sei.m_cpbDelayOffset = code; |
---|
461 | READ_CODE( pHRD->getDpbOutputDelayLengthMinus1() + 1, code, "dpb_delay_offset" ); sei.m_dpbDelayOffset = code; |
---|
462 | } |
---|
463 | //read splicing flag and cpb_removal_delay_delta |
---|
464 | READ_FLAG( code, "concatenation_flag"); |
---|
465 | sei.m_concatenationFlag = code; |
---|
466 | READ_CODE( ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" ); |
---|
467 | sei.m_auCpbRemovalDelayDelta = code + 1; |
---|
468 | for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) |
---|
469 | { |
---|
470 | if( ( ( nalOrVcl == 0 ) && ( pHRD->getNalHrdParametersPresentFlag() ) ) || |
---|
471 | ( ( nalOrVcl == 1 ) && ( pHRD->getVclHrdParametersPresentFlag() ) ) ) |
---|
472 | { |
---|
473 | for( i = 0; i < ( pHRD->getCpbCntMinus1( 0 ) + 1 ); i ++ ) |
---|
474 | { |
---|
475 | READ_CODE( ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, "initial_cpb_removal_delay" ); |
---|
476 | sei.m_initialCpbRemovalDelay[i][nalOrVcl] = code; |
---|
477 | READ_CODE( ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, "initial_cpb_removal_delay_offset" ); |
---|
478 | sei.m_initialCpbRemovalDelayOffset[i][nalOrVcl] = code; |
---|
479 | if( pHRD->getSubPicCpbParamsPresentFlag() || sei.m_rapCpbParamsPresentFlag ) |
---|
480 | { |
---|
481 | READ_CODE( ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, "initial_alt_cpb_removal_delay" ); |
---|
482 | sei.m_initialAltCpbRemovalDelay[i][nalOrVcl] = code; |
---|
483 | READ_CODE( ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, "initial_alt_cpb_removal_delay_offset" ); |
---|
484 | sei.m_initialAltCpbRemovalDelayOffset[i][nalOrVcl] = code; |
---|
485 | } |
---|
486 | } |
---|
487 | } |
---|
488 | } |
---|
489 | xParseByteAlign(); |
---|
490 | } |
---|
491 | Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt /*payloadSize*/, TComSPS *sps) |
---|
492 | { |
---|
493 | Int i; |
---|
494 | UInt code; |
---|
495 | |
---|
496 | TComVUI *vui = sps->getVuiParameters(); |
---|
497 | TComHRD *hrd = vui->getHrdParameters(); |
---|
498 | |
---|
499 | if( vui->getFrameFieldInfoPresentFlag() ) |
---|
500 | { |
---|
501 | READ_CODE( 4, code, "pic_struct" ); sei.m_picStruct = code; |
---|
502 | READ_CODE( 2, code, "source_scan_type" ); sei.m_sourceScanType = code; |
---|
503 | READ_FLAG( code, "duplicate_flag" ); sei.m_duplicateFlag = ( code == 1 ? true : false ); |
---|
504 | } |
---|
505 | |
---|
506 | if( hrd->getCpbDpbDelaysPresentFlag()) |
---|
507 | { |
---|
508 | READ_CODE( ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" ); |
---|
509 | sei.m_auCpbRemovalDelay = code + 1; |
---|
510 | READ_CODE( ( hrd->getDpbOutputDelayLengthMinus1() + 1 ), code, "pic_dpb_output_delay" ); |
---|
511 | sei.m_picDpbOutputDelay = code; |
---|
512 | |
---|
513 | if(hrd->getSubPicCpbParamsPresentFlag()) |
---|
514 | { |
---|
515 | READ_CODE(hrd->getDpbOutputDelayDuLengthMinus1()+1, code, "pic_dpb_output_du_delay" ); |
---|
516 | sei.m_picDpbOutputDuDelay = code; |
---|
517 | } |
---|
518 | if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) |
---|
519 | { |
---|
520 | READ_UVLC( code, "num_decoding_units_minus1"); |
---|
521 | sei.m_numDecodingUnitsMinus1 = code; |
---|
522 | READ_FLAG( code, "du_common_cpb_removal_delay_flag" ); |
---|
523 | sei.m_duCommonCpbRemovalDelayFlag = code; |
---|
524 | if( sei.m_duCommonCpbRemovalDelayFlag ) |
---|
525 | { |
---|
526 | READ_CODE( ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_common_cpb_removal_delay_minus1" ); |
---|
527 | sei.m_duCommonCpbRemovalDelayMinus1 = code; |
---|
528 | } |
---|
529 | if( sei.m_numNalusInDuMinus1 != NULL ) |
---|
530 | { |
---|
531 | delete sei.m_numNalusInDuMinus1; |
---|
532 | } |
---|
533 | sei.m_numNalusInDuMinus1 = new UInt[ ( sei.m_numDecodingUnitsMinus1 + 1 ) ]; |
---|
534 | if( sei.m_duCpbRemovalDelayMinus1 != NULL ) |
---|
535 | { |
---|
536 | delete sei.m_duCpbRemovalDelayMinus1; |
---|
537 | } |
---|
538 | sei.m_duCpbRemovalDelayMinus1 = new UInt[ ( sei.m_numDecodingUnitsMinus1 + 1 ) ]; |
---|
539 | |
---|
540 | for( i = 0; i <= sei.m_numDecodingUnitsMinus1; i ++ ) |
---|
541 | { |
---|
542 | READ_UVLC( code, "num_nalus_in_du_minus1"); |
---|
543 | sei.m_numNalusInDuMinus1[ i ] = code; |
---|
544 | if( ( !sei.m_duCommonCpbRemovalDelayFlag ) && ( i < sei.m_numDecodingUnitsMinus1 ) ) |
---|
545 | { |
---|
546 | READ_CODE( ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_cpb_removal_delay_minus1" ); |
---|
547 | sei.m_duCpbRemovalDelayMinus1[ i ] = code; |
---|
548 | } |
---|
549 | } |
---|
550 | } |
---|
551 | } |
---|
552 | xParseByteAlign(); |
---|
553 | } |
---|
554 | Void SEIReader::xParseSEIRecoveryPoint(SEIRecoveryPoint& sei, UInt /*payloadSize*/) |
---|
555 | { |
---|
556 | Int iCode; |
---|
557 | UInt uiCode; |
---|
558 | READ_SVLC( iCode, "recovery_poc_cnt" ); sei.m_recoveryPocCnt = iCode; |
---|
559 | READ_FLAG( uiCode, "exact_matching_flag" ); sei.m_exactMatchingFlag = uiCode; |
---|
560 | READ_FLAG( uiCode, "broken_link_flag" ); sei.m_brokenLinkFlag = uiCode; |
---|
561 | xParseByteAlign(); |
---|
562 | } |
---|
563 | Void SEIReader::xParseSEIFramePacking(SEIFramePacking& sei, UInt /*payloadSize*/) |
---|
564 | { |
---|
565 | UInt val; |
---|
566 | READ_UVLC( val, "frame_packing_arrangement_id" ); sei.m_arrangementId = val; |
---|
567 | READ_FLAG( val, "frame_packing_arrangement_cancel_flag" ); sei.m_arrangementCancelFlag = val; |
---|
568 | |
---|
569 | if ( !sei.m_arrangementCancelFlag ) |
---|
570 | { |
---|
571 | READ_CODE( 7, val, "frame_packing_arrangement_type" ); sei.m_arrangementType = val; |
---|
572 | assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) ); |
---|
573 | READ_FLAG( val, "quincunx_sampling_flag" ); sei.m_quincunxSamplingFlag = val; |
---|
574 | |
---|
575 | READ_CODE( 6, val, "content_interpretation_type" ); sei.m_contentInterpretationType = val; |
---|
576 | READ_FLAG( val, "spatial_flipping_flag" ); sei.m_spatialFlippingFlag = val; |
---|
577 | READ_FLAG( val, "frame0_flipped_flag" ); sei.m_frame0FlippedFlag = val; |
---|
578 | READ_FLAG( val, "field_views_flag" ); sei.m_fieldViewsFlag = val; |
---|
579 | READ_FLAG( val, "current_frame_is_frame0_flag" ); sei.m_currentFrameIsFrame0Flag = val; |
---|
580 | READ_FLAG( val, "frame0_self_contained_flag" ); sei.m_frame0SelfContainedFlag = val; |
---|
581 | READ_FLAG( val, "frame1_self_contained_flag" ); sei.m_frame1SelfContainedFlag = val; |
---|
582 | |
---|
583 | if ( sei.m_quincunxSamplingFlag == 0 && sei.m_arrangementType != 5) |
---|
584 | { |
---|
585 | READ_CODE( 4, val, "frame0_grid_position_x" ); sei.m_frame0GridPositionX = val; |
---|
586 | READ_CODE( 4, val, "frame0_grid_position_y" ); sei.m_frame0GridPositionY = val; |
---|
587 | READ_CODE( 4, val, "frame1_grid_position_x" ); sei.m_frame1GridPositionX = val; |
---|
588 | READ_CODE( 4, val, "frame1_grid_position_y" ); sei.m_frame1GridPositionY = val; |
---|
589 | } |
---|
590 | |
---|
591 | READ_CODE( 8, val, "frame_packing_arrangement_reserved_byte" ); sei.m_arrangementReservedByte = val; |
---|
592 | READ_FLAG( val, "frame_packing_arrangement_persistence_flag" ); sei.m_arrangementPersistenceFlag = val ? true : false; |
---|
593 | } |
---|
594 | READ_FLAG( val, "upsampled_aspect_ratio" ); sei.m_upsampledAspectRatio = val; |
---|
595 | |
---|
596 | xParseByteAlign(); |
---|
597 | } |
---|
598 | |
---|
599 | Void SEIReader::xParseSEIDisplayOrientation(SEIDisplayOrientation& sei, UInt /*payloadSize*/) |
---|
600 | { |
---|
601 | UInt val; |
---|
602 | READ_FLAG( val, "display_orientation_cancel_flag" ); sei.cancelFlag = val; |
---|
603 | if( !sei.cancelFlag ) |
---|
604 | { |
---|
605 | READ_FLAG( val, "hor_flip" ); sei.horFlip = val; |
---|
606 | READ_FLAG( val, "ver_flip" ); sei.verFlip = val; |
---|
607 | READ_CODE( 16, val, "anticlockwise_rotation" ); sei.anticlockwiseRotation = val; |
---|
608 | READ_FLAG( val, "display_orientation_persistence_flag" ); sei.persistenceFlag = val; |
---|
609 | } |
---|
610 | xParseByteAlign(); |
---|
611 | } |
---|
612 | |
---|
613 | Void SEIReader::xParseSEITemporalLevel0Index(SEITemporalLevel0Index& sei, UInt /*payloadSize*/) |
---|
614 | { |
---|
615 | UInt val; |
---|
616 | READ_CODE ( 8, val, "tl0_idx" ); sei.tl0Idx = val; |
---|
617 | READ_CODE ( 8, val, "rap_idx" ); sei.rapIdx = val; |
---|
618 | xParseByteAlign(); |
---|
619 | } |
---|
620 | |
---|
621 | Void SEIReader::xParseSEIGradualDecodingRefreshInfo(SEIGradualDecodingRefreshInfo& sei, UInt /*payloadSize*/) |
---|
622 | { |
---|
623 | UInt val; |
---|
624 | READ_FLAG( val, "gdr_foreground_flag" ); sei.m_gdrForegroundFlag = val ? 1 : 0; |
---|
625 | xParseByteAlign(); |
---|
626 | } |
---|
627 | |
---|
628 | Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/) |
---|
629 | { |
---|
630 | Int i; |
---|
631 | UInt val; |
---|
632 | READ_UVLC( val, "tone_map_id" ); sei.m_toneMapId = val; |
---|
633 | READ_FLAG( val, "tone_map_cancel_flag" ); sei.m_toneMapCancelFlag = val; |
---|
634 | |
---|
635 | if ( !sei.m_toneMapCancelFlag ) |
---|
636 | { |
---|
637 | READ_FLAG( val, "tone_map_persistence_flag" ); sei.m_toneMapPersistenceFlag = val; |
---|
638 | READ_CODE( 8, val, "coded_data_bit_depth" ); sei.m_codedDataBitDepth = val; |
---|
639 | READ_CODE( 8, val, "target_bit_depth" ); sei.m_targetBitDepth = val; |
---|
640 | READ_UVLC( val, "model_id" ); sei.m_modelId = val; |
---|
641 | switch(sei.m_modelId) |
---|
642 | { |
---|
643 | case 0: |
---|
644 | { |
---|
645 | READ_CODE( 32, val, "min_value" ); sei.m_minValue = val; |
---|
646 | READ_CODE( 32, val, "max_value" ); sei.m_maxValue = val; |
---|
647 | break; |
---|
648 | } |
---|
649 | case 1: |
---|
650 | { |
---|
651 | READ_CODE( 32, val, "sigmoid_midpoint" ); sei.m_sigmoidMidpoint = val; |
---|
652 | READ_CODE( 32, val, "sigmoid_width" ); sei.m_sigmoidWidth = val; |
---|
653 | break; |
---|
654 | } |
---|
655 | case 2: |
---|
656 | { |
---|
657 | UInt num = 1u << sei.m_targetBitDepth; |
---|
658 | sei.m_startOfCodedInterval.resize(num+1); |
---|
659 | for(i = 0; i < num; i++) |
---|
660 | { |
---|
661 | READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval" ); |
---|
662 | sei.m_startOfCodedInterval[i] = val; |
---|
663 | } |
---|
664 | sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth; |
---|
665 | break; |
---|
666 | } |
---|
667 | case 3: |
---|
668 | { |
---|
669 | READ_CODE( 16, val, "num_pivots" ); sei.m_numPivots = val; |
---|
670 | sei.m_codedPivotValue.resize(sei.m_numPivots); |
---|
671 | sei.m_targetPivotValue.resize(sei.m_numPivots); |
---|
672 | for(i = 0; i < sei.m_numPivots; i++ ) |
---|
673 | { |
---|
674 | READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value" ); |
---|
675 | sei.m_codedPivotValue[i] = val; |
---|
676 | READ_CODE( ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3), val, "target_pivot_value" ); |
---|
677 | sei.m_targetPivotValue[i] = val; |
---|
678 | } |
---|
679 | break; |
---|
680 | } |
---|
681 | case 4: |
---|
682 | { |
---|
683 | READ_CODE( 8, val, "camera_iso_speed_idc" ); sei.m_cameraIsoSpeedValue = val; |
---|
684 | if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO |
---|
685 | { |
---|
686 | READ_CODE( 32, val, "camera_iso_speed_value" ); sei.m_cameraIsoSpeedValue = val; |
---|
687 | } |
---|
688 | READ_FLAG( val, "exposure_compensation_value_sign_flag" ); sei.m_exposureCompensationValueSignFlag = val; |
---|
689 | READ_CODE( 16, val, "exposure_compensation_value_numerator" ); sei.m_exposureCompensationValueNumerator = val; |
---|
690 | READ_CODE( 16, val, "exposure_compensation_value_denom_idc" ); sei.m_exposureCompensationValueDenomIdc = val; |
---|
691 | READ_CODE( 32, val, "ref_screen_luminance_white" ); sei.m_refScreenLuminanceWhite = val; |
---|
692 | READ_CODE( 32, val, "extended_range_white_level" ); sei.m_extendedRangeWhiteLevel = val; |
---|
693 | READ_CODE( 16, val, "nominal_black_level_luma_code_value" ); sei.m_nominalBlackLevelLumaCodeValue = val; |
---|
694 | READ_CODE( 16, val, "nominal_white_level_luma_code_value" ); sei.m_nominalWhiteLevelLumaCodeValue= val; |
---|
695 | READ_CODE( 16, val, "extended_white_level_luma_code_value" ); sei.m_extendedWhiteLevelLumaCodeValue = val; |
---|
696 | break; |
---|
697 | } |
---|
698 | default: |
---|
699 | { |
---|
700 | assert(!"Undefined SEIToneMapModelId"); |
---|
701 | break; |
---|
702 | } |
---|
703 | }//switch model id |
---|
704 | }// if(!sei.m_toneMapCancelFlag) |
---|
705 | |
---|
706 | xParseByteAlign(); |
---|
707 | } |
---|
708 | |
---|
709 | Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) |
---|
710 | { |
---|
711 | Int iCode; |
---|
712 | UInt uiCode; |
---|
713 | |
---|
714 | READ_UVLC( uiCode, "sop_seq_parameter_set_id" ); sei.m_sopSeqParameterSetId = uiCode; |
---|
715 | READ_UVLC( uiCode, "num_pics_in_sop_minus1" ); sei.m_numPicsInSopMinus1 = uiCode; |
---|
716 | for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) |
---|
717 | { |
---|
718 | READ_CODE( 6, uiCode, "sop_desc_vcl_nalu_type" ); sei.m_sopDescVclNaluType[i] = uiCode; |
---|
719 | READ_CODE( 3, sei.m_sopDescTemporalId[i], "sop_desc_temporal_id" ); sei.m_sopDescTemporalId[i] = uiCode; |
---|
720 | if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) |
---|
721 | { |
---|
722 | READ_UVLC( sei.m_sopDescStRpsIdx[i], "sop_desc_st_rps_idx" ); sei.m_sopDescStRpsIdx[i] = uiCode; |
---|
723 | } |
---|
724 | if (i > 0) |
---|
725 | { |
---|
726 | READ_SVLC( iCode, "sop_desc_poc_delta" ); sei.m_sopDescPocDelta[i] = iCode; |
---|
727 | } |
---|
728 | } |
---|
729 | |
---|
730 | xParseByteAlign(); |
---|
731 | } |
---|
732 | |
---|
733 | Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps) |
---|
734 | { |
---|
735 | UInt uiCode; |
---|
736 | SEIMessages seis; |
---|
737 | |
---|
738 | READ_FLAG( uiCode, "bitstream_subset_flag" ); sei.m_bitStreamSubsetFlag = uiCode; |
---|
739 | READ_FLAG( uiCode, "nesting_op_flag" ); sei.m_nestingOpFlag = uiCode; |
---|
740 | if (sei.m_nestingOpFlag) |
---|
741 | { |
---|
742 | READ_FLAG( uiCode, "default_op_flag" ); sei.m_defaultOpFlag = uiCode; |
---|
743 | READ_UVLC( uiCode, "nesting_num_ops_minus1" ); sei.m_nestingNumOpsMinus1 = uiCode; |
---|
744 | for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++) |
---|
745 | { |
---|
746 | READ_CODE( 3, uiCode, "nesting_max_temporal_id_plus1" ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode; |
---|
747 | READ_UVLC( uiCode, "nesting_op_idx" ); sei.m_nestingOpIdx[i] = uiCode; |
---|
748 | } |
---|
749 | } |
---|
750 | else |
---|
751 | { |
---|
752 | READ_FLAG( uiCode, "all_layers_flag" ); sei.m_allLayersFlag = uiCode; |
---|
753 | if (!sei.m_allLayersFlag) |
---|
754 | { |
---|
755 | READ_CODE( 3, uiCode, "nesting_no_op_max_temporal_id_plus1" ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode; |
---|
756 | READ_UVLC( uiCode, "nesting_num_layers_minus1" ); sei.m_nestingNumLayersMinus1 = uiCode; |
---|
757 | for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) |
---|
758 | { |
---|
759 | READ_CODE( 6, uiCode, "nesting_layer_id" ); sei.m_nestingLayerId[i] = uiCode; |
---|
760 | } |
---|
761 | } |
---|
762 | } |
---|
763 | |
---|
764 | // byte alignment |
---|
765 | while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) |
---|
766 | { |
---|
767 | UInt code; |
---|
768 | READ_FLAG( code, "nesting_zero_bit" ); |
---|
769 | } |
---|
770 | |
---|
771 | sei.m_callerOwnsSEIs = false; |
---|
772 | |
---|
773 | // read nested SEI messages |
---|
774 | do { |
---|
775 | xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps); |
---|
776 | } while (m_pcBitstream->getNumBitsLeft() > 8); |
---|
777 | |
---|
778 | } |
---|
779 | #if H_MV |
---|
780 | Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei) |
---|
781 | { |
---|
782 | UInt uiCode; |
---|
783 | READ_CODE( 4, uiCode, "active_vps_id" ); sei.m_activeVpsId = uiCode; |
---|
784 | READ_UVLC( uiCode, "num_additional_sub_streams_minus1" ); sei.m_numAdditionalSubStreams = uiCode + 1; |
---|
785 | |
---|
786 | xResizeSubBitstreamPropertySeiArrays(sei); |
---|
787 | for( Int i = 0; i < sei.m_numAdditionalSubStreams; i++ ) |
---|
788 | { |
---|
789 | READ_CODE( 2, uiCode, "sub_bitstream_mode[i]" ); sei.m_subBitstreamMode[i] = uiCode; |
---|
790 | READ_UVLC( uiCode, "output_layer_set_idx_to_vps[i]" ); sei.m_outputLayerSetIdxToVps[i] = uiCode; |
---|
791 | READ_CODE( 3, uiCode, "highest_sub_layer_id[i]" ); sei.m_highestSublayerId[i] = uiCode; |
---|
792 | READ_CODE( 16, uiCode, "avg_bit_rate[i]" ); sei.m_avgBitRate[i] = uiCode; |
---|
793 | READ_CODE( 16, uiCode, "max_bit_rate[i]" ); sei.m_maxBitRate[i] = uiCode; |
---|
794 | } |
---|
795 | xParseByteAlign(); |
---|
796 | } |
---|
797 | Void SEIReader::xResizeSubBitstreamPropertySeiArrays(SEISubBitstreamProperty &sei) |
---|
798 | { |
---|
799 | sei.m_subBitstreamMode.resize( sei.m_numAdditionalSubStreams ); |
---|
800 | sei.m_outputLayerSetIdxToVps.resize( sei.m_numAdditionalSubStreams ); |
---|
801 | sei.m_highestSublayerId.resize( sei.m_numAdditionalSubStreams ); |
---|
802 | sei.m_avgBitRate.resize( sei.m_numAdditionalSubStreams ); |
---|
803 | sei.m_maxBitRate.resize( sei.m_numAdditionalSubStreams ); |
---|
804 | } |
---|
805 | #endif |
---|
806 | |
---|
807 | Void SEIReader::xParseByteAlign() |
---|
808 | { |
---|
809 | UInt code; |
---|
810 | if( m_pcBitstream->getNumBitsRead() % 8 != 0 ) |
---|
811 | { |
---|
812 | READ_FLAG( code, "bit_equal_to_one" ); assert( code == 1 ); |
---|
813 | } |
---|
814 | while( m_pcBitstream->getNumBitsRead() % 8 != 0 ) |
---|
815 | { |
---|
816 | READ_FLAG( code, "bit_equal_to_zero" ); assert( code == 0 ); |
---|
817 | } |
---|
818 | } |
---|
819 | //! \} |
---|