[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 TDecCAVLC.h |
---|
| 35 | \brief CAVLC decoder class (header) |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __TDECCAVLC__ |
---|
| 39 | #define __TDECCAVLC__ |
---|
| 40 | |
---|
| 41 | #if _MSC_VER > 1000 |
---|
| 42 | #pragma once |
---|
| 43 | #endif // _MSC_VER > 1000 |
---|
| 44 | |
---|
| 45 | #include "TDecEntropy.h" |
---|
| 46 | |
---|
[56] | 47 | //! \ingroup TLibDecoder |
---|
| 48 | //! \{ |
---|
| 49 | |
---|
[2] | 50 | // ==================================================================================================================== |
---|
| 51 | // Class definition |
---|
| 52 | // ==================================================================================================================== |
---|
| 53 | |
---|
| 54 | class SEImessages; |
---|
| 55 | |
---|
| 56 | /// CAVLC decoder class |
---|
| 57 | class TDecCavlc : public TDecEntropyIf |
---|
| 58 | { |
---|
| 59 | public: |
---|
| 60 | TDecCavlc(); |
---|
| 61 | virtual ~TDecCavlc(); |
---|
| 62 | |
---|
| 63 | protected: |
---|
[56] | 64 | Void xReadCode (UInt uiLength, UInt& ruiCode); |
---|
| 65 | Void xReadUvlc (UInt& ruiVal); |
---|
| 66 | Void xReadSvlc (Int& riVal); |
---|
| 67 | Void xReadFlag (UInt& ruiCode); |
---|
| 68 | Void xReadEpExGolomb ( UInt& ruiSymbol, UInt uiCount ); |
---|
| 69 | Void xReadExGolombLevel ( UInt& ruiSymbol ); |
---|
| 70 | Void xReadUnaryMaxSymbol ( UInt& ruiSymbol, UInt uiMaxSymbol ); |
---|
| 71 | #if ENC_DEC_TRACE |
---|
| 72 | Void xReadCodeTr (UInt length, UInt& rValue, const Char *pSymbolName); |
---|
| 73 | Void xReadUvlcTr ( UInt& rValue, const Char *pSymbolName); |
---|
| 74 | Void xReadSvlcTr ( Int& rValue, const Char *pSymbolName); |
---|
| 75 | Void xReadFlagTr ( UInt& rValue, const Char *pSymbolName); |
---|
| 76 | #endif |
---|
[210] | 77 | #if QC_MVHEVC_B0046 |
---|
| 78 | Void xReadVPSAlignOne (); |
---|
| 79 | #endif |
---|
[56] | 80 | Void xReadPCMAlignZero (); |
---|
| 81 | |
---|
[2] | 82 | UInt xGetBit (); |
---|
[56] | 83 | |
---|
| 84 | #if RPS_IN_SPS |
---|
| 85 | void parseShortTermRefPicSet (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx); |
---|
[2] | 86 | #else |
---|
[56] | 87 | void parseShortTermRefPicSet (TComPPS* pcPPS, TComReferencePictureSet* pcRPS, Int idx); |
---|
[2] | 88 | #endif |
---|
| 89 | private: |
---|
[56] | 90 | TComInputBitstream* m_pcBitstream; |
---|
| 91 | Int m_iSliceGranularity; //!< slice granularity |
---|
[2] | 92 | |
---|
| 93 | Int** m_aaiTempScale; |
---|
| 94 | Int** m_aaiTempOffset; |
---|
| 95 | Int** m_aaiTempPdmScaleNomDelta; |
---|
| 96 | Int** m_aaiTempPdmOffset; |
---|
| 97 | |
---|
| 98 | public: |
---|
[56] | 99 | |
---|
| 100 | /// rest entropy coder by intial QP and IDC in CABAC |
---|
| 101 | #if !CABAC_INIT_FLAG |
---|
| 102 | Void resetEntropy (Int iQp, Int iID) { printf("Not supported yet\n"); assert(0); exit(1);} |
---|
[2] | 103 | Void resetEntropy ( TComSlice* pcSlice ); |
---|
[56] | 104 | #else |
---|
| 105 | Void resetEntropy ( TComSlice* pcSlice ) { assert(0); }; |
---|
| 106 | #endif |
---|
| 107 | Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; } |
---|
| 108 | /// set slice granularity |
---|
| 109 | Void setSliceGranularity(Int iSliceGranularity) {m_iSliceGranularity = iSliceGranularity;} |
---|
| 110 | |
---|
| 111 | /// get slice granularity |
---|
| 112 | Int getSliceGranularity() {return m_iSliceGranularity; } |
---|
[2] | 113 | Void parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ); |
---|
| 114 | Void parseQtCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ); |
---|
| 115 | Void parseQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf ); |
---|
[56] | 116 | |
---|
[210] | 117 | #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 |
---|
[77] | 118 | Void parseVPS ( TComVPS* pcVPS ); |
---|
| 119 | #endif |
---|
[56] | 120 | #if HHI_MPI |
---|
| 121 | Void parseSPS ( TComSPS* pcSPS, Bool bIsDepth ); |
---|
| 122 | #else |
---|
| 123 | Void parseSPS ( TComSPS* pcSPS ); |
---|
[2] | 124 | #endif |
---|
[56] | 125 | #if TILES_OR_ENTROPY_SYNC_IDC |
---|
| 126 | Void parsePPS ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet); |
---|
[42] | 127 | #else |
---|
[56] | 128 | Void parsePPS ( TComPPS* pcPPS); |
---|
[42] | 129 | #endif |
---|
[56] | 130 | Void parseSEI(SEImessages&); |
---|
| 131 | Void parseAPS ( TComAPS* pAPS ); |
---|
| 132 | #if LCU_SYNTAX_ALF |
---|
| 133 | Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet); |
---|
| 134 | #else |
---|
| 135 | Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl ); |
---|
| 136 | #endif |
---|
[2] | 137 | Void parseTerminatingBit ( UInt& ruiBit ); |
---|
| 138 | |
---|
[56] | 139 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
| 140 | Void parseMVPIdx ( Int& riMVPIdx, Int iAMVPCands ); |
---|
| 141 | #else |
---|
| 142 | Void parseMVPIdx ( Int& riMVPIdx ); |
---|
| 143 | #endif |
---|
[2] | 144 | |
---|
| 145 | Void parseSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[189] | 146 | #if LGE_ILLUCOMP_B0045 |
---|
| 147 | Void parseICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 148 | #endif |
---|
[2] | 149 | Void parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ); |
---|
| 150 | Void parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[56] | 151 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 152 | Void parseResPredFlag ( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
[5] | 153 | #endif |
---|
[2] | 154 | Void parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 155 | Void parsePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 156 | Void parsePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 157 | |
---|
| 158 | Void parseIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 159 | |
---|
| 160 | Void parseIntraDirChroma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 161 | |
---|
| 162 | Void parseInterDir ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 163 | Void parseRefFrmIdx ( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
| 164 | Void parseMvd ( TComDataCU* pcCU, UInt uiAbsPartAddr,UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ); |
---|
| 165 | |
---|
| 166 | Void parseDeltaQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 167 | Void parseCoeffNxN ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ); |
---|
| 168 | |
---|
[56] | 169 | Void parseIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth); |
---|
| 170 | |
---|
| 171 | Void readTileMarker ( UInt& uiTileIdx, UInt uiBitsUsed ); |
---|
| 172 | Void updateContextTables ( SliceType eSliceType, Int iQp ) { return; } |
---|
| 173 | #if OL_FLUSH |
---|
| 174 | Void decodeFlush() {}; |
---|
[2] | 175 | #endif |
---|
| 176 | |
---|
[56] | 177 | Void xParsePredWeightTable ( TComSlice* pcSlice ); |
---|
| 178 | Void parseScalingList ( TComScalingList* scalingList ); |
---|
| 179 | Void xDecodeScalingList ( TComScalingList *scalingList, UInt sizeId, UInt listId); |
---|
| 180 | Void parseDFFlag ( UInt& ruiVal, const Char *pSymbolName ); |
---|
| 181 | Void parseDFSvlc ( Int& riVal, const Char *pSymbolName ); |
---|
[189] | 182 | #if RWTH_SDC_DLT_B0036 |
---|
| 183 | Void parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 184 | Void parseSDCPredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ); |
---|
| 185 | Void parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ); |
---|
| 186 | #endif |
---|
[56] | 187 | protected: |
---|
| 188 | #if DBL_CONTROL |
---|
| 189 | Void xParseDblParam ( TComAPS* aps ); |
---|
[2] | 190 | #endif |
---|
[56] | 191 | Void xParseSaoParam ( SAOParam* pSaoParam ); |
---|
| 192 | #if SAO_UNIT_INTERLEAVING |
---|
| 193 | Void xParseSaoOffset (SaoLcuParam* saoLcuParam); |
---|
| 194 | Void xParseSaoUnit (Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool& repeatedRow ); |
---|
| 195 | #else |
---|
| 196 | Void xParseSaoSplitParam ( SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr ); |
---|
| 197 | Void xParseSaoOffsetParam ( SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr ); |
---|
| 198 | #endif |
---|
| 199 | #if LCU_SYNTAX_ALF |
---|
| 200 | Void xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS = true, Int firstLCUAddr = 0, Bool acrossSlice = true, Int numLCUInWidth= -1, Int numLCUInHeight= -1); |
---|
| 201 | Void parseAlfParamSet(AlfParamSet* pAlfParamSet, Int firstLCUAddr, Bool alfAcrossSlice); |
---|
| 202 | Void parseAlfFixedLengthRun(UInt& idx, UInt rx, UInt numLCUInWidth); |
---|
| 203 | Void parseAlfStoredFilterIdx(UInt& idx, UInt numFilterSetsInBuffer); |
---|
| 204 | #endif |
---|
| 205 | Void xParseAlfParam ( ALFParam* pAlfParam ); |
---|
| 206 | Void xParseAlfCuControlParam(AlfCUCtrlInfo& cAlfParam, Int iNumCUsInPic); |
---|
| 207 | Int xGolombDecode ( Int k ); |
---|
| 208 | Bool xMoreRbspData(); |
---|
| 209 | }; |
---|
[2] | 210 | |
---|
[56] | 211 | //! \} |
---|
| 212 | |
---|
[2] | 213 | #endif // !defined(AFX_TDECCAVLC_H__9732DD64_59B0_4A41_B29E_1A5B18821EAD__INCLUDED_) |
---|
| 214 | |
---|