Commit 0ef3d5a6 authored by Han Gao's avatar Han Gao

move QT/BT/TT HLS from SPSNEXT to SPS, rebased master

parent 016e68f1
......@@ -1809,6 +1809,7 @@ SPSNext::SPSNext( SPS& sps )
#endif
// default values for additional parameters
#if !JVET_L0217_L0678_SPS_CLEANUP
, m_CTUSize ( 0 )
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
, m_minQT { 0, 0, 0 }
......@@ -1820,6 +1821,7 @@ SPSNext::SPSNext( SPS& sps )
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
, m_maxTTSize { MAX_TT_SIZE, MAX_TT_SIZE_INTER, MAX_TT_SIZE_C }
#endif
#endif
#if !JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK
, m_subPuLog2Size ( 0 )
#endif
......@@ -1847,6 +1849,19 @@ SPS::SPS()
, m_picHeightInLumaSamples (288)
, m_log2MinCodingBlockSize ( 0)
, m_log2DiffMaxMinCodingBlockSize(0)
#if JVET_L0217_L0678_SPS_CLEANUP
, m_CTUSize(0)
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
, m_minQT{ 0, 0, 0 }
#else
, m_minQT{ 0, 0 }
#endif
, m_maxBTDepth{ MAX_BT_DEPTH, MAX_BT_DEPTH_INTER, MAX_BT_DEPTH_C }
, m_maxBTSize{ MAX_BT_SIZE, MAX_BT_SIZE_INTER, MAX_BT_SIZE_C }
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
, m_maxTTSize{ MAX_TT_SIZE, MAX_TT_SIZE_INTER, MAX_TT_SIZE_C }
#endif
#endif
, m_uiMaxCUWidth ( 32)
, m_uiMaxCUHeight ( 32)
, m_uiMaxCodingDepth ( 3)
......
......@@ -841,6 +841,7 @@ public:
private:
//===== additional parameters =====
// qtbt
#if !JVET_L0217_L0678_SPS_CLEANUP
unsigned m_CTUSize;
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
unsigned m_partitionOverrideEnalbed; // enable partition constraints override function
......@@ -852,6 +853,7 @@ private:
unsigned m_maxTTSize[3];
#endif
unsigned m_dualITree;
#endif
// sub-pu merging
#if !JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK
unsigned m_subPuLog2Size;
......@@ -927,6 +929,7 @@ public:
#endif
//===== additional parameters =====
// qtbt
#if !JVET_L0217_L0678_SPS_CLEANUP
void setCTUSize ( unsigned ctuSize ) { m_CTUSize = ctuSize; }
unsigned getCTUSize () const { return m_CTUSize; }
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
......@@ -960,7 +963,7 @@ public:
void setUseDualITree ( bool b ) { m_dualITree = b; }
bool getUseDualITree () const { return m_dualITree; }
#endif
// sub pu tmvp
#if !JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK
void setSubPuMvpLog2Size ( unsigned log2Size ) { m_subPuLog2Size = log2Size; }
......@@ -1013,6 +1016,19 @@ private:
int m_log2MinCodingBlockSize;
int m_log2DiffMaxMinCodingBlockSize;
#if JVET_L0217_L0678_SPS_CLEANUP
unsigned m_CTUSize;
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
unsigned m_partitionOverrideEnalbed; // enable partition constraints override function
#endif
unsigned m_minQT[3]; // 0: I slice luma; 1: P/B slice; 2: I slice chroma
unsigned m_maxBTDepth[3];
unsigned m_maxBTSize[3];
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
unsigned m_maxTTSize[3];
#endif
unsigned m_dualITree;
#endif
uint32_t m_uiMaxCUWidth;
uint32_t m_uiMaxCUHeight;
uint32_t m_uiMaxCodingDepth; ///< Total CU depth, relative to the smallest possible transform block size.
......@@ -1115,6 +1131,44 @@ public:
void setLog2MinCodingBlockSize(int val) { m_log2MinCodingBlockSize = val; }
int getLog2DiffMaxMinCodingBlockSize() const { return m_log2DiffMaxMinCodingBlockSize; }
void setLog2DiffMaxMinCodingBlockSize(int val) { m_log2DiffMaxMinCodingBlockSize = val; }
#if JVET_L0217_L0678_SPS_CLEANUP
void setCTUSize(unsigned ctuSize) { m_CTUSize = ctuSize; }
unsigned getCTUSize() const { return m_CTUSize; }
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
void setSplitConsOverrideEnabledFlag(bool b) { m_partitionOverrideEnalbed = b; }
bool getSplitConsOverrideEnabledFlag() const { return m_partitionOverrideEnalbed; }
#endif
void setMinQTSizes(unsigned* minQT) { m_minQT[0] = minQT[0]; m_minQT[1] = minQT[1]; m_minQT[2] = minQT[2]; }
unsigned getMinQTSize(SliceType slicetype,
ChannelType chType = CHANNEL_TYPE_LUMA)
const { return slicetype == I_SLICE ? (chType == CHANNEL_TYPE_LUMA ? m_minQT[0] : m_minQT[2]) : m_minQT[1]; }
void setMaxBTDepth(unsigned maxBTDepth,
unsigned maxBTDepthI,
unsigned maxBTDepthIChroma)
{ m_maxBTDepth[1] = maxBTDepth; m_maxBTDepth[0] = maxBTDepthI; m_maxBTDepth[2] = maxBTDepthIChroma; }
unsigned getMaxBTDepth() const { return m_maxBTDepth[1]; }
unsigned getMaxBTDepthI() const { return m_maxBTDepth[0]; }
unsigned getMaxBTDepthIChroma() const { return m_maxBTDepth[2]; }
void setMaxBTSize(unsigned maxBTSize,
unsigned maxBTSizeI,
unsigned maxBTSizeC)
{ m_maxBTSize[1] = maxBTSize; m_maxBTSize[0] = maxBTSizeI; m_maxBTSize[2] = maxBTSizeC; }
unsigned getMaxBTSize() const { return m_maxBTSize[1]; }
unsigned getMaxBTSizeI() const { return m_maxBTSize[0]; }
unsigned getMaxBTSizeIChroma() const { return m_maxBTSize[2]; }
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
void setMaxTTSize(unsigned maxTTSize,
unsigned maxTTSizeI,
unsigned maxTTSizeC)
{ m_maxTTSize[1] = maxTTSize; m_maxTTSize[0] = maxTTSizeI; m_maxTTSize[2] = maxTTSizeC; }
unsigned getMaxTTSize() const { return m_maxTTSize[1]; }
unsigned getMaxTTSizeI() const { return m_maxTTSize[0]; }
unsigned getMaxTTSizeIChroma() const { return m_maxTTSize[2]; }
#endif
void setUseDualITree(bool b) { m_dualITree = b; }
bool getUseDualITree() const { return m_dualITree; }
#endif
void setMaxCUWidth( uint32_t u ) { m_uiMaxCUWidth = u; }
uint32_t getMaxCUWidth() const { return m_uiMaxCUWidth; }
......@@ -2175,6 +2229,19 @@ public:
, fastDeltaQPCuMaxSize( Clip3(sps.getMaxCUHeight() >> (sps.getLog2DiffMaxMinCodingBlockSize()), sps.getMaxCUHeight(), 32u) )
, noChroma2x2 ( false )
, isEncoder ( _isEncoder )
#if JVET_L0217_L0678_SPS_CLEANUP
, ISingleTree ( !sps.getUseDualITree() )
, maxBtDepth { sps.getMaxBTDepthI(), sps.getMaxBTDepth(), sps.getMaxBTDepthIChroma() }
, minBtSize { MIN_BT_SIZE, MIN_BT_SIZE_INTER, MIN_BT_SIZE_C }
, maxBtSize { sps.getMaxBTSizeI(), sps.getMaxBTSize(), sps.getMaxBTSizeIChroma() }
, minTtSize { MIN_TT_SIZE, MIN_TT_SIZE_INTER, MIN_TT_SIZE_C }
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
, maxTtSize { sps.getMaxTTSizeI(), sps.getMaxTTSize(), sps.getMaxTTSizeIChroma() }
#else
, maxTtSize { MAX_TT_SIZE, MAX_TT_SIZE_INTER, MAX_TT_SIZE_C }
#endif
, minQtSize { sps.getMinQTSize(I_SLICE, CHANNEL_TYPE_LUMA), sps.getMinQTSize(B_SLICE, CHANNEL_TYPE_LUMA), sps.getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA) }
#else
, ISingleTree ( !sps.getSpsNext().getUseDualITree() )
, maxBtDepth { sps.getSpsNext().getMaxBTDepthI(), sps.getSpsNext().getMaxBTDepth(), sps.getSpsNext().getMaxBTDepthIChroma() }
, minBtSize { MIN_BT_SIZE, MIN_BT_SIZE_INTER, MIN_BT_SIZE_C }
......@@ -2186,6 +2253,7 @@ public:
, maxTtSize { MAX_TT_SIZE, MAX_TT_SIZE_INTER, MAX_TT_SIZE_C }
#endif
, minQtSize { sps.getSpsNext().getMinQTSize( I_SLICE, CHANNEL_TYPE_LUMA ), sps.getSpsNext().getMinQTSize( B_SLICE, CHANNEL_TYPE_LUMA ), sps.getSpsNext().getMinQTSize( I_SLICE, CHANNEL_TYPE_CHROMA ) }
#endif
{}
const ChromaFormat chrFormat;
......
......@@ -175,6 +175,8 @@
#endif
#define JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT 1
#define JVET_L0217_L0678_SPS_CLEANUP 1 // move the QT/BT/TT related high level syntax element from SPSNext to SPS, delete HEVC RQT in SPS
#define JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK 1 // Fix sub-block size to 8x8 in ATMVP as proposed in L0198, L0468 and L0104
#define JVET_L0198_ATMVP_SCAN_SIMP 1 // Simplification for scan process in ATMVP cTMv derivation
......
......@@ -132,7 +132,11 @@ void Partitioner::copyState( const Partitioner& other )
void AdaptiveDepthPartitioner::setMaxMinDepth( unsigned& minDepth, unsigned& maxDepth, const CodingStructure& cs ) const
{
unsigned stdMinDepth = 0;
unsigned stdMaxDepth = ( g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), chType )]);
#if JVET_L0217_L0678_SPS_CLEANUP
unsigned stdMaxDepth = ( g_aucLog2[cs.sps->getCTUSize()] - g_aucLog2[cs.sps->getMinQTSize( cs.slice->getSliceType(), chType )]);
#else
unsigned stdMaxDepth = (g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize(cs.slice->getSliceType(), chType)]);
#endif
const Position pos = currArea().blocks[chType].pos();
const unsigned curSliceIdx = cs.slice->getIndependentSliceIdx();
#if HEVC_TILES_WPP
......
......@@ -2609,7 +2609,11 @@ void PU::xInheritedAffineMv( const PredictionUnit &pu, const PredictionUnit* puN
#if JVET_L0694_AFFINE_LINEBUFFER_CLEANUP
bool isTopCtuBoundary = false;
if ( (posNeiY + neiH) % pu.cs->sps->getSpsNext().getCTUSize() == 0 && (posNeiY + neiH) == posCurY )
#if JVET_L0217_L0678_SPS_CLEANUP
if ( (posNeiY + neiH) % pu.cs->sps->getCTUSize() == 0 && (posNeiY + neiH) == posCurY )
#else
if ((posNeiY + neiH) % pu.cs->sps->getSpsNext().getCTUSize() == 0 && (posNeiY + neiH) == posCurY)
#endif
{
// use bottom-left and bottom-right sub-block MVs for inheritance
const Position posRB = puNeighbour->Y().bottomRight();
......@@ -4189,14 +4193,24 @@ static bool deriveScaledMotionTemporal( const Slice& slice,
void clipColPos(int& posX, int& posY, const PredictionUnit& pu)
{
Position puPos = pu.lumaPos();
#if JVET_L0217_L0678_SPS_CLEANUP
int log2CtuSize = g_aucLog2[pu.cs->sps->getCTUSize()];
#else
int log2CtuSize = g_aucLog2[pu.cs->sps->getSpsNext().getCTUSize()];
#endif
int ctuX = ((puPos.x >> log2CtuSize) << log2CtuSize);
int ctuY = ((puPos.y >> log2CtuSize) << log2CtuSize);
#if JVET_L0217_L0678_SPS_CLEANUP
int horMax = std::min((int)pu.cs->sps->getPicWidthInLumaSamples() - 1, ctuX + (int)pu.cs->sps->getCTUSize() + 3);
int horMin = std::max((int)0, ctuX);
int verMax = std::min((int)pu.cs->sps->getPicHeightInLumaSamples() - 1, ctuY + (int)pu.cs->sps->getCTUSize() - 1);
int verMin = std::max((int)0, ctuY);
#else
int horMax = std::min((int)pu.cs->sps->getPicWidthInLumaSamples() - 1, ctuX + (int)pu.cs->sps->getSpsNext().getCTUSize() + 3);
int horMin = std::max((int)0, ctuX);
int verMax = std::min((int)pu.cs->sps->getPicHeightInLumaSamples() - 1, ctuY + (int)pu.cs->sps->getSpsNext().getCTUSize() - 1);
int verMin = std::max((int)0, ctuY);
#endif
posX = std::min(horMax, std::max(horMin, posX));
posY = std::min(verMax, std::max(verMin, posY));
......
......@@ -633,7 +633,11 @@ PartSplit CABACReader::split_cu_mode_mt( CodingStructure& cs, Partitioner &parti
bool CABACReader::split_cu_flag( CodingStructure& cs, Partitioner &partitioner )
{
// TODO: make maxQTDepth a slice parameter
#if JVET_L0217_L0678_SPS_CLEANUP
unsigned maxQTDepth = (g_aucLog2[cs.sps->getCTUSize()] - g_aucLog2[cs.sps->getMinQTSize(cs.slice->getSliceType(), partitioner.chType)]);
#else
unsigned maxQTDepth = ( g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), partitioner.chType )] );
#endif
if( partitioner.currDepth == maxQTDepth )
{
return false;
......
......@@ -830,6 +830,7 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM )
#endif
// additional parameters
#if !JVET_L0217_L0678_SPS_CLEANUP
unsigned minQT [3] = { 0, 0, 0 };
unsigned maxBTD[3] = { 0, 0, 0 };
......@@ -894,7 +895,7 @@ void HLSyntaxReader::parseSPSNext( SPSNext& spsNext, const bool usePCM )
#else
spsNext.setMaxBTDepth( maxBTD[0], maxBTD[1], maxBTD[2] );
#endif
#endif
if( spsNext.getUseSubPuMvp() )
{
#if !JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK
......@@ -1020,7 +1021,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
}
}
#if !JVET_L0217_L0678_SPS_CLEANUP
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
READ_UVLC( uiCode, "log2_min_luma_coding_block_size_minus2");
int log2MinCUSize = uiCode + 2;
......@@ -1031,26 +1032,104 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
pcSPS->setLog2MinCodingBlockSize(log2MinCUSize);
READ_UVLC( uiCode, "log2_diff_max_min_luma_coding_block_size" );
pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
#endif
#if JVET_L0217_L0678_SPS_CLEANUP
unsigned minQT[3] = { 0, 0, 0 };
unsigned maxBTD[3] = { 0, 0, 0 };
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
unsigned maxBTSize[3] = { 0, 0, 0 };
unsigned maxTTSize[3] = { 0, 0, 0 };
#endif
READ_FLAG(uiCode, "qtbt_dual_intra_tree"); pcSPS->setUseDualITree(uiCode);
READ_UVLC(uiCode, "log2_CTU_size_minus2"); pcSPS->setCTUSize(1 << (uiCode + 2));
pcSPS->setMaxCodingDepth(uiCode);
pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
pcSPS->setMaxCUWidth(pcSPS->getCTUSize());
pcSPS->setMaxCUHeight(pcSPS->getCTUSize());
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
READ_UVLC(uiCode, "log2_min_luma_coding_block_size_minus2");
int log2MinCUSize = uiCode + 2;
#else
READ_UVLC(uiCode, "log2_min_luma_coding_block_size_minus3");
int log2MinCUSize = uiCode + 3;
#endif
pcSPS->setLog2MinCodingBlockSize(log2MinCUSize);
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
READ_FLAG(uiCode, "sps_override_partition_constraints_enable_flag"); pcSPS->setSplitConsOverrideEnabledFlag(uiCode);
READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_slice"); minQT[0] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_inter_slice"); minQT[1] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_inter_slices"); maxBTD[1] = uiCode;
READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_slices"); maxBTD[0] = uiCode;
#else
READ_UVLC(uiCode, "log2_minQT_ISlice_minus2"); minQT[0] = 1 << (uiCode + MIN_CU_LOG2);
READ_UVLC(uiCode, "log2_minQT_PBSlice_minus2"); minQT[1] = 1 << (uiCode + MIN_CU_LOG2);
READ_UVLC(uiCode, "max_bt_depth"); maxBTD[0] = uiCode;
READ_UVLC(uiCode, "max_bt_depth_i_slice"); maxBTD[1] = uiCode;
#endif
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
maxTTSize[0] = maxBTSize[0] = minQT[0];
if (maxBTD[0] != 0)
{
READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_slice"); maxBTSize[0] <<= uiCode;
READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_slice"); maxTTSize[0] <<= uiCode;
}
maxTTSize[1] = maxBTSize[1] = minQT[1];
if (maxBTD[1] != 0)
{
READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_inter_slice"); maxBTSize[1] <<= uiCode;
READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_inter_slice"); maxTTSize[1] <<= uiCode;
}
#endif
if (pcSPS->getUseDualITree())
{
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_slice_chroma"); minQT[2] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_slices_chroma"); maxBTD[2] = uiCode;
maxTTSize[2] = maxBTSize[2] = minQT[2];
if (maxBTD[2] != 0)
{
READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_slice_chroma"); maxBTSize[2] <<= uiCode;
READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_slice_chroma"); maxTTSize[2] <<= uiCode;
}
#else
READ_UVLC(uiCode, "log2_minQT_ISliceChroma_minus2"); minQT[2] = 1 << (uiCode + MIN_CU_LOG2);
READ_UVLC(uiCode, "max_bt_depth_i_slice_chroma"); maxBTD[2] = uiCode;
#endif
}
pcSPS->setMinQTSizes(minQT);
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
pcSPS->setMaxBTDepth(maxBTD[1], maxBTD[0], maxBTD[2]);
pcSPS->setMaxBTSize(maxBTSize[1], maxBTSize[0], maxBTSize[2]);
pcSPS->setMaxTTSize(maxTTSize[1], maxTTSize[0], maxTTSize[2]);
#else
pcSPS->setMaxBTDepth(maxBTD[0], maxBTD[1], maxBTD[2]);
#endif
#endif
if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5)
{
CHECK(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() < 5, "Invalid code");
}
#if !JVET_L0217_L0678_SPS_CLEANUP
int maxCUDepthDelta = uiCode;
pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) );
pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) );
#endif
READ_UVLC( uiCode, "log2_min_luma_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 );
READ_UVLC( uiCode, "log2_diff_max_min_luma_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() );
pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) );
#if !JVET_L0217_L0678_SPS_CLEANUP
READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode + 1 );
READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode + 1 );
int addCuDepth = std::max (0, log2MinCUSize - (int)pcSPS->getQuadtreeTULog2MinSize() );
pcSPS->setMaxCodingDepth( maxCUDepthDelta + addCuDepth );
#endif
READ_FLAG( uiCode, "sps_alf_enable_flag" ); pcSPS->setUseALF( uiCode );
#if HEVC_USE_SCALING_LISTS
......@@ -1729,7 +1808,13 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
}
#endif
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
if (sps->getSpsNext().getSplitConsOverrideEnabledFlag())
if (
#if JVET_L0217_L0678_SPS_CLEANUP
sps->getSplitConsOverrideEnabledFlag()
#else
sps->getSpsNext().getSplitConsOverrideEnabledFlag()
#endif
)
{
READ_FLAG(uiCode, "partition_constrainst_override_flag"); pcSlice->setSplitConsOverrideFlag(uiCode ? true : false);
if (pcSlice->getSplitConsOverrideFlag())
......@@ -1746,7 +1831,13 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
pcSlice->setMaxBTSize(pcSlice->getMinQTSize());
pcSlice->setMaxTTSize(pcSlice->getMinQTSize());
}
if (pcSlice->isIntra() && sps->getSpsNext().getUseDualITree())
if (
#if JVET_L0217_L0678_SPS_CLEANUP
pcSlice->isIntra() && sps->getUseDualITree()
#else
pcSlice->isIntra() && sps->getSpsNext().getUseDualITree()
#endif
)
{
READ_UVLC(uiCode, "log2_diff_min_qt_min_cb_chroma"); pcSlice->setMinQTSizeIChroma(1 << (uiCode + sps->getLog2MinCodingBlockSize()));
READ_UVLC(uiCode, "max_mtt_hierarchy_depth_chroma"); pcSlice->setMaxBTDepthIChroma(uiCode);
......
......@@ -529,7 +529,11 @@ void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitione
void CABACWriter::split_cu_flag( bool split, const CodingStructure& cs, Partitioner& partitioner )
{
#if JVET_L0217_L0678_SPS_CLEANUP
unsigned maxQTDepth = ( g_aucLog2[cs.sps->getCTUSize()] - g_aucLog2[cs.sps->getMinQTSize(cs.slice->getSliceType(), partitioner.chType)] );
#else
unsigned maxQTDepth = ( g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( cs.slice->getSliceType(), partitioner.chType )] );
#endif
if( partitioner.currDepth == maxQTDepth )
{
return;
......
......@@ -1236,7 +1236,11 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
if( m_pcEncCfg->getUseFastLCTU() )
{
unsigned minDepth = 0;
#if JVET_L0217_L0678_SPS_CLEANUP
unsigned maxDepth = g_aucLog2[tempCS->sps->getCTUSize()] - g_aucLog2[tempCS->sps->getMinQTSize(slice.getSliceType(), partitioner.chType)];
#else
unsigned maxDepth = g_aucLog2[tempCS->sps->getSpsNext().getCTUSize()] - g_aucLog2[tempCS->sps->getSpsNext().getMinQTSize( slice.getSliceType(), partitioner.chType )];
#endif
if( auto ad = dynamic_cast<AdaptiveDepthPartitioner*>( &partitioner ) )
{
......
......@@ -824,15 +824,26 @@ void EncLib::xInitSPS(SPS &sps)
sps.setLog2DiffMaxMinCodingBlockSize(m_log2DiffMaxMinCodingBlockSize);
sps.getSpsNext().setNextToolsEnabled ( m_profile == Profile::NEXT );
sps.getSpsNext().setCTUSize ( m_CTUSize );
#if JVET_L0217_L0678_SPS_CLEANUP
sps.setCTUSize ( m_CTUSize );
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
sps.getSpsNext().setSplitConsOverrideEnabledFlag( m_useSplitConsOverride );
sps.setSplitConsOverrideEnabledFlag ( m_useSplitConsOverride );
#endif
sps.setMinQTSizes ( m_uiMinQT );
sps.getSpsNext().setUseLargeCTU ( m_LargeCTU );
sps.setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma );
sps.setUseDualITree ( m_dualITree );
#else
sps.getSpsNext().setCTUSize (m_CTUSize);
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
sps.getSpsNext().setSplitConsOverrideEnabledFlag(m_useSplitConsOverride);
#endif
sps.getSpsNext().setMinQTSizes ( m_uiMinQT );
sps.getSpsNext().setUseLargeCTU ( m_LargeCTU );
sps.getSpsNext().setMaxBTDepth ( m_uiMaxBTDepth, m_uiMaxBTDepthI, m_uiMaxBTDepthIChroma );
sps.getSpsNext().setUseDualITree ( m_dualITree );
sps.getSpsNext().setSubPuMvpMode(m_SubPuMvpMode);
#endif
sps.getSpsNext().setSubPuMvpMode ( m_SubPuMvpMode );
#if !JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK
sps.getSpsNext().setSubPuMvpLog2Size(m_SubPuMvpLog2Size);
#endif
......@@ -1315,7 +1326,13 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
#endif
pps.setSliceChromaQpFlag(bChromaDeltaQPEnabled);
#endif
if (!pps.getSliceChromaQpFlag() && sps.getSpsNext().getUseDualITree() && (getChromaFormatIdc() != CHROMA_400))
if (
#if JVET_L0217_L0678_SPS_CLEANUP
!pps.getSliceChromaQpFlag() && sps.getUseDualITree()
#else
!pps.getSliceChromaQpFlag() && sps.getSpsNext().getUseDualITree()
#endif
&& (getChromaFormatIdc() != CHROMA_400))
{
pps.setSliceChromaQpFlag(m_chromaCbQpOffsetDualTree != 0 || m_chromaCrQpOffsetDualTree != 0);
}
......
......@@ -878,7 +878,11 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
{
// Min/max depth
unsigned minDepth = 0;
unsigned maxDepth = g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize( m_slice->getSliceType(), partitioner.chType )];
#if JVET_L0217_L0678_SPS_CLEANUP
unsigned maxDepth = g_aucLog2[cs.sps->getCTUSize()] - g_aucLog2[cs.sps->getMinQTSize( m_slice->getSliceType(), partitioner.chType )];
#else
unsigned maxDepth = g_aucLog2[cs.sps->getSpsNext().getCTUSize()] - g_aucLog2[cs.sps->getSpsNext().getMinQTSize(m_slice->getSliceType(), partitioner.chType)];
#endif
if( m_pcEncCfg->getUseFastLCTU() )
{
if( auto adPartitioner = dynamic_cast<AdaptiveDepthPartitioner*>( &partitioner ) )
......
......@@ -676,18 +676,33 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr
rpcSlice->setMaxNumAffineMergeCand( m_pcCfg->getMaxNumAffineMergeCand() );
#endif
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
#if JVET_L0217_L0678_SPS_CLEANUP
rpcSlice->setSplitConsOverrideFlag(false);
rpcSlice->setMinQTSize( rpcSlice->getSPS()->getSpsNext().getMinQTSize(eSliceType));
rpcSlice->setMaxBTDepth( rpcSlice->isIntra() ? rpcSlice->getSPS()->getSpsNext().getMaxBTDepthI() : rpcSlice->getSPS()->getSpsNext().getMaxBTDepth() );
rpcSlice->setMaxBTSize( rpcSlice->isIntra() ? rpcSlice->getSPS()->getSpsNext().getMaxBTSizeI() : rpcSlice->getSPS()->getSpsNext().getMaxBTSize() );
rpcSlice->setMaxTTSize( rpcSlice->isIntra() ? rpcSlice->getSPS()->getSpsNext().getMaxTTSizeI() : rpcSlice->getSPS()->getSpsNext().getMaxTTSize() );
if ( eSliceType == I_SLICE && rpcSlice->getSPS()->getSpsNext().getUseDualITree() )
rpcSlice->setMinQTSize( rpcSlice->getSPS()->getMinQTSize(eSliceType));
rpcSlice->setMaxBTDepth( rpcSlice->isIntra() ? rpcSlice->getSPS()->getMaxBTDepthI() : rpcSlice->getSPS()->getMaxBTDepth() );
rpcSlice->setMaxBTSize( rpcSlice->isIntra() ? rpcSlice->getSPS()->getMaxBTSizeI() : rpcSlice->getSPS()->getMaxBTSize() );
rpcSlice->setMaxTTSize( rpcSlice->isIntra() ? rpcSlice->getSPS()->getMaxTTSizeI() : rpcSlice->getSPS()->getMaxTTSize() );
if ( eSliceType == I_SLICE && rpcSlice->getSPS()->getUseDualITree() )
{
rpcSlice->setMinQTSizeIChroma( rpcSlice->getSPS()->getSpsNext().getMinQTSize(eSliceType, CHANNEL_TYPE_CHROMA) );
rpcSlice->setMaxBTDepthIChroma( rpcSlice->getSPS()->getSpsNext().getMaxBTDepthIChroma() );
rpcSlice->setMaxBTSizeIChroma( rpcSlice->getSPS()->getSpsNext().getMaxBTSizeIChroma() );
rpcSlice->setMaxTTSizeIChroma( rpcSlice->getSPS()->getSpsNext().getMaxTTSizeIChroma() );
rpcSlice->setMinQTSizeIChroma( rpcSlice->getSPS()->getMinQTSize(eSliceType, CHANNEL_TYPE_CHROMA) );
rpcSlice->setMaxBTDepthIChroma( rpcSlice->getSPS()->getMaxBTDepthIChroma() );
rpcSlice->setMaxBTSizeIChroma( rpcSlice->getSPS()->getMaxBTSizeIChroma() );
rpcSlice->setMaxTTSizeIChroma( rpcSlice->getSPS()->getMaxTTSizeIChroma() );
}
#else
rpcSlice->setSplitConsOverrideFlag(false);
rpcSlice->setMinQTSize(rpcSlice->getSPS()->getSpsNext().getMinQTSize(eSliceType));
rpcSlice->setMaxBTDepth(rpcSlice->isIntra() ? rpcSlice->getSPS()->getSpsNext().getMaxBTDepthI() : rpcSlice->getSPS()->getSpsNext().getMaxBTDepth());
rpcSlice->setMaxBTSize(rpcSlice->isIntra() ? rpcSlice->getSPS()->getSpsNext().getMaxBTSizeI() : rpcSlice->getSPS()->getSpsNext().getMaxBTSize());
rpcSlice->setMaxTTSize(rpcSlice->isIntra() ? rpcSlice->getSPS()->getSpsNext().getMaxTTSizeI() : rpcSlice->getSPS()->getSpsNext().getMaxTTSize());
if (eSliceType == I_SLICE && rpcSlice->getSPS()->getSpsNext().getUseDualITree())
{
rpcSlice->setMinQTSizeIChroma(rpcSlice->getSPS()->getSpsNext().getMinQTSize(eSliceType, CHANNEL_TYPE_CHROMA));
rpcSlice->setMaxBTDepthIChroma(rpcSlice->getSPS()->getSpsNext().getMaxBTDepthIChroma());
rpcSlice->setMaxBTSizeIChroma(rpcSlice->getSPS()->getSpsNext().getMaxBTSizeIChroma());
rpcSlice->setMaxTTSizeIChroma(rpcSlice->getSPS()->getSpsNext().getMaxTTSizeIChroma());
}
#endif
#else
rpcSlice->setMaxBTSize ( rpcSlice->isIntra() ? MAX_BT_SIZE : MAX_BT_SIZE_INTER );
#endif
......
......@@ -571,6 +571,7 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM )
#endif
// additional parameters
#if !JVET_L0217_L0678_SPS_CLEANUP
WRITE_FLAG( spsNext.getUseDualITree(), "qtbt_dual_intra_tree" );
WRITE_UVLC( g_aucLog2[spsNext.getCTUSize()] - MIN_CU_LOG2, "log2_CTU_size_minus2" );
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
......@@ -610,7 +611,7 @@ void HLSWriter::codeSPSNext( const SPSNext& spsNext, const bool usePCM )
WRITE_UVLC( spsNext.getMaxBTDepthIChroma(), "max_bt_depth_i_slice_chroma" );
#endif
}
#endif
#if !JVET_L0198_L0468_L0104_ATMVP_8x8SUB_BLOCK
if( spsNext.getUseSubPuMvp() )
{
......@@ -697,16 +698,66 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
}
}
CHECK( pcSPS->getMaxCUWidth() != pcSPS->getMaxCUHeight(), "Rectangular CTUs not supported" );
#if !JVET_L0217_L0678_SPS_CLEANUP
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 2, "log2_min_luma_coding_block_size_minus2");
#else
WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3, "log2_min_luma_coding_block_size_minus3" );
#endif
WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(), "log2_diff_max_min_luma_coding_block_size" );
#endif
#if JVET_L0217_L0678_SPS_CLEANUP
WRITE_FLAG(pcSPS->getUseDualITree(), "qtbt_dual_intra_tree");
WRITE_UVLC(g_aucLog2[pcSPS->getCTUSize()] - MIN_CU_LOG2, "log2_CTU_size_minus2");
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
WRITE_UVLC(pcSPS->getLog2MinCodingBlockSize() - 2, "log2_min_luma_coding_block_size_minus2");
#else
WRITE_UVLC(pcSPS->getLog2MinCodingBlockSize() - 3, "log2_min_luma_coding_block_size_minus3");
#endif
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
WRITE_FLAG(pcSPS->getSplitConsOverrideEnabledFlag(), "sps_override_partition_constraints_enable_flag");
WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice");
WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(B_SLICE)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_inter_slice");
WRITE_UVLC(pcSPS->getMaxBTDepth(), "sps_max_mtt_hierarchy_depth_inter_slices");
WRITE_UVLC(pcSPS->getMaxBTDepthI(), "sps_max_mtt_hierarchy_depth_intra_slices");
if (pcSPS->getMaxBTDepthI() != 0)
{
WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSizeI()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE)], "sps_log2_diff_max_bt_min_qt_intra_slice");
WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSizeI()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE)], "sps_log2_diff_max_tt_min_qt_intra_slice");
}
if (pcSPS->getMaxBTDepth() != 0)
{
WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSize()] - g_aucLog2[pcSPS->getMinQTSize(B_SLICE)], "sps_log2_diff_max_bt_min_qt_inter_slice");
WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSize()] - g_aucLog2[pcSPS->getMinQTSize(B_SLICE)], "sps_log2_diff_max_tt_min_qt_inter_slice");
}
#else
WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE)] - MIN_CU_LOG2, "log2_minQT_ISlice_minus2");
WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(B_SLICE)] - MIN_CU_LOG2, "log2_minQT_PBSlice_minus2");
WRITE_UVLC(pcSPS->getMaxBTDepth(), "max_bt_depth");
WRITE_UVLC(pcSPS->getMaxBTDepthI(), "max_bt_depth_i_slice");
#endif
if (pcSPS->getUseDualITree())
{
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)] - pcSPS->getLog2MinCodingBlockSize(), "sps_log2_diff_min_qt_min_cb_intra_slice_chroma");
WRITE_UVLC(pcSPS->getMaxBTDepthIChroma(), "sps_max_mtt_hierarchy_depth_intra_slices_chroma");
if (pcSPS->getMaxBTDepthIChroma() != 0)
{
WRITE_UVLC(g_aucLog2[pcSPS->getMaxBTSizeIChroma()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_bt_min_qt_intra_slice_chroma");
WRITE_UVLC(g_aucLog2[pcSPS->getMaxTTSizeIChroma()] - g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)], "sps_log2_diff_max_tt_min_qt_intra_slice_chroma");
}
#else
WRITE_UVLC(g_aucLog2[pcSPS->getMinQTSize(I_SLICE, CHANNEL_TYPE_CHROMA)] - MIN_CU_LOG2, "log2_minQT_ISliceChroma_minus2");
WRITE_UVLC(pcSPS->getMaxBTDepthIChroma(), "max_bt_depth_i_slice_chroma");
#endif
}
#endif
WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2, "log2_min_luma_transform_block_size_minus2" );
WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_luma_transform_block_size" );
#if !JVET_L0217_L0678_SPS_CLEANUP
WRITE_UVLC( pcSPS->getQuadtreeTUMaxDepthInter() - 1, "max_transform_hierarchy_depth_inter" );