source: 3DVCSoftware/trunk/source/Lib/TLibDecoder/TDecCAVLC.h @ 5

Last change on this file since 5 was 5, checked in by hhi, 12 years ago

Clean version with cfg-files

  • Property svn:eol-style set to native
File size: 9.6 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license.
5 *
6 * Copyright (c) 2010-2011, ISO/IEC
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 *  * Redistributions of source code must retain the above copyright notice,
13 *    this list of conditions and the following disclaimer.
14 *  * Redistributions in binary form must reproduce the above copyright notice,
15 *    this list of conditions and the following disclaimer in the documentation
16 *    and/or other materials provided with the distribution.
17 *  * Neither the name of the ISO/IEC nor the names of its contributors may
18 *    be used to endorse or promote products derived from this software without
19 *    specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31 * THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34
35
36/** \file     TDecCAVLC.h
37    \brief    CAVLC decoder class (header)
38*/
39
40#ifndef __TDECCAVLC__
41#define __TDECCAVLC__
42
43#if _MSC_VER > 1000
44#pragma once
45#endif // _MSC_VER > 1000
46
47#include "TDecEntropy.h"
48
49// ====================================================================================================================
50// Class definition
51// ====================================================================================================================
52
53class SEImessages;
54
55/// CAVLC decoder class
56class TDecCavlc : public TDecEntropyIf
57{
58public:
59  TDecCavlc();
60  virtual ~TDecCavlc();
61 
62protected:
63  Void  xReadCode             (UInt uiLength, UInt& ruiCode);
64  Void  xReadUvlc             (UInt& ruiVal);
65  Void  xReadSvlc             (Int& riVal);
66  Void  xReadFlag             (UInt& ruiCode);
67  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
68  Void  xReadExGolombLevel  ( UInt& ruiSymbol );
69  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, UInt uiMaxSymbol );
70 
71  UInt  xGetBit             ();
72  Int   xReadVlc            ( Int n );
73#if CAVLC_COEF_LRG_BLK
74  Void  xParseCoeff         ( TCoeff* scoeff, Int iTableNumber, Int blSize);
75#else
76  Void  xParseCoeff4x4      ( TCoeff* scoeff, Int iTableNumber );
77  Void  xParseCoeff8x8      ( TCoeff* scoeff, Int iTableNumber );
78#endif
79#if QC_MOD_LCEC
80  Void  xRunLevelIndInv     (LastCoeffStruct *combo, Int maxrun, UInt lrg1Pos, UInt cn);
81#if RUNLEVEL_TABLE_CUT
82  Void  xRunLevelIndInterInv(LastCoeffStruct *combo, Int maxrun, UInt cn);
83#endif
84#endif
85 
86private:
87  TComBitstream*        m_pcBitstream;
88  UInt                  m_uiCoeffCost;
89  Bool                  m_bRunLengthCoding;
90  UInt                  m_uiRun;
91  Bool m_bAlfCtrl;
92  UInt m_uiMaxAlfCtrlDepth;
93  UInt                      m_uiLPTableD4[3][32];
94#if !CAVLC_COEF_LRG_BLK
95  UInt                      m_uiLPTableD8[10][128];
96#endif
97  UInt                      m_uiLastPosVlcIndex[10];
98 
99#if LCEC_INTRA_MODE
100#if MTK_DCM_MPM
101  UInt                      m_uiIntraModeTableD17[2][16];
102  UInt                      m_uiIntraModeTableD34[2][33];
103#else
104  UInt                      m_uiIntraModeTableD17[16];
105  UInt                      m_uiIntraModeTableD34[33];
106#endif
107#endif
108#if QC_LCEC_INTER_MODE
109  UInt                      m_uiSplitTableD[4][7];
110#endif
111#if CAVLC_RQT_CBP
112  UInt                      m_uiCBP_YUV_TableD[4][8];
113  UInt                      m_uiCBP_YS_TableD[2][4];
114  UInt                      m_uiCBP_YCS_TableD[2][8];
115  UInt                      m_uiCBP_4Y_TableD[2][15];
116  UInt                      m_uiCBP_4Y_VlcIdx;
117#else
118  UInt                      m_uiBlkCBPTableD[2][15];
119  UInt                      m_uiCBPTableD[2][8];
120  UInt                      m_uiCbpVlcIdx[2];
121  UInt                      m_uiBlkCbpVlcIdx;
122#endif
123
124
125 
126  Int                   m_iRefFrame0[1000];
127  Int                   m_iRefFrame1[1000];
128  Bool                  m_bMVres0[1000];
129  Bool                  m_bMVres1[1000];
130#if MS_LCEC_LOOKUP_TABLE_EXCEPTION
131  UInt                  m_uiMI1TableD[9];
132#else
133  UInt                  m_uiMI1TableD[8];
134#endif
135  UInt                  m_uiMI2TableD[15]; 
136  UInt                  m_uiMITableVlcIdx;
137
138#if CAVLC_COUNTER_ADAPT
139#if CAVLC_RQT_CBP
140  UChar         m_ucCBP_YUV_TableCounter[4][4];
141  UChar         m_ucCBP_4Y_TableCounter[2][2];
142  UChar         m_ucCBP_YS_TableCounter[2][3];
143  UChar         m_ucCBP_YCS_TableCounter[2][4];
144  UChar         m_ucCBP_YUV_TableCounterSum[4];
145  UChar         m_ucCBP_4Y_TableCounterSum[2];
146  UChar         m_ucCBP_YS_TableCounterSum[2];
147  UChar         m_ucCBP_YCS_TableCounterSum[2];
148#else
149  UChar         m_ucCBFTableCounter    [2][4];
150  UChar         m_ucBlkCBPTableCounter [2][2];
151  UChar         m_ucCBFTableCounterSum[2];
152  UChar         m_ucBlkCBPTableCounterSum[2];
153#endif
154
155  UChar         m_ucMI1TableCounter[4];
156  UChar         m_ucSplitTableCounter[4][4];
157  UChar         m_ucSplitTableCounterSum[4];
158  UChar         m_ucMI1TableCounterSum;
159#endif
160
161  Int**    m_aaiTempScale;
162  Int**    m_aaiTempOffset;
163  Int**    m_aaiTempPdmScaleNomDelta;
164  Int**    m_aaiTempPdmOffset;
165 
166public:
167  Void  resetEntropy        ( TComSlice* pcSlice  );
168  Void  setBitstream        ( TComBitstream* p    )      { m_pcBitstream = p; }
169  Void  setAlfCtrl          ( Bool bAlfCtrl )            { m_bAlfCtrl = bAlfCtrl; }
170  Void  setMaxAlfCtrlDepth  ( UInt uiMaxAlfCtrlDepth )  { m_uiMaxAlfCtrlDepth = uiMaxAlfCtrlDepth; }
171 
172  Void  parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
173  Void  parseQtCbf          ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth );
174  Void  parseQtRootCbf      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf );
175  Void  parseAlfFlag        ( UInt& ruiVal );
176  Void  parseAlfUvlc        ( UInt& ruiVal );
177  Void  parseAlfSvlc        ( Int&  riVal  );
178#if MTK_SAO
179  Void  parseAoFlag        ( UInt& ruiVal );
180  Void  parseAoUvlc        ( UInt& ruiVal );
181  Void  parseAoSvlc        ( Int&  riVal  );
182#endif
183 
184  Void  parseNalUnitHeader  ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag );
185 
186  Void  parseSPS            ( TComSPS* pcSPS );
187  Void  parsePPS            ( TComPPS* pcPPS);
188  void parseSEI(SEImessages&);
189  Void  parseSliceHeader    ( TComSlice*& rpcSlice );
190  Void  parseTerminatingBit ( UInt& ruiBit );
191 
192  Void  parseMVPIdx         ( TComDataCU* pcCU, Int& riMVPIdx, Int iMVPNum, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList );
193 
194  Void  parseSkipFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
195  Void parseMergeFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
196  Void parseMergeIndex      ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
197#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
198  Void parseMergeIndexMV    ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
199#endif
200  Void parseResPredFlag     ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth );
201  Void parseSplitFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
202  Void parsePartSize        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
203  Void parsePredMode        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
204 
205  Void parseIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
206 
207  Void parseIntraDirChroma  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
208 
209  Void parseInterDir        ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth );
210  Void parseRefFrmIdx       ( TComDataCU* pcCU, Int& riRefFrmIdx,  UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList );
211  Void parseMvd             ( TComDataCU* pcCU, UInt uiAbsPartAddr,UInt uiPartIdx,    UInt uiDepth, RefPicList eRefList );
212 
213  Void parseDeltaQP         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
214#if CAVLC_RQT_CBP
215  Void parseCbfTrdiv        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiTrDepth, UInt uiDepth, UInt& uiSubdiv );
216  UInt xGetFlagPattern      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth,  UInt& uiSubdiv );
217#endif
218  Void parseCbf             ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth );
219  Void parseBlockCbf        ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth, UInt uiQPartNum );
220  Void parseCoeffNxN        ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
221 
222  Void parseAlfCtrlDepth    ( UInt& ruiAlfCtrlDepth );
223  Void parseAlfCtrlFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
224#if TSB_ALF_HEADER
225  Void parseAlfFlagNum      ( UInt& ruiVal, UInt minValue, UInt depth );
226  Void parseAlfCtrlFlag     ( UInt &ruiAlfCtrlFlag );
227#endif
228
229#ifdef WEIGHT_PRED
230  Void parseWeightPredTable ( TComSlice* pcSlice );
231#endif
232
233  Void parseViewIdx         (Int& riViewIdx) ;
234};
235#endif // !defined(AFX_TDECCAVLC_H__9732DD64_59B0_4A41_B29E_1A5B18821EAD__INCLUDED_)
236
Note: See TracBrowser for help on using the repository browser.