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 | */ |
---|
33 | |
---|
34 | |
---|
35 | |
---|
36 | /** \file TAppEncTop.h |
---|
37 | \brief Encoder application class (header) |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef __TAPPENCTOP__ |
---|
41 | #define __TAPPENCTOP__ |
---|
42 | |
---|
43 | #include "../../Lib/TLibEncoder/TEncTop.h" |
---|
44 | #include "../../Lib/TLibVideoIO/TVideoIOYuv.h" |
---|
45 | #include "../../Lib/TLibVideoIO/TVideoIOBits.h" |
---|
46 | #include "../../Lib/TLibCommon/TComBitStream.h" |
---|
47 | #include "../../Lib/TLibCommon/TComDepthMapGenerator.h" |
---|
48 | #include "TAppEncCfg.h" |
---|
49 | //GT VSO |
---|
50 | #include "../../Lib/TLibRenderer/TRenTop.h" |
---|
51 | //GT VSO end |
---|
52 | |
---|
53 | // ==================================================================================================================== |
---|
54 | // Class definition |
---|
55 | // ==================================================================================================================== |
---|
56 | |
---|
57 | /// encoder application class |
---|
58 | class TAppEncTop : public TAppEncCfg |
---|
59 | { |
---|
60 | private: |
---|
61 | // class interface |
---|
62 | |
---|
63 | std::vector<TEncTop*> m_acTEncTopList ; |
---|
64 | std::vector<TEncTop*> m_acTEncDepthTopList ; |
---|
65 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvInputFileList; |
---|
66 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthInputFileList; |
---|
67 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvReconFileList; |
---|
68 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthReconFileList; |
---|
69 | |
---|
70 | TVideoIOBitsStartCode m_cTVideoIOBitsFile; ///< output bitstream file |
---|
71 | |
---|
72 | std::vector< TComList<TComPicYuv*>* > m_cListPicYuvRecList; ///< list of reconstruction YUV files |
---|
73 | std::vector< TComList<TComPicYuv*>* > m_cListPicYuvDepthRecList; ///< list of reconstruction YUV files |
---|
74 | std::vector<PicOrderCnt> m_aiNextPocToDump; |
---|
75 | std::vector<PicOrderCnt> m_aiNextDepthPocToDump; |
---|
76 | std::vector< std::map<PicOrderCnt, TComPicYuv*> > m_cListPicYuvRecMap; |
---|
77 | std::vector< std::map<PicOrderCnt, TComPicYuv*> > m_cListPicYuvDepthRecMap; |
---|
78 | |
---|
79 | TComList<TComBitstream*> m_cListBitstream; ///< list of bitstreams |
---|
80 | |
---|
81 | std::vector<Int> m_iFrameRcvdVector; ///< number of received frames |
---|
82 | std::vector<Int> m_iDepthFrameRcvdVector; ///< number of received frames |
---|
83 | |
---|
84 | #if DEPTH_MAP_GENERATION |
---|
85 | TComSPSAccess m_cSPSAccess; |
---|
86 | TComAUPicAccess m_cAUPicAccess; |
---|
87 | #endif |
---|
88 | |
---|
89 | #if HHI_VSO |
---|
90 | TRenTop m_cRendererTop; |
---|
91 | TRenModel m_cRendererModel; |
---|
92 | #endif |
---|
93 | |
---|
94 | protected: |
---|
95 | // initialization |
---|
96 | Void xCreateLib (); ///< create files & encoder class |
---|
97 | Void xInitLibCfg (); ///< initialize internal variables |
---|
98 | Void xInitLib (); ///< initialize encoder class |
---|
99 | Void xDestroyLib (); ///< destroy encoder class |
---|
100 | |
---|
101 | /// obtain required buffers |
---|
102 | Void xGetBuffer ( TComPicYuv*& rpcPicYuvRec, //GT: unused? |
---|
103 | TComBitstream*& rpcBitStream ); |
---|
104 | |
---|
105 | Void xGetBuffer ( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, std::vector< TComList<TComPicYuv*>*>& racBuffer ); |
---|
106 | |
---|
107 | /// delete allocated buffers |
---|
108 | Void xDeleteBuffer (); |
---|
109 | |
---|
110 | // file I/O |
---|
111 | Void xWriteOutput ( Int iViewIdx, Bool isDepth = false ); ///< write bitstream to file |
---|
112 | |
---|
113 | |
---|
114 | // util |
---|
115 | TComPic* xGetPicFromView ( Int iViewIdx, Int iPoc, Bool bDepth ); |
---|
116 | TComPicYuv* xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ); |
---|
117 | |
---|
118 | |
---|
119 | // Ref Data |
---|
120 | #if HHI_VSO |
---|
121 | Void xSetBaseLUT ( Int iViewIdxSource, Int iViewIdxTarget, TComMVDRefData* pcRefInfo, InterViewReference eView ); |
---|
122 | Void xSetBasePicYuv( Int iViewIdx, Int iPoc, TComMVDRefData* pcRefInfo, InterViewReference eView, bool bDepth ); ///< store pics from buffers in pcRefInfo |
---|
123 | #endif |
---|
124 | |
---|
125 | public: |
---|
126 | TAppEncTop(); |
---|
127 | virtual ~TAppEncTop(); |
---|
128 | |
---|
129 | Void encode (); ///< main encoding function |
---|
130 | #if HHI_VSO |
---|
131 | Void setupRenModel ( Int iPoc, Int iEncViewIdx, Int iEncContent ); |
---|
132 | Void setMVDPic ( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo ); // set MultiView References |
---|
133 | #endif |
---|
134 | Void getUsedPelsMap ( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedPelsMap ); |
---|
135 | std::vector<TComPic*> getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepthCoder ); // only for mvc functionality yet |
---|
136 | TComPic* getPicFromView ( Int iViewIdx, Int iPoc, Bool bDepth ) { return xGetPicFromView( iViewIdx, iPoc, bDepth ); } |
---|
137 | |
---|
138 | #if HHI_VSO |
---|
139 | TRenModel* getRenModel () { return &m_cRendererModel ; }; |
---|
140 | #endif |
---|
141 | |
---|
142 | #if DEPTH_MAP_GENERATION |
---|
143 | TComSPSAccess* getSPSAccess () { return &m_cSPSAccess; } |
---|
144 | TComAUPicAccess* getAUPicAccess() { return &m_cAUPicAccess; } |
---|
145 | #endif |
---|
146 | |
---|
147 | #if HHI_VSO |
---|
148 | private: |
---|
149 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvERFileList; |
---|
150 | std::map< Int, std::vector< TComPicYuv*> > m_cMapPicExtRefView; /// Buffer for external Reference files |
---|
151 | |
---|
152 | Int m_iLastFramePutInERViewBuffer; ///< Poc of last frame put to ERView Buffer |
---|
153 | Void xSetERPicYuvs( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo ); ///< store pic from buffer in pcReferenceInfo |
---|
154 | Void xStoreVSORefPicsInBuffer(); ///< read in External Ref pic from file and store in buffer |
---|
155 | #endif |
---|
156 | |
---|
157 | };// END CLASS DEFINITION TAppEncTop |
---|
158 | |
---|
159 | #endif // __TAPPENCTOP__ |
---|
160 | |
---|