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 | #if POZNAN_MP |
---|
54 | #include "../../Lib/TLibCommon/TComMP.h" |
---|
55 | #endif |
---|
56 | |
---|
57 | // ==================================================================================================================== |
---|
58 | // Class definition |
---|
59 | // ==================================================================================================================== |
---|
60 | |
---|
61 | /// encoder application class |
---|
62 | class TAppEncTop : public TAppEncCfg |
---|
63 | { |
---|
64 | private: |
---|
65 | // class interface |
---|
66 | |
---|
67 | std::vector<TEncTop*> m_acTEncTopList ; |
---|
68 | std::vector<TEncTop*> m_acTEncDepthTopList ; |
---|
69 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvInputFileList; |
---|
70 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthInputFileList; |
---|
71 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvReconFileList; |
---|
72 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvDepthReconFileList; |
---|
73 | |
---|
74 | TVideoIOBitsStartCode m_cTVideoIOBitsFile; ///< output bitstream file |
---|
75 | |
---|
76 | std::vector< TComList<TComPicYuv*>* > m_cListPicYuvRecList; ///< list of reconstruction YUV files |
---|
77 | std::vector< TComList<TComPicYuv*>* > m_cListPicYuvDepthRecList; ///< list of reconstruction YUV files |
---|
78 | std::vector<PicOrderCnt> m_aiNextPocToDump; |
---|
79 | std::vector<PicOrderCnt> m_aiNextDepthPocToDump; |
---|
80 | std::vector< std::map<PicOrderCnt, TComPicYuv*> > m_cListPicYuvRecMap; |
---|
81 | std::vector< std::map<PicOrderCnt, TComPicYuv*> > m_cListPicYuvDepthRecMap; |
---|
82 | |
---|
83 | TComList<TComBitstream*> m_cListBitstream; ///< list of bitstreams |
---|
84 | |
---|
85 | std::vector<Int> m_iFrameRcvdVector; ///< number of received frames |
---|
86 | std::vector<Int> m_iDepthFrameRcvdVector; ///< number of received frames |
---|
87 | |
---|
88 | #if DEPTH_MAP_GENERATION |
---|
89 | TComSPSAccess m_cSPSAccess; |
---|
90 | TComAUPicAccess m_cAUPicAccess; |
---|
91 | #endif |
---|
92 | |
---|
93 | #if HHI_VSO |
---|
94 | TRenTop m_cRendererTop; |
---|
95 | TRenModel m_cRendererModel; |
---|
96 | #endif |
---|
97 | |
---|
98 | #if POZNAN_CU_SKIP||POZNAN_CU_SYNTH |
---|
99 | TRenTop m_cAvailabilityRenderer; |
---|
100 | #endif |
---|
101 | |
---|
102 | #if POZNAN_MP |
---|
103 | TComMP* m_pcMP; |
---|
104 | #endif |
---|
105 | |
---|
106 | #if POZNAN_STAT_JK |
---|
107 | std::vector<FILE*> m_cStatFileList; ///< texure statistics file handles |
---|
108 | std::vector<FILE*> m_cDepthStatFileList; ///< depth statistics file handles |
---|
109 | #endif |
---|
110 | |
---|
111 | protected: |
---|
112 | // initialization |
---|
113 | Void xCreateLib (); ///< create files & encoder class |
---|
114 | Void xInitLibCfg (); ///< initialize internal variables |
---|
115 | Void xInitLib (); ///< initialize encoder class |
---|
116 | Void xDestroyLib (); ///< destroy encoder class |
---|
117 | |
---|
118 | /// obtain required buffers |
---|
119 | Void xGetBuffer ( TComPicYuv*& rpcPicYuvRec, //GT: unused? |
---|
120 | TComBitstream*& rpcBitStream ); |
---|
121 | |
---|
122 | Void xGetBuffer ( TComPicYuv*& rpcPicYuvRec, Int iViewIdx, std::vector< TComList<TComPicYuv*>*>& racBuffer ); |
---|
123 | |
---|
124 | /// delete allocated buffers |
---|
125 | Void xDeleteBuffer (); |
---|
126 | |
---|
127 | // file I/O |
---|
128 | Void xWriteOutput ( Int iViewIdx, Bool isDepth = false ); ///< write bitstream to file |
---|
129 | |
---|
130 | |
---|
131 | // util |
---|
132 | TComPic* xGetPicFromView ( Int iViewIdx, Int iPoc, Bool bDepth ); |
---|
133 | TComPicYuv* xGetPicYuvFromView( Int iViewIdx, Int iPoc, Bool bDepth, Bool bRecon ); |
---|
134 | |
---|
135 | |
---|
136 | // Ref Data |
---|
137 | #if HHI_VSO |
---|
138 | Void xSetBaseLUT ( Int iViewIdxSource, Int iViewIdxTarget, TComMVDRefData* pcRefInfo, InterViewReference eView ); |
---|
139 | Void xSetBasePicYuv( Int iViewIdx, Int iPoc, TComMVDRefData* pcRefInfo, InterViewReference eView, bool bDepth ); ///< store pics from buffers in pcRefInfo |
---|
140 | #endif |
---|
141 | |
---|
142 | public: |
---|
143 | TAppEncTop(); |
---|
144 | virtual ~TAppEncTop(); |
---|
145 | |
---|
146 | Void encode (); ///< main encoding function |
---|
147 | #if HHI_VSO |
---|
148 | Void setupRenModel ( Int iPoc, Int iEncViewIdx, Int iEncContent ); |
---|
149 | Void setMVDPic ( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo ); // set MultiView References |
---|
150 | #endif |
---|
151 | Void getUsedPelsMap ( Int iViewIdx, Int iPoc, TComPicYuv* pcPicYuvUsedPelsMap ); |
---|
152 | std::vector<TComPic*> getSpatialRefPics( Int iViewIdx, Int iPoc, Bool bIsDepthCoder ); // only for mvc functionality yet |
---|
153 | TComPic* getPicFromView ( Int iViewIdx, Int iPoc, Bool bDepth ) { return xGetPicFromView( iViewIdx, iPoc, bDepth ); } |
---|
154 | |
---|
155 | #if HHI_VSO |
---|
156 | TRenModel* getRenModel () { return &m_cRendererModel ; }; |
---|
157 | #endif |
---|
158 | |
---|
159 | #if DEPTH_MAP_GENERATION |
---|
160 | TComSPSAccess* getSPSAccess () { return &m_cSPSAccess; } |
---|
161 | TComAUPicAccess* getAUPicAccess() { return &m_cAUPicAccess; } |
---|
162 | #endif |
---|
163 | |
---|
164 | #if POZNAN_MP |
---|
165 | TComMP* getMP() {return m_pcMP;} |
---|
166 | #endif |
---|
167 | |
---|
168 | #if HHI_VSO |
---|
169 | private: |
---|
170 | std::vector<TVideoIOYuv*> m_acTVideoIOYuvERFileList; |
---|
171 | std::map< Int, std::vector< TComPicYuv*> > m_cMapPicExtRefView; /// Buffer for external Reference files |
---|
172 | |
---|
173 | Int m_iLastFramePutInERViewBuffer; ///< Poc of last frame put to ERView Buffer |
---|
174 | Void xSetERPicYuvs( Int iViewIdx, Int iPoc, TComMVDRefData* pcReferenceInfo ); ///< store pic from buffer in pcReferenceInfo |
---|
175 | Void xStoreVSORefPicsInBuffer(); ///< read in External Ref pic from file and store in buffer |
---|
176 | #endif |
---|
177 | |
---|
178 | |
---|
179 | #if POZNAN_CU_SYNTH |
---|
180 | private: |
---|
181 | Void xStoreSynthPicsInBuffer(Int iCoddedViewIdx, Bool bDepth); |
---|
182 | #endif |
---|
183 | |
---|
184 | };// END CLASS DEFINITION TAppEncTop |
---|
185 | |
---|
186 | #endif // __TAPPENCTOP__ |
---|
187 | |
---|