source: 3DVCSoftware/branches/HTM-DEV-2.0-dev2-Sharp/source/Lib/TLibCommon/SEI.h

Last change on this file was 537, checked in by tech, 11 years ago

Update to HM 11.0.

  • Property svn:eol-style set to native
File size: 11.4 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-2013, 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  };
75 
76  SEI() {}
77  virtual ~SEI() {}
78 
79  virtual PayloadType payloadType() const = 0;
80};
81
82class SEIuserDataUnregistered : public SEI
83{
84public:
85  PayloadType payloadType() const { return USER_DATA_UNREGISTERED; }
86
87  SEIuserDataUnregistered()
88    : userData(0)
89    {}
90
91  virtual ~SEIuserDataUnregistered()
92  {
93    delete userData;
94  }
95
96  UChar uuid_iso_iec_11578[16];
97  UInt userDataLength;
98  UChar *userData;
99};
100
101class SEIDecodedPictureHash : public SEI
102{
103public:
104  PayloadType payloadType() const { return DECODED_PICTURE_HASH; }
105
106  SEIDecodedPictureHash() {}
107  virtual ~SEIDecodedPictureHash() {}
108 
109  enum Method
110  {
111    MD5,
112    CRC,
113    CHECKSUM,
114    RESERVED,
115  } method;
116
117  UChar digest[3][16];
118};
119
120class SEIActiveParameterSets : public SEI
121{
122public:
123  PayloadType payloadType() const { return ACTIVE_PARAMETER_SETS; }
124
125  SEIActiveParameterSets() 
126    : activeVPSId            (0)
127    , m_fullRandomAccessFlag (false)
128    , m_noParamSetUpdateFlag (false)
129    , numSpsIdsMinus1        (0)
130  {}
131  virtual ~SEIActiveParameterSets() {}
132
133  Int activeVPSId; 
134  Bool m_fullRandomAccessFlag;
135  Bool m_noParamSetUpdateFlag;
136  Int numSpsIdsMinus1;
137  std::vector<Int> activeSeqParamSetId; 
138};
139
140class SEIBufferingPeriod : public SEI
141{
142public:
143  PayloadType payloadType() const { return BUFFERING_PERIOD; }
144
145  SEIBufferingPeriod()
146  : m_bpSeqParameterSetId (0)
147  , m_rapCpbParamsPresentFlag (false)
148  , m_cpbDelayOffset      (0)
149  , m_dpbDelayOffset      (0)
150  {
151    ::memset(m_initialCpbRemovalDelay, 0, sizeof(m_initialCpbRemovalDelay));
152    ::memset(m_initialCpbRemovalDelayOffset, 0, sizeof(m_initialCpbRemovalDelayOffset));
153    ::memset(m_initialAltCpbRemovalDelay, 0, sizeof(m_initialAltCpbRemovalDelay));
154    ::memset(m_initialAltCpbRemovalDelayOffset, 0, sizeof(m_initialAltCpbRemovalDelayOffset));
155  }
156  virtual ~SEIBufferingPeriod() {}
157
158  UInt m_bpSeqParameterSetId;
159  Bool m_rapCpbParamsPresentFlag;
160  Bool m_cpbDelayOffset;
161  Bool m_dpbDelayOffset;
162  UInt m_initialCpbRemovalDelay         [MAX_CPB_CNT][2];
163  UInt m_initialCpbRemovalDelayOffset   [MAX_CPB_CNT][2];
164  UInt m_initialAltCpbRemovalDelay      [MAX_CPB_CNT][2];
165  UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2];
166  Bool m_concatenationFlag;
167  UInt m_auCpbRemovalDelayDelta;
168};
169class SEIPictureTiming : public SEI
170{
171public:
172  PayloadType payloadType() const { return PICTURE_TIMING; }
173
174  SEIPictureTiming()
175  : m_picStruct               (0)
176  , m_sourceScanType          (0)
177  , m_duplicateFlag           (false)
178  , m_picDpbOutputDuDelay     (0)
179  , m_numNalusInDuMinus1      (NULL)
180  , m_duCpbRemovalDelayMinus1 (NULL)
181  {}
182  virtual ~SEIPictureTiming()
183  {
184    if( m_numNalusInDuMinus1 != NULL )
185    {
186      delete m_numNalusInDuMinus1;
187    }
188    if( m_duCpbRemovalDelayMinus1  != NULL )
189    {
190      delete m_duCpbRemovalDelayMinus1;
191    }
192  }
193
194  UInt  m_picStruct;
195  UInt  m_sourceScanType;
196  Bool  m_duplicateFlag;
197
198  UInt  m_auCpbRemovalDelay;
199  UInt  m_picDpbOutputDelay;
200  UInt  m_picDpbOutputDuDelay;
201  UInt  m_numDecodingUnitsMinus1;
202  Bool  m_duCommonCpbRemovalDelayFlag;
203  UInt  m_duCommonCpbRemovalDelayMinus1;
204  UInt* m_numNalusInDuMinus1;
205  UInt* m_duCpbRemovalDelayMinus1;
206};
207
208class SEIDecodingUnitInfo : public SEI
209{
210public:
211  PayloadType payloadType() const { return DECODING_UNIT_INFO; }
212
213  SEIDecodingUnitInfo()
214    : m_decodingUnitIdx(0)
215    , m_duSptCpbRemovalDelay(0)
216    , m_dpbOutputDuDelayPresentFlag(false)
217    , m_picSptDpbOutputDuDelay(0)
218  {}
219  virtual ~SEIDecodingUnitInfo() {}
220  Int m_decodingUnitIdx;
221  Int m_duSptCpbRemovalDelay;
222  Bool m_dpbOutputDuDelayPresentFlag;
223  Int m_picSptDpbOutputDuDelay;
224};
225
226class SEIRecoveryPoint : public SEI
227{
228public:
229  PayloadType payloadType() const { return RECOVERY_POINT; }
230
231  SEIRecoveryPoint() {}
232  virtual ~SEIRecoveryPoint() {}
233
234  Int  m_recoveryPocCnt;
235  Bool m_exactMatchingFlag;
236  Bool m_brokenLinkFlag;
237};
238class SEIFramePacking : public SEI
239{
240public:
241  PayloadType payloadType() const { return FRAME_PACKING; }
242
243  SEIFramePacking() {}
244  virtual ~SEIFramePacking() {}
245
246  Int  m_arrangementId;
247  Bool m_arrangementCancelFlag;
248  Int  m_arrangementType;
249  Bool m_quincunxSamplingFlag;
250  Int  m_contentInterpretationType;
251  Bool m_spatialFlippingFlag;
252  Bool m_frame0FlippedFlag;
253  Bool m_fieldViewsFlag;
254  Bool m_currentFrameIsFrame0Flag;
255  Bool m_frame0SelfContainedFlag;
256  Bool m_frame1SelfContainedFlag;
257  Int  m_frame0GridPositionX;
258  Int  m_frame0GridPositionY;
259  Int  m_frame1GridPositionX;
260  Int  m_frame1GridPositionY;
261  Int  m_arrangementReservedByte;
262  Bool m_arrangementPersistenceFlag;
263  Bool m_upsampledAspectRatio;
264};
265
266class SEIDisplayOrientation : public SEI
267{
268public:
269  PayloadType payloadType() const { return DISPLAY_ORIENTATION; }
270
271  SEIDisplayOrientation()
272    : cancelFlag(true)
273    , persistenceFlag(0)
274    , extensionFlag(false)
275    {}
276  virtual ~SEIDisplayOrientation() {}
277
278  Bool cancelFlag;
279  Bool horFlip;
280  Bool verFlip;
281
282  UInt anticlockwiseRotation;
283  Bool persistenceFlag;
284  Bool extensionFlag;
285};
286
287class SEITemporalLevel0Index : public SEI
288{
289public:
290  PayloadType payloadType() const { return TEMPORAL_LEVEL0_INDEX; }
291
292  SEITemporalLevel0Index()
293    : tl0Idx(0)
294    , rapIdx(0)
295    {}
296  virtual ~SEITemporalLevel0Index() {}
297
298  UInt tl0Idx;
299  UInt rapIdx;
300};
301
302class SEIGradualDecodingRefreshInfo : public SEI
303{
304public:
305  PayloadType payloadType() const { return REGION_REFRESH_INFO; }
306
307  SEIGradualDecodingRefreshInfo()
308    : m_gdrForegroundFlag(0)
309  {}
310  virtual ~SEIGradualDecodingRefreshInfo() {}
311
312  Bool m_gdrForegroundFlag;
313};
314
315class SEISOPDescription : public SEI
316{
317public:
318  PayloadType payloadType() const { return SOP_DESCRIPTION; }
319
320  SEISOPDescription() {}
321  virtual ~SEISOPDescription() {}
322
323  UInt m_sopSeqParameterSetId;
324  UInt m_numPicsInSopMinus1;
325
326  UInt m_sopDescVclNaluType[MAX_NUM_PICS_IN_SOP];
327  UInt m_sopDescTemporalId[MAX_NUM_PICS_IN_SOP];
328  UInt m_sopDescStRpsIdx[MAX_NUM_PICS_IN_SOP];
329  Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP];
330};
331
332class SEIToneMappingInfo : public SEI
333{
334public:
335  PayloadType payloadType() const { return TONE_MAPPING_INFO; }
336  SEIToneMappingInfo() {}
337  virtual ~SEIToneMappingInfo() {}
338
339  Int    m_toneMapId;
340  Bool   m_toneMapCancelFlag;
341  Bool   m_toneMapPersistenceFlag;
342  Int    m_codedDataBitDepth;
343  Int    m_targetBitDepth;
344  Int    m_modelId;
345  Int    m_minValue;
346  Int    m_maxValue;
347  Int    m_sigmoidMidpoint;
348  Int    m_sigmoidWidth;
349  std::vector<Int> m_startOfCodedInterval;
350  Int    m_numPivots;
351  std::vector<Int> m_codedPivotValue;
352  std::vector<Int> m_targetPivotValue;
353  Int    m_cameraIsoSpeedIdc;
354  Int    m_cameraIsoSpeedValue;
355  Int    m_exposureCompensationValueSignFlag;
356  Int    m_exposureCompensationValueNumerator;
357  Int    m_exposureCompensationValueDenomIdc;
358  Int    m_refScreenLuminanceWhite;
359  Int    m_extendedRangeWhiteLevel;
360  Int    m_nominalBlackLevelLumaCodeValue;
361  Int    m_nominalWhiteLevelLumaCodeValue;
362  Int    m_extendedWhiteLevelLumaCodeValue;
363};
364
365typedef std::list<SEI*> SEIMessages;
366
367/// output a selection of SEI messages by payload type. Ownership stays in original message list.
368SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType);
369
370/// remove a selection of SEI messages by payload type from the original list and return them in a new list.
371SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType);
372
373/// delete list of SEI messages (freeing the referenced objects)
374Void deleteSEIs (SEIMessages &seiList);
375
376class SEIScalableNesting : public SEI
377{
378public:
379  PayloadType payloadType() const { return SCALABLE_NESTING; }
380
381  SEIScalableNesting() {}
382  virtual ~SEIScalableNesting()
383  {
384    if (!m_callerOwnsSEIs)
385    {
386      deleteSEIs(m_nestedSEIs);
387    }
388  }
389
390  Bool  m_bitStreamSubsetFlag;
391  Bool  m_nestingOpFlag;
392  Bool  m_defaultOpFlag;                             //value valid if m_nestingOpFlag != 0
393  UInt  m_nestingNumOpsMinus1;                       // -"-
394  UInt  m_nestingMaxTemporalIdPlus1[MAX_TLAYER];     // -"-
395  UInt  m_nestingOpIdx[MAX_NESTING_NUM_OPS];         // -"-
396
397  Bool  m_allLayersFlag;                             //value valid if m_nestingOpFlag == 0
398  UInt  m_nestingNoOpMaxTemporalIdPlus1;             //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
399  UInt  m_nestingNumLayersMinus1;                    //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
400  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
401
402  Bool  m_callerOwnsSEIs;
403  SEIMessages m_nestedSEIs;
404};
405
406//! \}
Note: See TracBrowser for help on using the repository browser.