source: 3DVCSoftware/branches/HTM-15.1-MV-draft-4/source/Lib/TLibEncoder/TEncTop.h @ 1389

Last change on this file since 1389 was 1325, checked in by tech, 10 years ago

Removed 3D-HEVC.

  • Property svn:eol-style set to native
File size: 11.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-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/// encoder class
68class TEncTop : public TEncCfg
69{
70private:
71  // picture
72  Int                     m_iPOCLast;                     ///< time index (POC)
73  Int                     m_iNumPicRcvd;                  ///< number of received pictures
74  UInt                    m_uiNumAllPicCoded;             ///< number of coded pictures
75#if !NH_MV
76  TComList<TComPic*>      m_cListPic;                     ///< dynamic list of pictures
77#endif
78
79#if NH_MV
80  TComPicLists*           m_ivPicLists;                   ///< access to picture lists of other layers
81#endif
82  // encoder search
83  TEncSearch              m_cSearch;                      ///< encoder search class
84  //TEncEntropy*            m_pcEntropyCoder;                     ///< entropy encoder
85  TEncCavlc*              m_pcCavlcCoder;                       ///< CAVLC encoder
86  // coding tool
87  TComTrQuant             m_cTrQuant;                     ///< transform & quantization class
88  TComLoopFilter          m_cLoopFilter;                  ///< deblocking filter class
89  TEncSampleAdaptiveOffset m_cEncSAO;                     ///< sample adaptive offset class
90  TEncEntropy             m_cEntropyCoder;                ///< entropy encoder
91  TEncCavlc               m_cCavlcCoder;                  ///< CAVLC encoder
92  TEncSbac                m_cSbacCoder;                   ///< SBAC encoder
93  TEncBinCABAC            m_cBinCoderCABAC;               ///< bin coder CABAC
94
95  // processing unit
96  TEncGOP                 m_cGOPEncoder;                  ///< GOP encoder
97  TEncSlice               m_cSliceEncoder;                ///< slice encoder
98  TEncCu                  m_cCuEncoder;                   ///< CU encoder
99  // SPS
100  TComSPS                 m_cSPS;                         ///< SPS. This is the base value. This is copied to TComPicSym
101  TComPPS                 m_cPPS;                         ///< PPS. This is the base value. This is copied to TComPicSym
102  // RD cost computation
103  TComRdCost              m_cRdCost;                      ///< RD cost computation class
104  TEncSbac***             m_pppcRDSbacCoder;              ///< temporal storage for RD computation
105  TEncSbac                m_cRDGoOnSbacCoder;             ///< going on SBAC model for RD stage
106#if FAST_BIT_EST
107  TEncBinCABACCounter***  m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
108  TEncBinCABACCounter     m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
109#else
110  TEncBinCABAC***         m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
111  TEncBinCABAC            m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
112#endif
113
114  // quality control
115  TEncPreanalyzer         m_cPreanalyzer;                 ///< image characteristics analyzer for TM5-step3-like adaptive QP
116
117  TEncRateCtrl            m_cRateCtrl;                    ///< Rate control class
118
119#if NH_MV
120  TEncAnalyze             m_cAnalyzeAll;
121  TEncAnalyze             m_cAnalyzeI;
122  TEncAnalyze             m_cAnalyzeP;
123  TEncAnalyze             m_cAnalyzeB;
124  TEncAnalyze             m_cAnalyzeAll_in;
125#endif
126protected:
127  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
128  Void  xInitVPS          ();                             ///< initialize VPS from encoder options
129  Void  xInitSPS          ();                             ///< initialize SPS from encoder options
130  Void  xInitPPS          ();                             ///< initialize PPS from encoder options
131  Void  xInitScalingLists();                              ///< initialize scaling lists
132  Void  xInitHrdParameters();                             ///< initialize HRD parameters
133
134  Void  xInitPPSforTiles  ();
135  Void  xInitRPS          (Bool isFieldCoding);           ///< initialize PPS from encoder options
136
137public:
138  TEncTop();
139  virtual ~TEncTop();
140
141  Void      create          ();
142  Void      destroy         ();
143  Void      init            (Bool isFieldCoding);
144#if NH_MV 
145  TComPicLists* getIvPicLists() { return m_ivPicLists; }
146#endif
147  Void      deletePicBuffer ();
148#if NH_MV
149  Void      initNewPic(TComPicYuv* pcPicYuvOrg);
150#endif
151  // -------------------------------------------------------------------------------------------------------------------
152  // member access functions
153  // -------------------------------------------------------------------------------------------------------------------
154
155#if NH_MV
156  TComList<TComPic*>*     getListPic            () { return  m_ivPicLists->getSubDpb( getLayerId(), false);             }
157#else
158  TComList<TComPic*>*     getListPic            () { return  &m_cListPic;             }
159#endif
160  TEncSearch*             getPredSearch         () { return  &m_cSearch;              }
161
162  TComTrQuant*            getTrQuant            () { return  &m_cTrQuant;             }
163  TComLoopFilter*         getLoopFilter         () { return  &m_cLoopFilter;          }
164  TEncSampleAdaptiveOffset* getSAO              () { return  &m_cEncSAO;              }
165  TEncGOP*                getGOPEncoder         () { return  &m_cGOPEncoder;          }
166  TEncSlice*              getSliceEncoder       () { return  &m_cSliceEncoder;        }
167  TEncCu*                 getCuEncoder          () { return  &m_cCuEncoder;           }
168  TEncEntropy*            getEntropyCoder       () { return  &m_cEntropyCoder;        }
169  TEncCavlc*              getCavlcCoder         () { return  &m_cCavlcCoder;          }
170  TEncSbac*               getSbacCoder          () { return  &m_cSbacCoder;           }
171  TEncBinCABAC*           getBinCABAC           () { return  &m_cBinCoderCABAC;       }
172
173  TComRdCost*             getRdCost             () { return  &m_cRdCost;              }
174  TEncSbac***             getRDSbacCoder        () { return  m_pppcRDSbacCoder;       }
175  TEncSbac*               getRDGoOnSbacCoder    () { return  &m_cRDGoOnSbacCoder;     }
176  TEncRateCtrl*           getRateCtrl           () { return &m_cRateCtrl;             }
177  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid );
178  Int getReferencePictureSetIdxForSOP(Int POCCurr, Int GOPid );
179#if NH_MV
180  TEncAnalyze*            getAnalyzeAll         () { return &m_cAnalyzeAll; }
181  TEncAnalyze*            getAnalyzeI           () { return &m_cAnalyzeI;   }
182  TEncAnalyze*            getAnalyzeP           () { return &m_cAnalyzeP;   }
183  TEncAnalyze*            getAnalyzeB           () { return &m_cAnalyzeB;   }
184  Int                     getNumAllPicCoded     () { return m_uiNumAllPicCoded; } 
185  Int                     getFrameId            (Int iGOPid); 
186  TComPic*                getPic                ( Int poc );
187  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
188#endif
189  // -------------------------------------------------------------------------------------------------------------------
190  // encoder function
191  // -------------------------------------------------------------------------------------------------------------------
192
193  /// encode several number of pictures until end-of-sequence
194#if NH_MV
195  Void encode( Bool bEos,
196    TComPicYuv* pcPicYuvOrg,
197    TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
198    TComList<TComPicYuv*>& rcListPicYuvRecOut,
199    std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Int gopId );
200
201  /// encode several number of pictures until end-of-sequence
202  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg,
203    TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
204    TComList<TComPicYuv*>& rcListPicYuvRecOut,
205    std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff, Int gopId);
206#else
207  Void encode( Bool bEos,
208               TComPicYuv* pcPicYuvOrg,
209               TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
210               TComList<TComPicYuv*>& rcListPicYuvRecOut,
211               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded );
212
213  /// encode several number of pictures until end-of-sequence
214  Void encode( Bool bEos, TComPicYuv* pcPicYuvOrg,
215               TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
216               TComList<TComPicYuv*>& rcListPicYuvRecOut,
217               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Bool isTff);
218#endif
219  Void printSummary(Bool isField) { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_cSPS.getBitDepths()); }
220
221};
222
223//! \}
224
225#endif // __TENCTOP__
226
Note: See TracBrowser for help on using the repository browser.