Newer
Older

Karsten Suehring
committed
m_cListPic.push_back( rpcPic );
}
rpcPic->setBorderExtension( false );
rpcPic->reconstructed = false;
rpcPic->referenced = true;

Karsten Suehring
committed
m_iPOCLast += (m_compositeRefEnabled ? 2 : 1);

Karsten Suehring
committed
m_iNumPicRcvd++;
}
void EncLib::xInitVPS( const SPS& sps )
{
// The SPS must have already been set up.
// set the VPS profile information.
m_vps->m_olsHrdParams.clear();
m_vps->m_olsHrdParams.resize(m_vps->getNumOlsHrdParamsMinus1(), std::vector<OlsHrdParams>(m_vps->getMaxSubLayers()));
ProfileLevelTierFeatures profileLevelTierFeatures;
profileLevelTierFeatures.extractPTLInformation( sps );
m_vps->deriveOutputLayerSets();
m_vps->deriveTargetOutputLayerSet( m_vps->m_targetOlsIdx );
// number of the DPB parameters is set equal to the number of OLS containing multi layers
if( !m_vps->getEachLayerIsAnOlsFlag() )
m_vps->m_numDpbParams = m_vps->getNumMultiLayeredOlss();
}
if( m_vps->m_dpbParameters.size() != m_vps->m_numDpbParams )
{
m_vps->m_dpbParameters.resize( m_vps->m_numDpbParams );
}
if( m_vps->m_dpbMaxTemporalId.size() != m_vps->m_numDpbParams )
{
m_vps->m_dpbMaxTemporalId.resize( m_vps->m_numDpbParams );
}
Hendry
committed
for( int olsIdx = 0, dpbIdx = 0; olsIdx < m_vps->m_numOutputLayersInOls.size(); olsIdx++ )
if ( m_vps->getNumLayersInOls(olsIdx) > 1 )
{
Hendry
committed
if( std::find( m_vps->m_layerIdInOls[olsIdx].begin(), m_vps->m_layerIdInOls[olsIdx].end(), m_layerId ) != m_vps->m_layerIdInOls[olsIdx].end() )
{
m_vps->setOlsDpbPicWidth( olsIdx, std::max<int>( sps.getMaxPicWidthInLumaSamples(), m_vps->getOlsDpbPicSize( olsIdx ).width ) );
m_vps->setOlsDpbPicHeight( olsIdx, std::max<int>( sps.getMaxPicHeightInLumaSamples(), m_vps->getOlsDpbPicSize( olsIdx ).height ) );
}
Hendry
committed
m_vps->setOlsDpbParamsIdx( olsIdx, dpbIdx );
dpbIdx++;
}
Hendry
committed
//for( int i = 0; i < m_vps->m_numDpbParams; i++ )
for( int i = 0; i < m_vps->m_numOutputLayersInOls.size(); i++ )
if ( m_vps->getNumLayersInOls(i) > 1 )
{
Hendry
committed
int dpbIdx = m_vps->getOlsDpbParamsIdx( i );
Hendry
committed
if( m_vps->getMaxSubLayers() == 1 )
Hendry
committed
// When vps_max_sublayers_minus1 is equal to 0, the value of dpb_max_temporal_id[ dpbIdx ] is inferred to be equal to 0.
m_vps->m_dpbMaxTemporalId[dpbIdx] = 0;
Hendry
committed
if( m_vps->getAllLayersSameNumSublayersFlag() )
{
// When vps_max_sublayers_minus1 is greater than 0 and vps_all_layers_same_num_sublayers_flag is equal to 1, the value of dpb_max_temporal_id[ dpbIdx ] is inferred to be equal to vps_max_sublayers_minus1.
m_vps->m_dpbMaxTemporalId[dpbIdx] = m_vps->getMaxSubLayers() - 1;
}
else
{
m_vps->m_dpbMaxTemporalId[dpbIdx] = m_maxTempLayer;
}
}
for( int j = ( m_vps->m_sublayerDpbParamsPresentFlag ? 0 : m_vps->m_dpbMaxTemporalId[dpbIdx] ); j <= m_vps->m_dpbMaxTemporalId[dpbIdx]; j++ )
{
m_vps->m_dpbParameters[dpbIdx].m_maxDecPicBuffering[j] = profileLevelTierFeatures.getMaxDpbSize( m_vps->getOlsDpbPicSize( i ).width * m_vps->getOlsDpbPicSize( i ).height );
m_vps->m_dpbParameters[dpbIdx].m_numReorderPics[j] = m_vps->m_dpbParameters[dpbIdx].m_maxDecPicBuffering[j];
m_vps->m_dpbParameters[dpbIdx].m_maxLatencyIncreasePlus1[j] = 0;
Hendry
committed
for( int j = ( m_vps->m_sublayerDpbParamsPresentFlag ? m_vps->m_dpbMaxTemporalId[dpbIdx] : 0 ); j < m_vps->m_dpbMaxTemporalId[dpbIdx]; j++ )
{
// When max_dec_pic_buffering_minus1[ dpbIdx ] is not present for dpbIdx in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_dec_pic_buffering_minus1[ maxSubLayersMinus1 ].
m_vps->m_dpbParameters[dpbIdx].m_maxDecPicBuffering[j] = m_vps->m_dpbParameters[dpbIdx].m_maxDecPicBuffering[m_vps->m_dpbMaxTemporalId[dpbIdx]];
Hendry
committed
// When max_num_reorder_pics[ dpbIdx ] is not present for dpbIdx in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_num_reorder_pics[ maxSubLayersMinus1 ].
m_vps->m_dpbParameters[dpbIdx].m_numReorderPics[j] = m_vps->m_dpbParameters[dpbIdx].m_numReorderPics[m_vps->m_dpbMaxTemporalId[dpbIdx]];
Hendry
committed
// When max_latency_increase_plus1[ dpbIdx ] is not present for dpbIdx in the range of 0 to maxSubLayersMinus1 - 1, inclusive, due to subLayerInfoFlag being equal to 0, it is inferred to be equal to max_latency_increase_plus1[ maxSubLayersMinus1 ].
m_vps->m_dpbParameters[dpbIdx].m_maxLatencyIncreasePlus1[j] = m_vps->m_dpbParameters[dpbIdx].m_maxLatencyIncreasePlus1[m_vps->m_dpbMaxTemporalId[dpbIdx]];
}

Karsten Suehring
committed
void EncLib::xInitDCI(DCI& dci, const SPS& sps)
{
dci.setMaxSubLayersMinus1(sps.getMaxTLayers() - 1);
std::vector<ProfileTierLevel> ptls;
ptls.resize(1);
ptls[0] = *sps.getProfileTierLevel();
dci.setProfileTierLevel(ptls);
}
void EncLib::xInitSPS( SPS& sps )

Karsten Suehring
committed
{
ProfileTierLevel* profileTierLevel = sps.getProfileTierLevel();
ConstraintInfo* cinfo = profileTierLevel->getConstraintInfo();
cinfo->setProgressiveSourceFlag (m_progressiveSourceFlag);
cinfo->setInterlacedSourceFlag (m_interlacedSourceFlag);
cinfo->setNonPackedConstraintFlag (m_nonPackedConstraintFlag);
cinfo->setNonProjectedConstraintFlag(m_nonProjectedConstraintFlag);
cinfo->setNoResChangeInClvsConstraintFlag(m_noResChangeInClvsConstraintFlag);
cinfo->setOneTilePerPicConstraintFlag(m_oneTilePerPicConstraintFlag);
cinfo->setOneSlicePerPicConstraintFlag(m_oneSlicePerPicConstraintFlag);
cinfo->setOneSubpicPerPicConstraintFlag(m_oneSubpicPerPicConstraintFlag);
cinfo->setFrameOnlyConstraintFlag (m_frameOnlyConstraintFlag);
cinfo->setIntraOnlyConstraintFlag (m_intraConstraintFlag);
cinfo->setMaxBitDepthConstraintIdc (m_maxBitDepthConstraintIdc);
cinfo->setMaxChromaFormatConstraintIdc((ChromaFormat)m_maxChromaFormatConstraintIdc);
#if JVET_R0286_GCI_CLEANUP
cinfo->setSingleLayerConstraintFlag (m_singleLayerConstraintFlag);
cinfo->setAllLayersIndependentConstraintFlag (m_allLayersIndependentConstraintFlag);
cinfo->setNoMrlConstraintFlag (m_noMrlConstraintFlag);
cinfo->setNoIspConstraintFlag (m_noIspConstraintFlag);
cinfo->setNoMipConstraintFlag (m_noMipConstraintFlag);
cinfo->setNoLfnstConstraintFlag (m_noLfnstConstraintFlag);
cinfo->setNoMmvdConstraintFlag (m_noMmvdConstraintFlag);
cinfo->setNoSmvdConstraintFlag (m_noSmvdConstraintFlag);
cinfo->setNoProfConstraintFlag (m_noProfConstraintFlag);
cinfo->setNoPaletteConstraintFlag (m_noPaletteConstraintFlag);
cinfo->setNoActConstraintFlag (m_noActConstraintFlag);
cinfo->setNoLmcsConstraintFlag (m_noLmcsConstraintFlag);
#endif
cinfo->setNoQtbttDualTreeIntraConstraintFlag(m_bNoQtbttDualTreeIntraConstraintFlag);
cinfo->setNoPartitionConstraintsOverrideConstraintFlag(m_noPartitionConstraintsOverrideConstraintFlag);
cinfo->setNoSaoConstraintFlag(m_bNoSaoConstraintFlag);
cinfo->setNoAlfConstraintFlag(m_bNoAlfConstraintFlag);
cinfo->setNoCCAlfConstraintFlag(m_noCCAlfConstraintFlag);
cinfo->setNoRefWraparoundConstraintFlag(m_bNoRefWraparoundConstraintFlag);
cinfo->setNoTemporalMvpConstraintFlag(m_bNoTemporalMvpConstraintFlag);
cinfo->setNoSbtmvpConstraintFlag(m_bNoSbtmvpConstraintFlag);
cinfo->setNoAmvrConstraintFlag(m_bNoAmvrConstraintFlag);
cinfo->setNoBdofConstraintFlag(m_bNoBdofConstraintFlag);
cinfo->setNoDmvrConstraintFlag(m_noDmvrConstraintFlag);
cinfo->setNoCclmConstraintFlag(m_bNoCclmConstraintFlag);
cinfo->setNoMtsConstraintFlag(m_bNoMtsConstraintFlag);
cinfo->setNoSbtConstraintFlag(m_noSbtConstraintFlag);
cinfo->setNoAffineMotionConstraintFlag(m_bNoAffineMotionConstraintFlag);
cinfo->setNoBcwConstraintFlag(m_bNoBcwConstraintFlag);
cinfo->setNoIbcConstraintFlag(m_noIbcConstraintFlag);
cinfo->setNoCiipConstraintFlag(m_bNoCiipConstraintFlag);
cinfo->setNoFPelMmvdConstraintFlag(m_noFPelMmvdConstraintFlag);
cinfo->setNoGeoConstraintFlag(m_noGeoConstraintFlag);
cinfo->setNoLadfConstraintFlag(m_bNoLadfConstraintFlag);
cinfo->setNoTransformSkipConstraintFlag(m_noTransformSkipConstraintFlag);
cinfo->setNoBDPCMConstraintFlag(m_noBDPCMConstraintFlag);
cinfo->setNoJointCbCrConstraintFlag(m_noJointCbCrConstraintFlag);
cinfo->setNoQpDeltaConstraintFlag(m_bNoQpDeltaConstraintFlag);
cinfo->setNoDepQuantConstraintFlag(m_bNoDepQuantConstraintFlag);
cinfo->setNoSignDataHidingConstraintFlag(m_bNoSignDataHidingConstraintFlag);
Martin Pettersson
committed
cinfo->setNoTrailConstraintFlag(m_noTrailConstraintFlag);
cinfo->setNoStsaConstraintFlag(m_noStsaConstraintFlag);
cinfo->setNoRaslConstraintFlag(m_noRaslConstraintFlag);
cinfo->setNoRadlConstraintFlag(m_noRadlConstraintFlag);
cinfo->setNoIdrConstraintFlag(m_noIdrConstraintFlag);
cinfo->setNoCraConstraintFlag(m_noCraConstraintFlag);
cinfo->setNoGdrConstraintFlag(m_noGdrConstraintFlag);
cinfo->setNoApsConstraintFlag(m_noApsConstraintFlag);

Karsten Suehring
committed
profileTierLevel->setLevelIdc (m_level);
profileTierLevel->setTierFlag (m_levelTier);
profileTierLevel->setProfileIdc (m_profile);
profileTierLevel->setNumSubProfile(m_numSubProfile);
for (int k = 0; k < m_numSubProfile; k++)
{
profileTierLevel->setSubProfileIdc(k, m_subProfile[k]);
}

Karsten Suehring
committed
/* XXX: should Main be marked as compatible with still picture? */
/* XXX: may be a good idea to refactor the above into a function
* that chooses the actual compatibility based upon options */
sps.setVPSId( m_vps->getVPSId() );
sps.setMaxPicWidthInLumaSamples( m_iSourceWidth );
sps.setMaxPicHeightInLumaSamples( m_iSourceHeight );
#if JVET_R0058
if (m_resChangeInClvsEnabled)
#else
{
int maxPicWidth = std::max(m_iSourceWidth, (int)((double)m_iSourceWidth / m_scalingRatioHor + 0.5));
int maxPicHeight = std::max(m_iSourceHeight, (int)((double)m_iSourceHeight / m_scalingRatioVer + 0.5));
const int minCuSize = std::max(8, 1 << m_log2MinCUSize);
if (maxPicWidth % minCuSize)
maxPicWidth += ((maxPicWidth / minCuSize) + 1) * minCuSize - maxPicWidth;
maxPicHeight += ((maxPicHeight / minCuSize) + 1) * minCuSize - maxPicHeight;
sps.setMaxPicWidthInLumaSamples( maxPicWidth );
sps.setMaxPicHeightInLumaSamples( maxPicHeight );
}
Jonatan Samuelsson-Allendes
committed
sps.setConformanceWindow( m_conformanceWindow );

Karsten Suehring
committed
sps.setMaxCUWidth ( m_maxCUWidth );
sps.setMaxCUHeight ( m_maxCUHeight );
sps.setLog2MinCodingBlockSize ( m_log2MinCUSize );

Karsten Suehring
committed
sps.setChromaFormatIdc ( m_chromaFormatIDC );
sps.setCTUSize ( m_CTUSize );
sps.setSplitConsOverrideEnabledFlag ( m_useSplitConsOverride );
// convert the Intra Chroma minQT setting from chroma unit to luma unit
m_uiMinQT[2] <<= getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, m_chromaFormatIDC);
sps.setMinQTSizes ( m_uiMinQT );
sps.setMaxMTTHierarchyDepth ( m_uiMaxMTTHierarchyDepth, m_uiMaxMTTHierarchyDepthI, m_uiMaxMTTHierarchyDepthIChroma );
sps.setMaxBTSize( m_uiMaxBT[1], m_uiMaxBT[0], m_uiMaxBT[2] );
sps.setMaxTTSize( m_uiMaxTT[1], m_uiMaxTT[0], m_uiMaxTT[2] );
sps.setIDRRefParamListPresent ( m_idrRefParamList );
sps.setUseDualITree ( m_dualITree );
sps.setUseLFNST ( m_LFNST );
sps.setSBTMVPEnabledFlag ( m_SubPuMvpMode );
sps.setAMVREnabledFlag ( m_ImvMode != IMV_OFF );
sps.setBDOFEnabledFlag ( m_BIO );
sps.setMaxNumMergeCand(getMaxNumMergeCand());
sps.setMaxNumAffineMergeCand(getMaxNumAffineMergeCand());
sps.setMaxNumIBCMergeCand(getMaxNumIBCMergeCand());
sps.setMaxNumGeoCand(getMaxNumGeoCand());
sps.setUseAffine ( m_Affine );
sps.setUseAffineType ( m_AffineType );
sps.setUsePROF ( m_PROF );
sps.setUseLMChroma ( m_LMChroma ? true : false );
sps.setHorCollocatedChromaFlag( m_horCollocatedChromaFlag );
sps.setVerCollocatedChromaFlag( m_verCollocatedChromaFlag );
sps.setUseMTS ( m_IntraMTS || m_InterMTS || m_ImplicitMTS );
sps.setUseIntraMTS ( m_IntraMTS );
sps.setUseInterMTS ( m_InterMTS );
Yin Zhao
committed
sps.setUseSBT ( m_SBT );
sps.setUseBcw ( m_bcw );
Shunsuke Iwamura
committed
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
sps.setLadfEnabled ( m_LadfEnabled );
Shunsuke Iwamura
committed
if ( m_LadfEnabled )
{
sps.setLadfNumIntervals ( m_LadfNumIntervals );
Shunsuke Iwamura
committed
for ( int k = 0; k < m_LadfNumIntervals; k++ )
{
sps.setLadfQpOffset( m_LadfQpOffset[k], k );
sps.setLadfIntervalLowerBound( m_LadfIntervalLowerBound[k], k );
Shunsuke Iwamura
committed
}
CHECK( m_LadfIntervalLowerBound[0] != 0, "abnormal value set to LadfIntervalLowerBound[0]" );
}
#endif
sps.setUseCiip ( m_ciip );
sps.setUseGeo ( m_Geo );
sps.setFpelMmvdEnabledFlag (( m_MMVD ) ? m_allowDisFracMMVD : false);

Xuewei Meng
committed
sps.setBdofControlPresentFlag(m_BIO);
sps.setDmvrControlPresentFlag(m_DMVR);
sps.setProfControlPresentFlag(m_PROF);
sps.setAffineAmvrEnabledFlag ( m_AffineAmvr );
sps.setUseColorTrans(m_useColorTrans);
sps.setPLTMode ( m_PLTMode);
sps.setWrapAroundEnabledFlag ( m_wrapAround );
sps.setWrapAroundOffset ( m_wrapAroundOffset );

Karsten Suehring
committed
// ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here
sps.setUseISP ( m_ISP );
sps.setUseLmcs ( m_lmcsEnabled );
sps.setUseMIP ( m_MIP );
CHECK(m_log2MinCUSize > std::min(6, floorLog2(sps.getMaxCUWidth())), "log2_min_luma_coding_block_size_minus2 shall be in the range of 0 to min (4, log2_ctu_size - 2)");
CHECK(m_uiMaxMTTHierarchyDepth > 2 * (floorLog2(sps.getCTUSize()) - sps.getLog2MinCodingBlockSize()), "sps_max_mtt_hierarchy_depth_inter_slice shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)");
CHECK(m_uiMaxMTTHierarchyDepthI > 2 * (floorLog2(sps.getCTUSize()) - sps.getLog2MinCodingBlockSize()), "sps_max_mtt_hierarchy_depth_intra_slice_luma shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)");
CHECK(m_uiMaxMTTHierarchyDepthIChroma > 2 * (floorLog2(sps.getCTUSize()) - sps.getLog2MinCodingBlockSize()), "sps_max_mtt_hierarchy_depth_intra_slice_chroma shall be in the range 0 to 2*(ctbLog2SizeY - log2MinCUSize)");

Karsten Suehring
committed
sps.setTransformSkipEnabledFlag(m_useTransformSkip);
Shih-Ta Hsiang
committed
sps.setLog2MaxTransformSkipBlockSize(m_log2MaxTransformSkipBlockSize);
Alican Nalci
committed
sps.setBDPCMEnabledFlag(m_useBDPCM);

Karsten Suehring
committed
sps.setSPSTemporalMVPEnabledFlag((getTMVPModeId() == 2 || getTMVPModeId() == 1));
sps.setLog2MaxTbSize ( m_log2MaxTbSize );

Karsten Suehring
committed
for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
{
sps.setBitDepth (ChannelType(channelType), m_bitDepth[channelType] );
sps.setQpBDOffset (ChannelType(channelType), (6 * (m_bitDepth[channelType] - 8)));
#if JVET_R0045_TS_MIN_QP_CLEANUP
sps.setInternalMinusInputBitDepth(ChannelType(channelType), max(0, (m_bitDepth[channelType] - m_inputBitDepth[channelType])));
sps.setMinQpPrimeTsMinus4(ChannelType(channelType), max(0, 6 * (m_bitDepth[channelType] - m_inputBitDepth[channelType])));

Karsten Suehring
committed
}
sps.setEntropyCodingSyncEnabledFlag( m_entropyCodingSyncEnabledFlag );
#if JVET_R0165_OPTIONAL_ENTRY_POINT
sps.setEntryPointsPresentFlag( m_entryPointPresentFlag );
#else
sps.setEntropyCodingSyncEntryPointsPresentFlag( m_entropyCodingSyncEntryPointPresentFlag );
sps.setUseWP( m_useWeightedPred );
sps.setUseWPBiPred( m_useWeightedBiPred );
sps.setSAOEnabledFlag( m_bUseSAO );
sps.setJointCbCrEnabledFlag( m_JointCbCrMode );

Karsten Suehring
committed
sps.setMaxTLayers( m_maxTempLayer );
sps.setTemporalIdNestingFlag( ( m_maxTempLayer == 1 ) ? true : false );
for (int i = 0; i < std::min(sps.getMaxTLayers(), (uint32_t) MAX_TLAYER); i++ )

Karsten Suehring
committed
{
sps.setMaxDecPicBuffering(m_maxDecPicBuffering[i], i);
sps.setNumReorderPics(m_numReorderPics[i], i);
}
sps.setScalingListFlag ( (m_useScalingListId == SCALING_LIST_OFF) ? 0 : 1 );
#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB
if (sps.getUseColorTrans() && sps.getScalingListFlag())
{
sps.setScalingMatrixForAlternativeColourSpaceDisabledFlag( m_disableScalingMatrixForAlternativeColourSpace );
}
else
{
sps.setScalingMatrixForAlternativeColourSpaceDisabledFlag( false );
}
if (sps.getScalingMatrixForAlternativeColourSpaceDisabledFlag())
{
sps.setScalingMatrixDesignatedColourSpaceFlag( m_scalingMatrixDesignatedColourSpace );
}
else
{
sps.setScalingMatrixDesignatedColourSpaceFlag( true );
}

Karsten Suehring
committed
sps.setVuiParametersPresentFlag(getVuiParametersPresentFlag());
if (sps.getVuiParametersPresentFlag())
{
VUI* pcVUI = sps.getVuiParameters();
pcVUI->setAspectRatioInfoPresentFlag(getAspectRatioInfoPresentFlag());
pcVUI->setAspectRatioConstantFlag(!getSampleAspectRatioInfoSEIEnabled());
pcVUI->setAspectRatioIdc(getAspectRatioIdc());
pcVUI->setSarWidth(getSarWidth());
pcVUI->setSarHeight(getSarHeight());
pcVUI->setColourDescriptionPresentFlag(getColourDescriptionPresentFlag());
pcVUI->setColourPrimaries(getColourPrimaries());
pcVUI->setTransferCharacteristics(getTransferCharacteristics());
pcVUI->setMatrixCoefficients(getMatrixCoefficients());
#if JVET_R0090_VUI
pcVUI->setProgressiveSourceFlag (getProgressiveSourceFlag());
pcVUI->setInterlacedSourceFlag (getInterlacedSourceFlag());
#endif
pcVUI->setChromaLocInfoPresentFlag(getChromaLocInfoPresentFlag());
pcVUI->setChromaSampleLocTypeTopField(getChromaSampleLocTypeTopField());
pcVUI->setChromaSampleLocTypeBottomField(getChromaSampleLocTypeBottomField());
pcVUI->setChromaSampleLocType(getChromaSampleLocType());
pcVUI->setOverscanInfoPresentFlag(getOverscanInfoPresentFlag());
pcVUI->setOverscanAppropriateFlag(getOverscanAppropriateFlag());
pcVUI->setVideoFullRangeFlag(getVideoFullRangeFlag());
}

Karsten Suehring
committed
sps.setNumLongTermRefPicSPS(NUM_LONG_TERM_REF_PIC_SPS);
CHECK(!(NUM_LONG_TERM_REF_PIC_SPS <= MAX_NUM_LONG_TERM_REF_PICS), "Unspecified error");
for (int k = 0; k < NUM_LONG_TERM_REF_PIC_SPS; k++)
{
sps.setLtRefPicPocLsbSps(k, 0);
sps.setUsedByCurrPicLtSPSFlag(k, 0);
}
int numQpTables = m_chromaQpMappingTableParams.getSameCQPTableForAllChromaFlag() ? 1 : (sps.getJointCbCrEnabledFlag() ? 3 : 2);
m_chromaQpMappingTableParams.setNumQpTables(numQpTables);
sps.setChromaQpMappingTableFromParams(m_chromaQpMappingTableParams, sps.getQpBDOffset(CHANNEL_TYPE_CHROMA));
Adarsh Krishnan Ramasubramonian
committed
sps.derivedChromaQPMappingTables();

Karsten Suehring
committed
#if U0132_TARGET_BITS_SATURATION
if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() || getCpbSaturationEnabled() )
#else
if( getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() )
#endif
{
xInitHrdParameters(sps);
}
if( getBufferingPeriodSEIEnabled() || getPictureTimingSEIEnabled() || getDecodingUnitInfoSEIEnabled() )
{
sps.setGeneralHrdParametersPresentFlag(true);

Karsten Suehring
committed
}
// Set up SPS range extension settings
sps.getSpsRangeExtension().setTransformSkipRotationEnabledFlag(m_transformSkipRotationEnabledFlag);
sps.getSpsRangeExtension().setTransformSkipContextEnabledFlag(m_transformSkipContextEnabledFlag);
for (uint32_t signallingModeIndex = 0; signallingModeIndex < NUMBER_OF_RDPCM_SIGNALLING_MODES; signallingModeIndex++)
{
sps.getSpsRangeExtension().setRdpcmEnabledFlag(RDPCMSignallingMode(signallingModeIndex), m_rdpcmEnabledFlag[signallingModeIndex]);
}
sps.getSpsRangeExtension().setExtendedPrecisionProcessingFlag(m_extendedPrecisionProcessingFlag);
sps.getSpsRangeExtension().setIntraSmoothingDisabledFlag( m_intraSmoothingDisabledFlag );
sps.getSpsRangeExtension().setHighPrecisionOffsetsEnabledFlag(m_highPrecisionOffsetsEnabledFlag);
sps.getSpsRangeExtension().setPersistentRiceAdaptationEnabledFlag(m_persistentRiceAdaptationEnabledFlag);
sps.getSpsRangeExtension().setCabacBypassAlignmentEnabledFlag(m_cabacBypassAlignmentEnabledFlag);
Kui Fan
committed
sps.setSubPicInfoPresentFlag(m_subPicInfoPresentFlag);
if (m_subPicInfoPresentFlag)
LI JINGYA
committed
{
sps.setNumSubPics(m_numSubPics);
sps.setSubPicCtuTopLeftX(m_subPicCtuTopLeftX);
sps.setSubPicCtuTopLeftY(m_subPicCtuTopLeftY);
sps.setSubPicWidth(m_subPicWidth);
sps.setSubPicHeight(m_subPicHeight);
sps.setSubPicTreatedAsPicFlag(m_subPicTreatedAsPicFlag);
sps.setLoopFilterAcrossSubpicEnabledFlag(m_loopFilterAcrossSubpicEnabledFlag);
sps.setSubPicIdLen(m_subPicIdLen);

Karsten Suehring
committed
sps.setSubPicIdMappingExplicitlySignalledFlag(m_subPicIdMappingExplicitlySignalledFlag);
if (m_subPicIdMappingExplicitlySignalledFlag)
{
sps.setSubPicIdMappingInSpsFlag(m_subPicIdMappingInSpsFlag);
if (m_subPicIdMappingInSpsFlag)
{
sps.setSubPicId(m_subPicId);
}
}
else //In that case, there is only one subpicture that contains the whole picture
{
sps.setNumSubPics(1);
sps.setSubPicCtuTopLeftX(0, 0);
sps.setSubPicCtuTopLeftY(0, 0);
sps.setSubPicWidth(0, m_iSourceWidth);
sps.setSubPicHeight(0, m_iSourceHeight);
sps.setSubPicTreatedAsPicFlag(0, 1);
sps.setLoopFilterAcrossSubpicEnabledFlag(0, 0);

Karsten Suehring
committed
sps.setSubPicIdMappingExplicitlySignalledFlag(false);
FANGJUN PU
committed
sps.setDepQuantEnabledFlag( m_DepQuantEnabledFlag );
if (!sps.getDepQuantEnabledFlag())
{
sps.setSignDataHidingEnabledFlag( m_SignDataHidingEnabledFlag );
}
else
{
sps.setSignDataHidingEnabledFlag(false);
}
sps.setVirtualBoundariesEnabledFlag( m_virtualBoundariesEnabledFlag );
if( sps.getVirtualBoundariesEnabledFlag() )
sps.setVirtualBoundariesPresentFlag( m_virtualBoundariesPresentFlag );
CHECK( sps.getSubPicInfoPresentFlag() && sps.getVirtualBoundariesPresentFlag() != 1, "When subpicture signalling if present, the signalling of virtual boundaries, is present, shall be in the SPS" );
sps.setNumVerVirtualBoundaries ( m_numVerVirtualBoundaries );
sps.setNumHorVirtualBoundaries ( m_numHorVirtualBoundaries );
for( unsigned int i = 0; i < m_numVerVirtualBoundaries; i++ )
{
sps.setVirtualBoundariesPosX ( m_virtualBoundariesPosX[i], i );
}
for( unsigned int i = 0; i < m_numHorVirtualBoundaries; i++ )
{
sps.setVirtualBoundariesPosY ( m_virtualBoundariesPosY[i], i );
}
Vadim Seregin
committed
sps.setInterLayerPresentFlag( m_layerId > 0 && m_vps->getMaxLayers() > 1 && !m_vps->getAllIndependentLayersFlag() && !m_vps->getIndependentLayerFlag( m_vps->getGeneralLayerIdx( m_layerId ) ) );
CHECK( m_vps->getIndependentLayerFlag( m_vps->getGeneralLayerIdx( m_layerId ) ) && sps.getInterLayerPresentFlag(), " When vps_independent_layer_flag[GeneralLayerIdx[nuh_layer_id ]] is equal to 1, the value of inter_layer_ref_pics_present_flag shall be equal to 0." );
#if JVET_R0058
sps.setResChangeInClvsEnabledFlag(m_resChangeInClvsEnabled);
sps.setRprEnabledFlag((m_resChangeInClvsEnabled) || sps.getInterLayerPresentFlag());
#else
sps.setRprEnabledFlag(m_rprEnabled || sps.getInterLayerPresentFlag());
#endif
sps.setLog2ParallelMergeLevelMinus2( m_log2ParallelMergeLevelMinus2 );
#if JVET_R0058
CHECK(sps.getResChangeInClvsEnabledFlag() && sps.getVirtualBoundariesEnabledFlag(), "when the value of res_change_in_clvs_allowed_flag is equal to 1, the value of sps_virtual_boundaries_present_flag shall be equal to 0");
#else
CHECK(sps.getRprEnabledFlag() && sps.getVirtualBoundariesEnabledFlag(), "when the value of res_change_in_clvs_allowed_flag is equal to 1, the value of sps_virtual_boundaries_present_flag shall be equal to 0");
#endif

Karsten Suehring
committed
}
void EncLib::xInitHrdParameters(SPS &sps)
{
m_encHRD.initHRDParameters((EncCfg*) this);
GeneralHrdParams *generalHrdParams = sps.getGeneralHrdParameters();
*generalHrdParams = m_encHRD.getGeneralHrdParameters();
OlsHrdParams *spsOlsHrdParams = sps.getOlsHrdParameters();
for(int i = 0; i < MAX_TLAYER; i++)
{
*spsOlsHrdParams = m_encHRD.getOlsHrdParameters(i);
spsOlsHrdParams++;
}

Karsten Suehring
committed
}
void EncLib::xInitPPS(PPS &pps, const SPS &sps)
{
// pps ID already initialised.
pps.setSPSId(sps.getSPSId());
Kui Fan
committed
pps.setSubPicIdMappingInPpsFlag(false);
pps.setSubPicIdLen(sps.getSubPicIdLen());
for(int picIdx=0; picIdx<pps.getNumSubPics(); picIdx++)
{
pps.setSubPicId(picIdx, sps.getSubPicId(picIdx));
}
bool bUseDQP = (getCuQpDeltaSubdiv() > 0)? true : false;

Karsten Suehring
committed
if((getMaxDeltaQP() != 0 )|| getUseAdaptiveQP())
{
bUseDQP = true;
}
#if SHARP_LUMA_DELTA_QP
if ( getLumaLevelToDeltaQPMapping().isEnabled() )
{
bUseDQP = true;
}
#endif
#if !JVET_R0078_DISABLE_CHROMA_DBF_OFFSET_SINGALLING
if (sps.getChromaFormatIdc() != CHROMA_400)
{
pps.setPPSChromaToolFlag(true);
#endif

Karsten Suehring
committed
#if ENABLE_QPA
if (getUsePerceptQPA() && !bUseDQP)
{
CHECK( m_cuQpDeltaSubdiv != 0, "max. delta-QP subdiv must be zero!" );
bUseDQP = (getBaseQP() < 38) && (getSourceWidth() > 512 || getSourceHeight() > 320);

Karsten Suehring
committed
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
}
#endif
if (m_costMode==COST_SEQUENCE_LEVEL_LOSSLESS || m_costMode==COST_LOSSLESS_CODING)
{
bUseDQP=false;
}
if ( m_RCEnableRateControl )
{
pps.setUseDQP(true);
}
else if(bUseDQP)
{
pps.setUseDQP(true);
}
else
{
pps.setUseDQP(false);
}
if ( m_cuChromaQpOffsetSubdiv >= 0 )
{
pps.clearChromaQpOffsetList();
pps.setChromaQpOffsetListEntry(1, 6, 6, 6);

Karsten Suehring
committed
/* todo, insert table entries from command line (NB, 0 should not be touched) */
}
else
{
pps.clearChromaQpOffsetList();

Karsten Suehring
committed
}
{
int baseQp = 26;
if( 16 == getGOPSize() )
{
baseQp = getBaseQP()-24;
}
else
{
baseQp = getBaseQP()-26;
}
const int maxDQP = 37;

Karsten Suehring
committed
const int minDQP = -26 + sps.getQpBDOffset(CHANNEL_TYPE_LUMA);
pps.setPicInitQPMinus26( std::min( maxDQP, std::max( minDQP, baseQp ) ));
}
#if JVET_R0078_DISABLE_CHROMA_DBF_OFFSET_SINGALLING
if( sps.getJointCbCrEnabledFlag() == false || getChromaFormatIdc() == CHROMA_400 || m_chromaCbCrQpOffset == 0 )
#else
if (sps.getJointCbCrEnabledFlag() == false || getChromaFormatIdc() == CHROMA_400)
#endif
{
pps.setJointCbCrQpOffsetPresentFlag(false);
}
else
{
pps.setJointCbCrQpOffsetPresentFlag(true);
}

Karsten Suehring
committed
#if ER_CHROMA_QP_WCG_PPS
if (getWCGChromaQPControl().isEnabled())
{
const int baseQp=m_iQP+pps.getPPSId();
const double chromaQp = m_wcgChromaQpControl.chromaQpScale * baseQp + m_wcgChromaQpControl.chromaQpOffset;
const double dcbQP = m_wcgChromaQpControl.chromaCbQpScale * chromaQp;
const double dcrQP = m_wcgChromaQpControl.chromaCrQpScale * chromaQp;
const int cbQP =(int)(dcbQP + ( dcbQP < 0 ? -0.5 : 0.5) );
const int crQP =(int)(dcrQP + ( dcrQP < 0 ? -0.5 : 0.5) );
pps.setQpOffset(COMPONENT_Cb, Clip3( -12, 12, min(0, cbQP) + m_chromaCbQpOffset ));
pps.setQpOffset(COMPONENT_Cr, Clip3( -12, 12, min(0, crQP) + m_chromaCrQpOffset));
if(pps.getJointCbCrQpOffsetPresentFlag())
pps.setQpOffset(JOINT_CbCr, Clip3(-12, 12, (min(0, cbQP) + min(0, crQP)) / 2 + m_chromaCbCrQpOffset));
else
pps.setQpOffset(JOINT_CbCr, 0);

Karsten Suehring
committed
}
else
{
#endif
pps.setQpOffset(COMPONENT_Cb, m_chromaCbQpOffset );
pps.setQpOffset(COMPONENT_Cr, m_chromaCrQpOffset );
if (pps.getJointCbCrQpOffsetPresentFlag())
pps.setQpOffset(JOINT_CbCr, m_chromaCbCrQpOffset);
else
pps.setQpOffset(JOINT_CbCr, 0);

Karsten Suehring
committed
#if ER_CHROMA_QP_WCG_PPS
}
#endif
#if W0038_CQP_ADJ
bool bChromaDeltaQPEnabled = false;
{
bChromaDeltaQPEnabled = ( m_sliceChromaQpOffsetIntraOrPeriodic[0] || m_sliceChromaQpOffsetIntraOrPeriodic[1] );
if( !bChromaDeltaQPEnabled )
{
for( int i=0; i<m_iGOPSize; i++ )
{
if( m_GOPList[i].m_CbQPoffset || m_GOPList[i].m_CrQPoffset )
{
bChromaDeltaQPEnabled = true;
break;
}
}
}
}
#if ENABLE_QPA
if ((getUsePerceptQPA() || getSliceChromaOffsetQpPeriodicity() > 0) && (getChromaFormatIdc() != CHROMA_400))
{
bChromaDeltaQPEnabled = true;
}
#endif

Karsten Suehring
committed
pps.setSliceChromaQpFlag(bChromaDeltaQPEnabled);
#endif
!pps.getSliceChromaQpFlag() && sps.getUseDualITree()
&& (getChromaFormatIdc() != CHROMA_400))

Karsten Suehring
committed
{
pps.setSliceChromaQpFlag(m_chromaCbQpOffsetDualTree != 0 || m_chromaCrQpOffsetDualTree != 0 || m_chromaCbCrQpOffsetDualTree != 0);

Karsten Suehring
committed
}
#if JVET_Q0764_WRAP_AROUND_WITH_RPR
int minCbSizeY = (1 << sps.getLog2MinCodingBlockSize());
pps.setWrapAroundEnabledFlag ( m_wrapAround );
if( m_wrapAround )
{
#if JVET_R0162_WRAPAROUND_OFFSET_SIGNALING
pps.setPicWidthMinusWrapAroundOffset ((pps.getPicWidthInLumaSamples()/minCbSizeY) - (m_wrapAroundOffset / minCbSizeY));
pps.setWrapAroundOffset (minCbSizeY *(pps.getPicWidthInLumaSamples() / minCbSizeY- pps.getPicWidthMinusWrapAroundOffset()));
#else
pps.setWrapAroundOffsetMinusCtbSize ( (m_wrapAroundOffset / minCbSizeY) - 2 - (sps.getCTUSize() / minCbSizeY) );
pps.setWrapAroundOffset ( minCbSizeY * (pps.getWrapAroundOffsetMinusCtbSize() + 2 + sps.getCTUSize() / minCbSizeY) );
#endif
#if JVET_R0162_WRAPAROUND_OFFSET_SIGNALING
pps.setPicWidthMinusWrapAroundOffset ( 0 );
#else
pps.setWrapAroundOffsetMinusCtbSize ( 0 );
#endif
pps.setWrapAroundOffset ( 0 );
}
CHECK( !sps.getWrapAroundEnabledFlag() && pps.getWrapAroundEnabledFlag(), "When sps_ref_wraparound_enabled_flag is equal to 0, the value of pps_ref_wraparound_enabled_flag shall be equal to 0.");
CHECK( (((sps.getCTUSize() / minCbSizeY) + 1) > ((pps.getPicWidthInLumaSamples() / minCbSizeY) - 1)) && pps.getWrapAroundEnabledFlag(), "When the value of CtbSizeY / MinCbSizeY + 1 is greater than pic_width_in_luma_samples / MinCbSizeY - 1, the value of pps_ref_wraparound_enabled_flag shall be equal to 0.");
#endif
pps.setNoPicPartitionFlag( m_noPicPartitionFlag );
if( m_noPicPartitionFlag == false )
{
pps.setLog2CtuSize( ceilLog2( sps.getCTUSize()) );
pps.setNumExpTileColumns( (uint32_t) m_tileColumnWidth.size() );
pps.setNumExpTileRows( (uint32_t) m_tileRowHeight.size() );
pps.setTileColumnWidths( m_tileColumnWidth );
pps.setTileRowHeights( m_tileRowHeight );
pps.initTiles();
pps.setRectSliceFlag( m_rectSliceFlag );

Karsten Suehring
committed
pps.setSingleSlicePerSubPicFlag(m_singleSlicePerSubPicFlag);
pps.setNumSlicesInPic( m_numSlicesInPic );
pps.setTileIdxDeltaPresentFlag( m_tileIdxDeltaPresentFlag );
pps.setRectSlices( m_rectSlices );

Karsten Suehring
committed
pps.initRectSliceMap(&sps);
}
else
{
pps.initRasterSliceMap( m_rasterSliceSize );
}
pps.setLoopFilterAcrossTilesEnabledFlag( m_bLFCrossTileBoundaryFlag );
pps.setLoopFilterAcrossSlicesEnabledFlag( m_bLFCrossSliceBoundaryFlag );
}
else
{
pps.setLog2CtuSize( ceilLog2( sps.getCTUSize()) );
pps.setNumExpTileColumns(1);
pps.setNumExpTileRows(1);
pps.addTileColumnWidth( pps.getPicWidthInCtu( ) );
pps.addTileRowHeight( pps.getPicHeightInCtu( ) );
pps.initTiles();
pps.setRectSliceFlag( 1 );
pps.setNumSlicesInPic( 1 );
pps.initRectSlices( );
pps.setTileIdxDeltaPresentFlag( 0 );
pps.setSliceTileIdx( 0, 0 );

Karsten Suehring
committed
pps.initRectSliceMap( &sps );
pps.setLoopFilterAcrossTilesEnabledFlag( true );
pps.setLoopFilterAcrossSlicesEnabledFlag( true );
}

Karsten Suehring
committed
pps.setUseWP( m_useWeightedPred );
pps.setWPBiPred( m_useWeightedBiPred );
pps.setOutputFlagPresentFlag( false );
if ( getDeblockingFilterMetric() )
{
pps.setDeblockingFilterOverrideEnabledFlag(true);
pps.setPPSDeblockingFilterDisabledFlag(false);
}
else
{
pps.setDeblockingFilterOverrideEnabledFlag( !getLoopFilterOffsetInPPS() );
pps.setPPSDeblockingFilterDisabledFlag( getLoopFilterDisable() );
}
if (! pps.getPPSDeblockingFilterDisabledFlag())
{
pps.setDeblockingFilterBetaOffsetDiv2( getLoopFilterBetaOffset() );
pps.setDeblockingFilterTcOffsetDiv2( getLoopFilterTcOffset() );
pps.setDeblockingFilterCbBetaOffsetDiv2( getLoopFilterCbBetaOffset() );
pps.setDeblockingFilterCbTcOffsetDiv2( getLoopFilterCbTcOffset() );
pps.setDeblockingFilterCrBetaOffsetDiv2( getLoopFilterCrBetaOffset() );
pps.setDeblockingFilterCrTcOffsetDiv2( getLoopFilterCrTcOffset() );

Karsten Suehring
committed
}
else
{
pps.setDeblockingFilterBetaOffsetDiv2(0);
pps.setDeblockingFilterTcOffsetDiv2(0);
pps.setDeblockingFilterCbBetaOffsetDiv2(0);
pps.setDeblockingFilterCbTcOffsetDiv2(0);
pps.setDeblockingFilterCrBetaOffsetDiv2(0);
pps.setDeblockingFilterCrTcOffsetDiv2(0);

Karsten Suehring
committed
}
// deblockingFilterControlPresentFlag is true if any of the settings differ from the inferred values:
const bool deblockingFilterControlPresentFlag = pps.getDeblockingFilterOverrideEnabledFlag() ||
pps.getPPSDeblockingFilterDisabledFlag() ||
pps.getDeblockingFilterBetaOffsetDiv2() != 0 ||
pps.getDeblockingFilterTcOffsetDiv2() != 0 ||
pps.getDeblockingFilterCbBetaOffsetDiv2() != 0 ||
pps.getDeblockingFilterCbTcOffsetDiv2() != 0 ||
pps.getDeblockingFilterCrBetaOffsetDiv2() != 0 ||
pps.getDeblockingFilterCrTcOffsetDiv2() != 0;

Karsten Suehring
committed
pps.setDeblockingFilterControlPresentFlag(deblockingFilterControlPresentFlag);
pps.setCabacInitPresentFlag(CABAC_INIT_PRESENT_FLAG);
pps.setLoopFilterAcrossSlicesEnabledFlag( m_bLFCrossSliceBoundaryFlag );
#if JVET_R0078_DISABLE_CHROMA_DBF_OFFSET_SINGALLING
bool chromaQPOffsetNotZero = false;
if( pps.getQpOffset(COMPONENT_Cb) != 0 || pps.getQpOffset(COMPONENT_Cr) != 0 || pps.getJointCbCrQpOffsetPresentFlag() || pps.getSliceChromaQpFlag() || pps.getCuChromaQpOffsetListEnabledFlag() )
{
chromaQPOffsetNotZero = true;
bool chromaDbfOffsetNotSameAsLuma = true;
if( pps.getDeblockingFilterCbBetaOffsetDiv2() == pps.getDeblockingFilterBetaOffsetDiv2() && pps.getDeblockingFilterCrBetaOffsetDiv2() == pps.getDeblockingFilterBetaOffsetDiv2()
&& pps.getDeblockingFilterCbTcOffsetDiv2() == pps.getDeblockingFilterTcOffsetDiv2() && pps.getDeblockingFilterCrTcOffsetDiv2() == pps.getDeblockingFilterTcOffsetDiv2() )
{
chromaDbfOffsetNotSameAsLuma = false;
}
const uint32_t chromaArrayType = (int)sps.getSeparateColourPlaneFlag() ? 0 : sps.getChromaFormatIdc();
if( ( chromaArrayType != CHROMA_400 ) && ( chromaQPOffsetNotZero || chromaDbfOffsetNotSameAsLuma ) )
{
pps.setPPSChromaToolFlag(true);
}
else
{
pps.setPPSChromaToolFlag(false);
}
#endif

Karsten Suehring
committed
int histogram[MAX_NUM_REF + 1];
for( int i = 0; i <= MAX_NUM_REF; i++ )
{
histogram[i]=0;
}
for( int i = 0; i < getGOPSize(); i++)
{
CHECK(!(getRPLEntry(0, i).m_numRefPicsActive >= 0 && getRPLEntry(0, i).m_numRefPicsActive <= MAX_NUM_REF), "Unspecified error");
histogram[getRPLEntry(0, i).m_numRefPicsActive]++;

Karsten Suehring
committed
}
int maxHist=-1;
int bestPos=0;
for( int i = 0; i <= MAX_NUM_REF; i++ )
{
if(histogram[i]>maxHist)
{
maxHist=histogram[i];
bestPos=i;
}
}
CHECK(!(bestPos <= 15), "Unspecified error");
pps.setNumRefIdxL0DefaultActive(bestPos);

Karsten Suehring
committed
pps.setNumRefIdxL1DefaultActive(bestPos);
pps.setPictureHeaderExtensionPresentFlag(false);
Sheng-Yen Lin
committed
pps.setRplInfoInPhFlag(getSliceLevelRpl() ? false : true);
pps.setDbfInfoInPhFlag(getSliceLevelDblk() ? false : true);
pps.setSaoInfoInPhFlag(getSliceLevelSao() ? false : true);
pps.setAlfInfoInPhFlag(getSliceLevelAlf() ? false : true);
pps.setWpInfoInPhFlag(getSliceLevelWp() ? false : true);
pps.setQpDeltaInfoInPhFlag(getSliceLevelDeltaQp() ? false : true);

Karsten Suehring
committed
pps.pcv = new PreCalcValues( sps, pps, true );
pps.setRpl1IdxPresentFlag(sps.getRPL1IdxPresentFlag());

Karsten Suehring
committed
}
void EncLib::xInitPicHeader(PicHeader &picHeader, const SPS &sps, const PPS &pps)
{
int i;
picHeader.initPicHeader();
// parameter sets
picHeader.setSPSId( sps.getSPSId() );
picHeader.setPPSId( pps.getPPSId() );
picHeader.setMaxNumAffineMergeCand(getMaxNumAffineMergeCand());
// copy partitioning constraints from SPS
picHeader.setSplitConsOverrideFlag(false);
picHeader.setMinQTSizes( sps.getMinQTSizes() );
picHeader.setMaxMTTHierarchyDepths( sps.getMaxMTTHierarchyDepths() );
picHeader.setMaxBTSizes( sps.getMaxBTSizes() );
picHeader.setMaxTTSizes( sps.getMaxTTSizes() );
#if !JVET_R0271_SLICE_LEVEL_DQ_SDH_RRC
picHeader.setDepQuantEnabledFlag( sps.getDepQuantEnabledFlag() );
picHeader.setSignDataHidingEnabledFlag( sps.getSignDataHidingEnabledFlag() );
#endif
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
bool bUseDQP = (getCuQpDeltaSubdiv() > 0)? true : false;
if( (getMaxDeltaQP() != 0 )|| getUseAdaptiveQP() )
{
bUseDQP = true;
}
#if SHARP_LUMA_DELTA_QP
if( getLumaLevelToDeltaQPMapping().isEnabled() )
{
bUseDQP = true;
}
#endif
#if ENABLE_QPA
if( getUsePerceptQPA() && !bUseDQP )
{
CHECK( m_cuQpDeltaSubdiv != 0, "max. delta-QP subdiv must be zero!" );
bUseDQP = (getBaseQP() < 38) && (getSourceWidth() > 512 || getSourceHeight() > 320);
}
#endif
if( m_costMode==COST_SEQUENCE_LEVEL_LOSSLESS || m_costMode==COST_LOSSLESS_CODING )
{
bUseDQP=false;
}
if( m_RCEnableRateControl )
{
picHeader.setCuQpDeltaSubdivIntra( 0 );
picHeader.setCuQpDeltaSubdivInter( 0 );
}
else if( bUseDQP )
{
picHeader.setCuQpDeltaSubdivIntra( m_cuQpDeltaSubdiv );
picHeader.setCuQpDeltaSubdivInter( m_cuQpDeltaSubdiv );
}
else
{
picHeader.setCuQpDeltaSubdivIntra( 0 );
picHeader.setCuQpDeltaSubdivInter( 0 );
}
if( m_cuChromaQpOffsetSubdiv >= 0 )
{
picHeader.setCuChromaQpOffsetSubdivIntra(m_cuChromaQpOffsetSubdiv);
picHeader.setCuChromaQpOffsetSubdivInter(m_cuChromaQpOffsetSubdiv);
}
else
{
picHeader.setCuChromaQpOffsetSubdivIntra(0);
picHeader.setCuChromaQpOffsetSubdivInter(0);
}
if( sps.getVirtualBoundariesEnabledFlag() )
{
picHeader.setVirtualBoundariesPresentFlag( sps.getVirtualBoundariesPresentFlag() );
picHeader.setNumVerVirtualBoundaries(sps.getNumVerVirtualBoundaries());
picHeader.setNumHorVirtualBoundaries(sps.getNumHorVirtualBoundaries());
for(i=0; i<3; i++) {
picHeader.setVirtualBoundariesPosX(sps.getVirtualBoundariesPosX(i), i);
picHeader.setVirtualBoundariesPosY(sps.getVirtualBoundariesPosY(i), i);
}
}
// gradual decoder refresh flag
picHeader.setGdrPicFlag(false);

Xuewei Meng
committed
picHeader.setDisBdofFlag(false);
picHeader.setDisDmvrFlag(false);
picHeader.setDisProfFlag(false);
void EncLib::xInitAPS(APS &aps)
{
//Do nothing now
}
void EncLib::xInitRPL(SPS &sps, bool isFieldCoding)
{
ReferencePictureList* rpl;
int numRPLCandidates = getRPLCandidateSize(0);
// To allocate one additional memory for RPL of POC1 (first bottom field) which is not specified in cfg file
sps.createRPLList0(numRPLCandidates + (isFieldCoding ? 1 : 0));
sps.createRPLList1(numRPLCandidates + (isFieldCoding ? 1 : 0));
RPLList* rplList = 0;
for (int i = 0; i < 2; i++)
{
rplList = (i == 0) ? sps.getRPLList0() : sps.getRPLList1();
for (int j = 0; j < numRPLCandidates; j++)
{
const RPLEntry &ge = getRPLEntry(i, j);
rpl = rplList->getReferencePictureList(j);
rpl->setNumberOfShorttermPictures(ge.m_numRefPics);
rpl->setNumberOfLongtermPictures(0); //Hardcoded as 0 for now. need to update this when implementing LTRP
rpl->setNumberOfActivePictures(ge.m_numRefPicsActive);
Philip Cowan
committed
rpl->setLtrpInSliceHeaderFlag(ge.m_ltrp_in_slice_header_flag);
rpl->setInterLayerPresentFlag( sps.getInterLayerPresentFlag() );
// inter-layer reference picture is not signaled in SPS RPL, SPS is shared currently
rpl->setNumberOfInterLayerPictures( 0 );
for (int k = 0; k < ge.m_numRefPics; k++)
{
rpl->setRefPicIdentifier( k, ge.m_deltaRefPics[k], 0, false, 0 );
if (isFieldCoding)
{
// To set RPL of POC1 (first bottom field) which is not specified in cfg file
for (int i = 0; i < 2; i++)
{
rplList = (i == 0) ? sps.getRPLList0() : sps.getRPLList1();
rpl = rplList->getReferencePictureList(numRPLCandidates);
rpl->setNumberOfShorttermPictures(1);
rpl->setNumberOfLongtermPictures(0);
rpl->setNumberOfActivePictures(1);
rpl->setLtrpInSliceHeaderFlag(0);
rpl->setRefPicIdentifier(0, 1, 0, false, 0);
rpl->setPOC(0, 0);
}
}