0
点赞
收藏
分享

微信扫一扫

VVC代码学习自定义数据结构阅读5

孟佳 2022-04-22 阅读 57

本文开始介绍三个基础单元——cu,pu,tu。

struct CodingUnit

继承自UnitArea基类,存储着一堆用于对当前UnitArea的压缩方法。

struct CodingUnit : public UnitArea
{
  CodingStructure *cs;               // 父级的codingstructure
  Slice *slice;                      // 指向当前CU所属的slice
  ChannelType    chType;             // 颜色通道类型,luma,chroma

  PredMode       predMode;           // 预测模式,帧内或者帧间

  uint8_t          depth;            // 为QTBTTT的总深度,只要划分就+1
  uint8_t          qtDepth;          // 四叉树深度 btDepth和mtDepth都是描述MT的深度,在只有BT划分时,两者相等;但是CU使用TT划分时,两端的BTdepth将比mtdepth大1
  uint8_t          btDepth;          // 二叉树深度
  uint8_t          mtDepth;          // 多叉树深度
  int8_t          chromaQpAdj;       // 色度分量QP偏移值
  int8_t          qp;                // 实际的编码QP值
  SplitSeries    splitSeries;        // 
  TreeType       treeType;           // 树型
  ModeType       modeType;           // 可以尝试的压缩模式
  ModeTypeSeries modeTypeSeries;     //
  bool           skip;               // 是否选择SKIP模式
  bool           mmvdSkip;           // 是否选择 skip with mmvd 模式
  bool           affine;             // 是否选择affine模式
  int            affineType;         // affine 运动模型类型
  bool           colorTransform;     
  bool           geoFlag;
  int            bdpcmMode;
  int            bdpcmModeChroma;
  uint8_t          imv;
  bool           rootCbf;
  uint8_t        sbtInfo;
  uint32_t           tileIdx;
  uint8_t         mtsFlag;
  uint32_t        lfnstIdx;
  uint8_t         BcwIdx;
  int             refIdxBi[2];
  bool           mipFlag;

  // needed for fast imv mode decisions
  int8_t          imvNumCand;
  uint8_t          smvdMode;
  uint8_t        ispMode;
  bool           useEscape[MAX_NUM_CHANNEL_TYPE];
  bool           useRotation[MAX_NUM_CHANNEL_TYPE];
  bool           reuseflag[MAX_NUM_CHANNEL_TYPE][MAXPLTPREDSIZE];
  uint8_t        lastPLTSize[MAX_NUM_CHANNEL_TYPE];
  uint8_t        reusePLTSize[MAX_NUM_CHANNEL_TYPE];
  uint8_t        curPLTSize[MAX_NUM_CHANNEL_TYPE];
  Pel            curPLT[MAX_NUM_COMPONENT][MAXPLTSIZE];

  CodingUnit() : chType( CH_L ) { }
  CodingUnit(const UnitArea &unit);
  CodingUnit(const ChromaFormat _chromaFormat, const Area &area);

  CodingUnit& operator=( const CodingUnit& other );

  void initData();

  unsigned    idx;
  CodingUnit *next;

  PredictionUnit *firstPU;
  PredictionUnit *lastPU;

  TransformUnit *firstTU;
  TransformUnit *lastTU;
#if ENABLE_SPLIT_PARALLELISM

  int64_t cacheId;
  bool    cacheUsed;
#endif
  const uint8_t     getSbtIdx() const { assert( ( ( sbtInfo >> 0 ) & 0xf ) < NUMBER_SBT_IDX ); return ( sbtInfo >> 0 ) & 0xf; }
  const uint8_t     getSbtPos() const { return ( sbtInfo >> 4 ) & 0x3; }
  void              setSbtIdx( uint8_t idx ) { CHECK( idx >= NUMBER_SBT_IDX, "sbt_idx wrong" ); sbtInfo = ( idx << 0 ) + ( sbtInfo & 0xf0 ); }
  void              setSbtPos( uint8_t pos ) { CHECK( pos >= 4, "sbt_pos wrong" ); sbtInfo = ( pos << 4 ) + ( sbtInfo & 0xcf ); }
  uint8_t           getSbtTuSplit() const;
  const uint8_t     checkAllowedSbt() const;
  const bool        checkCCLMAllowed() const;
  const bool        isSepTree() const;
  const bool        isLocalSepTree() const;
  const bool        isConsInter() const { return modeType == MODE_TYPE_INTER; }
  const bool        isConsIntra() const { return modeType == MODE_TYPE_INTRA; }
};
举报

相关推荐

0 条评论