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

Last change on this file since 1003 was 976, checked in by tech, 11 years ago
  • Merged 11.1-dev0@975. (Clean ups)
  • Added coding results.
  • Changed version number.
  • Property svn:eol-style set to native
File size: 9.5 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 *
[872]6* Copyright (c) 2010-2014, 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
60/// SBAC decoder class
61class TDecSbac : public TDecEntropyIf
62{
63public:
64  TDecSbac();
65  virtual ~TDecSbac();
66 
67  Void  init                      ( TDecBinIf* p )    { m_pcTDecBinIf = p; }
68  Void  uninit                    (              )    { m_pcTDecBinIf = 0; }
69 
[56]70  Void load                          ( TDecSbac* pScr );
71  Void loadContexts                  ( TDecSbac* pScr );
72  Void xCopyFrom           ( TDecSbac* pSrc );
73  Void xCopyContextsFrom       ( TDecSbac* pSrc );
74
75  Void  resetEntropy (TComSlice* pSlice );
76  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
[608]77  Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
78#if H_3D
79  Void  parseSPS                  ( TComSPS* /*pcSPS*/ , Int /*viewIndex*/, Bool /*depthFlag*/ ) {}
[56]80#else
[608]81  Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
[56]82#endif
[773]83#if H_3D
[758]84  Void  parsePPS                  ( TComPPS* /*pcPPS*/, TComVPS* /*pcVPS*/ ) {}
85#else
[608]86  Void  parsePPS                  ( TComPPS* /*pcPPS*/ ) {}
[758]87#endif
[56]88
[976]89#if H_MV
[964]90  Void  parseSliceHeader          ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/, Int targetOlsIdx ) {}
91#else
[976]92  Void  parseSliceHeader          ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/ ) {}
[964]93#endif
[2]94  Void  parseTerminatingBit       ( UInt& ruiBit );
[56]95  Void  parseMVPIdx               ( Int& riMVPIdx          );
[443]96  Void  parseSaoMaxUvlc           ( UInt& val, UInt maxSymbol );
[608]97  Void  parseSaoMerge         ( UInt&  ruiVal   );
[443]98  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
99  Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
[872]100  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail);
101  Void parseSaoSign(UInt& val);
[2]102private:
103  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
104  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
105  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
[608]106  Void  xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam );
107#if H_3D_DIM
108  Void  xReadExGolombLevel   ( UInt& ruiSymbol, ContextModel& rcSCModel  );
[724]109  Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt uiNumSeg );
[608]110#if H_3D_DIM_DMM
111  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
[5]112#endif
[608]113#if H_3D_DIM_SDC
114  Void  xParseSDCResidualData     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
[2]115#endif
[100]116#endif
[655]117#if H_3D_INTER_SDC
[833]118  Void  parseDeltaDC         ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
119  Void  parseSDCFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
[608]120#endif
[833]121#if H_3D_DBBP
122  Void parseDBBPFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
123#endif
[2]124private:
[56]125  TComInputBitstream* m_pcBitstream;
[2]126  TDecBinIf*        m_pcTDecBinIf;
[608]127 
128public:
[2]129 
130  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
[608]131  Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
[2]132  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
133  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
[608]134  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex );
135#if H_3D_ARP
[443]136  Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
137#endif
[608]138#if H_3D_IC
139  Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
140#endif
[2]141  Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
142  Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
[608]143 
[2]144  Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
145 
146  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
147 
[608]148#if H_3D_DIM
149  Void parseIntraDepth     ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
150  Void parseIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
151#endif
152
153  Void parseInterDir      ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx );
154  Void parseRefFrmIdx     ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList );
[2]155  Void parseMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList );
156 
157  Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
158  Void parseQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth );
[608]159  Void parseQtRootCbf     ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
[2]160 
161  Void parseDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
162 
[56]163  Void parseIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
[2]164
[56]165  Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx );
[2]166  Void parseCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
[608]167  Void parseTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType);
168
[56]169  Void updateContextTables( SliceType eSliceType, Int iQp );
170
[608]171  Void  parseScalingList ( TComScalingList* /*scalingList*/ ) {}
[56]172
[2]173private:
174  UInt m_uiLastDQpNonZero;
175  UInt m_uiLastQp;
176 
[56]177  ContextModel         m_contextModels[MAX_NUM_CTX_MOD];
178  Int                  m_numContextModels;
179  ContextModel3DBuffer m_cCUSplitFlagSCModel;
[2]180  ContextModel3DBuffer m_cCUSkipFlagSCModel;
181  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
182  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
[608]183#if H_3D_ARP
184  ContextModel3DBuffer m_cCUPUARPWSCModel;
[56]185#endif
[608]186#if H_3D_IC
187  ContextModel3DBuffer m_cCUICFlagSCModel;
[443]188#endif
[2]189  ContextModel3DBuffer m_cCUPartSizeSCModel;
190  ContextModel3DBuffer m_cCUPredModeSCModel;
191  ContextModel3DBuffer m_cCUIntraPredSCModel;
192  ContextModel3DBuffer m_cCUChromaPredSCModel;
[56]193  ContextModel3DBuffer m_cCUDeltaQpSCModel;
[2]194  ContextModel3DBuffer m_cCUInterDirSCModel;
195  ContextModel3DBuffer m_cCURefPicSCModel;
196  ContextModel3DBuffer m_cCUMvdSCModel;
[56]197  ContextModel3DBuffer m_cCUQtCbfSCModel;
[2]198  ContextModel3DBuffer m_cCUTransSubdivFlagSCModel;
199  ContextModel3DBuffer m_cCUQtRootCbfSCModel;
200 
[56]201  ContextModel3DBuffer m_cCUSigCoeffGroupSCModel;
[2]202  ContextModel3DBuffer m_cCUSigSCModel;
203  ContextModel3DBuffer m_cCuCtxLastX;
204  ContextModel3DBuffer m_cCuCtxLastY;
205  ContextModel3DBuffer m_cCUOneSCModel;
206  ContextModel3DBuffer m_cCUAbsSCModel;
207 
208  ContextModel3DBuffer m_cMVPIdxSCModel;
209 
[443]210  ContextModel3DBuffer m_cSaoMergeSCModel;
211  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
[608]212  ContextModel3DBuffer m_cTransformSkipSCModel;
213  ContextModel3DBuffer m_CUTransquantBypassFlagSCModel;
[56]214
[608]215#if H_3D_DIM
216  ContextModel3DBuffer m_cDepthIntraModeSCModel;
217  ContextModel3DBuffer m_cDdcFlagSCModel;
218  ContextModel3DBuffer m_cDdcDataSCModel;
[833]219  ContextModel3DBuffer m_cAngleFlagSCModel;
[608]220#if H_3D_DIM_SDC 
221  ContextModel3DBuffer m_cSDCResidualFlagSCModel;
222  ContextModel3DBuffer m_cSDCResidualSCModel;
[100]223#endif
[443]224#endif
[884]225#if H_3D_DIM_SDC 
[833]226  ContextModel3DBuffer m_cSDCFlagSCModel;
227#endif
228#if H_3D_DBBP
229  ContextModel3DBuffer m_cDBBPFlagSCModel;
230#endif
[2]231};
232
[56]233//! \}
234
[2]235#endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_)
Note: See TracBrowser for help on using the repository browser.