source: 3DVCSoftware/branches/HTM-8.2-dev0-KWU/source/Lib/TLibEncoder/TEncTop.h @ 645

Last change on this file since 645 was 635, checked in by kwu-htm, 11 years ago

"JCT3V-E0227 : Inter-view MAD prediction for 3D multi-view video" is integrated by KWU. Configuration has changed by adding rate control for URQ and the integrated view-wise target bitrate allocation and inter-view MAD prediction.

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