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

coding_unit函数,对一个cu中的所有预测信息、变换系数等信息进行编码。
其实对一个cu的编码,主要编码3个信息:预测模式、预测数据、变换系数。
由于VTM3中加入了很多的编码工具,所以相较于VTM1,coding_unit函数会对更多的模式的信息进行编码。
对于帧内pu的几种模式的码字编写过程没有细看,以后补上。

void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, CUCtx& cuCtx )
{
   
  CodingStructure& cs = *cu.cs;
#if JVET_L0293_CPR
  cs.chType = partitioner.chType;
#endif
  // transquant bypass flag
  if( cs.pps->getTransquantBypassEnabledFlag() )
  {
   
    cu_transquant_bypass_flag( cu );	//变换系数旁路编码标志
  }

  // skip flag
#if JVET_L0293_CPR 
  if (!cs.slice->isIntra() && cu.Y().valid())
#else
  if( !cs.slice->isIntra() )
#endif
  {
   
    cu_skip_flag( cu );					//skip模式时编码skip_flag
  }

  // skip data
  if( cu.skip )
  {
   
    CHECK( !cu.firstPU->mergeFlag, "Merge flag has to be on!" );
    PredictionUnit&   pu = *cu.firstPU;
    prediction_unit ( pu );				//skip模式时编码预测数据:merge_idx
    end_of_ctu      ( cu, cuCtx );		//如果ctu结束,编码一个0(一帧最后一个ctu不编码这个0)
    return;
  }

  // prediction mode and partitioning data
  pred_mode ( cu );						//编码帧内还是帧间

#if JVET_L0283_MULTI_REF_LINE
  extend_ref_line(cu);				//MRL
#endif

  // pcm samples
  if( CU::isIntra(cu) && cu.partSize == SIZE_2Nx2N )
  {
   
    pcm_data( cu );					//pcm模式
    if( cu.ipcm )
    {
   
      end_of_ctu( cu, cuCtx );
      return;
    }
  }

  // prediction data ( intra prediction modes / reference indexes + motion vectors )
  cu_pred_data( cu );				//预测信息的编码,帧内亮度色度的具体模式,或帧间的merge_Idx、refIdx、mv、mvd等这些

  // residual data ( coded block flags + transform coefficient levels )
  cu_residual( cu, partitioner, cuCtx );	//残差数据,变换系数的编码

  // end of cu
  end_of_ctu( cu, cuCtx );			//如果ctu结束,编码一个0(一帧最后一个ctu不编码这个0)
}
//编码帧内还是帧间预测模式
void CABACWriter::pred_mo
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值