HEVC CU 广度优先

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 );
			}	
		}
	}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值