[313] | 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 |
---|
[1029] | 4 | * granted under this license. |
---|
[313] | 5 | * |
---|
[1259] | 6 | * Copyright (c) 2010-2015, ITU/ISO/IEC |
---|
[313] | 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 | |
---|
| 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" |
---|
| 49 | #include "TLibCommon/ContextTables.h" |
---|
| 50 | #include "TLibCommon/ContextModel.h" |
---|
| 51 | #include "TLibCommon/ContextModel3DBuffer.h" |
---|
| 52 | |
---|
| 53 | //! \ingroup TLibDecoder |
---|
| 54 | //! \{ |
---|
| 55 | |
---|
| 56 | // ==================================================================================================================== |
---|
| 57 | // Class definition |
---|
| 58 | // ==================================================================================================================== |
---|
| 59 | |
---|
[1029] | 60 | class SEImessages; |
---|
| 61 | |
---|
[313] | 62 | /// SBAC decoder class |
---|
| 63 | class TDecSbac : public TDecEntropyIf |
---|
| 64 | { |
---|
| 65 | public: |
---|
| 66 | TDecSbac(); |
---|
| 67 | virtual ~TDecSbac(); |
---|
[1029] | 68 | |
---|
[313] | 69 | Void init ( TDecBinIf* p ) { m_pcTDecBinIf = p; } |
---|
| 70 | Void uninit ( ) { m_pcTDecBinIf = 0; } |
---|
| 71 | |
---|
[1029] | 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 | |
---|
[313] | 77 | Void resetEntropy (TComSlice* pSlice ); |
---|
| 78 | Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); } |
---|
| 79 | Void parseVPS ( TComVPS* /*pcVPS*/ ) {} |
---|
| 80 | Void parseSPS ( TComSPS* /*pcSPS*/ ) {} |
---|
[713] | 81 | Void parsePPS ( TComPPS* /*pcPPS*/ |
---|
[1212] | 82 | #if CGS_3D_ASYMLUT |
---|
[713] | 83 | , TCom3DAsymLUT * /*pc3DAsymLUT*/ , Int /*nLayerID*/ |
---|
| 84 | #endif |
---|
| 85 | ) {} |
---|
[313] | 86 | |
---|
[1235] | 87 | Void parseSliceHeader ( TComSlice* /*pcSlice*/, ParameterSetManager* /*parameterSetManager*/) {} |
---|
[313] | 88 | Void parseTerminatingBit ( UInt& ruiBit ); |
---|
[1029] | 89 | Void parseRemainingBytes ( Bool noTrailingBytesExpected); |
---|
[313] | 90 | Void parseMVPIdx ( Int& riMVPIdx ); |
---|
| 91 | Void parseSaoMaxUvlc ( UInt& val, UInt maxSymbol ); |
---|
[1029] | 92 | Void parseSaoMerge ( UInt& ruiVal ); |
---|
[313] | 93 | Void parseSaoTypeIdx ( UInt& ruiVal ); |
---|
| 94 | Void parseSaoUflc ( UInt uiLength, UInt& ruiVal ); |
---|
[644] | 95 | |
---|
| 96 | #if SVC_EXTENSION |
---|
[1029] | 97 | Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail ); |
---|
[644] | 98 | #else |
---|
[1029] | 99 | Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail); |
---|
[644] | 100 | #endif |
---|
[1029] | 101 | Void parseSaoSign (UInt& val); |
---|
| 102 | |
---|
[313] | 103 | private: |
---|
[1029] | 104 | #if RExt__DECODER_DEBUG_BIT_STATISTICS |
---|
| 105 | Void xReadUnarySymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, const class TComCodingStatisticsClassType &whichStat ); |
---|
| 106 | Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol, const class TComCodingStatisticsClassType &whichStat ); |
---|
| 107 | Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount, const class TComCodingStatisticsClassType &whichStat ); |
---|
| 108 | Void xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const ChannelType channelType, const class TComCodingStatisticsClassType &whichStat ); |
---|
| 109 | #else |
---|
[313] | 110 | Void xReadUnarySymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset ); |
---|
| 111 | Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol ); |
---|
| 112 | Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount ); |
---|
[1029] | 113 | Void xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam, const Bool useLimitedPrefixLength, const ChannelType channelType ); |
---|
| 114 | #endif |
---|
[313] | 115 | private: |
---|
| 116 | TComInputBitstream* m_pcBitstream; |
---|
| 117 | TDecBinIf* m_pcTDecBinIf; |
---|
[1029] | 118 | |
---|
[313] | 119 | public: |
---|
[1029] | 120 | |
---|
[313] | 121 | Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 122 | Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 123 | Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 124 | Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); |
---|
| 125 | Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ); |
---|
| 126 | Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 127 | Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1029] | 128 | |
---|
[313] | 129 | Void parseIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 130 | Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1029] | 131 | |
---|
[313] | 132 | Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ); |
---|
| 133 | Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList ); |
---|
| 134 | Void parseMvd ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
[1029] | 135 | |
---|
| 136 | Void parseCrossComponentPrediction ( class TComTU &rTu, ComponentID compID ); |
---|
| 137 | |
---|
[313] | 138 | Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ); |
---|
[1029] | 139 | Void parseQtCbf ( TComTU &rTu, const ComponentID compID, const Bool lowestLevel ); |
---|
[313] | 140 | Void parseQtRootCbf ( UInt uiAbsPartIdx, UInt& uiQtRootCbf ); |
---|
[1029] | 141 | |
---|
[313] | 142 | Void parseDeltaQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[1029] | 143 | Void parseChromaQpAdjustment( TComDataCU* cu, UInt absPartIdx, UInt depth ); |
---|
| 144 | |
---|
[313] | 145 | Void parseIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth); |
---|
| 146 | |
---|
[1029] | 147 | Void parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, ComponentID component, UInt uiScanIdx ); |
---|
| 148 | Void parseCoeffNxN ( class TComTU &rTu, ComponentID compID ); |
---|
| 149 | Void parseTransformSkipFlags ( class TComTU &rTu, ComponentID component ); |
---|
[313] | 150 | |
---|
| 151 | Void parseScalingList ( TComScalingList* /*scalingList*/ ) {} |
---|
| 152 | |
---|
[1029] | 153 | Void parseExplicitRdpcmMode( TComTU &rTu, ComponentID compID ); |
---|
| 154 | |
---|
[313] | 155 | private: |
---|
| 156 | ContextModel m_contextModels[MAX_NUM_CTX_MOD]; |
---|
| 157 | Int m_numContextModels; |
---|
| 158 | ContextModel3DBuffer m_cCUSplitFlagSCModel; |
---|
| 159 | ContextModel3DBuffer m_cCUSkipFlagSCModel; |
---|
| 160 | ContextModel3DBuffer m_cCUMergeFlagExtSCModel; |
---|
| 161 | ContextModel3DBuffer m_cCUMergeIdxExtSCModel; |
---|
| 162 | ContextModel3DBuffer m_cCUPartSizeSCModel; |
---|
| 163 | ContextModel3DBuffer m_cCUPredModeSCModel; |
---|
| 164 | ContextModel3DBuffer m_cCUIntraPredSCModel; |
---|
| 165 | ContextModel3DBuffer m_cCUChromaPredSCModel; |
---|
| 166 | ContextModel3DBuffer m_cCUDeltaQpSCModel; |
---|
| 167 | ContextModel3DBuffer m_cCUInterDirSCModel; |
---|
| 168 | ContextModel3DBuffer m_cCURefPicSCModel; |
---|
| 169 | ContextModel3DBuffer m_cCUMvdSCModel; |
---|
| 170 | ContextModel3DBuffer m_cCUQtCbfSCModel; |
---|
| 171 | ContextModel3DBuffer m_cCUTransSubdivFlagSCModel; |
---|
| 172 | ContextModel3DBuffer m_cCUQtRootCbfSCModel; |
---|
[1029] | 173 | |
---|
[313] | 174 | ContextModel3DBuffer m_cCUSigCoeffGroupSCModel; |
---|
| 175 | ContextModel3DBuffer m_cCUSigSCModel; |
---|
| 176 | ContextModel3DBuffer m_cCuCtxLastX; |
---|
| 177 | ContextModel3DBuffer m_cCuCtxLastY; |
---|
| 178 | ContextModel3DBuffer m_cCUOneSCModel; |
---|
| 179 | ContextModel3DBuffer m_cCUAbsSCModel; |
---|
[1029] | 180 | |
---|
[313] | 181 | ContextModel3DBuffer m_cMVPIdxSCModel; |
---|
[1029] | 182 | |
---|
[313] | 183 | ContextModel3DBuffer m_cSaoMergeSCModel; |
---|
| 184 | ContextModel3DBuffer m_cSaoTypeIdxSCModel; |
---|
| 185 | ContextModel3DBuffer m_cTransformSkipSCModel; |
---|
| 186 | ContextModel3DBuffer m_CUTransquantBypassFlagSCModel; |
---|
[1029] | 187 | ContextModel3DBuffer m_explicitRdpcmFlagSCModel; |
---|
| 188 | ContextModel3DBuffer m_explicitRdpcmDirSCModel; |
---|
| 189 | ContextModel3DBuffer m_cCrossComponentPredictionSCModel; |
---|
| 190 | |
---|
| 191 | ContextModel3DBuffer m_ChromaQpAdjFlagSCModel; |
---|
| 192 | ContextModel3DBuffer m_ChromaQpAdjIdcSCModel; |
---|
| 193 | |
---|
| 194 | UInt m_golombRiceAdaptationStatistics[RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS]; |
---|
[313] | 195 | }; |
---|
| 196 | |
---|
| 197 | //! \} |
---|
| 198 | |
---|
| 199 | #endif // !defined(AFX_TDECSBAC_H__CFCAAA19_8110_47F4_9A16_810C4B5499D5__INCLUDED_) |
---|