source: SHVCSoftware/branches/SHM-1.0-dev/source/Lib/TLibCommon/SEI.h @ 225

Last change on this file since 225 was 2, checked in by seregin, 12 years ago

Initial import by Vadim Seregin <vseregin@…>

File size: 6.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-2012, 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
36//! \ingroup TLibCommon
37//! \{
38#if BUFFERING_PERIOD_AND_TIMING_SEI
39class TComSPS;
40#endif
41
42/**
43 * Abstract class representing an SEI message with lightweight RTTI.
44 */
45class SEI
46{
47public:
48  enum PayloadType
49  {
50#if BUFFERING_PERIOD_AND_TIMING_SEI
51    BUFFERING_PERIOD       = 0,
52    PICTURE_TIMING         = 1,
53#endif
54    USER_DATA_UNREGISTERED = 5,
55#if RECOVERY_POINT_SEI
56    RECOVERY_POINT         = 6,
57#endif
58#if ACTIVE_PARAMETER_SETS_SEI_MESSAGE
59    ACTIVE_PARAMETER_SETS = 131, 
60#endif
61    DECODED_PICTURE_HASH   = 256,
62  };
63 
64  SEI() {}
65  virtual ~SEI() {}
66 
67  virtual PayloadType payloadType() const = 0;
68};
69
70class SEIuserDataUnregistered : public SEI
71{
72public:
73  PayloadType payloadType() const { return USER_DATA_UNREGISTERED; }
74
75  SEIuserDataUnregistered()
76    : userData(0)
77    {}
78
79  virtual ~SEIuserDataUnregistered()
80  {
81    delete userData;
82  }
83
84  unsigned char uuid_iso_iec_11578[16];
85  unsigned userDataLength;
86  unsigned char *userData;
87};
88
89class SEIDecodedPictureHash : public SEI
90{
91public:
92  PayloadType payloadType() const { return DECODED_PICTURE_HASH; }
93
94  SEIDecodedPictureHash() {}
95  virtual ~SEIDecodedPictureHash() {}
96 
97  enum Method
98  {
99    MD5,
100    CRC,
101    CHECKSUM,
102    RESERVED,
103  } method;
104
105  unsigned char digest[3][16];
106};
107
108#if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 
109class SEIActiveParameterSets : public SEI
110{
111public:
112  PayloadType payloadType() const { return ACTIVE_PARAMETER_SETS; }
113
114  SEIActiveParameterSets() 
115    :activeSPSIdPresentFlag(1)
116    ,activeParamSetSEIExtensionFlag(0)
117  {}
118  virtual ~SEIActiveParameterSets() {}
119
120  Int activeVPSId; 
121  Int activeSPSIdPresentFlag;
122  Int activeSeqParamSetId; 
123  Int activeParamSetSEIExtensionFlag; 
124};
125#endif
126
127#if BUFFERING_PERIOD_AND_TIMING_SEI
128class SEIBufferingPeriod : public SEI
129{
130public:
131  PayloadType payloadType() const { return BUFFERING_PERIOD; }
132
133  SEIBufferingPeriod()
134  :m_sps (NULL)
135  {}
136  virtual ~SEIBufferingPeriod() {}
137
138  UInt m_seqParameterSetId;
139  Bool m_altCpbParamsPresentFlag;
140  UInt m_initialCpbRemovalDelay         [MAX_CPB_CNT][2];
141  UInt m_initialCpbRemovalDelayOffset   [MAX_CPB_CNT][2];
142  UInt m_initialAltCpbRemovalDelay      [MAX_CPB_CNT][2];
143  UInt m_initialAltCpbRemovalDelayOffset[MAX_CPB_CNT][2];
144  TComSPS* m_sps;
145};
146class SEIPictureTiming : public SEI
147{
148public:
149  PayloadType payloadType() const { return PICTURE_TIMING; }
150
151  SEIPictureTiming()
152  : m_numNalusInDuMinus1      (NULL)
153  , m_duCpbRemovalDelayMinus1 (NULL)
154  , m_sps                     (NULL)
155  {}
156  virtual ~SEIPictureTiming()
157  {
158    if( m_numNalusInDuMinus1 != NULL )
159    {
160      delete m_numNalusInDuMinus1;
161    }
162    if( m_duCpbRemovalDelayMinus1  != NULL )
163    {
164      delete m_duCpbRemovalDelayMinus1;
165    }
166  }
167
168  UInt  m_auCpbRemovalDelay;
169  UInt  m_picDpbOutputDelay;
170  UInt  m_numDecodingUnitsMinus1;
171  Bool  m_duCommonCpbRemovalDelayFlag;
172  UInt  m_duCommonCpbRemovalDelayMinus1;
173  UInt* m_numNalusInDuMinus1;
174  UInt* m_duCpbRemovalDelayMinus1;
175  TComSPS* m_sps;
176};
177#endif
178#if RECOVERY_POINT_SEI
179class SEIRecoveryPoint : public SEI
180{
181public:
182  PayloadType payloadType() const { return RECOVERY_POINT; }
183
184  SEIRecoveryPoint() {}
185  virtual ~SEIRecoveryPoint() {}
186
187  Int  m_recoveryPocCnt;
188  Bool m_exactMatchingFlag;
189  Bool m_brokenLinkFlag;
190};
191#endif
192/**
193 * A structure to collate all SEI messages.  This ought to be replaced
194 * with a list of std::list<SEI*>.  However, since there is only one
195 * user of the SEI framework, this will do initially */
196class SEImessages
197{
198public:
199  SEImessages()
200    : user_data_unregistered(0)
201#if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 
202    , active_parameter_sets(0)
203#endif
204    , picture_digest(0)
205#if BUFFERING_PERIOD_AND_TIMING_SEI
206    , buffering_period(0)
207    , picture_timing(0)
208#endif
209#if RECOVERY_POINT_SEI
210    , recovery_point(0)
211#endif
212    {}
213
214  ~SEImessages()
215  {
216    delete user_data_unregistered;
217#if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 
218    delete active_parameter_sets; 
219#endif
220    delete picture_digest;
221#if BUFFERING_PERIOD_AND_TIMING_SEI
222    delete buffering_period;
223    delete picture_timing;
224#endif
225#if RECOVERY_POINT_SEI
226    delete recovery_point;
227#endif
228  }
229
230  SEIuserDataUnregistered* user_data_unregistered;
231#if ACTIVE_PARAMETER_SETS_SEI_MESSAGE 
232  SEIActiveParameterSets* active_parameter_sets; 
233#endif
234  SEIDecodedPictureHash* picture_digest;
235#if BUFFERING_PERIOD_AND_TIMING_SEI
236  SEIBufferingPeriod* buffering_period;
237  SEIPictureTiming* picture_timing;
238  TComSPS* m_pSPS;
239#endif
240#if RECOVERY_POINT_SEI
241  SEIRecoveryPoint* recovery_point;
242#endif
243};
244
245//! \}
Note: See TracBrowser for help on using the repository browser.