VTM1.0代码阅读:CodingStructure类

CodingStructure类是VTM代码中的最基础的类,其地位相当于JEM代码中的TComDataCU类。视频的编解码都是基于CodingStructure类来进行,参考VTM说明文档,可以看到CodingStructure就是将它所处理区域的cu、pu、tu综合在一起统一操作的一个类可以将CodingStructure看做是一个包装盒,将area区域的cu、pu、tu等所有信息封装在一起的...
摘要由CSDN通过智能技术生成

CodingStructure类是VTM代码中的最基础的类,其地位相当于JEM代码中的TComDataCU类。视频的编解码都是基于CodingStructure类来进行,参考VTM说明文档,可以看到CodingStructure就是将它所处理区域的cu、pu、tu综合在一起统一操作的一个类。
可以将CodingStructure看做是一个包装盒,将area区域的cu、pu、tu等所有信息封装在一起的一个类。CodingStructure一般可以理解为代表一个CTU,它里面包含了CTU中所有划分得到的cu、pu、tu的数据。
在编码端compress过程中,CodingStructure在递归迭代过程中也可以代表子cu。
编码端的encode过程,解码端的decode过程,以及解码端的decompress过程中,可以看到用到的只有一个CodingStructure的对象cs,这个cs其实存储在它所归属的picture中,表示统一包含了该帧内的所有cu、pu、tu的信息
CodingStructure中的cu、pu、tu都是按照vector形式线性存储的。按照Z-scan扫描一个ctu中的cu,按照raster-scan扫描一帧中的所有ctu,一帧中所有的cu、pu、tu都按照这种扫描方式最终存储在picture的CodingStructure中


class CodingStructure
{
   
public:

  UnitArea         area;				//CodingStructure的处理区域

  Picture         *picture;				//CodingStructure所归属的picture
  CodingStructure *parent;				//compress递归迭代过程中,子cu递归的上一级的的划分块cu

  Slice           *slice;

  UnitScale        unitScale[MAX_NUM_COMPONENT];	//VTM处理亮度最小单元为4x4,色度2x2,将像素单位进行scale

  int         baseQP;
  int         prevQP[MAX_NUM_CHANNEL_TYPE];
  int         currQP[MAX_NUM_CHANNEL_TYPE];
  int         chromaQpAdj;
  bool        isLossless;
  const SPS *sps;
  const PPS *pps;
#if HEVC_VPS
  const VPS *vps;
#endif
  const PreCalcValues* pcv;				//存储CodingStructure相关的一些通用数据

  CodingStructure(CUCache&, PUCache&, TUCache&);
  void create( const UnitArea &_unit, const bool isTopLayer );
  void create( const ChromaFormat &_chromaFormat, const Area& _area, const bool isTopLayer );
  void destroy();
  void releaseIntermediateData();

  void rebindPicBufs();
  void createCoeffs();
  void destroyCoeffs();

  void allocateVectorsAtPicLevel();

  // ---------------------------------------------------------------------------
  // global accessors
  // ---------------------------------------------------------------------------

  bool isDecomp (const Position &pos, const ChannelType _chType) const;
  bool isDecomp (const Position &pos, const ChannelType _chType);
  void setDecomp(const CompArea &area, const bool _isCoded = true);
  void setDecomp(const UnitArea &area, const bool _isCoded = true);						//标记该区域已经完成解码

  const CodingUnit     *getCU(const Position &pos, const ChannelType _chType) const;	//获取对应pos的cu、pu、tu
  const PredictionUnit *getPU(const Position &pos, const ChannelType _chType) const;
  const TransformUnit  *getTU(const Position &pos, const ChannelType _chType) const;

  CodingUnit     *getCU(const Position &pos, const ChannelType _chType);
  PredictionUnit *getPU(const Position &pos, const ChannelType _chType);
  TransformUnit  *getTU(const Position &pos, const ChannelType _chType);

  const CodingUnit     *getCU(const ChannelType &_chType) const {
    return getCU(area.blocks[_chType].pos(), _chType
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值