source: 3DVCSoftware/branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.h @ 478

Last change on this file since 478 was 478, checked in by tech, 11 years ago

Minor clean ups.

  • Property svn:eol-style set to native
File size: 12.3 KB
Line 
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-2013, ITU/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 ITU/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/** \file     TEncTop.h
35    \brief    encoder class (header)
36*/
37
38#ifndef __TENCTOP__
39#define __TENCTOP__
40
41// Include files
42#include "TLibCommon/TComList.h"
43#include "TLibCommon/TComPrediction.h"
44#include "TLibCommon/TComTrQuant.h"
45#include "TLibCommon/AccessUnit.h"
46
47#include "TLibVideoIO/TVideoIOYuv.h"
48
49#include "TEncCfg.h"
50#include "TEncGOP.h"
51#include "TEncSlice.h"
52#include "TEncEntropy.h"
53#include "TEncCavlc.h"
54#include "TEncSbac.h"
55#include "TEncSearch.h"
56#include "TEncSampleAdaptiveOffset.h"
57#include "TEncPreanalyzer.h"
58#include "TEncRateCtrl.h"
59#if H_3D_IV_MERGE
60#include "TLibCommon/TComDepthMapGenerator.h"
61#endif
62//! \ingroup TLibEncoder
63//! \{
64
65// ====================================================================================================================
66// Class definition
67// ====================================================================================================================
68
69#if H_3D_IV_MERGE
70class TAppEncTop;
71#endif
72/// encoder class
73class TEncTop : public TEncCfg
74{
75private:
76  // picture
77  Int                     m_iPOCLast;                     ///< time index (POC)
78  Int                     m_iNumPicRcvd;                  ///< number of received pictures
79  UInt                    m_uiNumAllPicCoded;             ///< number of coded pictures
80  TComList<TComPic*>      m_cListPic;                     ///< dynamic list of pictures
81 
82#if H_MV
83  TComPicLists*           m_ivPicLists;                   ///< access to picture lists of other layers
84#endif
85  // encoder search
86  TEncSearch              m_cSearch;                      ///< encoder search class
87  TEncEntropy*            m_pcEntropyCoder;                     ///< entropy encoder
88  TEncCavlc*              m_pcCavlcCoder;                       ///< CAVLC encoder 
89  // coding tool
90  TComTrQuant             m_cTrQuant;                     ///< transform & quantization class
91  TComLoopFilter          m_cLoopFilter;                  ///< deblocking filter class
92  TEncSampleAdaptiveOffset m_cEncSAO;                     ///< sample adaptive offset class
93  TEncEntropy             m_cEntropyCoder;                ///< entropy encoder
94  TEncCavlc               m_cCavlcCoder;                  ///< CAVLC encoder
95  TEncSbac                m_cSbacCoder;                   ///< SBAC encoder
96  TEncBinCABAC            m_cBinCoderCABAC;               ///< bin coder CABAC
97  TEncSbac*               m_pcSbacCoders;                 ///< SBAC encoders (to encode substreams )
98  TEncBinCABAC*           m_pcBinCoderCABACs;             ///< bin coders CABAC (one per substream)
99 
100  // processing unit
101  TEncGOP                 m_cGOPEncoder;                  ///< GOP encoder
102  TEncSlice               m_cSliceEncoder;                ///< slice encoder
103  TEncCu                  m_cCuEncoder;                   ///< CU encoder
104#if H_3D_IV_MERGE
105  TComDepthMapGenerator   m_cDepthMapGenerator;           ///< depth map generator
106#endif
107  // SPS
108  TComSPS                 m_cSPS;                         ///< SPS
109  TComPPS                 m_cPPS;                         ///< PPS
110  // RD cost computation
111  TComBitCounter          m_cBitCounter;                  ///< bit counter for RD optimization
112  TComRdCost              m_cRdCost;                      ///< RD cost computation class
113  TEncSbac***             m_pppcRDSbacCoder;              ///< temporal storage for RD computation
114  TEncSbac                m_cRDGoOnSbacCoder;             ///< going on SBAC model for RD stage
115#if FAST_BIT_EST
116  TEncBinCABACCounter***  m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
117  TEncBinCABACCounter     m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
118#else
119  TEncBinCABAC***         m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
120  TEncBinCABAC            m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
121#endif
122  Int                     m_iNumSubstreams;                ///< # of top-level elements allocated.
123  TComBitCounter*         m_pcBitCounters;                 ///< bit counters for RD optimization per substream
124  TComRdCost*             m_pcRdCosts;                     ///< RD cost computation class per substream
125  TEncSbac****            m_ppppcRDSbacCoders;             ///< temporal storage for RD computation per substream
126  TEncSbac*               m_pcRDGoOnSbacCoders;            ///< going on SBAC model for RD stage per substream
127  TEncBinCABAC****        m_ppppcBinCodersCABAC;           ///< temporal CABAC state storage for RD computation per substream
128  TEncBinCABAC*           m_pcRDGoOnBinCodersCABAC;        ///< going on bin coder CABAC for RD stage per substream
129
130#if H_3D_IV_MERGE 
131  TAppEncTop*             m_pcTAppEncTop;
132#endif
133  // quality control
134  TEncPreanalyzer         m_cPreanalyzer;                 ///< image characteristics analyzer for TM5-step3-like adaptive QP
135
136  TComScalingList         m_scalingList;                 ///< quantization matrix information
137  TEncRateCtrl            m_cRateCtrl;                    ///< Rate control class
138 
139#if H_MV
140  TEncAnalyze             m_cAnalyzeAll;
141  TEncAnalyze             m_cAnalyzeI;
142  TEncAnalyze             m_cAnalyzeP;
143  TEncAnalyze             m_cAnalyzeB; 
144#endif
145protected:
146  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
147  Void  xInitSPS          ();                             ///< initialize SPS from encoder options
148  Void  xInitPPS          ();                             ///< initialize PPS from encoder options
149 
150  Void  xInitPPSforTiles  ();
151  Void  xInitRPS          ();                             ///< initialize PPS from encoder options
152
153public:
154  TEncTop();
155  virtual ~TEncTop();
156 
157  Void      create          ();
158  Void      destroy         ();
159#if H_3D_IV_MERGE
160  Void      init            ( TAppEncTop* pcTAppEncTop );
161#else
162  Void      init            ();
163#endif
164#if H_MV 
165  TComPicLists* getIvPicLists() { return m_ivPicLists; }
166#endif
167  Void      deletePicBuffer ();
168
169  Void      createWPPCoders(Int iNumSubstreams);
170 
171#if H_MV
172  Void      initNewPic(TComPicYuv* pcPicYuvOrg);
173#endif
174  // -------------------------------------------------------------------------------------------------------------------
175  // member access functions
176  // -------------------------------------------------------------------------------------------------------------------
177 
178  TComList<TComPic*>*     getListPic            () { return  &m_cListPic;             }
179  TEncSearch*             getPredSearch         () { return  &m_cSearch;              }
180 
181  TComTrQuant*            getTrQuant            () { return  &m_cTrQuant;             }
182  TComLoopFilter*         getLoopFilter         () { return  &m_cLoopFilter;          }
183  TEncSampleAdaptiveOffset* getSAO              () { return  &m_cEncSAO;              }
184  TEncGOP*                getGOPEncoder         () { return  &m_cGOPEncoder;          }
185  TEncSlice*              getSliceEncoder       () { return  &m_cSliceEncoder;        }
186  TEncCu*                 getCuEncoder          () { return  &m_cCuEncoder;           }
187  TEncEntropy*            getEntropyCoder       () { return  &m_cEntropyCoder;        }
188  TEncCavlc*              getCavlcCoder         () { return  &m_cCavlcCoder;          }
189  TEncSbac*               getSbacCoder          () { return  &m_cSbacCoder;           }
190  TEncBinCABAC*           getBinCABAC           () { return  &m_cBinCoderCABAC;       }
191  TEncSbac*               getSbacCoders     () { return  m_pcSbacCoders;      }
192  TEncBinCABAC*           getBinCABACs          () { return  m_pcBinCoderCABACs;      }
193 
194  TComBitCounter*         getBitCounter         () { return  &m_cBitCounter;          }
195  TComRdCost*             getRdCost             () { return  &m_cRdCost;              }
196  TEncSbac***             getRDSbacCoder        () { return  m_pppcRDSbacCoder;       }
197  TEncSbac*               getRDGoOnSbacCoder    () { return  &m_cRDGoOnSbacCoder;     }
198  TComBitCounter*         getBitCounters        () { return  m_pcBitCounters;         }
199  TComRdCost*             getRdCosts            () { return  m_pcRdCosts;             }
200  TEncSbac****            getRDSbacCoders       () { return  m_ppppcRDSbacCoders;     }
201  TEncSbac*               getRDGoOnSbacCoders   () { return  m_pcRDGoOnSbacCoders;   }
202  TEncRateCtrl*           getRateCtrl           () { return &m_cRateCtrl;             }
203#if H_3D_IV_MERGE
204  TAppEncTop*             getEncTop             () { return m_pcTAppEncTop; }
205#endif
206  TComSPS*                getSPS                () { return  &m_cSPS;                 }
207  TComPPS*                getPPS                () { return  &m_cPPS;                 }
208  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid );
209#if L0208_SOP_DESCRIPTION_SEI
210  Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid );
211#endif
212  TComScalingList*        getScalingList        () { return  &m_scalingList;         }
213#if H_MV
214  TEncAnalyze*            getAnalyzeAll         () { return &m_cAnalyzeAll; }
215  TEncAnalyze*            getAnalyzeI           () { return &m_cAnalyzeI;   }
216  TEncAnalyze*            getAnalyzeP           () { return &m_cAnalyzeP;   }
217  TEncAnalyze*            getAnalyzeB           () { return &m_cAnalyzeB;   }
218
219  Int                     getNumAllPicCoded     () { return m_uiNumAllPicCoded; }
220 
221  Int                     getFrameId            (Int iGOPid);
222 
223  TComPic*                getPic                ( Int poc );
224  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
225#endif
226#if H_3D_IV_MERGE
227  TComDepthMapGenerator*  getDepthMapGenerator  () { return  &m_cDepthMapGenerator;   }
228#endif
229  // -------------------------------------------------------------------------------------------------------------------
230  // encoder function
231  // -------------------------------------------------------------------------------------------------------------------
232
233  /// encode several number of pictures until end-of-sequence
234#if H_MV
235  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded  , Int gopId  ); 
236#else
237  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
238              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded ); 
239#endif
240
241#if H_MV
242  Void printSummary      ( Int numAllPicCoded ); 
243#else
244  void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); } 
245#endif
246
247#if H_3D
248   Void setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset );
249#endif
250};
251
252//! \}
253
254#endif // __TENCTOP__
Note: See TracBrowser for help on using the repository browser.