source: 3DVCSoftware/branches/HTM-15.1-dev0/source/Lib/TLibEncoder/TEncTop.h @ 1327

Last change on this file since 1327 was 1321, checked in by tech, 9 years ago

Merged 15.0-dev0@1320.

  • Property svn:eol-style set to native
File size: 12.6 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-2015, 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/TComLoopFilter.h"
46#include "TLibCommon/AccessUnit.h"
47
48#include "TLibVideoIO/TVideoIOYuv.h"
49
50#include "TEncCfg.h"
51#include "TEncGOP.h"
52#include "TEncSlice.h"
53#include "TEncEntropy.h"
54#include "TEncCavlc.h"
55#include "TEncSbac.h"
56#include "TEncSearch.h"
57#include "TEncSampleAdaptiveOffset.h"
58#include "TEncPreanalyzer.h"
59#include "TEncRateCtrl.h"
60//! \ingroup TLibEncoder
61//! \{
62
63// ====================================================================================================================
64// Class definition
65// ====================================================================================================================
66
67#if KWU_RC_MADPRED_E0227
68class TAppEncTop;
69#endif
70/// encoder class
71class TEncTop : public TEncCfg
72{
73private:
74  // picture
75  Int                     m_iPOCLast;                     ///< time index (POC)
76  Int                     m_iNumPicRcvd;                  ///< number of received pictures
77  UInt                    m_uiNumAllPicCoded;             ///< number of coded pictures
78#if !NH_MV
79  TComList<TComPic*>      m_cListPic;                     ///< dynamic list of pictures
80#endif
81
82#if NH_MV
83  TComPicLists*           m_ivPicLists;                   ///< access to picture lists of other layers
84#endif
85#if NH_3D_IC
86  Int *m_aICEnableCandidate;
87  Int *m_aICEnableNum;
88#endif
89  // encoder search
90  TEncSearch              m_cSearch;                      ///< encoder search class
91  //TEncEntropy*            m_pcEntropyCoder;                     ///< entropy encoder
92  TEncCavlc*              m_pcCavlcCoder;                       ///< CAVLC encoder
93  // coding tool
94  TComTrQuant             m_cTrQuant;                     ///< transform & quantization class
95  TComLoopFilter          m_cLoopFilter;                  ///< deblocking filter class
96  TEncSampleAdaptiveOffset m_cEncSAO;                     ///< sample adaptive offset class
97  TEncEntropy             m_cEntropyCoder;                ///< entropy encoder
98  TEncCavlc               m_cCavlcCoder;                  ///< CAVLC encoder
99  TEncSbac                m_cSbacCoder;                   ///< SBAC encoder
100  TEncBinCABAC            m_cBinCoderCABAC;               ///< bin coder CABAC
101
102  // processing unit
103  TEncGOP                 m_cGOPEncoder;                  ///< GOP encoder
104  TEncSlice               m_cSliceEncoder;                ///< slice encoder
105  TEncCu                  m_cCuEncoder;                   ///< CU encoder
106  // SPS
107  TComSPS                 m_cSPS;                         ///< SPS. This is the base value. This is copied to TComPicSym
108  TComPPS                 m_cPPS;                         ///< PPS. This is the base value. This is copied to TComPicSym
109  // RD cost computation
110  TComRdCost              m_cRdCost;                      ///< RD cost computation class
111  TEncSbac***             m_pppcRDSbacCoder;              ///< temporal storage for RD computation
112  TEncSbac                m_cRDGoOnSbacCoder;             ///< going on SBAC model for RD stage
113#if FAST_BIT_EST
114  TEncBinCABACCounter***  m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
115  TEncBinCABACCounter     m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
116#else
117  TEncBinCABAC***         m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
118  TEncBinCABAC            m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
119#endif
120
121  // quality control
122  TEncPreanalyzer         m_cPreanalyzer;                 ///< image characteristics analyzer for TM5-step3-like adaptive QP
123
124  TEncRateCtrl            m_cRateCtrl;                    ///< Rate control class
125
126#if KWU_RC_MADPRED_E0227
127  TAppEncTop*             m_pcTAppEncTop;
128  TAppComCamPara*         m_cCamParam;
129#endif
130#if NH_MV
131  TEncAnalyze             m_cAnalyzeAll;
132  TEncAnalyze             m_cAnalyzeI;
133  TEncAnalyze             m_cAnalyzeP;
134  TEncAnalyze             m_cAnalyzeB;
135  TEncAnalyze             m_cAnalyzeAll_in;
136#endif
137protected:
138  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
139  Void  xInitVPS          ();                             ///< initialize VPS from encoder options
140  Void  xInitSPS          ();                             ///< initialize SPS from encoder options
141  Void  xInitPPS          ();                             ///< initialize PPS from encoder options
142  Void  xInitScalingLists();                              ///< initialize scaling lists
143  Void  xInitHrdParameters();                             ///< initialize HRD parameters
144
145  Void  xInitPPSforTiles  ();
146  Void  xInitRPS          (Bool isFieldCoding);           ///< initialize PPS from encoder options
147
148public:
149  TEncTop();
150  virtual ~TEncTop();
151
152  Void      create          ();
153  Void      destroy         ();
154#if KWU_RC_MADPRED_E0227
155  Void      init            ( TAppEncTop* pcTAppEncTop, Bool isFieldCoding );
156#else
157  Void      init            (Bool isFieldCoding);
158#endif
159#if NH_MV 
160  TComPicLists* getIvPicLists() { return m_ivPicLists; }
161#endif
162#if NH_3D_IC
163  Int*      getICEnableCandidate() { return m_aICEnableCandidate; }
164  Int*      getICEnableNum() { return m_aICEnableNum; }
165#endif
166  Void      deletePicBuffer ();
167#if NH_MV
168  Void      initNewPic(TComPicYuv* pcPicYuvOrg);
169#endif
170  // -------------------------------------------------------------------------------------------------------------------
171  // member access functions
172  // -------------------------------------------------------------------------------------------------------------------
173
174#if NH_MV
175  TComList<TComPic*>*     getListPic            () { return  m_ivPicLists->getSubDpb( getLayerId(), false);             }
176#else
177  TComList<TComPic*>*     getListPic            () { return  &m_cListPic;             }
178#endif
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
192  TComRdCost*             getRdCost             () { return  &m_cRdCost;              }
193  TEncSbac***             getRDSbacCoder        () { return  m_pppcRDSbacCoder;       }
194  TEncSbac*               getRDGoOnSbacCoder    () { return  &m_cRDGoOnSbacCoder;     }
195  TEncRateCtrl*           getRateCtrl           () { return &m_cRateCtrl;             }
196#if KWU_RC_MADPRED_E0227
197  TAppEncTop*             getEncTop             () { return m_pcTAppEncTop; }
198  TAppComCamPara*         getCamParam()                 { return m_cCamParam;}
199  Void                    setCamParam(TAppComCamPara * pCamparam)                 { m_cCamParam = pCamparam;}
200#endif
201  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid );
202  Int getReferencePictureSetIdxForSOP(Int POCCurr, Int GOPid );
203#if NH_MV
204  TEncAnalyze*            getAnalyzeAll         () { return &m_cAnalyzeAll; }
205  TEncAnalyze*            getAnalyzeI           () { return &m_cAnalyzeI;   }
206  TEncAnalyze*            getAnalyzeP           () { return &m_cAnalyzeP;   }
207  TEncAnalyze*            getAnalyzeB           () { return &m_cAnalyzeB;   }
208  Int                     getNumAllPicCoded     () { return m_uiNumAllPicCoded; } 
209  Int                     getFrameId            (Int iGOPid); 
210  TComPic*                getPic                ( Int poc );
211  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
212#endif
213#if NH_3D
214  Void                    setSps3dExtension     ( TComSps3dExtension sps3dExtension ) { m_cSPS.setSps3dExtension( sps3dExtension );  };
215#endif
216#if NH_3D_IC
217  Void                    setICEnableCandidate         ( Int* ICEnableCandidate) { m_aICEnableCandidate = ICEnableCandidate; }
218  Void                    setICEnableNum         ( Int* ICEnableNum) { m_aICEnableNum = ICEnableNum; }
219#endif
220  // -------------------------------------------------------------------------------------------------------------------
221  // encoder function
222  // -------------------------------------------------------------------------------------------------------------------
223
224  /// encode several number of pictures until end-of-sequence
225#if NH_MV
226  Void encode( Bool bEos,
227    TComPicYuv* pcPicYuvOrg,
228    TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
229    TComList<TComPicYuv*>& rcListPicYuvRecOut,
230    std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Int gopId );
231
232  /// encode several number of pictures until end-of-sequence
233  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg,
234    TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
235    TComList<TComPicYuv*>& rcListPicYuvRecOut,
236    std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff, Int gopId);
237#else
238  Void encode( Bool bEos,
239               TComPicYuv* pcPicYuvOrg,
240               TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
241               TComList<TComPicYuv*>& rcListPicYuvRecOut,
242               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded );
243
244  /// encode several number of pictures until end-of-sequence
245  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg,
246               TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
247               TComList<TComPicYuv*>& rcListPicYuvRecOut,
248               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff);
249#endif
250  Void printSummary(Bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_cSPS.getBitDepths()); }
251
252#if NH_3D_VSO
253   Void setupRenModel( Int iPoc, Int iEncViewIdx, Int iEncContent, Int iHorOffset, Int maxCuHeight ); 
254#endif
255};
256
257//! \}
258
259#endif // __TENCTOP__
260
Note: See TracBrowser for help on using the repository browser.