source: SHVCSoftware/branches/SHM-3.1-dev/source/Lib/TLibCommon/SEI.h @ 678

Last change on this file since 678 was 435, checked in by nokia, 11 years ago

add inter-layer constrained tiles sets SEI from JCTVC-N0383

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