source: 3DVCSoftware/branches/HTM-5.1-dev1-LG/source/Lib/TLibDecoder/TDecSbac.h @ 267

Last change on this file since 267 was 251, checked in by lg, 12 years ago

Integration of JCT3V-C0044

  • Property svn:eol-style set to native
File size: 11.9 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 
[210]89#if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
[77]90  Void  parseVPS                  ( TComVPS* pcVPS )  {}
91#endif
[56]92#if HHI_MPI
93  Void  parseSPS                  ( TComSPS* pcSPS, Bool bIsDepth ) {}
94#else
[2]95  Void  parseSPS                  ( TComSPS* pcSPS         ) {}
[56]96#endif
97#if TILES_OR_ENTROPY_SYNC_IDC 
98  Void  parsePPS                  ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet         ) {}
99#else
[2]100  Void  parsePPS                  ( TComPPS* pcPPS         ) {}
[56]101#endif
102  Void  parseAPS                  ( TComAPS* pAPS          ) {}
[2]103  void parseSEI(SEImessages&) {}
[56]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
[2]111  Void  parseTerminatingBit       ( UInt& ruiBit );
[56]112#if HHI_INTER_VIEW_MOTION_PRED
113  Void  parseMVPIdx               ( Int& riMVPIdx, Int iNumAMVPCands );
114#else
115  Void  parseMVPIdx               ( Int& riMVPIdx          );
116#endif
[2]117 
[56]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);
[2]127#endif
[189]128 
129#if RWTH_SDC_DLT_B0036
130  Void parseSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
131  Void parseSDCPredMode    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
132  Void parseSDCResidualData     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
133#endif
[2]134private:
135  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
136  Void  xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
137  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
138  Void  xReadGoRiceExGolomb ( UInt &ruiSymbol, UInt &ruiGoRiceParam );
[5]139#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
[2]140  Void  xReadExGolombLevel  ( UInt& ruiSymbol, ContextModel& rcSCModel  );
141#endif
[5]142#if HHI_DMM_WEDGE_INTRA
[56]143  Void xParseWedgeFullInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
[2]144  Void xParseWedgeFullDeltaInfo     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
[5]145
[2]146  Void xParseWedgePredDirInfo       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
147  Void xParseWedgePredDirDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
[5]148#endif
149#if HHI_DMM_PRED_TEX
[251]150#if LGE_DMM3_SIMP_C0044
151  Void xParseWedgePredTexInfo       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
152#endif
[2]153  Void xParseWedgePredTexDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
154  Void xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
155#endif
156 
[189]157#if LGE_EDGE_INTRA_A0070
[100]158  Void xParseEdgeIntraInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
159#endif
160 
[2]161private:
[56]162  TComInputBitstream* m_pcBitstream;
[2]163  TDecBinIf*        m_pcTDecBinIf;
164 
[56]165  Int           m_iSliceGranularity; //!< slice granularity
166
[2]167public:
168  Void parseAlfCtrlFlag   ( UInt &ruiAlfCtrlFlag );
[56]169
170  /// set slice granularity
171  Void setSliceGranularity(Int iSliceGranularity)  {m_iSliceGranularity = iSliceGranularity;}
172
173  /// get slice granularity
174  Int  getSliceGranularity()                       {return m_iSliceGranularity;             }
175
[2]176  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
[189]177#if LGE_ILLUCOMP_B0045
178  Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
179#endif
[2]180  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
181  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
182  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth );
[56]183#if HHI_INTER_VIEW_RESIDUAL_PRED
184  Void parseResPredFlag   ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth );
[5]185#endif
[2]186  Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
187  Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
188 
189  Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
190 
191  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
192 
193  Void parseInterDir      ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth );
194  Void parseRefFrmIdx     ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList );
195  Void parseMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList );
196 
197  Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
198  Void parseQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth );
199  Void parseQtRootCbf     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf );
200 
201  Void parseDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
202 
[56]203  Void parseIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
[2]204
[56]205  Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx );
[2]206  Void parseCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
207 
[56]208  Void readTileMarker   ( UInt& uiTileIdx, UInt uiBitsUsed );
209  Void updateContextTables( SliceType eSliceType, Int iQp );
210
211  Void  parseScalingList ( TComScalingList* scalingList ) {}
212
[2]213private:
214  UInt m_uiLastDQpNonZero;
215  UInt m_uiLastQp;
216 
[56]217  ContextModel         m_contextModels[MAX_NUM_CTX_MOD];
218  Int                  m_numContextModels;
219  ContextModel3DBuffer m_cCUSplitFlagSCModel;
[2]220  ContextModel3DBuffer m_cCUSkipFlagSCModel;
[189]221#if LGE_ILLUCOMP_B0045
222  ContextModel3DBuffer m_cCUICFlagSCModel;
223#endif
[2]224  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
225  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
[56]226#if HHI_INTER_VIEW_RESIDUAL_PRED
[2]227  ContextModel3DBuffer m_cResPredFlagSCModel;
[56]228#endif
[2]229  ContextModel3DBuffer m_cCUPartSizeSCModel;
230  ContextModel3DBuffer m_cCUPredModeSCModel;
[56]231  ContextModel3DBuffer m_cCUAlfCtrlFlagSCModel;
[2]232  ContextModel3DBuffer m_cCUIntraPredSCModel;
233  ContextModel3DBuffer m_cCUChromaPredSCModel;
[56]234  ContextModel3DBuffer m_cCUDeltaQpSCModel;
[2]235  ContextModel3DBuffer m_cCUInterDirSCModel;
236  ContextModel3DBuffer m_cCURefPicSCModel;
237  ContextModel3DBuffer m_cCUMvdSCModel;
[56]238  ContextModel3DBuffer m_cCUQtCbfSCModel;
[2]239  ContextModel3DBuffer m_cCUTransSubdivFlagSCModel;
240  ContextModel3DBuffer m_cCUQtRootCbfSCModel;
241 
[56]242  ContextModel3DBuffer m_cCUSigCoeffGroupSCModel;
[2]243  ContextModel3DBuffer m_cCUSigSCModel;
244  ContextModel3DBuffer m_cCuCtxLastX;
245  ContextModel3DBuffer m_cCuCtxLastY;
246  ContextModel3DBuffer m_cCUOneSCModel;
247  ContextModel3DBuffer m_cCUAbsSCModel;
248 
249  ContextModel3DBuffer m_cMVPIdxSCModel;
250 
251  ContextModel3DBuffer m_cALFFlagSCModel;
252  ContextModel3DBuffer m_cALFUvlcSCModel;
253  ContextModel3DBuffer m_cALFSvlcSCModel;
[56]254#if AMP_CTX
255  ContextModel3DBuffer m_cCUAMPSCModel;
256#else
257  ContextModel3DBuffer m_cCUXPosiSCModel;
258  ContextModel3DBuffer m_cCUYPosiSCModel;
[2]259#endif
[56]260  ContextModel3DBuffer m_cSaoFlagSCModel;
261  ContextModel3DBuffer m_cSaoUvlcSCModel;
262  ContextModel3DBuffer m_cSaoSvlcSCModel;
263#if SAO_UNIT_INTERLEAVING
264  ContextModel3DBuffer m_cSaoMergeLeftSCModel;
265  ContextModel3DBuffer m_cSaoMergeUpSCModel;
266  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
267#endif
268
[5]269#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
[56]270  ContextModel3DBuffer m_cDmmFlagSCModel;
271  ContextModel3DBuffer m_cDmmModeSCModel;
272  ContextModel3DBuffer m_cDmmDataSCModel;
[2]273#endif
[189]274#if LGE_EDGE_INTRA_A0070
[100]275  ContextModel3DBuffer m_cEdgeIntraSCModel;
276#if LGE_EDGE_INTRA_DELTA_DC
277  ContextModel3DBuffer m_cEdgeIntraDeltaDCSCModel;
278#endif
279#endif
[189]280 
281#if RWTH_SDC_DLT_B0036
282  ContextModel3DBuffer m_cSDCFlagSCModel;
283 
284  ContextModel3DBuffer m_cSDCResidualFlagSCModel;
285  ContextModel3DBuffer m_cSDCResidualSignFlagSCModel;
286  ContextModel3DBuffer m_cSDCResidualSCModel;
287 
288  ContextModel3DBuffer m_cSDCPredModeSCModel;
289#endif
[2]290};
291
[56]292//! \}
293
[2]294#endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_)
Note: See TracBrowser for help on using the repository browser.