[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 |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
| 6 | * Copyright (c) 2010-2011, 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 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 | */ |
---|
[2] | 33 | |
---|
| 34 | |
---|
[5] | 35 | |
---|
[2] | 36 | /** \file TDecTop.h |
---|
| 37 | \brief decoder class (header) |
---|
| 38 | */ |
---|
| 39 | |
---|
| 40 | #ifndef __TDECTOP__ |
---|
| 41 | #define __TDECTOP__ |
---|
| 42 | |
---|
| 43 | #include "../TLibCommon/CommonDef.h" |
---|
| 44 | #include "../TLibCommon/TComList.h" |
---|
| 45 | #include "../TLibCommon/TComPicYuv.h" |
---|
| 46 | #include "../TLibCommon/TComPic.h" |
---|
| 47 | #include "../TLibCommon/TComTrQuant.h" |
---|
| 48 | #include "../TLibCommon/TComDepthMapGenerator.h" |
---|
| 49 | #include "../TLibCommon/TComResidualGenerator.h" |
---|
| 50 | #include "../TLibCommon/SEI.h" |
---|
| 51 | |
---|
| 52 | #include "TDecGop.h" |
---|
| 53 | #include "TDecEntropy.h" |
---|
| 54 | #include "TDecSbac.h" |
---|
| 55 | #include "TDecCAVLC.h" |
---|
| 56 | |
---|
| 57 | // ==================================================================================================================== |
---|
| 58 | // Class definition |
---|
| 59 | // ==================================================================================================================== |
---|
| 60 | |
---|
| 61 | class TAppDecTop ; |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | class CamParsCollector |
---|
| 65 | { |
---|
| 66 | public: |
---|
| 67 | CamParsCollector (); |
---|
| 68 | ~CamParsCollector (); |
---|
| 69 | |
---|
| 70 | Void init ( FILE* pCodedScaleOffsetFile ); |
---|
| 71 | Void uninit (); |
---|
| 72 | Void setSlice ( TComSlice* pcSlice ); |
---|
| 73 | |
---|
| 74 | private: |
---|
| 75 | Bool xIsComplete (); |
---|
| 76 | Void xOutput ( Int iPOC ); |
---|
| 77 | |
---|
| 78 | private: |
---|
| 79 | Bool m_bInitialized; |
---|
| 80 | FILE* m_pCodedScaleOffsetFile; |
---|
| 81 | |
---|
| 82 | Int** m_aaiCodedOffset; |
---|
| 83 | Int** m_aaiCodedScale; |
---|
| 84 | Int* m_aiViewOrderIndex; |
---|
| 85 | Int* m_aiViewReceived; |
---|
| 86 | UInt m_uiCamParsCodedPrecision; |
---|
| 87 | Bool m_bCamParsVaryOverTime; |
---|
| 88 | Int m_iLastViewId; |
---|
| 89 | Int m_iLastPOC; |
---|
| 90 | UInt m_uiMaxViewId; |
---|
| 91 | }; |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | /// decoder class |
---|
| 95 | class TDecTop |
---|
| 96 | { |
---|
| 97 | private: |
---|
| 98 | Int m_iGopSize; |
---|
| 99 | Bool m_bGopSizeSet; |
---|
| 100 | int m_iMaxRefPicNum; |
---|
[5] | 101 | |
---|
[2] | 102 | #if DCM_DECODING_REFRESH |
---|
| 103 | Bool m_bRefreshPending; ///< refresh pending flag |
---|
| 104 | UInt m_uiPOCCDR; ///< temporal reference of the CDR picture |
---|
| 105 | #if DCM_SKIP_DECODING_FRAMES |
---|
| 106 | UInt m_uiPOCRA; ///< temporal reference of the random access point |
---|
| 107 | #endif |
---|
| 108 | #endif |
---|
| 109 | |
---|
| 110 | UInt m_uiValidPS; |
---|
| 111 | TComList<TComPic*> m_cListPic; // Dynamic buffer |
---|
| 112 | TComSPS m_cSPS; |
---|
| 113 | TComPPS m_cPPS; |
---|
| 114 | TComSlice* m_apcSlicePilot; |
---|
[5] | 115 | |
---|
[2] | 116 | SEImessages *m_SEIs; ///< "all" SEI messages. If not NULL, we own the object. |
---|
| 117 | |
---|
| 118 | // functional classes |
---|
| 119 | TComPrediction m_cPrediction; |
---|
| 120 | TComTrQuant m_cTrQuant; |
---|
| 121 | TDecGop m_cGopDecoder; |
---|
| 122 | TDecSlice m_cSliceDecoder; |
---|
| 123 | TDecCu m_cCuDecoder; |
---|
| 124 | TDecEntropy m_cEntropyDecoder; |
---|
| 125 | TDecCavlc m_cCavlcDecoder; |
---|
| 126 | TDecSbac m_cSbacDecoder; |
---|
| 127 | TDecBinCABAC m_cBinCABAC; |
---|
| 128 | TComLoopFilter m_cLoopFilter; |
---|
| 129 | TComAdaptiveLoopFilter m_cAdaptiveLoopFilter; |
---|
| 130 | #if MTK_SAO |
---|
| 131 | TComSampleAdaptiveOffset m_cSAO; |
---|
| 132 | #endif |
---|
[5] | 133 | #if DEPTH_MAP_GENERATION |
---|
[2] | 134 | TComDepthMapGenerator m_cDepthMapGenerator; |
---|
[5] | 135 | #endif |
---|
| 136 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 137 | TComResidualGenerator m_cResidualGenerator; |
---|
[5] | 138 | #endif |
---|
[2] | 139 | |
---|
| 140 | Bool m_bIsDepth; |
---|
| 141 | Int m_iViewIdx; |
---|
[20] | 142 | #if SONY_COLPIC_AVAILABILITY |
---|
| 143 | Int m_iViewOrderIdx; |
---|
| 144 | #endif |
---|
[2] | 145 | TAppDecTop* m_pcTAppDecTop; |
---|
| 146 | CamParsCollector* m_pcCamParsCollector; |
---|
| 147 | |
---|
| 148 | #if DCM_SKIP_DECODING_FRAMES |
---|
| 149 | Bool isRandomAccessSkipPicture(Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
| 150 | #endif |
---|
| 151 | TComPic* m_pcPic; |
---|
| 152 | UInt m_uiSliceIdx; |
---|
| 153 | UInt m_uiLastSliceIdx; |
---|
| 154 | UInt m_uiPrevPOC; |
---|
| 155 | Bool m_bFirstSliceInPicture; |
---|
| 156 | Bool m_bFirstSliceInSequence; |
---|
| 157 | |
---|
| 158 | public: |
---|
| 159 | TDecTop(); |
---|
| 160 | virtual ~TDecTop(); |
---|
[5] | 161 | |
---|
[2] | 162 | Void create (); |
---|
| 163 | Void destroy (); |
---|
| 164 | |
---|
| 165 | void setPictureDigestEnabled(bool enabled) { m_cGopDecoder.setPictureDigestEnabled(enabled); } |
---|
[5] | 166 | |
---|
[2] | 167 | Void init( TAppDecTop* pcTAppDecTop, Bool bFirstInstance = true ); |
---|
| 168 | #if DCM_SKIP_DECODING_FRAMES |
---|
| 169 | Bool decode (Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS, Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
| 170 | #else |
---|
| 171 | Void decode ( Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, NalUnitType& reNalUnitType, TComSPS& cComSPS ); |
---|
| 172 | #endif |
---|
[5] | 173 | |
---|
[2] | 174 | TComSPS *getSPS() { return (m_uiValidPS & 1) ? &m_cSPS : NULL; } |
---|
[5] | 175 | |
---|
[2] | 176 | Void deletePicBuffer(); |
---|
| 177 | |
---|
| 178 | Void deleteExtraPicBuffers( Int iPoc ); |
---|
| 179 | #if AMVP_BUFFERCOMPRESS |
---|
| 180 | Void compressMotion ( Int iPoc ); |
---|
| 181 | #endif |
---|
| 182 | |
---|
| 183 | Void setViewIdx(Int i) { m_iViewIdx = i ;} |
---|
| 184 | Int getViewIdx() { return m_iViewIdx ; } |
---|
[20] | 185 | #if SONY_COLPIC_AVAILABILITY |
---|
| 186 | Void setViewOrderIdx(Int i) { m_iViewOrderIdx = i ;} |
---|
| 187 | Int getViewOrderIdx() { return m_iViewOrderIdx ; } |
---|
| 188 | #endif |
---|
[2] | 189 | |
---|
| 190 | Void setToDepth(Bool b) { m_bIsDepth = b ;} |
---|
| 191 | Bool getIsDepth() { return m_bIsDepth ;} |
---|
| 192 | |
---|
| 193 | Void setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; } |
---|
| 194 | |
---|
| 195 | TComList<TComPic*>* getListPic () { return &m_cListPic; } |
---|
[20] | 196 | TAppDecTop* getDecTop ( ){ return m_pcTAppDecTop ;} |
---|
| 197 | #if DEPTH_MAP_GENERATION |
---|
| 198 | TComDepthMapGenerator* getDepthMapGenerator () { return &m_cDepthMapGenerator; } |
---|
| 199 | #endif |
---|
[2] | 200 | |
---|
| 201 | Void setSPS (TComSPS cSPS ); |
---|
| 202 | |
---|
| 203 | UInt getCodedPictureBufferSize() { return m_cSPS.getCodedPictureBufferSize() ; } |
---|
| 204 | |
---|
| 205 | Void executeDeblockAndAlf(Bool bEos, TComBitstream* pcBitstream, UInt& ruiPOC, TComList<TComPic*>*& rpcListPic, Int& iSkipFrame, Int& iPOCLastDisplay); |
---|
| 206 | |
---|
| 207 | protected: |
---|
| 208 | Void xGetNewPicBuffer (TComSlice* pcSlice, TComPic*& rpcPic); |
---|
[5] | 209 | |
---|
[2] | 210 | };// END CLASS DEFINITION TDecTop |
---|
| 211 | |
---|
| 212 | |
---|
| 213 | #endif // __TDECTOP__ |
---|
| 214 | |
---|