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