source: 3DVCSoftware/branches/HTM-15.2-dev/source/Lib/TLibDecoder/SEIread.cpp @ 1374

Last change on this file since 1374 was 1374, checked in by tech, 8 years ago

Macro cleanups.

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