source: 3DVCSoftware/branches/0.3-nokia/source/Lib/TLibEncoder/TEncCu.h

Last change on this file was 5, checked in by hhi, 13 years ago

Clean version with cfg-files

  • Property svn:eol-style set to native
File size: 6.4 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
36/** \file     TEncCU.h
37    \brief    CU encoder class (header)
38*/
39
40#ifndef __TENCCU__
41#define __TENCCU__
42
43// Include files
44#include "../TLibCommon/CommonDef.h"
45#include "../TLibCommon/TComYuv.h"
46#include "../TLibCommon/TComPrediction.h"
47#include "../TLibCommon/TComTrQuant.h"
48#include "../TLibCommon/TComBitCounter.h"
49#include "../TLibCommon/TComDataCU.h"
50
51#include "TEncEntropy.h"
52#include "TEncSearch.h"
53
54class TEncTop;
55class TEncSbac;
56class TEncCavlc;
57class TEncSlice;
58
59// ====================================================================================================================
60// Class definition
61// ====================================================================================================================
62
63/// CU encoder class
64class TEncCu
65{
66private:
67 
68  TComDataCU**            m_ppcBestCU;      ///< Best CUs in each depth
69  TComDataCU**            m_ppcTempCU;      ///< Temporary CUs in each depth
70  UChar                   m_uhTotalDepth;
71 
72  TComYuv**               m_ppcPredYuvBest; ///< Best Prediction Yuv for each depth
73  TComYuv**               m_ppcResiYuvBest; ///< Best Residual Yuv for each depth
74  TComYuv**               m_ppcRecoYuvBest; ///< Best Reconstruction Yuv for each depth
75  TComYuv**               m_ppcPredYuvTemp; ///< Temporary Prediction Yuv for each depth
76  TComYuv**               m_ppcResiYuvTemp; ///< Temporary Residual Yuv for each depth
77  TComYuv**               m_ppcRecoYuvTemp; ///< Temporary Reconstruction Yuv for each depth
78  TComYuv**               m_ppcOrigYuv;     ///< Original Yuv for each depth
79  TComYuv**               m_ppcResPredTmp;  ///< Temporary residual prediction for each depth
80 
81  //  Data : encoder control
82  Int                     m_iQp;            ///< Last QP
83 
84  //  Access channel
85  TEncCfg*                m_pcEncCfg;
86  TEncTop*                m_pcEncTop;
87  TComPrediction*         m_pcPrediction;
88  TEncSearch*             m_pcPredSearch;
89  TComTrQuant*            m_pcTrQuant;
90  TComBitCounter*         m_pcBitCounter;
91  TComRdCost*             m_pcRdCost;
92 
93  TEncEntropy*            m_pcEntropyCoder;
94  TEncCavlc*              m_pcCavlcCoder;
95  TEncSbac*               m_pcSbacCoder;
96  TEncBinCABAC*           m_pcBinCABAC;
97 
98  // SBAC RD
99  TEncSbac***             m_pppcRDSbacCoder;
100  TEncSbac*               m_pcRDGoOnSbacCoder;
101  Bool                    m_bUseSBACRD;
102 
103#if HHI_MPI
104  UChar *m_puhDepthSaved;
105  UChar *m_puhWidthSaved;
106  UChar *m_puhHeightSaved;
107#endif
108
109public:
110  /// copy parameters from encoder class
111  Void  init                ( TEncTop* pcEncTop );
112 
113  /// create internal buffers
114  Void  create              ( UChar uhTotalDepth, UInt iMaxWidth, UInt iMaxHeight );
115 
116  /// destroy internal buffers
117  Void  destroy             ();
118 
119  /// CU analysis function
120  Void  compressCU          ( TComDataCU*&  rpcCU );
121 
122  /// CU encoding function
123  Void  encodeCU            ( TComDataCU*    pcCU, Bool bForceTerminate = false  );
124 
125  /// set QP value
126  Void  setQpLast           ( Int iQp ) { m_iQp = iQp; }
127 
128protected:
129  Void  xCompressCU         ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth        );
130  Void  xEncodeCU           ( TComDataCU*  pcCU, UInt uiAbsPartIdx,           UInt uiDepth        );
131 
132  Void  xCheckRDCostAMVPSkip( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                      );
133 
134#if HHI_INTERVIEW_SKIP
135  Void xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bFullyRendered ) ;
136#else
137  Void  xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                  );
138#endif
139 
140  Void  xCheckRDCostSkip    ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bBSkipRes      );
141#if HHI_INTERVIEW_SKIP
142  Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered ) ;
143#else
144  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
145#endif
146  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
147  Void  xCheckBestMode      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhDepth       );
148 
149  Void  xCopyAMVPInfo       ( AMVPInfo* pSrc, AMVPInfo* pDst );
150  Void  xCopyYuv2Pic        ( TComPic* rpcPic, UInt uiCUAddr, UInt uiAbsZorderIdx, UInt uiDepth );
151  Void  xCopyYuv2Tmp        ( UInt uhPartUnitIdx, UInt uiDepth );
152  Void  xAddMVISignallingBits( TComDataCU* pcCU );
153#if HHI_MPI
154  Void  xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bSkipResidual, Bool bRecursiveCall );
155  Void  xSaveDepthWidthHeight( TComDataCU* pcCU );
156  Void  xRestoreDepthWidthHeight( TComDataCU* pcCU );
157#endif
158};
159
160
161#endif // __TENCMB__
162
Note: See TracBrowser for help on using the repository browser.