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-2015, 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 funtionality 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 | #include "TLibCommon/TComPicYuv.h" |
---|
46 | #include <iomanip> |
---|
47 | |
---|
48 | |
---|
49 | //! \ingroup TLibDecoder |
---|
50 | //! \{ |
---|
51 | |
---|
52 | |
---|
53 | #if ENC_DEC_TRACE |
---|
54 | Void xTraceSEIHeader() |
---|
55 | { |
---|
56 | fprintf( g_hTrace, "=========== SEI message ===========\n"); |
---|
57 | } |
---|
58 | |
---|
59 | Void xTraceSEIMessageType(SEI::PayloadType payloadType) |
---|
60 | { |
---|
61 | fprintf( g_hTrace, "=========== %s SEI message ===========\n", SEI::getSEIMessageString(payloadType)); |
---|
62 | } |
---|
63 | #endif |
---|
64 | |
---|
65 | Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const Char *pSymbolName) |
---|
66 | { |
---|
67 | READ_CODE(uiLength, ruiCode, pSymbolName); |
---|
68 | if (pOS) |
---|
69 | { |
---|
70 | (*pOS) << " " << std::setw(55) << pSymbolName << ": " << ruiCode << "\n"; |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName) |
---|
75 | { |
---|
76 | READ_UVLC(ruiCode, pSymbolName); |
---|
77 | if (pOS) |
---|
78 | { |
---|
79 | (*pOS) << " " << std::setw(55) << pSymbolName << ": " << ruiCode << "\n"; |
---|
80 | } |
---|
81 | } |
---|
82 | |
---|
83 | Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const Char *pSymbolName) |
---|
84 | { |
---|
85 | READ_SVLC(ruiCode, pSymbolName); |
---|
86 | if (pOS) |
---|
87 | { |
---|
88 | (*pOS) << " " << std::setw(55) << pSymbolName << ": " << ruiCode << "\n"; |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName) |
---|
93 | { |
---|
94 | READ_FLAG(ruiCode, pSymbolName); |
---|
95 | if (pOS) |
---|
96 | { |
---|
97 | (*pOS) << " " << std::setw(55) << pSymbolName << ": " << (ruiCode?1:0) << "\n"; |
---|
98 | } |
---|
99 | } |
---|
100 | |
---|
101 | #if NH_MV_SEI |
---|
102 | inline Void SEIReader::output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize) |
---|
103 | #else |
---|
104 | static inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize) |
---|
105 | #endif |
---|
106 | { |
---|
107 | if (pDecodedMessageOutputStream) |
---|
108 | { |
---|
109 | std::string seiMessageHdr(SEI::getSEIMessageString(sei.payloadType())); seiMessageHdr+=" SEI message"; |
---|
110 | (*pDecodedMessageOutputStream) << std::setfill('-') << std::setw(seiMessageHdr.size()) << "-" << std::setfill(' ') << "\n" << seiMessageHdr << " (" << payloadSize << " bytes)"<< "\n"; |
---|
111 | #if NH_MV_SEI |
---|
112 | (*pDecodedMessageOutputStream) << std::setfill(' ') << "LayerId: " << m_layerId << std::setw(2) << " Picture: " << m_decOrder << std::setw( 5 ) << std::endl; |
---|
113 | #endif |
---|
114 | } |
---|
115 | } |
---|
116 | |
---|
117 | #undef READ_CODE |
---|
118 | #undef READ_SVLC |
---|
119 | #undef READ_UVLC |
---|
120 | #undef READ_FLAG |
---|
121 | |
---|
122 | |
---|
123 | /** |
---|
124 | * unmarshal a single SEI message from bitstream bs |
---|
125 | */ |
---|
126 | #if NH_MV_LAYERS_NOT_PRESENT_SEI |
---|
127 | Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
128 | #else |
---|
129 | Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
130 | #endif |
---|
131 | { |
---|
132 | setBitstream(bs); |
---|
133 | |
---|
134 | assert(!m_pcBitstream->getNumBitsUntilByteAligned()); |
---|
135 | do |
---|
136 | { |
---|
137 | #if NH_MV_LAYERS_NOT_PRESENT_SEI |
---|
138 | xReadSEImessage(seis, nalUnitType, vps, sps, pDecodedMessageOutputStream); |
---|
139 | #else |
---|
140 | xReadSEImessage(seis, nalUnitType, sps, pDecodedMessageOutputStream); |
---|
141 | #endif |
---|
142 | /* SEI messages are an integer number of bytes, something has failed |
---|
143 | * in the parsing if bitstream not byte-aligned */ |
---|
144 | assert(!m_pcBitstream->getNumBitsUntilByteAligned()); |
---|
145 | } |
---|
146 | while (m_pcBitstream->getNumBitsLeft() > 8); |
---|
147 | |
---|
148 | xReadRbspTrailingBits(); |
---|
149 | } |
---|
150 | |
---|
151 | #if NH_MV_LAYERS_NOT_PRESENT_SEI |
---|
152 | Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
153 | #else |
---|
154 | Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
155 | #endif |
---|
156 | { |
---|
157 | #if ENC_DEC_TRACE |
---|
158 | xTraceSEIHeader(); |
---|
159 | #endif |
---|
160 | Int payloadType = 0; |
---|
161 | UInt val = 0; |
---|
162 | |
---|
163 | do |
---|
164 | { |
---|
165 | sei_read_code(NULL, 8, val, "payload_type"); |
---|
166 | payloadType += val; |
---|
167 | } while (val==0xFF); |
---|
168 | |
---|
169 | UInt payloadSize = 0; |
---|
170 | do |
---|
171 | { |
---|
172 | sei_read_code(NULL, 8, val, "payload_size"); |
---|
173 | payloadSize += val; |
---|
174 | } while (val==0xFF); |
---|
175 | |
---|
176 | #if ENC_DEC_TRACE |
---|
177 | xTraceSEIMessageType((SEI::PayloadType)payloadType); |
---|
178 | #endif |
---|
179 | |
---|
180 | /* extract the payload for this single SEI message. |
---|
181 | * This allows greater safety in erroneous parsing of an SEI message |
---|
182 | * from affecting subsequent messages. |
---|
183 | * After parsing the payload, bs needs to be restored as the primary |
---|
184 | * bitstream. |
---|
185 | */ |
---|
186 | TComInputBitstream *bs = getBitstream(); |
---|
187 | setBitstream(bs->extractSubstream(payloadSize * 8)); |
---|
188 | |
---|
189 | SEI *sei = NULL; |
---|
190 | |
---|
191 | if(nalUnitType == NAL_UNIT_PREFIX_SEI) |
---|
192 | { |
---|
193 | switch (payloadType) |
---|
194 | { |
---|
195 | case SEI::USER_DATA_UNREGISTERED: |
---|
196 | sei = new SEIuserDataUnregistered; |
---|
197 | xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
198 | break; |
---|
199 | case SEI::ACTIVE_PARAMETER_SETS: |
---|
200 | sei = new SEIActiveParameterSets; |
---|
201 | xParseSEIActiveParameterSets((SEIActiveParameterSets&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
202 | break; |
---|
203 | case SEI::DECODING_UNIT_INFO: |
---|
204 | if (!sps) |
---|
205 | { |
---|
206 | printf ("Warning: Found Decoding unit SEI message, but no active SPS is available. Ignoring."); |
---|
207 | } |
---|
208 | else |
---|
209 | { |
---|
210 | sei = new SEIDecodingUnitInfo; |
---|
211 | xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps, pDecodedMessageOutputStream); |
---|
212 | } |
---|
213 | break; |
---|
214 | case SEI::BUFFERING_PERIOD: |
---|
215 | if (!sps) |
---|
216 | { |
---|
217 | printf ("Warning: Found Buffering period SEI message, but no active SPS is available. Ignoring."); |
---|
218 | } |
---|
219 | else |
---|
220 | { |
---|
221 | sei = new SEIBufferingPeriod; |
---|
222 | xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps, pDecodedMessageOutputStream); |
---|
223 | } |
---|
224 | break; |
---|
225 | case SEI::PICTURE_TIMING: |
---|
226 | if (!sps) |
---|
227 | { |
---|
228 | printf ("Warning: Found Picture timing SEI message, but no active SPS is available. Ignoring."); |
---|
229 | } |
---|
230 | else |
---|
231 | { |
---|
232 | sei = new SEIPictureTiming; |
---|
233 | xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, pDecodedMessageOutputStream); |
---|
234 | } |
---|
235 | break; |
---|
236 | case SEI::RECOVERY_POINT: |
---|
237 | sei = new SEIRecoveryPoint; |
---|
238 | xParseSEIRecoveryPoint((SEIRecoveryPoint&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
239 | break; |
---|
240 | case SEI::FRAME_PACKING: |
---|
241 | sei = new SEIFramePacking; |
---|
242 | xParseSEIFramePacking((SEIFramePacking&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
243 | break; |
---|
244 | case SEI::SEGM_RECT_FRAME_PACKING: |
---|
245 | sei = new SEISegmentedRectFramePacking; |
---|
246 | xParseSEISegmentedRectFramePacking((SEISegmentedRectFramePacking&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
247 | break; |
---|
248 | case SEI::DISPLAY_ORIENTATION: |
---|
249 | sei = new SEIDisplayOrientation; |
---|
250 | xParseSEIDisplayOrientation((SEIDisplayOrientation&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
251 | break; |
---|
252 | case SEI::TEMPORAL_LEVEL0_INDEX: |
---|
253 | sei = new SEITemporalLevel0Index; |
---|
254 | xParseSEITemporalLevel0Index((SEITemporalLevel0Index&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
255 | break; |
---|
256 | case SEI::REGION_REFRESH_INFO: |
---|
257 | sei = new SEIGradualDecodingRefreshInfo; |
---|
258 | xParseSEIRegionRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
259 | break; |
---|
260 | case SEI::NO_DISPLAY: |
---|
261 | sei = new SEINoDisplay; |
---|
262 | xParseSEINoDisplay((SEINoDisplay&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
263 | break; |
---|
264 | case SEI::TONE_MAPPING_INFO: |
---|
265 | sei = new SEIToneMappingInfo; |
---|
266 | xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
267 | break; |
---|
268 | case SEI::SOP_DESCRIPTION: |
---|
269 | sei = new SEISOPDescription; |
---|
270 | xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
271 | break; |
---|
272 | case SEI::SCALABLE_NESTING: |
---|
273 | sei = new SEIScalableNesting; |
---|
274 | #if NH_MV_LAYERS_NOT_PRESENT_SEI |
---|
275 | xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps, pDecodedMessageOutputStream); |
---|
276 | #else |
---|
277 | xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps, pDecodedMessageOutputStream); |
---|
278 | #endif |
---|
279 | break; |
---|
280 | case SEI::TEMP_MOTION_CONSTRAINED_TILE_SETS: |
---|
281 | sei = new SEITempMotionConstrainedTileSets; |
---|
282 | xParseSEITempMotionConstraintsTileSets((SEITempMotionConstrainedTileSets&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
283 | break; |
---|
284 | case SEI::TIME_CODE: |
---|
285 | sei = new SEITimeCode; |
---|
286 | xParseSEITimeCode((SEITimeCode&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
287 | break; |
---|
288 | case SEI::CHROMA_SAMPLING_FILTER_HINT: |
---|
289 | sei = new SEIChromaSamplingFilterHint; |
---|
290 | xParseSEIChromaSamplingFilterHint((SEIChromaSamplingFilterHint&) *sei, payloadSize/*, sps*/, pDecodedMessageOutputStream); |
---|
291 | //} |
---|
292 | break; |
---|
293 | case SEI::KNEE_FUNCTION_INFO: |
---|
294 | sei = new SEIKneeFunctionInfo; |
---|
295 | xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
296 | break; |
---|
297 | case SEI::MASTERING_DISPLAY_COLOUR_VOLUME: |
---|
298 | sei = new SEIMasteringDisplayColourVolume; |
---|
299 | xParseSEIMasteringDisplayColourVolume((SEIMasteringDisplayColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
300 | break; |
---|
301 | #if !NH_MV_SEI |
---|
302 | case SEI::SUB_BITSTREAM_PROPERTY: |
---|
303 | sei = new SEISubBitstreamProperty; |
---|
304 | xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
305 | break; |
---|
306 | #else |
---|
307 | #if NH_MV_LAYERS_NOT_PRESENT_SEI |
---|
308 | case SEI::LAYERS_NOT_PRESENT: |
---|
309 | if (!vps) |
---|
310 | { |
---|
311 | printf ("Warning: Found Layers not present SEI message, but no active VPS is available. Ignoring."); |
---|
312 | } |
---|
313 | else |
---|
314 | { |
---|
315 | sei = new SEILayersNotPresent; |
---|
316 | xParseSEILayersNotPresent((SEILayersNotPresent&) *sei, payloadSize, vps, pDecodedMessageOutputStream); |
---|
317 | } |
---|
318 | break; |
---|
319 | #endif |
---|
320 | case SEI::INTER_LAYER_CONSTRAINED_TILE_SETS: |
---|
321 | sei = new SEIInterLayerConstrainedTileSets; |
---|
322 | xParseSEIInterLayerConstrainedTileSets((SEIInterLayerConstrainedTileSets&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
323 | break; |
---|
324 | #if NH_MV_TBD |
---|
325 | case SEI::BSP_NESTING: |
---|
326 | sei = new SEIBspNesting; |
---|
327 | xParseSEIBspNesting((SEIBspNesting&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
328 | break; |
---|
329 | case SEI::BSP_INITIAL_ARRIVAL_TIME: |
---|
330 | sei = new SEIBspInitialArrivalTime; |
---|
331 | xParseSEIBspInitialArrivalTime((SEIBspInitialArrivalTime&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
332 | break; |
---|
333 | #endif |
---|
334 | case SEI::SUB_BITSTREAM_PROPERTY: |
---|
335 | sei = new SEISubBitstreamProperty; |
---|
336 | xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
337 | break; |
---|
338 | #if NH_MV_SEI_TBD |
---|
339 | case SEI::ALPHA_CHANNEL_INFO: |
---|
340 | sei = new SEIAlphaChannelInfo; |
---|
341 | xParseSEIAlphaChannelInfo((SEIAlphaChannelInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
342 | break; |
---|
343 | case SEI::OVERLAY_INFO: |
---|
344 | sei = new SEIOverlayInfo; |
---|
345 | xParseSEIOverlayInfo((SEIOverlayInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
346 | break; |
---|
347 | #endif |
---|
348 | case SEI::TEMPORAL_MV_PREDICTION_CONSTRAINTS: |
---|
349 | sei = new SEITemporalMvPredictionConstraints; |
---|
350 | xParseSEITemporalMvPredictionConstraints((SEITemporalMvPredictionConstraints&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
351 | break; |
---|
352 | #if NH_MV_SEI_TBD |
---|
353 | case SEI::FRAME_FIELD_INFO: |
---|
354 | sei = new SEIFrameFieldInfo; |
---|
355 | xParseSEIFrameFieldInfo((SEIFrameFieldInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
356 | break; |
---|
357 | case SEI::THREE_DIMENSIONAL_REFERENCE_DISPLAYS_INFO: |
---|
358 | sei = new SEIThreeDimensionalReferenceDisplaysInfo; |
---|
359 | xParseSEIThreeDimensionalReferenceDisplaysInfo((SEIThreeDimensionalReferenceDisplaysInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
360 | break; |
---|
361 | case SEI::DEPTH_REPRESENTATION_INFO: |
---|
362 | sei = new SEIDepthRepresentationInfo; |
---|
363 | xParseSEIDepthRepresentationInfo((SEIDepthRepresentationInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
364 | break; |
---|
365 | #endif |
---|
366 | case SEI::MULTIVIEW_SCENE_INFO: |
---|
367 | sei = new SEIMultiviewSceneInfo; |
---|
368 | xParseSEIMultiviewSceneInfo((SEIMultiviewSceneInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
369 | break; |
---|
370 | |
---|
371 | case SEI::MULTIVIEW_ACQUISITION_INFO: |
---|
372 | sei = new SEIMultiviewAcquisitionInfo; |
---|
373 | xParseSEIMultiviewAcquisitionInfo((SEIMultiviewAcquisitionInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
374 | break; |
---|
375 | |
---|
376 | case SEI::MULTIVIEW_VIEW_POSITION: |
---|
377 | sei = new SEIMultiviewViewPosition; |
---|
378 | xParseSEIMultiviewViewPosition((SEIMultiviewViewPosition&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
379 | break; |
---|
380 | #if NH_MV_TBD |
---|
381 | case SEI::ALTERNATIVE_DEPTH_INFO: |
---|
382 | sei = new SEIAlternativeDepthInfo; |
---|
383 | xParseSEIAlternativeDepthInfo((SEIAlternativeDepthInfo&) *sei, payloadSize, pDecodedMessageOutputStream ); |
---|
384 | break; |
---|
385 | #endif |
---|
386 | #endif |
---|
387 | default: |
---|
388 | for (UInt i = 0; i < payloadSize; i++) |
---|
389 | { |
---|
390 | UInt seiByte; |
---|
391 | sei_read_code (NULL, 8, seiByte, "unknown prefix SEI payload byte"); |
---|
392 | } |
---|
393 | printf ("Unknown prefix SEI message (payloadType = %d) was found!\n", payloadType); |
---|
394 | if (pDecodedMessageOutputStream) |
---|
395 | { |
---|
396 | (*pDecodedMessageOutputStream) << "Unknown prefix SEI message (payloadType = " << payloadType << ") was found!\n"; |
---|
397 | } |
---|
398 | break; |
---|
399 | } |
---|
400 | } |
---|
401 | else |
---|
402 | { |
---|
403 | switch (payloadType) |
---|
404 | { |
---|
405 | case SEI::USER_DATA_UNREGISTERED: |
---|
406 | sei = new SEIuserDataUnregistered; |
---|
407 | xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
408 | break; |
---|
409 | case SEI::DECODED_PICTURE_HASH: |
---|
410 | sei = new SEIDecodedPictureHash; |
---|
411 | xParseSEIDecodedPictureHash((SEIDecodedPictureHash&) *sei, payloadSize, pDecodedMessageOutputStream); |
---|
412 | break; |
---|
413 | default: |
---|
414 | for (UInt i = 0; i < payloadSize; i++) |
---|
415 | { |
---|
416 | UInt seiByte; |
---|
417 | sei_read_code( NULL, 8, seiByte, "unknown suffix SEI payload byte"); |
---|
418 | } |
---|
419 | printf ("Unknown suffix SEI message (payloadType = %d) was found!\n", payloadType); |
---|
420 | if (pDecodedMessageOutputStream) |
---|
421 | { |
---|
422 | (*pDecodedMessageOutputStream) << "Unknown suffix SEI message (payloadType = " << payloadType << ") was found!\n"; |
---|
423 | } |
---|
424 | break; |
---|
425 | } |
---|
426 | } |
---|
427 | |
---|
428 | if (sei != NULL) |
---|
429 | { |
---|
430 | seis.push_back(sei); |
---|
431 | } |
---|
432 | |
---|
433 | /* By definition the underlying bitstream terminates in a byte-aligned manner. |
---|
434 | * 1. Extract all bar the last MIN(bitsremaining,nine) bits as reserved_payload_extension_data |
---|
435 | * 2. Examine the final 8 bits to determine the payload_bit_equal_to_one marker |
---|
436 | * 3. Extract the remainingreserved_payload_extension_data bits. |
---|
437 | * |
---|
438 | * If there are fewer than 9 bits available, extract them. |
---|
439 | */ |
---|
440 | Int payloadBitsRemaining = getBitstream()->getNumBitsLeft(); |
---|
441 | if (payloadBitsRemaining) /* more_data_in_payload() */ |
---|
442 | { |
---|
443 | for (; payloadBitsRemaining > 9; payloadBitsRemaining--) |
---|
444 | { |
---|
445 | UInt reservedPayloadExtensionData; |
---|
446 | sei_read_code ( pDecodedMessageOutputStream, 1, reservedPayloadExtensionData, "reserved_payload_extension_data"); |
---|
447 | } |
---|
448 | |
---|
449 | /* 2 */ |
---|
450 | Int finalBits = getBitstream()->peekBits(payloadBitsRemaining); |
---|
451 | Int finalPayloadBits = 0; |
---|
452 | for (Int mask = 0xff; finalBits & (mask >> finalPayloadBits); finalPayloadBits++) |
---|
453 | { |
---|
454 | continue; |
---|
455 | } |
---|
456 | |
---|
457 | /* 3 */ |
---|
458 | for (; payloadBitsRemaining > 9 - finalPayloadBits; payloadBitsRemaining--) |
---|
459 | { |
---|
460 | UInt reservedPayloadExtensionData; |
---|
461 | sei_read_flag ( 0, reservedPayloadExtensionData, "reserved_payload_extension_data"); |
---|
462 | } |
---|
463 | |
---|
464 | UInt dummy; |
---|
465 | sei_read_flag( 0, dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--; |
---|
466 | while (payloadBitsRemaining) |
---|
467 | { |
---|
468 | sei_read_flag( 0, dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--; |
---|
469 | } |
---|
470 | } |
---|
471 | |
---|
472 | /* restore primary bitstream for sei_message */ |
---|
473 | delete getBitstream(); |
---|
474 | setBitstream(bs); |
---|
475 | } |
---|
476 | |
---|
477 | /** |
---|
478 | * parse bitstream bs and unpack a user_data_unregistered SEI message |
---|
479 | * of payloasSize bytes into sei. |
---|
480 | */ |
---|
481 | |
---|
482 | Void SEIReader::xParseSEIuserDataUnregistered(SEIuserDataUnregistered &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
483 | { |
---|
484 | assert(payloadSize >= ISO_IEC_11578_LEN); |
---|
485 | UInt val; |
---|
486 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
487 | |
---|
488 | for (UInt i = 0; i < ISO_IEC_11578_LEN; i++) |
---|
489 | { |
---|
490 | sei_read_code( pDecodedMessageOutputStream, 8, val, "uuid_iso_iec_11578"); |
---|
491 | sei.uuid_iso_iec_11578[i] = val; |
---|
492 | } |
---|
493 | |
---|
494 | sei.userDataLength = payloadSize - ISO_IEC_11578_LEN; |
---|
495 | if (!sei.userDataLength) |
---|
496 | { |
---|
497 | sei.userData = 0; |
---|
498 | return; |
---|
499 | } |
---|
500 | |
---|
501 | sei.userData = new UChar[sei.userDataLength]; |
---|
502 | for (UInt i = 0; i < sei.userDataLength; i++) |
---|
503 | { |
---|
504 | sei_read_code( NULL, 8, val, "user_data_payload_byte" ); |
---|
505 | sei.userData[i] = val; |
---|
506 | } |
---|
507 | if (pDecodedMessageOutputStream) |
---|
508 | { |
---|
509 | (*pDecodedMessageOutputStream) << " User data payload size: " << sei.userDataLength << "\n"; |
---|
510 | } |
---|
511 | } |
---|
512 | |
---|
513 | /** |
---|
514 | * parse bitstream bs and unpack a decoded picture hash SEI message |
---|
515 | * of payloadSize bytes into sei. |
---|
516 | */ |
---|
517 | Void SEIReader::xParseSEIDecodedPictureHash(SEIDecodedPictureHash& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
518 | { |
---|
519 | UInt bytesRead = 0; |
---|
520 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
521 | |
---|
522 | UInt val; |
---|
523 | sei_read_code( pDecodedMessageOutputStream, 8, val, "hash_type"); |
---|
524 | sei.method = static_cast<SEIDecodedPictureHash::Method>(val); bytesRead++; |
---|
525 | |
---|
526 | const Char *traceString="\0"; |
---|
527 | switch (sei.method) |
---|
528 | { |
---|
529 | case SEIDecodedPictureHash::MD5: traceString="picture_md5"; break; |
---|
530 | case SEIDecodedPictureHash::CRC: traceString="picture_crc"; break; |
---|
531 | case SEIDecodedPictureHash::CHECKSUM: traceString="picture_checksum"; break; |
---|
532 | default: assert(false); break; |
---|
533 | } |
---|
534 | |
---|
535 | if (pDecodedMessageOutputStream) |
---|
536 | { |
---|
537 | (*pDecodedMessageOutputStream) << " " << std::setw(55) << traceString << ": " << std::hex << std::setfill('0'); |
---|
538 | } |
---|
539 | |
---|
540 | sei.m_pictureHash.hash.clear(); |
---|
541 | for(;bytesRead < payloadSize; bytesRead++) |
---|
542 | { |
---|
543 | sei_read_code( NULL, 8, val, traceString); |
---|
544 | sei.m_pictureHash.hash.push_back((UChar)val); |
---|
545 | if (pDecodedMessageOutputStream) |
---|
546 | { |
---|
547 | (*pDecodedMessageOutputStream) << std::setw(2) << val; |
---|
548 | } |
---|
549 | } |
---|
550 | |
---|
551 | if (pDecodedMessageOutputStream) |
---|
552 | { |
---|
553 | (*pDecodedMessageOutputStream) << std::dec << std::setfill(' ') << "\n"; |
---|
554 | } |
---|
555 | } |
---|
556 | |
---|
557 | Void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
558 | { |
---|
559 | UInt val; |
---|
560 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
561 | |
---|
562 | sei_read_code( pDecodedMessageOutputStream, 4, val, "active_video_parameter_set_id"); sei.activeVPSId = val; |
---|
563 | sei_read_flag( pDecodedMessageOutputStream, val, "self_contained_cvs_flag"); sei.m_selfContainedCvsFlag = (val != 0); |
---|
564 | sei_read_flag( pDecodedMessageOutputStream, val, "no_parameter_set_update_flag"); sei.m_noParameterSetUpdateFlag = (val != 0); |
---|
565 | sei_read_uvlc( pDecodedMessageOutputStream, val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val; |
---|
566 | |
---|
567 | sei.activeSeqParameterSetId.resize(sei.numSpsIdsMinus1 + 1); |
---|
568 | for (Int i=0; i < (sei.numSpsIdsMinus1 + 1); i++) |
---|
569 | { |
---|
570 | sei_read_uvlc( pDecodedMessageOutputStream, val, "active_seq_parameter_set_id[i]"); sei.activeSeqParameterSetId[i] = val; |
---|
571 | } |
---|
572 | } |
---|
573 | |
---|
574 | Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
575 | { |
---|
576 | UInt val; |
---|
577 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
578 | sei_read_uvlc( pDecodedMessageOutputStream, val, "decoding_unit_idx"); |
---|
579 | sei.m_decodingUnitIdx = val; |
---|
580 | |
---|
581 | const TComVUI *vui = sps->getVuiParameters(); |
---|
582 | if(vui->getHrdParameters()->getSubPicCpbParamsInPicTimingSEIFlag()) |
---|
583 | { |
---|
584 | sei_read_code( pDecodedMessageOutputStream, ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay_increment"); |
---|
585 | sei.m_duSptCpbRemovalDelay = val; |
---|
586 | } |
---|
587 | else |
---|
588 | { |
---|
589 | sei.m_duSptCpbRemovalDelay = 0; |
---|
590 | } |
---|
591 | sei_read_flag( pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0); |
---|
592 | if(sei.m_dpbOutputDuDelayPresentFlag) |
---|
593 | { |
---|
594 | sei_read_code( pDecodedMessageOutputStream, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay"); |
---|
595 | sei.m_picSptDpbOutputDuDelay = val; |
---|
596 | } |
---|
597 | } |
---|
598 | |
---|
599 | Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
600 | { |
---|
601 | Int i, nalOrVcl; |
---|
602 | UInt code; |
---|
603 | |
---|
604 | const TComVUI *pVUI = sps->getVuiParameters(); |
---|
605 | const TComHRD *pHRD = pVUI->getHrdParameters(); |
---|
606 | |
---|
607 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
608 | |
---|
609 | sei_read_uvlc( pDecodedMessageOutputStream, code, "bp_seq_parameter_set_id" ); sei.m_bpSeqParameterSetId = code; |
---|
610 | if( !pHRD->getSubPicCpbParamsPresentFlag() ) |
---|
611 | { |
---|
612 | sei_read_flag( pDecodedMessageOutputStream, code, "irap_cpb_params_present_flag" ); sei.m_rapCpbParamsPresentFlag = code; |
---|
613 | } |
---|
614 | if( sei.m_rapCpbParamsPresentFlag ) |
---|
615 | { |
---|
616 | sei_read_code( pDecodedMessageOutputStream, pHRD->getCpbRemovalDelayLengthMinus1() + 1, code, "cpb_delay_offset" ); sei.m_cpbDelayOffset = code; |
---|
617 | sei_read_code( pDecodedMessageOutputStream, pHRD->getDpbOutputDelayLengthMinus1() + 1, code, "dpb_delay_offset" ); sei.m_dpbDelayOffset = code; |
---|
618 | } |
---|
619 | |
---|
620 | //read splicing flag and cpb_removal_delay_delta |
---|
621 | sei_read_flag( pDecodedMessageOutputStream, code, "concatenation_flag"); |
---|
622 | sei.m_concatenationFlag = code; |
---|
623 | sei_read_code( pDecodedMessageOutputStream, ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" ); |
---|
624 | sei.m_auCpbRemovalDelayDelta = code + 1; |
---|
625 | |
---|
626 | for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) |
---|
627 | { |
---|
628 | if( ( ( nalOrVcl == 0 ) && ( pHRD->getNalHrdParametersPresentFlag() ) ) || |
---|
629 | ( ( nalOrVcl == 1 ) && ( pHRD->getVclHrdParametersPresentFlag() ) ) ) |
---|
630 | { |
---|
631 | for( i = 0; i < ( pHRD->getCpbCntMinus1( 0 ) + 1 ); i ++ ) |
---|
632 | { |
---|
633 | sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_cpb_removal_delay":"nal_initial_cpb_removal_delay" ); |
---|
634 | sei.m_initialCpbRemovalDelay[i][nalOrVcl] = code; |
---|
635 | sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_cpb_removal_offset":"vcl_initial_cpb_removal_offset" ); |
---|
636 | sei.m_initialCpbRemovalDelayOffset[i][nalOrVcl] = code; |
---|
637 | if( pHRD->getSubPicCpbParamsPresentFlag() || sei.m_rapCpbParamsPresentFlag ) |
---|
638 | { |
---|
639 | sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_alt_cpb_removal_delay":"vcl_initial_alt_cpb_removal_delay" ); |
---|
640 | sei.m_initialAltCpbRemovalDelay[i][nalOrVcl] = code; |
---|
641 | sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_alt_cpb_removal_offset":"vcl_initial_alt_cpb_removal_offset" ); |
---|
642 | sei.m_initialAltCpbRemovalDelayOffset[i][nalOrVcl] = code; |
---|
643 | } |
---|
644 | } |
---|
645 | } |
---|
646 | } |
---|
647 | } |
---|
648 | |
---|
649 | Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
650 | { |
---|
651 | Int i; |
---|
652 | UInt code; |
---|
653 | |
---|
654 | const TComVUI *vui = sps->getVuiParameters(); |
---|
655 | const TComHRD *hrd = vui->getHrdParameters(); |
---|
656 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
657 | |
---|
658 | if( vui->getFrameFieldInfoPresentFlag() ) |
---|
659 | { |
---|
660 | sei_read_code( pDecodedMessageOutputStream, 4, code, "pic_struct" ); sei.m_picStruct = code; |
---|
661 | sei_read_code( pDecodedMessageOutputStream, 2, code, "source_scan_type" ); sei.m_sourceScanType = code; |
---|
662 | sei_read_flag( pDecodedMessageOutputStream, code, "duplicate_flag" ); sei.m_duplicateFlag = (code == 1); |
---|
663 | } |
---|
664 | |
---|
665 | if( hrd->getCpbDpbDelaysPresentFlag()) |
---|
666 | { |
---|
667 | sei_read_code( pDecodedMessageOutputStream, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" ); |
---|
668 | sei.m_auCpbRemovalDelay = code + 1; |
---|
669 | sei_read_code( pDecodedMessageOutputStream, ( hrd->getDpbOutputDelayLengthMinus1() + 1 ), code, "pic_dpb_output_delay" ); |
---|
670 | sei.m_picDpbOutputDelay = code; |
---|
671 | |
---|
672 | if(hrd->getSubPicCpbParamsPresentFlag()) |
---|
673 | { |
---|
674 | sei_read_code( pDecodedMessageOutputStream, hrd->getDpbOutputDelayDuLengthMinus1()+1, code, "pic_dpb_output_du_delay" ); |
---|
675 | sei.m_picDpbOutputDuDelay = code; |
---|
676 | } |
---|
677 | |
---|
678 | if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) |
---|
679 | { |
---|
680 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_decoding_units_minus1"); |
---|
681 | sei.m_numDecodingUnitsMinus1 = code; |
---|
682 | sei_read_flag( pDecodedMessageOutputStream, code, "du_common_cpb_removal_delay_flag" ); |
---|
683 | sei.m_duCommonCpbRemovalDelayFlag = code; |
---|
684 | if( sei.m_duCommonCpbRemovalDelayFlag ) |
---|
685 | { |
---|
686 | sei_read_code( pDecodedMessageOutputStream, ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_common_cpb_removal_delay_increment_minus1" ); |
---|
687 | sei.m_duCommonCpbRemovalDelayMinus1 = code; |
---|
688 | } |
---|
689 | sei.m_numNalusInDuMinus1.resize(sei.m_numDecodingUnitsMinus1 + 1 ); |
---|
690 | sei.m_duCpbRemovalDelayMinus1.resize( sei.m_numDecodingUnitsMinus1 + 1 ); |
---|
691 | |
---|
692 | for( i = 0; i <= sei.m_numDecodingUnitsMinus1; i ++ ) |
---|
693 | { |
---|
694 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_nalus_in_du_minus1[i]"); |
---|
695 | sei.m_numNalusInDuMinus1[ i ] = code; |
---|
696 | if( ( !sei.m_duCommonCpbRemovalDelayFlag ) && ( i < sei.m_numDecodingUnitsMinus1 ) ) |
---|
697 | { |
---|
698 | sei_read_code( pDecodedMessageOutputStream, ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_cpb_removal_delay_minus1[i]" ); |
---|
699 | sei.m_duCpbRemovalDelayMinus1[ i ] = code; |
---|
700 | } |
---|
701 | } |
---|
702 | } |
---|
703 | } |
---|
704 | } |
---|
705 | |
---|
706 | Void SEIReader::xParseSEIRecoveryPoint(SEIRecoveryPoint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
707 | { |
---|
708 | Int iCode; |
---|
709 | UInt uiCode; |
---|
710 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
711 | |
---|
712 | sei_read_svlc( pDecodedMessageOutputStream, iCode, "recovery_poc_cnt" ); sei.m_recoveryPocCnt = iCode; |
---|
713 | sei_read_flag( pDecodedMessageOutputStream, uiCode, "exact_matching_flag" ); sei.m_exactMatchingFlag = uiCode; |
---|
714 | sei_read_flag( pDecodedMessageOutputStream, uiCode, "broken_link_flag" ); sei.m_brokenLinkFlag = uiCode; |
---|
715 | } |
---|
716 | |
---|
717 | Void SEIReader::xParseSEIFramePacking(SEIFramePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
718 | { |
---|
719 | UInt val; |
---|
720 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
721 | |
---|
722 | sei_read_uvlc( pDecodedMessageOutputStream, val, "frame_packing_arrangement_id" ); sei.m_arrangementId = val; |
---|
723 | sei_read_flag( pDecodedMessageOutputStream, val, "frame_packing_arrangement_cancel_flag" ); sei.m_arrangementCancelFlag = val; |
---|
724 | |
---|
725 | if ( !sei.m_arrangementCancelFlag ) |
---|
726 | { |
---|
727 | sei_read_code( pDecodedMessageOutputStream, 7, val, "frame_packing_arrangement_type" ); sei.m_arrangementType = val; |
---|
728 | assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) ); |
---|
729 | |
---|
730 | sei_read_flag( pDecodedMessageOutputStream, val, "quincunx_sampling_flag" ); sei.m_quincunxSamplingFlag = val; |
---|
731 | |
---|
732 | sei_read_code( pDecodedMessageOutputStream, 6, val, "content_interpretation_type" ); sei.m_contentInterpretationType = val; |
---|
733 | sei_read_flag( pDecodedMessageOutputStream, val, "spatial_flipping_flag" ); sei.m_spatialFlippingFlag = val; |
---|
734 | sei_read_flag( pDecodedMessageOutputStream, val, "frame0_flipped_flag" ); sei.m_frame0FlippedFlag = val; |
---|
735 | sei_read_flag( pDecodedMessageOutputStream, val, "field_views_flag" ); sei.m_fieldViewsFlag = val; |
---|
736 | sei_read_flag( pDecodedMessageOutputStream, val, "current_frame_is_frame0_flag" ); sei.m_currentFrameIsFrame0Flag = val; |
---|
737 | sei_read_flag( pDecodedMessageOutputStream, val, "frame0_self_contained_flag" ); sei.m_frame0SelfContainedFlag = val; |
---|
738 | sei_read_flag( pDecodedMessageOutputStream, val, "frame1_self_contained_flag" ); sei.m_frame1SelfContainedFlag = val; |
---|
739 | |
---|
740 | if ( sei.m_quincunxSamplingFlag == 0 && sei.m_arrangementType != 5) |
---|
741 | { |
---|
742 | sei_read_code( pDecodedMessageOutputStream, 4, val, "frame0_grid_position_x" ); sei.m_frame0GridPositionX = val; |
---|
743 | sei_read_code( pDecodedMessageOutputStream, 4, val, "frame0_grid_position_y" ); sei.m_frame0GridPositionY = val; |
---|
744 | sei_read_code( pDecodedMessageOutputStream, 4, val, "frame1_grid_position_x" ); sei.m_frame1GridPositionX = val; |
---|
745 | sei_read_code( pDecodedMessageOutputStream, 4, val, "frame1_grid_position_y" ); sei.m_frame1GridPositionY = val; |
---|
746 | } |
---|
747 | |
---|
748 | sei_read_code( pDecodedMessageOutputStream, 8, val, "frame_packing_arrangement_reserved_byte" ); sei.m_arrangementReservedByte = val; |
---|
749 | sei_read_flag( pDecodedMessageOutputStream, val, "frame_packing_arrangement_persistence_flag" ); sei.m_arrangementPersistenceFlag = (val != 0); |
---|
750 | } |
---|
751 | sei_read_flag( pDecodedMessageOutputStream, val, "upsampled_aspect_ratio_flag" ); sei.m_upsampledAspectRatio = val; |
---|
752 | } |
---|
753 | |
---|
754 | Void SEIReader::xParseSEISegmentedRectFramePacking(SEISegmentedRectFramePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
755 | { |
---|
756 | UInt val; |
---|
757 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
758 | sei_read_flag( pDecodedMessageOutputStream, val, "segmented_rect_frame_packing_arrangement_cancel_flag" ); sei.m_arrangementCancelFlag = val; |
---|
759 | if( !sei.m_arrangementCancelFlag ) |
---|
760 | { |
---|
761 | sei_read_code( pDecodedMessageOutputStream, 2, val, "segmented_rect_content_interpretation_type" ); sei.m_contentInterpretationType = val; |
---|
762 | sei_read_flag( pDecodedMessageOutputStream, val, "segmented_rect_frame_packing_arrangement_persistence" ); sei.m_arrangementPersistenceFlag = val; |
---|
763 | } |
---|
764 | } |
---|
765 | |
---|
766 | Void SEIReader::xParseSEIDisplayOrientation(SEIDisplayOrientation& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
767 | { |
---|
768 | UInt val; |
---|
769 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
770 | sei_read_flag( pDecodedMessageOutputStream, val, "display_orientation_cancel_flag" ); sei.cancelFlag = val; |
---|
771 | if( !sei.cancelFlag ) |
---|
772 | { |
---|
773 | sei_read_flag( pDecodedMessageOutputStream, val, "hor_flip" ); sei.horFlip = val; |
---|
774 | sei_read_flag( pDecodedMessageOutputStream, val, "ver_flip" ); sei.verFlip = val; |
---|
775 | sei_read_code( pDecodedMessageOutputStream, 16, val, "anticlockwise_rotation" ); sei.anticlockwiseRotation = val; |
---|
776 | sei_read_flag( pDecodedMessageOutputStream, val, "display_orientation_persistence_flag" ); sei.persistenceFlag = val; |
---|
777 | } |
---|
778 | } |
---|
779 | |
---|
780 | Void SEIReader::xParseSEITemporalLevel0Index(SEITemporalLevel0Index& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
781 | { |
---|
782 | UInt val; |
---|
783 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
784 | sei_read_code( pDecodedMessageOutputStream, 8, val, "temporal_sub_layer_zero_idx" ); sei.tl0Idx = val; |
---|
785 | sei_read_code( pDecodedMessageOutputStream, 8, val, "irap_pic_id" ); sei.rapIdx = val; |
---|
786 | } |
---|
787 | |
---|
788 | Void SEIReader::xParseSEIRegionRefreshInfo(SEIGradualDecodingRefreshInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
789 | { |
---|
790 | UInt val; |
---|
791 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
792 | sei_read_flag( pDecodedMessageOutputStream, val, "refreshed_region_flag" ); sei.m_gdrForegroundFlag = val ? 1 : 0; |
---|
793 | } |
---|
794 | |
---|
795 | Void SEIReader::xParseSEINoDisplay(SEINoDisplay& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
796 | { |
---|
797 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
798 | sei.m_noDisplay = true; |
---|
799 | } |
---|
800 | |
---|
801 | Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
802 | { |
---|
803 | Int i; |
---|
804 | UInt val; |
---|
805 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
806 | sei_read_uvlc( pDecodedMessageOutputStream, val, "tone_map_id" ); sei.m_toneMapId = val; |
---|
807 | sei_read_flag( pDecodedMessageOutputStream, val, "tone_map_cancel_flag" ); sei.m_toneMapCancelFlag = val; |
---|
808 | |
---|
809 | if ( !sei.m_toneMapCancelFlag ) |
---|
810 | { |
---|
811 | sei_read_flag( pDecodedMessageOutputStream, val, "tone_map_persistence_flag" ); sei.m_toneMapPersistenceFlag = val; |
---|
812 | sei_read_code( pDecodedMessageOutputStream, 8, val, "coded_data_bit_depth" ); sei.m_codedDataBitDepth = val; |
---|
813 | sei_read_code( pDecodedMessageOutputStream, 8, val, "target_bit_depth" ); sei.m_targetBitDepth = val; |
---|
814 | sei_read_uvlc( pDecodedMessageOutputStream, val, "tone_map_model_id" ); sei.m_modelId = val; |
---|
815 | switch(sei.m_modelId) |
---|
816 | { |
---|
817 | case 0: |
---|
818 | { |
---|
819 | sei_read_code( pDecodedMessageOutputStream, 32, val, "min_value" ); sei.m_minValue = val; |
---|
820 | sei_read_code( pDecodedMessageOutputStream, 32, val, "max_value" ); sei.m_maxValue = val; |
---|
821 | break; |
---|
822 | } |
---|
823 | case 1: |
---|
824 | { |
---|
825 | sei_read_code( pDecodedMessageOutputStream, 32, val, "sigmoid_midpoint" ); sei.m_sigmoidMidpoint = val; |
---|
826 | sei_read_code( pDecodedMessageOutputStream, 32, val, "sigmoid_width" ); sei.m_sigmoidWidth = val; |
---|
827 | break; |
---|
828 | } |
---|
829 | case 2: |
---|
830 | { |
---|
831 | UInt num = 1u << sei.m_targetBitDepth; |
---|
832 | sei.m_startOfCodedInterval.resize(num+1); |
---|
833 | for(i = 0; i < num; i++) |
---|
834 | { |
---|
835 | sei_read_code( pDecodedMessageOutputStream, ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval[i]" ); |
---|
836 | sei.m_startOfCodedInterval[i] = val; |
---|
837 | } |
---|
838 | sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth; |
---|
839 | break; |
---|
840 | } |
---|
841 | case 3: |
---|
842 | { |
---|
843 | sei_read_code( pDecodedMessageOutputStream, 16, val, "num_pivots" ); sei.m_numPivots = val; |
---|
844 | sei.m_codedPivotValue.resize(sei.m_numPivots); |
---|
845 | sei.m_targetPivotValue.resize(sei.m_numPivots); |
---|
846 | for(i = 0; i < sei.m_numPivots; i++ ) |
---|
847 | { |
---|
848 | sei_read_code( pDecodedMessageOutputStream, ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value[i]" ); |
---|
849 | sei.m_codedPivotValue[i] = val; |
---|
850 | sei_read_code( pDecodedMessageOutputStream, ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3), val, "target_pivot_value[i]" ); |
---|
851 | sei.m_targetPivotValue[i] = val; |
---|
852 | } |
---|
853 | break; |
---|
854 | } |
---|
855 | case 4: |
---|
856 | { |
---|
857 | sei_read_code( pDecodedMessageOutputStream, 8, val, "camera_iso_speed_idc" ); sei.m_cameraIsoSpeedIdc = val; |
---|
858 | if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO |
---|
859 | { |
---|
860 | sei_read_code( pDecodedMessageOutputStream, 32, val, "camera_iso_speed_value" ); sei.m_cameraIsoSpeedValue = val; |
---|
861 | } |
---|
862 | sei_read_code( pDecodedMessageOutputStream, 8, val, "exposure_index_idc" ); sei.m_exposureIndexIdc = val; |
---|
863 | if( sei.m_exposureIndexIdc == 255) //Extended_ISO |
---|
864 | { |
---|
865 | sei_read_code( pDecodedMessageOutputStream, 32, val, "exposure_index_value" ); sei.m_exposureIndexValue = val; |
---|
866 | } |
---|
867 | sei_read_flag( pDecodedMessageOutputStream, val, "exposure_compensation_value_sign_flag" ); sei.m_exposureCompensationValueSignFlag = val; |
---|
868 | sei_read_code( pDecodedMessageOutputStream, 16, val, "exposure_compensation_value_numerator" ); sei.m_exposureCompensationValueNumerator = val; |
---|
869 | sei_read_code( pDecodedMessageOutputStream, 16, val, "exposure_compensation_value_denom_idc" ); sei.m_exposureCompensationValueDenomIdc = val; |
---|
870 | sei_read_code( pDecodedMessageOutputStream, 32, val, "ref_screen_luminance_white" ); sei.m_refScreenLuminanceWhite = val; |
---|
871 | sei_read_code( pDecodedMessageOutputStream, 32, val, "extended_range_white_level" ); sei.m_extendedRangeWhiteLevel = val; |
---|
872 | sei_read_code( pDecodedMessageOutputStream, 16, val, "nominal_black_level_code_value" ); sei.m_nominalBlackLevelLumaCodeValue = val; |
---|
873 | sei_read_code( pDecodedMessageOutputStream, 16, val, "nominal_white_level_code_value" ); sei.m_nominalWhiteLevelLumaCodeValue= val; |
---|
874 | sei_read_code( pDecodedMessageOutputStream, 16, val, "extended_white_level_code_value" ); sei.m_extendedWhiteLevelLumaCodeValue = val; |
---|
875 | break; |
---|
876 | } |
---|
877 | default: |
---|
878 | { |
---|
879 | assert(!"Undefined SEIToneMapModelId"); |
---|
880 | break; |
---|
881 | } |
---|
882 | }//switch model id |
---|
883 | }// if(!sei.m_toneMapCancelFlag) |
---|
884 | } |
---|
885 | |
---|
886 | Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
887 | { |
---|
888 | Int iCode; |
---|
889 | UInt uiCode; |
---|
890 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
891 | |
---|
892 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "sop_seq_parameter_set_id" ); sei.m_sopSeqParameterSetId = uiCode; |
---|
893 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_pics_in_sop_minus1" ); sei.m_numPicsInSopMinus1 = uiCode; |
---|
894 | for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++) |
---|
895 | { |
---|
896 | sei_read_code( pDecodedMessageOutputStream, 6, uiCode, "sop_vcl_nut[i]" ); sei.m_sopDescVclNaluType[i] = uiCode; |
---|
897 | sei_read_code( pDecodedMessageOutputStream, 3, sei.m_sopDescTemporalId[i], "sop_temporal_id[i]" ); sei.m_sopDescTemporalId[i] = uiCode; |
---|
898 | if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP) |
---|
899 | { |
---|
900 | sei_read_uvlc( pDecodedMessageOutputStream, sei.m_sopDescStRpsIdx[i], "sop_short_term_rps_idx[i]" ); sei.m_sopDescStRpsIdx[i] = uiCode; |
---|
901 | } |
---|
902 | if (i > 0) |
---|
903 | { |
---|
904 | sei_read_svlc( pDecodedMessageOutputStream, iCode, "sop_poc_delta[i]" ); sei.m_sopDescPocDelta[i] = iCode; |
---|
905 | } |
---|
906 | } |
---|
907 | } |
---|
908 | |
---|
909 | #if NH_MV_LAYERS_NOT_PRESENT_SEI |
---|
910 | Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComVPS *vps, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
911 | #else |
---|
912 | Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream) |
---|
913 | #endif |
---|
914 | { |
---|
915 | UInt uiCode; |
---|
916 | SEIMessages seis; |
---|
917 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
918 | |
---|
919 | sei_read_flag( pDecodedMessageOutputStream, uiCode, "bitstream_subset_flag" ); sei.m_bitStreamSubsetFlag = uiCode; |
---|
920 | sei_read_flag( pDecodedMessageOutputStream, uiCode, "nesting_op_flag" ); sei.m_nestingOpFlag = uiCode; |
---|
921 | if (sei.m_nestingOpFlag) |
---|
922 | { |
---|
923 | sei_read_flag( pDecodedMessageOutputStream, uiCode, "default_op_flag" ); sei.m_defaultOpFlag = uiCode; |
---|
924 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "nesting_num_ops_minus1" ); sei.m_nestingNumOpsMinus1 = uiCode; |
---|
925 | for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++) |
---|
926 | { |
---|
927 | sei_read_code( pDecodedMessageOutputStream, 3, uiCode, "nesting_max_temporal_id_plus1[i]" ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode; |
---|
928 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "nesting_op_idx[i]" ); sei.m_nestingOpIdx[i] = uiCode; |
---|
929 | } |
---|
930 | } |
---|
931 | else |
---|
932 | { |
---|
933 | sei_read_flag( pDecodedMessageOutputStream, uiCode, "all_layers_flag" ); sei.m_allLayersFlag = uiCode; |
---|
934 | if (!sei.m_allLayersFlag) |
---|
935 | { |
---|
936 | sei_read_code( pDecodedMessageOutputStream, 3, uiCode, "nesting_no_op_max_temporal_id_plus1" ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode; |
---|
937 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "nesting_num_layers_minus1" ); sei.m_nestingNumLayersMinus1 = uiCode; |
---|
938 | for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++) |
---|
939 | { |
---|
940 | sei_read_code( pDecodedMessageOutputStream, 6, uiCode, "nesting_layer_id[i]" ); sei.m_nestingLayerId[i] = uiCode; |
---|
941 | } |
---|
942 | } |
---|
943 | } |
---|
944 | |
---|
945 | // byte alignment |
---|
946 | while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) |
---|
947 | { |
---|
948 | UInt code; |
---|
949 | sei_read_flag( pDecodedMessageOutputStream, code, "nesting_zero_bit" ); |
---|
950 | } |
---|
951 | |
---|
952 | // read nested SEI messages |
---|
953 | do |
---|
954 | { |
---|
955 | #if NH_MV_LAYERS_NOT_PRESENT_SEI |
---|
956 | xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, pDecodedMessageOutputStream); |
---|
957 | #else |
---|
958 | xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, pDecodedMessageOutputStream); |
---|
959 | #endif |
---|
960 | } while (m_pcBitstream->getNumBitsLeft() > 8); |
---|
961 | |
---|
962 | if (pDecodedMessageOutputStream) |
---|
963 | { |
---|
964 | (*pDecodedMessageOutputStream) << "End of scalable nesting SEI message\n"; |
---|
965 | } |
---|
966 | } |
---|
967 | |
---|
968 | #if NH_MV |
---|
969 | #if !NH_MV_SEI |
---|
970 | Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream ) |
---|
971 | { |
---|
972 | UInt code; |
---|
973 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
974 | sei_read_code( pDecodedMessageOutputStream, 4, code, "active_vps_id" ); sei.m_activeVpsId = code; |
---|
975 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_additional_sub_streams_minus1" ); sei.m_numAdditionalSubStreams = code + 1; |
---|
976 | |
---|
977 | xResizeSubBitstreamPropertySeiArrays(sei); |
---|
978 | for( Int i = 0; i < sei.m_numAdditionalSubStreams; i++ ) |
---|
979 | { |
---|
980 | sei_read_code( pDecodedMessageOutputStream, 2, code, "sub_bitstream_mode[i]" ); sei.m_subBitstreamMode[i] = code; |
---|
981 | sei_read_uvlc( pDecodedMessageOutputStream, code, "output_layer_set_idx_to_vps[i]" ); sei.m_outputLayerSetIdxToVps[i] = code; |
---|
982 | sei_read_code( pDecodedMessageOutputStream, 3, code, "highest_sub_layer_id[i]" ); sei.m_highestSublayerId[i] = code; |
---|
983 | sei_read_code( pDecodedMessageOutputStream, 16, code, "avg_bit_rate[i]" ); sei.m_avgBitRate[i] = code; |
---|
984 | sei_read_code( pDecodedMessageOutputStream, 16, code, "max_bit_rate[i]" ); sei.m_maxBitRate[i] = code; |
---|
985 | } |
---|
986 | } |
---|
987 | |
---|
988 | Void SEIReader::xResizeSubBitstreamPropertySeiArrays(SEISubBitstreamProperty &sei) |
---|
989 | { |
---|
990 | sei.m_subBitstreamMode.resize( sei.m_numAdditionalSubStreams ); |
---|
991 | sei.m_outputLayerSetIdxToVps.resize( sei.m_numAdditionalSubStreams ); |
---|
992 | sei.m_highestSublayerId.resize( sei.m_numAdditionalSubStreams ); |
---|
993 | sei.m_avgBitRate.resize( sei.m_numAdditionalSubStreams ); |
---|
994 | sei.m_maxBitRate.resize( sei.m_numAdditionalSubStreams ); |
---|
995 | } |
---|
996 | #endif |
---|
997 | #endif |
---|
998 | |
---|
999 | |
---|
1000 | Void SEIReader::xParseSEITempMotionConstraintsTileSets(SEITempMotionConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1001 | { |
---|
1002 | UInt code; |
---|
1003 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1004 | sei_read_flag( pDecodedMessageOutputStream, code, "mc_all_tiles_exact_sample_value_match_flag"); sei.m_mc_all_tiles_exact_sample_value_match_flag = (code != 0); |
---|
1005 | sei_read_flag( pDecodedMessageOutputStream, code, "each_tile_one_tile_set_flag"); sei.m_each_tile_one_tile_set_flag = (code != 0); |
---|
1006 | |
---|
1007 | if(!sei.m_each_tile_one_tile_set_flag) |
---|
1008 | { |
---|
1009 | sei_read_flag( pDecodedMessageOutputStream, code, "limited_tile_set_display_flag"); sei.m_limited_tile_set_display_flag = (code != 0); |
---|
1010 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_sets_in_message_minus1"); sei.setNumberOfTileSets(code + 1); |
---|
1011 | |
---|
1012 | if(sei.getNumberOfTileSets() != 0) |
---|
1013 | { |
---|
1014 | for(Int i = 0; i < sei.getNumberOfTileSets(); i++) |
---|
1015 | { |
---|
1016 | sei_read_uvlc( pDecodedMessageOutputStream, code, "mcts_id"); sei.tileSetData(i).m_mcts_id = code; |
---|
1017 | |
---|
1018 | if(sei.m_limited_tile_set_display_flag) |
---|
1019 | { |
---|
1020 | sei_read_flag( pDecodedMessageOutputStream, code, "display_tile_set_flag"); sei.tileSetData(i).m_display_tile_set_flag = (code != 1); |
---|
1021 | } |
---|
1022 | |
---|
1023 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_tile_rects_in_set_minus1"); sei.tileSetData(i).setNumberOfTileRects(code + 1); |
---|
1024 | |
---|
1025 | for(Int j=0; j<sei.tileSetData(i).getNumberOfTileRects(); j++) |
---|
1026 | { |
---|
1027 | sei_read_uvlc( pDecodedMessageOutputStream, code, "top_left_tile_index"); sei.tileSetData(i).topLeftTileIndex(j) = code; |
---|
1028 | sei_read_uvlc( pDecodedMessageOutputStream, code, "bottom_right_tile_index"); sei.tileSetData(i).bottomRightTileIndex(j) = code; |
---|
1029 | } |
---|
1030 | |
---|
1031 | if(!sei.m_mc_all_tiles_exact_sample_value_match_flag) |
---|
1032 | { |
---|
1033 | sei_read_flag( pDecodedMessageOutputStream, code, "exact_sample_value_match_flag"); sei.tileSetData(i).m_exact_sample_value_match_flag = (code != 0); |
---|
1034 | } |
---|
1035 | sei_read_flag( pDecodedMessageOutputStream, code, "mcts_tier_level_idc_present_flag"); sei.tileSetData(i).m_mcts_tier_level_idc_present_flag = (code != 0); |
---|
1036 | |
---|
1037 | if(sei.tileSetData(i).m_mcts_tier_level_idc_present_flag) |
---|
1038 | { |
---|
1039 | sei_read_flag( pDecodedMessageOutputStream, code, "mcts_tier_flag"); sei.tileSetData(i).m_mcts_tier_flag = (code != 0); |
---|
1040 | sei_read_code( pDecodedMessageOutputStream, 8, code, "mcts_level_idc"); sei.tileSetData(i).m_mcts_level_idc = code; |
---|
1041 | } |
---|
1042 | } |
---|
1043 | } |
---|
1044 | } |
---|
1045 | else |
---|
1046 | { |
---|
1047 | sei_read_flag( pDecodedMessageOutputStream, code, "max_mcs_tier_level_idc_present_flag"); sei.m_max_mcs_tier_level_idc_present_flag = code; |
---|
1048 | if(sei.m_max_mcs_tier_level_idc_present_flag) |
---|
1049 | { |
---|
1050 | sei_read_flag( pDecodedMessageOutputStream, code, "max_mcts_tier_flag"); sei.m_max_mcts_tier_flag = code; |
---|
1051 | sei_read_code( pDecodedMessageOutputStream, 8, code, "max_mcts_level_idc"); sei.m_max_mcts_level_idc = code; |
---|
1052 | } |
---|
1053 | } |
---|
1054 | } |
---|
1055 | |
---|
1056 | Void SEIReader::xParseSEITimeCode(SEITimeCode& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1057 | { |
---|
1058 | UInt code; |
---|
1059 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1060 | sei_read_code( pDecodedMessageOutputStream, 2, code, "num_clock_ts"); sei.numClockTs = code; |
---|
1061 | for(Int i = 0; i < sei.numClockTs; i++) |
---|
1062 | { |
---|
1063 | TComSEITimeSet currentTimeSet; |
---|
1064 | sei_read_flag( pDecodedMessageOutputStream, code, "clock_time_stamp_flag[i]"); currentTimeSet.clockTimeStampFlag = code; |
---|
1065 | if(currentTimeSet.clockTimeStampFlag) |
---|
1066 | { |
---|
1067 | sei_read_flag( pDecodedMessageOutputStream, code, "nuit_field_based_flag"); currentTimeSet.numUnitFieldBasedFlag = code; |
---|
1068 | sei_read_code( pDecodedMessageOutputStream, 5, code, "counting_type"); currentTimeSet.countingType = code; |
---|
1069 | sei_read_flag( pDecodedMessageOutputStream, code, "full_timestamp_flag"); currentTimeSet.fullTimeStampFlag = code; |
---|
1070 | sei_read_flag( pDecodedMessageOutputStream, code, "discontinuity_flag"); currentTimeSet.discontinuityFlag = code; |
---|
1071 | sei_read_flag( pDecodedMessageOutputStream, code, "cnt_dropped_flag"); currentTimeSet.cntDroppedFlag = code; |
---|
1072 | sei_read_code( pDecodedMessageOutputStream, 9, code, "n_frames"); currentTimeSet.numberOfFrames = code; |
---|
1073 | if(currentTimeSet.fullTimeStampFlag) |
---|
1074 | { |
---|
1075 | sei_read_code( pDecodedMessageOutputStream, 6, code, "seconds_value"); currentTimeSet.secondsValue = code; |
---|
1076 | sei_read_code( pDecodedMessageOutputStream, 6, code, "minutes_value"); currentTimeSet.minutesValue = code; |
---|
1077 | sei_read_code( pDecodedMessageOutputStream, 5, code, "hours_value"); currentTimeSet.hoursValue = code; |
---|
1078 | } |
---|
1079 | else |
---|
1080 | { |
---|
1081 | sei_read_flag( pDecodedMessageOutputStream, code, "seconds_flag"); currentTimeSet.secondsFlag = code; |
---|
1082 | if(currentTimeSet.secondsFlag) |
---|
1083 | { |
---|
1084 | sei_read_code( pDecodedMessageOutputStream, 6, code, "seconds_value"); currentTimeSet.secondsValue = code; |
---|
1085 | sei_read_flag( pDecodedMessageOutputStream, code, "minutes_flag"); currentTimeSet.minutesFlag = code; |
---|
1086 | if(currentTimeSet.minutesFlag) |
---|
1087 | { |
---|
1088 | sei_read_code( pDecodedMessageOutputStream, 6, code, "minutes_value"); currentTimeSet.minutesValue = code; |
---|
1089 | sei_read_flag( pDecodedMessageOutputStream, code, "hours_flag"); currentTimeSet.hoursFlag = code; |
---|
1090 | if(currentTimeSet.hoursFlag) |
---|
1091 | { |
---|
1092 | sei_read_code( pDecodedMessageOutputStream, 5, code, "hours_value"); currentTimeSet.hoursValue = code; |
---|
1093 | } |
---|
1094 | } |
---|
1095 | } |
---|
1096 | } |
---|
1097 | sei_read_code( pDecodedMessageOutputStream, 5, code, "time_offset_length"); currentTimeSet.timeOffsetLength = code; |
---|
1098 | if(currentTimeSet.timeOffsetLength > 0) |
---|
1099 | { |
---|
1100 | sei_read_code( pDecodedMessageOutputStream, currentTimeSet.timeOffsetLength, code, "time_offset_value"); |
---|
1101 | if((code & (1 << (currentTimeSet.timeOffsetLength-1))) == 0) |
---|
1102 | { |
---|
1103 | currentTimeSet.timeOffsetValue = code; |
---|
1104 | } |
---|
1105 | else |
---|
1106 | { |
---|
1107 | code &= (1<< (currentTimeSet.timeOffsetLength-1)) - 1; |
---|
1108 | currentTimeSet.timeOffsetValue = ~code + 1; |
---|
1109 | } |
---|
1110 | } |
---|
1111 | } |
---|
1112 | sei.timeSetArray[i] = currentTimeSet; |
---|
1113 | } |
---|
1114 | } |
---|
1115 | |
---|
1116 | Void SEIReader::xParseSEIChromaSamplingFilterHint(SEIChromaSamplingFilterHint& sei, UInt payloadSize/*, TComSPS* sps*/, std::ostream *pDecodedMessageOutputStream) |
---|
1117 | { |
---|
1118 | UInt uiCode; |
---|
1119 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1120 | |
---|
1121 | sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "ver_chroma_filter_idc"); sei.m_verChromaFilterIdc = uiCode; |
---|
1122 | sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "hor_chroma_filter_idc"); sei.m_horChromaFilterIdc = uiCode; |
---|
1123 | sei_read_flag( pDecodedMessageOutputStream, uiCode, "ver_filtering_process_flag"); sei.m_verFilteringProcessFlag = uiCode; |
---|
1124 | if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1) |
---|
1125 | { |
---|
1126 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "target_format_idc"); sei.m_targetFormatIdc = uiCode; |
---|
1127 | if(sei.m_verChromaFilterIdc == 1) |
---|
1128 | { |
---|
1129 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_vertical_filters"); sei.m_numVerticalFilters = uiCode; |
---|
1130 | if(sei.m_numVerticalFilters > 0) |
---|
1131 | { |
---|
1132 | sei.m_verTapLengthMinus1 = (Int*)malloc(sei.m_numVerticalFilters * sizeof(Int)); |
---|
1133 | sei.m_verFilterCoeff = (Int**)malloc(sei.m_numVerticalFilters * sizeof(Int*)); |
---|
1134 | for(Int i = 0; i < sei.m_numVerticalFilters; i ++) |
---|
1135 | { |
---|
1136 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "ver_tap_length_minus_1"); sei.m_verTapLengthMinus1[i] = uiCode; |
---|
1137 | sei.m_verFilterCoeff[i] = (Int*)malloc(sei.m_verTapLengthMinus1[i] * sizeof(Int)); |
---|
1138 | for(Int j = 0; j < sei.m_verTapLengthMinus1[i]; j ++) |
---|
1139 | { |
---|
1140 | sei_read_svlc( pDecodedMessageOutputStream, sei.m_verFilterCoeff[i][j], "ver_filter_coeff"); |
---|
1141 | } |
---|
1142 | } |
---|
1143 | } |
---|
1144 | } |
---|
1145 | if(sei.m_horChromaFilterIdc == 1) |
---|
1146 | { |
---|
1147 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_horizontal_filters"); sei.m_numHorizontalFilters = uiCode; |
---|
1148 | if(sei.m_numHorizontalFilters > 0) |
---|
1149 | { |
---|
1150 | sei.m_horTapLengthMinus1 = (Int*)malloc(sei.m_numHorizontalFilters * sizeof(Int)); |
---|
1151 | sei.m_horFilterCoeff = (Int**)malloc(sei.m_numHorizontalFilters * sizeof(Int*)); |
---|
1152 | for(Int i = 0; i < sei.m_numHorizontalFilters; i ++) |
---|
1153 | { |
---|
1154 | sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "hor_tap_length_minus_1"); sei.m_horTapLengthMinus1[i] = uiCode; |
---|
1155 | sei.m_horFilterCoeff[i] = (Int*)malloc(sei.m_horTapLengthMinus1[i] * sizeof(Int)); |
---|
1156 | for(Int j = 0; j < sei.m_horTapLengthMinus1[i]; j ++) |
---|
1157 | { |
---|
1158 | sei_read_svlc( pDecodedMessageOutputStream, sei.m_horFilterCoeff[i][j], "hor_filter_coeff"); |
---|
1159 | } |
---|
1160 | } |
---|
1161 | } |
---|
1162 | } |
---|
1163 | } |
---|
1164 | } |
---|
1165 | |
---|
1166 | Void SEIReader::xParseSEIKneeFunctionInfo(SEIKneeFunctionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1167 | { |
---|
1168 | Int i; |
---|
1169 | UInt val; |
---|
1170 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1171 | |
---|
1172 | sei_read_uvlc( pDecodedMessageOutputStream, val, "knee_function_id" ); sei.m_kneeId = val; |
---|
1173 | sei_read_flag( pDecodedMessageOutputStream, val, "knee_function_cancel_flag" ); sei.m_kneeCancelFlag = val; |
---|
1174 | if ( !sei.m_kneeCancelFlag ) |
---|
1175 | { |
---|
1176 | sei_read_flag( pDecodedMessageOutputStream, val, "knee_function_persistence_flag" ); sei.m_kneePersistenceFlag = val; |
---|
1177 | sei_read_code( pDecodedMessageOutputStream, 32, val, "input_d_range" ); sei.m_kneeInputDrange = val; |
---|
1178 | sei_read_code( pDecodedMessageOutputStream, 32, val, "input_disp_luminance" ); sei.m_kneeInputDispLuminance = val; |
---|
1179 | sei_read_code( pDecodedMessageOutputStream, 32, val, "output_d_range" ); sei.m_kneeOutputDrange = val; |
---|
1180 | sei_read_code( pDecodedMessageOutputStream, 32, val, "output_disp_luminance" ); sei.m_kneeOutputDispLuminance = val; |
---|
1181 | sei_read_uvlc( pDecodedMessageOutputStream, val, "num_knee_points_minus1" ); sei.m_kneeNumKneePointsMinus1 = val; |
---|
1182 | assert( sei.m_kneeNumKneePointsMinus1 > 0 ); |
---|
1183 | sei.m_kneeInputKneePoint.resize(sei.m_kneeNumKneePointsMinus1+1); |
---|
1184 | sei.m_kneeOutputKneePoint.resize(sei.m_kneeNumKneePointsMinus1+1); |
---|
1185 | for(i = 0; i <= sei.m_kneeNumKneePointsMinus1; i++ ) |
---|
1186 | { |
---|
1187 | sei_read_code( pDecodedMessageOutputStream, 10, val, "input_knee_point" ); sei.m_kneeInputKneePoint[i] = val; |
---|
1188 | sei_read_code( pDecodedMessageOutputStream, 10, val, "output_knee_point" ); sei.m_kneeOutputKneePoint[i] = val; |
---|
1189 | } |
---|
1190 | } |
---|
1191 | } |
---|
1192 | |
---|
1193 | Void SEIReader::xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1194 | { |
---|
1195 | UInt code; |
---|
1196 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1197 | |
---|
1198 | sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[0]" ); sei.values.primaries[0][0] = code; |
---|
1199 | sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[0]" ); sei.values.primaries[0][1] = code; |
---|
1200 | |
---|
1201 | sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[1]" ); sei.values.primaries[1][0] = code; |
---|
1202 | sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[1]" ); sei.values.primaries[1][1] = code; |
---|
1203 | |
---|
1204 | sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[2]" ); sei.values.primaries[2][0] = code; |
---|
1205 | sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[2]" ); sei.values.primaries[2][1] = code; |
---|
1206 | |
---|
1207 | |
---|
1208 | sei_read_code( pDecodedMessageOutputStream, 16, code, "white_point_x" ); sei.values.whitePoint[0] = code; |
---|
1209 | sei_read_code( pDecodedMessageOutputStream, 16, code, "white_point_y" ); sei.values.whitePoint[1] = code; |
---|
1210 | |
---|
1211 | sei_read_code( pDecodedMessageOutputStream, 32, code, "max_display_mastering_luminance" ); sei.values.maxLuminance = code; |
---|
1212 | sei_read_code( pDecodedMessageOutputStream, 32, code, "min_display_mastering_luminance" ); sei.values.minLuminance = code; |
---|
1213 | } |
---|
1214 | |
---|
1215 | #if NH_MV_LAYERS_NOT_PRESENT_SEI |
---|
1216 | Void SEIReader::xParseSEILayersNotPresent(SEILayersNotPresent &sei, UInt payloadSize, const TComVPS *vps, std::ostream *pDecodedMessageOutputStream) |
---|
1217 | { |
---|
1218 | UInt code; |
---|
1219 | |
---|
1220 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1221 | sei_read_code( pDecodedMessageOutputStream, 4, code, "lnp_sei_active_vps_id" ); sei.m_lnpSeiActiveVpsId = code; |
---|
1222 | assert(vps->getVPSId() == sei.m_lnpSeiActiveVpsId); |
---|
1223 | |
---|
1224 | sei.m_lnpSeiMaxLayers = vps->getMaxLayersMinus1() + 1; |
---|
1225 | sei.resizeDimI(sei.m_lnpSeiMaxLayers); |
---|
1226 | for (Int i = 0; i < sei.m_lnpSeiMaxLayers; i++) |
---|
1227 | { |
---|
1228 | sei_read_flag( pDecodedMessageOutputStream, code, "layer_not_present_flag" ); |
---|
1229 | sei.m_layerNotPresentFlag[i] = (code == 1); |
---|
1230 | } |
---|
1231 | }; |
---|
1232 | #endif |
---|
1233 | |
---|
1234 | Void SEIReader::xParseSEIInterLayerConstrainedTileSets(SEIInterLayerConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1235 | { |
---|
1236 | UInt code; |
---|
1237 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1238 | |
---|
1239 | sei_read_flag( pDecodedMessageOutputStream, code, "il_all_tiles_exact_sample_value_match_flag" ); sei.m_ilAllTilesExactSampleValueMatchFlag = (code == 1); |
---|
1240 | sei_read_flag( pDecodedMessageOutputStream, code, "il_one_tile_per_tile_set_flag" ); sei.m_ilOneTilePerTileSetFlag = (code == 1); |
---|
1241 | if( !sei.m_ilOneTilePerTileSetFlag ) |
---|
1242 | { |
---|
1243 | sei_read_uvlc( pDecodedMessageOutputStream, code, "il_num_sets_in_message_minus1" ); sei.m_ilNumSetsInMessageMinus1 = code; |
---|
1244 | if( sei.m_ilNumSetsInMessageMinus1 ) |
---|
1245 | { |
---|
1246 | sei_read_flag( pDecodedMessageOutputStream, code, "skipped_tile_set_present_flag" ); sei.m_skippedTileSetPresentFlag = (code == 1); |
---|
1247 | } |
---|
1248 | Int numSignificantSets = sei.m_ilNumSetsInMessageMinus1 - sei.m_skippedTileSetPresentFlag + 1; |
---|
1249 | |
---|
1250 | sei.resizeDimI( numSignificantSets ); |
---|
1251 | for( Int i = 0; i < numSignificantSets; i++ ) |
---|
1252 | { |
---|
1253 | sei_read_uvlc( pDecodedMessageOutputStream, code, "ilcts_id" ); sei.m_ilctsId [i] = code; |
---|
1254 | sei_read_uvlc( pDecodedMessageOutputStream, code, "il_num_tile_rects_in_set_minus1" ); sei.m_ilNumTileRectsInSetMinus1[i] = code; |
---|
1255 | |
---|
1256 | sei.resizeDimJ( i, sei.m_ilNumTileRectsInSetMinus1[ i ] + 1 ); |
---|
1257 | for( Int j = 0; j <= sei.m_ilNumTileRectsInSetMinus1[ i ]; j++ ) |
---|
1258 | { |
---|
1259 | sei_read_uvlc( pDecodedMessageOutputStream, code, "il_top_left_tile_index" ); sei.m_ilTopLeftTileIndex [i][j] = code; |
---|
1260 | sei_read_uvlc( pDecodedMessageOutputStream, code, "il_bottom_right_tile_index" ); sei.m_ilBottomRightTileIndex[i][j] = code; |
---|
1261 | } |
---|
1262 | sei_read_code( pDecodedMessageOutputStream, 2, code, "ilc_idc" ); sei.m_ilcIdc[i] = code; |
---|
1263 | if ( !sei.m_ilAllTilesExactSampleValueMatchFlag ) |
---|
1264 | { |
---|
1265 | sei_read_flag( pDecodedMessageOutputStream, code, "il_exact_sample_value_match_flag" ); sei.m_ilExactSampleValueMatchFlag[i] = (code == 1); |
---|
1266 | } |
---|
1267 | } |
---|
1268 | } |
---|
1269 | else |
---|
1270 | { |
---|
1271 | sei_read_code( pDecodedMessageOutputStream, 2, code, "all_tiles_ilc_idc" ); sei.m_allTilesIlcIdc = code; |
---|
1272 | } |
---|
1273 | }; |
---|
1274 | |
---|
1275 | #if NH_MV_SEI_TBD |
---|
1276 | Void SEIReader::xParseSEIBspNesting(SEIBspNesting& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1277 | { |
---|
1278 | UInt code; |
---|
1279 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1280 | |
---|
1281 | sei_read_uvlc( pDecodedMessageOutputStream, code, "sei_ols_idx" ); sei.m_seiOlsIdx = code; |
---|
1282 | sei_read_uvlc( pDecodedMessageOutputStream, code, "sei_partitioning_scheme_idx" ); sei.m_seiPartitioningSchemeIdx = code; |
---|
1283 | sei_read_uvlc( pDecodedMessageOutputStream, code, "bsp_idx" ); sei.m_bspIdx = code; |
---|
1284 | while( !ByteaLigned(() ) ); |
---|
1285 | { |
---|
1286 | sei_read_code( pDecodedMessageOutputStream, *equalto0*/u1, code, "bsp_nesting_zero_bit" ); sei.m_bspNestingZeroBit = code; |
---|
1287 | } |
---|
1288 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_seis_in_bsp_minus1" ); sei.m_numSeisInBspMinus1 = code; |
---|
1289 | for( Int i = 0; i <= NumSeisInBspMinus1( ); i++ ) |
---|
1290 | { |
---|
1291 | SeiMessage(() ); |
---|
1292 | } |
---|
1293 | }; |
---|
1294 | |
---|
1295 | Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1296 | { |
---|
1297 | UInt code; |
---|
1298 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1299 | |
---|
1300 | psIdx = SeiPartitioningSchemeIdx(); |
---|
1301 | if( nalInitialArrivalDelayPresent ) |
---|
1302 | { |
---|
1303 | for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ ) |
---|
1304 | { |
---|
1305 | sei_read_code( pDecodedMessageOutputStream, getNalInitialArrivalDelayLen ), code, "nal_initial_arrival_delay" ); sei.m_nalInitialArrivalDelay[i] = code; |
---|
1306 | } |
---|
1307 | } |
---|
1308 | if( vclInitialArrivalDelayPresent ) |
---|
1309 | { |
---|
1310 | for( Int i = 0; i < BspSchedCnt( SeiOlsIdx(), psIdx, MaxTemporalId( 0 ) ); i++ ) |
---|
1311 | { |
---|
1312 | sei_read_code( pDecodedMessageOutputStream, getVclInitialArrivalDelayLen ), code, "vcl_initial_arrival_delay" ); sei.m_vclInitialArrivalDelay[i] = code; |
---|
1313 | } |
---|
1314 | } |
---|
1315 | }; |
---|
1316 | #endif |
---|
1317 | |
---|
1318 | Void SEIReader::xParseSEISubBitstreamProperty(SEISubBitstreamProperty& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1319 | { |
---|
1320 | UInt code; |
---|
1321 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1322 | |
---|
1323 | sei_read_code( pDecodedMessageOutputStream, 4, code, "sb_property_active_vps_id" ); sei.m_sbPropertyActiveVpsId = code; |
---|
1324 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_additional_sub_streams_minus1" ); sei.m_numAdditionalSubStreamsMinus1 = code; |
---|
1325 | sei.resizeArrays( ); |
---|
1326 | for( Int i = 0; i <= sei.m_numAdditionalSubStreamsMinus1; i++ ) |
---|
1327 | { |
---|
1328 | sei_read_code( pDecodedMessageOutputStream, 2, code, "sub_bitstream_mode" ); sei.m_subBitstreamMode[i] = code; |
---|
1329 | sei_read_uvlc( pDecodedMessageOutputStream, code, "ols_idx_to_vps" ); sei.m_olsIdxToVps[i] = code; |
---|
1330 | sei_read_code( pDecodedMessageOutputStream, 3, code, "highest_sublayer_id" ); sei.m_highestSublayerId[i] = code; |
---|
1331 | sei_read_code( pDecodedMessageOutputStream, 16, code, "avg_sb_property_bit_rate" ); sei.m_avgSbPropertyBitRate[i] = code; |
---|
1332 | sei_read_code( pDecodedMessageOutputStream, 16, code, "max_sb_property_bit_rate" ); sei.m_maxSbPropertyBitRate[i] = code; |
---|
1333 | } |
---|
1334 | }; |
---|
1335 | |
---|
1336 | #if NH_MV_SEI_TBD |
---|
1337 | Void SEIReader::xParseSEIAlphaChannelInfo(SEIAlphaChannelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1338 | { |
---|
1339 | UInt code; |
---|
1340 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1341 | |
---|
1342 | sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_cancel_flag" ); sei.m_alphaChannelCancelFlag = (code == 1); |
---|
1343 | if( !sei.m_alphaChannelCancelFlag ) |
---|
1344 | { |
---|
1345 | sei_read_code( pDecodedMessageOutputStream, 3, code, "alpha_channel_use_idc" ); sei.m_alphaChannelUseIdc = code; |
---|
1346 | sei_read_code( pDecodedMessageOutputStream, 3, code, "alpha_channel_bit_depth_minus8" ); sei.m_alphaChannelBitDepthMinus8 = code; |
---|
1347 | sei_read_code( pDecodedMessageOutputStream, getAlphaTransparentValueLen ), code, "alpha_transparent_value" ); sei.m_alphaTransparentValue = code; |
---|
1348 | sei_read_code( pDecodedMessageOutputStream, getAlphaOpaqueValueLen ), code, "alpha_opaque_value" ); sei.m_alphaOpaqueValue = code; |
---|
1349 | sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_incr_flag" ); sei.m_alphaChannelIncrFlag = (code == 1); |
---|
1350 | sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_clip_flag" ); sei.m_alphaChannelClipFlag = (code == 1); |
---|
1351 | if( sei.m_alphaChannelClipFlag ) |
---|
1352 | { |
---|
1353 | sei_read_flag( pDecodedMessageOutputStream, code, "alpha_channel_clip_type_flag" ); sei.m_alphaChannelClipTypeFlag = (code == 1); |
---|
1354 | } |
---|
1355 | } |
---|
1356 | }; |
---|
1357 | |
---|
1358 | Void SEIReader::xParseSEIOverlayInfo(SEIOverlayInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1359 | { |
---|
1360 | UInt code; |
---|
1361 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1362 | |
---|
1363 | sei_read_flag( pDecodedMessageOutputStream, code, "overlay_info_cancel_flag" ); sei.m_overlayInfoCancelFlag = (code == 1); |
---|
1364 | if( !sei.m_overlayInfoCancelFlag ) |
---|
1365 | { |
---|
1366 | sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_content_aux_id_minus128" ); sei.m_overlayContentAuxIdMinus128 = code; |
---|
1367 | sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_label_aux_id_minus128" ); sei.m_overlayLabelAuxIdMinus128 = code; |
---|
1368 | sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_alpha_aux_id_minus128" ); sei.m_overlayAlphaAuxIdMinus128 = code; |
---|
1369 | sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_element_label_value_length_minus8" ); sei.m_overlayElementLabelValueLengthMinus8 = code; |
---|
1370 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_overlays_minus1" ); sei.m_numOverlaysMinus1 = code; |
---|
1371 | for( Int i = 0; i <= NumOverlaysMinus1( ); i++ ) |
---|
1372 | { |
---|
1373 | sei_read_uvlc( pDecodedMessageOutputStream, code, "overlay_idx" ); sei.m_overlayIdx[i] = code; |
---|
1374 | sei_read_flag( pDecodedMessageOutputStream, code, "language_overlay_present_flag" ); sei.m_languageOverlayPresentFlag[i] = (code == 1); |
---|
1375 | sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_content_layer_id" ); sei.m_overlayContentLayerId[i] = code; |
---|
1376 | sei_read_flag( pDecodedMessageOutputStream, code, "overlay_label_present_flag" ); sei.m_overlayLabelPresentFlag[i] = (code == 1); |
---|
1377 | if( sei.m_overlayLabelPresentFlag( i ) ) |
---|
1378 | { |
---|
1379 | sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_label_layer_id" ); sei.m_overlayLabelLayerId[i] = code; |
---|
1380 | } |
---|
1381 | sei_read_flag( pDecodedMessageOutputStream, code, "overlay_alpha_present_flag" ); sei.m_overlayAlphaPresentFlag[i] = (code == 1); |
---|
1382 | if( sei.m_overlayAlphaPresentFlag( i ) ) |
---|
1383 | { |
---|
1384 | sei_read_code( pDecodedMessageOutputStream, 6, code, "overlay_alpha_layer_id" ); sei.m_overlayAlphaLayerId[i] = code; |
---|
1385 | } |
---|
1386 | if( sei.m_overlayLabelPresentFlag( i ) ) |
---|
1387 | { |
---|
1388 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_overlay_elements_minus1" ); sei.m_numOverlayElementsMinus1[i] = code; |
---|
1389 | for( Int j = 0; j <= sei.m_numOverlayElementsMinus1( i ); j++ ) |
---|
1390 | { |
---|
1391 | sei_read_code( pDecodedMessageOutputStream, getOverlayElementLabelMinLen ), code, "overlay_element_label_min" ); sei.m_overlayElementLabelMin[i][j] = code; |
---|
1392 | sei_read_code( pDecodedMessageOutputStream, getOverlayElementLabelMaxLen ), code, "overlay_element_label_max" ); sei.m_overlayElementLabelMax[i][j] = code; |
---|
1393 | } |
---|
1394 | } |
---|
1395 | } |
---|
1396 | while( !ByteaLigned(() ) ); |
---|
1397 | { |
---|
1398 | sei_read_code( pDecodedMessageOutputStream, *equalto0*/f1, code, "overlay_zero_bit" ); sei.m_overlayZeroBit = code; |
---|
1399 | } |
---|
1400 | for( Int i = 0; i <= NumOverlaysMinus1( ); i++ ) |
---|
1401 | { |
---|
1402 | if( sei.m_languageOverlayPresentFlag( i ) ) |
---|
1403 | { |
---|
1404 | sei_read_code( pDecodedMessageOutputStream, tv, code, "overlay_language" ); sei.m_overlayLanguage[i] = code; |
---|
1405 | } |
---|
1406 | sei_read_code( pDecodedMessageOutputStream, tv, code, "overlay_name" ); sei.m_overlayName[i] = code; |
---|
1407 | if( sei.m_overlayLabelPresentFlag( i ) ) |
---|
1408 | { |
---|
1409 | for( Int j = 0; j <= sei.m_numOverlayElementsMinus1( i ); j++ ) |
---|
1410 | { |
---|
1411 | sei_read_code( pDecodedMessageOutputStream, tv, code, "overlay_element_name" ); sei.m_overlayElementName[i][j] = code; |
---|
1412 | } |
---|
1413 | } |
---|
1414 | } |
---|
1415 | sei_read_flag( pDecodedMessageOutputStream, code, "overlay_info_persistence_flag" ); sei.m_overlayInfoPersistenceFlag = (code == 1); |
---|
1416 | } |
---|
1417 | }; |
---|
1418 | #endif |
---|
1419 | |
---|
1420 | Void SEIReader::xParseSEITemporalMvPredictionConstraints(SEITemporalMvPredictionConstraints& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1421 | { |
---|
1422 | UInt code; |
---|
1423 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1424 | |
---|
1425 | sei_read_flag( pDecodedMessageOutputStream, code, "prev_pics_not_used_flag" ); sei.m_prevPicsNotUsedFlag = (code == 1); |
---|
1426 | sei_read_flag( pDecodedMessageOutputStream, code, "no_intra_layer_col_pic_flag" ); sei.m_noIntraLayerColPicFlag = (code == 1); |
---|
1427 | }; |
---|
1428 | |
---|
1429 | #if NH_MV_SEI_TBD |
---|
1430 | Void SEIReader::xParseSEIFrameFieldInfo(SEIFrameFieldInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1431 | { |
---|
1432 | UInt code; |
---|
1433 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1434 | |
---|
1435 | sei_read_code( pDecodedMessageOutputStream, 4, code, "ffinfo_pic_struct" ); sei.m_ffinfoPicStruct = code; |
---|
1436 | sei_read_code( pDecodedMessageOutputStream, 2, code, "ffinfo_source_scan_type" ); sei.m_ffinfoSourceScanType = code; |
---|
1437 | sei_read_flag( pDecodedMessageOutputStream, code, "ffinfo_duplicate_flag" ); sei.m_ffinfoDuplicateFlag = (code == 1); |
---|
1438 | }; |
---|
1439 | |
---|
1440 | Void SEIReader::xParseSEIThreeDimensionalReferenceDisplaysInfo(SEIThreeDimensionalReferenceDisplaysInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1441 | { |
---|
1442 | UInt code; |
---|
1443 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1444 | |
---|
1445 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_ref_display_width" ); sei.m_precRefDisplayWidth = code; |
---|
1446 | sei_read_flag( pDecodedMessageOutputStream, code, "ref_viewing_distance_flag" ); sei.m_refViewingDistanceFlag = (code == 1); |
---|
1447 | if( sei.m_refViewingDistanceFlag ) |
---|
1448 | { |
---|
1449 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_ref_viewing_dist" ); sei.m_precRefViewingDist = code; |
---|
1450 | } |
---|
1451 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_ref_displays_minus1" ); sei.m_numRefDisplaysMinus1 = code; |
---|
1452 | for( Int i = 0; i <= NumRefDisplaysMinus1( ); i++ ) |
---|
1453 | { |
---|
1454 | sei_read_uvlc( pDecodedMessageOutputStream, code, "left_view_id" ); sei.m_leftViewId[i] = code; |
---|
1455 | sei_read_uvlc( pDecodedMessageOutputStream, code, "right_view_id" ); sei.m_rightViewId[i] = code; |
---|
1456 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_ref_display_width" ); sei.m_exponentRefDisplayWidth[i] = code; |
---|
1457 | sei_read_code( pDecodedMessageOutputStream, getMantissaRefDisplayWidthLen ), code, "mantissa_ref_display_width" ); sei.m_mantissaRefDisplayWidth[i] = code; |
---|
1458 | if( sei.m_refViewingDistanceFlag ) |
---|
1459 | { |
---|
1460 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_ref_viewing_distance" ); sei.m_exponentRefViewingDistance[i] = code; |
---|
1461 | sei_read_code( pDecodedMessageOutputStream, getMantissaRefViewingDistanceLen ), code, "mantissa_ref_viewing_distance" ); sei.m_mantissaRefViewingDistance[i] = code; |
---|
1462 | } |
---|
1463 | sei_read_flag( pDecodedMessageOutputStream, code, "additional_shift_present_flag" ); sei.m_additionalShiftPresentFlag[i] = (code == 1); |
---|
1464 | if( sei.m_additionalShiftPresentFlag( i ) ) |
---|
1465 | { |
---|
1466 | sei_read_code( pDecodedMessageOutputStream, 10, code, "num_sample_shift_plus512" ); sei.m_numSampleShiftPlus512[i] = code; |
---|
1467 | } |
---|
1468 | } |
---|
1469 | sei_read_flag( pDecodedMessageOutputStream, code, "three_dimensional_reference_displays_extension_flag" ); sei.m_threeDimensionalReferenceDisplaysExtensionFlag = (code == 1); |
---|
1470 | }; |
---|
1471 | |
---|
1472 | Void SEIReader::xParseSEIDepthRepresentationInfo(SEIDepthRepresentationInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1473 | { |
---|
1474 | UInt code; |
---|
1475 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1476 | |
---|
1477 | sei_read_flag( pDecodedMessageOutputStream, code, "z_near_flag" ); sei.m_zNearFlag = (code == 1); |
---|
1478 | sei_read_flag( pDecodedMessageOutputStream, code, "z_far_flag" ); sei.m_zFarFlag = (code == 1); |
---|
1479 | sei_read_flag( pDecodedMessageOutputStream, code, "d_min_flag" ); sei.m_dMinFlag = (code == 1); |
---|
1480 | sei_read_flag( pDecodedMessageOutputStream, code, "d_max_flag" ); sei.m_dMaxFlag = (code == 1); |
---|
1481 | sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_representation_type" ); sei.m_depthRepresentationType = code; |
---|
1482 | if( sei.m_dMinFlag | | sei.m_dMaxFlag ) |
---|
1483 | { |
---|
1484 | sei_read_uvlc( pDecodedMessageOutputStream, code, "disparity_ref_view_id" ); sei.m_disparityRefViewId = code; |
---|
1485 | } |
---|
1486 | if( sei.m_zNearFlag ) |
---|
1487 | { |
---|
1488 | DepthRepInfoElement(() ZNearSign, ZNearExp, ZNearMantissa, ZNearManLen ); |
---|
1489 | } |
---|
1490 | if( sei.m_zFarFlag ) |
---|
1491 | { |
---|
1492 | DepthRepInfoElement(() ZFarSign, ZFarExp, ZFarMantissa, ZFarManLen ); |
---|
1493 | } |
---|
1494 | if( sei.m_dMinFlag ) |
---|
1495 | { |
---|
1496 | DepthRepInfoElement(() DMinSign, DMinExp, DMinMantissa, DMinManLen ); |
---|
1497 | } |
---|
1498 | if( sei.m_dMaxFlag ) |
---|
1499 | { |
---|
1500 | DepthRepInfoElement(() DMaxSign, DMaxExp, DMaxMantissa, DMaxManLen ); |
---|
1501 | } |
---|
1502 | if( sei.m_depthRepresentationType == 3 ) |
---|
1503 | { |
---|
1504 | sei_read_uvlc( pDecodedMessageOutputStream, code, "depth_nonlinear_representation_num_minus1" ); sei.m_depthNonlinearRepresentationNumMinus1 = code; |
---|
1505 | for( Int i = 1; i <= sei.m_depthNonlinearRepresentationNumMinus1 + 1; i++ ) |
---|
1506 | { |
---|
1507 | DepthNonlinearRepresentationModel( i ); |
---|
1508 | } |
---|
1509 | } |
---|
1510 | }; |
---|
1511 | |
---|
1512 | Void SEIReader::xParseSEIDepthRepInfoElement(SEIDepthRepInfoElement& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1513 | { |
---|
1514 | UInt code; |
---|
1515 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1516 | |
---|
1517 | sei_read_flag( pDecodedMessageOutputStream, code, "da_sign_flag" ); sei.m_daSignFlag = (code == 1); |
---|
1518 | sei_read_code( pDecodedMessageOutputStream, 7, code, "da_exponent" ); sei.m_daExponent = code; |
---|
1519 | sei_read_code( pDecodedMessageOutputStream, 5, code, "da_mantissa_len_minus1" ); sei.m_daMantissaLenMinus1 = code; |
---|
1520 | sei_read_code( pDecodedMessageOutputStream, getDaMantissaLen ), code, "da_mantissa" ); sei.m_daMantissa = code; |
---|
1521 | }; |
---|
1522 | #endif |
---|
1523 | Void SEIReader::xParseSEIMultiviewSceneInfo(SEIMultiviewSceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1524 | { |
---|
1525 | UInt code; |
---|
1526 | Int sCode; |
---|
1527 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1528 | |
---|
1529 | sei_read_svlc( pDecodedMessageOutputStream, sCode, "min_disparity" ) ; sei.m_minDisparity = sCode; |
---|
1530 | sei_read_uvlc( pDecodedMessageOutputStream, code , "max_disparity_range" ); sei.m_maxDisparityRange = code; |
---|
1531 | }; |
---|
1532 | |
---|
1533 | Void SEIReader::xParseSEIMultiviewAcquisitionInfo(SEIMultiviewAcquisitionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1534 | { |
---|
1535 | UInt code; |
---|
1536 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1537 | |
---|
1538 | sei.resizeArrays( ); |
---|
1539 | sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_param_flag" ); sei.m_intrinsicParamFlag = (code == 1); |
---|
1540 | sei_read_flag( pDecodedMessageOutputStream, code, "extrinsic_param_flag" ); sei.m_extrinsicParamFlag = (code == 1); |
---|
1541 | if( sei.m_intrinsicParamFlag ) |
---|
1542 | { |
---|
1543 | sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_params_equal_flag" ); sei.m_intrinsicParamsEqualFlag = (code == 1); |
---|
1544 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_focal_length" ); sei.m_precFocalLength = code ; |
---|
1545 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_principal_point" ); sei.m_precPrincipalPoint = code ; |
---|
1546 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_skew_factor" ); sei.m_precSkewFactor = code ; |
---|
1547 | |
---|
1548 | for( Int i = 0; i <= ( sei.m_intrinsicParamsEqualFlag ? 0 : sei.getNumViewsMinus1() ); i++ ) |
---|
1549 | { |
---|
1550 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_focal_length_x" ); sei.m_signFocalLengthX [i] = (code == 1); |
---|
1551 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_focal_length_x" ); sei.m_exponentFocalLengthX [i] = code ; |
---|
1552 | sei_read_code( pDecodedMessageOutputStream, sei.getMantissaFocalLengthXLen ( i ), code, "mantissa_focal_length_x" ); sei.m_mantissaFocalLengthX [i] = code ; |
---|
1553 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_focal_length_y" ); sei.m_signFocalLengthY [i] = (code == 1); |
---|
1554 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_focal_length_y" ); sei.m_exponentFocalLengthY [i] = code ; |
---|
1555 | sei_read_code( pDecodedMessageOutputStream, sei.getMantissaFocalLengthYLen ( i ), code, "mantissa_focal_length_y" ); sei.m_mantissaFocalLengthY [i] = code ; |
---|
1556 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_principal_point_x" ); sei.m_signPrincipalPointX [i] = (code == 1); |
---|
1557 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_principal_point_x" ); sei.m_exponentPrincipalPointX[i] = code ; |
---|
1558 | sei_read_code( pDecodedMessageOutputStream, sei.getMantissaPrincipalPointXLen( i ), code, "mantissa_principal_point_x" ); sei.m_mantissaPrincipalPointX[i] = code ; |
---|
1559 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_principal_point_y" ); sei.m_signPrincipalPointY [i] = (code == 1); |
---|
1560 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_principal_point_y" ); sei.m_exponentPrincipalPointY[i] = code ; |
---|
1561 | sei_read_code( pDecodedMessageOutputStream, sei.getMantissaPrincipalPointYLen( i ), code, "mantissa_principal_point_y" ); sei.m_mantissaPrincipalPointY[i] = code ; |
---|
1562 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_skew_factor" ); sei.m_signSkewFactor [i] = (code == 1); |
---|
1563 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_skew_factor" ); sei.m_exponentSkewFactor [i] = code ; |
---|
1564 | sei_read_code( pDecodedMessageOutputStream, sei.getMantissaSkewFactorLen ( i ), code, "mantissa_skew_factor" ); sei.m_mantissaSkewFactor [i] = code ; |
---|
1565 | } |
---|
1566 | } |
---|
1567 | if( sei.m_extrinsicParamFlag ) |
---|
1568 | { |
---|
1569 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_rotation_param" ); sei.m_precRotationParam = code; |
---|
1570 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_translation_param" ); sei.m_precTranslationParam = code; |
---|
1571 | |
---|
1572 | for( Int i = 0; i <= sei.getNumViewsMinus1(); i++ ) |
---|
1573 | { |
---|
1574 | for( Int j = 0; j <= 2; j++ ) /* row */ |
---|
1575 | { |
---|
1576 | for( Int k = 0; k <= 2; k++ ) /* column */ |
---|
1577 | { |
---|
1578 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_r" ); sei.m_signR [i][j][k] = (code == 1); |
---|
1579 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_r" ); sei.m_exponentR[i][j][k] = code ; |
---|
1580 | sei_read_code( pDecodedMessageOutputStream, sei.getMantissaRLen( i, j, k ), code, "mantissa_r" ); sei.m_mantissaR[i][j][k] = code ; |
---|
1581 | } |
---|
1582 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_t" ); sei.m_signT [i][j] = (code == 1); |
---|
1583 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exponent_t" ); sei.m_exponentT[i][j] = code ; |
---|
1584 | sei_read_code( pDecodedMessageOutputStream, sei.getMantissaTLen( i, j ), code, "mantissa_t" ); sei.m_mantissaT[i][j] = code ; |
---|
1585 | } |
---|
1586 | } |
---|
1587 | } |
---|
1588 | }; |
---|
1589 | |
---|
1590 | |
---|
1591 | |
---|
1592 | Void SEIReader::xParseSEIMultiviewViewPosition(SEIMultiviewViewPosition& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1593 | { |
---|
1594 | UInt code; |
---|
1595 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1596 | |
---|
1597 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_views_minus1" ); sei.m_numViewsMinus1 = code; |
---|
1598 | sei.m_viewPosition.resize( sei.m_numViewsMinus1 + 1 ); |
---|
1599 | for( Int i = 0; i <= sei.m_numViewsMinus1; i++ ) |
---|
1600 | { |
---|
1601 | sei_read_uvlc( pDecodedMessageOutputStream, code, "view_position" ); sei.m_viewPosition[i] = code; |
---|
1602 | } |
---|
1603 | }; |
---|
1604 | |
---|
1605 | #if NH_MV_SEI_TBD |
---|
1606 | Void SEIReader::xParseSEIAlternativeDepthInfo(SEIAlternativeDepthInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) |
---|
1607 | { |
---|
1608 | UInt code; |
---|
1609 | output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); |
---|
1610 | |
---|
1611 | sei_read_flag( pDecodedMessageOutputStream, code, "alternative_depth_info_cancel_flag" ); sei.m_alternativeDepthInfoCancelFlag = (code == 1); |
---|
1612 | if( sei.m_alternativeDepthInfoCancelFlag == 0 ) |
---|
1613 | { |
---|
1614 | sei_read_code( pDecodedMessageOutputStream, 2, code, "depth_type" ); sei.m_depthType = code; |
---|
1615 | if( sei.m_depthType == 0 ) |
---|
1616 | { |
---|
1617 | sei_read_uvlc( pDecodedMessageOutputStream, code, "num_constituent_views_gvd_minus1" ); sei.m_numConstituentViewsGvdMinus1 = code; |
---|
1618 | sei_read_flag( pDecodedMessageOutputStream, code, "depth_present_gvd_flag" ); sei.m_depthPresentGvdFlag = (code == 1); |
---|
1619 | sei_read_flag( pDecodedMessageOutputStream, code, "z_gvd_flag" ); sei.m_zGvdFlag = (code == 1); |
---|
1620 | sei_read_flag( pDecodedMessageOutputStream, code, "intrinsic_param_gvd_flag" ); sei.m_intrinsicParamGvdFlag = (code == 1); |
---|
1621 | sei_read_flag( pDecodedMessageOutputStream, code, "rotation_gvd_flag" ); sei.m_rotationGvdFlag = (code == 1); |
---|
1622 | sei_read_flag( pDecodedMessageOutputStream, code, "translation_gvd_flag" ); sei.m_translationGvdFlag = (code == 1); |
---|
1623 | if( sei.m_zGvdFlag ) |
---|
1624 | { |
---|
1625 | for( Int i = 0; i <= sei.m_numConstituentViewsGvdMinus1 + 1; i++ ) |
---|
1626 | { |
---|
1627 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_z_near_flag" ); sei.m_signGvdZNearFlag[i] = (code == 1); |
---|
1628 | sei_read_code( pDecodedMessageOutputStream, 7, code, "exp_gvd_z_near" ); sei.m_expGvdZNear[i] = code; |
---|
1629 | sei_read_code( pDecodedMessageOutputStream, 5, code, "man_len_gvd_z_near_minus1" ); sei.m_manLenGvdZNearMinus1[i] = code; |
---|
1630 | sei_read_code( pDecodedMessageOutputStream, getManGvdZNearLen ), code, "man_gvd_z_near" ); sei.m_manGvdZNear[i] = code; |
---|
1631 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_z_far_flag" ); sei.m_signGvdZFarFlag[i] = (code == 1); |
---|
1632 | sei_read_code( pDecodedMessageOutputStream, 7, code, "exp_gvd_z_far" ); sei.m_expGvdZFar[i] = code; |
---|
1633 | sei_read_code( pDecodedMessageOutputStream, 5, code, "man_len_gvd_z_far_minus1" ); sei.m_manLenGvdZFarMinus1[i] = code; |
---|
1634 | sei_read_code( pDecodedMessageOutputStream, getManGvdZFarLen ), code, "man_gvd_z_far" ); sei.m_manGvdZFar[i] = code; |
---|
1635 | } |
---|
1636 | } |
---|
1637 | if( sei.m_intrinsicParamGvdFlag ) |
---|
1638 | { |
---|
1639 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_focal_length" ); sei.m_precGvdFocalLength = code; |
---|
1640 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_principal_point" ); sei.m_precGvdPrincipalPoint = code; |
---|
1641 | } |
---|
1642 | if( sei.m_rotationGvdFlag ) |
---|
1643 | { |
---|
1644 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_rotation_param" ); sei.m_precGvdRotationParam = code; |
---|
1645 | } |
---|
1646 | if( sei.m_translationGvdFlag ) |
---|
1647 | { |
---|
1648 | sei_read_uvlc( pDecodedMessageOutputStream, code, "prec_gvd_translation_param" ); sei.m_precGvdTranslationParam = code; |
---|
1649 | } |
---|
1650 | for( Int i = 0; i <= sei.m_numConstituentViewsGvdMinus1 + 1; i++ ) |
---|
1651 | { |
---|
1652 | if( sei.m_intrinsicParamGvdFlag ) |
---|
1653 | { |
---|
1654 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_focal_length_x" ); sei.m_signGvdFocalLengthX[i] = (code == 1); |
---|
1655 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_focal_length_x" ); sei.m_expGvdFocalLengthX[i] = code; |
---|
1656 | sei_read_code( pDecodedMessageOutputStream, getManGvdFocalLengthXLen ), code, "man_gvd_focal_length_x" ); sei.m_manGvdFocalLengthX[i] = code; |
---|
1657 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_focal_length_y" ); sei.m_signGvdFocalLengthY[i] = (code == 1); |
---|
1658 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_focal_length_y" ); sei.m_expGvdFocalLengthY[i] = code; |
---|
1659 | sei_read_code( pDecodedMessageOutputStream, getManGvdFocalLengthYLen ), code, "man_gvd_focal_length_y" ); sei.m_manGvdFocalLengthY[i] = code; |
---|
1660 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_principal_point_x" ); sei.m_signGvdPrincipalPointX[i] = (code == 1); |
---|
1661 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_principal_point_x" ); sei.m_expGvdPrincipalPointX[i] = code; |
---|
1662 | sei_read_code( pDecodedMessageOutputStream, getManGvdPrincipalPointXLen ), code, "man_gvd_principal_point_x" ); sei.m_manGvdPrincipalPointX[i] = code; |
---|
1663 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_principal_point_y" ); sei.m_signGvdPrincipalPointY[i] = (code == 1); |
---|
1664 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_principal_point_y" ); sei.m_expGvdPrincipalPointY[i] = code; |
---|
1665 | sei_read_code( pDecodedMessageOutputStream, getManGvdPrincipalPointYLen ), code, "man_gvd_principal_point_y" ); sei.m_manGvdPrincipalPointY[i] = code; |
---|
1666 | } |
---|
1667 | if( sei.m_rotationGvdFlag ) |
---|
1668 | { |
---|
1669 | for( Int j = 10; j <= 3; j++ ) /* row */ |
---|
1670 | { |
---|
1671 | for( Int k = 10; k <= 3; k++ ) /* column */ |
---|
1672 | { |
---|
1673 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_r" ); sei.m_signGvdR[i][j][k] = (code == 1); |
---|
1674 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_r" ); sei.m_expGvdR[i][j][k] = code; |
---|
1675 | sei_read_code( pDecodedMessageOutputStream, getManGvdRLen ), code, "man_gvd_r" ); sei.m_manGvdR[i][j][k] = code; |
---|
1676 | } |
---|
1677 | } |
---|
1678 | } |
---|
1679 | if( sei.m_translationGvdFlag ) |
---|
1680 | { |
---|
1681 | sei_read_flag( pDecodedMessageOutputStream, code, "sign_gvd_t_x" ); sei.m_signGvdTX[i] = (code == 1); |
---|
1682 | sei_read_code( pDecodedMessageOutputStream, 6, code, "exp_gvd_t_x" ); sei.m_expGvdTX[i] = code; |
---|
1683 | sei_read_code( pDecodedMessageOutputStream, getManGvdTXLen ), code, "man_gvd_t_x" ); sei.m_manGvdTX[i] = code; |
---|
1684 | } |
---|
1685 | } |
---|
1686 | } |
---|
1687 | if( sei.m_depthType == 1 ) |
---|
1688 | { |
---|
1689 | sei_read_svlc( pDecodedMessageOutputStream, code, "min_offset_x_int" ); sei.m_minOffsetXInt = code; |
---|
1690 | sei_read_code( pDecodedMessageOutputStream, 8, code, "min_offset_x_frac" ); sei.m_minOffsetXFrac = code; |
---|
1691 | sei_read_svlc( pDecodedMessageOutputStream, code, "max_offset_x_int" ); sei.m_maxOffsetXInt = code; |
---|
1692 | sei_read_code( pDecodedMessageOutputStream, 8, code, "max_offset_x_frac" ); sei.m_maxOffsetXFrac = code; |
---|
1693 | sei_read_flag( pDecodedMessageOutputStream, code, "offset_y_present_flag" ); sei.m_offsetYPresentFlag = (code == 1); |
---|
1694 | if( sei.m_offsetYPresentFlag ) |
---|
1695 | { |
---|
1696 | sei_read_svlc( pDecodedMessageOutputStream, code, "min_offset_y_int" ); sei.m_minOffsetYInt = code; |
---|
1697 | sei_read_code( pDecodedMessageOutputStream, 8, code, "min_offset_y_frac" ); sei.m_minOffsetYFrac = code; |
---|
1698 | sei_read_svlc( pDecodedMessageOutputStream, code, "max_offset_y_int" ); sei.m_maxOffsetYInt = code; |
---|
1699 | sei_read_code( pDecodedMessageOutputStream, 8, code, "max_offset_y_frac" ); sei.m_maxOffsetYFrac = code; |
---|
1700 | } |
---|
1701 | sei_read_flag( pDecodedMessageOutputStream, code, "warp_map_size_present_flag" ); sei.m_warpMapSizePresentFlag = (code == 1); |
---|
1702 | if( sei.m_warpMapSizePresentFlag ) |
---|
1703 | { |
---|
1704 | sei_read_uvlc( pDecodedMessageOutputStream, code, "warp_map_width_minus2" ); sei.m_warpMapWidthMinus2 = code; |
---|
1705 | sei_read_uvlc( pDecodedMessageOutputStream, code, "warp_map_height_minus2" ); sei.m_warpMapHeightMinus2 = code; |
---|
1706 | } |
---|
1707 | } |
---|
1708 | } |
---|
1709 | }; |
---|
1710 | #endif |
---|
1711 | |
---|
1712 | //! \} |
---|