source: 3DVCSoftware/trunk/source/Lib/TLibEncoder/TEncCu.h @ 375

Last change on this file since 375 was 296, checked in by tech, 12 years ago

Reintegrated branch 5.1-dev0 rev. 295.

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