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