1 /* ----------------------------------------------------------------------------- 2 The copyright in this software is being made available under the BSD 3 License, included below. No patent rights, trademark rights and/or 4 other Intellectual Property Rights other than the copyrights concerning 5 the Software are granted under this license. 6 7 For any license concerning other Intellectual Property rights than the software, 8 especially patent licenses, a separate Agreement needs to be closed. 9 For more information please contact: 10 11 Fraunhofer Heinrich Hertz Institute 12 Einsteinufer 37 13 10587 Berlin, Germany 14 www.hhi.fraunhofer.de/vvc 15 vvc@hhi.fraunhofer.de 16 17 Copyright (c) 2018-2021, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. 18 All rights reserved. 19 20 Redistribution and use in source and binary forms, with or without 21 modification, are permitted provided that the following conditions are met: 22 23 * Redistributions of source code must retain the above copyright notice, 24 this list of conditions and the following disclaimer. 25 * Redistributions in binary form must reproduce the above copyright notice, 26 this list of conditions and the following disclaimer in the documentation 27 and/or other materials provided with the distribution. 28 * Neither the name of Fraunhofer nor the names of its contributors may 29 be used to endorse or promote products derived from this software without 30 specific prior written permission. 31 32 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 33 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 34 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 35 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 36 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 37 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 40 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 41 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 42 THE POSSIBILITY OF SUCH DAMAGE. 43 44 45 ------------------------------------------------------------------------------------------- */ 46 47 #ifndef _VVDEC_SEI_H_ 48 #define _VVDEC_SEI_H_ 49 50 #include <stdio.h> 51 #include <stdint.h> 52 53 typedef enum 54 { 55 VVDEC_BUFFERING_PERIOD = 0, 56 VVDEC_PICTURE_TIMING = 1, 57 VVDEC_FILLER_PAYLOAD = 3, 58 VVDEC_USER_DATA_REGISTERED_ITU_T_T35 = 4, 59 VVDEC_USER_DATA_UNREGISTERED = 5, 60 VVDEC_FILM_GRAIN_CHARACTERISTICS = 19, 61 VVDEC_FRAME_PACKING = 45, 62 VVDEC_PARAMETER_SETS_INCLUSION_INDICATION = 129, 63 VVDEC_DECODING_UNIT_INFO = 130, 64 VVDEC_DECODED_PICTURE_HASH = 132, 65 VVDEC_SCALABLE_NESTING = 133, 66 VVDEC_MASTERING_DISPLAY_COLOUR_VOLUME = 137, 67 VVDEC_DEPENDENT_RAP_INDICATION = 145, 68 VVDEC_EQUIRECTANGULAR_PROJECTION = 150, 69 VVDEC_SPHERE_ROTATION = 154, 70 VVDEC_REGION_WISE_PACKING = 155, 71 VVDEC_OMNI_VIEWPORT = 156, 72 VVDEC_GENERALIZED_CUBEMAP_PROJECTION = 153, 73 VVDEC_FRAME_FIELD_INFO = 168, 74 VVDEC_SUBPICTURE_LEVEL_INFO = 203, 75 VVDEC_SAMPLE_ASPECT_RATIO_INFO = 204, 76 VVDEC_CONTENT_LIGHT_LEVEL_INFO = 144, 77 VVDEC_ALTERNATIVE_TRANSFER_CHARACTERISTICS = 147, 78 VVDEC_AMBIENT_VIEWING_ENVIRONMENT = 148, 79 VVDEC_CONTENT_COLOUR_VOLUME = 149, 80 VVDEC_SEI_UNKNOWN = -1, 81 }vvdecSEIPayloadType; 82 83 typedef enum 84 { 85 VVDEC_LEVEL_NONE = 0, 86 VVDEC_LEVEL1 = 16, 87 VVDEC_LEVEL2 = 32, 88 VVDEC_LEVEL2_1 = 35, 89 VVDEC_LEVEL3 = 48, 90 VVDEC_LEVEL3_1 = 51, 91 VVDEC_LEVEL4 = 64, 92 VVDEC_LEVEL4_1 = 67, 93 VVDEC_LEVEL5 = 80, 94 VVDEC_LEVEL5_1 = 83, 95 VVDEC_LEVEL5_2 = 86, 96 VVDEC_LEVEL6 = 96, 97 VVDEC_LEVEL6_1 = 99, 98 VVDEC_LEVEL6_2 = 102, 99 VVDEC_LEVEL15_5 = 255, 100 }vvdecLevel; 101 102 103 typedef enum 104 { 105 VVDEC_HASHTYPE_MD5 = 0, 106 VVDEC_HASHTYPE_CRC = 1, 107 VVDEC_HASHTYPE_CHECKSUM = 2, 108 VVDEC_HASHTYPE_NONE = 3, 109 VVDEC_NUMBER_OF_HASHTYPES = 4 110 }vvdecHashType; 111 112 /* vvdecSEI 113 The struct vvdecSEI contains the payload of a SEI message. 114 To get the data from the payload the SEI has to be type casted into target type 115 e.g. 116 vvdecSEIBufferingPeriod* s = reinterpret_cast<vvdecSEIBufferingPeriod *>(sei->payload); 117 */ 118 typedef struct vvdecSEI 119 { 120 vvdecSEIPayloadType payloadType; /* payload type as defined in sei.h */ 121 unsigned int size; /* size of payload in bytes */ 122 void *payload; /* payload structure as defined in sei.h */ 123 }vvdecSEI; 124 125 typedef struct vvdecSEIBufferingPeriod 126 { 127 bool bpNalCpbParamsPresentFlag; 128 bool bpVclCpbParamsPresentFlag; 129 uint32_t initialCpbRemovalDelayLength; 130 uint32_t cpbRemovalDelayLength; 131 uint32_t dpbOutputDelayLength; 132 int bpCpbCnt; 133 uint32_t duCpbRemovalDelayIncrementLength; 134 uint32_t dpbOutputDelayDuLength; 135 uint32_t initialCpbRemovalDelay [7][32][2]; 136 uint32_t initialCpbRemovalOffset[7][32][2]; 137 bool concatenationFlag; 138 uint32_t auCpbRemovalDelayDelta; 139 bool cpbRemovalDelayDeltasPresentFlag; 140 int numCpbRemovalDelayDeltas; 141 int bpMaxSubLayers; 142 uint32_t cpbRemovalDelayDelta[15]; 143 bool bpDecodingUnitHrdParamsPresentFlag; 144 bool decodingUnitCpbParamsInPicTimingSeiFlag; 145 bool decodingUnitDpbDuParamsInPicTimingSeiFlag; 146 bool sublayerInitialCpbRemovalDelayPresentFlag; 147 bool additionalConcatenationInfoPresentFlag; 148 uint32_t maxInitialRemovalDelayForConcatenation; 149 bool sublayerDpbOutputOffsetsPresentFlag; 150 uint32_t dpbOutputTidOffset[7]; 151 bool altCpbParamsPresentFlag; 152 bool useAltCpbParamsFlag; 153 } vvdecSEIBufferingPeriod; 154 155 156 typedef struct vvdecSEIPictureTiming 157 { 158 bool ptSubLayerDelaysPresentFlag[7]; 159 bool cpbRemovalDelayDeltaEnabledFlag[7]; 160 uint32_t cpbRemovalDelayDeltaIdx[7]; 161 uint32_t auCpbRemovalDelay[7]; 162 uint32_t picDpbOutputDelay; 163 uint32_t picDpbOutputDuDelay; 164 uint32_t numDecodingUnits; 165 bool duCommonCpbRemovalDelayFlag; 166 uint32_t duCommonCpbRemovalDelay[7]; 167 uint32_t numNalusInDu[32]; 168 uint32_t duCpbRemovalDelay[32*7+7]; 169 bool cpbAltTimingInfoPresentFlag; 170 uint32_t nalCpbAltInitialRemovalDelayDelta[7][32]; 171 uint32_t nalCpbAltInitialRemovalOffsetDelta[7][32]; 172 uint32_t nalCpbDelayOffset[7]; 173 uint32_t nalDpbDelayOffset[7]; 174 uint32_t vclCpbAltInitialRemovalDelayDelta[7][32]; 175 uint32_t vclCpbAltInitialRemovalOffsetDelta[7][32]; 176 uint32_t vclCpbDelayOffset[7]; 177 uint32_t vclDpbDelayOffset[7]; 178 int ptDisplayElementalPeriods; 179 } vvdecSEIPictureTiming; 180 181 182 typedef struct vvdecSEIUserDataRegistered 183 { 184 uint16_t ituCountryCode; 185 uint32_t userDataLength; 186 uint8_t *userData; 187 } vvdecSEIUserDataRegistered; 188 189 typedef struct vvdecSEIUserDataUnregistered 190 { 191 uint8_t uuid_iso_iec_11578[16]; 192 uint32_t userDataLength; 193 uint8_t *userData; 194 } vvdecSEIUserDataUnregistered; 195 196 197 typedef struct vvdecCompModelIntensityValues 198 { 199 uint8_t intensityIntervalLowerBound; 200 uint8_t intensityIntervalUpperBound; 201 int compModelValue[6]; 202 }vvdecCompModelIntensityValues; 203 204 typedef struct vvdecCompModel 205 { 206 bool presentFlag; 207 uint8_t numModelValues; 208 vvdecCompModelIntensityValues intensityValues[256]; 209 }vvdecCompModel; 210 211 typedef struct vvdecSEIFilmGrainCharacteristics 212 { 213 bool filmGrainCharacteristicsCancelFlag; 214 uint8_t filmGrainModelId; 215 bool separateColourDescriptionPresentFlag; 216 uint8_t filmGrainBitDepthLuma; 217 uint8_t filmGrainBitDepthChroma; 218 bool filmGrainFullRangeFlag; 219 uint8_t filmGrainColourPrimaries; 220 uint8_t filmGrainTransferCharacteristics; 221 uint8_t filmGrainMatrixCoeffs; 222 uint8_t blendingModeId; 223 uint8_t log2ScaleFactor; 224 vvdecCompModel compModel[3]; 225 bool filmGrainCharacteristicsPersistenceFlag; 226 }vvdecSEIFilmGrainCharacteristics; 227 228 typedef struct vvdecSEIFramePacking 229 { 230 int arrangementId; 231 bool arrangementCancelFlag; 232 int arrangementType; 233 bool quincunxSamplingFlag; 234 int contentInterpretationType; 235 bool spatialFlippingFlag; 236 bool frame0FlippedFlag; 237 bool fieldViewsFlag; 238 bool currentFrameIsFrame0Flag; 239 bool frame0SelfContainedFlag; 240 bool frame1SelfContainedFlag; 241 int frame0GridPositionX; 242 int frame0GridPositionY; 243 int frame1GridPositionX; 244 int frame1GridPositionY; 245 int arrangementReservedByte; 246 bool arrangementPersistenceFlag; 247 bool upsampledAspectRatio; 248 }vvdecSEIFramePacking; 249 250 typedef struct vvdecSEIParameterSetsInclusionIndication 251 { 252 int selfContainedClvsFlag; 253 }vvdecSEIParameterSetsInclusionIndication; 254 255 typedef struct vvdecSEIDecodingUnitInfo 256 { 257 int decodingUnitIdx; 258 bool duiSubLayerDelaysPresentFlag[7]; 259 int duSptCpbRemovalDelayIncrement[7]; 260 bool dpbOutputDuDelayPresentFlag; 261 int picSptDpbOutputDuDelay; 262 }vvdecSEIDecodingUnitInfo; 263 264 265 typedef struct vvdecSEIDecodedPictureHash 266 { 267 vvdecHashType method; 268 bool singleCompFlag; 269 int digist_length; 270 unsigned char digest[16*3]; 271 }vvdecSEIDecodedPictureHash; 272 273 274 typedef struct vvdecSEIScalableNesting 275 { 276 bool snOlsFlag; 277 bool snSubpicFlag; 278 uint32_t snNumOlss; 279 uint32_t snOlsIdxDelta[64]; 280 uint32_t snOlsIdx[64]; 281 bool snAllLayersFlag; 282 uint32_t snNumLayers; 283 uint8_t snLayerId[64]; 284 uint32_t snNumSubpics; 285 uint8_t snSubpicIdLen; 286 uint16_t snSubpicId[64]; 287 uint32_t snNumSEIs; 288 289 vvdecSEI* nestedSEIs[64]; 290 }vvdecSEIScalableNesting; 291 292 typedef struct vvdecSEIMasteringDisplayColourVolume 293 { 294 uint32_t maxLuminance; 295 uint32_t minLuminance; 296 uint16_t primaries[3][2]; 297 uint16_t whitePoint[2]; 298 }vvdecSEIMasteringDisplayColourVolume; 299 300 typedef struct vvdecSEIDependentRapIndication 301 { 302 } vvdecSEIDependentRapIndication; 303 304 typedef struct vvdecSEIEquirectangularProjection 305 { 306 bool erpCancelFlag; 307 bool erpPersistenceFlag; 308 bool erpGuardBandFlag; 309 uint8_t erpGuardBandType; 310 uint8_t erpLeftGuardBandWidth; 311 uint8_t erpRightGuardBandWidth; 312 }vvdecSEIEquirectangularProjection; 313 314 typedef struct vvdecSEISphereRotation 315 { 316 bool sphereRotationCancelFlag; 317 bool sphereRotationPersistenceFlag; 318 int sphereRotationYaw; 319 int sphereRotationPitch; 320 int sphereRotationRoll; 321 }vvdecSEISphereRotation; 322 323 typedef struct vvdecSEIRegionWisePacking 324 { 325 bool rwpCancelFlag; 326 bool rwpPersistenceFlag; 327 bool constituentPictureMatchingFlag; 328 int numPackedRegions; 329 int projPictureWidth; 330 int projPictureHeight; 331 int packedPictureWidth; 332 int packedPictureHeight; 333 uint8_t rwpTransformType[256]; 334 bool rwpGuardBandFlag[256]; 335 uint32_t projRegionWidth[256]; 336 uint32_t projRegionHeight[256]; 337 uint32_t rwpProjRegionTop[256]; 338 uint32_t projRegionLeft[256]; 339 uint16_t packedRegionWidth[256]; 340 uint16_t packedRegionHeight[256]; 341 uint16_t packedRegionTop[256]; 342 uint16_t packedRegionLeft[256]; 343 uint8_t rwpLeftGuardBandWidth[256]; 344 uint8_t rwpRightGuardBandWidth[256]; 345 uint8_t rwpTopGuardBandHeight[256]; 346 uint8_t rwpBottomGuardBandHeight[256]; 347 bool rwpGuardBandNotUsedForPredFlag[256]; 348 uint8_t rwpGuardBandType[4*256]; 349 }vvdecSEIRegionWisePacking; 350 351 typedef struct vvdecOmniViewportRegion 352 { 353 int azimuthCentre; 354 int elevationCentre; 355 int tiltCentre; 356 uint32_t horRange; 357 uint32_t verRange; 358 }vvdecOmniViewportRegion; 359 360 typedef struct vvdecSEIOmniViewport 361 { 362 uint32_t omniViewportId; 363 bool omniViewportCancelFlag; 364 bool omniViewportPersistenceFlag; 365 uint8_t omniViewportCnt; 366 vvdecOmniViewportRegion omniViewportRegions[16]; 367 }vvdecSEIOmniViewport; 368 369 370 typedef struct vvdecSEIGeneralizedCubemapProjection 371 { 372 bool gcmpCancelFlag; 373 bool gcmpPersistenceFlag; 374 uint8_t gcmpPackingType; 375 uint8_t gcmpMappingFunctionType; 376 uint8_t gcmpFaceIndex[6]; 377 uint8_t gcmpFaceRotation[6]; 378 uint8_t gcmpFunctionCoeffU[6]; 379 bool gcmpFunctionUAffectedByVFlag[6]; 380 uint8_t gcmpFunctionCoeffV[6]; 381 bool gcmpFunctionVAffectedByUFlag[6]; 382 bool gcmpGuardBandFlag; 383 uint8_t gcmpGuardBandType; 384 bool gcmpGuardBandBoundaryExteriorFlag; 385 uint8_t gcmpGuardBandSamples; 386 }vvdecSEIGeneralizedCubemapProjection; 387 388 typedef struct vvdecSEIFrameFieldInfo 389 { 390 bool fieldPicFlag; 391 bool bottomFieldFlag; 392 bool pairingIndicatedFlag; 393 bool pairedWithNextFieldFlag; 394 bool displayFieldsFromFrameFlag; 395 bool topFieldFirstFlag; 396 int displayElementalPeriods; 397 int sourceScanType; 398 bool duplicateFlag; 399 }vvdecSEIFrameFieldInfo; 400 401 typedef struct vvdecSEISubpictureLevelInfo 402 { 403 int numRefLevels; 404 bool explicitFractionPresentFlag; 405 bool cbrConstraintFlag; 406 int numSubpics; 407 int sliMaxSublayers; 408 bool sliSublayerInfoPresentFlag; 409 int nonSubpicLayersFraction[6][6]; 410 vvdecLevel refLevelIdc[6][6]; 411 int refLevelFraction[6][64][6]; 412 }vvdecSEISubpictureLevelInfo; 413 414 typedef struct vvdecSEISampleAspectRatioInfo 415 { 416 bool sariCancelFlag; 417 bool sariPersistenceFlag; 418 int sariAspectRatioIdc; 419 int sariSarWidth; 420 int sariSarHeight; 421 }vvdecSEISampleAspectRatioInfo; 422 423 typedef struct vvdecSEIContentLightLevelInfo 424 { 425 uint16_t maxContentLightLevel; 426 uint16_t maxPicAverageLightLevel; 427 }vvdecSEIContentLightLevelInfo; 428 429 typedef struct vvdecSEIAlternativeTransferCharacteristics 430 { 431 uint8_t preferred_transfer_characteristics; 432 }vvdecSEIAlternativeTransferCharacteristics; 433 434 typedef struct vvdecSEIAmbientViewingEnvironment 435 { 436 uint32_t ambientIlluminance; 437 uint16_t ambientLightX; 438 uint16_t ambientLightY; 439 }vvdecSEIAmbientViewingEnvironment; 440 441 typedef struct vvdecSEIContentColourVolume 442 { 443 bool ccvCancelFlag; 444 bool ccvPersistenceFlag; 445 bool ccvPrimariesPresentFlag; 446 bool ccvMinLuminanceValuePresentFlag; 447 bool ccvMaxLuminanceValuePresentFlag; 448 bool ccvAvgLuminanceValuePresentFlag; 449 int ccvPrimariesX[3]; 450 int ccvPrimariesY[3]; 451 uint32_t ccvMinLuminanceValue; 452 uint32_t ccvMaxLuminanceValue; 453 uint32_t ccvAvgLuminanceValue; 454 }vvdecSEIContentColourVolume; 455 456 #endif /*_VVDEC_SEI_H_*/ 457