1 /*! 2 * \copy 3 * Copyright (c) 2013, Cisco Systems 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 * 31 */ 32 33 #ifndef WELS_PARAMETER_SETS_H__ 34 #define WELS_PARAMETER_SETS_H__ 35 36 #include "typedefs.h" 37 #include "wels_const.h" 38 #include "wels_common_basis.h" 39 40 namespace WelsEnc { 41 42 /* Sequence Parameter Set, refer to Page 57 in JVT X201wcm */ 43 typedef struct TagWelsSPS { 44 uint32_t uiSpsId; 45 int16_t iMbWidth; 46 int16_t iMbHeight; 47 uint32_t uiLog2MaxFrameNum; 48 // uint32_t uiPocType; 49 /* POC type 0 */ 50 int32_t iLog2MaxPocLsb; 51 /* POC type 1 */ 52 // int32_t iOffsetForNonRefPic; 53 54 // int32_t iOffsetForTopToBottomField; 55 // int32_t iNumRefFramesInPocCycle; 56 // int8_t iOffsetForRefFrame[256]; 57 SCropOffset sFrameCrop; 58 int16_t iNumRefFrames; 59 // uint32_t uiNumUnitsInTick; 60 // uint32_t uiTimeScale; 61 62 uint8_t uiProfileIdc; 63 uint8_t iLevelIdc; 64 // uint8_t uiChromaFormatIdc; 65 // uint8_t uiChromaArrayType; //support =1 66 67 // uint8_t uiBitDepthLuma; //=8, only used in decoder, encoder in general_***; it can be removed when removed general up_sample 68 // uint8_t uiBitDepthChroma; //=8 69 /* TO BE CONTINUE: POC type 1 */ 70 // bool bDeltaPicOrderAlwaysZeroFlag; 71 bool bGapsInFrameNumValueAllowedFlag; 72 73 // bool bFrameMbsOnlyFlag; 74 // bool bMbaffFlag; // MB Adapative Frame Field 75 // bool bDirect8x8InferenceFlag; 76 bool bFrameCroppingFlag; 77 78 bool bVuiParamPresentFlag; 79 // bool bTimingInfoPresentFlag; 80 // bool bFixedFrameRateFlag; 81 82 // Note: members bVideoSignalTypePresent through uiColorMatrix below are also defined in SSpatialLayerConfig in codec_app_def.h, 83 // along with definitions for enumerators EVideoFormatSPS, EColorPrimaries, ETransferCharacteristics, and EColorMatrix. 84 bool bVideoSignalTypePresent; // false => do not write any of the following information to the header 85 uint8_t uiVideoFormat; // EVideoFormatSPS; 3 bits in header; 0-5 => component, kpal, ntsc, secam, mac, undef 86 bool bFullRange; // false => analog video data range [16, 235]; true => full data range [0,255] 87 bool bColorDescriptionPresent; // false => do not write any of the following three items to the header 88 uint8_t uiColorPrimaries; // EColorPrimaries; 8 bits in header; 0 - 9 => ???, bt709, undef, ???, bt470m, bt470bg, 89 // smpte170m, smpte240m, film, bt2020 90 uint8_t uiTransferCharacteristics; // ETransferCharacteristics; 8 bits in header; 0 - 15 => ???, bt709, undef, ???, bt470m, bt470bg, smpte170m, 91 // smpte240m, linear, log100, log316, iec61966-2-4, bt1361e, iec61966-2-1, bt2020-10, bt2020-12 92 uint8_t uiColorMatrix; // EColorMatrix; 8 bits in header (corresponds to FFmpeg "colorspace"); 0 - 10 => GBR, bt709, 93 // undef, ???, fcc, bt470bg, smpte170m, smpte240m, YCgCo, bt2020nc, bt2020c 94 95 bool bConstraintSet0Flag; 96 bool bConstraintSet1Flag; 97 bool bConstraintSet2Flag; 98 bool bConstraintSet3Flag; 99 // bool bSeparateColorPlaneFlag; // =false,: only used in decoder, encoder in general_***; it can be removed when removed general up_sample 100 101 // aspect ratio in VUI 102 bool bAspectRatioPresent; 103 ESampleAspectRatio eAspectRatio; 104 uint16_t sAspectRatioExtWidth; 105 uint16_t sAspectRatioExtHeight; 106 107 } SWelsSPS, *PWelsSPS; 108 109 110 /* Sequence Parameter Set SVC extension syntax, refer to Page 391 in JVT X201wcm */ 111 typedef struct TagSpsSvcExt { 112 // SCropOffset sSeqScaledRefLayer; 113 114 uint8_t iExtendedSpatialScalability; // ESS 115 // uint8_t uiChromaPhaseXPlus1Flag; 116 // uint8_t uiChromaPhaseYPlus1; 117 // uint8_t uiSeqRefLayerChromaPhaseXPlus1Flag; 118 // uint8_t uiSeqRefLayerChromaPhaseYPlus1; 119 // bool bInterLayerDeblockingFilterCtrlPresentFlag; 120 bool bSeqTcoeffLevelPredFlag; 121 bool bAdaptiveTcoeffLevelPredFlag; 122 bool bSliceHeaderRestrictionFlag; 123 } SSpsSvcExt, *PSpsSvcExt; 124 125 /* Subset sequence parameter set syntax, refer to Page 391 in JVT X201wcm */ 126 typedef struct TagSubsetSps { 127 SWelsSPS pSps; 128 SSpsSvcExt sSpsSvcExt; 129 130 // bool bSvcVuiParamPresentFlag; 131 // bool bAdditionalExtension2Flag; 132 // bool bAdditionalExtension2DataFlag; 133 } SSubsetSps, *PSubsetSps; 134 135 /* Picture parameter set syntax, refer to Page 59 in JVT X201wcm */ 136 typedef struct TagWelsPPS { 137 uint32_t iSpsId; 138 uint32_t iPpsId; 139 140 #if !defined(DISABLE_FMO_FEATURE) 141 uint32_t uiNumSliceGroups; 142 uint32_t uiSliceGroupMapType; 143 /* uiSliceGroupMapType = 0 */ 144 uint32_t uiRunLength[MAX_SLICEGROUP_IDS]; 145 /* uiSliceGroupMapType = 2 */ 146 uint32_t uiTopLeft[MAX_SLICEGROUP_IDS]; 147 uint32_t uiBottomRight[MAX_SLICEGROUP_IDS]; 148 /* uiSliceGroupMapType = 3, 4 or 5 */ 149 /* uiSliceGroupMapType = 3, 4 or 5 */ 150 bool bSliceGroupChangeDirectionFlag; 151 uint32_t uiSliceGroupChangeRate; 152 /* uiSliceGroupMapType = 6 */ 153 uint32_t uiPicSizeInMapUnits; 154 uint32_t uiSliceGroupId[MAX_SLICEGROUP_IDS]; 155 #endif//!DISABLE_FMO_FEATURE 156 157 // uint32_t uiNumRefIdxL0Active; 158 // uint32_t uiNumRefIdxL1Active; 159 160 int8_t iPicInitQp; 161 int8_t iPicInitQs; 162 uint8_t uiChromaQpIndexOffset; 163 164 /* potential application for High profile */ 165 // int32_t iSecondChromaQpIndexOffset; 166 // /* potential application for High profile */ 167 168 // bool bPicOrderPresentFlag; 169 bool bEntropyCodingModeFlag; 170 bool bDeblockingFilterControlPresentFlag; 171 172 // bool bConstainedIntraPredFlag; 173 // bool bRedundantPicCntPresentFlag; 174 // bool bWeightedPredFlag; 175 // uint8_t uiWeightedBiPredIdc; 176 177 } SWelsPPS, *PWelsPPPS; 178 179 } 180 181 #endif //WELS_PARAMETER_SETS_H__ 182