[51] | 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-2013, 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 | |
---|
| 34 | /** \file TDecTop.h |
---|
| 35 | \brief decoder class (header) |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __TDECTOP__ |
---|
| 39 | #define __TDECTOP__ |
---|
| 40 | |
---|
| 41 | #include "TLibCommon/CommonDef.h" |
---|
| 42 | #include "TLibCommon/TComList.h" |
---|
| 43 | #include "TLibCommon/TComPicYuv.h" |
---|
| 44 | #include "TLibCommon/TComPic.h" |
---|
| 45 | #include "TLibCommon/TComTrQuant.h" |
---|
| 46 | #include "TLibCommon/SEI.h" |
---|
| 47 | |
---|
| 48 | #include "TDecGop.h" |
---|
| 49 | #include "TDecEntropy.h" |
---|
| 50 | #include "TDecSbac.h" |
---|
| 51 | #include "TDecCAVLC.h" |
---|
| 52 | #include "SEIread.h" |
---|
| 53 | |
---|
| 54 | struct InputNALUnit; |
---|
| 55 | |
---|
| 56 | //! \ingroup TLibDecoder |
---|
| 57 | //! \{ |
---|
| 58 | |
---|
| 59 | // ==================================================================================================================== |
---|
| 60 | // Class definition |
---|
| 61 | // ==================================================================================================================== |
---|
| 62 | |
---|
| 63 | /// decoder class |
---|
| 64 | class TDecTop |
---|
| 65 | { |
---|
| 66 | private: |
---|
| 67 | Int m_iMaxRefPicNum; |
---|
| 68 | |
---|
| 69 | Int m_pocCRA; ///< POC number of the latest CRA picture |
---|
| 70 | Bool m_prevRAPisBLA; ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture |
---|
| 71 | Int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) |
---|
| 72 | |
---|
| 73 | TComList<TComPic*> m_cListPic; // Dynamic buffer |
---|
[54] | 74 | #if SVC_EXTENSION |
---|
[90] | 75 | ParameterSetManagerDecoder m_parameterSetManagerDecoder[MAX_LAYERS]; // storage for parameter sets |
---|
[54] | 76 | #else |
---|
[51] | 77 | ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets |
---|
[54] | 78 | #endif |
---|
| 79 | |
---|
[51] | 80 | TComSlice* m_apcSlicePilot; |
---|
| 81 | |
---|
| 82 | SEIMessages m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices |
---|
| 83 | |
---|
| 84 | // functional classes |
---|
| 85 | TComPrediction m_cPrediction; |
---|
| 86 | TComTrQuant m_cTrQuant; |
---|
| 87 | TDecGop m_cGopDecoder; |
---|
| 88 | TDecSlice m_cSliceDecoder; |
---|
| 89 | TDecCu m_cCuDecoder; |
---|
| 90 | TDecEntropy m_cEntropyDecoder; |
---|
| 91 | TDecCavlc m_cCavlcDecoder; |
---|
| 92 | TDecSbac m_cSbacDecoder; |
---|
| 93 | TDecBinCABAC m_cBinCABAC; |
---|
| 94 | SEIReader m_seiReader; |
---|
| 95 | TComLoopFilter m_cLoopFilter; |
---|
| 96 | TComSampleAdaptiveOffset m_cSAO; |
---|
| 97 | |
---|
| 98 | Bool isSkipPictureForBLA(Int& iPOCLastDisplay); |
---|
| 99 | Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
| 100 | TComPic* m_pcPic; |
---|
| 101 | UInt m_uiSliceIdx; |
---|
[54] | 102 | #if !SVC_EXTENSION |
---|
[51] | 103 | Int m_prevPOC; |
---|
[54] | 104 | #endif |
---|
[51] | 105 | Bool m_bFirstSliceInPicture; |
---|
[54] | 106 | #if !SVC_EXTENSION |
---|
[51] | 107 | Bool m_bFirstSliceInSequence; |
---|
[54] | 108 | #endif |
---|
[51] | 109 | |
---|
[54] | 110 | #if SVC_EXTENSION |
---|
| 111 | static UInt m_prevPOC; // POC of the previous slice |
---|
| 112 | static UInt m_uiPrevLayerId; // LayerId of the previous slice |
---|
| 113 | static Bool m_bFirstSliceInSequence; |
---|
| 114 | UInt m_layerId; |
---|
| 115 | UInt m_numLayer; |
---|
| 116 | TDecTop** m_ppcTDecTop; |
---|
| 117 | #if AVC_BASE |
---|
| 118 | fstream* m_pBLReconFile; |
---|
| 119 | Int m_iBLSourceWidth; |
---|
| 120 | Int m_iBLSourceHeight; |
---|
| 121 | #endif |
---|
| 122 | #endif |
---|
| 123 | #if AVC_SYNTAX || SYNTAX_OUTPUT |
---|
| 124 | fstream* m_pBLSyntaxFile; |
---|
| 125 | #endif |
---|
| 126 | #if REF_IDX_FRAMEWORK |
---|
| 127 | TComPic* m_cIlpPic[MAX_NUM_REF]; ///< Inter layer Prediction picture = upsampled picture |
---|
| 128 | #endif |
---|
| 129 | |
---|
[51] | 130 | public: |
---|
| 131 | TDecTop(); |
---|
| 132 | virtual ~TDecTop(); |
---|
| 133 | |
---|
| 134 | Void create (); |
---|
| 135 | Void destroy (); |
---|
| 136 | |
---|
| 137 | void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); } |
---|
| 138 | |
---|
| 139 | Void init(); |
---|
[54] | 140 | #if SVC_EXTENSION |
---|
| 141 | Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC); |
---|
| 142 | #else |
---|
[51] | 143 | Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
[54] | 144 | #endif |
---|
[51] | 145 | |
---|
| 146 | Void deletePicBuffer(); |
---|
| 147 | |
---|
| 148 | Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic); |
---|
| 149 | |
---|
[54] | 150 | #if SVC_EXTENSION |
---|
| 151 | UInt getLayerId () { return m_layerId; } |
---|
| 152 | Void setLayerId (UInt layer) { m_layerId = layer; } |
---|
| 153 | UInt getNumLayer () { return m_numLayer; } |
---|
| 154 | Void setNumLayer (UInt uiNum) { m_numLayer = uiNum; } |
---|
| 155 | TComList<TComPic*>* getListPic() { return &m_cListPic; } |
---|
| 156 | Void setLayerDec(TDecTop **p) { m_ppcTDecTop = p; } |
---|
| 157 | TDecTop* getLayerDec(UInt layer) { return m_ppcTDecTop[layer]; } |
---|
| 158 | #if AVC_BASE |
---|
| 159 | Void setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; } |
---|
| 160 | fstream* getBLReconFile() { return m_pBLReconFile; } |
---|
| 161 | Void setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; } |
---|
| 162 | Int getBLWidth() { return m_iBLSourceWidth; } |
---|
| 163 | Int getBLHeight() { return m_iBLSourceHeight; } |
---|
| 164 | #endif |
---|
| 165 | #endif |
---|
| 166 | #if AVC_SYNTAX || SYNTAX_OUTPUT |
---|
| 167 | Void setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; } |
---|
| 168 | fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; } |
---|
| 169 | #endif |
---|
| 170 | #if REF_IDX_FRAMEWORK |
---|
| 171 | Void xInitILRP(TComSPS *pcSPS); |
---|
| 172 | Void setILRPic(TComPic *pcPic); |
---|
| 173 | #endif |
---|
| 174 | |
---|
[51] | 175 | protected: |
---|
| 176 | Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); |
---|
| 177 | Void xCreateLostPicture (Int iLostPOC); |
---|
| 178 | |
---|
| 179 | Void xActivateParameterSets(); |
---|
[54] | 180 | #if SVC_EXTENSION |
---|
| 181 | Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC); |
---|
| 182 | #else |
---|
[51] | 183 | Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); |
---|
[54] | 184 | #endif |
---|
[51] | 185 | Void xDecodeVPS(); |
---|
| 186 | Void xDecodeSPS(); |
---|
| 187 | Void xDecodePPS(); |
---|
| 188 | Void xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ); |
---|
| 189 | |
---|
| 190 | };// END CLASS DEFINITION TDecTop |
---|
| 191 | |
---|
| 192 | |
---|
| 193 | //! \} |
---|
| 194 | |
---|
| 195 | #endif // __TDECTOP__ |
---|
| 196 | |
---|