HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SEIread.cpp
Go to the documentation of this file.
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-2017, 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 
39 #include "TLibCommon/CommonDef.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 
51 
52 
53 #if ENC_DEC_TRACE
54 Void xTraceSEIHeader()
55 {
56  fprintf( g_hTrace, "=========== SEI message ===========\n");
57 }
58 
59 Void xTraceSEIMessageType(SEI::PayloadType payloadType)
60 {
61  fprintf( g_hTrace, "=========== %s SEI message ===========\n", SEI::getSEIMessageString(payloadType));
62 }
63 #endif
64 
65 Void SEIReader::sei_read_scode(std::ostream *pOS, UInt uiLength, Int& ruiCode, const TChar *pSymbolName)
66 {
67  READ_SCODE(uiLength, ruiCode, pSymbolName);
68  if (pOS)
69  {
70  (*pOS) << " " << std::setw(55) << pSymbolName << ": " << ruiCode << "\n";
71  }
72 }
73 
74 Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName)
75 {
76  READ_CODE(uiLength, ruiCode, pSymbolName);
77  if (pOS)
78  {
79  (*pOS) << " " << std::setw(55) << pSymbolName << ": " << ruiCode << "\n";
80  }
81 }
82 
83 Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName)
84 {
85  READ_UVLC(ruiCode, pSymbolName);
86  if (pOS)
87  {
88  (*pOS) << " " << std::setw(55) << pSymbolName << ": " << ruiCode << "\n";
89  }
90 }
91 
92 Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const TChar *pSymbolName)
93 {
94  READ_SVLC(ruiCode, pSymbolName);
95  if (pOS)
96  {
97  (*pOS) << " " << std::setw(55) << pSymbolName << ": " << ruiCode << "\n";
98  }
99 }
100 
101 Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName)
102 {
103  READ_FLAG(ruiCode, pSymbolName);
104  if (pOS)
105  {
106  (*pOS) << " " << std::setw(55) << pSymbolName << ": " << (ruiCode?1:0) << "\n";
107  }
108 }
109 
110 static inline Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize)
111 {
112  if (pDecodedMessageOutputStream)
113  {
114  std::string seiMessageHdr(SEI::getSEIMessageString(sei.payloadType())); seiMessageHdr+=" SEI message";
115  (*pDecodedMessageOutputStream) << std::setfill('-') << std::setw(seiMessageHdr.size()) << "-" << std::setfill(' ') << "\n" << seiMessageHdr << " (" << payloadSize << " bytes)"<< "\n";
116  }
117 }
118 
119 #undef READ_SCODE
120 #undef READ_CODE
121 #undef READ_SVLC
122 #undef READ_UVLC
123 #undef READ_FLAG
124 
125 
129 Void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
130 {
131  setBitstream(bs);
132 
134  do
135  {
136  xReadSEImessage(seis, nalUnitType, sps, pDecodedMessageOutputStream);
137 
138  /* SEI messages are an integer number of bytes, something has failed
139  * in the parsing if bitstream not byte-aligned */
141  }
142  while (m_pcBitstream->getNumBitsLeft() > 8);
143 
145 }
146 
147 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
148 {
149 #if ENC_DEC_TRACE
150  xTraceSEIHeader();
151 #endif
152  Int payloadType = 0;
153  UInt val = 0;
154 
155  do
156  {
157  sei_read_code(NULL, 8, val, "payload_type");
158  payloadType += val;
159  } while (val==0xFF);
160 
161  UInt payloadSize = 0;
162  do
163  {
164  sei_read_code(NULL, 8, val, "payload_size");
165  payloadSize += val;
166  } while (val==0xFF);
167 
168 #if ENC_DEC_TRACE
169  xTraceSEIMessageType((SEI::PayloadType)payloadType);
170 #endif
171 
172  /* extract the payload for this single SEI message.
173  * This allows greater safety in erroneous parsing of an SEI message
174  * from affecting subsequent messages.
175  * After parsing the payload, bs needs to be restored as the primary
176  * bitstream.
177  */
179  setBitstream(bs->extractSubstream(payloadSize * 8));
180 
181  SEI *sei = NULL;
182 
183  if(nalUnitType == NAL_UNIT_PREFIX_SEI)
184  {
185  switch (payloadType)
186  {
188  if (!sps)
189  {
190  printf ("Warning: Found Buffering period SEI message, but no active SPS is available. Ignoring.");
191  }
192  else
193  {
194  sei = new SEIBufferingPeriod;
195  xParseSEIBufferingPeriod((SEIBufferingPeriod&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
196  }
197  break;
198  case SEI::PICTURE_TIMING:
199  if (!sps)
200  {
201  printf ("Warning: Found Picture timing SEI message, but no active SPS is available. Ignoring.");
202  }
203  else
204  {
205  sei = new SEIPictureTiming;
206  xParseSEIPictureTiming((SEIPictureTiming&)*sei, payloadSize, sps, pDecodedMessageOutputStream);
207  }
208  break;
209  case SEI::PAN_SCAN_RECT:
210  sei = new SEIPanScanRect;
211  xParseSEIPanScanRect((SEIPanScanRect&) *sei, payloadSize, pDecodedMessageOutputStream);
212  break;
213  case SEI::FILLER_PAYLOAD:
214  sei = new SEIFillerPayload;
215  xParseSEIFillerPayload((SEIFillerPayload&) *sei, payloadSize, pDecodedMessageOutputStream);
216  break;
218  sei = new SEIUserDataRegistered;
219  xParseSEIUserDataRegistered((SEIUserDataRegistered&) *sei, payloadSize, pDecodedMessageOutputStream);
220  break;
222  sei = new SEIUserDataUnregistered;
223  xParseSEIUserDataUnregistered((SEIUserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream);
224  break;
225  case SEI::RECOVERY_POINT:
226  sei = new SEIRecoveryPoint;
227  xParseSEIRecoveryPoint((SEIRecoveryPoint&) *sei, payloadSize, pDecodedMessageOutputStream);
228  break;
229  case SEI::SCENE_INFO:
230  sei = new SEISceneInfo;
231  xParseSEISceneInfo((SEISceneInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
232  break;
234  sei = new SEIPictureSnapshot;
235  xParseSEIPictureSnapshot((SEIPictureSnapshot&) *sei, payloadSize, pDecodedMessageOutputStream);
236  break;
239  xParseSEIProgressiveRefinementSegmentStart((SEIProgressiveRefinementSegmentStart&) *sei, payloadSize, pDecodedMessageOutputStream);
240  break;
243  xParseSEIProgressiveRefinementSegmentEnd((SEIProgressiveRefinementSegmentEnd&) *sei, payloadSize, pDecodedMessageOutputStream);
244  break;
246  sei = new SEIFilmGrainCharacteristics;
247  xParseSEIFilmGrainCharacteristics((SEIFilmGrainCharacteristics&) *sei, payloadSize, pDecodedMessageOutputStream);
248  break;
250  if (!sps)
251  {
252  printf ("Warning: post filter hint SEI message, but no active SPS is available. Ignoring.");
253  }
254  else
255  {
256  sei = new SEIPostFilterHint;
257  xParseSEIPostFilterHint((SEIPostFilterHint&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
258  }
259  break;
261  sei = new SEIToneMappingInfo;
262  xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
263  break;
264  case SEI::FRAME_PACKING:
265  sei = new SEIFramePacking;
266  xParseSEIFramePacking((SEIFramePacking&) *sei, payloadSize, pDecodedMessageOutputStream);
267  break;
269  sei = new SEIDisplayOrientation;
270  xParseSEIDisplayOrientation((SEIDisplayOrientation&) *sei, payloadSize, pDecodedMessageOutputStream);
271  break;
272  case SEI::GREEN_METADATA:
273  sei = new SEIGreenMetadataInfo;
274  xParseSEIGreenMetadataInfo((SEIGreenMetadataInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
275  break;
277  sei = new SEISOPDescription;
278  xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize, pDecodedMessageOutputStream);
279  break;
281  sei = new SEIActiveParameterSets;
282  xParseSEIActiveParameterSets((SEIActiveParameterSets&) *sei, payloadSize, pDecodedMessageOutputStream);
283  break;
285  if (!sps)
286  {
287  printf ("Warning: Found Decoding unit SEI message, but no active SPS is available. Ignoring.");
288  }
289  else
290  {
291  sei = new SEIDecodingUnitInfo;
292  xParseSEIDecodingUnitInfo((SEIDecodingUnitInfo&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
293  }
294  break;
296  sei = new SEITemporalLevel0Index;
297  xParseSEITemporalLevel0Index((SEITemporalLevel0Index&) *sei, payloadSize, pDecodedMessageOutputStream);
298  break;
300  sei = new SEIScalableNesting;
301  xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps, pDecodedMessageOutputStream);
302  break;
304  sei = new SEIRegionRefreshInfo;
305  xParseSEIRegionRefreshInfo((SEIRegionRefreshInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
306  break;
307  case SEI::NO_DISPLAY:
308  sei = new SEINoDisplay;
309  xParseSEINoDisplay((SEINoDisplay&) *sei, payloadSize, pDecodedMessageOutputStream);
310  break;
311  case SEI::TIME_CODE:
312  sei = new SEITimeCode;
313  xParseSEITimeCode((SEITimeCode&) *sei, payloadSize, pDecodedMessageOutputStream);
314  break;
317  xParseSEIMasteringDisplayColourVolume((SEIMasteringDisplayColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
318  break;
321  xParseSEISegmentedRectFramePacking((SEISegmentedRectFramePacking&) *sei, payloadSize, pDecodedMessageOutputStream);
322  break;
325  xParseSEITempMotionConstraintsTileSets((SEITempMotionConstrainedTileSets&) *sei, payloadSize, pDecodedMessageOutputStream);
326  break;
329  xParseSEIChromaResamplingFilterHint((SEIChromaResamplingFilterHint&) *sei, payloadSize, pDecodedMessageOutputStream);
330  break;
332  sei = new SEIKneeFunctionInfo;
333  xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
334  break;
336  sei = new SEIColourRemappingInfo;
337  xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
338  break;
341  xParseSEIDeinterlaceFieldIdentification((SEIDeinterlaceFieldIdentification&) *sei, payloadSize, pDecodedMessageOutputStream);
342  break;
344  sei = new SEIContentLightLevelInfo;
345  xParseSEIContentLightLevelInfo((SEIContentLightLevelInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
346  break;
348  sei = new SEIDependentRAPIndication;
349  xParseSEIDependentRAPIndication((SEIDependentRAPIndication&) *sei, payloadSize, pDecodedMessageOutputStream);
350  break;
352  sei = new SEICodedRegionCompletion;
353  xParseSEICodedRegionCompletion((SEICodedRegionCompletion&) *sei, payloadSize, pDecodedMessageOutputStream);
354  break;
357  xParseSEIAlternativeTransferCharacteristics((SEIAlternativeTransferCharacteristics&) *sei, payloadSize, pDecodedMessageOutputStream);
358  break;
361  xParseSEIAmbientViewingEnvironment((SEIAmbientViewingEnvironment&) *sei, payloadSize, pDecodedMessageOutputStream);
362  break;
363 #if CCV_SEI_MESSAGE
365  sei = new SEIContentColourVolume;
366  xParseSEIContentColourVolume((SEIContentColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
367  break;
368 #endif
369 #if ERP_SR_OV_SEI_MESSAGE
372  xParseSEIEquirectangularProjection((SEIEquirectangularProjection&) *sei, payloadSize, pDecodedMessageOutputStream);
373  break;
375  sei = new SEISphereRotation;
376  xParseSEISphereRotation((SEISphereRotation&) *sei, payloadSize, pDecodedMessageOutputStream);
377  break;
378  case SEI::OMNI_VIEWPORT:
379  sei = new SEIOmniViewport;
380  xParseSEIOmniViewport((SEIOmniViewport&) *sei, payloadSize, pDecodedMessageOutputStream);
381  break;
382 #endif
383 #if CMP_SEI_MESSAGE
385  sei = new SEICubemapProjection;
386  xParseSEICubemapProjection((SEICubemapProjection&)*sei, payloadSize, pDecodedMessageOutputStream);
387  break;
388 #endif
389 #if RWP_SEI_MESSAGE
391  sei = new SEIRegionWisePacking;
392  xParseSEIRegionWisePacking((SEIRegionWisePacking&) *sei, payloadSize, pDecodedMessageOutputStream);
393  break;
394 #endif
395 #if RNSEI
397  sei = new SEIRegionalNesting;
398  xParseSEIRegionalNesting((SEIRegionalNesting&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
399  break;
400 #endif
401  default:
402  for (UInt i = 0; i < payloadSize; i++)
403  {
404  UInt seiByte;
405  sei_read_code (NULL, 8, seiByte, "unknown prefix SEI payload byte");
406  }
407  printf ("Unknown prefix SEI message (payloadType = %d) was found!\n", payloadType);
408  if (pDecodedMessageOutputStream)
409  {
410  (*pDecodedMessageOutputStream) << "Unknown prefix SEI message (payloadType = " << payloadType << ") was found!\n";
411  }
412  break;
413  }
414  }
415  else
416  {
417  switch (payloadType)
418  {
419  case SEI::FILLER_PAYLOAD:
420  sei = new SEIFillerPayload;
421  xParseSEIFillerPayload((SEIFillerPayload&) *sei, payloadSize, pDecodedMessageOutputStream);
422  break;
424  sei = new SEIUserDataRegistered;
425  xParseSEIUserDataRegistered((SEIUserDataRegistered&) *sei, payloadSize, pDecodedMessageOutputStream);
426  break;
428  sei = new SEIUserDataUnregistered;
429  xParseSEIUserDataUnregistered((SEIUserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream);
430  break;
433  xParseSEIProgressiveRefinementSegmentEnd((SEIProgressiveRefinementSegmentEnd&) *sei, payloadSize, pDecodedMessageOutputStream);
434  break;
436  if (!sps)
437  {
438  printf ("Warning: post filter hint SEI message, but no active SPS is available. Ignoring.");
439  }
440  else
441  {
442  sei = new SEIPostFilterHint;
443  xParseSEIPostFilterHint((SEIPostFilterHint&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
444  }
445  break;
447  sei = new SEIDecodedPictureHash;
448  xParseSEIDecodedPictureHash((SEIDecodedPictureHash&) *sei, payloadSize, pDecodedMessageOutputStream);
449  break;
451  sei = new SEICodedRegionCompletion;
452  xParseSEICodedRegionCompletion((SEICodedRegionCompletion&) *sei, payloadSize, pDecodedMessageOutputStream);
453  break;
454  default:
455  for (UInt i = 0; i < payloadSize; i++)
456  {
457  UInt seiByte;
458  sei_read_code( NULL, 8, seiByte, "unknown suffix SEI payload byte");
459  }
460  printf ("Unknown suffix SEI message (payloadType = %d) was found!\n", payloadType);
461  if (pDecodedMessageOutputStream)
462  {
463  (*pDecodedMessageOutputStream) << "Unknown suffix SEI message (payloadType = " << payloadType << ") was found!\n";
464  }
465  break;
466  }
467  }
468 
469  if (sei != NULL)
470  {
471  seis.push_back(sei);
472  }
473 
474  /* By definition the underlying bitstream terminates in a byte-aligned manner.
475  * 1. Extract all bar the last MIN(bitsremaining,nine) bits as reserved_payload_extension_data
476  * 2. Examine the final 8 bits to determine the payload_bit_equal_to_one marker
477  * 3. Extract the remainingreserved_payload_extension_data bits.
478  *
479  * If there are fewer than 9 bits available, extract them.
480  */
481  Int payloadBitsRemaining = getBitstream()->getNumBitsLeft();
482  if (payloadBitsRemaining) /* more_data_in_payload() */
483  {
484  for (; payloadBitsRemaining > 9; payloadBitsRemaining--)
485  {
486  UInt reservedPayloadExtensionData;
487  sei_read_code ( pDecodedMessageOutputStream, 1, reservedPayloadExtensionData, "reserved_payload_extension_data");
488  }
489 
490  /* 2 */
491  Int finalBits = getBitstream()->peekBits(payloadBitsRemaining);
492  Int finalPayloadBits = 0;
493  for (Int mask = 0xff; finalBits & (mask >> finalPayloadBits); finalPayloadBits++)
494  {
495  continue;
496  }
497 
498  /* 3 */
499  for (; payloadBitsRemaining > 9 - finalPayloadBits; payloadBitsRemaining--)
500  {
501  UInt reservedPayloadExtensionData;
502  sei_read_flag ( 0, reservedPayloadExtensionData, "reserved_payload_extension_data");
503  }
504 
505  UInt dummy;
506  sei_read_flag( 0, dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--;
507  while (payloadBitsRemaining)
508  {
509  sei_read_flag( 0, dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--;
510  }
511  }
512 
513  /* restore primary bitstream for sei_message */
514  delete getBitstream();
515  setBitstream(bs);
516 }
517 
518 #if RNSEI
519 Void SEIReader::xReadSEImessageHdrPayload(SEI* &sei, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
520 {
521 #if ENC_DEC_TRACE
522  xTraceSEIHeader();
523 #endif
524  Int payloadType = 0;
525  UInt val = 0;
526 
527  do
528  {
529  sei_read_code(NULL, 8, val, "payload_type");
530  payloadType += val;
531  } while (val==0xFF);
532 
533  UInt payloadSize = 0;
534  do
535  {
536  sei_read_code(NULL, 8, val, "payload_size");
537  payloadSize += val;
538  } while (val==0xFF);
539 
540 #if ENC_DEC_TRACE
541  xTraceSEIMessageType((SEI::PayloadType)payloadType);
542 #endif
543 
544  /* extract the payload for this single SEI message.
545  * This allows greater safety in erroneous parsing of an SEI message
546  * from affecting subsequent messages.
547  * After parsing the payload, bs needs to be restored as the primary
548  * bitstream.
549  */
551  setBitstream(bs->extractSubstream(payloadSize * 8));
552 
553 
554  {
555  switch (payloadType)
556  {
558  sei = new SEIUserDataRegistered;
559  xParseSEIUserDataRegistered((SEIUserDataRegistered&) *sei, payloadSize, pDecodedMessageOutputStream);
560  break;
562  sei = new SEIUserDataUnregistered;
563  xParseSEIUserDataUnregistered((SEIUserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream);
564  break;
566  sei = new SEIFilmGrainCharacteristics;
567  xParseSEIFilmGrainCharacteristics((SEIFilmGrainCharacteristics&) *sei, payloadSize, pDecodedMessageOutputStream);
568  break;
570  if (!sps)
571  {
572  printf ("Warning: post filter hint SEI message, but no active SPS is available. Ignoring.");
573  }
574  else
575  {
576  sei = new SEIPostFilterHint;
577  xParseSEIPostFilterHint((SEIPostFilterHint&) *sei, payloadSize, sps, pDecodedMessageOutputStream);
578  }
579  break;
581  sei = new SEIToneMappingInfo;
582  xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
583  break;
586  xParseSEIChromaResamplingFilterHint((SEIChromaResamplingFilterHint&) *sei, payloadSize, pDecodedMessageOutputStream);
587  break;
589  sei = new SEIKneeFunctionInfo;
590  xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
591  break;
593  sei = new SEIColourRemappingInfo;
594  xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
595  break;
597  sei = new SEIContentColourVolume;
598  xParseSEIContentColourVolume((SEIContentColourVolume&) *sei, payloadSize, pDecodedMessageOutputStream);
599  break;
600  default:
601  for (UInt i = 0; i < payloadSize; i++)
602  {
603  UInt seiByte;
604  sei_read_code (NULL, 8, seiByte, "unknown prefix SEI payload byte");
605  }
606  printf ("Unknown prefix SEI message (payloadType = %d) was found!\n", payloadType);
607  if (pDecodedMessageOutputStream)
608  {
609  (*pDecodedMessageOutputStream) << "Unknown prefix SEI message (payloadType = " << payloadType << ") was found!\n";
610  }
611  break;
612  }
613  }
614 
615 
616  /* By definition the underlying bitstream terminates in a byte-aligned manner.
617  * 1. Extract all bar the last MIN(bitsremaining,nine) bits as reserved_payload_extension_data
618  * 2. Examine the final 8 bits to determine the payload_bit_equal_to_one marker
619  * 3. Extract the remainingreserved_payload_extension_data bits.
620  *
621  * If there are fewer than 9 bits available, extract them.
622  */
623  Int payloadBitsRemaining = getBitstream()->getNumBitsLeft();
624  if (payloadBitsRemaining) /* more_data_in_payload() */
625  {
626  for (; payloadBitsRemaining > 9; payloadBitsRemaining--)
627  {
628  UInt reservedPayloadExtensionData;
629  sei_read_code ( pDecodedMessageOutputStream, 1, reservedPayloadExtensionData, "reserved_payload_extension_data");
630  }
631 
632  /* 2 */
633  Int finalBits = getBitstream()->peekBits(payloadBitsRemaining);
634  Int finalPayloadBits = 0;
635  for (Int mask = 0xff; finalBits & (mask >> finalPayloadBits); finalPayloadBits++)
636  {
637  continue;
638  }
639 
640  /* 3 */
641  for (; payloadBitsRemaining > 9 - finalPayloadBits; payloadBitsRemaining--)
642  {
643  UInt reservedPayloadExtensionData;
644  sei_read_flag ( 0, reservedPayloadExtensionData, "reserved_payload_extension_data");
645  }
646 
647  UInt dummy;
648  sei_read_flag( 0, dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--;
649  while (payloadBitsRemaining)
650  {
651  sei_read_flag( 0, dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--;
652  }
653  }
654 
655  /* restore primary bitstream for sei_message */
656  delete getBitstream();
657  setBitstream(bs);
658 }
659 #endif
660 
661 
662 Void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
663 {
664  Int i, nalOrVcl;
665  UInt code;
666 
667  const TComVUI *pVUI = sps->getVuiParameters();
668  const TComHRD *pHRD = pVUI->getHrdParameters();
669 
670  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
671 
672  sei_read_uvlc( pDecodedMessageOutputStream, code, "bp_seq_parameter_set_id" ); sei.m_bpSeqParameterSetId = code;
673  if( !pHRD->getSubPicCpbParamsPresentFlag() )
674  {
675  sei_read_flag( pDecodedMessageOutputStream, code, "irap_cpb_params_present_flag" ); sei.m_rapCpbParamsPresentFlag = code;
676  }
677  if( sei.m_rapCpbParamsPresentFlag )
678  {
679  sei_read_code( pDecodedMessageOutputStream, pHRD->getCpbRemovalDelayLengthMinus1() + 1, code, "cpb_delay_offset" ); sei.m_cpbDelayOffset = code;
680  sei_read_code( pDecodedMessageOutputStream, pHRD->getDpbOutputDelayLengthMinus1() + 1, code, "dpb_delay_offset" ); sei.m_dpbDelayOffset = code;
681  }
682 
683  //read splicing flag and cpb_removal_delay_delta
684  sei_read_flag( pDecodedMessageOutputStream, code, "concatenation_flag");
685  sei.m_concatenationFlag = code;
686  sei_read_code( pDecodedMessageOutputStream, ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" );
687  sei.m_auCpbRemovalDelayDelta = code + 1;
688 
689  for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
690  {
691  if( ( ( nalOrVcl == 0 ) && ( pHRD->getNalHrdParametersPresentFlag() ) ) ||
692  ( ( nalOrVcl == 1 ) && ( pHRD->getVclHrdParametersPresentFlag() ) ) )
693  {
694  for( i = 0; i < ( pHRD->getCpbCntMinus1( 0 ) + 1 ); i ++ )
695  {
696  sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_cpb_removal_delay":"nal_initial_cpb_removal_delay" );
697  sei.m_initialCpbRemovalDelay[i][nalOrVcl] = code;
698  sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_cpb_removal_offset":"nal_initial_cpb_removal_offset" );
699  sei.m_initialCpbRemovalDelayOffset[i][nalOrVcl] = code;
701  {
702  sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_alt_cpb_removal_delay":"nal_initial_alt_cpb_removal_delay" );
703  sei.m_initialAltCpbRemovalDelay[i][nalOrVcl] = code;
704  sei_read_code( pDecodedMessageOutputStream, ( pHRD->getInitialCpbRemovalDelayLengthMinus1() + 1 ) , code, nalOrVcl?"vcl_initial_alt_cpb_removal_offset":"nal_initial_alt_cpb_removal_offset" );
705  sei.m_initialAltCpbRemovalDelayOffset[i][nalOrVcl] = code;
706  }
707  }
708  }
709  }
710 }
711 
712 
713 Void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
714 {
715  Int i;
716  UInt code;
717 
718  const TComVUI *vui = sps->getVuiParameters();
719  const TComHRD *hrd = vui->getHrdParameters();
720  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
721 
722  if( vui->getFrameFieldInfoPresentFlag() )
723  {
724  sei_read_code( pDecodedMessageOutputStream, 4, code, "pic_struct" ); sei.m_picStruct = code;
725  sei_read_code( pDecodedMessageOutputStream, 2, code, "source_scan_type" ); sei.m_sourceScanType = code;
726  sei_read_flag( pDecodedMessageOutputStream, code, "duplicate_flag" ); sei.m_duplicateFlag = (code == 1);
727  }
728 
729  if( hrd->getCpbDpbDelaysPresentFlag())
730  {
731  sei_read_code( pDecodedMessageOutputStream, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" );
732  sei.m_auCpbRemovalDelay = code + 1;
733  sei_read_code( pDecodedMessageOutputStream, ( hrd->getDpbOutputDelayLengthMinus1() + 1 ), code, "pic_dpb_output_delay" );
734  sei.m_picDpbOutputDelay = code;
735 
737  {
738  sei_read_code( pDecodedMessageOutputStream, hrd->getDpbOutputDelayDuLengthMinus1()+1, code, "pic_dpb_output_du_delay" );
739  sei.m_picDpbOutputDuDelay = code;
740  }
741 
743  {
744  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_decoding_units_minus1");
745  sei.m_numDecodingUnitsMinus1 = code;
746  sei_read_flag( pDecodedMessageOutputStream, code, "du_common_cpb_removal_delay_flag" );
749  {
750  sei_read_code( pDecodedMessageOutputStream, ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_common_cpb_removal_delay_increment_minus1" );
752  }
753  sei.m_numNalusInDuMinus1.resize(sei.m_numDecodingUnitsMinus1 + 1 );
755 
756  for( i = 0; i <= sei.m_numDecodingUnitsMinus1; i ++ )
757  {
758  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_nalus_in_du_minus1[i]");
759  sei.m_numNalusInDuMinus1[ i ] = code;
760  if( ( !sei.m_duCommonCpbRemovalDelayFlag ) && ( i < sei.m_numDecodingUnitsMinus1 ) )
761  {
762  sei_read_code( pDecodedMessageOutputStream, ( hrd->getDuCpbRemovalDelayLengthMinus1() + 1 ), code, "du_cpb_removal_delay_minus1[i]" );
763  sei.m_duCpbRemovalDelayMinus1[ i ] = code;
764  }
765  }
766  }
767  }
768 }
769 
770 
771 Void SEIReader::xParseSEIPanScanRect(SEIPanScanRect& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
772 {
773  UInt code;
774  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
775  sei_read_uvlc( pDecodedMessageOutputStream, code, "pan_scan_rect_id" ); sei.m_panScanRectId = code;
776  sei_read_flag( pDecodedMessageOutputStream, code, "pan_scan_rect_cancel_flag" ); sei.m_panScanRectCancelFlag = code!=0;
777  if (!sei.m_panScanRectCancelFlag)
778  {
779  UInt numRegions;
780  sei_read_uvlc( pDecodedMessageOutputStream, numRegions, "pan_scan_cnt_minus1" ); numRegions++;
781  sei.m_panScanRectRegions.resize(numRegions);
782  for(UInt region=0; region<numRegions; region++)
783  {
785  Int i;
786  sei_read_svlc( pDecodedMessageOutputStream, i, "pan_scan_rect_left_offset[i]" ); rect.leftOffset = i;
787  sei_read_svlc( pDecodedMessageOutputStream, i, "pan_scan_rect_right_offset[i]" ); rect.rightOffset = i;
788  sei_read_svlc( pDecodedMessageOutputStream, i, "pan_scan_rect_top_offset[i]" ); rect.topOffset = i;
789  sei_read_svlc( pDecodedMessageOutputStream, i, "pan_scan_rect_bottom_offset[i]" ); rect.bottomOffset = i;
790  }
791  sei_read_flag( pDecodedMessageOutputStream, code, "pan_scan_rect_persistence_flag" ); sei.m_panScanRectPersistenceFlag = code!=0;
792  }
793  else
794  {
795  sei.m_panScanRectRegions.clear();
797  }
798 }
799 
800 
801 Void SEIReader::xParseSEIFillerPayload(SEIFillerPayload& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
802 {
803  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
804  sei.m_numFillerFFBytes = payloadSize;
805  Bool allBytesWereFF=true;
806  for(UInt k=0; k<payloadSize; k++)
807  {
808  UInt code;
809  sei_read_code( NULL, 8, code, "ff_byte" );
810  if (code!=0xff) allBytesWereFF=false;
811  }
812  if (pDecodedMessageOutputStream && !allBytesWereFF)
813  {
814  (*pDecodedMessageOutputStream) << " not all filler payload bytes were 0xff\n";
815  }
816 }
817 
818 
819 Void SEIReader::xParseSEIUserDataRegistered(SEIUserDataRegistered& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
820 {
821  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
822 
823  UInt code;
824  assert(payloadSize>0);
825  sei_read_code( pDecodedMessageOutputStream, 8, code, "itu_t_t35_country_code" ); payloadSize--;
826  if (code == 255)
827  {
828  assert(payloadSize>0);
829  sei_read_code( pDecodedMessageOutputStream, 8, code, "itu_t_t35_country_code_extension_byte" ); payloadSize--;
830  code+=255;
831  }
832  sei.m_ituCountryCode = code;
833  sei.m_userData.resize(payloadSize);
834  for (UInt i = 0; i < sei.m_userData.size(); i++)
835  {
836  sei_read_code( NULL, 8, code, "itu_t_t35_payload_byte" );
837  sei.m_userData[i] = code;
838  }
839  if (pDecodedMessageOutputStream)
840  {
841  (*pDecodedMessageOutputStream) << " itu_t_t35 payload size: " << sei.m_userData.size() << "\n";
842  }
843 }
844 
845 
846 Void SEIReader::xParseSEIUserDataUnregistered(SEIUserDataUnregistered &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
847 {
848  assert(payloadSize >= ISO_IEC_11578_LEN);
849  UInt val;
850  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
851 
852  for (UInt i = 0; i < ISO_IEC_11578_LEN; i++)
853  {
854  sei_read_code( pDecodedMessageOutputStream, 8, val, "uuid_iso_iec_11578");
855  sei.m_uuid_iso_iec_11578[i] = val;
856  }
857 
858  sei.m_userData.resize(payloadSize - ISO_IEC_11578_LEN);
859  for (UInt i = 0; i < sei.m_userData.size(); i++)
860  {
861  sei_read_code( NULL, 8, val, "user_data_payload_byte" );
862  sei.m_userData[i] = val;
863  }
864  if (pDecodedMessageOutputStream)
865  {
866  (*pDecodedMessageOutputStream) << " User data payload size: " << sei.m_userData.size() << "\n";
867  }
868 }
869 
870 
871 Void SEIReader::xParseSEIRecoveryPoint(SEIRecoveryPoint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
872 {
873  Int iCode;
874  UInt uiCode;
875  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
876 
877  sei_read_svlc( pDecodedMessageOutputStream, iCode, "recovery_poc_cnt" ); sei.m_recoveryPocCnt = iCode;
878  sei_read_flag( pDecodedMessageOutputStream, uiCode, "exact_matching_flag" ); sei.m_exactMatchingFlag = uiCode;
879  sei_read_flag( pDecodedMessageOutputStream, uiCode, "broken_link_flag" ); sei.m_brokenLinkFlag = uiCode;
880 }
881 
882 
883 Void SEIReader::xParseSEISceneInfo(SEISceneInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
884 {
885  UInt code;
886  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
887 
888  sei_read_flag( pDecodedMessageOutputStream, code, "scene_info_present_flag" ); sei.m_bSceneInfoPresentFlag = code!=0;
889  if (sei.m_bSceneInfoPresentFlag)
890  {
891  sei_read_flag( pDecodedMessageOutputStream, code, "prev_scene_id_valid_flag" ); sei.m_bPrevSceneIdValidFlag = code!=0;
892  sei_read_uvlc( pDecodedMessageOutputStream, code, "scene_id" ); sei.m_sceneId = code;
893  sei_read_uvlc( pDecodedMessageOutputStream, code, "scene_transition_type" ); sei.m_sceneTransitionType = code;
894  if (sei.m_sceneTransitionType > 3)
895  {
896  sei_read_uvlc( pDecodedMessageOutputStream, code, "second_scene_id" ); sei.m_secondSceneId = code;
897  }
898  else
899  {
900  sei.m_secondSceneId = 0; // set to known value.
901  }
902  }
903 }
904 
905 
906 Void SEIReader::xParseSEIPictureSnapshot(SEIPictureSnapshot& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
907 {
908  UInt code;
909  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
910 
911  sei_read_uvlc( pDecodedMessageOutputStream, code, "snapshot_id" ); sei.m_snapshotId = code;
912 }
913 
914 
916 {
917  UInt code;
918  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
919 
920  sei_read_uvlc( pDecodedMessageOutputStream, code, "progressive_refinement_id" ); sei.m_progressiveRefinementId = code;
921  sei_read_uvlc( pDecodedMessageOutputStream, code, "pic_order_cnt_delta" ); sei.m_picOrderCntDelta = code;
922 }
923 
924 
925 Void SEIReader::xParseSEIProgressiveRefinementSegmentEnd(SEIProgressiveRefinementSegmentEnd& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
926 {
927  UInt code;
928  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
929 
930  sei_read_uvlc( pDecodedMessageOutputStream, code, "progressive_refinement_id" ); sei.m_progressiveRefinementId = code;
931 }
932 
933 
934 Void SEIReader::xParseSEIFilmGrainCharacteristics(SEIFilmGrainCharacteristics& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
935 {
936  UInt code;
937  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
938 
939  sei_read_flag( pDecodedMessageOutputStream, code, "film_grain_characteristics_cancel_flag" ); sei.m_filmGrainCharacteristicsCancelFlag = code!=0;
941  {
942  sei_read_code( pDecodedMessageOutputStream, 2, code, "film_grain_model_id" ); sei.m_filmGrainModelId = code;
943  sei_read_flag( pDecodedMessageOutputStream, code, "separate_colour_description_present_flag" ); sei.m_separateColourDescriptionPresentFlag = code!=0;
945  {
946  sei_read_code( pDecodedMessageOutputStream, 3, code, "film_grain_bit_depth_luma_minus8" ); sei.m_filmGrainBitDepthLumaMinus8 = code;
947  sei_read_code( pDecodedMessageOutputStream, 3, code, "film_grain_bit_depth_chroma_minus8" ); sei.m_filmGrainBitDepthChromaMinus8 = code;
948  sei_read_flag( pDecodedMessageOutputStream, code, "film_grain_full_range_flag" ); sei.m_filmGrainFullRangeFlag = code!=0;
949  sei_read_code( pDecodedMessageOutputStream, 8, code, "film_grain_colour_primaries" ); sei.m_filmGrainColourPrimaries = code;
950  sei_read_code( pDecodedMessageOutputStream, 8, code, "film_grain_transfer_characteristics" ); sei.m_filmGrainTransferCharacteristics = code;
951  sei_read_code( pDecodedMessageOutputStream, 8, code, "film_grain_matrix_coeffs" ); sei.m_filmGrainMatrixCoeffs = code;
952  }
953  sei_read_code( pDecodedMessageOutputStream, 2, code, "blending_mode_id" ); sei.m_blendingModeId = code;
954  sei_read_code( pDecodedMessageOutputStream, 4, code, "log2_scale_factor" ); sei.m_log2ScaleFactor = code;
955  for(Int c=0; c<3; c++)
956  {
957  sei_read_flag( pDecodedMessageOutputStream, code, "comp_model_present_flag[c]" ); sei.m_compModel[c].bPresentFlag = code!=0;
958  }
959  for(Int c=0; c<3; c++)
960  {
962  if (cm.bPresentFlag)
963  {
964  UInt numIntensityIntervals;
965  sei_read_code( pDecodedMessageOutputStream, 8, code, "num_intensity_intervals_minus1[c]" ); numIntensityIntervals = code+1;
966  sei_read_code( pDecodedMessageOutputStream, 3, code, "num_model_values_minus1[c]" ); cm.numModelValues = code+1;
967  cm.intensityValues.resize(numIntensityIntervals);
968  for(UInt interval=0; interval<numIntensityIntervals; interval++)
969  {
971  sei_read_code( pDecodedMessageOutputStream, 8, code, "intensity_interval_lower_bound[c][i]" ); cmiv.intensityIntervalLowerBound=code;
972  sei_read_code( pDecodedMessageOutputStream, 8, code, "intensity_interval_upper_bound[c][i]" ); cmiv.intensityIntervalUpperBound=code;
973  cmiv.compModelValue.resize(cm.numModelValues);
974  for(UInt j=0; j<cm.numModelValues; j++)
975  {
976  sei_read_svlc( pDecodedMessageOutputStream, cmiv.compModelValue[j], "comp_model_value[c][i]" );
977  }
978  }
979  }
980  } // for c
981  sei_read_flag( pDecodedMessageOutputStream, code, "film_grain_characteristics_persistence_flag" ); sei.m_filmGrainCharacteristicsPersistenceFlag = code!=0;
982  } // cancel flag
983 }
984 
985 
986 Void SEIReader::xParseSEIPostFilterHint(SEIPostFilterHint& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
987 {
988  UInt code;
989  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
990 
991  sei_read_uvlc( pDecodedMessageOutputStream, code, "filter_hint_size_y" ); sei.m_filterHintSizeY = code;
992  sei_read_uvlc( pDecodedMessageOutputStream, code, "filter_hint_size_x" ); sei.m_filterHintSizeX = code;
993  sei_read_code( pDecodedMessageOutputStream, 2, code, "filter_hint_type" ); sei.m_filterHintType = code;
994 
996  const UInt numChromaChannels = sei.m_bIsMonochrome ? 1:3;
997 
998  sei.m_filterHintValues.resize(numChromaChannels * sei.m_filterHintSizeX * sei.m_filterHintSizeY);
999  for(std::size_t i=0; i<sei.m_filterHintValues.size(); i++)
1000  {
1001  Int v;
1002  sei_read_svlc( pDecodedMessageOutputStream, v, "filter_hint_value[][][]" ); sei.m_filterHintValues[i] = code;
1003  }
1004 }
1005 
1006 
1007 Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1008 {
1009  Int i;
1010  UInt val;
1011  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1012  sei_read_uvlc( pDecodedMessageOutputStream, val, "tone_map_id" ); sei.m_toneMapId = val;
1013  sei_read_flag( pDecodedMessageOutputStream, val, "tone_map_cancel_flag" ); sei.m_toneMapCancelFlag = val;
1014 
1015  if ( !sei.m_toneMapCancelFlag )
1016  {
1017  sei_read_flag( pDecodedMessageOutputStream, val, "tone_map_persistence_flag" ); sei.m_toneMapPersistenceFlag = val;
1018  sei_read_code( pDecodedMessageOutputStream, 8, val, "coded_data_bit_depth" ); sei.m_codedDataBitDepth = val;
1019  sei_read_code( pDecodedMessageOutputStream, 8, val, "target_bit_depth" ); sei.m_targetBitDepth = val;
1020  sei_read_uvlc( pDecodedMessageOutputStream, val, "tone_map_model_id" ); sei.m_modelId = val;
1021  switch(sei.m_modelId)
1022  {
1023  case 0:
1024  {
1025  sei_read_code( pDecodedMessageOutputStream, 32, val, "min_value" ); sei.m_minValue = val;
1026  sei_read_code( pDecodedMessageOutputStream, 32, val, "max_value" ); sei.m_maxValue = val;
1027  break;
1028  }
1029  case 1:
1030  {
1031  sei_read_code( pDecodedMessageOutputStream, 32, val, "sigmoid_midpoint" ); sei.m_sigmoidMidpoint = val;
1032  sei_read_code( pDecodedMessageOutputStream, 32, val, "sigmoid_width" ); sei.m_sigmoidWidth = val;
1033  break;
1034  }
1035  case 2:
1036  {
1037  UInt num = 1u << sei.m_targetBitDepth;
1038  sei.m_startOfCodedInterval.resize(num+1);
1039  for(i = 0; i < num; i++)
1040  {
1041  sei_read_code( pDecodedMessageOutputStream, ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval[i]" );
1042  sei.m_startOfCodedInterval[i] = val;
1043  }
1044  sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth;
1045  break;
1046  }
1047  case 3:
1048  {
1049  sei_read_code( pDecodedMessageOutputStream, 16, val, "num_pivots" ); sei.m_numPivots = val;
1050  sei.m_codedPivotValue.resize(sei.m_numPivots);
1051  sei.m_targetPivotValue.resize(sei.m_numPivots);
1052  for(i = 0; i < sei.m_numPivots; i++ )
1053  {
1054  sei_read_code( pDecodedMessageOutputStream, ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value[i]" );
1055  sei.m_codedPivotValue[i] = val;
1056  sei_read_code( pDecodedMessageOutputStream, ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3), val, "target_pivot_value[i]" );
1057  sei.m_targetPivotValue[i] = val;
1058  }
1059  break;
1060  }
1061  case 4:
1062  {
1063  sei_read_code( pDecodedMessageOutputStream, 8, val, "camera_iso_speed_idc" ); sei.m_cameraIsoSpeedIdc = val;
1064  if( sei.m_cameraIsoSpeedIdc == 255) //Extended_ISO
1065  {
1066  sei_read_code( pDecodedMessageOutputStream, 32, val, "camera_iso_speed_value" ); sei.m_cameraIsoSpeedValue = val;
1067  }
1068  sei_read_code( pDecodedMessageOutputStream, 8, val, "exposure_index_idc" ); sei.m_exposureIndexIdc = val;
1069  if( sei.m_exposureIndexIdc == 255) //Extended_ISO
1070  {
1071  sei_read_code( pDecodedMessageOutputStream, 32, val, "exposure_index_value" ); sei.m_exposureIndexValue = val;
1072  }
1073  sei_read_flag( pDecodedMessageOutputStream, val, "exposure_compensation_value_sign_flag" ); sei.m_exposureCompensationValueSignFlag = val;
1074  sei_read_code( pDecodedMessageOutputStream, 16, val, "exposure_compensation_value_numerator" ); sei.m_exposureCompensationValueNumerator = val;
1075  sei_read_code( pDecodedMessageOutputStream, 16, val, "exposure_compensation_value_denom_idc" ); sei.m_exposureCompensationValueDenomIdc = val;
1076  sei_read_code( pDecodedMessageOutputStream, 32, val, "ref_screen_luminance_white" ); sei.m_refScreenLuminanceWhite = val;
1077  sei_read_code( pDecodedMessageOutputStream, 32, val, "extended_range_white_level" ); sei.m_extendedRangeWhiteLevel = val;
1078  sei_read_code( pDecodedMessageOutputStream, 16, val, "nominal_black_level_code_value" ); sei.m_nominalBlackLevelLumaCodeValue = val;
1079  sei_read_code( pDecodedMessageOutputStream, 16, val, "nominal_white_level_code_value" ); sei.m_nominalWhiteLevelLumaCodeValue= val;
1080  sei_read_code( pDecodedMessageOutputStream, 16, val, "extended_white_level_code_value" ); sei.m_extendedWhiteLevelLumaCodeValue = val;
1081  break;
1082  }
1083  default:
1084  {
1085  assert(!"Undefined SEIToneMapModelId");
1086  break;
1087  }
1088  }//switch model id
1089  }// if(!sei.m_toneMapCancelFlag)
1090 }
1091 
1092 
1093 Void SEIReader::xParseSEIFramePacking(SEIFramePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1094 {
1095  UInt val;
1096  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1097 
1098  sei_read_uvlc( pDecodedMessageOutputStream, val, "frame_packing_arrangement_id" ); sei.m_arrangementId = val;
1099  sei_read_flag( pDecodedMessageOutputStream, val, "frame_packing_arrangement_cancel_flag" ); sei.m_arrangementCancelFlag = val;
1100 
1101  if ( !sei.m_arrangementCancelFlag )
1102  {
1103  sei_read_code( pDecodedMessageOutputStream, 7, val, "frame_packing_arrangement_type" ); sei.m_arrangementType = val;
1104  assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) );
1105 
1106  sei_read_flag( pDecodedMessageOutputStream, val, "quincunx_sampling_flag" ); sei.m_quincunxSamplingFlag = val;
1107 
1108  sei_read_code( pDecodedMessageOutputStream, 6, val, "content_interpretation_type" ); sei.m_contentInterpretationType = val;
1109  sei_read_flag( pDecodedMessageOutputStream, val, "spatial_flipping_flag" ); sei.m_spatialFlippingFlag = val;
1110  sei_read_flag( pDecodedMessageOutputStream, val, "frame0_flipped_flag" ); sei.m_frame0FlippedFlag = val;
1111  sei_read_flag( pDecodedMessageOutputStream, val, "field_views_flag" ); sei.m_fieldViewsFlag = val;
1112  sei_read_flag( pDecodedMessageOutputStream, val, "current_frame_is_frame0_flag" ); sei.m_currentFrameIsFrame0Flag = val;
1113  sei_read_flag( pDecodedMessageOutputStream, val, "frame0_self_contained_flag" ); sei.m_frame0SelfContainedFlag = val;
1114  sei_read_flag( pDecodedMessageOutputStream, val, "frame1_self_contained_flag" ); sei.m_frame1SelfContainedFlag = val;
1115 
1116  if ( sei.m_quincunxSamplingFlag == 0 && sei.m_arrangementType != 5)
1117  {
1118  sei_read_code( pDecodedMessageOutputStream, 4, val, "frame0_grid_position_x" ); sei.m_frame0GridPositionX = val;
1119  sei_read_code( pDecodedMessageOutputStream, 4, val, "frame0_grid_position_y" ); sei.m_frame0GridPositionY = val;
1120  sei_read_code( pDecodedMessageOutputStream, 4, val, "frame1_grid_position_x" ); sei.m_frame1GridPositionX = val;
1121  sei_read_code( pDecodedMessageOutputStream, 4, val, "frame1_grid_position_y" ); sei.m_frame1GridPositionY = val;
1122  }
1123 
1124  sei_read_code( pDecodedMessageOutputStream, 8, val, "frame_packing_arrangement_reserved_byte" ); sei.m_arrangementReservedByte = val;
1125  sei_read_flag( pDecodedMessageOutputStream, val, "frame_packing_arrangement_persistence_flag" ); sei.m_arrangementPersistenceFlag = (val != 0);
1126  }
1127  sei_read_flag( pDecodedMessageOutputStream, val, "upsampled_aspect_ratio_flag" ); sei.m_upsampledAspectRatio = val;
1128 }
1129 
1130 
1131 Void SEIReader::xParseSEIDisplayOrientation(SEIDisplayOrientation& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1132 {
1133  UInt val;
1134  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1135  sei_read_flag( pDecodedMessageOutputStream, val, "display_orientation_cancel_flag" ); sei.cancelFlag = val;
1136  if( !sei.cancelFlag )
1137  {
1138  sei_read_flag( pDecodedMessageOutputStream, val, "hor_flip" ); sei.horFlip = val;
1139  sei_read_flag( pDecodedMessageOutputStream, val, "ver_flip" ); sei.verFlip = val;
1140  sei_read_code( pDecodedMessageOutputStream, 16, val, "anticlockwise_rotation" ); sei.anticlockwiseRotation = val;
1141  sei_read_flag( pDecodedMessageOutputStream, val, "display_orientation_persistence_flag" ); sei.persistenceFlag = val;
1142  }
1143 }
1144 
1145 
1146 Void SEIReader::xParseSEIGreenMetadataInfo(SEIGreenMetadataInfo& sei, UInt payloadSize, ostream* pDecodedMessageOutputStream)
1147 {
1148  UInt code;
1149  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1150 
1151  sei_read_code(pDecodedMessageOutputStream, 8, code, "green_metadata_type");
1152  sei.m_greenMetadataType = code;
1153 
1154  sei_read_code(pDecodedMessageOutputStream, 8, code, "xsd_metric_type");
1155  sei.m_xsdMetricType = code;
1156 
1157  sei_read_code(pDecodedMessageOutputStream, 16, code, "xsd_metric_value");
1158  sei.m_xsdMetricValue = code;
1159 }
1160 
1161 
1162 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1163 {
1164  Int iCode;
1165  UInt uiCode;
1166  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1167 
1168  sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "sop_seq_parameter_set_id" ); sei.m_sopSeqParameterSetId = uiCode;
1169  sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_pics_in_sop_minus1" ); sei.m_numPicsInSopMinus1 = uiCode;
1170  for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++)
1171  {
1172  sei_read_code( pDecodedMessageOutputStream, 6, uiCode, "sop_vcl_nut[i]" ); sei.m_sopDescVclNaluType[i] = uiCode;
1173  sei_read_code( pDecodedMessageOutputStream, 3, sei.m_sopDescTemporalId[i], "sop_temporal_id[i]" ); sei.m_sopDescTemporalId[i] = uiCode;
1175  {
1176  sei_read_uvlc( pDecodedMessageOutputStream, sei.m_sopDescStRpsIdx[i], "sop_short_term_rps_idx[i]" ); sei.m_sopDescStRpsIdx[i] = uiCode;
1177  }
1178  if (i > 0)
1179  {
1180  sei_read_svlc( pDecodedMessageOutputStream, iCode, "sop_poc_delta[i]" ); sei.m_sopDescPocDelta[i] = iCode;
1181  }
1182  }
1183 }
1184 
1185 
1186 Void SEIReader::xParseSEIActiveParameterSets(SEIActiveParameterSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1187 {
1188  UInt val;
1189  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1190 
1191  sei_read_code( pDecodedMessageOutputStream, 4, val, "active_video_parameter_set_id"); sei.activeVPSId = val;
1192  sei_read_flag( pDecodedMessageOutputStream, val, "self_contained_cvs_flag"); sei.m_selfContainedCvsFlag = (val != 0);
1193  sei_read_flag( pDecodedMessageOutputStream, val, "no_parameter_set_update_flag"); sei.m_noParameterSetUpdateFlag = (val != 0);
1194  sei_read_uvlc( pDecodedMessageOutputStream, val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val;
1195 
1196  sei.activeSeqParameterSetId.resize(sei.numSpsIdsMinus1 + 1);
1197  for (Int i=0; i < (sei.numSpsIdsMinus1 + 1); i++)
1198  {
1199  sei_read_uvlc( pDecodedMessageOutputStream, val, "active_seq_parameter_set_id[i]"); sei.activeSeqParameterSetId[i] = val;
1200  }
1201 }
1202 
1203 
1204 Void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
1205 {
1206  UInt val;
1207  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1208  sei_read_uvlc( pDecodedMessageOutputStream, val, "decoding_unit_idx");
1209  sei.m_decodingUnitIdx = val;
1210 
1211  const TComVUI *vui = sps->getVuiParameters();
1213  {
1214  sei_read_code( pDecodedMessageOutputStream, ( vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1 ), val, "du_spt_cpb_removal_delay_increment");
1215  sei.m_duSptCpbRemovalDelay = val;
1216  }
1217  else
1218  {
1219  sei.m_duSptCpbRemovalDelay = 0;
1220  }
1221  sei_read_flag( pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0);
1223  {
1224  sei_read_code( pDecodedMessageOutputStream, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, val, "pic_spt_dpb_output_du_delay");
1225  sei.m_picSptDpbOutputDuDelay = val;
1226  }
1227 }
1228 
1229 
1230 Void SEIReader::xParseSEITemporalLevel0Index(SEITemporalLevel0Index& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1231 {
1232  UInt val;
1233  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1234  sei_read_code( pDecodedMessageOutputStream, 8, val, "temporal_sub_layer_zero_idx" ); sei.tl0Idx = val;
1235  sei_read_code( pDecodedMessageOutputStream, 8, val, "irap_pic_id" ); sei.rapIdx = val;
1236 }
1237 
1238 
1239 Void SEIReader::xParseSEIDecodedPictureHash(SEIDecodedPictureHash& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1240 {
1241  UInt bytesRead = 0;
1242  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1243 
1244  UInt val;
1245  sei_read_code( pDecodedMessageOutputStream, 8, val, "hash_type");
1246  sei.method = static_cast<HashType>(val); bytesRead++;
1247 
1248  const TChar *traceString="\0";
1249  switch (sei.method)
1250  {
1251  case HASHTYPE_MD5: traceString="picture_md5"; break;
1252  case HASHTYPE_CRC: traceString="picture_crc"; break;
1253  case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break;
1254  default: assert(false); break;
1255  }
1256 
1257  if (pDecodedMessageOutputStream)
1258  {
1259  (*pDecodedMessageOutputStream) << " " << std::setw(55) << traceString << ": " << std::hex << std::setfill('0');
1260  }
1261 
1262  sei.m_pictureHash.hash.clear();
1263  for(;bytesRead < payloadSize; bytesRead++)
1264  {
1265  sei_read_code( NULL, 8, val, traceString);
1266  sei.m_pictureHash.hash.push_back((UChar)val);
1267  if (pDecodedMessageOutputStream)
1268  {
1269  (*pDecodedMessageOutputStream) << std::setw(2) << val;
1270  }
1271  }
1272 
1273  if (pDecodedMessageOutputStream)
1274  {
1275  (*pDecodedMessageOutputStream) << std::dec << std::setfill(' ') << "\n";
1276  }
1277 }
1278 
1279 
1280 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
1281 {
1282  UInt uiCode;
1283  SEIMessages seis;
1284  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1285 
1286  sei_read_flag( pDecodedMessageOutputStream, uiCode, "bitstream_subset_flag" ); sei.m_bitStreamSubsetFlag = uiCode;
1287  sei_read_flag( pDecodedMessageOutputStream, uiCode, "nesting_op_flag" ); sei.m_nestingOpFlag = uiCode;
1288  if (sei.m_nestingOpFlag)
1289  {
1290  sei_read_flag( pDecodedMessageOutputStream, uiCode, "default_op_flag" ); sei.m_defaultOpFlag = uiCode;
1291  sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "nesting_num_ops_minus1" ); sei.m_nestingNumOpsMinus1 = uiCode;
1292  for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++)
1293  {
1294  sei_read_code( pDecodedMessageOutputStream, 3, uiCode, "nesting_max_temporal_id_plus1[i]" ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode;
1295  sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "nesting_op_idx[i]" ); sei.m_nestingOpIdx[i] = uiCode;
1296  }
1297  }
1298  else
1299  {
1300  sei_read_flag( pDecodedMessageOutputStream, uiCode, "all_layers_flag" ); sei.m_allLayersFlag = uiCode;
1301  if (!sei.m_allLayersFlag)
1302  {
1303  sei_read_code( pDecodedMessageOutputStream, 3, uiCode, "nesting_no_op_max_temporal_id_plus1" ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode;
1304  sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "nesting_num_layers_minus1" ); sei.m_nestingNumLayersMinus1 = uiCode;
1305  for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++)
1306  {
1307  sei_read_code( pDecodedMessageOutputStream, 6, uiCode, "nesting_layer_id[i]" ); sei.m_nestingLayerId[i] = uiCode;
1308  }
1309  }
1310  }
1311 
1312  // byte alignment
1313  while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
1314  {
1315  UInt code;
1316  sei_read_flag( pDecodedMessageOutputStream, code, "nesting_zero_bit" );
1317  }
1318 
1319  // read nested SEI messages
1320  do
1321  {
1322  xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, pDecodedMessageOutputStream);
1323  } while (m_pcBitstream->getNumBitsLeft() > 8);
1324 
1325  if (pDecodedMessageOutputStream)
1326  {
1327  (*pDecodedMessageOutputStream) << "End of scalable nesting SEI message\n";
1328  }
1329 }
1330 
1331 
1332 Void SEIReader::xParseSEIRegionRefreshInfo(SEIRegionRefreshInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1333 {
1334  UInt val;
1335  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1336  sei_read_flag( pDecodedMessageOutputStream, val, "refreshed_region_flag" ); sei.m_gdrForegroundFlag = val ? 1 : 0;
1337 }
1338 
1339 
1340 Void SEIReader::xParseSEINoDisplay(SEINoDisplay& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1341 {
1342  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1343  sei.m_noDisplay = true;
1344 }
1345 
1346 
1347 Void SEIReader::xParseSEITimeCode(SEITimeCode& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1348 {
1349  UInt code;
1350  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1351  sei_read_code( pDecodedMessageOutputStream, 2, code, "num_clock_ts"); sei.numClockTs = code;
1352  for(Int i = 0; i < sei.numClockTs; i++)
1353  {
1354  TComSEITimeSet currentTimeSet;
1355  sei_read_flag( pDecodedMessageOutputStream, code, "clock_time_stamp_flag[i]"); currentTimeSet.clockTimeStampFlag = code;
1356  if(currentTimeSet.clockTimeStampFlag)
1357  {
1358  sei_read_flag( pDecodedMessageOutputStream, code, "nuit_field_based_flag"); currentTimeSet.numUnitFieldBasedFlag = code;
1359  sei_read_code( pDecodedMessageOutputStream, 5, code, "counting_type"); currentTimeSet.countingType = code;
1360  sei_read_flag( pDecodedMessageOutputStream, code, "full_timestamp_flag"); currentTimeSet.fullTimeStampFlag = code;
1361  sei_read_flag( pDecodedMessageOutputStream, code, "discontinuity_flag"); currentTimeSet.discontinuityFlag = code;
1362  sei_read_flag( pDecodedMessageOutputStream, code, "cnt_dropped_flag"); currentTimeSet.cntDroppedFlag = code;
1363  sei_read_code( pDecodedMessageOutputStream, 9, code, "n_frames"); currentTimeSet.numberOfFrames = code;
1364  if(currentTimeSet.fullTimeStampFlag)
1365  {
1366  sei_read_code( pDecodedMessageOutputStream, 6, code, "seconds_value"); currentTimeSet.secondsValue = code;
1367  sei_read_code( pDecodedMessageOutputStream, 6, code, "minutes_value"); currentTimeSet.minutesValue = code;
1368  sei_read_code( pDecodedMessageOutputStream, 5, code, "hours_value"); currentTimeSet.hoursValue = code;
1369  }
1370  else
1371  {
1372  sei_read_flag( pDecodedMessageOutputStream, code, "seconds_flag"); currentTimeSet.secondsFlag = code;
1373  if(currentTimeSet.secondsFlag)
1374  {
1375  sei_read_code( pDecodedMessageOutputStream, 6, code, "seconds_value"); currentTimeSet.secondsValue = code;
1376  sei_read_flag( pDecodedMessageOutputStream, code, "minutes_flag"); currentTimeSet.minutesFlag = code;
1377  if(currentTimeSet.minutesFlag)
1378  {
1379  sei_read_code( pDecodedMessageOutputStream, 6, code, "minutes_value"); currentTimeSet.minutesValue = code;
1380  sei_read_flag( pDecodedMessageOutputStream, code, "hours_flag"); currentTimeSet.hoursFlag = code;
1381  if(currentTimeSet.hoursFlag)
1382  {
1383  sei_read_code( pDecodedMessageOutputStream, 5, code, "hours_value"); currentTimeSet.hoursValue = code;
1384  }
1385  }
1386  }
1387  }
1388  sei_read_code( pDecodedMessageOutputStream, 5, code, "time_offset_length"); currentTimeSet.timeOffsetLength = code;
1389  if(currentTimeSet.timeOffsetLength > 0)
1390  {
1391  sei_read_code( pDecodedMessageOutputStream, currentTimeSet.timeOffsetLength, code, "time_offset_value");
1392  if((code & (1 << (currentTimeSet.timeOffsetLength-1))) == 0)
1393  {
1394  currentTimeSet.timeOffsetValue = code;
1395  }
1396  else
1397  {
1398  code &= (1<< (currentTimeSet.timeOffsetLength-1)) - 1;
1399  currentTimeSet.timeOffsetValue = ~code + 1;
1400  }
1401  }
1402  }
1403  sei.timeSetArray[i] = currentTimeSet;
1404  }
1405 }
1406 
1407 
1408 Void SEIReader::xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1409 {
1410  UInt code;
1411  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1412 
1413  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[0]" ); sei.values.primaries[0][0] = code;
1414  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[0]" ); sei.values.primaries[0][1] = code;
1415 
1416  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[1]" ); sei.values.primaries[1][0] = code;
1417  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[1]" ); sei.values.primaries[1][1] = code;
1418 
1419  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_x[2]" ); sei.values.primaries[2][0] = code;
1420  sei_read_code( pDecodedMessageOutputStream, 16, code, "display_primaries_y[2]" ); sei.values.primaries[2][1] = code;
1421 
1422 
1423  sei_read_code( pDecodedMessageOutputStream, 16, code, "white_point_x" ); sei.values.whitePoint[0] = code;
1424  sei_read_code( pDecodedMessageOutputStream, 16, code, "white_point_y" ); sei.values.whitePoint[1] = code;
1425 
1426  sei_read_code( pDecodedMessageOutputStream, 32, code, "max_display_mastering_luminance" ); sei.values.maxLuminance = code;
1427  sei_read_code( pDecodedMessageOutputStream, 32, code, "min_display_mastering_luminance" ); sei.values.minLuminance = code;
1428 }
1429 
1430 
1431 Void SEIReader::xParseSEISegmentedRectFramePacking(SEISegmentedRectFramePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1432 {
1433  UInt val;
1434  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1435  sei_read_flag( pDecodedMessageOutputStream, val, "segmented_rect_frame_packing_arrangement_cancel_flag" ); sei.m_arrangementCancelFlag = val;
1436  if( !sei.m_arrangementCancelFlag )
1437  {
1438  sei_read_code( pDecodedMessageOutputStream, 2, val, "segmented_rect_content_interpretation_type" ); sei.m_contentInterpretationType = val;
1439  sei_read_flag( pDecodedMessageOutputStream, val, "segmented_rect_frame_packing_arrangement_persistence" ); sei.m_arrangementPersistenceFlag = val;
1440  }
1441 }
1442 
1443 
1444 Void SEIReader::xParseSEITempMotionConstraintsTileSets(SEITempMotionConstrainedTileSets& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1445 {
1446  UInt code;
1447  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1448  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);
1449  sei_read_flag( pDecodedMessageOutputStream, code, "each_tile_one_tile_set_flag"); sei.m_each_tile_one_tile_set_flag = (code != 0);
1450 
1452  {
1453  sei_read_flag( pDecodedMessageOutputStream, code, "limited_tile_set_display_flag"); sei.m_limited_tile_set_display_flag = (code != 0);
1454  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_sets_in_message_minus1"); sei.setNumberOfTileSets(code + 1);
1455 
1456  if(sei.getNumberOfTileSets() != 0)
1457  {
1458  for(Int i = 0; i < sei.getNumberOfTileSets(); i++)
1459  {
1460  sei_read_uvlc( pDecodedMessageOutputStream, code, "mcts_id"); sei.tileSetData(i).m_mcts_id = code;
1461 
1463  {
1464  sei_read_flag( pDecodedMessageOutputStream, code, "display_tile_set_flag"); sei.tileSetData(i).m_display_tile_set_flag = (code != 1);
1465  }
1466 
1467  sei_read_uvlc( pDecodedMessageOutputStream, code, "num_tile_rects_in_set_minus1"); sei.tileSetData(i).setNumberOfTileRects(code + 1);
1468 
1469  for(Int j=0; j<sei.tileSetData(i).getNumberOfTileRects(); j++)
1470  {
1471  sei_read_uvlc( pDecodedMessageOutputStream, code, "top_left_tile_index"); sei.tileSetData(i).topLeftTileIndex(j) = code;
1472  sei_read_uvlc( pDecodedMessageOutputStream, code, "bottom_right_tile_index"); sei.tileSetData(i).bottomRightTileIndex(j) = code;
1473  }
1474 
1476  {
1477  sei_read_flag( pDecodedMessageOutputStream, code, "exact_sample_value_match_flag"); sei.tileSetData(i).m_exact_sample_value_match_flag = (code != 0);
1478  }
1479  sei_read_flag( pDecodedMessageOutputStream, code, "mcts_tier_level_idc_present_flag"); sei.tileSetData(i).m_mcts_tier_level_idc_present_flag = (code != 0);
1480 
1482  {
1483  sei_read_flag( pDecodedMessageOutputStream, code, "mcts_tier_flag"); sei.tileSetData(i).m_mcts_tier_flag = (code != 0);
1484  sei_read_code( pDecodedMessageOutputStream, 8, code, "mcts_level_idc"); sei.tileSetData(i).m_mcts_level_idc = code;
1485  }
1486  }
1487  }
1488  }
1489  else
1490  {
1491  sei_read_flag( pDecodedMessageOutputStream, code, "max_mcs_tier_level_idc_present_flag"); sei.m_max_mcs_tier_level_idc_present_flag = code;
1493  {
1494  sei_read_flag( pDecodedMessageOutputStream, code, "max_mcts_tier_flag"); sei.m_max_mcts_tier_flag = code;
1495  sei_read_code( pDecodedMessageOutputStream, 8, code, "max_mcts_level_idc"); sei.m_max_mcts_level_idc = code;
1496  }
1497  }
1498 }
1499 
1500 
1501 Void SEIReader::xParseSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1502 {
1503  UInt uiCode;
1504  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1505 
1506  sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "ver_chroma_filter_idc"); sei.m_verChromaFilterIdc = uiCode;
1507  sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "hor_chroma_filter_idc"); sei.m_horChromaFilterIdc = uiCode;
1508  sei_read_flag( pDecodedMessageOutputStream, uiCode, "ver_filtering_field_processing_flag"); sei.m_verFilteringFieldProcessingFlag = uiCode;
1509  if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1)
1510  {
1511  sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "target_format_idc"); sei.m_targetFormatIdc = uiCode;
1512  if(sei.m_verChromaFilterIdc == 1)
1513  {
1514  UInt numVerticalFilters;
1515  sei_read_uvlc( pDecodedMessageOutputStream, numVerticalFilters, "num_vertical_filters"); sei.m_verFilterCoeff.resize(numVerticalFilters);
1516  if(numVerticalFilters > 0)
1517  {
1518  for(Int i = 0; i < numVerticalFilters; i++)
1519  {
1520  UInt verTapLengthMinus1;
1521  sei_read_uvlc( pDecodedMessageOutputStream, verTapLengthMinus1, "ver_tap_length_minus_1"); sei.m_verFilterCoeff[i].resize(verTapLengthMinus1+1);
1522  for(Int j = 0; j < (verTapLengthMinus1 + 1); j++)
1523  {
1524  sei_read_svlc( pDecodedMessageOutputStream, sei.m_verFilterCoeff[i][j], "ver_filter_coeff");
1525  }
1526  }
1527  }
1528  }
1529  if(sei.m_horChromaFilterIdc == 1)
1530  {
1531  UInt numHorizontalFilters;
1532  sei_read_uvlc( pDecodedMessageOutputStream, numHorizontalFilters, "num_horizontal_filters"); sei.m_horFilterCoeff.resize(numHorizontalFilters);
1533  if(numHorizontalFilters > 0)
1534  {
1535  for(Int i = 0; i < numHorizontalFilters; i++)
1536  {
1537  UInt horTapLengthMinus1;
1538  sei_read_uvlc( pDecodedMessageOutputStream, horTapLengthMinus1, "hor_tap_length_minus_1"); sei.m_horFilterCoeff[i].resize(horTapLengthMinus1+1);
1539  for(Int j = 0; j < (horTapLengthMinus1 + 1); j++)
1540  {
1541  sei_read_svlc( pDecodedMessageOutputStream, sei.m_horFilterCoeff[i][j], "hor_filter_coeff");
1542  }
1543  }
1544  }
1545  }
1546  }
1547 }
1548 
1549 
1550 Void SEIReader::xParseSEIKneeFunctionInfo(SEIKneeFunctionInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1551 {
1552  Int i;
1553  UInt val;
1554  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1555 
1556  sei_read_uvlc( pDecodedMessageOutputStream, val, "knee_function_id" ); sei.m_kneeId = val;
1557  sei_read_flag( pDecodedMessageOutputStream, val, "knee_function_cancel_flag" ); sei.m_kneeCancelFlag = val;
1558  if ( !sei.m_kneeCancelFlag )
1559  {
1560  sei_read_flag( pDecodedMessageOutputStream, val, "knee_function_persistence_flag" ); sei.m_kneePersistenceFlag = val;
1561  sei_read_code( pDecodedMessageOutputStream, 32, val, "input_d_range" ); sei.m_kneeInputDrange = val;
1562  sei_read_code( pDecodedMessageOutputStream, 32, val, "input_disp_luminance" ); sei.m_kneeInputDispLuminance = val;
1563  sei_read_code( pDecodedMessageOutputStream, 32, val, "output_d_range" ); sei.m_kneeOutputDrange = val;
1564  sei_read_code( pDecodedMessageOutputStream, 32, val, "output_disp_luminance" ); sei.m_kneeOutputDispLuminance = val;
1565  sei_read_uvlc( pDecodedMessageOutputStream, val, "num_knee_points_minus1" ); sei.m_kneeNumKneePointsMinus1 = val;
1566  assert( sei.m_kneeNumKneePointsMinus1 > 0 );
1569  for(i = 0; i <= sei.m_kneeNumKneePointsMinus1; i++ )
1570  {
1571  sei_read_code( pDecodedMessageOutputStream, 10, val, "input_knee_point" ); sei.m_kneeInputKneePoint[i] = val;
1572  sei_read_code( pDecodedMessageOutputStream, 10, val, "output_knee_point" ); sei.m_kneeOutputKneePoint[i] = val;
1573  }
1574  }
1575 }
1576 
1577 #if CCV_SEI_MESSAGE
1578 Void SEIReader::xParseSEIContentColourVolume(SEIContentColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1579 {
1580  Int i;
1581  UInt val;
1582  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1583 
1584  sei_read_flag( pDecodedMessageOutputStream, val, "ccv_cancel_flag" ); sei.m_ccvCancelFlag = val;
1585  if ( !sei.m_ccvCancelFlag )
1586  {
1587  Int iVal;
1588  sei_read_flag( pDecodedMessageOutputStream, val, "ccv_persistence_flag" ); sei.m_ccvPersistenceFlag = val;
1589  sei_read_flag( pDecodedMessageOutputStream, val, "ccv_primaries_present_flag" ); sei.m_ccvPrimariesPresentFlag = val;
1590  sei_read_flag( pDecodedMessageOutputStream, val, "ccv_min_luminance_value_present_flag" ); sei.m_ccvMinLuminanceValuePresentFlag = val;
1591  sei_read_flag( pDecodedMessageOutputStream, val, "ccv_max_luminance_value_present_flag" ); sei.m_ccvMaxLuminanceValuePresentFlag = val;
1592  sei_read_flag( pDecodedMessageOutputStream, val, "ccv_avg_luminance_value_present_flag" ); sei.m_ccvAvgLuminanceValuePresentFlag = val;
1593 
1594  if (sei.m_ccvPrimariesPresentFlag)
1595  {
1596  for (i = 0; i < MAX_NUM_COMPONENT; i++)
1597  {
1598  sei_read_scode( pDecodedMessageOutputStream, 32, iVal, "ccv_primaries_x[i]" ); sei.m_ccvPrimariesX[i] = iVal;
1599  sei_read_scode( pDecodedMessageOutputStream, 32, iVal, "ccv_primaries_y[i]" ); sei.m_ccvPrimariesY[i] = iVal;
1600  }
1601  }
1603  {
1604  sei_read_code( pDecodedMessageOutputStream, 32, val, "ccv_min_luminance_value" ); sei.m_ccvMinLuminanceValue = val;
1605  }
1607  {
1608  sei_read_code( pDecodedMessageOutputStream, 32, val, "ccv_max_luminance_value" ); sei.m_ccvMaxLuminanceValue = val;
1609  }
1611  {
1612  sei_read_code( pDecodedMessageOutputStream, 32, val, "ccv_avg_luminance_value" ); sei.m_ccvAvgLuminanceValue = val;
1613  }
1614  }
1615 }
1616 #endif
1617 
1618 #if ERP_SR_OV_SEI_MESSAGE
1619 Void SEIReader::xParseSEIEquirectangularProjection(SEIEquirectangularProjection& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1620 {
1621  UInt val;
1622  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1623 
1624  sei_read_flag( pDecodedMessageOutputStream, val, "erp_cancel_flag" ); sei.m_erpCancelFlag = val;
1625  if( !sei.m_erpCancelFlag )
1626  {
1627  sei_read_flag( pDecodedMessageOutputStream, val, "erp_persistence_flag" ); sei.m_erpPersistenceFlag = val;
1628  sei_read_flag( pDecodedMessageOutputStream, val, "erp_guard_band_flag" ); sei.m_erpGuardBandFlag = val;
1629  sei_read_code( pDecodedMessageOutputStream, 2, val, "erp_reserved_zero_2bits" );
1630  if ( sei.m_erpGuardBandFlag == 1)
1631  {
1632  sei_read_code( pDecodedMessageOutputStream, 3, val, "erp_guard_band_type" ); sei.m_erpGuardBandType = val;
1633  sei_read_code( pDecodedMessageOutputStream, 8, val, "erp_left_guard_band_width" ); sei.m_erpLeftGuardBandWidth = val;
1634  sei_read_code( pDecodedMessageOutputStream, 8, val, "erp_right_guard_band_width"); sei.m_erpRightGuardBandWidth = val;
1635  }
1636  }
1637 }
1638 
1639 Void SEIReader::xParseSEISphereRotation(SEISphereRotation& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1640 {
1641  UInt val;
1642  Int sval;
1643  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1644  sei_read_flag( pDecodedMessageOutputStream, val, "sphere_rotation_cancel_flag" ); sei.m_sphereRotationCancelFlag = val;
1645  if( !sei.m_sphereRotationCancelFlag )
1646  {
1647  sei_read_flag ( pDecodedMessageOutputStream, val, "sphere_rotation_persistence_flag" ); sei.m_sphereRotationPersistenceFlag = val;
1648  sei_read_code ( pDecodedMessageOutputStream, 6, val, "sphere_rotation_reserved_zero_6bits" );
1649  sei_read_scode( pDecodedMessageOutputStream, 32, sval, "sphere_rotation_yaw" ); sei.m_sphereRotationYaw = sval;
1650  sei_read_scode( pDecodedMessageOutputStream, 32, sval, "sphere_rotation_pitch" ); sei.m_sphereRotationPitch = sval;
1651  sei_read_scode( pDecodedMessageOutputStream, 32, sval, "sphere_rotation_roll" ); sei.m_sphereRotationRoll = sval;
1652  }
1653 }
1654 
1655 Void SEIReader::xParseSEIOmniViewport(SEIOmniViewport& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1656 {
1657  UInt code;
1658  Int scode;
1659  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1660  sei_read_code( pDecodedMessageOutputStream, 10, code, "omni_viewport_id" ); sei.m_omniViewportId = code;
1661  sei_read_flag( pDecodedMessageOutputStream, code, "omni_viewport_cancel_flag" ); sei.m_omniViewportCancelFlag = code;
1662  if (!sei.m_omniViewportCancelFlag)
1663  {
1664  UInt numRegions;
1665  sei_read_flag( pDecodedMessageOutputStream, code, "omni_viewport_persistence_flag" ); sei.m_omniViewportPersistenceFlag = code;
1666  sei_read_code( pDecodedMessageOutputStream, 4, numRegions, "omni_viewport_cnt_minus1" ); numRegions++;
1667  sei.m_omniViewportRegions.resize(numRegions);
1668  for(UInt region=0; region<numRegions; region++)
1669  {
1670  SEIOmniViewport::OmniViewport &viewport = sei.m_omniViewportRegions[region];
1671  sei_read_scode( pDecodedMessageOutputStream, 32, scode, "omni_viewport_azimuth_centre" ); viewport.azimuthCentre = scode;
1672  sei_read_scode( pDecodedMessageOutputStream, 32, scode, "omni_viewport_elevation_centre" ); viewport.elevationCentre = scode;
1673  sei_read_scode( pDecodedMessageOutputStream, 32, scode, "omni_viewport_tilt_centre" ); viewport.tiltCentre = code;
1674  sei_read_code( pDecodedMessageOutputStream, 32, code, "omni_viewport_hor_range" ); viewport.horRange = code;
1675  sei_read_code( pDecodedMessageOutputStream, 32, code, "omni_viewport_ver_range" ); viewport.verRange = code;
1676  }
1677  }
1678  else
1679  {
1680  sei.m_omniViewportRegions.clear();
1682  }
1683 }
1684 #endif
1685 
1686 #if CMP_SEI_MESSAGE
1687 Void SEIReader::xParseSEICubemapProjection(SEICubemapProjection& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1688 {
1689  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1690  UInt val;
1691 
1692  sei_read_flag(pDecodedMessageOutputStream, val, "cmp_cancel_flag"); sei.m_cmpCancelFlag = val;
1693  if (!sei.m_cmpCancelFlag)
1694  {
1695  sei_read_flag(pDecodedMessageOutputStream, val, "cmp_persistence_flag"); sei.m_cmpPersistenceFlag = val;
1696  }
1697 }
1698 #endif
1699 
1700 
1701 
1702 #if RWP_SEI_MESSAGE
1703 Void SEIReader::xParseSEIRegionWisePacking(SEIRegionWisePacking& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1704 {
1705  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1706  UInt val;
1707 
1708  sei_read_flag( pDecodedMessageOutputStream, val, "rwp_cancel_flag" ); sei.m_rwpCancelFlag = val;
1709  if (!sei.m_rwpCancelFlag)
1710  {
1711  sei_read_flag( pDecodedMessageOutputStream, val, "rwp_persistence_flag" ); sei.m_rwpPersistenceFlag = val;
1712  sei_read_flag( pDecodedMessageOutputStream, val, "constituent_picture_matching_flag" ); sei.m_constituentPictureMatchingFlag = val;
1713  sei_read_code( pDecodedMessageOutputStream, 5, val, "rwp_reserved_zero_5bits" );
1714  sei_read_code( pDecodedMessageOutputStream, 8, val, "num_packed_regions" ); sei.m_numPackedRegions = val;
1715  sei_read_code( pDecodedMessageOutputStream, 32, val, "proj_picture_width" ); sei.m_projPictureWidth = val;
1716  sei_read_code( pDecodedMessageOutputStream, 32, val, "proj_picture_height" ); sei.m_projPictureHeight = val;
1717  sei_read_code( pDecodedMessageOutputStream, 16, val, "packed_picture_width" ); sei.m_packedPictureWidth = val;
1718  sei_read_code( pDecodedMessageOutputStream, 16, val, "packed_picture_height" ); sei.m_packedPictureHeight = val;
1719 
1720  sei.m_rwpTransformType.resize(sei.m_numPackedRegions);
1721  sei.m_rwpGuardBandFlag.resize(sei.m_numPackedRegions);
1722  sei.m_projRegionWidth.resize(sei.m_numPackedRegions);
1723  sei.m_projRegionHeight.resize(sei.m_numPackedRegions);
1724  sei.m_rwpProjRegionTop.resize(sei.m_numPackedRegions);
1725  sei.m_projRegionLeft.resize(sei.m_numPackedRegions);
1726  sei.m_packedRegionWidth.resize(sei.m_numPackedRegions);
1727  sei.m_packedRegionHeight.resize(sei.m_numPackedRegions);
1728  sei.m_packedRegionTop.resize(sei.m_numPackedRegions);
1729  sei.m_packedRegionLeft.resize(sei.m_numPackedRegions);
1735  sei.m_rwpGuardBandType.resize(4*sei.m_numPackedRegions);
1736 
1737  for( Int i=0; i < sei.m_numPackedRegions; i++ )
1738  {
1739  sei_read_code( pDecodedMessageOutputStream, 4, val, "rwp_reserved_zero_4bits" );
1740  sei_read_code( pDecodedMessageOutputStream, 3, val, "rwp_tTransform_type" ); sei.m_rwpTransformType[i] = val;
1741  sei_read_flag( pDecodedMessageOutputStream, val, "rwp_guard_band_flag" ); sei.m_rwpGuardBandFlag[i] = val;
1742  sei_read_code( pDecodedMessageOutputStream, 32, val, "proj_region_width" ); sei.m_projRegionWidth[i] = val;
1743  sei_read_code( pDecodedMessageOutputStream, 32, val, "proj_region_height" ); sei.m_projRegionHeight[i] = val;
1744  sei_read_code( pDecodedMessageOutputStream, 32, val, "rwp_proj_regionTop" ); sei.m_rwpProjRegionTop[i] = val;
1745  sei_read_code( pDecodedMessageOutputStream, 32, val, "proj_region_left" ); sei.m_projRegionLeft[i] = val;
1746  sei_read_code( pDecodedMessageOutputStream, 16, val, "packed_region_width" ); sei.m_packedRegionWidth[i] = val;
1747  sei_read_code( pDecodedMessageOutputStream, 16, val, "packed_region_height" ); sei.m_packedRegionHeight[i] = val;
1748  sei_read_code( pDecodedMessageOutputStream, 16, val, "packed_region_top" ); sei.m_packedRegionTop[i] = val;
1749  sei_read_code( pDecodedMessageOutputStream, 16, val, "packed_region_left" ); sei.m_packedRegionLeft[i] = val;
1750  if( sei.m_rwpGuardBandFlag[i] )
1751  {
1752  sei_read_code( pDecodedMessageOutputStream, 8, val, "rwp_left_guard_band_width" ); sei.m_rwpLeftGuardBandWidth[i] = val;
1753  sei_read_code( pDecodedMessageOutputStream, 8, val, "rwp_right_guard_band_width" ); sei.m_rwpRightGuardBandWidth[i] = val;
1754  sei_read_code( pDecodedMessageOutputStream, 8, val, "rwp_top_guard_band_height" ); sei.m_rwpTopGuardBandHeight[i] = val;
1755  sei_read_code( pDecodedMessageOutputStream, 8, val, "rwp_bottom_guard_band_height" ); sei. m_rwpBottomGuardBandHeight[i] = val;
1756  sei_read_flag( pDecodedMessageOutputStream, val, "rwp_guard_band_not_used_forPred_flag" ); sei.m_rwpGuardBandNotUsedForPredFlag[i] = val;
1757  for( Int j=0; j < 4; j++ )
1758  {
1759  sei_read_code( pDecodedMessageOutputStream, 3, val, "rwp_guard_band_type" ); sei.m_rwpGuardBandType[i*4 + j] = val;
1760  }
1761  sei_read_code( pDecodedMessageOutputStream, 3, val, "rwp_guard_band_reserved_zero_3bits" );
1762  }
1763  }
1764  }
1765 }
1766 #endif
1767 
1768 Void SEIReader::xParseSEIColourRemappingInfo(SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
1769 {
1770  UInt uiVal;
1771  Int iVal;
1772  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1773 
1774  sei_read_uvlc( pDecodedMessageOutputStream, uiVal, "colour_remap_id" ); sei.m_colourRemapId = uiVal;
1775  sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_cancel_flag" ); sei.m_colourRemapCancelFlag = uiVal;
1776  if( !sei.m_colourRemapCancelFlag )
1777  {
1778  sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_persistence_flag" ); sei.m_colourRemapPersistenceFlag = uiVal;
1779  sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_video_signal_info_present_flag" ); sei.m_colourRemapVideoSignalInfoPresentFlag = uiVal;
1781  {
1782  sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_full_range_flag" ); sei.m_colourRemapFullRangeFlag = uiVal;
1783  sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_primaries" ); sei.m_colourRemapPrimaries = uiVal;
1784  sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_transfer_function" ); sei.m_colourRemapTransferFunction = uiVal;
1785  sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_matrix_coefficients" ); sei.m_colourRemapMatrixCoefficients = uiVal;
1786  }
1787  sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_input_bit_depth" ); sei.m_colourRemapInputBitDepth = uiVal;
1788  sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_bit_depth" ); sei.m_colourRemapBitDepth = uiVal;
1789 
1790  for( Int c=0 ; c<3 ; c++ )
1791  {
1792  sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "pre_lut_num_val_minus1[c]" ); sei.m_preLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal;
1793  sei.m_preLut[c].resize(sei.m_preLutNumValMinus1[c]+1);
1794  if( uiVal> 0 )
1795  {
1796  for ( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ )
1797  {
1798  sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapInputBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_coded_value[c][i]" ); sei.m_preLut[c][i].codedValue = uiVal;
1799  sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_target_value[c][i]" ); sei.m_preLut[c][i].targetValue = uiVal;
1800  }
1801  }
1802  else // pre_lut_num_val_minus1[c] == 0
1803  {
1804  sei.m_preLut[c][0].codedValue = 0;
1805  sei.m_preLut[c][0].targetValue = 0;
1806  sei.m_preLut[c][1].codedValue = (1 << sei.m_colourRemapInputBitDepth) - 1 ;
1807  sei.m_preLut[c][1].targetValue = (1 << sei.m_colourRemapBitDepth) - 1 ;
1808  }
1809  }
1810 
1811  sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_matrix_present_flag" ); sei.m_colourRemapMatrixPresentFlag = uiVal;
1813  {
1814  sei_read_code( pDecodedMessageOutputStream, 4, uiVal, "log2_matrix_denom" ); sei.m_log2MatrixDenom = uiVal;
1815  for ( Int c=0 ; c<3 ; c++ )
1816  {
1817  for ( Int i=0 ; i<3 ; i++ )
1818  {
1819  sei_read_svlc( pDecodedMessageOutputStream, iVal, "colour_remap_coeffs[c][i]" ); sei.m_colourRemapCoeffs[c][i] = iVal;
1820  }
1821  }
1822  }
1823  else // setting default matrix (I3)
1824  {
1825  sei.m_log2MatrixDenom = 10;
1826  for ( Int c=0 ; c<3 ; c++ )
1827  {
1828  for ( Int i=0 ; i<3 ; i++ )
1829  {
1830  sei.m_colourRemapCoeffs[c][i] = (c==i) << sei.m_log2MatrixDenom;
1831  }
1832  }
1833  }
1834  for( Int c=0 ; c<3 ; c++ )
1835  {
1836  sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "post_lut_num_val_minus1[c]" ); sei.m_postLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal;
1837  sei.m_postLut[c].resize(sei.m_postLutNumValMinus1[c]+1);
1838  if( uiVal > 0 )
1839  {
1840  for ( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ )
1841  {
1842  sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_coded_value[c][i]" ); sei.m_postLut[c][i].codedValue = uiVal;
1843  sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_target_value[c][i]" ); sei.m_postLut[c][i].targetValue = uiVal;
1844  }
1845  }
1846  else
1847  {
1848  sei.m_postLut[c][0].codedValue = 0;
1849  sei.m_postLut[c][0].targetValue = 0;
1850  sei.m_postLut[c][1].targetValue = (1 << sei.m_colourRemapBitDepth) - 1;
1851  sei.m_postLut[c][1].codedValue = (1 << sei.m_colourRemapBitDepth) - 1;
1852  }
1853  }
1854  }
1855 }
1856 
1857 
1858 Void SEIReader::xParseSEIDeinterlaceFieldIdentification( SEIDeinterlaceFieldIdentification& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
1859 {
1860  UInt code;
1861  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1862 
1863  sei_read_flag(pDecodedMessageOutputStream, code, "deinterlaced_picture_source_parity_flag"); sei.m_deinterlacedPictureSourceParityFlag = code!=0;
1864 }
1865 
1866 
1867 Void SEIReader::xParseSEIContentLightLevelInfo( SEIContentLightLevelInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
1868 {
1869  UInt code;
1870  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1871 
1872  sei_read_code(pDecodedMessageOutputStream, 16, code, "max_content_light_level"); sei.m_maxContentLightLevel = code;
1873  sei_read_code(pDecodedMessageOutputStream, 16, code, "max_pic_average_light_level"); sei.m_maxPicAverageLightLevel = code;
1874 }
1875 
1876 
1877 Void SEIReader::xParseSEIDependentRAPIndication( SEIDependentRAPIndication& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
1878 {
1879  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1880 }
1881 
1882 
1883 Void SEIReader::xParseSEICodedRegionCompletion( SEICodedRegionCompletion& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
1884 {
1885  UInt code;
1886  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1887 
1888  sei_read_uvlc(pDecodedMessageOutputStream, code, "next_segment_address"); sei.m_nextSegmentAddress= code;
1889  if (code)
1890  {
1891  sei_read_flag(pDecodedMessageOutputStream, code, "independent_slice_segment_flag"); sei.m_independentSliceSegmentFlag = code!=0;
1892  }
1893  else
1894  {
1895  sei.m_independentSliceSegmentFlag=false; // initialise to known value.
1896  }
1897 }
1898 
1899 
1901 {
1902  UInt code;
1903  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1904 
1905  sei_read_code(pDecodedMessageOutputStream, 8, code, "preferred_transfer_characteristics"); sei.m_preferredTransferCharacteristics = code;
1906 }
1907 
1908 
1909 Void SEIReader::xParseSEIAmbientViewingEnvironment( SEIAmbientViewingEnvironment& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream )
1910 {
1911  UInt code;
1912  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1913 
1914  sei_read_code(pDecodedMessageOutputStream, 32, code, "ambient_illuminance"); sei.m_ambientIlluminance= code;
1915  sei_read_code(pDecodedMessageOutputStream, 16, code, "ambient_light_x"); sei.m_ambientLightX = (UShort)code;
1916  sei_read_code(pDecodedMessageOutputStream, 16, code, "ambient_light_y"); sei.m_ambientLightY = (UShort)code;
1917 }
1918 #if RNSEI
1919 Void SEIReader::xParseSEIRegionalNesting( SEIRegionalNesting& sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream )
1920 {
1921  UInt uiCode;
1922  output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize);
1923  UInt numRegions, numSEIs;
1924 
1925  sei_read_code(pDecodedMessageOutputStream, 16, uiCode, "regional_nesting_id");
1926  sei_read_code(pDecodedMessageOutputStream, 8, uiCode, "regional_nesting_num_rect_regions"); numRegions = uiCode;
1927 
1928  sei.clearRegions();
1929  for(UInt i = 0; i < numRegions; i++)
1930  {
1931  RNSEIWindow region;
1932  Int lOffset, rOffset, tOffset, bOffset, regionId;
1933  sei_read_code(pDecodedMessageOutputStream, 8, uiCode, "regional_nesting_rect_region_id"); regionId = uiCode;
1934  sei_read_code(pDecodedMessageOutputStream, 16, uiCode, "regional_nesting_rect_left_offset"); lOffset = uiCode;
1935  sei_read_code(pDecodedMessageOutputStream, 16, uiCode, "regional_nesting_rect_right_offset"); rOffset = uiCode;
1936  sei_read_code(pDecodedMessageOutputStream, 16, uiCode, "regional_nesting_rect_top_offset"); tOffset = uiCode;
1937  sei_read_code(pDecodedMessageOutputStream, 16, uiCode, "regional_nesting_rect_bottom_offset"); bOffset = uiCode;
1938  region.setRegionId(regionId);
1939  region.setWindow(lOffset, rOffset, tOffset, bOffset);
1940 
1941  sei.addRegion(&region);
1942  }
1943  sei_read_code(pDecodedMessageOutputStream, 8, uiCode, "num_sei_messages_in_regional_nesting_minus1"); numSEIs = uiCode + 1;
1944  for(UInt i = 0; i < numSEIs; i++)
1945  {
1946  std::vector<UInt> regionsForSEI;
1947  UInt numRegionsForSEI;
1948  sei_read_code(pDecodedMessageOutputStream, 8, uiCode, "num_regions_for_sei_message[i]"); numRegionsForSEI = uiCode;
1949  for(UInt j = 0; j < numRegionsForSEI; j++)
1950  {
1951  sei_read_code(pDecodedMessageOutputStream, 8, uiCode, "regional_nesting_sei_region_idx[i][j]");
1952  regionsForSEI.push_back(uiCode);
1953  }
1954  SEIMessages seis;
1955 
1956  SEI *seiReg = NULL;
1957  xReadSEImessageHdrPayload(seiReg, sps, pDecodedMessageOutputStream);
1958 
1959  sei.addRegionalSEI( regionsForSEI, seiReg) ;
1960  }
1961 }
1962 #endif
1963 
1964 
SEIMessages m_nestedSEIs
Definition: SEI.h:596
UChar m_filmGrainMatrixCoeffs
Definition: SEI.h:344
Void xParseSEIFilmGrainCharacteristics(SEIFilmGrainCharacteristics &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:934
Int m_packedPictureWidth
Definition: SEI.h:866
Bool getNalHrdParametersPresentFlag() const
Definition: TComSlice.h:324
std::vector< UShort > m_packedRegionLeft
Definition: SEI.h:877
UChar m_uuid_iso_iec_11578[ISO_IEC_11578_LEN]
Definition: SEI.h:256
Int m_postLutNumValMinus1[3]
Definition: SEI.h:925
UInt m_panScanRectId
Definition: SEI.h:214
Bool m_currentFrameIsFrame0Flag
Definition: SEI.h:435
Int m_duSptCpbRemovalDelay
Definition: SEI.h:536
std::vector< UChar > m_rwpTopGuardBandHeight
Definition: SEI.h:880
UInt getDuCpbRemovalDelayLengthMinus1() const
Definition: TComSlice.h:336
Void xParseSEIKneeFunctionInfo(SEIKneeFunctionInfo &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1550
UChar m_filmGrainBitDepthChromaMinus8
Definition: SEI.h:340
PayloadType
Definition: SEI.h:55
Bool getVclHrdParametersPresentFlag() const
Definition: TComSlice.h:327
Void xParseSEIFramePacking(SEIFramePacking &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1093
Bool m_selfContainedCvsFlag
Definition: SEI.h:516
UShort m_ituCountryCode
Definition: SEI.h:241
Void xParseSEIRegionalNesting(SEIRegionalNesting &sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1919
Bool m_exposureCompensationValueSignFlag
Definition: SEI.h:408
TComSEIMasteringDisplay values
Definition: SEI.h:647
std::vector< UShort > m_packedRegionWidth
Definition: SEI.h:874
UInt m_sopDescVclNaluType[MAX_NUM_PICS_IN_SOP]
Definition: SEI.h:495
unsigned short UShort
Definition: TypeDef.h:210
Bool m_max_mcs_tier_level_idc_present_flag
Definition: SEI.h:709
UInt m_sopDescStRpsIdx[MAX_NUM_PICS_IN_SOP]
Definition: SEI.h:497
Int m_frame1GridPositionX
Definition: SEI.h:440
Void xParseSEIRegionRefreshInfo(SEIRegionRefreshInfo &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1332
std::vector< Bool > m_rwpGuardBandFlag
Definition: SEI.h:869
UInt getNumBitsUntilByteAligned()
Void setNumberOfTileRects(const Int number)
Definition: SEI.h:683
UInt m_snapshotId
Definition: SEI.h:299
Bool m_constituentPictureMatchingFlag
Definition: SEI.h:862
Void xParseSEIAmbientViewingEnvironment(SEIAmbientViewingEnvironment &sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1909
Void xParseSEIBufferingPeriod(SEIBufferingPeriod &sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:662
Int m_contentInterpretationType
Definition: SEI.h:431
Void xReadSEImessageHdrPayload(SEI *&sei, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:519
UInt m_initialCpbRemovalDelay[MAX_CPB_CNT][2]
Definition: SEI.h:158
Int m_exposureIndexIdc
Definition: SEI.h:406
Bool m_frame1SelfContainedFlag
Definition: SEI.h:437
#define READ_CODE(length, code, name)
Defines version information, constants and small in-line functions.
Int m_ccvPrimariesY[MAX_NUM_COMPONENT]
Definition: SEI.h:777
Int m_exposureCompensationValueNumerator
Definition: SEI.h:409
void Void
Definition: TypeDef.h:203
std::vector< Int > m_targetPivotValue
Definition: SEI.h:403
Void xParseSEIEquirectangularProjection(SEIEquirectangularProjection &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1619
Bool m_fieldViewsFlag
Definition: SEI.h:434
Int m_projPictureWidth
Definition: SEI.h:864
TComInputBitstream * extractSubstream(UInt uiNumBits)
Void xParseSEIAlternativeTransferCharacteristics(SEIAlternativeTransferCharacteristics &sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1900
UInt m_dpbDelayOffset
Definition: SEI.h:157
Bool m_exactMatchingFlag
Definition: SEI.h:270
Void xReadSEImessage(SEIMessages &seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:147
Int timeOffsetValue
Definition: TypeDef.h:877
Bool m_arrangementPersistenceFlag
Definition: SEI.h:443
Int numberOfFrames
Definition: TypeDef.h:869
Int m_colourRemapMatrixCoefficients
Definition: SEI.h:917
UChar m_filmGrainColourPrimaries
Definition: SEI.h:342
#define NULL
Definition: CommonDef.h:107
Bool m_kneePersistenceFlag
Definition: SEI.h:752
Void sei_read_scode(std::ostream *pOS, UInt uiLength, Int &ruiCode, const TChar *pSymbolName)
Definition: SEIread.cpp:65
Void sei_read_code(std::ostream *pOS, UInt uiLength, UInt &ruiCode, const TChar *pSymbolName)
Definition: SEIread.cpp:74
Void xParseSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1501
UChar m_filmGrainBitDepthLumaMinus8
Definition: SEI.h:339
Bool m_bIsMonochrome
Definition: SEI.h:378
UInt m_picDpbOutputDelay
Definition: SEI.h:188
slice header and SPS class (header)
std::vector< Int > m_kneeOutputKneePoint
Definition: SEI.h:759
#define READ_SVLC(code, name)
Void xParseSEICubemapProjection(SEICubemapProjection &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1687
Void xParseSEIScalableNesting(SEIScalableNesting &sei, const NalUnitType nalUnitType, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1280
Int m_decodingUnitIdx
Definition: SEI.h:535
Void sei_read_svlc(std::ostream *pOS, Int &ruiCode, const TChar *pSymbolName)
Definition: SEIread.cpp:92
Bool m_frame0FlippedFlag
Definition: SEI.h:433
std::vector< Int > m_kneeInputKneePoint
Definition: SEI.h:758
unsigned int UInt
Definition: TypeDef.h:212
Bool clockTimeStampFlag
Definition: TypeDef.h:863
Bool m_rapCpbParamsPresentFlag
Definition: SEI.h:155
Int m_frame0GridPositionX
Definition: SEI.h:438
UInt m_cpbDelayOffset
Definition: SEI.h:156
Bool m_colourRemapVideoSignalInfoPresentFlag
Definition: SEI.h:913
std::vector< Bool > m_rwpGuardBandNotUsedForPredFlag
Definition: SEI.h:882
Bool m_frame0SelfContainedFlag
Definition: SEI.h:436
Void xParseSEIGreenMetadataInfo(SEIGreenMetadataInfo &sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1146
Int m_numPivots
Definition: SEI.h:401
Int m_minValue
Definition: SEI.h:396
Bool m_deinterlacedPictureSourceParityFlag
Definition: SEI.h:938
Bool m_ccvAvgLuminanceValuePresentFlag
Definition: SEI.h:775
Bool m_ccvPersistenceFlag
Definition: SEI.h:771
UInt numClockTs
Definition: SEI.h:635
TileSetData & tileSetData(const Int index)
Definition: SEI.h:720
std::vector< UInt > m_numNalusInDuMinus1
Definition: SEI.h:193
std::vector< UInt > m_projRegionWidth
Definition: SEI.h:870
Void sei_read_flag(std::ostream *pOS, UInt &ruiCode, const TChar *pSymbolName)
Definition: SEIread.cpp:101
Bool m_panScanRectPersistenceFlag
Definition: SEI.h:217
Void xParseSEIDeinterlaceFieldIdentification(SEIDeinterlaceFieldIdentification &sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1858
std::vector< UInt > m_projRegionHeight
Definition: SEI.h:871
UInt m_secondSceneId
Definition: SEI.h:287
Bool m_cmpPersistenceFlag
Definition: SEI.h:849
Void xParseSEICodedRegionCompletion(SEICodedRegionCompletion &sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1883
Void xParseSEIRegionWisePacking(SEIRegionWisePacking &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1703
Bool m_sphereRotationPersistenceFlag
Definition: SEI.h:810
ChromaFormat getChromaFormatIdc() const
Definition: TComSlice.h:826
UInt m_ccvAvgLuminanceValue
Definition: SEI.h:780
Void addRegion(RNSEIWindow *regn)
Definition: SEI.h:1064
Int m_nominalBlackLevelLumaCodeValue
Definition: SEI.h:413
std::vector< Int > activeSeqParameterSetId
Definition: SEI.h:519
Void xParseSEIUserDataUnregistered(SEIUserDataUnregistered &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:846
static const TChar * getSEIMessageString(SEI::PayloadType payloadType)
Definition: SEI.cpp:182
char TChar
Definition: TypeDef.h:206
TComInputBitstream * m_pcBitstream
HashType method
Definition: SEI.h:566
TComVUI * getVuiParameters()
Definition: TComSlice.h:936
Void xParseSEISceneInfo(SEISceneInfo &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:883
std::vector< UChar > m_rwpRightGuardBandWidth
Definition: SEI.h:879
Bool m_separateColourDescriptionPresentFlag
Definition: SEI.h:338
Void xParseSEIActiveParameterSets(SEIActiveParameterSets &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1186
Bool m_colourRemapCancelFlag
Definition: SEI.h:911
Bool m_colourRemapMatrixPresentFlag
Definition: SEI.h:922
UInt m_picStruct
Definition: SEI.h:183
std::vector< CRIlut > m_postLut[3]
Definition: SEI.h:926
std::vector< OmniViewport > m_omniViewportRegions
Definition: SEI.h:837
Bool m_colourRemapFullRangeFlag
Definition: SEI.h:914
Int countingType
Definition: TypeDef.h:865
Int m_picSptDpbOutputDuDelay
Definition: SEI.h:538
std::vector< UInt > m_rwpProjRegionTop
Definition: SEI.h:872
Int m_kneeOutputDrange
Definition: SEI.h:755
UInt m_sopDescTemporalId[MAX_NUM_PICS_IN_SOP]
Definition: SEI.h:496
Bool hoursFlag
Definition: TypeDef.h:875
Bool m_rwpCancelFlag
Definition: SEI.h:860
std::vector< UShort > m_packedRegionTop
Definition: SEI.h:876
Void xParseSEITempMotionConstraintsTileSets(SEITempMotionConstrainedTileSets &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1444
std::vector< UChar > m_userData
Definition: SEI.h:242
Int m_frame1GridPositionY
Definition: SEI.h:441
Int m_kneeInputDispLuminance
Definition: SEI.h:754
Bool secondsFlag
Definition: TypeDef.h:873
Void xParseSEIFillerPayload(SEIFillerPayload &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:801
Bool m_cmpCancelFlag
Definition: SEI.h:848
UInt m_sourceScanType
Definition: SEI.h:184
HashType
Definition: TypeDef.h:524
Void xParseSEIPostFilterHint(SEIPostFilterHint &sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:986
std::vector< Int > m_startOfCodedInterval
Definition: SEI.h:400
Bool m_bPrevSceneIdValidFlag
Definition: SEI.h:284
std::vector< PanScanRect > m_panScanRectRegions
Definition: SEI.h:216
Void xParseSEIUserDataRegistered(SEIUserDataRegistered &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:819
TComSEITimeSet timeSetArray[MAX_TIMECODE_SEI_SETS]
Definition: SEI.h:636
UInt m_xsdMetricValue
Definition: SEI.h:480
UInt m_numPicsInSopMinus1
Definition: SEI.h:493
Int hoursValue
Definition: TypeDef.h:872
Bool m_ccvMaxLuminanceValuePresentFlag
Definition: SEI.h:774
Int m_maxValue
Definition: SEI.h:397
TComInputBitstream * getBitstream()
Int m_colourRemapCoeffs[3][3]
Definition: SEI.h:924
static const UInt ISO_IEC_11578_LEN
Definition: SEI.h:246
Bool m_independentSliceSegmentFlag
Definition: SEI.h:974
bool Bool
Definition: TypeDef.h:204
CompModel m_compModel[MAX_NUM_COMPONENT]
Definition: SEI.h:362
Int minutesValue
Definition: TypeDef.h:871
Bool m_verFilteringFieldProcessingFlag
Definition: SEI.h:735
Void xParseSEIDecodedPictureHash(SEIDecodedPictureHash &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1239
Bool m_ccvPrimariesPresentFlag
Definition: SEI.h:772
Bool getSubPicCpbParamsPresentFlag() const
Definition: TComSlice.h:330
UInt m_xsdMetricType
Definition: SEI.h:479
Bool m_allLayersFlag
Definition: SEI.h:591
TComPictureHash m_pictureHash
Definition: SEI.h:568
Int m_sigmoidWidth
Definition: SEI.h:399
Parsing functionality high level syntax.
std::vector< UChar > m_rwpLeftGuardBandWidth
Definition: SEI.h:878
Void xParseSEIContentColourVolume(SEIContentColourVolume &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1578
Bool getSubPicCpbParamsInPicTimingSEIFlag() const
Definition: TComSlice.h:339
Int m_nominalWhiteLevelLumaCodeValue
Definition: SEI.h:414
Int m_cameraIsoSpeedIdc
Definition: SEI.h:404
Void setBitstream(TComInputBitstream *p)
Bool numUnitFieldBasedFlag
Definition: TypeDef.h:864
Definition: SEI.h:52
UInt m_filterHintType
Definition: SEI.h:377
Void xParseSEITemporalLevel0Index(SEITemporalLevel0Index &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1230
UInt m_maxContentLightLevel
Definition: SEI.h:950
Void xParseSEIProgressiveRefinementSegmentEnd(SEIProgressiveRefinementSegmentEnd &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:925
std::vector< UChar > m_rwpBottomGuardBandHeight
Definition: SEI.h:881
virtual PayloadType payloadType() const =0
Bool m_ccvCancelFlag
Definition: SEI.h:770
Int m_toneMapId
Definition: SEI.h:390
UInt m_numDecodingUnitsMinus1
Definition: SEI.h:190
std::vector< CRIlut > m_preLut[3]
Definition: SEI.h:921
UInt m_bpSeqParameterSetId
Definition: SEI.h:154
Bool m_quincunxSamplingFlag
Definition: SEI.h:430
UInt m_nestingNumOpsMinus1
Definition: SEI.h:587
Int & bottomRightTileIndex(const Int tileRectIndex)
Definition: SEI.h:696
Bool getFrameFieldInfoPresentFlag() const
Definition: TComSlice.h:640
UInt m_filterHintSizeY
Definition: SEI.h:375
UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2]
Definition: SEI.h:161
std::vector< std::vector< Int > > m_horFilterCoeff
Definition: SEI.h:739
Void parseSEImessage(TComInputBitstream *bs, SEIMessages &seis, const NalUnitType nalUnitType, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:129
Bool m_omniViewportPersistenceFlag
Definition: SEI.h:835
std::vector< UShort > m_packedRegionHeight
Definition: SEI.h:875
Bool m_filmGrainCharacteristicsCancelFlag
Definition: SEI.h:336
Int m_preLutNumValMinus1[3]
Definition: SEI.h:920
UInt m_auCpbRemovalDelayDelta
Definition: SEI.h:163
UInt getInitialCpbRemovalDelayLengthMinus1() const
Definition: TComSlice.h:353
unsigned char UChar
Definition: TypeDef.h:208
UInt m_nextSegmentAddress
Definition: SEI.h:973
std::vector< std::vector< Int > > m_verFilterCoeff
Definition: SEI.h:738
UInt getDpbOutputDelayLengthMinus1() const
Definition: TComSlice.h:359
Int m_sphereRotationYaw
Definition: SEI.h:811
class for handling bitstream (header)
UInt m_maxPicAverageLightLevel
Definition: SEI.h:951
Bool m_arrangementCancelFlag
Definition: SEI.h:428
static Void output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize)
Definition: SEIread.cpp:110
Int m_codedDataBitDepth
Definition: SEI.h:393
UInt m_nestingNoOpMaxTemporalIdPlus1
Definition: SEI.h:592
Bool discontinuityFlag
Definition: TypeDef.h:867
Int m_colourRemapInputBitDepth
Definition: SEI.h:918
Void sei_read_uvlc(std::ostream *pOS, UInt &ruiCode, const TChar *pSymbolName)
Definition: SEIread.cpp:83
Int m_ccvPrimariesX[MAX_NUM_COMPONENT]
Definition: SEI.h:776
Void xParseSEIToneMappingInfo(SEIToneMappingInfo &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1007
Bool m_filmGrainCharacteristicsPersistenceFlag
Definition: SEI.h:363
Int m_extendedWhiteLevelLumaCodeValue
Definition: SEI.h:415
Bool m_bSceneInfoPresentFlag
Definition: SEI.h:283
UInt m_initialCpbRemovalDelayOffset[MAX_CPB_CNT][2]
Definition: SEI.h:159
UInt m_duCommonCpbRemovalDelayMinus1
Definition: SEI.h:192
#define READ_SCODE(length, code, name)
std::vector< UChar > m_rwpTransformType
Definition: SEI.h:868
picture YUV buffer class (header)
Int getNumberOfTileSets() const
Definition: SEI.h:718
Void clearRegions()
Definition: SEI.h:1065
UInt anticlockwiseRotation
Definition: SEI.h:464
#define READ_FLAG(code, name)
UInt m_ccvMinLuminanceValue
Definition: SEI.h:778
Bool m_spatialFlippingFlag
Definition: SEI.h:432
Bool minutesFlag
Definition: TypeDef.h:874
UInt m_omniViewportId
Definition: SEI.h:833
#define READ_UVLC(code, name)
Void setNumberOfTileSets(const Int number)
Definition: SEI.h:717
std::vector< Int > m_filterHintValues
Definition: SEI.h:379
Void xParseSEINoDisplay(SEINoDisplay &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1340
UInt m_filterHintSizeX
Definition: SEI.h:376
Int m_projPictureHeight
Definition: SEI.h:865
std::vector< UChar > m_userData
Definition: SEI.h:257
Void xParseSEIRecoveryPoint(SEIRecoveryPoint &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:871
UInt getCpbRemovalDelayLengthMinus1() const
Definition: TComSlice.h:356
UInt m_nestingMaxTemporalIdPlus1[MAX_TLAYER]
Definition: SEI.h:588
UInt m_greenMetadataType
Definition: SEI.h:478
Bool m_noDisplay
Definition: SEI.h:624
Int m_numPackedRegions
Definition: SEI.h:863
Int m_recoveryPocCnt
Definition: SEI.h:269
std::vector< UChar > hash
Definition: TypeDef.h:821
UInt m_numFillerFFBytes
Definition: SEI.h:229
Void xParseSEIContentLightLevelInfo(SEIContentLightLevelInfo &sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1867
Void xParseSEIColourRemappingInfo(SEIColourRemappingInfo &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1768
UInt getDpbOutputDelayDuLengthMinus1() const
Definition: TComSlice.h:342
Bool m_omniViewportCancelFlag
Definition: SEI.h:834
Definition: SEI.h:367
Int secondsValue
Definition: TypeDef.h:870
Int m_exposureIndexValue
Definition: SEI.h:407
Bool m_nestingOpFlag
Definition: SEI.h:585
UShort whitePoint[2]
Definition: TypeDef.h:886
Bool getCpbDpbDelaysPresentFlag() const
Definition: TComSlice.h:388
UInt m_initialAltCpbRemovalDelay[MAX_CPB_CNT][2]
Definition: SEI.h:160
Void xParseSEIProgressiveRefinementSegmentStart(SEIProgressiveRefinementSegmentStart &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:915
Void xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1408
Int m_colourRemapPrimaries
Definition: SEI.h:915
Int m_arrangementType
Definition: SEI.h:429
Bool m_duCommonCpbRemovalDelayFlag
Definition: SEI.h:191
Int m_exposureCompensationValueDenomIdc
Definition: SEI.h:410
Bool m_sphereRotationCancelFlag
Definition: SEI.h:809
Int m_arrangementId
Definition: SEI.h:427
Int & topLeftTileIndex(const Int tileRectIndex)
Definition: SEI.h:695
Void xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1162
UChar m_filmGrainTransferCharacteristics
Definition: SEI.h:343
std::vector< Int > m_codedPivotValue
Definition: SEI.h:402
Int m_kneeOutputDispLuminance
Definition: SEI.h:756
Int m_sigmoidMidpoint
Definition: SEI.h:398
std::vector< UInt > m_duCpbRemovalDelayMinus1
Definition: SEI.h:194
UInt m_auCpbRemovalDelay
Definition: SEI.h:187
std::list< SEI * > SEIMessages
Definition: SEI.h:123
Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP]
Definition: SEI.h:498
std::vector< UInt > m_projRegionLeft
Definition: SEI.h:873
Int m_sphereRotationRoll
Definition: SEI.h:813
Int m_extendedRangeWhiteLevel
Definition: SEI.h:412
UInt m_nestingNumLayersMinus1
Definition: SEI.h:593
Void addRegionalSEI(std::vector< UInt > listInd, SEI *sei)
Definition: SEI.h:1066
int Int
Definition: TypeDef.h:211
Bool persistenceFlag
Definition: SEI.h:465
Bool m_mc_all_tiles_exact_sample_value_match_flag
Definition: SEI.h:706
Void xParseSEIDisplayOrientation(SEIDisplayOrientation &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1131
Int m_sphereRotationPitch
Definition: SEI.h:812
Void xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo &sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1204
Int m_refScreenLuminanceWhite
Definition: SEI.h:411
Bool m_concatenationFlag
Definition: SEI.h:162
Bool m_brokenLinkFlag
Definition: SEI.h:271
Bool m_toneMapPersistenceFlag
Definition: SEI.h:392
Bool m_colourRemapPersistenceFlag
Definition: SEI.h:912
NalUnitType
Definition: TypeDef.h:664
Int m_kneeInputDrange
Definition: SEI.h:753
UInt getCpbCntMinus1(Int layer) const
Definition: TComSlice.h:374
Int m_kneeNumKneePointsMinus1
Definition: SEI.h:757
Int m_frame0GridPositionY
Definition: SEI.h:439
std::vector< UChar > m_rwpGuardBandType
Definition: SEI.h:883
Void xParseSEIPictureSnapshot(SEIPictureSnapshot &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:906
UInt m_picDpbOutputDuDelay
Definition: SEI.h:189
Bool fullTimeStampFlag
Definition: TypeDef.h:866
UInt peekBits(UInt uiBits)
Int timeOffsetLength
Definition: TypeDef.h:876
UInt m_ccvMaxLuminanceValue
Definition: SEI.h:779
Bool m_toneMapCancelFlag
Definition: SEI.h:391
Int m_cameraIsoSpeedValue
Definition: SEI.h:405
std::vector< CompModelIntensityValues > intensityValues
Definition: SEI.h:359
Bool m_dpbOutputDuDelayPresentFlag
Definition: SEI.h:537
Bool m_noParameterSetUpdateFlag
Definition: SEI.h:517
UInt m_colourRemapId
Definition: SEI.h:910
Void setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
Definition: TypeDef.h:934
Void xParseSEISphereRotation(SEISphereRotation &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1639
Bool m_upsampledAspectRatio
Definition: SEI.h:444
UInt m_sceneId
Definition: SEI.h:285
Bool m_kneeCancelFlag
Definition: SEI.h:751
UChar m_nestingLayerId[MAX_NESTING_NUM_LAYER]
Definition: SEI.h:594
Int m_colourRemapBitDepth
Definition: SEI.h:919
Bool m_panScanRectCancelFlag
Definition: SEI.h:215
Void setRegionId(UInt const val)
Definition: TypeDef.h:961
Int m_arrangementReservedByte
Definition: SEI.h:442
Bool cntDroppedFlag
Definition: TypeDef.h:868
Int m_packedPictureHeight
Definition: SEI.h:867
Bool m_defaultOpFlag
Definition: SEI.h:586
UInt m_nestingOpIdx[MAX_NESTING_NUM_OPS]
Definition: SEI.h:589
Bool m_rwpPersistenceFlag
Definition: SEI.h:861
Void xParseSEISegmentedRectFramePacking(SEISegmentedRectFramePacking &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1431
Int m_targetBitDepth
Definition: SEI.h:394
Void xParseSEIOmniViewport(SEIOmniViewport &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1655
Bool m_bitStreamSubsetFlag
Definition: SEI.h:584
reading funtionality for SEI messages
Void xParseSEIPictureTiming(SEIPictureTiming &sei, UInt payloadSize, const TComSPS *sps, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:713
UInt m_sopSeqParameterSetId
Definition: SEI.h:492
Int m_colourRemapTransferFunction
Definition: SEI.h:916
Bool m_gdrForegroundFlag
Definition: SEI.h:610
UChar m_erpRightGuardBandWidth
Definition: SEI.h:798
UInt m_sceneTransitionType
Definition: SEI.h:286
TComHRD * getHrdParameters()
Definition: TComSlice.h:677
UShort primaries[3][2]
Definition: TypeDef.h:885
Void xParseSEIDependentRAPIndication(SEIDependentRAPIndication &sei, UInt payLoadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1877
Bool m_duplicateFlag
Definition: SEI.h:185
Bool m_ccvMinLuminanceValuePresentFlag
Definition: SEI.h:773
Void xParseSEITimeCode(SEITimeCode &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:1347
SPS class.
Definition: TComSlice.h:740
Void xParseSEIPanScanRect(SEIPanScanRect &sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Definition: SEIread.cpp:771
Bool m_arrangementPersistenceFlag
Definition: SEI.h:661