| 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 | #if H_MV |
|---|
| 64 | class TAppDecTop; |
|---|
| 65 | #endif |
|---|
| 66 | /// decoder class |
|---|
| 67 | class TDecTop |
|---|
| 68 | { |
|---|
| 69 | private: |
|---|
| 70 | Int m_iMaxRefPicNum; |
|---|
| 71 | |
|---|
| 72 | Int m_pocCRA; ///< POC number of the latest CRA picture |
|---|
| 73 | Bool m_prevRAPisBLA; ///< true if the previous RAP (CRA/CRANT/BLA/BLANT/IDR) picture is a BLA/BLANT picture |
|---|
| 74 | Int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) |
|---|
| 75 | |
|---|
| 76 | TComList<TComPic*> m_cListPic; // Dynamic buffer |
|---|
| 77 | #if H_MV |
|---|
| 78 | static ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets |
|---|
| 79 | #else |
|---|
| 80 | ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets |
|---|
| 81 | #endif |
|---|
| 82 | TComSlice* m_apcSlicePilot; |
|---|
| 83 | |
|---|
| 84 | SEIMessages m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices |
|---|
| 85 | |
|---|
| 86 | // functional classes |
|---|
| 87 | TComPrediction m_cPrediction; |
|---|
| 88 | TComTrQuant m_cTrQuant; |
|---|
| 89 | TDecGop m_cGopDecoder; |
|---|
| 90 | TDecSlice m_cSliceDecoder; |
|---|
| 91 | TDecCu m_cCuDecoder; |
|---|
| 92 | TDecEntropy m_cEntropyDecoder; |
|---|
| 93 | TDecCavlc m_cCavlcDecoder; |
|---|
| 94 | TDecSbac m_cSbacDecoder; |
|---|
| 95 | TDecBinCABAC m_cBinCABAC; |
|---|
| 96 | SEIReader m_seiReader; |
|---|
| 97 | TComLoopFilter m_cLoopFilter; |
|---|
| 98 | TComSampleAdaptiveOffset m_cSAO; |
|---|
| 99 | |
|---|
| 100 | Bool isSkipPictureForBLA(Int& iPOCLastDisplay); |
|---|
| 101 | Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay); |
|---|
| 102 | TComPic* m_pcPic; |
|---|
| 103 | UInt m_uiSliceIdx; |
|---|
| 104 | Int m_prevPOC; |
|---|
| 105 | Bool m_bFirstSliceInPicture; |
|---|
| 106 | Bool m_bFirstSliceInSequence; |
|---|
| 107 | #if H_MV |
|---|
| 108 | // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer |
|---|
| 109 | Int m_layerId; |
|---|
| 110 | Int m_viewId; |
|---|
| 111 | TComPicLists* m_ivPicLists; |
|---|
| 112 | std::vector<TComPic*> m_refPicSetInterLayer; |
|---|
| 113 | #if H_3D |
|---|
| 114 | Bool m_isDepth; |
|---|
| 115 | #endif |
|---|
| 116 | #endif |
|---|
| 117 | |
|---|
| 118 | public: |
|---|
| 119 | TDecTop(); |
|---|
| 120 | virtual ~TDecTop(); |
|---|
| 121 | |
|---|
| 122 | Void create (); |
|---|
| 123 | Void destroy (); |
|---|
| 124 | |
|---|
| 125 | void setDecodedPictureHashSEIEnabled(Int enabled) { m_cGopDecoder.setDecodedPictureHashSEIEnabled(enabled); } |
|---|
| 126 | |
|---|
| 127 | Void init(); |
|---|
| 128 | #if H_MV |
|---|
| 129 | Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer ); |
|---|
| 130 | #else |
|---|
| 131 | Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay); |
|---|
| 132 | #endif |
|---|
| 133 | |
|---|
| 134 | Void deletePicBuffer(); |
|---|
| 135 | |
|---|
| 136 | #if H_MV |
|---|
| 137 | Void endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet); |
|---|
| 138 | #else |
|---|
| 139 | Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic); |
|---|
| 140 | #endif |
|---|
| 141 | |
|---|
| 142 | #if H_MV |
|---|
| 143 | TComPic* getPic ( Int poc ); |
|---|
| 144 | TComList<TComPic*>* getListPic () { return &m_cListPic; } |
|---|
| 145 | Void setIvPicLists ( TComPicLists* picLists) { m_ivPicLists = picLists; } |
|---|
| 146 | |
|---|
| 147 | Int getCurrPoc () { return m_apcSlicePilot->getPOC(); } |
|---|
| 148 | Void setLayerId ( Int layer) { m_layerId = layer; } |
|---|
| 149 | Int getLayerId () { return m_layerId; } |
|---|
| 150 | Void setViewId ( Int viewId ) { m_viewId = viewId; } |
|---|
| 151 | Int getViewId () { return m_viewId; } |
|---|
| 152 | #if H_3D |
|---|
| 153 | Void setIsDepth ( Bool isDepth ) { m_isDepth = isDepth; } |
|---|
| 154 | Bool getIsDepth () { return m_isDepth; } |
|---|
| 155 | #endif |
|---|
| 156 | #endif |
|---|
| 157 | protected: |
|---|
| 158 | Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); |
|---|
| 159 | Void xCreateLostPicture (Int iLostPOC); |
|---|
| 160 | |
|---|
| 161 | Void xActivateParameterSets(); |
|---|
| 162 | #if H_MV |
|---|
| 163 | TComPic* xGetPic( Int layerId, Int poc ); |
|---|
| 164 | Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); |
|---|
| 165 | #else |
|---|
| 166 | Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); |
|---|
| 167 | #endif |
|---|
| 168 | Void xDecodeVPS(); |
|---|
| 169 | Void xDecodeSPS(); |
|---|
| 170 | Void xDecodePPS(); |
|---|
| 171 | Void xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ); |
|---|
| 172 | |
|---|
| 173 | };// END CLASS DEFINITION TDecTop |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | //! \} |
|---|
| 177 | |
|---|
| 178 | #endif // __TDECTOP__ |
|---|
| 179 | |
|---|