最近开始做HEVC了,其中熵解码作为最底层的部分,因为和h264差不多,难度系数不是很大,主要是一些查表的操作
具体的实现原理就不细说了,主要从代码来进行解释
首先分析HM工程当中的熵解码的部分作为引导,因为最终要在DSP上进行运行,之后会重写为C代码,流程性更强
代码分析
首先介绍熵解码中比较重要的几个结构体和设计到的函数
一进入main函数,最主要的就是对应的解码类TAppDecTop
int main(int argc, char* argv[])
{
TAppDecTop cTAppDecTop;
TAppDecTop类中主要是create和destroy相关的成员函数,真正重要的解码类还在 TDecTop当中,打开TDecTop类,会看到一些比较重要的模块的类
TComPrediction m_cPrediction;
TComTrQuant m_cTrQuant;
TDecGop m_cGopDecoder;
TDecSlice m_cSliceDecoder;
TDecCu m_cCuDecoder;
TDecEntropy m_cEntropyDecoder;
TDecCavlc m_cCavlcDecoder;
TDecSbac m_cSbacDecoder;
TDecBinCABAC m_cBinCABAC;
SEIReader m_seiReader;
TComLoopFilter m_cLoopFilter;
TComSampleAdaptiveOffset m_cSAO;
很明显有几个和熵解码有关系:
TDecEntropy m_cEntropyDecoder; 看一下成员函数
Void init (TComPrediction* p) {m_pcPrediction = p;}
Void decodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU );
Void decodeInterDirPU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx );
Void decodeRefFrmIdxPU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList );
Void decodeMvdPU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList );
Void decodeMVPIdxPU ( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList );
Void setEntropyDecoder ( TDecEntropyIf* p );
Void setBitstream ( TComInp