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

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

A second release, as planned

  • Migrate to HTM 4.1
  • Move VSP related switches to cfg file instead of #define in the source code
  • A few bug fixes
  • For VC project files, only VC9 file is updated

TODO

  • Migrate to HTM 5.0, to be used as anchor for CE1 toward Geneva meeting
  • Property svn:eol-style set to native
File size: 8.8 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
49#include "TEncEntropy.h"
50#include "TEncSearch.h"
51
52//! \ingroup TLibEncoder
53//! \{
54
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
80#if HHI_INTER_VIEW_RESIDUAL_PRED
81  TComYuv**               m_ppcResPredTmp;  ///< Temporary residual prediction for each depth
82#endif
83 
84  //  Data : encoder control
85  Bool                    m_bEncodeDQP;
86#if BURST_IPCM
87  Bool                    m_checkBurstIPCMFlag;
88#endif
89
90  //  Access channel
91  TEncCfg*                m_pcEncCfg;
92  TComPrediction*         m_pcPrediction;
93  TEncSearch*             m_pcPredSearch;
94  TComTrQuant*            m_pcTrQuant;
95  TComBitCounter*         m_pcBitCounter;
96  TComRdCost*             m_pcRdCost;
97 
98  TEncEntropy*            m_pcEntropyCoder;
99  TEncCavlc*              m_pcCavlcCoder;
100  TEncSbac*               m_pcSbacCoder;
101  TEncBinCABAC*           m_pcBinCABAC;
102 
103  // SBAC RD
104  TEncSbac***             m_pppcRDSbacCoder;
105  TEncSbac*               m_pcRDGoOnSbacCoder;
106  Bool                    m_bUseSBACRD;
107 
108#if HHI_MPI
109  UChar *m_puhDepthSaved;
110  UChar *m_puhWidthSaved;
111  UChar *m_puhHeightSaved;
112#endif
113
114public:
115  /// copy parameters from encoder class
116  Void  init                ( TEncTop* pcEncTop );
117 
118  /// create internal buffers
119  Void  create              ( UChar uhTotalDepth, UInt iMaxWidth, UInt iMaxHeight );
120 
121  /// destroy internal buffers
122  Void  destroy             ();
123 
124  /// CU analysis function
125  Void  compressCU          ( TComDataCU*&  rpcCU );
126 
127  /// CU encoding function
128  Void  encodeCU            ( TComDataCU*    pcCU, Bool bForceTerminate = false  );
129 
130  Void setBitCounter        ( TComBitCounter* pcBitCounter ) { m_pcBitCounter = pcBitCounter; }
131protected:
132  Void  finishCU            ( TComDataCU*  pcCU, UInt uiAbsPartIdx,           UInt uiDepth        );
133#if AMP_ENC_SPEEDUP
134  Void  xCompressCU         ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth, PartSize eParentPartSize = SIZE_NONE );
135#else
136  Void  xCompressCU         ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth        );
137#endif
138  Void  xEncodeCU           ( TComDataCU*  pcCU, UInt uiAbsPartIdx,           UInt uiDepth        );
139 
140  Int   xComputeQP          ( TComDataCU* pcCU, UInt uiDepth );
141  Void  xCheckBestMode      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth        );
142 
143#if HHI_INTERVIEW_SKIP
144  Void xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bFullyRendered ) ;
145#else
146  Void  xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                  );
147#endif
148#if AMP_MRG
149#if HHI_INTERVIEW_SKIP
150  Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered, Bool bUseMRG = false
151#if FORCE_REF_VSP==1
152    , Bool bForceRefVsp = false
153#endif
154    ) ;
155#else
156  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG = false  );
157#endif
158//  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG = false  );
159#else
160#if HHI_INTERVIEW_SKIP
161  Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered ) ;
162#else
163  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
164#endif
165//  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
166#endif
167  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
168  Void  xCheckBestMode      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                      );
169  Void  xCheckDQP           ( TComDataCU*  pcCU );
170 
171  Void  xCheckIntraPCM      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                      );
172  Void  xCopyAMVPInfo       ( AMVPInfo* pSrc, AMVPInfo* pDst );
173  Void  xCopyYuv2Pic        (TComPic* rpcPic, UInt uiCUAddr, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSrcDepth, TComDataCU* pcCU, UInt uiLPelX, UInt uiTPelY );
174  Void  xCopyYuv2Tmp        ( UInt uhPartUnitIdx, UInt uiDepth );
175
176  Bool getdQPFlag           ()                        { return m_bEncodeDQP;        }
177  Void setdQPFlag           ( Bool b )                { m_bEncodeDQP = b;           }
178
179#if BURST_IPCM
180  Bool getCheckBurstIPCMFlag()                        { return m_checkBurstIPCMFlag;   }
181  Void setCheckBurstIPCMFlag( Bool b )                { m_checkBurstIPCMFlag = b;      }
182
183  Bool checkLastCUSucIPCM   ( TComDataCU* pcCU, UInt uiCurAbsPartIdx );
184  Int  countNumSucIPCM      ( TComDataCU* pcCU, UInt uiCurAbsPartIdx );
185#endif
186
187#if ADAPTIVE_QP_SELECTION
188  // Adaptive reconstruction level (ARL) statistics collection functions
189  Void xLcuCollectARLStats(TComDataCU* rpcCU);
190  Int  xTuCollectARLStats(TCoeff* rpcCoeff, Int* rpcArlCoeff, Int NumCoeffInCU, Double* cSum, UInt* numSamples );
191#endif
192
193#if AMP_ENC_SPEEDUP
194#if AMP_MRG
195  Void deriveTestModeAMP (TComDataCU *&rpcBestCU, PartSize eParentPartSize, Bool &bTestAMP_Hor, Bool &bTestAMP_Ver, Bool &bTestMergeAMP_Hor, Bool &bTestMergeAMP_Ver);
196#else
197  Void deriveTestModeAMP (TComDataCU *&rpcBestCU, PartSize eParentPartSize, Bool &bTestAMP_Hor, Bool &bTestAMP_Ver);
198#endif
199#endif
200
201#if LOSSLESS_CODING
202  Void  xFillPCMBuffer     ( TComDataCU*& pCU, TComYuv* pOrgYuv ); 
203#endif
204#if HHI_MPI
205  Void  xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bSkipResidual, Bool bRecursiveCall );
206  Void  xSaveDepthWidthHeight( TComDataCU* pcCU );
207  Void  xRestoreDepthWidthHeight( TComDataCU* pcCU );
208  Void  xAddMVISignallingBits( TComDataCU* pcCU );
209#endif
210};
211
212//! \}
213
214#endif // __TENCMB__
Note: See TracBrowser for help on using the repository browser.