source: 3DVCSoftware/branches/0.3-ericsson/source/Lib/TLibDecoder/TDecSbac.h @ 36

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

Clean version with cfg-files

  • Property svn:eol-style set to native
File size: 10.0 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     TDecSbac.h
37    \brief    SBAC decoder class (header)
38*/
39
40#ifndef __TDECSBAC__
41#define __TDECSBAC__
42
43
44#if _MSC_VER > 1000
45#pragma once
46#endif // _MSC_VER > 1000
47
48
49#include "TDecEntropy.h"
50#include "TDecBinCoder.h"
51#include "../TLibCommon/ContextTables.h"
52#include "../TLibCommon/ContextModel.h"
53#include "../TLibCommon/ContextModel3DBuffer.h"
54
55// ====================================================================================================================
56// Class definition
57// ====================================================================================================================
58
59class SEImessages;
60
61/// SBAC decoder class
62class TDecSbac : public TDecEntropyIf
63{
64public:
65  TDecSbac();
66  virtual ~TDecSbac();
67 
68  Void  init                      ( TDecBinIf* p )    { m_pcTDecBinIf = p; }
69  Void  uninit                    (              )    { m_pcTDecBinIf = 0; }
70 
71  Void  resetEntropy              ( TComSlice* pcSlice     );
72  Void  setBitstream              ( TComBitstream* p       ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
73 
74  Void  setAlfCtrl                ( Bool bAlfCtrl          ) { m_bAlfCtrl = bAlfCtrl;                   }
75  Void  setMaxAlfCtrlDepth        ( UInt uiMaxAlfCtrlDepth ) { m_uiMaxAlfCtrlDepth = uiMaxAlfCtrlDepth; }
76 
77  Void  parseNalUnitHeader    ( NalUnitType& eNalUnitType, UInt& TemporalId, Bool& bOutputFlag ) {}
78 
79  Void  parseSPS                  ( TComSPS* pcSPS         ) {}
80  Void  parsePPS                  ( TComPPS* pcPPS         ) {}
81  void parseSEI(SEImessages&) {}
82  Void  parseSliceHeader          ( TComSlice*& rpcSlice   ) {}
83  Void  parseTerminatingBit       ( UInt& ruiBit );
84  Void  parseMVPIdx               ( TComDataCU* pcCU, Int& riMVPIdx, Int iMVPNum, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList );
85 
86  Void  parseAlfFlag              ( UInt& ruiVal           );
87  Void  parseAlfUvlc              ( UInt& ruiVal           );
88  Void  parseAlfSvlc              ( Int&  riVal            );
89  Void  parseAlfCtrlDepth         ( UInt& ruiAlfCtrlDepth  );
90#if MTK_SAO
91  Void  parseAoFlag              ( UInt& ruiVal           );
92  Void  parseAoUvlc              ( UInt& ruiVal           );
93  Void  parseAoSvlc              ( Int&  riVal            );
94#endif
95private:
96  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
97  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
98  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
99#if E253
100  Void  xReadGoRiceExGolomb ( UInt &ruiSymbol, UInt &ruiGoRiceParam );
101#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
102  Void  xReadExGolombLevel  ( UInt& ruiSymbol, ContextModel& rcSCModel  );
103#endif
104#else
105  Void  xReadExGolombLevel  ( UInt& ruiSymbol, ContextModel& rcSCModel  );
106#endif
107 
108#if MVD_CTX
109  Void  xReadMvd            ( Int& riMvdComp, UInt uiAbsSumL, UInt uiAbsSumA, UInt uiCtx );
110#else
111  Void  xReadMvd            ( Int& riMvdComp, UInt uiAbsSum, UInt uiCtx );
112#endif
113
114  Void  xReadExGolombMvd    ( UInt& ruiSymbol, ContextModel* pcSCModel, UInt uiMaxBin );
115 
116#if HHI_DMM_WEDGE_INTRA
117  Void xParseWedgeFullInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
118  Void xParseWedgeFullDeltaInfo     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
119
120  Void xParseWedgePredDirInfo       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
121  Void xParseWedgePredDirDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
122#endif
123#if HHI_DMM_PRED_TEX
124  Void xParseWedgePredTexDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
125  Void xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
126#endif
127 
128private:
129  TComBitstream*    m_pcBitstream;
130  TDecBinIf*        m_pcTDecBinIf;
131 
132  Bool m_bAlfCtrl;
133  UInt m_uiMaxAlfCtrlDepth;
134 
135public:
136  Void parseAlfCtrlFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
137#if TSB_ALF_HEADER
138  Void parseAlfFlagNum    ( UInt& ruiVal, UInt minValue, UInt depth );
139  Void parseAlfCtrlFlag   ( UInt &ruiAlfCtrlFlag );
140#endif
141 
142  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
143  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
144  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
145  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
146#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
147  Void parseMergeIndexMV  ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
148#endif
149  Void parseResPredFlag   ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth );
150  Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
151  Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
152 
153  Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
154 
155  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
156 
157  Void parseInterDir      ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth );
158  Void parseRefFrmIdx     ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList );
159  Void parseMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList );
160 
161  Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
162  Void parseQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth );
163  Void parseQtRootCbf     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf );
164 
165  Void parseDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
166 
167  Void parseCbf           ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ) {}
168  Void parseBlockCbf      ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth, UInt uiQPartNum ) {}
169 
170#if CAVLC_RQT_CBP
171  Void parseCbfTrdiv      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiTrDepth, UInt uiDepth, UInt& uiSubdiv ) {}
172#endif
173
174#if PCP_SIGMAP_SIMPLE_LAST
175  __inline Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, const UInt uiWidth, const TextType eTType, const UInt uiCTXIdx, const UInt uiScanIdx );
176#endif
177  Void parseCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
178  Void parseViewIdx       (Int &riViewIdx );
179 
180private:
181  UInt m_uiLastDQpNonZero;
182  UInt m_uiLastQp;
183 
184  ContextModel3DBuffer m_cCUSkipFlagSCModel;
185  ContextModel3DBuffer m_cCUSplitFlagSCModel;
186  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
187  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
188  ContextModel3DBuffer m_cCUMVMergeIdxExtSCModel;
189  ContextModel3DBuffer m_cResPredFlagSCModel;
190  ContextModel3DBuffer m_cCUAlfCtrlFlagSCModel;
191  ContextModel3DBuffer m_cCUPartSizeSCModel;
192  ContextModel3DBuffer m_cCUPredModeSCModel;
193 
194  ContextModel3DBuffer m_cCUIntraPredSCModel;
195#if ADD_PLANAR_MODE
196  ContextModel3DBuffer m_cPlanarFlagSCModel;
197#endif
198  ContextModel3DBuffer m_cCUChromaPredSCModel;
199  ContextModel3DBuffer m_cCUInterDirSCModel;
200  ContextModel3DBuffer m_cCURefPicSCModel;
201  ContextModel3DBuffer m_cCUMvdSCModel;
202 
203  ContextModel3DBuffer m_cCUTransSubdivFlagSCModel;
204  ContextModel3DBuffer m_cCUQtRootCbfSCModel;
205  ContextModel3DBuffer m_cCUDeltaQpSCModel;
206 
207  ContextModel3DBuffer m_cCUQtCbfSCModel;
208 
209  ContextModel3DBuffer m_cCUSigSCModel;
210#if PCP_SIGMAP_SIMPLE_LAST
211  ContextModel3DBuffer m_cCuCtxLastX;
212  ContextModel3DBuffer m_cCuCtxLastY;
213#else 
214  ContextModel3DBuffer m_cCULastSCModel;
215#endif
216  ContextModel3DBuffer m_cCUOneSCModel;
217  ContextModel3DBuffer m_cCUAbsSCModel;
218 
219  ContextModel3DBuffer m_cMVPIdxSCModel;
220 
221  ContextModel3DBuffer m_cALFFlagSCModel;
222  ContextModel3DBuffer m_cALFUvlcSCModel;
223  ContextModel3DBuffer m_cALFSvlcSCModel;
224#if MTK_SAO
225  ContextModel3DBuffer m_cAOFlagSCModel;
226  ContextModel3DBuffer m_cAOUvlcSCModel;
227  ContextModel3DBuffer m_cAOSvlcSCModel;
228#endif
229  ContextModel3DBuffer m_cViewIdxSCModel;
230#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
231  ContextModel3DBuffer m_cIntraDMMSCModel;
232  ContextModel3DBuffer m_cIntraWedgeSCModel;
233#endif
234};
235
236#endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_)
Note: See TracBrowser for help on using the repository browser.