EncModeCtrl类控制ctu中所有cu在compress过程中需要test的模式,其中最主要的成员变量是一个堆栈,用来存储ctu中各个cu的情况。
EncCu::*m_modeCtrl在xCompressCU函数中用来控制一个cu需要test的模式。可以看到m_modeCtrl被定义在了EncCu类中,即m_modeCtrl其实是用来控制一个ctu中所有cu的compress过程的test模式。
m_modeCtrl中的成员m_ComprCUCtxList堆栈,就是用来存储一个ctu中的所有cu在compress过程中的test模式。
m_ComprCUCtxList堆栈中的成员ComprCUCtx,则是用来存储ctu中的一个cu在compress过程中的各种数据,而ComprCUCtx::testModes堆栈,则用来存储一个cu需要test的各种模式。
struct ComprCUCtx //用来存储ctu中的一个cu在compress过程中的各种数据
{
unsigned minDepth;
unsigned maxDepth;
unsigned cuX, cuY, cuW, cuH, partIdx; //cu的pos和size
std::vector<EncTestMode> testModes; //堆栈,用来存储一个cu在compress过程中需要test的所有模式
EncTestMode lastTestMode; //一个cu test的上一个模式
bool earlySkip;
CodingStructure *bestCS;
CodingUnit *bestCU;
TransformUnit *bestTU; //记录compress过程中cu的最优数据
static_vector<Int64, 30> extraFeatures;
static_vector<double, 30> extraFeaturesd;
double bestInterCost;
Distortion interHad;
///...
};
class EncModeCtrl //控制ctu中所有cu在compress过程中需要test的模式
{
protected:
const EncCfg *m_pcEncCfg;
const class RateCtrl *m_pcRateCtrl;
class RdCost *m_pcRdCost;
const Slice *m_slice;
#if SHARP_LUMA_DELTA_QP
int m_lumaLevelToDeltaQPLUT[LUMA_LEVEL_TO_DQP_LUT_MAXSIZE];
int m_lumaQPOffset;
#endif
bool m_fastDeltaQP;
//堆栈,用来存储一个ctu中的所有cu在compress过程中的test模式
static_vector<ComprCUCtx, ( MAX_CU_DEPTH << 2 )>