source: 3DVCSoftware/branches/HTM-12.1-Multiview-draft-1/source/Lib/TLibCommon/SEI.h @ 1070

Last change on this file since 1070 was 964, checked in by tech, 10 years ago
  • Merged 11.0-dev0@963. (Update to HM 14.0 + MV-HEVC Draft 8 HLS)
  • Added coding results.
  • Changed version number.
  • Property svn:eol-style set to native
File size: 12.1 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license.
5 *
6* Copyright (c) 2010-2014, ITU/ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#pragma once
35#include <list>
36#include <vector>
37#include <cstring>
38
39//! \ingroup TLibCommon
40//! \{
41class TComSPS;
42
43/**
44 * Abstract class representing an SEI message with lightweight RTTI.
45 */
46class SEI
47{
48public:
49  enum PayloadType
50  {
51    BUFFERING_PERIOD                     = 0,
52    PICTURE_TIMING                       = 1,
53    PAN_SCAN_RECT                        = 2,
54    FILLER_PAYLOAD                       = 3,
55    USER_DATA_REGISTERED_ITU_T_T35       = 4,
56    USER_DATA_UNREGISTERED               = 5,
57    RECOVERY_POINT                       = 6,
58    SCENE_INFO                           = 9,
59    FULL_FRAME_SNAPSHOT                  = 15,
60    PROGRESSIVE_REFINEMENT_SEGMENT_START = 16,
61    PROGRESSIVE_REFINEMENT_SEGMENT_END   = 17,
62    FILM_GRAIN_CHARACTERISTICS           = 19,
63    POST_FILTER_HINT                     = 22,
64    TONE_MAPPING_INFO                    = 23,
65    FRAME_PACKING                        = 45,
66    DISPLAY_ORIENTATION                  = 47,
67    SOP_DESCRIPTION                      = 128,
68    ACTIVE_PARAMETER_SETS                = 129,
69    DECODING_UNIT_INFO                   = 130,
70    TEMPORAL_LEVEL0_INDEX                = 131,
71    DECODED_PICTURE_HASH                 = 132,
72    SCALABLE_NESTING                     = 133,
73    REGION_REFRESH_INFO                  = 134,
74#if H_MV
75    SUB_BITSTREAM_PROPERTY               = 139,    // Final PayloadType to be defined after finalization
76#endif
77  };
78 
79  SEI() {}
80  virtual ~SEI() {}
81 
82  virtual PayloadType payloadType() const = 0;
83};
84
85class SEIuserDataUnregistered : public SEI
86{
87public:
88  PayloadType payloadType() const { return USER_DATA_UNREGISTERED; }
89
90  SEIuserDataUnregistered()
91    : userData(0)
92    {}
93
94  virtual ~SEIuserDataUnregistered()
95  {
96    delete userData;
97  }
98
99  UChar uuid_iso_iec_11578[16];
100  UInt userDataLength;
101  UChar *userData;
102};
103
104class SEIDecodedPictureHash : public SEI
105{
106public:
107  PayloadType payloadType() const { return DECODED_PICTURE_HASH; }
108
109  SEIDecodedPictureHash() {}
110  virtual ~SEIDecodedPictureHash() {}
111 
112  enum Method
113  {
114    MD5,
115    CRC,
116    CHECKSUM,
117    RESERVED,
118  } method;
119
120  UChar digest[3][16];
121};
122
123class SEIActiveParameterSets : public SEI
124{
125public:
126  PayloadType payloadType() const { return ACTIVE_PARAMETER_SETS; }
127
128  SEIActiveParameterSets() 
129    : activeVPSId            (0)
130    , m_selfContainedCvsFlag (false)
131    , m_noParameterSetUpdateFlag (false)
132    , numSpsIdsMinus1        (0)
133  {}
134  virtual ~SEIActiveParameterSets() {}
135
136  Int activeVPSId; 
137  Bool m_selfContainedCvsFlag;
138  Bool m_noParameterSetUpdateFlag;
139  Int numSpsIdsMinus1;
140  std::vector<Int> activeSeqParameterSetId; 
141};
142
143class SEIBufferingPeriod : public SEI
144{
145public:
146  PayloadType payloadType() const { return BUFFERING_PERIOD; }
147
148  SEIBufferingPeriod()
149  : m_bpSeqParameterSetId (0)
150  , m_rapCpbParamsPresentFlag (false)
151  , m_cpbDelayOffset      (0)
152  , m_dpbDelayOffset      (0)
153  {
154    ::memset(m_initialCpbRemovalDelay, 0, sizeof(m_initialCpbRemovalDelay));
155    ::memset(m_initialCpbRemovalDelayOffset, 0, sizeof(m_initialCpbRemovalDelayOffset));
156    ::memset(m_initialAltCpbRemovalDelay, 0, sizeof(m_initialAltCpbRemovalDelay));
157    ::memset(m_initialAltCpbRemovalDelayOffset, 0, sizeof(m_initialAltCpbRemovalDelayOffset));
158  }
159  virtual ~SEIBufferingPeriod() {}
160
161  UInt m_bpSeqParameterSetId;
162  Bool m_rapCpbParamsPresentFlag;
163  Bool m_cpbDelayOffset;
164  Bool m_dpbDelayOffset;
165  UInt m_initialCpbRemovalDelay         [MAX_CPB_CNT][2];
166  UInt m_initialCpbRemovalDelayOffset   [MAX_CPB_CNT][2];
167  UInt m_initialAltCpbRemovalDelay      [MAX_CPB_CNT][2];
168  UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2];
169  Bool m_concatenationFlag;
170  UInt m_auCpbRemovalDelayDelta;
171};
172class SEIPictureTiming : public SEI
173{
174public:
175  PayloadType payloadType() const { return PICTURE_TIMING; }
176
177  SEIPictureTiming()
178  : m_picStruct               (0)
179  , m_sourceScanType          (0)
180  , m_duplicateFlag           (false)
181  , m_picDpbOutputDuDelay     (0)
182  , m_numNalusInDuMinus1      (NULL)
183  , m_duCpbRemovalDelayMinus1 (NULL)
184  {}
185  virtual ~SEIPictureTiming()
186  {
187    if( m_numNalusInDuMinus1 != NULL )
188    {
189      delete m_numNalusInDuMinus1;
190    }
191    if( m_duCpbRemovalDelayMinus1  != NULL )
192    {
193      delete m_duCpbRemovalDelayMinus1;
194    }
195  }
196
197  UInt  m_picStruct;
198  UInt  m_sourceScanType;
199  Bool  m_duplicateFlag;
200
201  UInt  m_auCpbRemovalDelay;
202  UInt  m_picDpbOutputDelay;
203  UInt  m_picDpbOutputDuDelay;
204  UInt  m_numDecodingUnitsMinus1;
205  Bool  m_duCommonCpbRemovalDelayFlag;
206  UInt  m_duCommonCpbRemovalDelayMinus1;
207  UInt* m_numNalusInDuMinus1;
208  UInt* m_duCpbRemovalDelayMinus1;
209};
210
211class SEIDecodingUnitInfo : public SEI
212{
213public:
214  PayloadType payloadType() const { return DECODING_UNIT_INFO; }
215
216  SEIDecodingUnitInfo()
217    : m_decodingUnitIdx(0)
218    , m_duSptCpbRemovalDelay(0)
219    , m_dpbOutputDuDelayPresentFlag(false)
220    , m_picSptDpbOutputDuDelay(0)
221  {}
222  virtual ~SEIDecodingUnitInfo() {}
223  Int m_decodingUnitIdx;
224  Int m_duSptCpbRemovalDelay;
225  Bool m_dpbOutputDuDelayPresentFlag;
226  Int m_picSptDpbOutputDuDelay;
227};
228
229class SEIRecoveryPoint : public SEI
230{
231public:
232  PayloadType payloadType() const { return RECOVERY_POINT; }
233
234  SEIRecoveryPoint() {}
235  virtual ~SEIRecoveryPoint() {}
236
237  Int  m_recoveryPocCnt;
238  Bool m_exactMatchingFlag;
239  Bool m_brokenLinkFlag;
240};
241class SEIFramePacking : public SEI
242{
243public:
244  PayloadType payloadType() const { return FRAME_PACKING; }
245
246  SEIFramePacking() {}
247  virtual ~SEIFramePacking() {}
248
249  Int  m_arrangementId;
250  Bool m_arrangementCancelFlag;
251  Int  m_arrangementType;
252  Bool m_quincunxSamplingFlag;
253  Int  m_contentInterpretationType;
254  Bool m_spatialFlippingFlag;
255  Bool m_frame0FlippedFlag;
256  Bool m_fieldViewsFlag;
257  Bool m_currentFrameIsFrame0Flag;
258  Bool m_frame0SelfContainedFlag;
259  Bool m_frame1SelfContainedFlag;
260  Int  m_frame0GridPositionX;
261  Int  m_frame0GridPositionY;
262  Int  m_frame1GridPositionX;
263  Int  m_frame1GridPositionY;
264  Int  m_arrangementReservedByte;
265  Bool m_arrangementPersistenceFlag;
266  Bool m_upsampledAspectRatio;
267};
268
269class SEIDisplayOrientation : public SEI
270{
271public:
272  PayloadType payloadType() const { return DISPLAY_ORIENTATION; }
273
274  SEIDisplayOrientation()
275    : cancelFlag(true)
276    , persistenceFlag(0)
277    , extensionFlag(false)
278    {}
279  virtual ~SEIDisplayOrientation() {}
280
281  Bool cancelFlag;
282  Bool horFlip;
283  Bool verFlip;
284
285  UInt anticlockwiseRotation;
286  Bool persistenceFlag;
287  Bool extensionFlag;
288};
289
290class SEITemporalLevel0Index : public SEI
291{
292public:
293  PayloadType payloadType() const { return TEMPORAL_LEVEL0_INDEX; }
294
295  SEITemporalLevel0Index()
296    : tl0Idx(0)
297    , rapIdx(0)
298    {}
299  virtual ~SEITemporalLevel0Index() {}
300
301  UInt tl0Idx;
302  UInt rapIdx;
303};
304
305class SEIGradualDecodingRefreshInfo : public SEI
306{
307public:
308  PayloadType payloadType() const { return REGION_REFRESH_INFO; }
309
310  SEIGradualDecodingRefreshInfo()
311    : m_gdrForegroundFlag(0)
312  {}
313  virtual ~SEIGradualDecodingRefreshInfo() {}
314
315  Bool m_gdrForegroundFlag;
316};
317
318class SEISOPDescription : public SEI
319{
320public:
321  PayloadType payloadType() const { return SOP_DESCRIPTION; }
322
323  SEISOPDescription() {}
324  virtual ~SEISOPDescription() {}
325
326  UInt m_sopSeqParameterSetId;
327  UInt m_numPicsInSopMinus1;
328
329  UInt m_sopDescVclNaluType[MAX_NUM_PICS_IN_SOP];
330  UInt m_sopDescTemporalId[MAX_NUM_PICS_IN_SOP];
331  UInt m_sopDescStRpsIdx[MAX_NUM_PICS_IN_SOP];
332  Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP];
333};
334
335class SEIToneMappingInfo : public SEI
336{
337public:
338  PayloadType payloadType() const { return TONE_MAPPING_INFO; }
339  SEIToneMappingInfo() {}
340  virtual ~SEIToneMappingInfo() {}
341
342  Int    m_toneMapId;
343  Bool   m_toneMapCancelFlag;
344  Bool   m_toneMapPersistenceFlag;
345  Int    m_codedDataBitDepth;
346  Int    m_targetBitDepth;
347  Int    m_modelId;
348  Int    m_minValue;
349  Int    m_maxValue;
350  Int    m_sigmoidMidpoint;
351  Int    m_sigmoidWidth;
352  std::vector<Int> m_startOfCodedInterval;
353  Int    m_numPivots;
354  std::vector<Int> m_codedPivotValue;
355  std::vector<Int> m_targetPivotValue;
356  Int    m_cameraIsoSpeedIdc;
357  Int    m_cameraIsoSpeedValue;
358  Int    m_exposureIndexIdc;
359  Int    m_exposureIndexValue;
360  Int    m_exposureCompensationValueSignFlag;
361  Int    m_exposureCompensationValueNumerator;
362  Int    m_exposureCompensationValueDenomIdc;
363  Int    m_refScreenLuminanceWhite;
364  Int    m_extendedRangeWhiteLevel;
365  Int    m_nominalBlackLevelLumaCodeValue;
366  Int    m_nominalWhiteLevelLumaCodeValue;
367  Int    m_extendedWhiteLevelLumaCodeValue;
368};
369
370#if H_MV
371class SEISubBitstreamProperty : public SEI
372{
373public:
374  PayloadType payloadType() const { return SUB_BITSTREAM_PROPERTY; }
375
376  SEISubBitstreamProperty():   m_activeVpsId(-1), m_numAdditionalSubStreams(0) {}
377  virtual ~SEISubBitstreamProperty() {}
378
379  Int  m_activeVpsId;
380  Int  m_numAdditionalSubStreams;
381  std::vector<Int>  m_subBitstreamMode;
382  std::vector<Int>  m_outputLayerSetIdxToVps;
383  std::vector<Int>  m_highestSublayerId;
384  std::vector<Int>  m_avgBitRate;
385  std::vector<Int>  m_maxBitRate;
386};
387#endif
388
389typedef std::list<SEI*> SEIMessages;
390
391/// output a selection of SEI messages by payload type. Ownership stays in original message list.
392SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType);
393
394/// remove a selection of SEI messages by payload type from the original list and return them in a new list.
395SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType);
396
397/// delete list of SEI messages (freeing the referenced objects)
398Void deleteSEIs (SEIMessages &seiList);
399
400class SEIScalableNesting : public SEI
401{
402public:
403  PayloadType payloadType() const { return SCALABLE_NESTING; }
404
405  SEIScalableNesting() {}
406  virtual ~SEIScalableNesting()
407  {
408    if (!m_callerOwnsSEIs)
409    {
410      deleteSEIs(m_nestedSEIs);
411    }
412  }
413
414  Bool  m_bitStreamSubsetFlag;
415  Bool  m_nestingOpFlag;
416  Bool  m_defaultOpFlag;                             //value valid if m_nestingOpFlag != 0
417  UInt  m_nestingNumOpsMinus1;                       // -"-
418  UInt  m_nestingMaxTemporalIdPlus1[MAX_TLAYER];     // -"-
419  UInt  m_nestingOpIdx[MAX_NESTING_NUM_OPS];         // -"-
420
421  Bool  m_allLayersFlag;                             //value valid if m_nestingOpFlag == 0
422  UInt  m_nestingNoOpMaxTemporalIdPlus1;             //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
423  UInt  m_nestingNumLayersMinus1;                    //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
424  UChar m_nestingLayerId[MAX_NESTING_NUM_LAYER];     //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0. This can e.g. be a static array of 64 unsigned char values
425
426  Bool  m_callerOwnsSEIs;
427  SEIMessages m_nestedSEIs;
428};
429
430//! \}
Note: See TracBrowser for help on using the repository browser.