coding_tree递归调用,按照ctu在xCompressCU中得到的划分树,寻址到ctu中的每个cu,对于每个cu,调用coding_unit函数进行编码。
本函数基本上和VTM1中的流程一致,但要对>64的DualITree块进行特别处理:
对与>64的DualITree块,在QT时要对亮度和色度统一进行,保持QT对亮度和色度划分一致。
对于>64的DualITree块,本函数入口参数既有亮度partitioner,又有色度chromaPartitioner。
void CABACWriter::coding_tree(const CodingStructure& cs, Partitioner& partitioner, CUCtx& cuCtx, Partitioner* pPartitionerChroma, CUCtx* pCuCtxChroma)
{
const PPS &pps = *cs.pps;
const UnitArea &currArea = partitioner.currArea(); //当前递归到的处理区域
const CodingUnit &cu = *cs.getCU(currArea.blocks[partitioner.chType], partitioner.chType); //get目前区域的左上角位置的cu
// Reset delta QP coding flag and ChromaQPAdjustemt coding flag //按照该cu中的depth信息,判断当前区域是否继续划分,如果不需要划分,就表示目前区域就是cu,直接调用coding_unit函数进行编码
if (pps.getUseDQP() && partitioner.currDepth <= pps.getMaxCuDQPDepth()) //如果按照cu中的depth信息依然需要划分,那么递归调用coding_tree划分当前区域,继续寻址cu
{
cuCtx.isDQPCoded = false;
}
if (cs.slice->getUseChromaQpAdj() && partitioner.currDepth <= pps.getPpsRangeExtension().getDiffCuChromaQpOffsetDepth())
{
cuCtx.isChromaQpAdjCoded = false;
}
// Reset delta QP coding flag and ChromaQPAdjustemt coding flag
if (CS::isDualITree(cs) && pPartitionerChroma != nullptr) //即:I帧DualITree且CTU为128x128时的情况
{
if (pps.getUseDQP() && pPartitionerChroma->currDepth <= pps.getMaxCuDQPDepth())
{
pCuCtxChroma->isDQPCoded = false;
}
if (cs.slice->getUseChromaQpAdj(