1 /*****************************************************************************
2 * Copyright (C) 2014 x265 project
4 * Authors: Steve Borho <steve@borho.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
20 * This program is also available under a commercial proprietary license.
21 * For more information, contact us at license @ x265.com.
22 *****************************************************************************/
34 class MotionReference
;
46 int numberOfNegativePictures
;
47 int numberOfPositivePictures
;
49 int poc
[MAX_NUM_REF_PICS
];
50 int deltaPOC
[MAX_NUM_REF_PICS
];
51 bool bUsed
[MAX_NUM_REF_PICS
];
55 , numberOfNegativePictures(0)
56 , numberOfPositivePictures(0)
58 ::memset(deltaPOC
, 0, sizeof(deltaPOC
));
59 ::memset(poc
, 0, sizeof(poc
));
60 ::memset(bUsed
, 0, sizeof(bUsed
));
74 HIGHTHROUGHPUTREXT
= 5
104 struct ProfileTierLevel
107 bool progressiveSourceFlag
;
108 bool interlacedSourceFlag
;
109 bool nonPackedConstraintFlag
;
110 bool frameOnlyConstraintFlag
;
111 bool profileCompatibilityFlag
[32];
112 bool intraConstraintFlag
;
113 bool lowerBitRateConstraintFlag
;
116 uint32_t minCrForLevel
;
117 uint32_t maxLumaSrForLevel
;
118 uint32_t bitDepthConstraint
;
119 int chromaFormatConstraint
;
124 uint32_t bitRateScale
;
125 uint32_t cpbSizeScale
;
126 uint32_t initialCpbRemovalDelayLength
;
127 uint32_t cpbRemovalDelayLength
;
128 uint32_t dpbOutputDelayLength
;
129 uint32_t bitRateValue
;
130 uint32_t cpbSizeValue
;
136 , initialCpbRemovalDelayLength(1)
137 , cpbRemovalDelayLength(1)
138 , dpbOutputDelayLength(1)
146 uint32_t numUnitsInTick
;
152 uint32_t numReorderPics
;
153 uint32_t maxDecPicBuffering
;
154 HRDInfo hrdParameters
;
155 ProfileTierLevel ptl
;
174 bool aspectRatioInfoPresentFlag
;
179 bool overscanInfoPresentFlag
;
180 bool overscanAppropriateFlag
;
182 bool videoSignalTypePresentFlag
;
184 bool videoFullRangeFlag
;
186 bool colourDescriptionPresentFlag
;
188 int transferCharacteristics
;
189 int matrixCoefficients
;
191 bool chromaLocInfoPresentFlag
;
192 int chromaSampleLocTypeTopField
;
193 int chromaSampleLocTypeBottomField
;
195 Window defaultDisplayWindow
;
197 bool frameFieldInfoPresentFlag
;
200 bool hrdParametersPresentFlag
;
201 HRDInfo hrdParameters
;
203 TimingInfo timingInfo
;
208 int chromaFormatIdc
; // use param
209 uint32_t picWidthInLumaSamples
; // use param
210 uint32_t picHeightInLumaSamples
; // use param
212 uint32_t numCuInWidth
;
213 uint32_t numCuInHeight
;
214 uint32_t numCUsInFrame
;
215 uint32_t numPartitions
;
216 uint32_t numPartInCUSize
;
218 int log2MinCodingBlockSize
;
219 int log2DiffMaxMinCodingBlockSize
;
221 uint32_t quadtreeTULog2MaxSize
;
222 uint32_t quadtreeTULog2MinSize
;
224 uint32_t quadtreeTUMaxDepthInter
; // use param
225 uint32_t quadtreeTUMaxDepthIntra
; // use param
227 bool bUseSAO
; // use param
228 bool bUseAMP
; // use param
229 uint32_t maxAMPDepth
;
231 uint32_t maxDecPicBuffering
; // these are dups of VPS values
234 bool bUseStrongIntraSmoothing
; // use param
235 bool bTemporalMVPEnabled
;
237 Window conformanceWindow
;
243 uint32_t maxCuDQPDepth
;
245 int chromaCbQpOffset
; // use param
246 int chromaCrQpOffset
; // use param
248 bool bUseWeightPred
; // use param
249 bool bUseWeightedBiPred
; // use param
251 bool bConstrainedIntraPred
; // use param
253 bool bTransquantBypassEnabled
; // Indicates presence of cu_transquant_bypass_flag in CUs.
254 bool bTransformSkipEnabled
; // use param
255 bool bEntropyCodingSyncEnabled
; // use param
256 bool bSignHideEnabled
; // use param
258 bool bDeblockingFilterControlPresent
;
259 bool bPicDisableDeblockingFilter
;
260 int deblockingFilterBetaOffsetDiv2
;
261 int deblockingFilterTcOffsetDiv2
;
266 // Explicit weighted prediction parameters parsed in slice header,
268 uint32_t log2WeightDenom
;
272 /* makes a non-h265 weight (i.e. fix7), into an h265 weight */
273 void setFromWeightAndOffset(int w
, int o
, int denom
, bool bNormalize
)
276 log2WeightDenom
= denom
;
278 while (bNormalize
&& log2WeightDenom
> 0 && (inputWeight
> 127))
284 inputWeight
= X265_MIN(inputWeight
, 127);
294 WeightParam m_weightPredTable
[2][MAX_NUM_REF
][3]; // [list][refIdx][0:Y, 1:U, 2:V]
295 MotionReference (*m_mref
)[MAX_NUM_REF
+ 1];
298 NalUnitType m_nalUnitType
;
299 SliceType m_sliceType
;
305 bool m_bCheckLDC
; // TODO: is this necessary?
306 bool m_sLFaseFlag
; // loop filter boundary flag
307 bool m_colFromL0Flag
; // collocated picture from List0 or List1 flag
308 uint32_t m_colRefIdx
; // never modified
311 Frame
* m_refPicList
[2][MAX_NUM_REF
+ 1];
312 int m_refPOCList
[2][MAX_NUM_REF
+ 1];
314 uint32_t m_maxNumMergeCand
; // use param
315 uint32_t m_endCUAddr
;
321 m_numRefIdx
[0] = m_numRefIdx
[1] = 0;
322 for (int i
= 0; i
< MAX_NUM_REF
; i
++)
324 m_refPicList
[0][i
] = NULL
;
325 m_refPicList
[1][i
] = NULL
;
326 m_refPOCList
[0][i
] = 0;
327 m_refPOCList
[1][i
] = 0;
333 void disableWeights();
335 void setRefPicList(PicList
& picList
);
337 bool getRapPicFlag() const
339 return m_nalUnitType
== NAL_UNIT_CODED_SLICE_IDR_W_RADL
340 || m_nalUnitType
== NAL_UNIT_CODED_SLICE_CRA
;
343 bool getIdrPicFlag() const
345 return m_nalUnitType
== NAL_UNIT_CODED_SLICE_IDR_W_RADL
;
348 bool isIRAP() const { return m_nalUnitType
>= 16 && m_nalUnitType
<= 23; }
350 bool isIntra() const { return m_sliceType
== I_SLICE
; }
352 bool isInterB() const { return m_sliceType
== B_SLICE
; }
354 bool isInterP() const { return m_sliceType
== P_SLICE
; }
356 uint32_t realEndAddress(uint32_t endCUAddr
) const;
361 #endif // ifndef X265_SLICE_H