if(!bBoundary&&(Split6432Flag/*||Split168Flag*/) && bSubBranch && bTrySplitDQP && (uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth) &&(rpcBestCU->getTotalCost() >Threshold[uiDepth])){
TComDataCU rpcqueueSubBestPartCU[4];
TComDataCU rpcqueueSubTempPartCU[4];
/*TComDataCU testTempCU=*rpcTempCU;*/
/*TComDataCU BestTempSwap;*/
UChar uh6432NextDepth = uiDepth+1;
TComDataCU *pcSubBestPartCU = m_ppcBestCU[uh6432NextDepth];
TComDataCU *pcSubTempPartCU = m_ppcTempCU[uh6432NextDepth];
for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ ){
pcSubBestPartCU=m_ppcBestCU[uh6432NextDepth];
pcSubTempPartCU=m_ppcTempCU[uh6432NextDepth];
pcSubBestPartCU->initSubCU( rpcTempCU, uiPartUnitIdx, uh6432NextDepth, iQP ); // clear sub partition datas or init.
pcSubTempPartCU->initSubCU( rpcTempCU, uiPartUnitIdx, uh6432NextDepth, iQP ); // clear sub partition datas or init.
rpcqueueSubTempPartCU[uiPartUnitIdx]=*pcSubTempPartCU;
rpcqueueSubBestPartCU[uiPartUnitIdx]=*pcSubBestPartCU;
}
double totalCost=0;
//bool inFlags[4]={false,false,false,false};
for(int i=0;i<4;++i){
pcSubBestPartCU = &rpcqueueSubBestPartCU[i];
pcSubTempPartCU = &rpcqueueSubTempPartCU[i];
//UInt ui6432PartUnitIdx=(pcSubBestPartCU->getUiPartUnitIdx());//this is a self define function. just for test.
Bool bInSlice = pcSubBestPartCU->getSCUAddr()+pcSubBestPartCU->getTotalNumPart()>pcSlice->getSliceSegmentCurStartCUAddr()&&pcSubBestPartCU->getSCUAddr()<pcSlice->getSliceSegmentCurEndCUAddr();
if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && (pcSubBestPartCU->getCUPelY() < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
{
if( m_bUseSBACRD )
{
if ( 0 == i) //initialize RD with previous depth buffer
{
m_pppcRDSbacCoder[uh6432NextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
}
else
{
m_pppcRDSbacCoder[uh6432NextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uh6432NextDepth][CI_NEXT_BEST]);
}
}
Split6432Flag=false;
#if AMP_ENC_SPEEDUP
if ( rpcBestCU->isIntra(0) )
{
xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uh6432NextDepth, SIZE_NONE );
}
else
{
xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uh6432NextDepth, rpcBestCU->getPartitionSize(0) );
}
#else
xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uh6432NextDepth );
#endif
totalCost+=pcSubBestPartCU->getTotalCost();
/*BestTempSwap=*pcSubTempPartCU;
rpcqueueSubBestPartCU[i]=*pcSubBestPartCU;
rpcqueueSubTempPartCU[i]=BestTempSwap; */
rpcTempCU->copyPartFrom(/*&rpcqueueSubBestPartCU[i]*/pcSubBestPartCU, i, uh6432NextDepth ); // Keep best part data to current temporary data.
xCopyYuv2Tmp( /*rpcqueueSubBestPartCU[i].*/pcSubBestPartCU->getTotalNumPart()*i, uh6432NextDepth );
}
else if (bInSlice)
{
/*(&rpcqueueSubBestPartCU[i])*/pcSubBestPartCU->copyToPic( uh6432NextDepth );
rpcTempCU->copyPartFrom( /*&rpcqueueSubBestPartCU[i]*/pcSubBestPartCU, i, uh6432NextDepth );
totalCost+=pcSubBestPartCU->getTotalCost();
}
}
if(uh6432NextDepth < g_uiMaxCUDepth - g_uiAddCUDepth&&(totalCost+test[uiDepth]<rpcBestCU->getTotalCost())&&!bBoundary&& bSubBranch && bTrySplitDQP){
rpcTempCU->initEstData( uiDepth, iQP );
TComDataCU *pcSubBestPartCU = m_ppcBestCU[uh6432NextDepth];
TComDataCU *pcSubTempPartCU = m_ppcTempCU[uh6432NextDepth];
for(int i=0;i<4;++i){
pcSubBestPartCU->initSubCU( rpcTempCU, i, uh6432NextDepth, iQP ); // clear sub partition datas or init.
pcSubTempPartCU->initSubCU( rpcTempCU, i, uh6432NextDepth, iQP ); // clear sub partition datas or init.
Bool bInSlice = pcSubBestPartCU->getSCUAddr()+pcSubBestPartCU->getTotalNumPart()>pcSlice->getSliceSegmentCurStartCUAddr()&&pcSubBestPartCU->getSCUAddr()<pcSlice->getSliceSegmentCurEndCUAddr();
if(bInSlice && ( pcSubBestPartCU->getCUPelX() < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && (pcSubBestPartCU->getCUPelY() < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
{
if( m_bUseSBACRD )
{
if ( 0 == i) //initialize RD with previous depth buffer
{
m_pppcRDSbacCoder[uh6432NextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
}
else
{
m_pppcRDSbacCoder[uh6432NextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uh6432NextDepth][CI_NEXT_BEST]);
}
}
Split6432Flag=true;
#if AMP_ENC_SPEEDUP
if ( rpcBestCU->isIntra(0) )
{
xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uh6432NextDepth, SIZE_NONE );
}
else
{
xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uh6432NextDepth, rpcBestCU->getPartitionSize(0) );
}
#else
xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uh6432NextDepth );
#endif
rpcTempCU->copyPartFrom(pcSubBestPartCU, i, uh6432NextDepth ); // Keep best part data to current temporary data.
xCopyYuv2Tmp( pcSubBestPartCU->getTotalNumPart()*i, uh6432NextDepth );
}
else if (bInSlice)
{
pcSubBestPartCU->copyToPic( uh6432NextDepth );
rpcTempCU->copyPartFrom( pcSubBestPartCU, i, uh6432NextDepth );
}
}
}
HEVC CU 广度优先
最新推荐文章于 2022-11-19 00:43:34 发布