source: SHVCSoftware/branches/SHM-5.1-dev/source/Lib/TLibCommon/SEI.h @ 627

Last change on this file since 627 was 616, checked in by nokia, 11 years ago

JCTVC-P0138: Implementation of use_alt_cpb_params_flag

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