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

Last change on this file since 72 was 56, checked in by hschwarz, 13 years ago

updated trunk (move to HM6.1)

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