source: 3DVCSoftware/tags/HTM-DEV-0.1/source/Lib/TLibCommon/SEI.h @ 324

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

Initial development version for update to latest HM version.
Includes MV-HEVC and basic extensions for 3D-HEVC.

  • Property svn:eol-style set to native
File size: 9.7 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#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
357typedef std::list<SEI*> SEIMessages;
358
359/// output a selection of SEI messages by payload type. Ownership stays in original message list.
360SEIMessages getSeisByType(SEIMessages &seiList, SEI::PayloadType seiType);
361
362/// remove a selection of SEI messages by payload type from the original list and return them in a new list.
363SEIMessages extractSeisByType(SEIMessages &seiList, SEI::PayloadType seiType);
364
365/// delete list of SEI messages (freeing the referenced objects)
366Void deleteSEIs (SEIMessages &seiList);
367
368//! \}
Note: See TracBrowser for help on using the repository browser.