source: 3DVCSoftware/branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncCu.h @ 166

Last change on this file since 166 was 166, checked in by mitsubishi-htm, 12 years ago

Initial integration of VSP into HTM 4.0.1. The version used for JCT3V-B0102 at Shanghai meeting.

  • VC9 project/solution files updated. Other Visual C++ project/solution files are not updated.
  • Linux make file updated.

TODO

  • A second release is expected to include some bug fix and improvements on the interface, e.g. to move switches from macro definition to the configuration file.
  • A third release is expected after being integrated within HTM 5.x, which is to be used for CE1.h anchor.
  • Property svn:eol-style set to native
File size: 8.9 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-2012, 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     TEncCu.h
35    \brief    Coding Unit (CU) encoder class (header)
36*/
37
38#ifndef __TENCCU__
39#define __TENCCU__
40
41// Include files
42#include "TLibCommon/CommonDef.h"
43#include "TLibCommon/TComYuv.h"
44#include "TLibCommon/TComPrediction.h"
45#include "TLibCommon/TComTrQuant.h"
46#include "TLibCommon/TComBitCounter.h"
47#include "TLibCommon/TComDataCU.h"
48#if DEBUGLOGOUT
49#include "TLibCommon/DebugLog.h"
50#endif
51
52#include "TEncEntropy.h"
53#include "TEncSearch.h"
54
55//! \ingroup TLibEncoder
56//! \{
57
58class TEncTop;
59class TEncSbac;
60class TEncCavlc;
61class TEncSlice;
62
63// ====================================================================================================================
64// Class definition
65// ====================================================================================================================
66
67/// CU encoder class
68class TEncCu
69{
70private:
71 
72  TComDataCU**            m_ppcBestCU;      ///< Best CUs in each depth
73  TComDataCU**            m_ppcTempCU;      ///< Temporary CUs in each depth
74  UChar                   m_uhTotalDepth;
75 
76  TComYuv**               m_ppcPredYuvBest; ///< Best Prediction Yuv for each depth
77  TComYuv**               m_ppcResiYuvBest; ///< Best Residual Yuv for each depth
78  TComYuv**               m_ppcRecoYuvBest; ///< Best Reconstruction Yuv for each depth
79  TComYuv**               m_ppcPredYuvTemp; ///< Temporary Prediction Yuv for each depth
80  TComYuv**               m_ppcResiYuvTemp; ///< Temporary Residual Yuv for each depth
81  TComYuv**               m_ppcRecoYuvTemp; ///< Temporary Reconstruction Yuv for each depth
82  TComYuv**               m_ppcOrigYuv;     ///< Original Yuv for each depth
83#if HHI_INTER_VIEW_RESIDUAL_PRED
84  TComYuv**               m_ppcResPredTmp;  ///< Temporary residual prediction for each depth
85#endif
86 
87  //  Data : encoder control
88  Bool                    m_bEncodeDQP;
89#if BURST_IPCM
90  Bool                    m_checkBurstIPCMFlag;
91#endif
92
93  //  Access channel
94  TEncCfg*                m_pcEncCfg;
95  TComPrediction*         m_pcPrediction;
96  TEncSearch*             m_pcPredSearch;
97  TComTrQuant*            m_pcTrQuant;
98  TComBitCounter*         m_pcBitCounter;
99  TComRdCost*             m_pcRdCost;
100 
101  TEncEntropy*            m_pcEntropyCoder;
102  TEncCavlc*              m_pcCavlcCoder;
103  TEncSbac*               m_pcSbacCoder;
104  TEncBinCABAC*           m_pcBinCABAC;
105 
106  // SBAC RD
107  TEncSbac***             m_pppcRDSbacCoder;
108  TEncSbac*               m_pcRDGoOnSbacCoder;
109  Bool                    m_bUseSBACRD;
110 
111#if HHI_MPI
112  UChar *m_puhDepthSaved;
113  UChar *m_puhWidthSaved;
114  UChar *m_puhHeightSaved;
115#endif
116
117public:
118#if DEBUGLOGOUT
119  DebugLog                m_cDebug;
120#endif
121
122  /// copy parameters from encoder class
123  Void  init                ( TEncTop* pcEncTop );
124 
125  /// create internal buffers
126  Void  create              ( UChar uhTotalDepth, UInt iMaxWidth, UInt iMaxHeight );
127 
128  /// destroy internal buffers
129  Void  destroy             ();
130 
131  /// CU analysis function
132  Void  compressCU          ( TComDataCU*&  rpcCU );
133 
134  /// CU encoding function
135  Void  encodeCU            ( TComDataCU*    pcCU, Bool bForceTerminate = false  );
136 
137  Void setBitCounter        ( TComBitCounter* pcBitCounter ) { m_pcBitCounter = pcBitCounter; }
138protected:
139  Void  finishCU            ( TComDataCU*  pcCU, UInt uiAbsPartIdx,           UInt uiDepth        );
140#if AMP_ENC_SPEEDUP
141  Void  xCompressCU         ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth, PartSize eParentPartSize = SIZE_NONE );
142#else
143  Void  xCompressCU         ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth        );
144#endif
145  Void  xEncodeCU           ( TComDataCU*  pcCU, UInt uiAbsPartIdx,           UInt uiDepth        );
146 
147  Int   xComputeQP          ( TComDataCU* pcCU, UInt uiDepth );
148  Void  xCheckBestMode      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth        );
149 
150#if HHI_INTERVIEW_SKIP
151  Void xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bFullyRendered ) ;
152#else
153  Void  xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                  );
154#endif
155#if AMP_MRG
156#if HHI_INTERVIEW_SKIP
157  Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered, Bool bUseMRG = false
158#if FORCE_REF_VSP==1
159    , Bool bForceRefVsp = false
160#endif
161    ) ;
162#else
163  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG = false  );
164#endif
165//  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG = false  );
166#else
167#if HHI_INTERVIEW_SKIP
168  Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered ) ;
169#else
170  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
171#endif
172//  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
173#endif
174  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
175  Void  xCheckBestMode      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                      );
176  Void  xCheckDQP           ( TComDataCU*  pcCU );
177 
178  Void  xCheckIntraPCM      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                      );
179  Void  xCopyAMVPInfo       ( AMVPInfo* pSrc, AMVPInfo* pDst );
180  Void  xCopyYuv2Pic        (TComPic* rpcPic, UInt uiCUAddr, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSrcDepth, TComDataCU* pcCU, UInt uiLPelX, UInt uiTPelY );
181  Void  xCopyYuv2Tmp        ( UInt uhPartUnitIdx, UInt uiDepth );
182
183  Bool getdQPFlag           ()                        { return m_bEncodeDQP;        }
184  Void setdQPFlag           ( Bool b )                { m_bEncodeDQP = b;           }
185
186#if BURST_IPCM
187  Bool getCheckBurstIPCMFlag()                        { return m_checkBurstIPCMFlag;   }
188  Void setCheckBurstIPCMFlag( Bool b )                { m_checkBurstIPCMFlag = b;      }
189
190  Bool checkLastCUSucIPCM   ( TComDataCU* pcCU, UInt uiCurAbsPartIdx );
191  Int  countNumSucIPCM      ( TComDataCU* pcCU, UInt uiCurAbsPartIdx );
192#endif
193
194#if ADAPTIVE_QP_SELECTION
195  // Adaptive reconstruction level (ARL) statistics collection functions
196  Void xLcuCollectARLStats(TComDataCU* rpcCU);
197  Int  xTuCollectARLStats(TCoeff* rpcCoeff, Int* rpcArlCoeff, Int NumCoeffInCU, Double* cSum, UInt* numSamples );
198#endif
199
200#if AMP_ENC_SPEEDUP
201#if AMP_MRG
202  Void deriveTestModeAMP (TComDataCU *&rpcBestCU, PartSize eParentPartSize, Bool &bTestAMP_Hor, Bool &bTestAMP_Ver, Bool &bTestMergeAMP_Hor, Bool &bTestMergeAMP_Ver);
203#else
204  Void deriveTestModeAMP (TComDataCU *&rpcBestCU, PartSize eParentPartSize, Bool &bTestAMP_Hor, Bool &bTestAMP_Ver);
205#endif
206#endif
207
208#if LOSSLESS_CODING
209  Void  xFillPCMBuffer     ( TComDataCU*& pCU, TComYuv* pOrgYuv ); 
210#endif
211#if HHI_MPI
212  Void  xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bSkipResidual, Bool bRecursiveCall );
213  Void  xSaveDepthWidthHeight( TComDataCU* pcCU );
214  Void  xRestoreDepthWidthHeight( TComDataCU* pcCU );
215  Void  xAddMVISignallingBits( TComDataCU* pcCU );
216#endif
217};
218
219//! \}
220
221#endif // __TENCMB__
Note: See TracBrowser for help on using the repository browser.