[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 | |
---|
[56] | 34 | /** \file TEncGOP.h |
---|
[2] | 35 | \brief GOP encoder class (header) |
---|
| 36 | */ |
---|
| 37 | |
---|
[56] | 38 | #ifndef __TENCGOP__ |
---|
| 39 | #define __TENCGOP__ |
---|
[2] | 40 | |
---|
[56] | 41 | #include <list> |
---|
| 42 | |
---|
[2] | 43 | #include <stdlib.h> |
---|
| 44 | |
---|
[56] | 45 | #include "TLibCommon/TComList.h" |
---|
| 46 | #include "TLibCommon/TComPic.h" |
---|
| 47 | #include "TLibCommon/TComBitCounter.h" |
---|
| 48 | #include "TLibCommon/TComLoopFilter.h" |
---|
| 49 | #include "TLibCommon/AccessUnit.h" |
---|
| 50 | #include "TLibCommon/TComDepthMapGenerator.h" |
---|
| 51 | #include "TLibCommon/TComResidualGenerator.h" |
---|
[2] | 52 | #include "TEncAdaptiveLoopFilter.h" |
---|
[56] | 53 | #include "TEncSampleAdaptiveOffset.h" |
---|
[2] | 54 | #include "TEncSlice.h" |
---|
| 55 | #include "TEncEntropy.h" |
---|
| 56 | #include "TEncCavlc.h" |
---|
| 57 | #include "TEncSbac.h" |
---|
| 58 | |
---|
| 59 | #include "TEncAnalyze.h" |
---|
| 60 | |
---|
| 61 | #include <vector> |
---|
| 62 | |
---|
[56] | 63 | //! \ingroup TLibEncoder |
---|
| 64 | //! \{ |
---|
| 65 | |
---|
[2] | 66 | class TEncTop; |
---|
| 67 | |
---|
| 68 | // ==================================================================================================================== |
---|
| 69 | // Class definition |
---|
| 70 | // ==================================================================================================================== |
---|
| 71 | |
---|
| 72 | /// GOP encoder class |
---|
[56] | 73 | class TEncGOP |
---|
[2] | 74 | { |
---|
| 75 | private: |
---|
| 76 | // Data |
---|
[56] | 77 | Bool m_bLongtermTestPictureHasBeenCoded; |
---|
| 78 | Bool m_bLongtermTestPictureHasBeenCoded2; |
---|
| 79 | Int m_iLastIDR; |
---|
| 80 | Int m_iGopSize; |
---|
| 81 | Int m_iNumPicCoded; |
---|
| 82 | Bool m_bFirst; |
---|
[2] | 83 | |
---|
| 84 | // Access channel |
---|
| 85 | TEncTop* m_pcEncTop; |
---|
| 86 | TEncCfg* m_pcCfg; |
---|
| 87 | TEncSlice* m_pcSliceEncoder; |
---|
| 88 | TComList<TComPic*>* m_pcListPic; |
---|
| 89 | |
---|
| 90 | TEncEntropy* m_pcEntropyCoder; |
---|
| 91 | TEncCavlc* m_pcCavlcCoder; |
---|
| 92 | TEncSbac* m_pcSbacCoder; |
---|
| 93 | TEncBinCABAC* m_pcBinCABAC; |
---|
| 94 | TComLoopFilter* m_pcLoopFilter; |
---|
[56] | 95 | |
---|
[5] | 96 | #if DEPTH_MAP_GENERATION |
---|
[2] | 97 | TComDepthMapGenerator* m_pcDepthMapGenerator; |
---|
[5] | 98 | #endif |
---|
| 99 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
[2] | 100 | TComResidualGenerator* m_pcResidualGenerator; |
---|
[5] | 101 | #endif |
---|
[56] | 102 | Int m_pocLastCoded; |
---|
| 103 | |
---|
[2] | 104 | // Adaptive Loop filter |
---|
| 105 | TEncAdaptiveLoopFilter* m_pcAdaptiveLoopFilter; |
---|
| 106 | //--Adaptive Loop filter |
---|
| 107 | TEncSampleAdaptiveOffset* m_pcSAO; |
---|
| 108 | TComBitCounter* m_pcBitCounter; |
---|
| 109 | TComRdCost* m_pcRdCost; ///< RD cost computation |
---|
[56] | 110 | // indicate sequence first |
---|
| 111 | Bool m_bSeqFirst; |
---|
[2] | 112 | |
---|
| 113 | // clean decoding refresh |
---|
| 114 | Bool m_bRefreshPending; |
---|
[56] | 115 | Int m_pocCRA; |
---|
[2] | 116 | UInt* m_uiStoredStartCUAddrForEncodingSlice; |
---|
| 117 | UInt* m_uiStoredStartCUAddrForEncodingEntropySlice; |
---|
| 118 | |
---|
| 119 | std::vector<Int> m_vRVM_RP; |
---|
| 120 | |
---|
| 121 | public: |
---|
[56] | 122 | TEncGOP(); |
---|
| 123 | virtual ~TEncGOP(); |
---|
[2] | 124 | |
---|
| 125 | Void create ( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight ); |
---|
| 126 | Void destroy (); |
---|
| 127 | |
---|
| 128 | Void init ( TEncTop* pcTEncTop ); |
---|
[56] | 129 | Void initGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP); |
---|
| 130 | Void compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid ); |
---|
| 131 | Void xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice); |
---|
| 132 | |
---|
| 133 | Int getPocLastCoded() { return m_pocLastCoded; } |
---|
| 134 | Int getGOPSize() { return m_iGopSize; } |
---|
| 135 | |
---|
[2] | 136 | TComList<TComPic*>* getListPic() { return m_pcListPic; } |
---|
| 137 | |
---|
| 138 | Void preLoopFilterPicAll ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits ); |
---|
[101] | 139 | #if HHI_VSO_SPEEDUP_A0033 |
---|
[100] | 140 | TEncTop* getEncTop() { return m_pcEncTop; } |
---|
| 141 | #endif |
---|
[2] | 142 | |
---|
[56] | 143 | TEncSlice* getSliceEncoder() { return m_pcSliceEncoder; } |
---|
| 144 | NalUnitType getNalUnitType( UInt uiPOCCurr ); |
---|
| 145 | NalUnitType getNalUnitTypeBaseViewMvc( UInt uiPOCCurr ); |
---|
| 146 | Void freeAPS (TComAPS* pAPS, TComSPS* pSPS); |
---|
| 147 | Void allocAPS (TComAPS* pAPS, TComSPS* pSPS); |
---|
[2] | 148 | protected: |
---|
[56] | 149 | Void encodeAPS (TComAPS* pcAPS, TComOutputBitstream& APSbs, TComSlice* pcSlice); //!< encode APS syntax elements |
---|
| 150 | Void assignNewAPS(TComAPS& cAPS, Int apsID, std::vector<TComAPS>& vAPS, TComSlice* pcSlice); //!< Assign APS object into APS container |
---|
| 151 | |
---|
[2] | 152 | |
---|
[56] | 153 | protected: |
---|
| 154 | Void xInitGOP ( Int iPOC, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut ); |
---|
| 155 | Void xGetBuffer ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, UInt uiPOCCurr ); |
---|
[2] | 156 | |
---|
[56] | 157 | Void xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime ); |
---|
| 158 | |
---|
[2] | 159 | UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1); |
---|
| 160 | |
---|
| 161 | Double xCalculateRVM(); |
---|
| 162 | |
---|
[56] | 163 | Void xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid ); |
---|
| 164 | };// END CLASS DEFINITION TEncGOP |
---|
[2] | 165 | |
---|
[56] | 166 | // ==================================================================================================================== |
---|
| 167 | // Enumeration |
---|
| 168 | // ==================================================================================================================== |
---|
| 169 | enum PROCESSING_STATE |
---|
| 170 | { |
---|
| 171 | EXECUTE_INLOOPFILTER, |
---|
| 172 | ENCODE_APS, |
---|
| 173 | ENCODE_SLICE |
---|
| 174 | }; |
---|
[2] | 175 | |
---|
[56] | 176 | enum SCALING_LIST_PARAMETER |
---|
| 177 | { |
---|
| 178 | SCALING_LIST_OFF, |
---|
| 179 | SCALING_LIST_DEFAULT, |
---|
| 180 | SCALING_LIST_FILE_READ |
---|
| 181 | }; |
---|
| 182 | |
---|
| 183 | //! \} |
---|
| 184 | |
---|
| 185 | #endif // __TENCGOP__ |
---|
| 186 | |
---|