source: 3DVCSoftware/branches/HTM-13.1-dev1-Samsung/source/Lib/TLibEncoder/TEncCu.h @ 1159

Last change on this file since 1159 was 1145, checked in by samsung-htm, 10 years ago

Integration of K0033: Depth intra skip (DIS) mode

  • Property svn:eol-style set to native
File size: 8.2 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 *
[872]6* Copyright (c) 2010-2014, 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"
[608]51#include "TEncRateCtrl.h"
[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
[608]71#if H_3D_ARP
72  TComDataCU**            m_ppcWeightedTempCU;
[443]73#endif
[2]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
[608]83 
[833]84#if H_3D_DBBP
85  TComYuv**               m_ppcOrigYuvDBBP;
86#endif
87 
[2]88  //  Data : encoder control
[56]89  Bool                    m_bEncodeDQP;
[608]90 
[2]91  //  Access channel
92  TEncCfg*                m_pcEncCfg;
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;
[608]106  TEncRateCtrl*           m_pcRateCtrl;
[872]107#if KWU_RC_MADPRED_E0227
[608]108  UInt                    m_LCUPredictionSAD;
109  Int                     m_addSADDepth;
110  Int                     m_temporalSAD;
[655]111  Int                     m_spatialSAD;
112#endif
[2]113public:
114  /// copy parameters from encoder class
115  Void  init                ( TEncTop* pcEncTop );
116 
117  /// create internal buffers
118  Void  create              ( UChar uhTotalDepth, UInt iMaxWidth, UInt iMaxHeight );
119 
120  /// destroy internal buffers
121  Void  destroy             ();
[608]122 
[2]123  /// CU analysis function
124  Void  compressCU          ( TComDataCU*&  rpcCU );
125 
126  /// CU encoding function
[608]127  Void  encodeCU            ( TComDataCU*    pcCU );
[2]128 
[56]129  Void setBitCounter        ( TComBitCounter* pcBitCounter ) { m_pcBitCounter = pcBitCounter; }
[872]130#if KWU_RC_MADPRED_E0227
[608]131  UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; }
132#endif
133  Int   updateLCUDataISlice ( TComDataCU* pcCU, Int LCUIdx, Int width, Int height );
[2]134protected:
[56]135  Void  finishCU            ( TComDataCU*  pcCU, UInt uiAbsPartIdx,           UInt uiDepth        );
136#if AMP_ENC_SPEEDUP
137  Void  xCompressCU         ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth, PartSize eParentPartSize = SIZE_NONE );
138#else
[2]139  Void  xCompressCU         ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth        );
[56]140#endif
[2]141  Void  xEncodeCU           ( TComDataCU*  pcCU, UInt uiAbsPartIdx,           UInt uiDepth        );
142 
[56]143  Int   xComputeQP          ( TComDataCU* pcCU, UInt uiDepth );
144  Void  xCheckBestMode      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UInt uiDepth        );
[2]145 
[608]146  Void  xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool *earlyDetectionSkipMode);
147
[56]148#if AMP_MRG
[655]149#if  H_3D_FAST_TEXTURE_ENCODING
[608]150  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize,  Bool bFMD, Bool bUseMRG = false  ) ;
[56]151#else
152  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bUseMRG = false  );
153#endif
154#else
[2]155  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
156#endif
[833]157#if H_3D_DBBP
158  Void  xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment );
159  Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );
160#endif
[1145]161#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
162  Void  xCheckRDCostDIS   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
163#else
[1084]164#if H_3D_SINGLE_DEPTH
[1039]165  Void  xCheckRDCostSingleDepth   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
166#endif
[1145]167#endif
[1084]168#if H_3D_DIM
[1039]169  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bOnlyIVP );
170#else
[2]171  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
[1039]172#endif
[56]173  Void  xCheckDQP           ( TComDataCU*  pcCU );
[2]174 
[56]175  Void  xCheckIntraPCM      ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                      );
[2]176  Void  xCopyAMVPInfo       ( AMVPInfo* pSrc, AMVPInfo* pDst );
[56]177  Void  xCopyYuv2Pic        (TComPic* rpcPic, UInt uiCUAddr, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSrcDepth, TComDataCU* pcCU, UInt uiLPelX, UInt uiTPelY );
[2]178  Void  xCopyYuv2Tmp        ( UInt uhPartUnitIdx, UInt uiDepth );
[56]179
180  Bool getdQPFlag           ()                        { return m_bEncodeDQP;        }
181  Void setdQPFlag           ( Bool b )                { m_bEncodeDQP = b;           }
182
183#if ADAPTIVE_QP_SELECTION
184  // Adaptive reconstruction level (ARL) statistics collection functions
185  Void xLcuCollectARLStats(TComDataCU* rpcCU);
186  Int  xTuCollectARLStats(TCoeff* rpcCoeff, Int* rpcArlCoeff, Int NumCoeffInCU, Double* cSum, UInt* numSamples );
187#endif
188
189#if AMP_ENC_SPEEDUP
190#if AMP_MRG
191  Void deriveTestModeAMP (TComDataCU *&rpcBestCU, PartSize eParentPartSize, Bool &bTestAMP_Hor, Bool &bTestAMP_Ver, Bool &bTestMergeAMP_Hor, Bool &bTestMergeAMP_Ver);
192#else
193  Void deriveTestModeAMP (TComDataCU *&rpcBestCU, PartSize eParentPartSize, Bool &bTestAMP_Hor, Bool &bTestAMP_Ver);
194#endif
195#endif
196
197  Void  xFillPCMBuffer     ( TComDataCU*& pCU, TComYuv* pOrgYuv ); 
[2]198};
199
[56]200//! \}
[2]201
202#endif // __TENCMB__
Note: See TracBrowser for help on using the repository browser.