source: 3DVCSoftware/branches/0.2-poznan-univ/source/Lib/TLibEncoder/TEncTop.h @ 192

Last change on this file since 192 was 12, checked in by poznan-univ, 13 years ago

Poznan Tools

  • Depth base motion vector prediction
  • Property svn:eol-style set to native
File size: 11.2 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-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/** \file     TEncTop.h
36    \brief    encoder class (header)
37*/
38
39#ifndef __TENCTOP__
40#define __TENCTOP__
41
42// Include files
43#include "../TLibCommon/TComList.h"
44#include "../TLibCommon/TComPrediction.h"
45#include "../TLibCommon/TComTrQuant.h"
46#include "../TLibCommon/TComBitStream.h"
47#include "../TLibCommon/TComDepthMapGenerator.h"
48#include "../TLibCommon/TComResidualGenerator.h"
49
50#include "../TLibVideoIO/TVideoIOYuv.h"
51#include "../TLibVideoIO/TVideoIOBits.h"
52
53#include "TEncCfg.h"
54#include "TEncGOP.h"
55#include "TEncSlice.h"
56#include "TEncEntropy.h"
57#include "TEncCavlc.h"
58#include "TEncSbac.h"
59#include "TEncSearch.h"
60#include "TEncAdaptiveLoopFilter.h"
61
62#include "TEncSeqStructure.h"
63#include <map>
64#include "TEncAnalyze.h"
65
66#if POZNAN_MP
67#include "../TLibCommon/TComMP.h"
68#endif         
69
70// ====================================================================================================================
71// Class definition
72// ====================================================================================================================
73
74class TAppEncTop ;
75
76/// encoder class
77class TEncTop : public TEncCfg
78{
79private:
80  // picture
81  Int                     m_iPOCLast;                     ///< time index (POC)
82  Int                     m_iNumPicRcvd;                  ///< number of received pictures
83  UInt                    m_uiNumAllPicCoded;             ///< number of coded pictures
84  TComList<TComPic*>      m_cListPic;                     ///< dynamic list of pictures
85
86  Bool                    m_bSeqFirst ;
87  TEncSeqStructure::Iterator m_cSeqIter;
88  std::map<Int, TComPic*> m_acInputPicMap;
89  std::map<PicOrderCnt, TComPicYuv*> m_acOutputPicMap;
90
91  // encoder search
92  TEncSearch              m_cSearch;                      ///< encoder search class
93  TEncEntropy*            m_pcEntropyCoder;                     ///< entropy encoder
94  TEncCavlc*              m_pcCavlcCoder;                       ///< CAVLC encoder
95  // coding tool
96  TComTrQuant             m_cTrQuant;                     ///< transform & quantization class
97  TComLoopFilter          m_cLoopFilter;                  ///< deblocking filter class
98#if MTK_SAO
99  TEncSampleAdaptiveOffset  m_cEncSAO;                    ///< sample adaptive offset class
100#endif
101  TEncAdaptiveLoopFilter  m_cAdaptiveLoopFilter;          ///< adaptive loop filter class
102  TEncEntropy             m_cEntropyCoder;                ///< entropy encoder
103  TEncCavlc               m_cCavlcCoder;                  ///< CAVLC encoder
104  TEncSbac                m_cSbacCoder;                   ///< SBAC encoder
105  TEncBinCABAC            m_cBinCoderCABAC;               ///< bin coder CABAC
106
107  // processing unit
108  TEncPic                 m_cPicEncoder;                  ///< Pic encoder
109  TEncSlice               m_cSliceEncoder;                ///< slice encoder
110  TEncCu                  m_cCuEncoder;                   ///< CU encoder
111#if DEPTH_MAP_GENERATION
112  TComDepthMapGenerator   m_cDepthMapGenerator;           ///< depth map generator
113#endif
114#if HHI_INTER_VIEW_RESIDUAL_PRED
115  TComResidualGenerator   m_cResidualGenerator;           ///< generator for residual pictures
116#endif
117
118  // SPS
119  TComSPS                 m_cSPS;                         ///< SPS
120  TComPPS                 m_cPPS;                         ///< PPS
121
122  // RD cost computation
123  TComBitCounter          m_cBitCounter;                  ///< bit counter for RD optimization
124  TComRdCost              m_cRdCost;                      ///< RD cost computation class
125  TEncSbac***             m_pppcRDSbacCoder;              ///< temporal storage for RD computation
126  TEncSbac                m_cRDGoOnSbacCoder;             ///< going on SBAC model for RD stage
127  TEncBinCABAC***         m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
128  TEncBinCABAC            m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
129
130  std::vector<TEncTop*>*  m_pacTEncTopList;
131  TAppEncTop*             m_pcTAppEncTop;                 // SB better: design a new MVTop encoder class, instead of mixing lib and app
132
133  bool                    m_bPicWaitingForCoding;
134
135  PicOrderCnt             m_iFrameNumInCodingOrder;
136#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
137  Double                  m_dTextureCuDeltaQpOffset;
138  Double                  m_dTextureCuDeltaQpMul;
139  Int                     m_iTextureCuDeltaQpTopBottomRow; 
140#endif
141
142#if POZNAN_MP
143  TComMP*                                 m_pcMP;
144#endif
145
146protected:
147  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
148  Void  xInitSPS          ();                             ///< initialize SPS from encoder options
149#if CONSTRAINED_INTRA_PRED
150  Void  xInitPPS          ();                             ///< initialize PPS from encoder options
151#endif
152  Void  xSetPicProperties( TComPic* pcPic  ) ;
153  Void  xSetRefPics( TComPic* pcPic, RefPicList eRefPicList );
154  Void  xCheckSliceType(TComPic* pcPic);
155
156public:
157  TEncTop();
158  virtual ~TEncTop();
159
160  Void      create          ();
161  Void      destroy         ();
162  Void      init            ( TAppEncTop* pcTAppEncTop );
163  Void      deletePicBuffer ();
164
165  Void      deleteExtraPicBuffers   ( Int iPoc );
166#if AMVP_BUFFERCOMPRESS
167  Void      compressMotion          ( Int iPoc );
168#endif
169
170  UInt      getNextFrameId          ()  { return (UInt)m_cSeqIter.getPoc(); }
171  Bool      currentPocWillBeCoded   ()  { return ( m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() ) != m_acInputPicMap.end() ); }
172
173  TComList<TComPic*>      getCodedPictureStore(){ return m_cListPic;}
174
175  // -------------------------------------------------------------------------------------------------------------------
176  // member access functions
177  // -------------------------------------------------------------------------------------------------------------------
178
179  TComList<TComPic*>*     getListPic            () { return  &m_cListPic;             }
180  TEncSearch*             getPredSearch         () { return  &m_cSearch;              }
181
182  TComTrQuant*            getTrQuant            () { return  &m_cTrQuant;             }
183  TComLoopFilter*         getLoopFilter         () { return  &m_cLoopFilter;          }
184  TEncAdaptiveLoopFilter* getAdaptiveLoopFilter () { return  &m_cAdaptiveLoopFilter;  }
185#if MTK_SAO
186  TEncSampleAdaptiveOffset* getSAO                () { return  &m_cEncSAO;              }
187#endif
188  TEncPic*                getPicEncoder         () { return  &m_cPicEncoder;          }
189  TEncSlice*              getSliceEncoder       () { return  &m_cSliceEncoder;        }
190  TEncCu*                 getCuEncoder          () { return  &m_cCuEncoder;           }
191  TEncEntropy*            getEntropyCoder       () { return  &m_cEntropyCoder;        }
192  TEncCavlc*              getCavlcCoder         () { return  &m_cCavlcCoder;          }
193  TEncSbac*               getSbacCoder          () { return  &m_cSbacCoder;           }
194  TEncBinCABAC*           getBinCABAC           () { return  &m_cBinCoderCABAC;       }
195
196  TComBitCounter*         getBitCounter         () { return  &m_cBitCounter;          }
197  TComRdCost*             getRdCost             () { return  &m_cRdCost;              }
198  TEncSbac***             getRDSbacCoder        () { return  m_pppcRDSbacCoder;       }
199  TEncSbac*               getRDGoOnSbacCoder    () { return  &m_cRDGoOnSbacCoder;     }
200#if DEPTH_MAP_GENERATION
201  TComDepthMapGenerator*  getDepthMapGenerator  () { return  &m_cDepthMapGenerator;   }
202#endif
203#if HHI_INTER_VIEW_RESIDUAL_PRED
204  TComResidualGenerator*  getResidualGenerator  () { return  &m_cResidualGenerator;   }
205#endif
206
207  TComSPS*                getSPS                () { return  &m_cSPS;                 }
208  TComPPS*                getPPS                () { return  &m_cPPS;                 }
209
210  Void                    setTEncTopList        ( std::vector<TEncTop*>* pacTEncTopList );
211  TAppEncTop*             getEncTop             () { return m_pcTAppEncTop; }
212
213  Int                     getNumAllPicCoded     () { return m_uiNumAllPicCoded; }
214
215  Void                    printOutSummary       ( UInt uiNumAllPicCoded );
216
217  TEncAnalyze             m_cAnalyzeAll;
218  TEncAnalyze             m_cAnalyzeI;
219  TEncAnalyze             m_cAnalyzeP;
220  TEncAnalyze             m_cAnalyzeB;
221  // -------------------------------------------------------------------------------------------------------------------
222  // encoder function
223  // -------------------------------------------------------------------------------------------------------------------
224
225  /// encode several number of pictures until end-of-sequence
226
227
228//GT PRE LOAD ENC BUFFER
229  Void encode    ( bool bEos, std::map<PicOrderCnt, TComPicYuv*>& rcMapPicYuvRecOut, TComBitstream* pcBitstreamOut, Bool& bNewPicNeeded );
230  Void receivePic( bool bEos, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvRec, TComPicYuv* pcOrgPdmDepth = 0 );
231
232#if POZNAN_TEXTURE_TU_DELTA_QP_PARAM_IN_CFG_FOR_ENC
233  Double getTextureCuDeltaQpOffset( )      { return m_dTextureCuDeltaQpOffset;}
234  Double getTextureCuDeltaQpMul( )         { return m_dTextureCuDeltaQpMul;}
235  Int    getTextureCuDeltaQpTopBottomRow( ){ return m_iTextureCuDeltaQpTopBottomRow;}
236  Void   setTextureCuDeltaQpOffset      ( Double dTextureCuDeltaQpOffset    ){ m_dTextureCuDeltaQpOffset       = dTextureCuDeltaQpOffset; }
237  Void   setTextureCuDeltaQpMul         ( Double dTextureCuDeltaQpMul       ){ m_dTextureCuDeltaQpMul          = dTextureCuDeltaQpMul; }
238  Void   setTextureCuDeltaQpTopBottomRow( Int iTextureCuDeltaQpTopBottomRow ){ m_iTextureCuDeltaQpTopBottomRow = iTextureCuDeltaQpTopBottomRow; } 
239#endif
240};
241
242#endif // __TENCTOP__
243
Note: See TracBrowser for help on using the repository browser.