热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

HEVCxCompressCU

本文的学习离不开各路大神的帮助,这里主要谢谢hevc_cjl和yangxiao_xiang喽~~~Protectedmemberfunctions**Compr

本文的学习离不开各路大神的帮助,这里主要谢谢hevc_cjl和yangxiao_xiang喽~~~

// ====================================================================================================================
// Protected member functions
// ====================================================================================================================
/** Compress a CU block recursively with enabling sub-LCU-level delta QP*\param rpcBestCU*\param rpcTempCU*\param uiDepth*\returns Void**- for loop of QP value to compress the current CU with all possible QP
*/
#if AMP_ENC_SPEEDUP
Void TEncCu::xCompressCU( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth, PartSize eParentPartSize )
#else
Void TEncCu::xCompressCU( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth )
#endif
{TComPic* pcPic = rpcBestCU->getPic();// get Original YUV data from picture//getZorderIdxInCU():CU中的Z扫描绝对地址;getAddr():CU在slice中的地址;getPicYuvOrg():输入YUV的纹理信息m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() );// variables for fast encoder decisionBool bEarlySkip = false;Bool bTrySplit = true;Double fRD_Skip = MAX_DOUBLE;// variable for Early CU determinationBool bSubBranch = true;// variable for Cbf fast mode PU decision---Cbf: coded block flagsBool doNotBlockPu = true;Bool earlyDetectionSkipMode = false;Bool bTrySplitDQP = true;static Double afCost[ MAX_CU_DEPTH ];//MAX_CU_DEPTH为7 即128以2为底的对数,其中128为最大的LCU,即TCUstatic Int aiNum[ MAX_CU_DEPTH ];if ( rpcBestCU->getAddr() == 0 ){::memset( afCost, 0, sizeof( afCost ) );::memset( aiNum, 0, sizeof( aiNum ) );}//memset:作用是在一段内存块中填充某个给定的值,它是对较大的结构体或数组进行清零操作的一种最快方法Bool bBoundary = false;UInt uiLPelX = rpcBestCU->getCUPelX();//CU内部左边界UInt uiRPelX = uiLPelX + rpcBestCU->getWidth(0) - 1;//CU内部右边界UInt uiTPelY = rpcBestCU->getCUPelY();//CU内部上边界UInt uiBPelY = uiTPelY + rpcBestCU->getHeight(0) - 1;//CU内部下边界Int iBaseQP = xComputeQP( rpcBestCU, uiDepth );//配置文件(.cfg)中设置的QP值32.可以设置范围为0-51Int iMinQP;Int iMaxQP;Bool isAddLowestQP = false;Int lowestQP = -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY();//返回类型 m_qpBDOffsetY (0)if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )//64>=64{Int idQP = m_pcEncCfg->getMaxDeltaQP();//配置文件中MaxDeltaQP设置为0.iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );//MAX_QP宏定义为51,同时MIN_QP宏定义为0if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP getSlice()->getPPS()->getUseDQP() ){isAddLowestQP = true; iMinQP = iMinQP - 1;}}else{iMinQP = rpcTempCU->getQP(0);iMaxQP = rpcTempCU->getQP(0);//配置文件设置为32}#if RATE_CONTROL_LAMBDA_DOMAIN if ( m_pcEncCfg->getUseRateCtrl() ){iMinQP = m_pcRateCtrl->getRCQP();iMaxQP = m_pcRateCtrl->getRCQP();}
#elseif(m_pcEncCfg->getUseRateCtrl()){Int qp = m_pcRateCtrl->getUnitQP();iMinQP = Clip3( MIN_QP, MAX_QP, qp);iMaxQP = Clip3( MIN_QP, MAX_QP, qp);}
#endif// If slice start or slice end is within this cu...如果bSliceStart和bSliceStart都为false,则当前块需要长宽各缩小一倍TComSlice * pcSlice &#61; rpcTempCU->getPic()->getSlice(rpcTempCU->getPic()->getCurrSliceIdx());Bool bSliceStart &#61; pcSlice->getSliceSegmentCurStartCUAddr()>rpcTempCU->getSCUAddr()&&pcSlice->getSliceSegmentCurStartCUAddr()getSCUAddr()&#43;rpcTempCU->getTotalNumPart();Bool bSliceEnd &#61; (pcSlice->getSliceSegmentCurEndCUAddr()>rpcTempCU->getSCUAddr()&&pcSlice->getSliceSegmentCurEndCUAddr()getSCUAddr()&#43;rpcTempCU->getTotalNumPart());// Structure TComSlice.cpp//,m_picWidthInLumaSamples (352) //HM10.0允许处理的最小亮度采样宽度//,m_picHeightInLumaSamples (288) //HM10.0允许处理的最小亮度采样高度Bool bInsidePicture &#61; ( uiRPelX getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY getSlice()->getSPS()->getPicHeightInLumaSamples() );// We need to split, so don&#39;t try these modes.if(!bSliceEnd && !bSliceStart && bInsidePicture ){for (Int iQP&#61;iMinQP; iQP<&#61;iMaxQP; iQP&#43;&#43;){if (isAddLowestQP && (iQP &#61;&#61; iMinQP)){iQP &#61; lowestQP;}// variables for fast encoder decisionbEarlySkip &#61; false;bTrySplit &#61; true;fRD_Skip &#61; MAX_DOUBLE;//#define MAX_DOUBLE 1.7e&#43;308 ///initEstData( uiDepth, iQP );//当前CU初始化估计数据 对当前CU以4x4大小进行初始化// do inter modes, SKIP and 2Nx2Nif( rpcBestCU->getSlice()->getSliceType() !&#61; I_SLICE ){// 2Nx2Nif(m_pcEncCfg->getUseEarlySkipDetection()){//帧间预测模式---帧间2Nx2N时&#xff0c;率失真代价比较xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData( uiDepth, iQP );//by Competition for inter_2Nx2N}// SKIP Merge模式xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2NrpcTempCU->initEstData( uiDepth, iQP );// fast encoder decision for early skipif ( m_pcEncCfg->getUseFastEnc() ){Int iIdx &#61; g_aucConvertToBit[ rpcBestCU->getWidth(0) ];if ( aiNum [ iIdx ] > 5 && fRD_Skip getUseEarlySkipDetection()){// 2Nx2N, NxNif ( !bEarlySkip ){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N ); rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode()){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}}}if( (g_uiMaxCUWidth>>uiDepth) >&#61; rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )//64>&#61;64{if(iQP &#61;&#61; iBaseQP){bTrySplitDQP &#61; bTrySplit;//bTrySplitDQP&#61;true}}else{bTrySplitDQP &#61; bTrySplit;//bTrySplitDQP&#61;true}if (isAddLowestQP && (iQP &#61;&#61; lowestQP)){iQP &#61; iMinQP;}}#if RATE_CONTROL_LAMBDA_DOMAINif ( uiDepth <&#61; m_addSADDepth ){m_LCUPredictionSAD &#43;&#61; m_temporalSAD;m_addSADDepth &#61; uiDepth;}
#endifif(!earlyDetectionSkipMode){for (Int iQP&#61;iMinQP; iQP<&#61;iMaxQP; iQP&#43;&#43;){if (isAddLowestQP && (iQP &#61;&#61; iMinQP)){iQP &#61; lowestQP;}rpcTempCU->initEstData( uiDepth, iQP );//--------------------------------------------------帧间模式选择开始201348----------------------------------------------\\// do inter modes, NxN, 2NxN, and Nx2Nif( rpcBestCU->getSlice()->getSliceType() !&#61; I_SLICE ){// 2Nx2N, NxNif ( !bEarlySkip ){if(!( (rpcBestCU->getWidth(0)&#61;&#61;8) && (rpcBestCU->getHeight(0)&#61;&#61;8) )){if( uiDepth &#61;&#61; g_uiMaxCUDepth - g_uiAddCUDepth && doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN );rpcTempCU->initEstData( uiDepth, iQP );}}}// 2NxN, Nx2Nif(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N );rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) &#61;&#61; SIZE_Nx2N ){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}if(doNotBlockPu){xCheckRDCostInter ( rpcBestCU, rpcTempCU, SIZE_2NxN );rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) &#61;&#61; SIZE_2NxN){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}#if 1//! Try AMP (SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N)AMP: Asymmetric motion partitions 非对称运动分割if( pcPic->getSlice(0)->getSPS()->getAMPAcc(uiDepth) ){
#if AMP_ENC_SPEEDUP Bool bTestAMP_Hor &#61; false, bTestAMP_Ver &#61; false;#if AMP_MRGBool bTestMergeAMP_Hor &#61; false, bTestMergeAMP_Ver &#61; false;deriveTestModeAMP (rpcBestCU, eParentPartSize, bTestAMP_Hor, bTestAMP_Ver, bTestMergeAMP_Hor, bTestMergeAMP_Ver);
#elsederiveTestModeAMP (rpcBestCU, eParentPartSize, bTestAMP_Hor, bTestAMP_Ver);
#endif//! Do horizontal AMP 水平非对称运动分割if ( bTestAMP_Hor ){if(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) &#61;&#61; SIZE_2NxnU ){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}if(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) &#61;&#61; SIZE_2NxnD ){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}}
#if AMP_MRGelse if ( bTestMergeAMP_Hor ) {if(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, true );rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) &#61;&#61; SIZE_2NxnU ){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}if(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, true );rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) &#61;&#61; SIZE_2NxnD ){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}}
#endif//! Do vertical AMP 垂直非对称运动分割if ( bTestAMP_Ver ){if(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) &#61;&#61; SIZE_nLx2N ){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}if(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );rpcTempCU->initEstData( uiDepth, iQP );}}
#if AMP_MRGelse if ( bTestMergeAMP_Ver ){if(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, true );rpcTempCU->initEstData( uiDepth, iQP );if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) &#61;&#61; SIZE_nLx2N ){doNotBlockPu &#61; rpcBestCU->getQtRootCbf( 0 ) !&#61; 0;}}if(doNotBlockPu){xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, true );rpcTempCU->initEstData( uiDepth, iQP );}}
#endif#elsexCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );rpcTempCU->initEstData( uiDepth, iQP );xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );rpcTempCU->initEstData( uiDepth, iQP );xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );rpcTempCU->initEstData( uiDepth, iQP );xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );rpcTempCU->initEstData( uiDepth, iQP );#endif}
#endif}
//------------------------------------------------------帧间模式选择结束----------------------------------------------\\//------------------------------------------------------帧内模式选择开始201348----------------------------------------------\\// do normal intra modesif ( !bEarlySkip )//bEarlySkip&#61;false{/ texture component type//enum TextType//{// TEXT_LUMA, ///getSlice()->getSliceType() &#61;&#61; I_SLICE || rpcBestCU->getCbf( 0, TEXT_LUMA ) !&#61; 0 ||rpcBestCU->getCbf( 0, TEXT_CHROMA_U ) !&#61; 0 ||rpcBestCU->getCbf( 0, TEXT_CHROMA_V ) !&#61; 0 ) // avoid very complex intra if it is unlikely{//帧内预测式---只有2Nx2N,NxN两种模式xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N );rpcTempCU->initEstData( uiDepth, iQP );if( uiDepth &#61;&#61; g_uiMaxCUDepth - g_uiAddCUDepth ){if( rpcTempCU->getWidth(0) > ( 1 <getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) ){xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN );rpcTempCU->initEstData( uiDepth, iQP );}}}}
//------------------------------------------------------帧内模式选择结束----------------------------------------------// test PCM测试PCM模式&#xff0c;一般不使用这种模式if(pcPic->getSlice(0)->getSPS()->getUsePCM()&& rpcTempCU->getWidth(0) <&#61; (1<getSlice(0)->getSPS()->getPCMLog2MaxSize())&& rpcTempCU->getWidth(0) >&#61; (1<getSlice(0)->getSPS()->getPCMLog2MinSize()) ){UInt uiRawBits &#61; (2 * g_bitDepthY &#43; g_bitDepthC) * rpcBestCU->getWidth(0) * rpcBestCU->getHeight(0) / 2;UInt uiBestBits &#61; rpcBestCU->getTotalBits();if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0))){xCheckIntraPCM (rpcBestCU, rpcTempCU);rpcTempCU->initEstData( uiDepth, iQP );}}if (isAddLowestQP && (iQP &#61;&#61; lowestQP)){iQP &#61; iMinQP;}}}m_pcEntropyCoder->resetBits();m_pcEntropyCoder->encodeSplitFlag( rpcBestCU, 0, uiDepth, true );rpcBestCU->getTotalBits() &#43;&#61; m_pcEntropyCoder->getNumberOfWrittenBits(); // split bitsif(m_pcEncCfg->getUseSBACRD()){rpcBestCU->getTotalBins() &#43;&#61; ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();}rpcBestCU->getTotalCost() &#61; m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );// accumulate statistics for early skipif ( m_pcEncCfg->getUseFastEnc() ){if ( rpcBestCU->isSkipped(0) ){Int iIdx &#61; g_aucConvertToBit[ rpcBestCU->getWidth(0) ];afCost[ iIdx ] &#43;&#61; rpcBestCU->getTotalCost();aiNum [ iIdx ] &#43;&#43;;}}// Early CU determinationif( m_pcEncCfg->getUseEarlyCU() && rpcBestCU->isSkipped(0) ){bSubBranch &#61; false;}else{bSubBranch &#61; true;}}else if(!(bSliceEnd && bInsidePicture)){bBoundary &#61; true;
#if RATE_CONTROL_LAMBDA_DOMAINm_addSADDepth&#43;&#43;;
#endif}// copy orginal YUV samples to PCM bufferif( rpcBestCU->isLosslessCoded(0) && (rpcBestCU->getIPCMFlag(0) &#61;&#61; false)){xFillPCMBuffer(rpcBestCU, m_ppcOrigYuv[uiDepth]);}if( (g_uiMaxCUWidth>>uiDepth) &#61;&#61; rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() ){Int idQP &#61; m_pcEncCfg->getMaxDeltaQP();iMinQP &#61; Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );iMaxQP &#61; Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP&#43;idQP );if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP getSlice()->getPPS()->getUseDQP() ){isAddLowestQP &#61; true;iMinQP &#61; iMinQP - 1; }}else if( (g_uiMaxCUWidth>>uiDepth) > rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() ){iMinQP &#61; iBaseQP;iMaxQP &#61; iBaseQP;}else{Int iStartQP;if( pcPic->getCU( rpcTempCU->getAddr() )->getSliceSegmentStartCU(rpcTempCU->getZorderIdxInCU()) &#61;&#61; pcSlice->getSliceSegmentCurStartCUAddr()){iStartQP &#61; rpcTempCU->getQP(0);}else{UInt uiCurSliceStartPartIdx &#61; pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU() - rpcTempCU->getZorderIdxInCU();iStartQP &#61; rpcTempCU->getQP(uiCurSliceStartPartIdx);}iMinQP &#61; iStartQP;iMaxQP &#61; iStartQP;}
#if RATE_CONTROL_LAMBDA_DOMAINif ( m_pcEncCfg->getUseRateCtrl() ){iMinQP &#61; m_pcRateCtrl->getRCQP();iMaxQP &#61; m_pcRateCtrl->getRCQP();}
#elseif(m_pcEncCfg->getUseRateCtrl()){Int qp &#61; m_pcRateCtrl->getUnitQP();iMinQP &#61; Clip3( MIN_QP, MAX_QP, qp);iMaxQP &#61; Clip3( MIN_QP, MAX_QP, qp);}
#endiffor (Int iQP&#61;iMinQP; iQP<&#61;iMaxQP; iQP&#43;&#43;){if (isAddLowestQP && (iQP &#61;&#61; iMinQP)){iQP &#61; lowestQP;}rpcTempCU->initEstData( uiDepth, iQP );// further split 进一步进行CU分割if( bSubBranch && bTrySplitDQP && uiDepth initSubCU( rpcTempCU, uiPartUnitIdx, uhNextDepth, iQP ); // clear sub partition datas or init.pcSubTempPartCU->initSubCU( rpcTempCU, uiPartUnitIdx, uhNextDepth, iQP ); // clear sub partition datas or init.Bool bInSlice &#61; pcSubBestPartCU->getSCUAddr()&#43;pcSubBestPartCU->getTotalNumPart()>pcSlice->getSliceSegmentCurStartCUAddr()&&pcSubBestPartCU->getSCUAddr()getSliceSegmentCurEndCUAddr();if(bInSlice && ( pcSubBestPartCU->getCUPelX() getSPS()->getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() getSPS()->getPicHeightInLumaSamples() ) ){if( m_bUseSBACRD ){if ( 0 &#61;&#61; uiPartUnitIdx) //initialize RD with previous depth buffer{m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);}else{m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]);}}#if AMP_ENC_SPEEDUPif ( rpcBestCU->isIntra(0) ){xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uhNextDepth, SIZE_NONE );//递归函数}else{xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uhNextDepth, rpcBestCU->getPartitionSize(0) );//递归函数}
#elsexCompressCU( pcSubBestPartCU, pcSubTempPartCU, uhNextDepth );
#endifrpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth );// Keep best part data to current temporary data.xCopyYuv2Tmp( pcSubBestPartCU->getTotalNumPart()*uiPartUnitIdx, uhNextDepth );}else if (bInSlice){pcSubBestPartCU->copyToPic( uhNextDepth );rpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth );}}if( !bBoundary ){m_pcEntropyCoder->resetBits();m_pcEntropyCoder->encodeSplitFlag( rpcTempCU, 0, uiDepth, true );rpcTempCU->getTotalBits() &#43;&#61; m_pcEntropyCoder->getNumberOfWrittenBits(); // split bitsif(m_pcEncCfg->getUseSBACRD()){rpcTempCU->getTotalBins() &#43;&#61; ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();}}rpcTempCU->getTotalCost() &#61; m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );if( (g_uiMaxCUWidth>>uiDepth) &#61;&#61; rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() && rpcTempCU->getSlice()->getPPS()->getUseDQP()){Bool hasResidual &#61; false;for( UInt uiBlkIdx &#61; 0; uiBlkIdx getTotalNumPart(); uiBlkIdx &#43;&#43;){if( ( pcPic->getCU( rpcTempCU->getAddr() )->getSliceSegmentStartCU(uiBlkIdx&#43;rpcTempCU->getZorderIdxInCU()) &#61;&#61; rpcTempCU->getSlice()->getSliceSegmentCurStartCUAddr() ) && ( rpcTempCU->getCbf( uiBlkIdx, TEXT_LUMA ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_U ) || rpcTempCU->getCbf( uiBlkIdx, TEXT_CHROMA_V ) ) ){hasResidual &#61; true;break;}}UInt uiTargetPartIdx;if ( pcPic->getCU( rpcTempCU->getAddr() )->getSliceSegmentStartCU(rpcTempCU->getZorderIdxInCU()) !&#61; pcSlice->getSliceSegmentCurStartCUAddr() ){uiTargetPartIdx &#61; pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU() - rpcTempCU->getZorderIdxInCU();}else{uiTargetPartIdx &#61; 0;}if ( hasResidual ){
#if !RDO_WITHOUT_DQP_BITSm_pcEntropyCoder->resetBits();m_pcEntropyCoder->encodeQP( rpcTempCU, uiTargetPartIdx, false );rpcTempCU->getTotalBits() &#43;&#61; m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bitsif(m_pcEncCfg->getUseSBACRD()){rpcTempCU->getTotalBins() &#43;&#61; ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();}rpcTempCU->getTotalCost() &#61; m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
#endifBool foundNonZeroCbf &#61; false;rpcTempCU->setQPSubCUs( rpcTempCU->getRefQP( uiTargetPartIdx ), rpcTempCU, 0, uiDepth, foundNonZeroCbf );assert( foundNonZeroCbf );}else{rpcTempCU->setQPSubParts( rpcTempCU->getRefQP( uiTargetPartIdx ), 0, uiDepth ); // set QP to default QP}}if( m_bUseSBACRD ){m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);}Bool isEndOfSlice &#61; rpcBestCU->getSlice()->getSliceMode()&#61;&#61;FIXED_NUMBER_OF_BYTES&& (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3);Bool isEndOfSliceSegment &#61; rpcBestCU->getSlice()->getSliceSegmentMode()&#61;&#61;FIXED_NUMBER_OF_BYTES&& (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceSegmentArgument()<<3);if(isEndOfSlice||isEndOfSliceSegment){rpcBestCU->getTotalCost()&#61;rpcTempCU->getTotalCost()&#43;1;}xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth); // RD compare current larger prediction} // with sub partitioned prediction.判断决定是否选择本层CU还是下层CUif (isAddLowestQP && (iQP &#61;&#61; lowestQP)){iQP &#61; iMinQP;}}rpcBestCU->copyToPic(uiDepth); // Copy Best data to Picture for next partition prediction.xCopyYuv2Pic( rpcBestCU->getPic(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU(), uiDepth, uiDepth, rpcBestCU, uiLPelX, uiTPelY ); // Copy Yuv data to picture Yuvif( bBoundary ||(bSliceEnd && bInsidePicture)){return;}// Assert if Best prediction mode is NONE// Selected mode&#39;s RD-cost must be not MAX_DOUBLE.assert( rpcBestCU->getPartitionSize ( 0 ) !&#61; SIZE_NONE );assert( rpcBestCU->getPredictionMode( 0 ) !&#61; MODE_NONE );assert( rpcBestCU->getTotalCost ( ) !&#61; MAX_DOUBLE );
}





推荐阅读
  • C++字符字符串处理及字符集编码方案
    本文介绍了C++中字符字符串处理的问题,并详细解释了字符集编码方案,包括UNICODE、Windows apps采用的UTF-16编码、ASCII、SBCS和DBCS编码方案。同时说明了ANSI C标准和Windows中的字符/字符串数据类型实现。文章还提到了在编译时需要定义UNICODE宏以支持unicode编码,否则将使用windows code page编译。最后,给出了相关的头文件和数据类型定义。 ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • Windows7 64位系统安装PLSQL Developer的步骤和注意事项
    本文介绍了在Windows7 64位系统上安装PLSQL Developer的步骤和注意事项。首先下载并安装PLSQL Developer,注意不要安装在默认目录下。然后下载Windows 32位的oracle instant client,并解压到指定路径。最后,按照自己的喜好对解压后的文件进行命名和压缩。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 怀疑是每次都在新建文件,具体代码如下 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • Html5-Canvas实现简易的抽奖转盘效果
    本文介绍了如何使用Html5和Canvas标签来实现简易的抽奖转盘效果,同时使用了jQueryRotate.js旋转插件。文章中给出了主要的html和css代码,并展示了实现的基本效果。 ... [详细]
  • 本文介绍了Windows操作系统的版本及其特点,包括Windows 7系统的6个版本:Starter、Home Basic、Home Premium、Professional、Enterprise、Ultimate。Windows操作系统是微软公司研发的一套操作系统,具有人机操作性优异、支持的应用软件较多、对硬件支持良好等优点。Windows 7 Starter是功能最少的版本,缺乏Aero特效功能,没有64位支持,最初设计不能同时运行三个以上应用程序。 ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • position属性absolute与relative的区别和用法详解
    本文详细解读了CSS中的position属性absolute和relative的区别和用法。通过解释绝对定位和相对定位的含义,以及配合TOP、RIGHT、BOTTOM、LEFT进行定位的方式,说明了它们的特性和能够实现的效果。同时指出了在网页居中时使用Absolute可能会出错的原因,即以浏览器左上角为原始点进行定位,不会随着分辨率的变化而变化位置。最后总结了一些使用这两个属性的技巧。 ... [详细]
  • Java序列化对象传给PHP的方法及原理解析
    本文介绍了Java序列化对象传给PHP的方法及原理,包括Java对象传递的方式、序列化的方式、PHP中的序列化用法介绍、Java是否能反序列化PHP的数据、Java序列化的原理以及解决Java序列化中的问题。同时还解释了序列化的概念和作用,以及代码执行序列化所需要的权限。最后指出,序列化会将对象实例的所有字段都进行序列化,使得数据能够被表示为实例的序列化数据,但只有能够解释该格式的代码才能够确定数据的内容。 ... [详细]
  • baresip android编译、运行教程1语音通话
    本文介绍了如何在安卓平台上编译和运行baresip android,包括下载相关的sdk和ndk,修改ndk路径和输出目录,以及创建一个c++的安卓工程并将目录考到cpp下。详细步骤可参考给出的链接和文档。 ... [详细]
author-avatar
热情的海浪公主
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有