source: 3DVCSoftware/branches/HTM-DEV-0.1-dev/source/Lib/TLibCommon/SEI.h @ 363

Last change on this file since 363 was 362, checked in by tech, 12 years ago

Update to HM-10.1.

  • Property svn:eol-style set to native
File size: 12.3 KB
RevLine 
[324]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#if !L0047_APS_FLAGS
127    :numSpsIdsMinus1(0)
128#else
129    : activeVPSId            (0)
130    , m_fullRandomAccessFlag (false)
131    , m_noParamSetUpdateFlag (false)
132    , numSpsIdsMinus1        (0)
133#endif
134  {}
135  virtual ~SEIActiveParameterSets() {}
136
137  Int activeVPSId; 
138#if L0047_APS_FLAGS
139  Bool m_fullRandomAccessFlag;
140  Bool m_noParamSetUpdateFlag;
141#endif
142  Int numSpsIdsMinus1;
143  std::vector<Int> activeSeqParamSetId; 
144};
145
146class SEIBufferingPeriod : public SEI
147{
148public:
149  PayloadType payloadType() const { return BUFFERING_PERIOD; }
150
151  SEIBufferingPeriod()
152#if L0044_CPB_DPB_DELAY_OFFSET
153  : m_bpSeqParameterSetId (0)
154  , m_rapCpbParamsPresentFlag (false)
155  , m_cpbDelayOffset      (0)
156  , m_dpbDelayOffset      (0)
157  {
158    ::memset(m_initialCpbRemovalDelay, 0, sizeof(m_initialCpbRemovalDelay));
159    ::memset(m_initialCpbRemovalDelayOffset, 0, sizeof(m_initialCpbRemovalDelayOffset));
160    ::memset(m_initialAltCpbRemovalDelay, 0, sizeof(m_initialAltCpbRemovalDelay));
161    ::memset(m_initialAltCpbRemovalDelayOffset, 0, sizeof(m_initialAltCpbRemovalDelayOffset));
162  }
163#else
164  {}
165#endif
166  virtual ~SEIBufferingPeriod() {}
167
168  UInt m_bpSeqParameterSetId;
169  Bool m_rapCpbParamsPresentFlag;
170#if L0044_CPB_DPB_DELAY_OFFSET
171  Bool m_cpbDelayOffset;
172  Bool m_dpbDelayOffset;
173#endif
174  UInt m_initialCpbRemovalDelay         [MAX_CPB_CNT][2];
175  UInt m_initialCpbRemovalDelayOffset   [MAX_CPB_CNT][2];
176  UInt m_initialAltCpbRemovalDelay      [MAX_CPB_CNT][2];
177  UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2];
178#if L0328_SPLICING
179  Bool m_concatenationFlag;
180  UInt m_auCpbRemovalDelayDelta;
181#endif
182};
183class SEIPictureTiming : public SEI
184{
185public:
186  PayloadType payloadType() const { return PICTURE_TIMING; }
187
188  SEIPictureTiming()
189  : m_picStruct               (0)
190#if L0046_RENAME_PROG_SRC_IDC
191  , m_sourceScanType          (0)
192#else
193  , m_progressiveSourceIdc    (0)
194#endif
195  , m_duplicateFlag           (false)
196#if L0044_DU_DPB_OUTPUT_DELAY_HRD
197  , m_picDpbOutputDuDelay     (0)
198#endif
199  , m_numNalusInDuMinus1      (NULL)
200  , m_duCpbRemovalDelayMinus1 (NULL)
201  {}
202  virtual ~SEIPictureTiming()
203  {
204    if( m_numNalusInDuMinus1 != NULL )
205    {
206      delete m_numNalusInDuMinus1;
207    }
208    if( m_duCpbRemovalDelayMinus1  != NULL )
209    {
210      delete m_duCpbRemovalDelayMinus1;
211    }
212  }
213
214  UInt  m_picStruct;
215#if L0046_RENAME_PROG_SRC_IDC
216  UInt  m_sourceScanType;
217#else
218  UInt  m_progressiveSourceIdc;
219#endif
220  Bool  m_duplicateFlag;
221
222  UInt  m_auCpbRemovalDelay;
223  UInt  m_picDpbOutputDelay;
224#if L0044_DU_DPB_OUTPUT_DELAY_HRD
225  UInt  m_picDpbOutputDuDelay;
226#endif
227  UInt  m_numDecodingUnitsMinus1;
228  Bool  m_duCommonCpbRemovalDelayFlag;
229  UInt  m_duCommonCpbRemovalDelayMinus1;
230  UInt* m_numNalusInDuMinus1;
231  UInt* m_duCpbRemovalDelayMinus1;
232};
233
234class SEIDecodingUnitInfo : public SEI
235{
236public:
237  PayloadType payloadType() const { return DECODING_UNIT_INFO; }
238
239  SEIDecodingUnitInfo()
240    : m_decodingUnitIdx(0)
241    , m_duSptCpbRemovalDelay(0)
242#if L0044_DU_DPB_OUTPUT_DELAY_HRD
243    , m_dpbOutputDuDelayPresentFlag(false)
244    , m_picSptDpbOutputDuDelay(0)
245#endif
246  {}
247  virtual ~SEIDecodingUnitInfo() {}
248  Int m_decodingUnitIdx;
249  Int m_duSptCpbRemovalDelay;
250#if L0044_DU_DPB_OUTPUT_DELAY_HRD
251  Bool m_dpbOutputDuDelayPresentFlag;
252  Int m_picSptDpbOutputDuDelay;
253#endif
254};
255
256class SEIRecoveryPoint : public SEI
257{
258public:
259  PayloadType payloadType() const { return RECOVERY_POINT; }
260
261  SEIRecoveryPoint() {}
262  virtual ~SEIRecoveryPoint() {}
263
264  Int  m_recoveryPocCnt;
265  Bool m_exactMatchingFlag;
266  Bool m_brokenLinkFlag;
267};
268class SEIFramePacking : public SEI
269{
270public:
271  PayloadType payloadType() const { return FRAME_PACKING; }
272
273  SEIFramePacking() {}
274  virtual ~SEIFramePacking() {}
275
276  Int  m_arrangementId;
277  Bool m_arrangementCancelFlag;
278  Int  m_arrangementType;
279  Bool m_quincunxSamplingFlag;
280  Int  m_contentInterpretationType;
281  Bool m_spatialFlippingFlag;
282  Bool m_frame0FlippedFlag;
283  Bool m_fieldViewsFlag;
284  Bool m_currentFrameIsFrame0Flag;
285  Bool m_frame0SelfContainedFlag;
286  Bool m_frame1SelfContainedFlag;
287  Int  m_frame0GridPositionX;
288  Int  m_frame0GridPositionY;
289  Int  m_frame1GridPositionX;
290  Int  m_frame1GridPositionY;
291  Int  m_arrangementReservedByte;
292#if L0045_PERSISTENCE_FLAGS
293  Bool m_arrangementPersistenceFlag;
294#else
295  Int  m_arrangementRepetetionPeriod;
296#endif
297  Bool m_upsampledAspectRatio;
298};
299
300class SEIDisplayOrientation : public SEI
301{
302public:
303  PayloadType payloadType() const { return DISPLAY_ORIENTATION; }
304
305  SEIDisplayOrientation()
306    : cancelFlag(true)
307#if L0045_PERSISTENCE_FLAGS
308    , persistenceFlag(0)
309#else
310    , repetitionPeriod(1)
311#endif
312    , extensionFlag(false)
313    {}
314  virtual ~SEIDisplayOrientation() {}
315
316  Bool cancelFlag;
317  Bool horFlip;
318  Bool verFlip;
319
320  UInt anticlockwiseRotation;
321#if L0045_PERSISTENCE_FLAGS
322  Bool persistenceFlag;
323#else
324  UInt repetitionPeriod;
325#endif
326  Bool extensionFlag;
327};
328
329class SEITemporalLevel0Index : public SEI
330{
331public:
332  PayloadType payloadType() const { return TEMPORAL_LEVEL0_INDEX; }
333
334  SEITemporalLevel0Index()
335    : tl0Idx(0)
336    , rapIdx(0)
337    {}
338  virtual ~SEITemporalLevel0Index() {}
339
340  UInt tl0Idx;
341  UInt rapIdx;
342};
343
344class SEIGradualDecodingRefreshInfo : public SEI
345{
346public:
347  PayloadType payloadType() const { return REGION_REFRESH_INFO; }
348
349  SEIGradualDecodingRefreshInfo()
350    : m_gdrForegroundFlag(0)
351  {}
352  virtual ~SEIGradualDecodingRefreshInfo() {}
353
354  Bool m_gdrForegroundFlag;
355};
356
[362]357#if L0208_SOP_DESCRIPTION_SEI
358class SEISOPDescription : public SEI
359{
360public:
361  PayloadType payloadType() const { return SOP_DESCRIPTION; }
362
363  SEISOPDescription() {}
364  virtual ~SEISOPDescription() {}
365
366  UInt m_sopSeqParameterSetId;
367  UInt m_numPicsInSopMinus1;
368
369  UInt m_sopDescVclNaluType[MAX_NUM_PICS_IN_SOP];
370  UInt m_sopDescTemporalId[MAX_NUM_PICS_IN_SOP];
371  UInt m_sopDescStRpsIdx[MAX_NUM_PICS_IN_SOP];
372  Int m_sopDescPocDelta[MAX_NUM_PICS_IN_SOP];
373};
374#endif
375
376#if J0149_TONE_MAPPING_SEI
377class SEIToneMappingInfo : public SEI
378{
379public:
380  PayloadType payloadType() const { return TONE_MAPPING_INFO; }
381  SEIToneMappingInfo() {}
382  virtual ~SEIToneMappingInfo() {}
383
384  Int    m_toneMapId;
385  Bool   m_toneMapCancelFlag;
386  Bool   m_toneMapPersistenceFlag;
387  Int    m_codedDataBitDepth;
388  Int    m_targetBitDepth;
389  Int    m_modelId;
390  Int    m_minValue;
391  Int    m_maxValue;
392  Int    m_sigmoidMidpoint;
393  Int    m_sigmoidWidth;
394  std::vector<Int> m_startOfCodedInterval;
395  Int    m_numPivots;
396  std::vector<Int> m_codedPivotValue;
397  std::vector<Int> m_targetPivotValue;
398  Int    m_cameraIsoSpeedIdc;
399  Int    m_cameraIsoSpeedValue;
400  Int    m_exposureCompensationValueSignFlag;
401  Int    m_exposureCompensationValueNumerator;
402  Int    m_exposureCompensationValueDenomIdc;
403  Int    m_refScreenLuminanceWhite;
404  Int    m_extendedRangeWhiteLevel;
405  Int    m_nominalBlackLevelLumaCodeValue;
406  Int    m_nominalWhiteLevelLumaCodeValue;
407  Int    m_extendedWhiteLevelLumaCodeValue;
408};
409#endif
410
[324]411typedef std::list<SEI*> SEIMessages;
412
413/// output a selection of SEI messages by payload type. Ownership stays in original message list.
414SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType);
415
416/// remove a selection of SEI messages by payload type from the original list and return them in a new list.
417SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType);
418
419/// delete list of SEI messages (freeing the referenced objects)
420Void deleteSEIs (SEIMessages &seiList);
421
[362]422#if K0180_SCALABLE_NESTING_SEI
423class SEIScalableNesting : public SEI
424{
425public:
426  PayloadType payloadType() const { return SCALABLE_NESTING; }
427
428  SEIScalableNesting() {}
429  virtual ~SEIScalableNesting()
430  {
431    if (!m_callerOwnsSEIs)
432    {
433      deleteSEIs(m_nestedSEIs);
434    }
435  }
436
437  Bool  m_bitStreamSubsetFlag;
438  Bool  m_nestingOpFlag;
439  Bool  m_defaultOpFlag;                             //value valid if m_nestingOpFlag != 0
440  UInt  m_nestingNumOpsMinus1;                       // -"-
441  UInt  m_nestingMaxTemporalIdPlus1[MAX_TLAYER];     // -"-
442  UInt  m_nestingOpIdx[MAX_NESTING_NUM_OPS];         // -"-
443
444  Bool  m_allLayersFlag;                             //value valid if m_nestingOpFlag == 0
445  UInt  m_nestingNoOpMaxTemporalIdPlus1;             //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
446  UInt  m_nestingNumLayersMinus1;                    //value valid if m_nestingOpFlag == 0 and m_allLayersFlag == 0
447  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
448
449  Bool  m_callerOwnsSEIs;
450  SEIMessages m_nestedSEIs;
451};
452#endif
453
[324]454//! \}
Note: See TracBrowser for help on using the repository browser.