• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 WelsDec {
41 /* VUI syntax in Sequence Parameter Set, refer to E.1 in Rec */
42 typedef struct TagVui {
43   bool bAspectRatioInfoPresentFlag;
44   uint32_t uiAspectRatioIdc;
45   uint32_t uiSarWidth;
46   uint32_t uiSarHeight;
47   bool bOverscanInfoPresentFlag;
48   bool bOverscanAppropriateFlag;
49   bool bVideoSignalTypePresentFlag;
50   uint8_t uiVideoFormat;
51   bool bVideoFullRangeFlag;
52   bool bColourDescripPresentFlag;
53   uint8_t uiColourPrimaries;
54   uint8_t uiTransferCharacteristics;
55   uint8_t uiMatrixCoeffs;
56   bool bChromaLocInfoPresentFlag;
57   uint32_t uiChromaSampleLocTypeTopField;
58   uint32_t uiChromaSampleLocTypeBottomField;
59   bool bTimingInfoPresentFlag;
60   uint32_t uiNumUnitsInTick;
61   uint32_t uiTimeScale;
62   bool bFixedFrameRateFlag;
63   bool bNalHrdParamPresentFlag;
64   bool bVclHrdParamPresentFlag;
65   bool bPicStructPresentFlag;
66   bool bBitstreamRestrictionFlag;
67   bool bMotionVectorsOverPicBoundariesFlag;
68   uint32_t uiMaxBytesPerPicDenom;
69   uint32_t uiMaxBitsPerMbDenom;
70   uint32_t uiLog2MaxMvLengthHorizontal;
71   uint32_t uiLog2MaxMvLengthVertical;
72   uint32_t uiMaxNumReorderFrames;
73   uint32_t uiMaxDecFrameBuffering;
74 } SVui, *PVui;
75 
76 /* Sequence Parameter Set, refer to Page 57 in JVT X201wcm */
77 typedef struct TagSps {
78   int32_t       iSpsId;
79   uint32_t      iMbWidth;
80   uint32_t      iMbHeight;
81   uint32_t      uiTotalMbCount; //used in decode_slice_data()
82 
83   uint32_t      uiLog2MaxFrameNum;
84   uint32_t      uiPocType;
85   /* POC type 0 */
86   int32_t       iLog2MaxPocLsb;
87   /* POC type 1 */
88   int32_t       iOffsetForNonRefPic;
89 
90   int32_t       iOffsetForTopToBottomField;
91   int32_t       iNumRefFramesInPocCycle;
92   int8_t        iOffsetForRefFrame[256];
93   int32_t       iNumRefFrames;
94 
95   SPosOffset    sFrameCrop;
96 
97   ProfileIdc    uiProfileIdc;
98   uint8_t       uiLevelIdc;
99   uint8_t       uiChromaFormatIdc;
100   uint8_t       uiChromaArrayType;
101 
102   uint8_t       uiBitDepthLuma;
103   uint8_t       uiBitDepthChroma;
104   /* TO BE CONTINUE: POC type 1 */
105   bool          bDeltaPicOrderAlwaysZeroFlag;
106   bool          bGapsInFrameNumValueAllowedFlag;
107 
108   bool          bFrameMbsOnlyFlag;
109   bool          bMbaffFlag;     // MB Adapative Frame Field
110   bool          bDirect8x8InferenceFlag;
111   bool          bFrameCroppingFlag;
112 
113   bool          bVuiParamPresentFlag;
114 //  bool          bTimingInfoPresentFlag;
115 //  bool          bFixedFrameRateFlag;
116   bool          bConstraintSet0Flag;
117   bool          bConstraintSet1Flag;
118   bool          bConstraintSet2Flag;
119   bool          bConstraintSet3Flag;
120   bool          bSeparateColorPlaneFlag;
121   bool          bQpPrimeYZeroTransfBypassFlag;
122   bool          bSeqScalingMatrixPresentFlag;
123   bool          bSeqScalingListPresentFlag[12];
124   //Add scaling list supporting
125   uint8_t  iScalingList4x4[6][16];
126   uint8_t  iScalingList8x8[6][64];
127   SVui sVui;
128   const SLevelLimits* pSLevelLimits;
129 } SSps, *PSps;
130 
131 
132 /* Sequence Parameter Set extension syntax, refer to Page 58 in JVT X201wcm */
133 //typedef struct TagSpsExt{
134 //  uint32_t      iSpsId;
135 //  uint32_t      uiAuxFormatIdc;
136 //  int32_t       iAlphaOpaqueValue;
137 //  int32_t       iAlphaTransparentValue;
138 
139 //  uint8_t       uiBitDepthAux;
140 //  bool          bAlphaIncrFlag;
141 //  bool          bAdditionalExtFlag;
142 //}SSpsExt, *PSpsExt;
143 
144 /* Sequence Parameter Set extension syntax, refer to Page 391 in JVT X201wcm */
145 typedef struct TagSpsSvcExt {
146   SPosOffset    sSeqScaledRefLayer;
147 
148   uint8_t       uiExtendedSpatialScalability;   // ESS
149   uint8_t       uiChromaPhaseXPlus1Flag;
150   uint8_t       uiChromaPhaseYPlus1;
151   uint8_t       uiSeqRefLayerChromaPhaseXPlus1Flag;
152   uint8_t       uiSeqRefLayerChromaPhaseYPlus1;
153   bool          bInterLayerDeblockingFilterCtrlPresentFlag;
154   bool          bSeqTCoeffLevelPredFlag;
155   bool          bAdaptiveTCoeffLevelPredFlag;
156   bool          bSliceHeaderRestrictionFlag;
157 } SSpsSvcExt, *PSpsSvcExt;
158 
159 /* Subset sequence parameter set syntax, refer to Page 391 in JVT X201wcm */
160 typedef struct TagSubsetSps {
161   SSps          sSps;
162   SSpsSvcExt    sSpsSvcExt;
163   bool          bSvcVuiParamPresentFlag;
164   bool          bAdditionalExtension2Flag;
165   bool          bAdditionalExtension2DataFlag;
166 } SSubsetSps, *PSubsetSps;
167 
168 /* Picture parameter set syntax, refer to Page 59 in JVT X201wcm */
169 typedef struct TagPps {
170   int32_t       iSpsId;
171   int32_t       iPpsId;
172 
173   uint32_t      uiNumSliceGroups;
174   uint32_t      uiSliceGroupMapType;
175   /* slice_group_map_type = 0 */
176   uint32_t      uiRunLength[MAX_SLICEGROUP_IDS];
177   /* slice_group_map_type = 2 */
178   uint32_t      uiTopLeft[MAX_SLICEGROUP_IDS];
179   uint32_t      uiBottomRight[MAX_SLICEGROUP_IDS];
180   /* slice_group_map_type = 3, 4 or 5 */
181   uint32_t      uiSliceGroupChangeRate;
182   /* slice_group_map_type = 6 */
183   uint32_t      uiPicSizeInMapUnits;
184   uint32_t      uiSliceGroupId[MAX_SLICEGROUP_IDS];
185 
186   uint32_t      uiNumRefIdxL0Active;
187   uint32_t      uiNumRefIdxL1Active;
188 
189   int32_t       iPicInitQp;
190   int32_t       iPicInitQs;
191   int32_t       iChromaQpIndexOffset[2];//cb,cr
192 
193   bool          bEntropyCodingModeFlag;
194   bool          bPicOrderPresentFlag;
195   /* slice_group_map_type = 3, 4 or 5 */
196   bool          bSliceGroupChangeDirectionFlag;
197   bool          bDeblockingFilterControlPresentFlag;
198 
199   bool          bConstainedIntraPredFlag;
200   bool          bRedundantPicCntPresentFlag;
201   bool          bWeightedPredFlag;
202   uint8_t       uiWeightedBipredIdc;
203 
204   bool    bTransform8x8ModeFlag;
205   //Add for scalinglist support
206   bool    bPicScalingMatrixPresentFlag;
207   bool    bPicScalingListPresentFlag[12];
208   uint8_t  iScalingList4x4[6][16];
209   uint8_t  iScalingList8x8[6][64];
210 
211   int32_t iSecondChromaQPIndexOffset; //second_chroma_qp_index_offset
212 
213 } SPps, *PPps;
214 
215 } // namespace WelsDec
216 
217 #endif //WELS_PARAMETER_SETS_H__
218