[x265] h265.h:Proposed replacement of HM's h265 classes
dave
dtyx265 at gmail.com
Sat Apr 12 00:32:01 CEST 2014
Below is my proposed replacement for many of the H265 classes and
structures in TComSlice.h.
All have at least basic constructor but no methods and most probably
won't need additional methods that do much more than set fields which
can be added when needed.
A few structures have non-H265 fields that at least in HM code appear to
be useful for encoding frames.
I have configured the classes so the Encoder class would have an
instance each H265 class so that when an object is part of multiple H265
structures, only one instance is needed.
Where fields are taken from either the Encoder class or x265_param I
have used references instead of copying the field or using a pointer. I
don't think this will create any concurrency issues since the fields
shouldn't need to be changed once they are set but if there are then the
references can be replaced with copies.
I tried to setup constructors to replace init methods where applicable.
I haven't started integrating it into x265, when everyone's happy with
it I can start replacing HM's classes with these.
The file is also attached to this email
#ifndef X265_H265_H
#define X265_H265_H
#include "CommonDef.h"
#include "x265.h" // NAL type enums
#include "common.h"
namespace x265 {
// private x265 namespace
// Timing Info is used in the VUI and VPS
class TimingInfo
{
public:
bool m_timingInfoPresentFlag;
uint32_t m_numUnitsInTick; //aka fpsNum
uint32_t m_timeScale; //aka fpsDenom
bool m_pocProportionalToTimingFlag;
int m_numTicksPocDiffOneMinus1;
TimingInfo()
: m_timingInfoPresentFlag(false)
, m_numUnitsInTick(1001)
, m_timeScale(60000)
, m_pocProportionalToTimingFlag(false)
, m_numTicksPocDiffOneMinus1(0)
{}
TimingInfo(x265_param* p)
: m_timingInfoPresentFlag(p->vui.bEnableVuiTimingInfoPresentFlag)
, m_numUnitsInTick(p->fpsDenom)
, m_timeScale(p->fpsNum)
, m_pocProportionalToTimingFlag(false)
, m_numTicksPocDiffOneMinus1(0)
{}
};
// Window is used for the VUI Default Display Window and SPS Conformance
Window and possibly for the SEI pan_scan_rect
class Window
{
public:
bool m_enabledFlag;
int m_winLeftOffset;
int m_winRightOffset;
int m_winTopOffset;
int m_winBottomOffset;
Window()
: m_enabledFlag(false)
, m_winLeftOffset(0)
, m_winRightOffset(0)
, m_winTopOffset(0)
, m_winBottomOffset(0)
{}
Window(x265_param* p)
: m_enabledFlag(p->vui.bEnableDefaultDisplayWindowFlag)
, m_winLeftOffset(p->vui.defDispWinLeftOffset)
, m_winRightOffset(p->vui.defDispWinRightOffset)
, m_winTopOffset(p->vui.defDispWinTopOffset)
, m_winBottomOffset(p->vui.defDispWinBottomOffset)
{}
};
//Sub Layer Ordering Info is used in the VPS and SPS
class SubLayerOrderingInfo
{
public:
bool m_subLayerOrderingInfoPresentFlag;
uint32_t m_maxDecPicBufferingMinus1[MAX_TLAYER];
uint32_t m_maxNumReorderPics[MAX_TLAYER];
uint32_t m_maxLatencyIncreasePlus1[MAX_TLAYER];
SubLayerOrderingInfo()
{
m_subLayerOrderingInfoPresentFlag = false;
for (int i = 0; i < MAX_TLAYER; i++)
{
m_maxDecPicBufferingMinus1[i] = 1;
m_maxNumReorderPics[i] = 0;
m_maxLatencyIncreasePlus1[i] = 0;
}
}
};
// Profile Tier Level is used for the general and sub layers
class ProfileTierLevel
{
public:
int m_profileSpace;
bool m_tierFlag;
int m_profileIdc;
bool m_profileCompatibilityFlag[32];
bool m_progressiveSourceFlag;
bool m_interlacedSourceFlag;
bool m_nonPackedConstraintFlag;
bool m_frameOnlyConstraintFlag;
int m_levelIdc;
ProfileTierLevel()
: m_profileSpace(0)
, m_tierFlag(false)
, m_profileIdc(0)
, m_progressiveSourceFlag(false)
, m_interlacedSourceFlag(false)
, m_nonPackedConstraintFlag(false)
, m_frameOnlyConstraintFlag(false)
, m_levelIdc(0)
{
::memset((void*)m_profileCompatibilityFlag, 0,
sizeof(m_profileCompatibilityFlag));
}
// constructor for General Profile Tier Level
ProfileTierLevel(Encoder* e)
: m_profileSpace(0)
, m_tierFlag(e->m_levelTier)
, m_profileIdc(e->m_profile)
, m_progressiveSourceFlag(!e->param->interlaceMode)
, m_interlacedSourceFlag(e->param->interlaceMode)
, m_nonPackedConstraintFlag(e->m_nonPackedConstraintFlag)
, m_frameOnlyConstraintFlag(e->m_frameOnlyConstraintFlag)
, m_levelIdc(e->m_level)
{
::memset(m_profileCompatibilityFlag, 0,
sizeof(m_profileCompatibilityFlag));
m_profileCompatibilityFlag[m_profileIdc] = true;
if (m_profileIdc == Profile::MAIN10 && X265_DEPTH == 8)
{
/* The above constraint is equal to Profile::MAIN */
m_profileCompatibilityFlag[Profile::MAIN] = true;
}
if (m_profileIdc == Profile::MAIN)
{
/* A Profile::MAIN10 decoder can always decode Profile::MAIN */
m_profileCompatibilityFlag[Profile::MAIN10] = true;
}
}
};
// Profile Tier Level is used in the VPS and SPS
class PTL
{
public:
ProfileTierLevel m_generalPTL;
bool m_subLayerProfilePresentFlag[MAX_NUM_SUB_LAYERS];
bool m_subLayerLevelPresentFlag[MAX_NUM_SUB_LAYERS];
ProfileTierLevel m_subLayerPTL[MAX_NUM_SUB_LAYERS];
PTL()
{
::memset((void*)m_subLayerProfilePresentFlag, 0,
sizeof(m_subLayerProfilePresentFlag));
::memset((void*)m_subLayerLevelPresentFlag, 0,
sizeof(m_subLayerLevelPresentFlag));
}
PTL(Encoder* e)
: m_generalPTL(e)
{
::memset((void*)m_subLayerProfilePresentFlag, 0,
sizeof(m_subLayerProfilePresentFlag));
::memset((void*)m_subLayerLevelPresentFlag, 0,
sizeof(m_subLayerLevelPresentFlag));
}
};
// HRD Sub Layer Info is used in the HRD
struct HrdSubLayerInfo
{
bool m_fixedPicRateGeneralFlag; //formerly fixedPicRateFlag
bool m_fixedPicRateWithinCvsFlag; //formerly
fixedPicRateWithinCvsFlag
uint32_t m_elementalDurationInTcMinus1; //formerly
picDurationInTcMinus1
bool m_lowDelayHrdFlag; //formerly lowDelayHrdFlag
uint32_t m_cpbCntMinus1; //formerly cpbCntMinus1
uint32_t m_bitRateValueMinus1[MAX_CPB_CNT][2]; //formerly
bitRateValueMinus1
uint32_t m_cpbSizeValueMinus1[MAX_CPB_CNT][2]; //formerly cpbSizeValue
uint32_t m_cpbSizeDuValueMinus1[MAX_CPB_CNT][2]; //formerly
ducpbSizeValue
uint32_t m_bitRateDuValueMinus1[MAX_CPB_CNT][2]; //formerly
duBitRateValue
bool m_cbrFlag[MAX_CPB_CNT][2]; //formerly cbrFlag
};
// Hypothetical Reference Decoder
class HRD
{
public:
bool& m_nalHrdParametersPresentFlag; //formerly
m_nalHrdParametersPresentFlag
bool m_vclHrdParametersPresentFlag; //formerly
m_vclHrdParametersPresentFlag
bool& m_subPicHrdParamsPresentFlag; //formerly
m_subPicHrdParamsPresentFlag
uint32_t m_tickDivisorMinus2;
uint32_t m_cuCpbRemovalDelayIncrementLengthMinus1;
uint32_t m_duCpbRemovalDelayIncrementLengthMinus1;
//formerly m_duCpbRemovalDelayLengthMinus1
bool m_subPicCpbParamsInPicTimingSEIFlag; //formerly
m_subPicCpbParamsInPicTimingSEIFlag
uint32_t m_dpbOutputDelayDuLengthMinus1;
uint32_t m_bitRateScale;
uint32_t m_cpbSizeScale;
uint32_t m_cpbSizeDuScale; //formerly m_ducpbSizeScale
uint32_t m_initialCpbRemovalDelayLengthMinus1;
uint32_t m_auCpbRemovalDelayLengthMinus1; //formerly
m_cpbRemovalDelayLengthMinus1
uint32_t m_dpbOutputDelayLengthMinus1;
HrdSubLayerInfo m_HSLI[MAX_TLAYER];
// The values set to constants were taken from current x265 code
HRD(x265_param* p)
: m_nalHrdParametersPresentFlag(true)
, m_vclHrdParametersPresentFlag(false)
, m_subPicHrdParamsPresentFlag(false)
, m_tickDivisorMinus2(100 - 2)
, m_cuCpbRemovalDelayIncrementLengthMinus1(7) // 8-bit
precision ( plus 1 for last DU in AU )
, m_duCpbRemovalDelayIncrementLengthMinus1(0)
, m_dpbOutputDelayDuLengthMinus1(5 + 7) // With sub-clock tick
factor of 100, at least 7 bits to have the same value as AU dpb delay
, m_bitRateScale(4) // in units of 2~( 6 + 4 ) = 1,024 bps
, m_cpbSizeScale(6) // in units of 2~( 4 + 4 ) = 1,024 bit
, m_cpbSizeDuScale(6) // in units of 2~( 4 + 4 ) = 1,024 bit
, m_initialCpbRemovalDelayLengthMinus1(15) // assuming 0.5 sec,
log2( 90,000 * 0.5 ) = 16-bit
, m_auCpbRemovalDelayLengthMinus1(0)
, m_dpbOutputDelayLengthMinus1(0)
{
m_vclHrdParametersPresentFlag = (p->rc.bitrate > 0);
m_subPicCpbParamsInPicTimingSEIFlag = m_subPicHrdParamsPresentFlag;
if (p->bframes > 0)
{
m_auCpbRemovalDelayLengthMinus1 = 5; // 32 =
2^5 (plus 1)
m_dpbOutputDelayLengthMinus1 = 5; // 32 + 3
= 2^6
}
else
{
m_auCpbRemovalDelayLengthMinus1 = 9; // max. 2^10
m_dpbOutputDelayLengthMinus1 = 9; // max. 2^10
}
/*
Note: only the case of "vps_max_temporal_layers_minus1 = 0" is
supported.
*/
int i, j;
for (i = 0; i < MAX_TLAYER; i++)
{
m_HSLI[i].m_fixedPicRateGeneralFlag = true;
m_HSLI[i].m_elementalDurationInTcMinus1 = 0;
m_HSLI[i].m_lowDelayHrdFlag = false;
m_HSLI[i].m_cpbCntMinus1 = 0;
for (j = 0; j < m_HSLI[i].m_cpbCntMinus1; j++)
{
m_HSLI[i].m_bitRateValueMinus1[j][0] = p->rc.bitrate - 1;
m_HSLI[i].m_cpbSizeValueMinus1[j][0] = p->rc.bitrate - 1;
m_HSLI[i].m_cpbSizeDuValueMinus1[j][0] = p->rc.bitrate
- 1;
m_HSLI[i].m_cbrFlag[j][0] = (j == 0);
m_HSLI[i].m_bitRateValueMinus1[j][1] = p->rc.bitrate - 1;
m_HSLI[i].m_cpbSizeValueMinus1[j][1] = p->rc.bitrate - 1;
m_HSLI[i].m_cpbSizeDuValueMinus1[j][1] = p->rc.bitrate
- 1;
m_HSLI[i].m_bitRateDuValueMinus1[j][1] = p->rc.bitrate - 1;
m_HSLI[i].m_cbrFlag[j][1] = (j == 0);
}
}
}
};
// Video Parameter Set
class VPS
{
public:
int m_videoParameterSetId;
uint32_t m_maxLayersMinus1; //formerly m_maxLayers
uint32_t m_maxSubLayersMinus1; //formerly m_maxTLayers
bool m_temporalIdNestingFlag;
PTL& m_ptl;
SubLayerOrderingInfo& m_subLayerOrderingInfo;
uint32_t m_maxLayerId;
uint32_t m_numLayerSetsMinus1; // formerly m_numOpSets
bool
m_layerIdIncludedFlag[MAX_VPS_OP_SETS_PLUS1][MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1];
TimingInfo& m_timingInfo;
uint32_t m_numHrdParameters;
uint32_t m_hrdLayerSetIdx; // formerly m_hrdOpSetIdx
bool m_cprmsPresentFlag;
HRD* m_hrdParameters;
//extension flags are for future extensions of H265
// they should always be false until H265 is extended and x265
implements the extension
bool m_extensionFlag;
bool m_extensionDataFlag;
VPS(Encoder* e)
: m_videoParameterSetId(0)
, m_maxLayersMinus1(1)
, m_maxSubLayersMinus1(1)
, m_temporalIdNestingFlag(true)
, m_ptl(e->m_ptl)
, m_subLayerOrderingInfo(e->m_sloi)
, m_maxLayerId(0)
, m_numLayerSetsMinus1(1)
, m_timingInfo(e->m_timingInfo)
, m_numHrdParameters(1)
, m_hrdLayerSetIdx(0)
, m_cprmsPresentFlag(true)
, m_hrdParameters(e->m_hrd)
, m_extensionFlag(false)
, m_extensionDataFlag(false)
{
for (uint32_t opsIdx = 1; opsIdx <= m_numLayerSetsMinus1; opsIdx++)
{
for (uint32_t i = 0; i <= m_maxLayerId; i++)
{
m_layerIdIncludedFlag[opsIdx][i] = true;
}
}
}
};
class RPS
{
public:
bool m_interRefPicSetPredictionFlag; //formerly
m_interRPSPrediction
uint32_t m_deltaIdxMinus1; //formerly m_deltaRIdxMinus1
int m_deltaRpsMinus1; //formerly m_deltaRPS,
will be used to calculate sign and abs
bool m_usedByCurrPicFlag[MAX_NUM_REF_PICS]; //formerly m_refIdc
== 1
bool m_useDeltaFlag[MAX_NUM_REF_PICS]; //formerly m_refIdc >> 1
uint32_t m_numNegativePics; //formerly
m_numberOfNegativePictures
uint32_t m_numPositivePics; //formerly
m_numberOfPositivePictures
uint32_t m_deltaPocMinus1[MAX_NUM_REF_PICS]; //formerly m_deltaPOC,
used for S0 and S1
bool m_usedByCurrPicFlag[MAX_NUM_REF_PICS]; //formerly m_used,
used for S0 and S1
RPS()
: m_interRefPicSetPredictionFlag(false)
, m_deltaIdxMinus1(0)
, m_deltaRpsMinus1(0)
, m_numNegativePics(0)
, m_numPositivePics(0)
{
for (int i = 0; i < MAX_NUM_REF_PICS; i++)
{
m_deltaPocMinus1[i] = 0;
m_usedByCurrPicFlag[i] = false;
}
}
};
//Scaling List, quantization parameters
class ScalingList
{
public:
bool
m_scalingListPredModeFlag[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
uint32_t
m_scalingListPredMatrixIdDelta[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
int m_scalingListDcCoef[SCALING_LIST_SIZE_NUM -
2][SCALING_LIST_NUM];
int m_scalingListCoef[SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM];
ScalingList()
{
int sizeId = 0;
int matrixId;
for (matrixId = 0; matrixId < SCALING_LIST_NUM; matrixId++)
{
m_scalingListPredModeFlag[sizeId][matrixId] = false;
m_scalingListPredMatrixIdDelta[sizeId][matrixId] = 0;
::memcpy((void*)&m_scalingListCoef[sizeId][matrixId],
(void*)&ScalingList4x4Default, sizeof(ScalingList4x4Default));
}
for (sizeId = 1; sizeId <= 2; sizeId++)
{
for (matrixId = 0; matrixId <= 2; matrixId++)
{
m_scalingListPredModeFlag[sizeId][matrixId] = false;
m_scalingListPredMatrixIdDelta[sizeId][matrixId] = 0;
::memcpy((void*)&m_scalingListCoef[sizeId][matrixId],
(void*)&ScalingList8x8IntraDefault, sizeof(ScalingList8x8IntraDefault));
}
}
for (sizeId = 1; sizeId <= 2; sizeId++)
{
for (matrixId; matrixId < SCALING_LIST_NUM; matrixId++)
{
m_scalingListPredModeFlag[sizeId][matrixId] = false;
m_scalingListPredMatrixIdDelta[sizeId][matrixId] = 0;
::memcpy((void*)&m_scalingListCoef[sizeId][matrixId],
(void*)&ScalingList8x8InterDefault, sizeof(ScalingList8x8InterDefault));
}
}
m_scalingListPredModeFlag[sizeId][0] = false;
m_scalingListPredModeFlag[sizeId][1] = false;
m_scalingListPredMatrixIdDelta[sizeId][0] = 0;
m_scalingListPredMatrixIdDelta[sizeId][1] = 0;
::memcpy((void*)&m_scalingListCoef[sizeId][0],
(void*)&ScalingList8x8IntraDefault, sizeof(ScalingList8x8IntraDefault));
::memcpy((void*)&m_scalingListCoef[sizeId][1],
(void*)&ScalingList8x8InterDefault, sizeof(ScalingList8x8InterDefault));
for (sizeId = 0; sizeId < 2; sizeId++)
{
for (matrixId = 0; matrixId < SCALING_LIST_NUM; matrixId++)
{
m_scalingListDcCoef[sizeId][matrixId] = 16;
}
}
}
};
// Video Usability Information
class VUI
{
public:
bool m_aspectRatioInfoPresentFlag;
int& m_aspectRatioIdc;
int& m_sarWidth;
int& m_sarHeight;
bool m_overscanInfoPresentFlag;
bool m_overscanAppropriateFlag;
bool m_videoSignalTypePresentFlag;
int& m_videoFormat;
bool m_videoFullRangeFlag;
bool m_colourDescriptionPresentFlag;
int& m_colourPrimaries;
int& m_transferCharacteristics;
int& m_matrixCoefficients;
bool m_chromaLocInfoPresentFlag;
int& m_chromaSampleLocTypeTopField;
int& m_chromaSampleLocTypeBottomField;
bool m_neutralChromaIndicationFlag;
bool m_fieldSeqFlag;
Window& m_defaultDisplayWindow;
bool m_frameFieldInfoPresentFlag;
bool m_hrdParametersPresentFlag;
bool m_bitstreamRestrictionFlag;
bool m_tilesFixedStructureFlag;
bool m_motionVectorsOverPicBoundariesFlag;
bool m_restrictedRefPicListsFlag;
int m_minSpatialSegmentationIdc;
int m_maxBytesPerPicDenom;
int m_maxBitsPerMinCuDenom;
int m_log2MaxMvLengthHorizontal;
int m_log2MaxMvLengthVertical;
HRD& m_hrdParameters;
TimingInfo& m_timingInfo;
VUI(x265_param* p, Window* dw, HRD* hrd, TimingInfo* ti)
: m_aspectRatioInfoPresentFlag(p->vui.aspectRatioIdc)
, m_aspectRatioIdc(p->vui.aspectRatioIdc)
, m_sarWidth(p->vui.sarWidth)
, m_sarHeight(p->vui.sarHeight)
, m_overscanInfoPresentFlag(p->vui.bEnableOverscanInfoPresentFlag)
, m_overscanAppropriateFlag(p->vui.bEnableOverscanAppropriateFlag)
,
m_videoSignalTypePresentFlag(p->vui.bEnableVideoSignalTypePresentFlag)
, m_videoFormat(p->vui.videoFormat)
, m_videoFullRangeFlag(p->vui.bEnableVideoFullRangeFlag)
,
m_colourDescriptionPresentFlag(p->vui.bEnableColorDescriptionPresentFlag)
, m_colourPrimaries(p->vui.colorPrimaries)
, m_transferCharacteristics(p->vui.transferCharacteristics)
, m_matrixCoefficients(p->vui.matrixCoeffs)
,
m_chromaLocInfoPresentFlag(p->vui.bEnableChromaLocInfoPresentFlag)
, m_chromaSampleLocTypeTopField(p->vui.chromaSampleLocTypeTopField)
,
m_chromaSampleLocTypeBottomField(p->vui.chromaSampleLocTypeBottomField)
, m_neutralChromaIndicationFlag(false)
, m_fieldSeqFlag(p->interlaceMode)
, m_defaultDisplayWindow(dw)
, m_frameFieldInfoPresentFlag(false)
, m_hrdParametersPresentFlag(false)
, m_bitstreamRestrictionFlag(false)
, m_tilesFixedStructureFlag(false)
, m_motionVectorsOverPicBoundariesFlag(true)
, m_restrictedRefPicListsFlag(1)
, m_minSpatialSegmentationIdc(0)
, m_maxBytesPerPicDenom(2)
, m_maxBitsPerMinCuDenom(1)
, m_log2MaxMvLengthHorizontal(15)
, m_log2MaxMvLengthVertical(15)
, m_hrdParameters(hrd)
, m_timingInfo(ti)
{}
};
// Sequence Parameter Set
class SPS
{
public:
int m_videoParameterSetId; //formerly m_VPSId
uint32_t m_maxSubLayersMinus1; //formerly m_maxTLayers
bool m_temporalIdNestingFlag;
PTL& m_ptl;
int m_seqParameterSetId; //formerly m_SPSId
int m_chromaFormatIdc;
bool m_separateColorPlaneFlag; //formerly
m_colorPlaneFlag
uint32_t& m_picWidthInLumaSamples;
uint32_t& m_picHeightInLumaSamples;
Window& m_conformanceWindow;
int m_bitDepthLumaMinus8; //formerly m_bitDepthY
int m_bitDepthChromaMinus8; //formerly m_bitDepthC
uint32_t m_log2MaxPicOrderCntLsbMinus4; //formerly
m_bitsForPOC
SubLayerOrderingInfo& m_subLayerOrderingInfo;
int& m_log2MinLumaCodingBlockSizeMinus3;
//formerly m_log2MinCodingBlockSize
int& m_log2DiffMaxMinLumaCodingBlockSize;
//formerly m_log2DiffMaxMinCodingBlockSize
uint32_t& m_log2MinTransformBlockSizeMinus2; //formerly
m_quadtreeTULog2MinSize
uint32_t m_diffMaxMinTransformBlockSize;
uint32_t m_maxTransformHierarchyDepthInter; //formerly
m_quadtreeTUMaxDepthInter
uint32_t m_maxTransformHierarchyDepthIntra; //formerly
m_quadtreeTUMaxDepthIntra
bool m_scalingListEnabledFlag; //formerly
m_scalingListEnabledFlag
bool m_scalingListPresentFlag; //formerly
m_scalingListPresentFlag
ScalingList& m_scalingList;
bool& m_ampEnabledFlag; //formerly m_useAMP
bool& m_sampleAdaptiveOffsetEnabledFlag; //formerly
m_bUseSAO
bool m_pcmEnabledFlag; //formerly m_usePCM
uint32_t m_pcmSampleBitDepthLumaMinus1; //formerly
m_pcmBitDepthLuma
uint32_t m_pcmSampleBitDepthChromaMinus1; //formerly
m_pcmBitDepthChroma
uint32_t& m_log2MinPcmLumaCodingBlockSizeMinus3; //formerly
m_pcmLog2MinSize
uint32_t& m_log2DiffMaxMinPcmLumaCodingBlockSize;
bool m_pcmLoopFilterDisableFlag; //formerly
m_bPCMFilterDisableFlag
RPS* m_RPSList;
bool m_longTermRefPicsPresentFlag; //formerly
m_bLongTermRefsPresent
uint32_t m_numLongTermRefPicsSPS;
uint32_t m_ltRefPicPocLsbSps[33];
bool m_usedByCurrPicLtSPSFlag[33];
bool m_temporalMvpEnabledFlag; //formerly
m_TMVPFlagsPresent
bool& m_strongIntraSmoothingEnabledFlag;
//m_useStrongIntraSmoothing
bool& m_vuiParametersPresentFlag;
VUI& m_vuiParameters;
bool m_extensionFlag;
bool m_extensionDataFlag;
//These are non SPS fields
uint32_t& m_maxCUSize;
uint32_t& m_maxCUDepth;
uint32_t& m_quadtreeTULog2MaxSize;
uint32_t& m_pcmLog2MaxSize;
int m_qpBDOffsetY;
int m_qpBDOffsetC;
bool m_useLossless;
uint32_t m_maxTrSize;
int m_iAMPAcc[MAX_CU_DEPTH];
SPS(Encoder* e, x265_param* p)
: m_videoParameterSetId(0)
, m_maxSubLayersMinus1(1)
, m_temporalIdNestingFlag(false)
, m_ptl(e->ptl)
, m_seqParameterSetId(0)
, m_chromaFormatIdc(X265_CSP_I420)
, m_separateColorPlaneFlag(false)
, m_picWidthInLumaSamples(p->sourceWidth)
, m_picHeightInLumaSamples(p->sourceHeight)
, m_conformanceWindow(e->confwin)
, m_bitDepthLumaMinus8(X265_DEPTH)
, m_bitDepthChromaMinus8(X265_DEPTH)
, m_log2MaxPicOrderCntLsbMinus4(8)
, m_subLayerOrderingInfo(e->sloi)
, m_log2MinTransformBlockSizeMinus2(e->m_quadtreeTULog2MinSize)
, m_maxTransformHierarchyDepthInter(p->tuQTMaxInterDepth)
, m_maxTransformHierarchyDepthIntra(p->tuQTMaxIntraDepth)
, m_scalingListPresentFlag(false)
, m_ampEnabledFlag(p->bEnableAMP)
, m_sampleAdaptiveOffsetEnabledFlag(p->bEnableSAO)
, m_pcmEnabledFlag(false)
, m_pcmSampleBitDepthLumaMinus1(X265_DEPTH)
, m_pcmSampleBitDepthChromaMinus1(X265_DEPTH)
, m_log2MinPcmLumaCodingBlockSizeMinus3(e->m_pcmLog2MinSize)
, m_pcmLoopFilterDisableFlag(e->m_bPCMFilterDisableFlag)
, m_RPSList(NULL)
, m_longTermRefPicsPresentFlag(false)
, m_numLongTermRefPicsSPS(0)
, m_temporalMvpEnabledFlag(false)
, m_strongIntraSmoothingEnabledFlag(p->bEnableStrongIntraSmoothing)
, m_vuiParametersPresentFlag(true)
, m_vuiParameters(&e->m_vui)
, m_extensionFlag(false)
, m_extensionDataFlag(false)
// non sps fields
, m_maxCUSize(g_maxCUSize)
, m_maxCUDepth(g_maxCUDepth)
, m_quadtreeTULog2MaxSize(e->m_quadtreeTULog2MaxSize)
, m_pcmLog2MaxSize(e->m_pcmLog2MaxSize)
, m_useLossless(false)
{
m_log2MinLumaCodingBlockSizeMinus3; //needs to be calculated,
see initSPS
m_log2DiffMaxMinLumaCodingBlockSize; //needs to be calculated,
see initSPS
m_diffMaxMinTransformBlockSize = e->m_quadtreeTULog2MaxSize -
e->m_quadtreeTULog2MinSize;
m_scalingListEnabledFlag = e->m_useScalingListId == 0 ? false :
true;
m_scalingList = e->getScalingList();
m_log2DiffMaxMinPcmLumaCodingBlockSize = e->m_pcmLog2MaxSize -
e->m_pcmLog2MinSize;
::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
::memset(m_usedByCurrPicLtSPSFlag, 0,
sizeof(m_usedByCurrPicLtSPSFlag));
m_qpBDOffsetY = 6 * (X265_DEPTH - 8);
m_qpBDOffsetC = 6 * (X265_DEPTH - 8);
for (uint32_t i = 0; i < MAX_CU_DEPTH; i++)
{
m_iAMPAcc[i] = m_ampEnabledFlag;
}
}
};
// Picture Parameter Set
class PPS
{
private:
int m_picParameterSetId; // formerly
m_PPSId
int m_seqParameterSetId; // formerly
m_SPSId
bool m_dependentSliceSegmentsEnabledFlag;
bool m_outputFlagPresentFlag; // Indicates the presence
of output_flag in slice header
int m_numExtraSliceHeaderBits;
bool& m_signDataHidingEnabledFlag; //formerly m_signHideFlag
bool m_cabacInitPresentFlag;
uint32_t m_numRefIdxL0DefaultActiveMinus1; //formerly
m_numRefIdxL0DefaultActive
uint32_t m_numRefIdxL1DefaultActiveMinus1; //formerly
m_numRefIdxL1DefaultActive
int m_initQPMinus26; // formerly m_picInitQPMinus26
bool& m_constrainedIntraPredFlag; // formerly
m_bConstrainedIntraPred
bool& m_transformSkipEnabledFlag; // formerly
m_useTransformSkip
bool m_cuQpDeltaEnabledFlag; // formerly m_useDQP
uint32_t m_diffCuQpDeltaDepth; // formerly
m_maxCuDQPDepth
int& m_cbQpOffset; // formerly
m_chromaCbQpOffset
int& m_crQpOffset; // formerly
m_chromaCrQpOffset
bool m_sliceChromaQpOffsetsPresentFlag; // formerly
m_bSliceChromaQpFlag
bool& m_weightedPredFlag; // formerly
m_bUseWeightPred
bool& m_weightedBipredFlag; // formerly
m_useWeightedBiPred
bool& m_transquantBypassEnabledFlag; // formerly
m_transquantBypassEnableFlag
bool m_tilesEnabledFlag;
bool& m_entropyCodingSyncEnabledFlag; // formerly
m_entropyCodingSyncEnabledFlag !Wavefronts!
uint32_t m_numTileColumnsMinus1;
uint32_t m_numTileRowsMinus1;
bool m_uniformSpacingFlag;
uint32_t* m_columnWidthMinus1;
uint32_t* m_rowHeightMinus1;
bool& m_loopFilterAcrossTilesEnabledFlag; // formerly
m_loopFilterAcrossTilesEnabledFlag
bool m_loopFilterAcrossSlicesEnabledFlag;
bool& m_deblockingFilterControlPresentFlag; // formerly
m_deblockingFilterControlPresentFlag
bool& m_deblockingFilterOverrideEnabledFlag; // formerly
m_deblockingFilterOverrideEnabledFlag
bool& m_deblockingFilterDisabledFlag; // formerly
m_picDisableDeblockingFilterFlag
int& m_betaOffsetDiv2; // formerly
m_deblockingFilterBetaOffsetDiv2 beta offset
int& m_tcOffsetDiv2; // formerly
m_deblockingFilterTcOffsetDiv2 tc offset for deblocking filter
bool m_scalingListDataPresentFlag; // formerly
m_scalingListPresentFlag
ScalingList& m_scalingList;
bool m_listsModificationPresentFlag; // formerly
m_listsModificationPresentFlag
uint32_t& m_log2ParallelMergeLevelMinus2;
bool m_sliceSegemntHeaderExtenstionPresentFlag; //
formerly m_sliceHeaderExtensionPresentFlag
bool m_extensionFlag;
bool m_extensionDataFlag;
// non PPS fields
SPS* m_sps;
uint32_t m_minCuDQPSize;
uint32_t m_encCABACTableIdx; // Used to transmit
table selection across slicesa
PPS(Encoder* e, x265_param* p)
: m_picParameterSetId(0)
, m_seqParameterSetId(0)
, m_dependentSliceSegmentsEnabledFlag(false)
, m_outputFlagPresentFlag(false)
, m_numExtraSliceHeaderBits(0)
, m_signDataHidingEnabledFlag(p->bEnableSignHiding)
, m_numRefIdxL0DefaultActiveMinus1(1)
, m_numRefIdxL1DefaultActiveMinus1(1)
, m_initQPMinus26(0)
, m_constrainedIntraPredFlag(p->bEnableConstrainedIntra)
, m_transformSkipEnabledFlag(p->bEnableTransformSkip)
, m_diffCuQpDeltaDepth(0)
, m_cbQpOffset(p->cbQpOffset)
, m_crQpOffset(p->crQpOffset)
, m_sliceChromaQpOffsetsPresentFlag(false)
, m_weightedPredFlag(p->bEnableWeightedPred)
, m_weightedBipredFlag(p->bEnableWeightedBiPred)
, m_transquantBypassEnabledFlag(e->m_TransquantBypassEnableFlag)
, m_tilesEnabledFlag(false)
, m_entropyCodingSyncEnabledFlag(p->bEnableWavefront)
, m_numTileColumnsMinus1(0)
, m_numTileRowsMinus1(0)
, m_uniformSpacingFlag(false)
, m_columnWidthMinus1(NULL)
, m_rowHeightMinus1(NULL)
,
m_loopFilterAcrossTilesEnabledFlag(e->m_loopFilterAcrossTilesEnabledFlag)
, m_loopFilterAcrossSlicesEnabledFlag(true)
, m_deblockingFilterControlPresentFlag(!p->bEnableLoopFilter)
,
m_deblockingFilterOverrideEnabledFlag(!e->m_loopFilterOffsetInPPS)
, m_deblockingFilterDisabledFlag(!p->bEnableLoopFilter)
, m_betaOffsetDiv2(e->m_loopFilterBetaOffset)
, m_tcOffsetDiv2(e->m_loopFilterTcOffset)
, m_scalingListDataPresentFlag(false)
, m_scalingList(e->m_scalingList)
, m_listsModificationPresentFlag(false)
, m_log2ParallelMergeLevelMinus2(e->m_log2ParallelMergeLevelMinus2)
, m_sliceSegemntHeaderExtenstionPresentFlag(false)
, m_extensionFlag(false)
, m_extensionDataFlag(false)
// non PPS fields
, m_sps(e->m_SPS)
, m_minCuDQPSize(0)
, m_encCABACTableIdx(I_SLICE)
{
m_cabacInitPresentFlag = (p->frameNumThreads > 0);
m_cuQpDeltaEnabledFlag = (m_diffCuQpDeltaDepth > 0 ||
p->rc.aqMode) ? true : false;
int lowestQP = -(6 * (X265_DEPTH - 8));
if (e->m_useLossLess)
if ((e->m_maxCuDQPDepth == 0) && (p->rc.qp == lowestQP))
{
m_cuQpDeltaEnabledFlag = false;
}
else
{
m_cuQpDeltaEnabledFlag = true;
}
m_cuQpDeltaEnabledFlag =
m_scalingList = new ScalingList;
}
};
} // close namespace x265
#endif //#ifndef X265_H265_H
-------------- next part --------------
A non-text attachment was scrubbed...
Name: h265.h
Type: text/x-chdr
Size: 31039 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140411/40fec818/attachment-0001.h>
More information about the x265-devel
mailing list