[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 TAppEncTop.h |
---|
| 35 | \brief Encoder application class (header) |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __TAPPENCTOP__ |
---|
| 39 | #define __TAPPENCTOP__ |
---|
| 40 | |
---|
[56] | 41 | #include <list> |
---|
| 42 | #include <ostream> |
---|
| 43 | |
---|
| 44 | #include "TLibEncoder/TEncTop.h" |
---|
| 45 | #include "TLibVideoIO/TVideoIOYuv.h" |
---|
| 46 | #include "TLibCommon/AccessUnit.h" |
---|
[2] | 47 | #include "TAppEncCfg.h" |
---|
[56] | 48 | #include "TLibCommon/TComDepthMapGenerator.h" |
---|
| 49 | #if HHI_VSO || HHI_INTERVIEW_SKIP |
---|
[2] | 50 | #include "../../Lib/TLibRenderer/TRenTop.h" |
---|
[56] | 51 | #endif |
---|
[2] | 52 | |
---|
[56] | 53 | //! \ingroup TAppEncoder |
---|
| 54 | //! \{ |
---|
| 55 | |
---|
[2] | 56 | // ==================================================================================================================== |
---|
| 57 | // Class definition |
---|
| 58 | // ==================================================================================================================== |
---|
| 59 | |
---|
| 60 | /// encoder application class |
---|
| 61 | class TAppEncTop : public TAppEncCfg |
---|
| 62 | { |
---|
| 63 | private: |
---|
| 64 | // class interface |
---|
[100] | 65 | std::vector<TEncTop*> m_acTEncTopList ; |
---|
| 66 | std::vector<TEncTop*> m_acTEncDepthTopList ; |
---|
| 67 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvInputFileList; ///< input YUV file |
---|
[56] | 68 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthInputFileList; |
---|
[100] | 69 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvReconFileList; ///< output reconstruction file |
---|
[56] | 70 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthReconFileList; |
---|
[2] | 71 | |
---|
[56] | 72 | std::vector< TComList<TComPicYuv*>* > m_picYuvRec; ///< list of reconstruction YUV files |
---|
| 73 | std::vector< TComList<TComPicYuv*>* > m_picYuvDepthRec; |
---|
[2] | 74 | |
---|
[100] | 75 | std::vector<Int> m_frameRcvd; ///< number of received frames |
---|
| 76 | std::vector<Int> m_depthFrameRcvd; |
---|
[2] | 77 | |
---|
[56] | 78 | unsigned m_essentialBytes; |
---|
| 79 | unsigned m_totalBytes; |
---|
[2] | 80 | |
---|
[5] | 81 | #if DEPTH_MAP_GENERATION |
---|
[77] | 82 | #if VIDYO_VPS_INTEGRATION |
---|
| 83 | TComVPSAccess m_cVPSAccess; |
---|
| 84 | #endif |
---|
[2] | 85 | TComSPSAccess m_cSPSAccess; |
---|
| 86 | TComAUPicAccess m_cAUPicAccess; |
---|
[5] | 87 | #endif |
---|
[56] | 88 | |
---|
[210] | 89 | #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046 |
---|
[77] | 90 | TComVPS m_cVPS; |
---|
| 91 | #endif |
---|
| 92 | |
---|
[5] | 93 | #if HHI_VSO |
---|
[2] | 94 | TRenTop m_cRendererTop; |
---|
[5] | 95 | TRenModel m_cRendererModel; |
---|
[2] | 96 | #endif |
---|
| 97 | |
---|
[56] | 98 | #if HHI_INTERVIEW_SKIP |
---|
| 99 | TRenTop m_cUsedPelsRenderer; ///< renderer for used pels map |
---|
| 100 | #endif |
---|
[231] | 101 | |
---|
[2] | 102 | protected: |
---|
| 103 | // initialization |
---|
| 104 | Void xCreateLib (); ///< create files & encoder class |
---|
| 105 | Void xInitLibCfg (); ///< initialize internal variables |
---|
| 106 | Void xInitLib (); ///< initialize encoder class |
---|
| 107 | Void xDestroyLib (); ///< destroy encoder class |
---|
| 108 | |
---|
| 109 | /// obtain required buffers |
---|
[56] | 110 | Void xGetBuffer(TComPicYuv*& rpcPicYuvRec, Int iViewIdx, Bool isDepth); |
---|
[2] | 111 | |
---|
| 112 | /// delete allocated buffers |
---|
| 113 | Void xDeleteBuffer (); |
---|
| 114 | |
---|
| 115 | // file I/O |
---|
[56] | 116 | Void xWriteOutput(std::ostream& bitstreamFile, Int iNumEncoded, std::list<AccessUnit>& accessUnits, Int iViewIdx, Bool isDepth); ///< write bitstream to file |
---|
| 117 | void rateStatsAccum(const AccessUnit& au, const std::vector<unsigned>& stats); |
---|
| 118 | // void printRateSummary(); |
---|
| 119 | |
---|
| 120 | TComPic* xGetPicFromView( Int viewId, Int iPoc, Bool isDepth ); |
---|
[2] | 121 | TComPicYuv* xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ); |
---|
| 122 | |
---|
| 123 | public: |
---|
| 124 | TAppEncTop(); |
---|
| 125 | virtual ~TAppEncTop(); |
---|
[100] | 126 | |
---|
[102] | 127 | |
---|
[2] | 128 | Void encode (); ///< main encoding function |
---|
[56] | 129 | TEncTop* getTEncTop( Int viewId, Bool isDepth ); |
---|
| 130 | |
---|
| 131 | std::vector<TComPic*> getInterViewRefPics( Int viewId, Int poc, Bool isDepth, TComSPS* sps ); |
---|
| 132 | TComPic* getPicFromView ( Int viewId, Int poc, Bool isDepth ) { return xGetPicFromView( viewId, poc, isDepth ); } |
---|
| 133 | TComPicYuv* getPicYuvFromView ( Int iViewIdx, Int iPoc, bool bDepth, Bool bRecon ) { return xGetPicYuvFromView( iViewIdx, iPoc, bDepth, bRecon ); } |
---|
| 134 | |
---|
| 135 | #if HHI_INTERVIEW_SKIP |
---|
| 136 | Void getUsedPelsMap ( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedPelsMap ); |
---|
| 137 | #endif |
---|
[5] | 138 | #if HHI_VSO |
---|
[100] | 139 | Void setupRenModel ( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset ); |
---|
[5] | 140 | #endif |
---|
[56] | 141 | |
---|
[210] | 142 | #if QC_MVHEVC_B0046 |
---|
| 143 | TComVPS* getVPS() { return &m_cVPS; } |
---|
| 144 | #endif |
---|
[77] | 145 | #if VIDYO_VPS_INTEGRATION |
---|
| 146 | TComVPS* getVPS() { return &m_cVPS; } |
---|
| 147 | TComVPSAccess* getVPSAccess () { return &m_cVPSAccess; } |
---|
| 148 | #endif |
---|
| 149 | |
---|
[5] | 150 | #if DEPTH_MAP_GENERATION |
---|
[2] | 151 | TComSPSAccess* getSPSAccess () { return &m_cSPSAccess; } |
---|
| 152 | TComAUPicAccess* getAUPicAccess() { return &m_cAUPicAccess; } |
---|
[5] | 153 | #endif |
---|
[2] | 154 | |
---|
[5] | 155 | #if HHI_VSO |
---|
[56] | 156 | TRenModel* getRenModel () { return &m_cRendererModel ; }; |
---|
| 157 | #endif |
---|
| 158 | |
---|
| 159 | #if HHI_VSO |
---|
[2] | 160 | private: |
---|
| 161 | Void xStoreVSORefPicsInBuffer(); ///< read in External Ref pic from file and store in buffer |
---|
[5] | 162 | #endif |
---|
[189] | 163 | |
---|
| 164 | #if RWTH_SDC_DLT_B0036 |
---|
| 165 | Void xAnalyzeInputBaseDepth(Int iViewIdx, UInt uiNumFrames); |
---|
| 166 | #endif |
---|
[56] | 167 | |
---|
[231] | 168 | #if MERL_VSP_C0152 |
---|
| 169 | Void setBWVSPLUT( Int iCodedViewIdx, Int gopId, Bool isDepth); |
---|
| 170 | #endif |
---|
[2] | 171 | };// END CLASS DEFINITION TAppEncTop |
---|
| 172 | |
---|
[56] | 173 | //! \} |
---|
| 174 | |
---|
[2] | 175 | #endif // __TAPPENCTOP__ |
---|
| 176 | |
---|