estIntraPredLumaQT函数用作从0-66个intra modes中选出最佳模式(uiBestPUMode)
Void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner )
{
CodingStructure &cs = *cu.cs;
const SPS &sps = *cs.sps;
//printf("pcv=%d WidthBit=%d\n", cs.pcv->rectCUs,uiWidthBit);
//cs.pcv->rectCUs = 1
//当前CU的宽、高
//cu.lwidth
const UInt uiWidthBit = cs.pcv->rectCUs ? g_aucLog2[partitioner.currArea().lwidth() ] : CU::getIntraSizeIdx(cu);
const UInt uiHeightBit = g_aucLog2[partitioner.currArea().lheight()];
#if HEVC_USE_PART_SIZE
const UInt uiNumPU = CU::getNumPUs( cu );
#endif
// Lambda calculation at equivalent Qp of 4 is recommended because at that Qp, the quantization divisor is 1.
// 取得 Lambda, 该参数用作率失真优化
const double sqrtLambdaForFirstPass = m_pcRdCost->getMotionLambda(cu.transQuantBypass) / double(1 << SCALE_BITS);
//===== loop over partitions =====
// 用作CABAC编码
const TempCtx ctxStart ( m_CtxCache, m_CABACEstimator->getCtx() );
const TempCtx ctxStartIntraMode ( m_CtxCache, SubCtx( Ctx::IPredMode[CHANNEL_TYPE_LUMA], m_CABACEstimator->getCtx() ) );
#if HEVC_USE_PART_SIZE
if( uiNumPU > 1 ) partitioner.splitCurrArea( TU_QUAD_SPLIT, cs );
#endif
CHECK( !cu.firstPU, "CU has no PUs" );
const bool keepResi = cs.pps->getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() || KEEP_PRED_AND_RESI_SIGNALS;
//lisx
//printf("keepResi=%d\n", keepResi); allways is 0 false
UInt extraModes = 0; // add two extra modes, which would be used after uiMode <= DC_IDX is removed for cu.nsstIdx == 3
#if HEVC_USE_PART_SIZE
UInt puIndex = 0;
#endif
//这三个list 用做记录每个参与模式选择的mode的 Cost值等,
static_vector<UInt, FAST_UDI_MAX_RDMODE_NUM> uiHadModeList;
static_vector<Double, FAST_UDI_MAX_RDMODE_NUM> CandCostList;
static_vector<Double, FAST_UDI_MAX_RDMODE_NUM> CandHadList;
#if HEVC_USE_PART_SIZE
for( auto &pu : CU::traversePUs( cu ) )
#else
auto &pu = *cu.firstPU;
#endif
{
CandHadList.clear();
CandCostList.clear();
uiHadModeList.clear();
CHECK(pu.cu != &cu, "PU is not contained in the CU");
//===== determine set of modes to be tested (using prediction signal only) =====
Int numModesAvailable = NUM_LUMA_MODE; //