[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 TDecTop.h |
---|
| 35 | \brief decoder class (header) |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __TDECTOP__ |
---|
| 39 | #define __TDECTOP__ |
---|
| 40 | |
---|
[56] | 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/TComDepthMapGenerator.h" |
---|
| 47 | #include "TLibCommon/SEI.h" |
---|
[2] | 48 | |
---|
| 49 | #include "TDecGop.h" |
---|
| 50 | #include "TDecEntropy.h" |
---|
| 51 | #include "TDecSbac.h" |
---|
| 52 | #include "TDecCAVLC.h" |
---|
| 53 | |
---|
[56] | 54 | struct InputNALUnit; |
---|
| 55 | |
---|
| 56 | //! \ingroup TLibDecoder |
---|
| 57 | //! \{ |
---|
| 58 | |
---|
| 59 | #define APS_RESERVED_BUFFER_SIZE 2 //!< must be equal to or larger than 2 to handle bitstream parsing |
---|
| 60 | |
---|
[2] | 61 | // ==================================================================================================================== |
---|
| 62 | // Class definition |
---|
| 63 | // ==================================================================================================================== |
---|
| 64 | |
---|
[56] | 65 | class TAppDecTop; |
---|
[2] | 66 | |
---|
| 67 | class CamParsCollector |
---|
| 68 | { |
---|
| 69 | public: |
---|
| 70 | CamParsCollector (); |
---|
| 71 | ~CamParsCollector (); |
---|
| 72 | |
---|
| 73 | Void init ( FILE* pCodedScaleOffsetFile ); |
---|
| 74 | Void uninit (); |
---|
| 75 | Void setSlice ( TComSlice* pcSlice ); |
---|
| 76 | |
---|
[57] | 77 | Bool isInitialized() const { return m_bInitialized; } |
---|
| 78 | |
---|
[2] | 79 | private: |
---|
| 80 | Bool xIsComplete (); |
---|
| 81 | Void xOutput ( Int iPOC ); |
---|
| 82 | |
---|
| 83 | private: |
---|
| 84 | Bool m_bInitialized; |
---|
| 85 | FILE* m_pCodedScaleOffsetFile; |
---|
| 86 | |
---|
| 87 | Int** m_aaiCodedOffset; |
---|
| 88 | Int** m_aaiCodedScale; |
---|
| 89 | Int* m_aiViewOrderIndex; |
---|
[195] | 90 | #if QC_MVHEVC_B0046 |
---|
[194] | 91 | Int* m_aiViewId; |
---|
| 92 | #endif |
---|
[2] | 93 | Int* m_aiViewReceived; |
---|
| 94 | UInt m_uiCamParsCodedPrecision; |
---|
| 95 | Bool m_bCamParsVaryOverTime; |
---|
| 96 | Int m_iLastViewId; |
---|
| 97 | Int m_iLastPOC; |
---|
| 98 | UInt m_uiMaxViewId; |
---|
| 99 | }; |
---|
| 100 | |
---|
| 101 | /// decoder class |
---|
| 102 | class TDecTop |
---|
| 103 | { |
---|
| 104 | private: |
---|
| 105 | Int m_iGopSize; |
---|
| 106 | Bool m_bGopSizeSet; |
---|
| 107 | int m_iMaxRefPicNum; |
---|
[56] | 108 | |
---|
[2] | 109 | Bool m_bRefreshPending; ///< refresh pending flag |
---|
[56] | 110 | Int m_pocCRA; ///< POC number of the latest CRA picture |
---|
| 111 | Int m_pocRandomAccess; ///< POC number of the random access point (the first IDR or CRA picture) |
---|
[2] | 112 | |
---|
| 113 | UInt m_uiValidPS; |
---|
| 114 | TComList<TComPic*> m_cListPic; // Dynamic buffer |
---|
[56] | 115 | ParameterSetManagerDecoder m_parameterSetManagerDecoder; // storage for parameter sets |
---|
| 116 | TComRPSList m_RPSList; |
---|
[2] | 117 | TComSlice* m_apcSlicePilot; |
---|
[56] | 118 | |
---|
[2] | 119 | SEImessages *m_SEIs; ///< "all" SEI messages. If not NULL, we own the object. |
---|
| 120 | |
---|
[56] | 121 | #if SONY_COLPIC_AVAILABILITY |
---|
| 122 | Int m_iViewOrderIdx; |
---|
| 123 | #endif |
---|
| 124 | |
---|
[2] | 125 | // functional classes |
---|
| 126 | TComPrediction m_cPrediction; |
---|
| 127 | TComTrQuant m_cTrQuant; |
---|
| 128 | TDecGop m_cGopDecoder; |
---|
| 129 | TDecSlice m_cSliceDecoder; |
---|
| 130 | TDecCu m_cCuDecoder; |
---|
| 131 | TDecEntropy m_cEntropyDecoder; |
---|
| 132 | TDecCavlc m_cCavlcDecoder; |
---|
| 133 | TDecSbac m_cSbacDecoder; |
---|
| 134 | TDecBinCABAC m_cBinCABAC; |
---|
| 135 | TComLoopFilter m_cLoopFilter; |
---|
| 136 | TComAdaptiveLoopFilter m_cAdaptiveLoopFilter; |
---|
| 137 | TComSampleAdaptiveOffset m_cSAO; |
---|
[56] | 138 | |
---|
[5] | 139 | #if DEPTH_MAP_GENERATION |
---|
[2] | 140 | TComDepthMapGenerator m_cDepthMapGenerator; |
---|
[5] | 141 | #endif |
---|
| 142 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 143 | TComResidualGenerator m_cResidualGenerator; |
---|
[5] | 144 | #endif |
---|
[2] | 145 | |
---|
| 146 | Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
| 147 | TComPic* m_pcPic; |
---|
| 148 | UInt m_uiSliceIdx; |
---|
| 149 | UInt m_uiLastSliceIdx; |
---|
[56] | 150 | Int m_prevPOC; |
---|
[2] | 151 | Bool m_bFirstSliceInPicture; |
---|
| 152 | Bool m_bFirstSliceInSequence; |
---|
| 153 | |
---|
[56] | 154 | Int m_viewId; |
---|
| 155 | Bool m_isDepth; |
---|
| 156 | TAppDecTop* m_tAppDecTop; |
---|
[57] | 157 | CamParsCollector* m_pcCamParsCollector; |
---|
[56] | 158 | NalUnitType m_nalUnitTypeBaseView; |
---|
| 159 | |
---|
[2] | 160 | public: |
---|
| 161 | TDecTop(); |
---|
| 162 | virtual ~TDecTop(); |
---|
[56] | 163 | |
---|
[2] | 164 | Void create (); |
---|
| 165 | Void destroy (); |
---|
| 166 | |
---|
| 167 | void setPictureDigestEnabled(bool enabled) { m_cGopDecoder.setPictureDigestEnabled(enabled); } |
---|
[56] | 168 | |
---|
| 169 | Void init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance ); |
---|
| 170 | Bool decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
| 171 | |
---|
| 172 | Void deletePicBuffer(); |
---|
[195] | 173 | #if QC_MVHEVC_B0046 |
---|
[194] | 174 | Void xCopySPS( TComSPS* pSPSV0); |
---|
| 175 | Void xCopyPPS( TComPPS* pPPSV0); |
---|
| 176 | Void xCopyVPS( TComVPS* pVPSV0); |
---|
| 177 | #endif |
---|
[56] | 178 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
| 179 | Void deleteExtraPicBuffers ( Int iPoc ); |
---|
[42] | 180 | #endif |
---|
[56] | 181 | Void compressMotion ( Int iPoc ); |
---|
[5] | 182 | |
---|
[56] | 183 | Void executeDeblockAndAlf(UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
[5] | 184 | |
---|
[100] | 185 | Void setViewId(Int viewId) { m_viewId = viewId;} |
---|
| 186 | Int getViewId() { return m_viewId ;} |
---|
[56] | 187 | Void setIsDepth( Bool isDepth ) { m_isDepth = isDepth; } |
---|
[2] | 188 | |
---|
[21] | 189 | #if SONY_COLPIC_AVAILABILITY |
---|
[100] | 190 | Void setViewOrderIdx(Int i) { m_iViewOrderIdx = i ;} |
---|
| 191 | Int getViewOrderIdx() { return m_iViewOrderIdx ; } |
---|
[21] | 192 | #endif |
---|
[2] | 193 | |
---|
[21] | 194 | #if DEPTH_MAP_GENERATION |
---|
| 195 | TComDepthMapGenerator* getDepthMapGenerator () { return &m_cDepthMapGenerator; } |
---|
| 196 | #endif |
---|
[2] | 197 | |
---|
[57] | 198 | Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } |
---|
| 199 | |
---|
[56] | 200 | TComList<TComPic*>* getListPic() { return &m_cListPic; } |
---|
| 201 | Void setTAppDecTop( TAppDecTop* pcTAppDecTop ) { m_tAppDecTop = pcTAppDecTop; } |
---|
| 202 | TAppDecTop* getTAppDecTop() { return m_tAppDecTop; } |
---|
| 203 | NalUnitType getNalUnitTypeBaseView() { return m_nalUnitTypeBaseView; } |
---|
[195] | 204 | #if QC_MVHEVC_B0046 |
---|
[194] | 205 | bool m_bFirstNal; //used to copy SPS, PPS, VPS |
---|
| 206 | ParameterSetManagerDecoder* xGetParaSetDec () {return &m_parameterSetManagerDecoder;} |
---|
| 207 | #endif |
---|
[2] | 208 | protected: |
---|
| 209 | Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); |
---|
[56] | 210 | Void xUpdateGopSize (TComSlice* pcSlice); |
---|
| 211 | Void xCreateLostPicture (Int iLostPOC); |
---|
[5] | 212 | |
---|
[56] | 213 | Void decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); }; |
---|
| 214 | Void xActivateParameterSets(); |
---|
| 215 | #if SKIPFRAME_BUGFIX |
---|
| 216 | Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); |
---|
| 217 | #else |
---|
| 218 | Bool xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay); |
---|
| 219 | #endif |
---|
[195] | 220 | #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 |
---|
[100] | 221 | Void xDecodeVPS(); |
---|
[77] | 222 | #endif |
---|
[56] | 223 | Void xDecodeSPS(); |
---|
| 224 | Void xDecodePPS(); |
---|
| 225 | Void xDecodeAPS(); |
---|
| 226 | Void xDecodeSEI(); |
---|
| 227 | |
---|
| 228 | Void allocAPS (TComAPS* pAPS); //!< memory allocation for APS |
---|
[2] | 229 | };// END CLASS DEFINITION TDecTop |
---|
| 230 | |
---|
| 231 | |
---|
[56] | 232 | //! \} |
---|
| 233 | |
---|
[2] | 234 | #endif // __TDECTOP__ |
---|
| 235 | |
---|