1 | |
---|
2 | |
---|
3 | /** \file TDecEntropy.h |
---|
4 | \brief entropy decoder class (header) |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef __TDECENTROPY__ |
---|
8 | #define __TDECENTROPY__ |
---|
9 | |
---|
10 | #include "../TLibCommon/CommonDef.h" |
---|
11 | #include "../TLibCommon/TComBitStream.h" |
---|
12 | #include "../TLibCommon/TComSlice.h" |
---|
13 | #include "../TLibCommon/TComPic.h" |
---|
14 | #include "../TLibCommon/TComPrediction.h" |
---|
15 | #include "../TLibCommon/TComAdaptiveLoopFilter.h" |
---|
16 | |
---|
17 | class TDecSbac; |
---|
18 | class TDecCavlc; |
---|
19 | class SEImessages; |
---|
20 | |
---|
21 | // ==================================================================================================================== |
---|
22 | // Class definition |
---|
23 | // ==================================================================================================================== |
---|
24 | |
---|
25 | /// entropy decoder pure class |
---|
26 | class TDecEntropyIf |
---|
27 | { |
---|
28 | public: |
---|
29 | // Virtual list for SBAC/CAVLC |
---|
30 | virtual Void setAlfCtrl(Bool bAlfCtrl) = 0; |
---|
31 | virtual Void setMaxAlfCtrlDepth(UInt uiMaxAlfCtrlDepth) = 0; |
---|
32 | |
---|
33 | virtual Void resetEntropy (TComSlice* pcSlice) = 0; |
---|
34 | virtual Void setBitstream ( TComBitstream* p ) = 0; |
---|
35 | |
---|
36 | virtual Void parseNalUnitHeader ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag ) = 0; |
---|
37 | |
---|
38 | virtual Void parseSPS ( TComSPS* pcSPS ) = 0; |
---|
39 | virtual Void parsePPS ( TComPPS* pcPPS ) = 0; |
---|
40 | virtual void parseSEI(SEImessages&) = 0; |
---|
41 | virtual Void parseSliceHeader ( TComSlice*& rpcSlice ) = 0; |
---|
42 | virtual Void parseTerminatingBit ( UInt& ruilsLast ) = 0; |
---|
43 | |
---|
44 | virtual Void parseMVPIdx ( TComDataCU* pcCU, Int& riMVPIdx, Int iMVPNum, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ) = 0; |
---|
45 | |
---|
46 | public: |
---|
47 | virtual Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
48 | virtual Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
49 | #if MW_MVI_SIGNALLING_MODE == 0 |
---|
50 | virtual Void parseMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
51 | #endif |
---|
52 | virtual Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0; |
---|
53 | virtual Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
54 | virtual Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
55 | virtual Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
56 | virtual Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
57 | |
---|
58 | virtual Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
59 | |
---|
60 | virtual Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
61 | |
---|
62 | virtual Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
63 | virtual Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ) = 0; |
---|
64 | virtual Void parseMvd ( TComDataCU* pcCU, UInt uiAbsPartAddr, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ) = 0; |
---|
65 | |
---|
66 | virtual Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ) = 0; |
---|
67 | virtual Void parseQtCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ) = 0; |
---|
68 | virtual Void parseQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf ) = 0; |
---|
69 | |
---|
70 | virtual Void parseDeltaQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
71 | |
---|
72 | virtual Void parseCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ) = 0; |
---|
73 | virtual Void parseBlockCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth, UInt uiQPartNum ) = 0; |
---|
74 | #if CAVLC_RQT_CBP |
---|
75 | virtual Void parseCbfTrdiv ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiTrDepth, UInt uiDepth, UInt& uiSubdiv ) = 0; |
---|
76 | #endif |
---|
77 | |
---|
78 | virtual Void parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) = 0; |
---|
79 | |
---|
80 | virtual Void parseAlfFlag ( UInt& ruiVal ) = 0; |
---|
81 | virtual Void parseAlfUvlc ( UInt& ruiVal ) = 0; |
---|
82 | virtual Void parseAlfSvlc ( Int& riVal ) = 0; |
---|
83 | virtual Void parseAlfCtrlDepth ( UInt& ruiAlfCtrlDepth ) = 0; |
---|
84 | virtual Void parseAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; |
---|
85 | #if TSB_ALF_HEADER |
---|
86 | virtual Void parseAlfFlagNum ( UInt& ruiVal, UInt minValue, UInt depth ) = 0; |
---|
87 | virtual Void parseAlfCtrlFlag ( UInt &ruiAlfCtrlFlag ) = 0; |
---|
88 | #endif |
---|
89 | |
---|
90 | #if MTK_SAO |
---|
91 | virtual Void parseAoFlag ( UInt& ruiVal ) = 0; |
---|
92 | virtual Void parseAoUvlc ( UInt& ruiVal ) = 0; |
---|
93 | virtual Void parseAoSvlc ( Int& riVal ) = 0; |
---|
94 | #endif |
---|
95 | virtual Void parseViewIdx ( Int& riViewIdx ) = 0; |
---|
96 | virtual ~TDecEntropyIf() {} |
---|
97 | }; |
---|
98 | |
---|
99 | /// entropy decoder class |
---|
100 | class TDecEntropy |
---|
101 | { |
---|
102 | private: |
---|
103 | TDecEntropyIf* m_pcEntropyDecoderIf; |
---|
104 | TComPrediction* m_pcPrediction; |
---|
105 | |
---|
106 | public: |
---|
107 | Void init (TComPrediction* p) {m_pcPrediction = p;} |
---|
108 | Void decodeMVPIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList, TComDataCU* pcSubCU ); |
---|
109 | Void decodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ); |
---|
110 | Void decodeInterDirPU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx ); |
---|
111 | Void decodeRefFrmIdxPU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ); |
---|
112 | Void decodeMvdPU ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ); |
---|
113 | Void decodeMVPIdxPU ( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ); |
---|
114 | |
---|
115 | Void setEntropyDecoder ( TDecEntropyIf* p ); |
---|
116 | Void setBitstream ( TComBitstream* p ) { m_pcEntropyDecoderIf->setBitstream(p); } |
---|
117 | Void resetEntropy ( TComSlice* p) { m_pcEntropyDecoderIf->resetEntropy(p); } |
---|
118 | |
---|
119 | Void decodeNalUnitHeader ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag ) |
---|
120 | { m_pcEntropyDecoderIf->parseNalUnitHeader(eNalUnitType, TemporalId, bOutputFlag ); } |
---|
121 | |
---|
122 | |
---|
123 | Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } |
---|
124 | Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); } |
---|
125 | void decodeSEI(SEImessages& seis) { m_pcEntropyDecoderIf->parseSEI(seis); } |
---|
126 | Void decodeSliceHeader ( TComSlice*& rpcSlice ) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice); } |
---|
127 | Void decodeTerminatingBit ( UInt& ruiIsLast ) { m_pcEntropyDecoderIf->parseTerminatingBit(ruiIsLast); } |
---|
128 | |
---|
129 | // Adaptive Loop filter |
---|
130 | Void decodeAlfParam(ALFParam* pAlfParam); |
---|
131 | //--Adaptive Loop filter |
---|
132 | |
---|
133 | TDecEntropyIf* getEntropyDecoder() { return m_pcEntropyDecoderIf; } |
---|
134 | |
---|
135 | public: |
---|
136 | Void decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
137 | #if MW_MVI_SIGNALLING_MODE == 0 |
---|
138 | Void decodeMvInheritanceFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
139 | #endif |
---|
140 | Void decodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
141 | Void decodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); |
---|
142 | Void decodeMergeIndex ( TComDataCU* pcSubCU, UInt uiPartIdx, UInt uiPartAddr, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth ); |
---|
143 | Void decodeResPredFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx ); |
---|
144 | Void decodeAlfCtrlFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
145 | #if TSB_ALF_HEADER |
---|
146 | Void decodeAlfCtrlParam ( ALFParam *pAlfParam ); |
---|
147 | #endif |
---|
148 | |
---|
149 | Void decodePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
150 | Void decodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
151 | |
---|
152 | Void decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ); |
---|
153 | |
---|
154 | Void decodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
155 | Void decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
156 | Void decodeInterDir ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
157 | Void decodeRefFrmIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
158 | Void decodeMvd ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
159 | // SB |
---|
160 | Void decodeRefViewIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
161 | // |
---|
162 | Void decodeTransformIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
163 | Void decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
164 | |
---|
165 | Void decodeViewidx ( Int& riViewIdx ); |
---|
166 | |
---|
167 | |
---|
168 | private: |
---|
169 | Void xDecodeTransformSubdiv ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 ); |
---|
170 | |
---|
171 | Void xDecodeCoeff ( TComDataCU* pcCU, TCoeff* pcCoeff, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, TextType eType ); |
---|
172 | public: |
---|
173 | Void decodeCoeff ( TComDataCU* pcCU , UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight ); |
---|
174 | |
---|
175 | // ALF-related |
---|
176 | Void decodeAux(ALFParam* pAlfParam); |
---|
177 | Void decodeFilt(ALFParam* pAlfParam); |
---|
178 | Void readFilterCodingParams(ALFParam* pAlfParam); |
---|
179 | Void readFilterCoeffs(ALFParam* pAlfParam); |
---|
180 | Void decodeFilterCoeff (ALFParam* pAlfParam); |
---|
181 | Int golombDecode(Int k); |
---|
182 | |
---|
183 | #if MTK_SAO |
---|
184 | Void decodeQAOOnePart(SAOParam* pQaoParam, Int part_idx); |
---|
185 | Void decodeQuadTreeSplitFlag(SAOParam* pQaoParam, Int part_idx); |
---|
186 | Void decodeSaoParam(SAOParam* pQaoParam) ; |
---|
187 | #endif |
---|
188 | |
---|
189 | };// END CLASS DEFINITION TDecEntropy |
---|
190 | |
---|
191 | |
---|
192 | #endif // __TDECENTROPY__ |
---|
193 | |
---|