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