[2] | 1 | |
---|
| 2 | |
---|
| 3 | /** \file TDecCAVLC.h |
---|
| 4 | \brief CAVLC decoder class (header) |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef __TDECCAVLC__ |
---|
| 8 | #define __TDECCAVLC__ |
---|
| 9 | |
---|
| 10 | #if _MSC_VER > 1000 |
---|
| 11 | #pragma once |
---|
| 12 | #endif // _MSC_VER > 1000 |
---|
| 13 | |
---|
| 14 | #include "TDecEntropy.h" |
---|
| 15 | |
---|
| 16 | // ==================================================================================================================== |
---|
| 17 | // Class definition |
---|
| 18 | // ==================================================================================================================== |
---|
| 19 | |
---|
| 20 | class SEImessages; |
---|
| 21 | |
---|
| 22 | /// CAVLC decoder class |
---|
| 23 | class TDecCavlc : public TDecEntropyIf |
---|
| 24 | { |
---|
| 25 | public: |
---|
| 26 | TDecCavlc(); |
---|
| 27 | virtual ~TDecCavlc(); |
---|
| 28 | |
---|
| 29 | protected: |
---|
| 30 | Void xReadCode (UInt uiLength, UInt& ruiCode); |
---|
| 31 | Void xReadUvlc (UInt& ruiVal); |
---|
| 32 | Void xReadSvlc (Int& riVal); |
---|
| 33 | Void xReadFlag (UInt& ruiCode); |
---|
| 34 | Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount ); |
---|
| 35 | Void xReadExGolombLevel ( UInt& ruiSymbol ); |
---|
| 36 | Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, UInt uiMaxSymbol ); |
---|
| 37 | |
---|
| 38 | UInt xGetBit (); |
---|
| 39 | Int xReadVlc ( Int n ); |
---|
| 40 | #if CAVLC_COEF_LRG_BLK |
---|
| 41 | Void xParseCoeff ( TCoeff* scoeff, Int iTableNumber, Int blSize); |
---|
| 42 | #else |
---|
| 43 | Void xParseCoeff4x4 ( TCoeff* scoeff, Int iTableNumber ); |
---|
| 44 | Void xParseCoeff8x8 ( TCoeff* scoeff, Int iTableNumber ); |
---|
| 45 | #endif |
---|
| 46 | #if QC_MOD_LCEC |
---|
| 47 | Void xRunLevelIndInv (LastCoeffStruct *combo, Int maxrun, UInt lrg1Pos, UInt cn); |
---|
| 48 | #if RUNLEVEL_TABLE_CUT |
---|
| 49 | Void xRunLevelIndInterInv(LastCoeffStruct *combo, Int maxrun, UInt cn); |
---|
| 50 | #endif |
---|
| 51 | #endif |
---|
| 52 | |
---|
| 53 | private: |
---|
| 54 | TComBitstream* m_pcBitstream; |
---|
| 55 | UInt m_uiCoeffCost; |
---|
| 56 | Bool m_bRunLengthCoding; |
---|
| 57 | UInt m_uiRun; |
---|
| 58 | Bool m_bAlfCtrl; |
---|
| 59 | UInt m_uiMaxAlfCtrlDepth; |
---|
| 60 | UInt m_uiLPTableD4[3][32]; |
---|
| 61 | #if !CAVLC_COEF_LRG_BLK |
---|
| 62 | UInt m_uiLPTableD8[10][128]; |
---|
| 63 | #endif |
---|
| 64 | UInt m_uiLastPosVlcIndex[10]; |
---|
| 65 | |
---|
| 66 | #if LCEC_INTRA_MODE |
---|
| 67 | #if MTK_DCM_MPM |
---|
| 68 | UInt m_uiIntraModeTableD17[2][16]; |
---|
| 69 | UInt m_uiIntraModeTableD34[2][33]; |
---|
| 70 | #else |
---|
| 71 | UInt m_uiIntraModeTableD17[16]; |
---|
| 72 | UInt m_uiIntraModeTableD34[33]; |
---|
| 73 | #endif |
---|
| 74 | #endif |
---|
| 75 | #if QC_LCEC_INTER_MODE |
---|
| 76 | UInt m_uiSplitTableD[4][7]; |
---|
| 77 | #endif |
---|
| 78 | #if CAVLC_RQT_CBP |
---|
| 79 | UInt m_uiCBP_YUV_TableD[4][8]; |
---|
| 80 | UInt m_uiCBP_YS_TableD[2][4]; |
---|
| 81 | UInt m_uiCBP_YCS_TableD[2][8]; |
---|
| 82 | UInt m_uiCBP_4Y_TableD[2][15]; |
---|
| 83 | UInt m_uiCBP_4Y_VlcIdx; |
---|
| 84 | #else |
---|
| 85 | UInt m_uiBlkCBPTableD[2][15]; |
---|
| 86 | UInt m_uiCBPTableD[2][8]; |
---|
| 87 | UInt m_uiCbpVlcIdx[2]; |
---|
| 88 | UInt m_uiBlkCbpVlcIdx; |
---|
| 89 | #endif |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | Int m_iRefFrame0[1000]; |
---|
| 94 | Int m_iRefFrame1[1000]; |
---|
| 95 | Bool m_bMVres0[1000]; |
---|
| 96 | Bool m_bMVres1[1000]; |
---|
| 97 | #if MS_LCEC_LOOKUP_TABLE_EXCEPTION |
---|
| 98 | UInt m_uiMI1TableD[9]; |
---|
| 99 | #else |
---|
| 100 | UInt m_uiMI1TableD[8]; |
---|
| 101 | #endif |
---|
| 102 | UInt m_uiMI2TableD[15]; |
---|
| 103 | UInt m_uiMITableVlcIdx; |
---|
| 104 | |
---|
| 105 | #if CAVLC_COUNTER_ADAPT |
---|
| 106 | #if CAVLC_RQT_CBP |
---|
| 107 | UChar m_ucCBP_YUV_TableCounter[4][4]; |
---|
| 108 | UChar m_ucCBP_4Y_TableCounter[2][2]; |
---|
| 109 | UChar m_ucCBP_YS_TableCounter[2][3]; |
---|
| 110 | UChar m_ucCBP_YCS_TableCounter[2][4]; |
---|
| 111 | UChar m_ucCBP_YUV_TableCounterSum[4]; |
---|
| 112 | UChar m_ucCBP_4Y_TableCounterSum[2]; |
---|
| 113 | UChar m_ucCBP_YS_TableCounterSum[2]; |
---|
| 114 | UChar m_ucCBP_YCS_TableCounterSum[2]; |
---|
| 115 | #else |
---|
| 116 | UChar m_ucCBFTableCounter [2][4]; |
---|
| 117 | UChar m_ucBlkCBPTableCounter [2][2]; |
---|
| 118 | UChar m_ucCBFTableCounterSum[2]; |
---|
| 119 | UChar m_ucBlkCBPTableCounterSum[2]; |
---|
| 120 | #endif |
---|
| 121 | |
---|
| 122 | UChar m_ucMI1TableCounter[4]; |
---|
| 123 | UChar m_ucSplitTableCounter[4][4]; |
---|
| 124 | UChar m_ucSplitTableCounterSum[4]; |
---|
| 125 | UChar m_ucMI1TableCounterSum; |
---|
| 126 | #endif |
---|
| 127 | |
---|
| 128 | Int** m_aaiTempScale; |
---|
| 129 | Int** m_aaiTempOffset; |
---|
| 130 | Int** m_aaiTempPdmScaleNomDelta; |
---|
| 131 | Int** m_aaiTempPdmOffset; |
---|
| 132 | |
---|
| 133 | public: |
---|
| 134 | Void resetEntropy ( TComSlice* pcSlice ); |
---|
| 135 | Void setBitstream ( TComBitstream* p ) { m_pcBitstream = p; } |
---|
| 136 | Void setAlfCtrl ( Bool bAlfCtrl ) { m_bAlfCtrl = bAlfCtrl; } |
---|
| 137 | Void setMaxAlfCtrlDepth ( UInt uiMaxAlfCtrlDepth ) { m_uiMaxAlfCtrlDepth = uiMaxAlfCtrlDepth; } |
---|
| 138 | |
---|
| 139 | Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ); |
---|
| 140 | Void parseQtCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ); |
---|
| 141 | Void parseQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf ); |
---|
| 142 | Void parseAlfFlag ( UInt& ruiVal ); |
---|
| 143 | Void parseAlfUvlc ( UInt& ruiVal ); |
---|
| 144 | Void parseAlfSvlc ( Int& riVal ); |
---|
| 145 | #if MTK_SAO |
---|
| 146 | Void parseAoFlag ( UInt& ruiVal ); |
---|
| 147 | Void parseAoUvlc ( UInt& ruiVal ); |
---|
| 148 | Void parseAoSvlc ( Int& riVal ); |
---|
| 149 | #endif |
---|
| 150 | |
---|
| 151 | Void parseNalUnitHeader ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag ); |
---|
| 152 | |
---|
| 153 | Void parseSPS ( TComSPS* pcSPS ); |
---|
| 154 | Void parsePPS ( TComPPS* pcPPS); |
---|
| 155 | void parseSEI(SEImessages&); |
---|
| 156 | Void parseSliceHeader ( TComSlice*& rpcSlice ); |
---|
| 157 | Void parseTerminatingBit ( UInt& ruiBit ); |
---|
| 158 | |
---|
| 159 | Void parseMVPIdx ( TComDataCU* pcCU, Int& riMVPIdx, Int iMVPNum, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
| 160 | |
---|
| 161 | Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 162 | Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); |
---|
| 163 | Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 164 | Void parseMergeIndexMV ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 165 | Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 166 | Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 167 | #if MW_MVI_SIGNALLING_MODE == 0 |
---|
| 168 | Void parseMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 169 | #endif |
---|
| 170 | Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 171 | Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 172 | |
---|
| 173 | Void parseIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 174 | |
---|
| 175 | Void parseIntraDirChroma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 176 | |
---|
| 177 | Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 178 | Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
| 179 | Void parseMvd ( TComDataCU* pcCU, UInt uiAbsPartAddr,UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
| 180 | |
---|
| 181 | Void parseDeltaQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 182 | #if CAVLC_RQT_CBP |
---|
| 183 | Void parseCbfTrdiv ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiTrDepth, UInt uiDepth, UInt& uiSubdiv ); |
---|
| 184 | UInt xGetFlagPattern ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiSubdiv ); |
---|
| 185 | #endif |
---|
| 186 | Void parseCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ); |
---|
| 187 | Void parseBlockCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth, UInt uiQPartNum ); |
---|
| 188 | Void parseCoeffNxN ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ); |
---|
| 189 | |
---|
| 190 | Void parseAlfCtrlDepth ( UInt& ruiAlfCtrlDepth ); |
---|
| 191 | Void parseAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 192 | #if TSB_ALF_HEADER |
---|
| 193 | Void parseAlfFlagNum ( UInt& ruiVal, UInt minValue, UInt depth ); |
---|
| 194 | Void parseAlfCtrlFlag ( UInt &ruiAlfCtrlFlag ); |
---|
| 195 | #endif |
---|
| 196 | |
---|
| 197 | #ifdef WEIGHT_PRED |
---|
| 198 | Void parseWeightPredTable ( TComSlice* pcSlice ); |
---|
| 199 | #endif |
---|
| 200 | |
---|
| 201 | Void parseViewIdx (Int& riViewIdx) ; |
---|
| 202 | }; |
---|
| 203 | #endif // !defined(AFX_TDECCAVLC_H__9732DD64_59B0_4A41_B29E_1A5B18821EAD__INCLUDED_) |
---|
| 204 | |
---|