source: 3DVCSoftware/branches/HTM-6.2-dev2-Qualcomm/source/Lib/TLibDecoder/TDecSbac.h @ 1417

Last change on this file since 1417 was 373, checked in by zhang, 12 years ago

JCT3V-D0177: ARP

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