HEVC Test Model (HM)  HM-16.3
TDecSbac.h
Go to the documentation of this file.
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 
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"
52 
55 
56 // ====================================================================================================================
57 // Class definition
58 // ====================================================================================================================
59 
60 class SEImessages;
61 
63 class TDecSbac : public TDecEntropyIf
64 {
65 public:
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 );
79  Void parseVPS ( TComVPS* /*pcVPS*/ ) {}
80  Void parseSPS ( TComSPS* /*pcSPS*/ ) {}
81  Void parsePPS ( TComPPS* /*pcPPS*/ ) {}
82 
83  Void parseSliceHeader ( TComSlice* /*pcSlice*/, ParameterSetManager* /*parameterSetManager*/) {}
84  Void parseTerminatingBit ( UInt& ruiBit );
85  Void parseRemainingBytes ( Bool noTrailingBytesExpected);
86  Void parseMVPIdx ( Int& riMVPIdx );
87  Void parseSaoMaxUvlc ( UInt& val, UInt maxSymbol );
88  Void parseSaoMerge ( UInt& ruiVal );
89  Void parseSaoTypeIdx ( UInt& ruiVal );
90  Void parseSaoUflc ( UInt uiLength, UInt& ruiVal );
91  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail);
92  Void parseSaoSign (UInt& val);
93 
94 private:
95 #if RExt__DECODER_DEBUG_BIT_STATISTICS
96  Void xReadUnarySymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, const class TComCodingStatisticsClassType &whichStat );
97  Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol, const class TComCodingStatisticsClassType &whichStat );
98  Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount, const class TComCodingStatisticsClassType &whichStat );
99  Void xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const ChannelType channelType, const class TComCodingStatisticsClassType &whichStat );
100 #else
101  Void xReadUnarySymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
102  Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
103  Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount );
104  Void xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const ChannelType channelType );
105 #endif
106 private:
109 
110 public:
111 
112  Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
113  Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
114  Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
115  Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
116  Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex );
117  Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
118  Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
119 
120  Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
121  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
122 
123  Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx );
124  Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList );
125  Void parseMvd ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList );
126 
127  Void parseCrossComponentPrediction ( class TComTU &rTu, ComponentID compID );
128 
129  Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize );
130  Void parseQtCbf ( TComTU &rTu, const ComponentID compID, const Bool lowestLevel );
131  Void parseQtRootCbf ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
132 
133  Void parseDeltaQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
134  Void parseChromaQpAdjustment( TComDataCU* cu, UInt absPartIdx, UInt depth );
135 
136  Void parseIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth);
137 
138  Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, ComponentID component, UInt uiScanIdx );
139  Void parseCoeffNxN ( class TComTU &rTu, ComponentID compID );
140  Void parseTransformSkipFlags ( class TComTU &rTu, ComponentID component );
141 
142  Void parseScalingList ( TComScalingList* /*scalingList*/ ) {}
143 
145 
146 private:
164 
171 
173 
181 
184 
186 };
187 
189 
190 #endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_)
Void loadContexts(const TDecSbac *pSrc)
Definition: TDecSbac.cpp:1847
Void parseIntraDirChroma(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:694
ContextModel3DBuffer m_cCUMergeFlagExtSCModel
Definition: TDecSbac.h:151
Void parseMVPIdx(Int &riMVPIdx)
Definition: TDecSbac.cpp:502
Void parseTerminatingBit(UInt &ruiBit)
Definition: TDecSbac.cpp:171
ContextModel3DBuffer m_cSaoMergeSCModel
Definition: TDecSbac.h:174
CU data structure class.
Definition: TComDataCU.h:64
ChannelType
Definition: TypeDef.h:361
Void parseQtRootCbf(UInt uiAbsPartIdx, UInt &uiQtRootCbf)
Definition: TDecSbac.cpp:911
ContextModel3DBuffer m_cCUChromaPredSCModel
Definition: TDecSbac.h:156
Void parseSaoSign(UInt &val)
Definition: TDecSbac.cpp:1678
Void parseChromaQpAdjustment(TComDataCU *cu, UInt absPartIdx, UInt depth)
Definition: TDecSbac.cpp:969
void Void
Definition: TypeDef.h:285
virtual ~TDecSbac()
Definition: TDecSbac.cpp:102
ContextModel3DBuffer m_cCUTransSubdivFlagSCModel
Definition: TDecSbac.h:162
ContextModel3DBuffer m_cMVPIdxSCModel
Definition: TDecSbac.h:172
ContextModel3DBuffer m_explicitRdpcmDirSCModel
Definition: TDecSbac.h:179
unsigned int UInt
Definition: TypeDef.h:297
Void parseIntraDirLumaAng(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:633
ContextModel3DBuffer m_cCUMergeIdxExtSCModel
Definition: TDecSbac.h:152
Void parseInterDir(TComDataCU *pcCU, UInt &ruiInterDir, UInt uiAbsPartIdx)
Definition: TDecSbac.cpp:719
SCALING_LIST class.
Definition: TComSlice.h:150
Void parseSaoTypeIdx(UInt &ruiVal)
Definition: TDecSbac.cpp:1656
virtual Void init(TComInputBitstream *pcTComBitstream)=0
ContextModel3DBuffer m_cCUSigCoeffGroupSCModel
Definition: TDecSbac.h:165
Void parseSkipFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:418
entropy decoder pure class
Definition: TDecEntropy.h:61
ContextModel3DBuffer m_cCUSkipFlagSCModel
Definition: TDecSbac.h:150
Void parseIPCMInfo(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:364
SBAC decoder class.
Definition: TDecSbac.h:63
ContextModel3DBuffer m_cCuCtxLastY
Definition: TDecSbac.h:168
Void parseSplitFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:509
Void xReadUnarySymbol(UInt &ruiSymbol, ContextModel *pcSCModel, Int iOffset)
Definition: TDecSbac.cpp:271
Void init(TDecBinIf *p)
Definition: TDecSbac.h:69
ContextModel3DBuffer m_cCUQtRootCbfSCModel
Definition: TDecSbac.h:163
ContextModel3DBuffer m_cCUDeltaQpSCModel
Definition: TDecSbac.h:157
entropy decoder class (header)
context model class
Definition: ContextModel.h:57
Void parseMvd(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList)
Definition: TDecSbac.cpp:780
Void resetEntropy(TComSlice *pSlice)
Definition: TDecSbac.cpp:110
Int m_numContextModels
Definition: TDecSbac.h:148
Void parseTransformSkipFlags(class TComTU &rTu, ComponentID component)
Definition: TDecSbac.cpp:1096
ContextModel3DBuffer m_ChromaQpAdjFlagSCModel
Definition: TDecSbac.h:182
Void load(const TDecSbac *pSrc)
Definition: TDecSbac.cpp:1842
Void parsePPS(TComPPS *)
Definition: TDecSbac.h:81
Void parseSAOBlkParam(SAOBlkParam &saoBlkParam, Bool *sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail)
Definition: TDecSbac.cpp:1683
Void parseMergeFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx)
Definition: TDecSbac.cpp:454
ContextModel3DBuffer m_cCUSigSCModel
Definition: TDecSbac.h:166
bool Bool
Definition: TypeDef.h:286
Void uninit()
Definition: TDecSbac.h:70
TDecBinIf * m_pcTDecBinIf
Definition: TDecSbac.h:108
ContextModel3DBuffer m_cTransformSkipSCModel
Definition: TDecSbac.h:176
Void parseRefFrmIdx(TComDataCU *pcCU, Int &riRefFrmIdx, RefPicList eRefList)
Definition: TDecSbac.cpp:746
Void parseMergeIndex(TComDataCU *pcCU, UInt &ruiMergeIndex)
Definition: TDecSbac.cpp:470
PPS class.
Definition: TComSlice.h:977
ContextModel3DBuffer m_cCUPredModeSCModel
Definition: TDecSbac.h:154
Void xReadCoefRemainExGolomb(UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const ChannelType channelType)
Definition: TDecSbac.cpp:303
ContextModel3DBuffer m_cCuCtxLastX
Definition: TDecSbac.h:167
Void parsePartSize(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:535
ContextModel3DBuffer m_cCUQtCbfSCModel
Definition: TDecSbac.h:161
Void parseCUTransquantBypassFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:405
Defines constants and tables for SBAC.
ContextModel3DBuffer m_cCUInterDirSCModel
Definition: TDecSbac.h:158
RefPicList
reference list index
Definition: TypeDef.h:415
ContextModel3DBuffer m_ChromaQpAdjIdcSCModel
Definition: TDecSbac.h:183
ContextModel3DBuffer m_cCUAbsSCModel
Definition: TDecSbac.h:170
ContextModel3DBuffer m_cCUSplitFlagSCModel
Definition: TDecSbac.h:149
Void parseExplicitRdpcmMode(TComTU &rTu, ComponentID compID)
Definition: TDecSbac.cpp:1856
Void parseSaoUflc(UInt uiLength, UInt &ruiVal)
Definition: TDecSbac.cpp:1644
ContextModel m_contextModels[512]
Definition: TDecSbac.h:147
Void xCopyContextsFrom(const TDecSbac *pSrc)
Definition: TDecSbac.cpp:1830
context model 3D buffer class
Void parseDeltaQP(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:929
context model class (header)
ContextModel3DBuffer m_cSaoTypeIdxSCModel
Definition: TDecSbac.h:175
Void parseQtCbf(TComTU &rTu, const ComponentID compID, const Bool lowestLevel)
Definition: TDecSbac.cpp:994
Void xCopyFrom(const TDecSbac *pSrc)
Definition: TDecSbac.cpp:1836
Void xReadUnaryMaxSymbol(UInt &ruiSymbol, ContextModel *pcSCModel, Int iOffset, UInt uiMaxSymbol)
Definition: TDecSbac.cpp:210
ContextModel3DBuffer m_cCUOneSCModel
Definition: TDecSbac.h:169
Definition: TComTU.h:48
ContextModel3DBuffer m_explicitRdpcmFlagSCModel
Definition: TDecSbac.h:178
Void parseSaoMerge(UInt &ruiVal)
Definition: TDecSbac.cpp:1649
Void parseCrossComponentPrediction(class TComTU &rTu, ComponentID compID)
Definition: TDecSbac.cpp:844
ContextModel3DBuffer m_cCrossComponentPredictionSCModel
Definition: TDecSbac.h:180
ContextModel3DBuffer m_CUTransquantBypassFlagSCModel
Definition: TDecSbac.h:177
ContextModel3DBuffer m_cCUMvdSCModel
Definition: TDecSbac.h:160
TComInputBitstream * m_pcBitstream
Definition: TDecSbac.h:107
Void parseScalingList(TComScalingList *)
Definition: TDecSbac.h:142
Void parseRemainingBytes(Bool noTrailingBytesExpected)
Definition: TDecSbac.cpp:186
Void parseTransformSubdivFlag(UInt &ruiSubdivFlag, UInt uiLog2TransformBlockSize)
Definition: TDecSbac.cpp:897
#define MAX_NUM_CTX_MOD
maximum number of supported contexts
Definition: ContextTables.h:49
int Int
Definition: TypeDef.h:296
context model 3D buffer class (header)
ComponentID
Definition: TypeDef.h:368
Void xReadEpExGolomb(UInt &ruiSymbol, UInt uiCount)
Definition: TDecSbac.cpp:246
ContextModel3DBuffer m_cCURefPicSCModel
Definition: TDecSbac.h:159
Void parseVPS(TComVPS *)
Definition: TDecSbac.h:79
Void parseCoeffNxN(class TComTU &rTu, ComponentID compID)
Definition: TDecSbac.cpp:1220
TDecSbac()
Definition: TDecSbac.cpp:62
ContextModel3DBuffer m_cCUIntraPredSCModel
Definition: TDecSbac.h:155
binary entropy decoder interface
slice header class
Definition: TComSlice.h:1198
Void parseSPS(TComSPS *)
Definition: TDecSbac.h:80
UInt m_golombRiceAdaptationStatistics[4]
Definition: TDecSbac.h:185
#define RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS
Definition: TypeDef.h:247
Void setBitstream(TComInputBitstream *p)
Definition: TDecSbac.h:78
Void parseSliceHeader(TComSlice *, ParameterSetManager *)
Definition: TDecSbac.h:83
Void parseLastSignificantXY(UInt &uiPosLastX, UInt &uiPosLastY, Int width, Int height, ComponentID component, UInt uiScanIdx)
Definition: TDecSbac.cpp:1143
ContextModel3DBuffer m_cCUPartSizeSCModel
Definition: TDecSbac.h:153
SPS class.
Definition: TComSlice.h:722
Void parseSaoMaxUvlc(UInt &val, UInt maxSymbol)
Definition: TDecSbac.cpp:1609
Void parsePredMode(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecSbac.cpp:617