VVC代码学习之自定义数据结构阅读4
class CodingStructure
1.这个类中存储了编码所需要的一系列信息,区域,图片,父类CS,bestCS,以及slice,同时还存放了相关的QP信息,以及各种参数集SPS,PPS,VPS等等,并且可以从CS中提取到当前的cu,pu 和tu,更可以获取到可以遍历当前CU的遍历器。
2.定义三个数组,分别存放CU,TU,PU, 以及m_numCUs,cucache等等,同时还保存了预测,残差,原始,重构的Pelstorage,同时可以获取当前的运动信息getMotionBuf
3.同样的,因为由picture成员变量,所以可以访问原始,预测,残差等等的buf。
补充:一帧中的所有CU都会存放在CodingStructure中,存放的位置就是vector的数组,tu,pu同理
class CodingStructure
{
public:UnitArea area;Picture *picture;CodingStructure *parent;CodingStructure *bestCS;Slice *slice;UnitScale unitScale[MAX_NUM_COMPONENT];int baseQP;int prevQP[MAX_NUM_CHANNEL_TYPE];int currQP[MAX_NUM_CHANNEL_TYPE];int chromaQpAdj;const SPS *sps;const PPS *pps;PicHeader *picHeader;APS* alfApss[ALF_CTB_MAX_NUM_APS];APS * lmcsAps;APS * scalinglistAps;const VPS *vps;const PreCalcValues* pcv;CodingStructure(CUCache&, PUCache&, TUCache&);void create(const UnitArea &_unit, const bool isTopLayer, const bool isPLTused);void create(const ChromaFormat &_chromaFormat, const Area& _area, const bool isTopLayer, const bool isPLTused);void destroy();void releaseIntermediateData();void rebindPicBufs();void createCoeffs(const bool isPLTused);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;const PredictionUnit *getPU(const Position &pos, const ChannelType _chType) const;const TransformUnit *getTU(const Position &pos, const ChannelType _chType, const int subTuIdx = -1) const;CodingUnit *getCU(const Position &pos, const ChannelType _chType);CodingUnit *getLumaCU( const Position &pos );PredictionUnit *getPU(const Position &pos, const ChannelType _chType);TransformUnit *getTU(const Position &pos, const ChannelType _chType, const int subTuIdx = -1);const CodingUnit *getCU(const ChannelType &_chType) const { return getCU(area.blocks[_chType].pos(), _chType); }const PredictionUnit *getPU(const ChannelType &_chType) const { return getPU(area.blocks[_chType].pos(), _chType); }const TransformUnit *getTU(const ChannelType &_chType) const { return getTU(area.blocks[_chType].pos(), _chType); }CodingUnit *getCU(const ChannelType &_chType ) { return getCU(area.blocks[_chType].pos(), _chType); }PredictionUnit *getPU(const ChannelType &_chType ) { return getPU(area.blocks[_chType].pos(), _chType); }TransformUnit *getTU(const ChannelType &_chType ) { return getTU(area.blocks[_chType].pos(), _chType); }const CodingUnit *getCURestricted(const Position &pos, const Position curPos, const unsigned curSliceIdx, const unsigned curTileIdx, const ChannelType _chType) const;const CodingUnit *getCURestricted(const Position &pos, const CodingUnit& curCu, const ChannelType _chType) const;const PredictionUnit *getPURestricted(const Position &pos, const PredictionUnit& curPu, const ChannelType _chType) const;const TransformUnit *getTURestricted(const Position &pos, const TransformUnit& curTu, const ChannelType _chType) const;CodingUnit& addCU(const UnitArea &unit, const ChannelType _chType);PredictionUnit& addPU(const UnitArea &unit, const ChannelType _chType);TransformUnit& addTU(const UnitArea &unit, const ChannelType _chType);void addEmptyTUs(Partitioner &partitioner);CUTraverser traverseCUs(const UnitArea& _unit, const ChannelType _chType);PUTraverser traversePUs(const UnitArea& _unit, const ChannelType _chType);TUTraverser traverseTUs(const UnitArea& _unit, const ChannelType _chType);cCUTraverser traverseCUs(const UnitArea& _unit, const ChannelType _chType) const;cPUTraverser traversePUs(const UnitArea& _unit, const ChannelType _chType) const;cTUTraverser traverseTUs(const UnitArea& _unit, const ChannelType _chType) const;// ---------------------------------------------------------------------------// encoding search utilities// ---------------------------------------------------------------------------static_vector<double, NUM_ENC_FEATURES> features;double cost;bool useDbCost;double costDbOffset;double lumaCost;uint64_t fracBits;Distortion dist;Distortion interHad;TreeType treeType; //because partitioner can not go deep to tu and cu coding (e.g., addCU()), need another variable for indicating treeTypeModeType modeType;void initStructData (const int &QP = MAX_INT, const bool &skipMotBuf = false);void initSubStructure( CodingStructure& cs, const ChannelType chType, const UnitArea &subArea, const bool &isTuEnc);void copyStructure (const CodingStructure& cs, const ChannelType chType, const bool copyTUs = false, const bool copyRecoBuffer = false);void useSubStructure (const CodingStructure& cs, const ChannelType chType, const UnitArea &subArea, const bool cpyPred, const bool cpyReco, const bool cpyOrgResi, const bool cpyResi, const bool updateCost);void useSubStructure (const CodingStructure& cs, const ChannelType chType, const bool cpyPred, const bool cpyReco, const bool cpyOrgResi, const bool cpyResi, const bool updateCost) { useSubStructure(cs, chType, cs.area, cpyPred, cpyReco, cpyOrgResi, cpyResi, updateCost); }void clearTUs();void clearPUs();void clearCUs();const int signalModeCons( const PartSplit split, Partitioner &partitioner, const ModeType modeTypeParent ) const;void clearCuPuTuIdxMap ( const UnitArea &_area, uint32_t numCu, uint32_t numPu, uint32_t numTu, uint32_t* pOffset );void getNumCuPuTuOffset ( uint32_t* pArray ){pArray[0] = m_numCUs; pArray[1] = m_numPUs; pArray[2] = m_numTUs;pArray[3] = m_offsets[0]; pArray[4] = m_offsets[1]; pArray[5] = m_offsets[2];}private:void createInternals(const UnitArea& _unit, const bool isTopLayer, const bool isPLTused);public:std::vector< CodingUnit*> cus;std::vector<PredictionUnit*> pus;std::vector< TransformUnit*> tus;LutMotionCand motionLut;void addMiToLut(static_vector<MotionInfo, MAX_NUM_HMVP_CANDS>& lut, const MotionInfo &mi);PLTBuf prevPLT;void resetPrevPLT(PLTBuf& prevPLT);void reorderPrevPLT(PLTBuf& prevPLT, uint8_t curPLTSize[MAX_NUM_CHANNEL_TYPE], Pel curPLT[MAX_NUM_COMPONENT][MAXPLTSIZE], bool reuseflag[MAX_NUM_CHANNEL_TYPE][MAXPLTPREDSIZE], uint32_t compBegin, uint32_t numComp, bool jointPLT);void setPrevPLT(PLTBuf predictor);void storePrevPLT(PLTBuf& predictor);
private:// needed for TU encodingbool m_isTuEnc;unsigned *m_cuIdx [MAX_NUM_CHANNEL_TYPE];unsigned *m_puIdx [MAX_NUM_CHANNEL_TYPE];unsigned *m_tuIdx [MAX_NUM_CHANNEL_TYPE];bool *m_isDecomp[MAX_NUM_CHANNEL_TYPE];unsigned m_numCUs;unsigned m_numPUs;unsigned m_numTUs;CUCache& m_cuCache;PUCache& m_puCache;TUCache& m_tuCache;std::vector<SAOBlkParam> m_sao;PelStorage m_pred;PelStorage m_resi;PelStorage m_reco;PelStorage m_orgr;TCoeff *m_coeffs [ MAX_NUM_COMPONENT ];Pel *m_pcmbuf [ MAX_NUM_COMPONENT ];bool *m_runType[ MAX_NUM_CHANNEL_TYPE ];int m_offsets[ MAX_NUM_COMPONENT ];MotionInfo *m_motionBuf;public:CodingStructure *bestParent;double tmpColorSpaceCost;bool firstColorSpaceSelected;double tmpColorSpaceIntraCost[2];bool firstColorSpaceTestOnly;bool resetIBCBuffer;MotionBuf getMotionBuf( const Area& _area );MotionBuf getMotionBuf( const UnitArea& _area ) { return getMotionBuf( _area.Y() ); }MotionBuf getMotionBuf() { return getMotionBuf( area.Y() ); }const CMotionBuf getMotionBuf( const Area& _area ) const;const CMotionBuf getMotionBuf( const UnitArea& _area ) const { return getMotionBuf( _area.Y() ); }const CMotionBuf getMotionBuf() const { return getMotionBuf( area.Y() ); }MotionInfo& getMotionInfo( const Position& pos );const MotionInfo& getMotionInfo( const Position& pos ) const;public:// ---------------------------------------------------------------------------// temporary (shadowed) data accessors// ---------------------------------------------------------------------------PelBuf getPredBuf(const CompArea &blk);const CPelBuf getPredBuf(const CompArea &blk) const;PelUnitBuf getPredBuf(const UnitArea &unit);const CPelUnitBuf getPredBuf(const UnitArea &unit) const;PelBuf getResiBuf(const CompArea &blk);const CPelBuf getResiBuf(const CompArea &blk) const;PelUnitBuf getResiBuf(const UnitArea &unit);const CPelUnitBuf getResiBuf(const UnitArea &unit) const;PelBuf getRecoBuf(const CompArea &blk);const CPelBuf getRecoBuf(const CompArea &blk) const;PelUnitBuf getRecoBuf(const UnitArea &unit);const CPelUnitBuf getRecoBuf(const UnitArea &unit) const;PelUnitBuf& getRecoBufRef() { return m_reco; }PelBuf getOrgResiBuf(const CompArea &blk);const CPelBuf getOrgResiBuf(const CompArea &blk) const;PelUnitBuf getOrgResiBuf(const UnitArea &unit);const CPelUnitBuf getOrgResiBuf(const UnitArea &unit) const;PelBuf getOrgBuf(const CompArea &blk);const CPelBuf getOrgBuf(const CompArea &blk) const;PelUnitBuf getOrgBuf(const UnitArea &unit);const CPelUnitBuf getOrgBuf(const UnitArea &unit) const;PelBuf getOrgBuf(const ComponentID &compID);const CPelBuf getOrgBuf(const ComponentID &compID) const;PelUnitBuf getOrgBuf();const CPelUnitBuf getOrgBuf() const;// pred bufferPelBuf getPredBuf(const ComponentID &compID) { return m_pred.get(compID); }const CPelBuf getPredBuf(const ComponentID &compID) const { return m_pred.get(compID); }PelUnitBuf getPredBuf() { return m_pred; }const CPelUnitBuf getPredBuf() const { return m_pred; }// resi bufferPelBuf getResiBuf(const ComponentID compID) { return m_resi.get(compID); }const CPelBuf getResiBuf(const ComponentID compID) const { return m_resi.get(compID); }PelUnitBuf getResiBuf() { return m_resi; }const CPelUnitBuf getResiBuf() const { return m_resi; }// org-resi bufferPelBuf getOrgResiBuf(const ComponentID &compID) { return m_orgr.get(compID); }const CPelBuf getOrgResiBuf(const ComponentID &compID) const { return m_orgr.get(compID); }PelUnitBuf getOrgResiBuf() { return m_orgr; }const CPelUnitBuf getOrgResiBuf() const { return m_orgr; }// reco bufferPelBuf getRecoBuf(const ComponentID compID) { return m_reco.get(compID); }const CPelBuf getRecoBuf(const ComponentID compID) const { return m_reco.get(compID); }PelUnitBuf getRecoBuf() { return m_reco; }const CPelUnitBuf getRecoBuf() const { return m_reco; }private:inline PelBuf getBuf(const CompArea &blk, const PictureType &type);inline const CPelBuf getBuf(const CompArea &blk, const PictureType &type) const;inline PelUnitBuf getBuf(const UnitArea &unit, const PictureType &type);inline const CPelUnitBuf getBuf(const UnitArea &unit, const PictureType &type) const;
};static inline uint32_t getNumberValidTBlocks(const PreCalcValues& pcv) { return (pcv.chrFormat==CHROMA_400) ? 1 : ( pcv.multiBlock422 ? MAX_NUM_TBLOCKS : MAX_NUM_COMPONENT ); }#endif
VVC代码学习之自定义数据结构阅读4相关推荐
- H.266/VVC代码学习20:角度预测入口 / 特殊模式的PDPC技术(predIntraAng)
1.predIntraAng函数 predIntraAng是帧内0~66这67种预测的入口.其中可细分为: 模式0:PLANAR模式 模式1:DC模式 模式2~66:角度模式 此函数在亮度预测和色度预 ...
- H.266/VVC代码学习21:帧内角度预测的实现 / 近对角模式的PDPC(xPredIntraAng)
xPredIntraAng函数的作用是对任意大小的块和任意模式,如何将参考像素的值根据其模式的角度填充进每一个像素. 下图是basketball drill的一个16*16的块,其预测模式为10(偏斜 ...
- H.266/VVC代码学习17:帧内亮度预测的编解码(intra_luma_pred_modes)
引--亮度预测:H.266/VVC代码学习5:VTM4.0帧内亮度预测代码(estIntraPredLumaQT) 一.结论: 亮度编解码根据MPM列表的值分为两个阶段: 1 亮度模式在MPM列表中: ...
- H.266/VVC代码学习:帧内预测之角度预测函数(predIntraAng、xPredIntraAng)
predIntraAng函数 VTM中,帧内预测的角度预测的入口函数为predIntraAng函数,该函数主要是用于进行传统的帧内预测(Planar.DC.角度预测),然后对Planar和DC模式使用 ...
- H.266/VVC代码学习:xCompressCU函数
xCompressCU函数是用来进行CU划分(递归调用自身)以及模式选择. 首先调用m_modeCtrl->initCULevel函数初始化模式选择列表,由堆栈控制,将当前CU可以划分的模式(四 ...
- H.266/VVC代码学习:MIP技术相关代码之initIntraMip函数
initIntraMip函数主要是对参考像素进行下采样并为MIP矩阵乘法准备输入数据,函数结构如下: MIP根据块尺寸可以分为以下三种情况: 块尺寸 下采样后的边界长度 m_reducedBdry ...
- H.266/VVC代码学习32:VTM5.0解码端最上层函数
解码部分的研究不像编码端那样需要精雕细琢,但如果想研究一个内容划分或选择模式等的最终结果是怎样,那么应该从解码端入手.下面让我们来学习解码端的框架及最上层的三个函数. 文章目录 1 main() 2 ...
- H.266/VVC代码学习:DC模式和Planar模式
Planar模式和DC模式时两种特殊的角度模式,分别对应于模式号0和1. 一.DC模式 DC模式适用于大面积平坦区域,其预测值是通过计算左边和(或)上边参考像素的平均值获得的. 1.1.计算 DC模式 ...
- VVC 代码阅读 compressCtu()函数
void EncCu::compressCtu( CodingStructure& cs, const UnitArea& area, const unsigned ctuRsAddr ...
最新文章
- 2 分 31 秒,腾讯云创造 128 卡训练 ImageNet 新记录
- 使用了这个神器,让我的代码bug少了一半
- python环境搭建需要装几个软件_python的发展前景及python环境搭建
- van Emda Boas
- 如何在GitHub上重命名存储库?
- 《研磨设计模式》chap19 备忘录模式
- IDEA 2020 本土化,真的是全中文了,新手,开心了!
- Windows Socket 编程
- nginx负载均衡 页面缓存
- python 调用bat失败_要想顺利通过Python面试,你最起码需要达到白银段位!
- html页面缓存meta,html中怎么用meta语句禁用页面缓存?
- 刨根问底:对于 self = [super init] 的思考
- 编译出错 recompile with -fPIC
- Atitit 军事学 之 军事思想学与打猎学总结以及在软件行业中的应用 attilax著 1. 军事思想在软件行业技术开发中的想通之处	1 1.1. 软件开发本质上是一种作战,敌人是时间与费用成本
- 怎样邀请别人加入企业微信?
- MySQL: 为什么使用 innobackupex 备份恢复搭建主从时,必须人为设置 gtid_purged 变量
- Freebase SPARQL 查询模板
- mysql数据备份与导入(二)
- C++强制类型转化:reinterpret_cast
- 集成微控制器使太阳能微型逆变器设计成本有效