source: 3DVCSoftware/branches/HTM-14.1-update-dev1-LG/source/Lib/TLibDecoder/TDecSbac.h

Last change on this file was 1303, checked in by lg, 9 years ago

Integration of inter SDC

  • 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-2015, 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                       ( const TDecSbac* pSrc );
73  Void loadContexts               ( const TDecSbac* pSrc );
74  Void xCopyFrom                  ( const TDecSbac* pSrc );
75  Void xCopyContextsFrom          ( const TDecSbac* pSrc );
76
77  Void  resetEntropy (TComSlice* pSlice );
78  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
79  Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
80  Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
81#if H_3D
82  Void  parsePPS                  ( TComPPS* /*pcPPS*/, TComVPS* /*pcVPS*/ ) {}
83#else
84  Void  parsePPS                  ( TComPPS* /*pcPPS*/ ) {}
85#endif
86  Void  parseSliceHeader          ( TComSlice* /*pcSlice*/, ParameterSetManager* /*parameterSetManager*/, const Int /*prevTid0POC*/) {}
87  Void  parseTerminatingBit       ( UInt& ruiBit );
88  Void  parseRemainingBytes       ( Bool noTrailingBytesExpected);
89  Void  parseMVPIdx               ( Int& riMVPIdx          );
90  Void  parseSaoMaxUvlc           ( UInt& val, UInt maxSymbol );
91  Void  parseSaoMerge             ( UInt&  ruiVal   );
92  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
93  Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
94  Void parseSAOBlkParam           (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, const BitDepths &bitDepths);
95  Void parseSaoSign               (UInt& val);
96
97private:
98#if RExt__DECODER_DEBUG_BIT_STATISTICS
99  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, const class TComCodingStatisticsClassType &whichStat );
100  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol, const class TComCodingStatisticsClassType &whichStat );
101  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount, const class TComCodingStatisticsClassType &whichStat );
102  Void  xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const Int maxLog2TrDynamicRange, const class TComCodingStatisticsClassType &whichStat );
103#else
104  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
105  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
106  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
107  Void  xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const Int maxLog2TrDynamicRange );
108#endif
109#if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
110  Void  xReadExGolombLevelDdc( UInt& ruiSymbol );
111  Void  xParseDeltaDC        ( Pel& rValDeltaDC, UInt uiNumSeg );
112#endif
113#if NH_3D_DMM
114  Void  xParseIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
115  Void  xParseDmmData        ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
116  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
117#endif
118#if NH_3D_SDC_INTRA
119  Void  xParseSDCResidualData     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
120#endif
121#if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
122  Void  parseSDCFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
123#endif
124#if NH_3D_DBBP
125  Void parseDBBPFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
126#endif
127
128private:
129  TComInputBitstream* m_pcBitstream;
130  TDecBinIf*        m_pcTDecBinIf;
131
132public:
133
134  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
135#if NH_3D_DIS
136  Void parseDIS          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
137#endif
138#if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
139  Void  parseDeltaDC      ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
140#endif
141  Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
142  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
143  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
144  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex );
145#if NH_3D_ARP
146  Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
147#endif
148#if NH_3D_IC
149  Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
150#endif
151  Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
152  Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
153
154  Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
155  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
156  Void parseInterDir      ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx );
157  Void parseRefFrmIdx     ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList );
158  Void parseMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList );
159
160  Void parseCrossComponentPrediction ( class TComTU &rTu, ComponentID compID );
161
162  Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
163  Void parseQtCbf         ( TComTU &rTu, const ComponentID compID, const Bool lowestLevel );
164  Void parseQtRootCbf     ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
165
166  Void parseDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
167  Void parseChromaQpAdjustment( TComDataCU* cu, UInt absPartIdx, UInt depth );
168
169  Void parseIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
170
171  Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, ComponentID component, UInt uiScanIdx );
172  Void parseCoeffNxN      ( class TComTU &rTu, ComponentID compID  );
173  Void parseTransformSkipFlags ( class TComTU &rTu, ComponentID component );
174
175  Void  parseScalingList ( TComScalingList* /*scalingList*/ ) {}
176
177  Void  parseExplicitRdpcmMode( TComTU &rTu, ComponentID compID );
178
179private:
180  ContextModel         m_contextModels[MAX_NUM_CTX_MOD];
181  Int                  m_numContextModels;
182  ContextModel3DBuffer m_cCUSplitFlagSCModel;
183  ContextModel3DBuffer m_cCUSkipFlagSCModel;
184#if NH_3D_DIS
185  ContextModel3DBuffer m_cCUDISFlagSCModel;
186  ContextModel3DBuffer m_cCUDISTypeSCModel;
187#endif
188  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
189  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
190#if NH_3D_ARP
191  ContextModel3DBuffer m_cCUPUARPWSCModel;
192#endif
193#if NH_3D_IC
194  ContextModel3DBuffer m_cCUICFlagSCModel;
195#endif
196  ContextModel3DBuffer m_cCUPartSizeSCModel;
197  ContextModel3DBuffer m_cCUPredModeSCModel;
198  ContextModel3DBuffer m_cCUIntraPredSCModel;
199  ContextModel3DBuffer m_cCUChromaPredSCModel;
200  ContextModel3DBuffer m_cCUDeltaQpSCModel;
201  ContextModel3DBuffer m_cCUInterDirSCModel;
202  ContextModel3DBuffer m_cCURefPicSCModel;
203  ContextModel3DBuffer m_cCUMvdSCModel;
204  ContextModel3DBuffer m_cCUQtCbfSCModel;
205  ContextModel3DBuffer m_cCUTransSubdivFlagSCModel;
206  ContextModel3DBuffer m_cCUQtRootCbfSCModel;
207
208  ContextModel3DBuffer m_cCUSigCoeffGroupSCModel;
209  ContextModel3DBuffer m_cCUSigSCModel;
210  ContextModel3DBuffer m_cCuCtxLastX;
211  ContextModel3DBuffer m_cCuCtxLastY;
212  ContextModel3DBuffer m_cCUOneSCModel;
213  ContextModel3DBuffer m_cCUAbsSCModel;
214
215  ContextModel3DBuffer m_cMVPIdxSCModel;
216
217  ContextModel3DBuffer m_cSaoMergeSCModel;
218  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
219  ContextModel3DBuffer m_cTransformSkipSCModel;
220  ContextModel3DBuffer m_CUTransquantBypassFlagSCModel;
221  ContextModel3DBuffer m_explicitRdpcmFlagSCModel;
222  ContextModel3DBuffer m_explicitRdpcmDirSCModel;
223  ContextModel3DBuffer m_cCrossComponentPredictionSCModel;
224
225  ContextModel3DBuffer m_ChromaQpAdjFlagSCModel;
226  ContextModel3DBuffer m_ChromaQpAdjIdcSCModel;
227#if NH_3D_DMM
228  ContextModel3DBuffer m_cNotDmmFlagSCModel;
229  ContextModel3DBuffer m_cDmmModeSCModel;
230#endif
231#if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
232  ContextModel3DBuffer m_cDdcDataSCModel;
233  ContextModel3DBuffer m_cSDCFlagSCModel;
234#endif
235#if NH_3D_SDC_INTRA 
236  ContextModel3DBuffer m_cSDCResidualFlagSCModel;
237  ContextModel3DBuffer m_cSDCResidualSCModel;
238  ContextModel3DBuffer m_cDdcFlagSCModel;
239#endif
240#if NH_3D_DBBP
241  ContextModel3DBuffer m_cDBBPFlagSCModel;
242#endif
243
244
245  UInt m_golombRiceAdaptationStatistics[RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS];
246};
247
248//! \}
249
250#endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_)
Note: See TracBrowser for help on using the repository browser.