source: 3DVCSoftware/trunk/source/Lib/TLibDecoder/TDecSbac.h @ 443

Last change on this file since 443 was 443, checked in by tech, 11 years ago
  • Reintegrated branch 6.2-dev0 rev. 442.
  • Changed version number.
  • Added coding results.
  • Property svn:eol-style set to native
File size: 12.9 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-2012, ITU/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 ITU/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/** \file     TDecSbac.h
35    \brief    SBAC decoder class (header)
36*/
37
38#ifndef __TDECSBAC__
39#define __TDECSBAC__
40
41
42#if _MSC_VER > 1000
43#pragma once
44#endif // _MSC_VER > 1000
45
46
47#include "TDecEntropy.h"
48#include "TDecBinCoder.h"
49#include "TLibCommon/ContextTables.h"
50#include "TLibCommon/ContextModel.h"
51#include "TLibCommon/ContextModel3DBuffer.h"
52
53//! \ingroup TLibDecoder
54//! \{
55
56// ====================================================================================================================
57// Class definition
58// ====================================================================================================================
59
60class SEImessages;
61
62/// SBAC decoder class
63class TDecSbac : public TDecEntropyIf
64{
65public:
66  TDecSbac();
67  virtual ~TDecSbac();
68 
69  Void  init                      ( TDecBinIf* p )    { m_pcTDecBinIf = p; }
70  Void  uninit                    (              )    { m_pcTDecBinIf = 0; }
71 
72  Void load                          ( TDecSbac* pScr );
73  Void loadContexts                  ( TDecSbac* pScr );
74  Void xCopyFrom           ( TDecSbac* pSrc );
75  Void xCopyContextsFrom       ( TDecSbac* pSrc );
76  Void decodeFlush();
77
78#if CABAC_INIT_FLAG
79  Void  resetEntropy (TComSlice* pSlice );
80#else
81  Void  resetEntropywithQPandInitIDC ( Int  iQp, Int iID);
82  Void  resetEntropy                 ( Int  iQp, Int iID      ) { resetEntropywithQPandInitIDC(iQp, iID);                                      }
83  Void  resetEntropy                 ( TComSlice* pcSlice     ) { resetEntropywithQPandInitIDC(pcSlice->getSliceQp(), pcSlice->getCABACinitIDC());}
84#endif
85  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
86 
87#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
88  Void  parseVPS                  ( TComVPS* pcVPS )  {}
89#endif
90#if HHI_MPI || H3D_QTL
91  Void  parseSPS                  ( TComSPS* pcSPS, Bool bIsDepth ) {}
92#else
93  Void  parseSPS                  ( TComSPS* pcSPS         ) {}
94#endif
95  Void  parsePPS                  ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet         ) {}
96  Void  parseAPS                  ( TComAPS* pAPS          ) {}
97  void parseSEI(SEImessages&) {}
98
99#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
100  Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) {}
101#else
102  Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) {}
103#endif
104
105  Void  parseTerminatingBit       ( UInt& ruiBit );
106#if H3D_IVMP
107  Void  parseMVPIdx               ( Int& riMVPIdx, Int iNumAMVPCands );
108#else
109  Void  parseMVPIdx               ( Int& riMVPIdx          );
110#endif
111 
112#if LGE_SAO_MIGRATION_D0091
113  Void  parseSaoMaxUvlc           ( UInt& val, UInt maxSymbol );
114  Void  parseSaoMerge             ( UInt&  ruiVal   );
115  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
116  Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
117  Void  parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp);
118  Void  parseSaoOffset            (SaoLcuParam* psSaoLcuParam, UInt compIdx);
119#else
120  Void  parseSaoUvlc              ( UInt& ruiVal           );
121  Void  parseSaoSvlc              ( Int&  riVal            );
122  Void  parseSaoMergeLeft         ( UInt&  ruiVal, UInt uiCompIdx   );
123  Void  parseSaoMergeUp           ( UInt&  ruiVal  );
124  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
125  Void  parseSaoUflc              ( UInt& ruiVal           );
126  Void  parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag);
127  Void  parseSaoOffset            (SaoLcuParam* psSaoLcuParam);
128#endif
129 
130#if RWTH_SDC_DLT_B0036
131#if !PKU_QC_DEPTH_INTRA_UNI_D0195
132  Void parseSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
133  Void parseSDCPredMode    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
134#endif
135  Void parseSDCResidualData     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
136#endif
137private:
138  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
139  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
140  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
141  Void  xReadGoRiceExGolomb ( UInt &ruiSymbol, UInt &ruiGoRiceParam );
142#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
143  Void  xReadExGolombLevel  ( UInt& ruiSymbol, ContextModel& rcSCModel  );
144#endif
145#if HHI_DMM_WEDGE_INTRA
146  Void xParseWedgeFullInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
147  Void xParseWedgeFullDeltaInfo     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
148
149  Void xParseWedgePredDirInfo       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
150  Void xParseWedgePredDirDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
151#endif
152#if HHI_DMM_PRED_TEX
153#if LGE_DMM3_SIMP_C0044
154  Void xParseWedgePredTexInfo       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
155#endif
156  Void xParseWedgePredTexDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
157  Void xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
158#endif
159 
160#if LGE_EDGE_INTRA_A0070
161  Void xParseEdgeIntraInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
162#endif
163 
164private:
165  TComInputBitstream* m_pcBitstream;
166  TDecBinIf*        m_pcTDecBinIf;
167 
168  Int           m_iSliceGranularity; //!< slice granularity
169
170public:
171  Void parseAlfCtrlFlag   ( UInt &ruiAlfCtrlFlag );
172
173  /// set slice granularity
174  Void setSliceGranularity(Int iSliceGranularity)  {m_iSliceGranularity = iSliceGranularity;}
175
176  /// get slice granularity
177  Int  getSliceGranularity()                       {return m_iSliceGranularity;             }
178
179  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
180#if LGE_ILLUCOMP_B0045
181  Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
182#endif
183  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
184  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
185  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
186#if H3D_IVRP
187  Void parseResPredFlag   ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth );
188#endif
189#if QC_ARP_D0177
190  Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
191#endif
192  Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
193  Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
194#if PKU_QC_DEPTH_INTRA_UNI_D0195
195  Void parseDepthIntraMode  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
196  Void parseDepthModelingTable( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
197#endif
198  Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
199 
200  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
201 
202  Void parseInterDir      ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth );
203  Void parseRefFrmIdx     ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList );
204  Void parseMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList );
205 
206  Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
207  Void parseQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth );
208  Void parseQtRootCbf     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf );
209 
210  Void parseDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
211 
212  Void parseIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
213
214  Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx );
215  Void parseCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
216 
217  Void readTileMarker   ( UInt& uiTileIdx, UInt uiBitsUsed );
218  Void updateContextTables( SliceType eSliceType, Int iQp );
219
220  Void  parseScalingList ( TComScalingList* scalingList ) {}
221
222private:
223  UInt m_uiLastDQpNonZero;
224  UInt m_uiLastQp;
225 
226  ContextModel         m_contextModels[MAX_NUM_CTX_MOD];
227  Int                  m_numContextModels;
228  ContextModel3DBuffer m_cCUSplitFlagSCModel;
229  ContextModel3DBuffer m_cCUSkipFlagSCModel;
230#if LGE_ILLUCOMP_B0045
231  ContextModel3DBuffer m_cCUICFlagSCModel;
232#endif
233  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
234  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
235#if H3D_IVRP
236  ContextModel3DBuffer m_cResPredFlagSCModel;
237#endif
238#if QC_ARP_D0177
239  ContextModel3DBuffer m_cCUPUARPW;
240#endif
241  ContextModel3DBuffer m_cCUPartSizeSCModel;
242  ContextModel3DBuffer m_cCUPredModeSCModel;
243  ContextModel3DBuffer m_cCUAlfCtrlFlagSCModel;
244  ContextModel3DBuffer m_cCUIntraPredSCModel;
245  ContextModel3DBuffer m_cCUChromaPredSCModel;
246  ContextModel3DBuffer m_cCUDeltaQpSCModel;
247  ContextModel3DBuffer m_cCUInterDirSCModel;
248  ContextModel3DBuffer m_cCURefPicSCModel;
249  ContextModel3DBuffer m_cCUMvdSCModel;
250  ContextModel3DBuffer m_cCUQtCbfSCModel;
251  ContextModel3DBuffer m_cCUTransSubdivFlagSCModel;
252  ContextModel3DBuffer m_cCUQtRootCbfSCModel;
253 
254  ContextModel3DBuffer m_cCUSigCoeffGroupSCModel;
255  ContextModel3DBuffer m_cCUSigSCModel;
256  ContextModel3DBuffer m_cCuCtxLastX;
257  ContextModel3DBuffer m_cCuCtxLastY;
258  ContextModel3DBuffer m_cCUOneSCModel;
259  ContextModel3DBuffer m_cCUAbsSCModel;
260 
261  ContextModel3DBuffer m_cMVPIdxSCModel;
262 
263  ContextModel3DBuffer m_cALFFlagSCModel;
264  ContextModel3DBuffer m_cALFUvlcSCModel;
265  ContextModel3DBuffer m_cALFSvlcSCModel;
266  ContextModel3DBuffer m_cCUAMPSCModel;
267#if LGE_SAO_MIGRATION_D0091
268  ContextModel3DBuffer m_cSaoMergeSCModel;
269  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
270#else
271  ContextModel3DBuffer m_cSaoFlagSCModel;
272  ContextModel3DBuffer m_cSaoUvlcSCModel;
273  ContextModel3DBuffer m_cSaoSvlcSCModel;
274  ContextModel3DBuffer m_cSaoMergeLeftSCModel;
275  ContextModel3DBuffer m_cSaoMergeUpSCModel;
276  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
277#endif
278
279#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
280#if !PKU_QC_DEPTH_INTRA_UNI_D0195
281  ContextModel3DBuffer m_cDmmFlagSCModel;
282  ContextModel3DBuffer m_cDmmModeSCModel;
283#endif
284  ContextModel3DBuffer m_cDmmDataSCModel;
285#endif
286#if LGE_EDGE_INTRA_A0070
287  ContextModel3DBuffer m_cEdgeIntraSCModel;
288#if LGE_EDGE_INTRA_DELTA_DC
289  ContextModel3DBuffer m_cEdgeIntraDeltaDCSCModel;
290#endif
291#endif
292 
293#if RWTH_SDC_DLT_B0036
294#if !PKU_QC_DEPTH_INTRA_UNI_D0195
295  ContextModel3DBuffer m_cSDCFlagSCModel;
296#else
297  ContextModel3DBuffer m_cDepthModeModel;
298  ContextModel3DBuffer m_cDmmDeltaFlagModel;
299#endif
300 
301  ContextModel3DBuffer m_cSDCResidualFlagSCModel;
302#if !RWTH_SDC_CTX_SIMPL_D0032
303  ContextModel3DBuffer m_cSDCResidualSignFlagSCModel;
304#endif
305  ContextModel3DBuffer m_cSDCResidualSCModel;
306 
307  ContextModel3DBuffer m_cSDCPredModeSCModel;
308#endif
309};
310
311//! \}
312
313#endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_)
Note: See TracBrowser for help on using the repository browser.