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

Last change on this file since 95 was 77, checked in by tech, 13 years ago

Merged with branch/HTM-3.0Samsung REV74 including:

  • restricted residual prediction m24766
  • Inter-view residual prediction m24938
  • VPS concept m24714,m24878, m24945,m24896, m2491
  • reference list modification, restriction on IDR m24876, m24874
  • depth based motion parameter prediction m24829

Fixed bugs:

  • interview prediction
  • VSO

Added:

  • xcode project
  • Property svn:eol-style set to native
File size: 10.8 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#if OL_FLUSH
77  Void decodeFlush();
78#endif
79
80#if CABAC_INIT_FLAG
81  Void  resetEntropy (TComSlice* pSlice );
82#else
83  Void  resetEntropywithQPandInitIDC ( Int  iQp, Int iID);
84  Void  resetEntropy                 ( Int  iQp, Int iID      ) { resetEntropywithQPandInitIDC(iQp, iID);                                      }
85  Void  resetEntropy                 ( TComSlice* pcSlice     ) { resetEntropywithQPandInitIDC(pcSlice->getSliceQp(), pcSlice->getCABACinitIDC());}
86#endif
87  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
88 
89#if VIDYO_VPS_INTEGRATION
90  Void  parseVPS                  ( TComVPS* pcVPS )  {}
91#endif
92#if HHI_MPI
93  Void  parseSPS                  ( TComSPS* pcSPS, Bool bIsDepth ) {}
94#else
95  Void  parseSPS                  ( TComSPS* pcSPS         ) {}
96#endif
97#if TILES_OR_ENTROPY_SYNC_IDC 
98  Void  parsePPS                  ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet         ) {}
99#else
100  Void  parsePPS                  ( TComPPS* pcPPS         ) {}
101#endif
102  Void  parseAPS                  ( TComAPS* pAPS          ) {}
103  void parseSEI(SEImessages&) {}
104
105#if LCU_SYNTAX_ALF
106  Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) {}
107#else
108  Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl ) {}
109#endif
110
111  Void  parseTerminatingBit       ( UInt& ruiBit );
112#if HHI_INTER_VIEW_MOTION_PRED
113  Void  parseMVPIdx               ( Int& riMVPIdx, Int iNumAMVPCands );
114#else
115  Void  parseMVPIdx               ( Int& riMVPIdx          );
116#endif
117 
118#if SAO_UNIT_INTERLEAVING
119  Void  parseSaoUvlc              ( UInt& ruiVal           );
120  Void  parseSaoSvlc              ( Int&  riVal            );
121  Void  parseSaoMergeLeft         ( UInt&  ruiVal, UInt uiCompIdx   );
122  Void  parseSaoMergeUp           ( UInt&  ruiVal  );
123  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
124  Void  parseSaoUflc              ( UInt& ruiVal           );
125  Void  parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag);
126  Void  parseSaoOffset            (SaoLcuParam* psSaoLcuParam);
127#endif
128private:
129  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
130  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
131  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
132  Void  xReadGoRiceExGolomb ( UInt &ruiSymbol, UInt &ruiGoRiceParam );
133#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
134  Void  xReadExGolombLevel  ( UInt& ruiSymbol, ContextModel& rcSCModel  );
135#endif
136#if HHI_DMM_WEDGE_INTRA
137  Void xParseWedgeFullInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
138  Void xParseWedgeFullDeltaInfo     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
139
140  Void xParseWedgePredDirInfo       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
141  Void xParseWedgePredDirDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
142#endif
143#if HHI_DMM_PRED_TEX
144  Void xParseWedgePredTexDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
145  Void xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
146#endif
147 
148private:
149  TComInputBitstream* m_pcBitstream;
150  TDecBinIf*        m_pcTDecBinIf;
151 
152  Int           m_iSliceGranularity; //!< slice granularity
153
154public:
155  Void parseAlfCtrlFlag   ( UInt &ruiAlfCtrlFlag );
156
157  /// set slice granularity
158  Void setSliceGranularity(Int iSliceGranularity)  {m_iSliceGranularity = iSliceGranularity;}
159
160  /// get slice granularity
161  Int  getSliceGranularity()                       {return m_iSliceGranularity;             }
162
163  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
164  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
165  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
166  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
167#if HHI_INTER_VIEW_RESIDUAL_PRED
168  Void parseResPredFlag   ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth );
169#endif
170  Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
171  Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
172 
173  Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
174 
175  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
176 
177  Void parseInterDir      ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth );
178  Void parseRefFrmIdx     ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList );
179  Void parseMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList );
180 
181  Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
182  Void parseQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth );
183  Void parseQtRootCbf     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf );
184 
185  Void parseDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
186 
187  Void parseIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
188
189  Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx );
190  Void parseCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
191 
192  Void readTileMarker   ( UInt& uiTileIdx, UInt uiBitsUsed );
193  Void updateContextTables( SliceType eSliceType, Int iQp );
194
195  Void  parseScalingList ( TComScalingList* scalingList ) {}
196
197private:
198  UInt m_uiLastDQpNonZero;
199  UInt m_uiLastQp;
200 
201  ContextModel         m_contextModels[MAX_NUM_CTX_MOD];
202  Int                  m_numContextModels;
203  ContextModel3DBuffer m_cCUSplitFlagSCModel;
204  ContextModel3DBuffer m_cCUSkipFlagSCModel;
205  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
206  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
207#if HHI_INTER_VIEW_RESIDUAL_PRED
208  ContextModel3DBuffer m_cResPredFlagSCModel;
209#endif
210  ContextModel3DBuffer m_cCUPartSizeSCModel;
211  ContextModel3DBuffer m_cCUPredModeSCModel;
212  ContextModel3DBuffer m_cCUAlfCtrlFlagSCModel;
213  ContextModel3DBuffer m_cCUIntraPredSCModel;
214  ContextModel3DBuffer m_cCUChromaPredSCModel;
215  ContextModel3DBuffer m_cCUDeltaQpSCModel;
216  ContextModel3DBuffer m_cCUInterDirSCModel;
217  ContextModel3DBuffer m_cCURefPicSCModel;
218  ContextModel3DBuffer m_cCUMvdSCModel;
219  ContextModel3DBuffer m_cCUQtCbfSCModel;
220  ContextModel3DBuffer m_cCUTransSubdivFlagSCModel;
221  ContextModel3DBuffer m_cCUQtRootCbfSCModel;
222 
223  ContextModel3DBuffer m_cCUSigCoeffGroupSCModel;
224  ContextModel3DBuffer m_cCUSigSCModel;
225  ContextModel3DBuffer m_cCuCtxLastX;
226  ContextModel3DBuffer m_cCuCtxLastY;
227  ContextModel3DBuffer m_cCUOneSCModel;
228  ContextModel3DBuffer m_cCUAbsSCModel;
229 
230  ContextModel3DBuffer m_cMVPIdxSCModel;
231 
232  ContextModel3DBuffer m_cALFFlagSCModel;
233  ContextModel3DBuffer m_cALFUvlcSCModel;
234  ContextModel3DBuffer m_cALFSvlcSCModel;
235#if AMP_CTX
236  ContextModel3DBuffer m_cCUAMPSCModel;
237#else
238  ContextModel3DBuffer m_cCUXPosiSCModel;
239  ContextModel3DBuffer m_cCUYPosiSCModel;
240#endif
241  ContextModel3DBuffer m_cSaoFlagSCModel;
242  ContextModel3DBuffer m_cSaoUvlcSCModel;
243  ContextModel3DBuffer m_cSaoSvlcSCModel;
244#if SAO_UNIT_INTERLEAVING
245  ContextModel3DBuffer m_cSaoMergeLeftSCModel;
246  ContextModel3DBuffer m_cSaoMergeUpSCModel;
247  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
248#endif
249
250#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
251  ContextModel3DBuffer m_cDmmFlagSCModel;
252  ContextModel3DBuffer m_cDmmModeSCModel;
253  ContextModel3DBuffer m_cDmmDataSCModel;
254#endif
255};
256
257//! \}
258
259#endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_)
Note: See TracBrowser for help on using the repository browser.