VTM3.0代码阅读:编码端coding_tree函数

本文主要探讨VTM3.0中的coding_tree函数,该函数根据CTU划分树对每个CU进行编码。针对大于64的DualITree块,函数在QT阶段对亮度和色度进行统一处理,确保两者划分同步。在处理过程中,函数接收亮度和色度的partitioner作为参数。
摘要由CSDN通过智能技术生成

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(
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值