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