source: 3DVCSoftware/branches/HTM-12.2-dev0/source/Lib/TLibDecoder/TDecSbac.h

Last change on this file was 1106, checked in by tech, 10 years ago
  • HHI_TOOL_PARAMETERS_I2_J0107: Tool parameters moved to SPS and combined with dependency flags
  • Related update of cfg files.
  • Property svn:eol-style set to native
File size: 9.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-2014, 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
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 
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 ); }
77  Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
78#if HHI_TOOL_PARAMETERS_I2_J0107
79  Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
80#else
81#if H_3D
82  Void  parseSPS                  ( TComSPS* /*pcSPS*/ , Int /*viewIndex*/, Bool /*depthFlag*/ ) {}
83#else
84  Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
85#endif
86#endif
87#if H_3D
88  Void  parsePPS                  ( TComPPS* /*pcPPS*/, TComVPS* /*pcVPS*/ ) {}
89#else
90  Void  parsePPS                  ( TComPPS* /*pcPPS*/ ) {}
91#endif
92
93#if H_MV
94  Void  parseSliceHeader          ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/, Int targetOlsIdx ) {}
95#else
96  Void  parseSliceHeader          ( TComSlice*& /*rpcSlice*/, ParameterSetManagerDecoder* /*parameterSetManager*/ ) {}
97#endif
98  Void  parseTerminatingBit       ( UInt& ruiBit );
99  Void  parseMVPIdx               ( Int& riMVPIdx          );
100  Void  parseSaoMaxUvlc           ( UInt& val, UInt maxSymbol );
101  Void  parseSaoMerge         ( UInt&  ruiVal   );
102  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
103  Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
104  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail);
105  Void parseSaoSign(UInt& val);
106private:
107  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
108  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
109  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
110  Void  xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam );
111#if H_3D_DIM
112  Void  xReadExGolombLevel   ( UInt& ruiSymbol, ContextModel& rcSCModel  );
113  Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt uiNumSeg );
114#if H_3D_DIM_DMM
115  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
116#endif
117#if H_3D_DIM_SDC
118  Void  xParseSDCResidualData     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
119#endif
120#endif
121#if H_3D_INTER_SDC
122  Void  parseDeltaDC         ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
123  Void  parseSDCFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
124#endif
125#if H_3D_DBBP
126  Void parseDBBPFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
127#endif
128private:
129  TComInputBitstream* m_pcBitstream;
130  TDecBinIf*        m_pcTDecBinIf;
131 
132public:
133 
134  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
135#if H_3D_SINGLE_DEPTH 
136  Void parseSingleDepthMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
137#endif 
138  Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
139  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
140  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
141  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex );
142#if H_3D_ARP
143  Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
144#endif
145#if H_3D_IC
146  Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
147#endif
148  Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
149  Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
150 
151  Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
152 
153  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
154 
155#if H_3D_DIM
156  Void parseIntraDepth     ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
157  Void parseIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
158#endif
159
160  Void parseInterDir      ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx );
161  Void parseRefFrmIdx     ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList );
162  Void parseMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList );
163 
164  Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
165  Void parseQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth );
166  Void parseQtRootCbf     ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
167 
168  Void parseDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
169 
170  Void parseIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
171
172  Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx );
173  Void parseCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
174  Void parseTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType);
175
176  Void updateContextTables( SliceType eSliceType, Int iQp );
177
178  Void  parseScalingList ( TComScalingList* /*scalingList*/ ) {}
179
180private:
181  UInt m_uiLastDQpNonZero;
182  UInt m_uiLastQp;
183 
184  ContextModel         m_contextModels[MAX_NUM_CTX_MOD];
185  Int                  m_numContextModels;
186  ContextModel3DBuffer m_cCUSplitFlagSCModel;
187  ContextModel3DBuffer m_cCUSkipFlagSCModel;
188#if H_3D_SINGLE_DEPTH
189  ContextModel3DBuffer m_cCUSingleDepthFlagSCModel;
190  ContextModel3DBuffer m_cSingleDepthValueSCModel;
191#endif
192  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
193  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
194#if H_3D_ARP
195  ContextModel3DBuffer m_cCUPUARPWSCModel;
196#endif
197#if H_3D_IC
198  ContextModel3DBuffer m_cCUICFlagSCModel;
199#endif
200  ContextModel3DBuffer m_cCUPartSizeSCModel;
201  ContextModel3DBuffer m_cCUPredModeSCModel;
202  ContextModel3DBuffer m_cCUIntraPredSCModel;
203  ContextModel3DBuffer m_cCUChromaPredSCModel;
204  ContextModel3DBuffer m_cCUDeltaQpSCModel;
205  ContextModel3DBuffer m_cCUInterDirSCModel;
206  ContextModel3DBuffer m_cCURefPicSCModel;
207  ContextModel3DBuffer m_cCUMvdSCModel;
208  ContextModel3DBuffer m_cCUQtCbfSCModel;
209  ContextModel3DBuffer m_cCUTransSubdivFlagSCModel;
210  ContextModel3DBuffer m_cCUQtRootCbfSCModel;
211 
212  ContextModel3DBuffer m_cCUSigCoeffGroupSCModel;
213  ContextModel3DBuffer m_cCUSigSCModel;
214  ContextModel3DBuffer m_cCuCtxLastX;
215  ContextModel3DBuffer m_cCuCtxLastY;
216  ContextModel3DBuffer m_cCUOneSCModel;
217  ContextModel3DBuffer m_cCUAbsSCModel;
218 
219  ContextModel3DBuffer m_cMVPIdxSCModel;
220 
221  ContextModel3DBuffer m_cSaoMergeSCModel;
222  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
223  ContextModel3DBuffer m_cTransformSkipSCModel;
224  ContextModel3DBuffer m_CUTransquantBypassFlagSCModel;
225
226#if H_3D_DIM
227  ContextModel3DBuffer m_cDepthIntraModeSCModel;
228  ContextModel3DBuffer m_cDdcFlagSCModel;
229  ContextModel3DBuffer m_cDdcDataSCModel;
230  ContextModel3DBuffer m_cAngleFlagSCModel;
231#if H_3D_DIM_SDC 
232  ContextModel3DBuffer m_cSDCResidualFlagSCModel;
233  ContextModel3DBuffer m_cSDCResidualSCModel;
234#endif
235#endif
236#if H_3D_DIM_SDC 
237  ContextModel3DBuffer m_cSDCFlagSCModel;
238#endif
239#if H_3D_DBBP
240  ContextModel3DBuffer m_cDBBPFlagSCModel;
241#endif
242};
243
244//! \}
245
246#endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_)
Note: See TracBrowser for help on using the repository browser.