source: 3DVCSoftware/trunk/source/Lib/TLibEncoder/TEncCavlc.h @ 2

Last change on this file since 2 was 2, checked in by hhi, 13 years ago

inital import

  • Property svn:eol-style set to native
File size: 8.6 KB
Line 
1
2
3/** \file     TEncCavlc.h
4    \brief    CAVLC encoder class (header)
5*/
6
7#ifndef __TENCCAVLC__
8#define __TENCCAVLC__
9
10#if _MSC_VER > 1000
11#pragma once
12#endif // _MSC_VER > 1000
13
14#include "../TLibCommon/CommonDef.h"
15#include "../TLibCommon/TComBitStream.h"
16#include "TEncEntropy.h"
17#if QC_MOD_LCEC
18#include "../TLibCommon/TComRom.h"
19#endif
20
21class TEncTop;
22
23// ====================================================================================================================
24// Class definition
25// ====================================================================================================================
26
27/// CAVLC encoder class
28class TEncCavlc : public TEncEntropyIf
29{
30private:
31  Bool m_bAdaptFlag;
32 
33 
34public:
35  TEncCavlc();
36  virtual ~TEncCavlc();
37 
38protected:
39  TComBitIf*    m_pcBitIf;
40  TComSlice*    m_pcSlice;
41  UInt          m_uiCoeffCost;
42  Bool          m_bRunLengthCoding;
43  UInt          m_uiRun;
44  Bool          m_bAlfCtrl;
45  UInt          m_uiMaxAlfCtrlDepth;
46  UInt          m_uiLPTableE4[3][32];
47  UInt          m_uiLPTableD4[3][32];
48#if !CAVLC_COEF_LRG_BLK
49  UInt          m_uiLPTableE8[10][128];
50  UInt          m_uiLPTableD8[10][128];
51#endif
52  UInt          m_uiLastPosVlcIndex[10];
53 
54#if LCEC_INTRA_MODE
55 #if MTK_DCM_MPM
56  UInt          m_uiIntraModeTableD17[2][16];
57  UInt          m_uiIntraModeTableE17[2][16];
58
59  UInt          m_uiIntraModeTableD34[2][33];
60  UInt          m_uiIntraModeTableE34[2][33];
61#else
62  UInt          m_uiIntraModeTableD17[16];
63  UInt          m_uiIntraModeTableE17[16];
64
65  UInt          m_uiIntraModeTableD34[33];
66  UInt          m_uiIntraModeTableE34[33];
67#endif
68#endif
69 
70#if CAVLC_RQT_CBP
71  UInt          m_uiCBP_YUV_TableE[4][8];
72  UInt          m_uiCBP_YUV_TableD[4][8];
73  UInt          m_uiCBP_YS_TableE[2][4];
74  UInt          m_uiCBP_YS_TableD[2][4];
75  UInt          m_uiCBP_YCS_TableE[2][8];
76  UInt          m_uiCBP_YCS_TableD[2][8];
77  UInt          m_uiCBP_4Y_TableE[2][15];
78  UInt          m_uiCBP_4Y_TableD[2][15];
79  UInt          m_uiCBP_4Y_VlcIdx;
80#else
81  UInt          m_uiCBPTableE[2][8];
82  UInt          m_uiCBPTableD[2][8];
83  UInt          m_uiBlkCBPTableE[2][15];
84  UInt          m_uiBlkCBPTableD[2][15];
85  UInt          m_uiCbpVlcIdx[2];
86  UInt          m_uiBlkCbpVlcIdx;
87#endif
88
89
90 
91#if MS_LCEC_LOOKUP_TABLE_EXCEPTION
92  UInt          m_uiMI1TableE[9];
93  UInt          m_uiMI1TableD[9];
94#else
95  UInt          m_uiMI1TableE[8];
96  UInt          m_uiMI1TableD[8];
97#endif
98  UInt          m_uiMI2TableE[15];
99  UInt          m_uiMI2TableD[15];
100 
101  UInt          m_uiMITableVlcIdx;
102#if QC_LCEC_INTER_MODE
103  UInt          m_uiSplitTableE[4][7];
104  UInt          m_uiSplitTableD[4][7];
105#endif
106
107#if CAVLC_COUNTER_ADAPT
108#if CAVLC_RQT_CBP
109  UChar         m_ucCBP_YUV_TableCounter[4][4];
110  UChar         m_ucCBP_4Y_TableCounter[2][2];
111  UChar         m_ucCBP_YS_TableCounter[2][3];
112  UChar         m_ucCBP_YCS_TableCounter[2][4];
113  UChar         m_ucCBP_YUV_TableCounterSum[4];
114  UChar         m_ucCBP_4Y_TableCounterSum[2];
115  UChar         m_ucCBP_YS_TableCounterSum[2];
116  UChar         m_ucCBP_YCS_TableCounterSum[2];
117#else
118  UChar         m_ucCBFTableCounter    [2][4];
119  UChar         m_ucBlkCBPTableCounter [2][2];
120  UChar         m_ucCBFTableCounterSum[2];
121  UChar         m_ucBlkCBPTableCounterSum[2];
122#endif
123  UChar         m_ucMI1TableCounter       [4];
124  UChar         m_ucSplitTableCounter  [4][4];
125
126  UChar         m_ucSplitTableCounterSum[4];
127  UChar         m_ucMI1TableCounterSum;
128#endif
129
130  Void  xCheckCoeff( TCoeff* pcCoef, UInt uiSize, UInt uiDepth, UInt& uiNumofCoeff, UInt& uiPart );
131 
132  Void  xWriteCode            ( UInt uiCode, UInt uiLength );
133  Void  xWriteUvlc            ( UInt uiCode );
134  Void  xWriteSvlc            ( Int iCode   );
135  Void  xWriteFlag            ( UInt uiCode );
136  Void  xWriteEpExGolomb      ( UInt uiSymbol, UInt uiCount );
137  Void  xWriteExGolombLevel    ( UInt uiSymbol );
138  Void  xWriteUnaryMaxSymbol  ( UInt uiSymbol, UInt uiMaxSymbol );
139#if !QC_MOD_LCEC_RDOQ
140  UInt  xLeadingZeros         ( UInt uiCode );
141#endif
142  Void  xWriteVlc             ( UInt uiTableNumber, UInt uiCodeNumber );
143
144#if CAVLC_COEF_LRG_BLK
145  Void  xCodeCoeff             ( TCoeff* scoeff, Int n, Int blSize);
146#else
147  Void  xCodeCoeff4x4          ( TCoeff* scoeff, Int iTableNumber );
148  Void  xCodeCoeff8x8          ( TCoeff* scoeff, Int iTableNumber );
149#endif
150 
151  UInt  xConvertToUInt        ( Int iValue ) {  return ( iValue <= 0) ? -iValue<<1 : (iValue<<1)-1; }
152 
153public:
154 
155  Void  resetEntropy          ();
156
157#if !CAVLC_COEF_LRG_BLK
158  UInt* GetLP8Table();
159#endif
160  UInt* GetLP4Table();
161#if QC_MOD_LCEC
162  UInt* GetLastPosVlcIndexTable();
163#endif
164  Void  setBitstream          ( TComBitIf* p )  { m_pcBitIf = p;  }
165  Void  setSlice              ( TComSlice* p )  { m_pcSlice = p;  }
166  Bool getAlfCtrl() {return m_bAlfCtrl;}
167  UInt getMaxAlfCtrlDepth() {return m_uiMaxAlfCtrlDepth;}
168  Void setAlfCtrl(Bool bAlfCtrl) {m_bAlfCtrl = bAlfCtrl;}
169  Void setMaxAlfCtrlDepth(UInt uiMaxAlfCtrlDepth) {m_uiMaxAlfCtrlDepth = uiMaxAlfCtrlDepth;}
170  Void  resetBits             ()                { m_pcBitIf->resetBits(); }
171  Void  resetCoeffCost        ()                { m_uiCoeffCost = 0;  }
172  UInt  getNumberOfWrittenBits()                { return  m_pcBitIf->getNumberOfWrittenBits();  }
173  UInt  getCoeffCost          ()                { return  m_uiCoeffCost;  }
174 
175  Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, Bool bOutputFlag = true );
176 
177  Void  codeSPS                 ( TComSPS* pcSPS );
178  Void  codePPS                 ( TComPPS* pcPPS );
179  void codeSEI(const SEI&);
180  Void  codeSliceHeader         ( TComSlice* pcSlice );
181  Void  codeTerminatingBit      ( UInt uilsLast );
182  Void  codeSliceFinish         ();
183 
184  Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
185  Void codeAlfFlag       ( UInt uiCode );
186  Void codeAlfUvlc       ( UInt uiCode );
187  Void codeAlfSvlc       ( Int   iCode );
188  Void codeAlfCtrlDepth();
189#if MTK_SAO
190  Void codeAoFlag       ( UInt uiCode );
191  Void codeAoUvlc       ( UInt uiCode );
192  Void codeAoSvlc       ( Int   iCode );
193#endif
194  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
195#if MW_MVI_SIGNALLING_MODE == 0
196  Void codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
197#endif
198  Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
199  Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
200  Void codeMergeIndexMV  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
201  Void codeResPredFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
202  Void codeAlfCtrlFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
203#if TSB_ALF_HEADER
204  Void codeAlfFlagNum    ( UInt uiCode, UInt minValue );
205  Void codeAlfCtrlFlag   ( UInt uiSymbol );
206#endif
207#if QC_LCEC_INTER_MODE
208  Void codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode );
209#endif 
210  Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
211 
212  Void codePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
213  Void codePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
214 
215  Void codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx );
216  Void codeQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth );
217  Void codeQtRootCbf     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
218 
219  Void codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx );
220 
221  Void codeIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx );
222  Void codeInterDir      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
223  Void codeRefFrmIdx     ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
224  Void codeMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
225 
226  Void codeDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
227
228  Void codeViewIdx       ( Int iViewIdx );
229#if CAVLC_RQT_CBP
230  Void codeCbfTrdiv      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
231  UInt xGetFlagPattern   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
232#endif
233  Void codeCbf           ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth );
234  Void codeBlockCbf      ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiQPartNum, Bool bRD = false);
235 
236  Void codeCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType, Bool bRD = false );
237
238#ifdef WEIGHT_PRED
239  Void codeWeightPredTable( TComSlice* pcSlice );
240#endif
241 
242  Void estBit             (estBitsSbacStruct* pcEstBitsSbac, UInt uiCTXIdx, TextType eTType);
243 
244  Bool  getAdaptFlag          ()          { return m_bAdaptFlag; }
245  Void  setAdaptFlag          ( Bool b )  { m_bAdaptFlag = b;     }
246};
247
248#endif // !defined(AFX_TENCCAVLC_H__EE8A0B30_945B_4169_B290_24D3AD52296F__INCLUDED_)
249
Note: See TracBrowser for help on using the repository browser.