Changeset 56 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPrediction.h


Ignore:
Timestamp:
11 May 2012, 21:20:17 (12 years ago)
Author:
hschwarz
Message:

updated trunk (move to HM6.1)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r21 r56  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license.
     4 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2011, ISO/IEC
     6 * Copyright (c) 2010-2012, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    1515 *    this list of conditions and the following disclaimer in the documentation
    1616 *    and/or other materials provided with the distribution.
    17  *  * Neither the name of the ISO/IEC nor the names of its contributors may
     17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
    1818 *    be used to endorse or promote products derived from this software without
    1919 *    specific prior written permission.
     
    3232 */
    3333
    34 
    35 
    3634/** \file     TComPrediction.h
    3735    \brief    prediction class (header)
     
    4745#include "TComPattern.h"
    4846#include "TComTrQuant.h"
    49 #include "TComPredFilter.h"
    50 #ifdef WEIGHT_PRED
    51   #include "TComWeightPrediction.h"
     47#include "TComInterpolationFilter.h"
     48#include "TComWeightPrediction.h"
     49
     50#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     51#include <math.h>
    5252#endif
     53
     54//! \ingroup TLibCommon
     55//! \{
    5356
    5457// ====================================================================================================================
     
    5760
    5861/// prediction class
    59 class TComPrediction : public TComPredFilter
    60 #ifdef WEIGHT_PRED
    61   , public TComWeightPrediction
    62 #endif
     62class TComPrediction : public TComWeightPrediction
    6363{
    6464protected:
     
    6969  TComYuv   m_acYuvPred[2];
    7070  TComYuv   m_cYuvPredTemp;
    71   TComYuv   m_cYuvExt;
     71  TComYuv m_filteredBlock[4][4];
     72  TComYuv m_filteredBlockTmp[4];
    7273 
    73 #if LM_CHROMA
    74   Pel*   m_pLumaRecBuffer;       // array for downsampled reconstructed luma sample
    75   Int    m_iLumaRecStride;
    76   UInt   m_uiaShift[ 65 ];       // Table for multiplication to substitue of division operation
    77 #endif
     74  TComInterpolationFilter m_if;
     75 
     76  Pel*   m_pLumaRecBuffer;       ///< array for downsampled reconstructed luma sample
     77  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
     78  UInt   m_uiaShift[ 63 ];       // Table for multiplication to substitue of division operation
    7879
    79   Void xPredIntraAng            ( Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable );
    80 #if ADD_PLANAR_MODE
    81 #if REFERENCE_SAMPLE_PADDING
    82   Void xPredIntraPlanar         ( Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height );
    83 #else
    84   Void xPredIntraPlanar         ( Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, Bool blkAboveAvailable, Bool blkLeftAvailable );
    85 #endif
    86 #endif
     80  Void xPredIntraAng            ( Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter );
     81  Void xPredIntraPlanar         ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
    8782 
    8883  // motion compensation functions
    89 #if HIGH_ACCURACY_BI
    9084#if DEPTH_MAP_GENERATION
    9185  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false );
    9286#else
    93   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false );
     87  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false          );
    9488#endif
    95 #else
    96 #if DEPTH_MAP_GENERATION
    97   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
    98 #else
    99   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx );
    100 #endif
    101 #endif
     89
    10290#if DEPTH_MAP_GENERATION
    10391  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
    104   Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift );
     92  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset );
    10593#else
    106   Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx );
    107   Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv, UInt uiRShift );
     94  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx          );
     95  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset );
    10896#endif
    109   Void xPredInterLumaBlk        ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv );
    110   Void xPredInterChromaBlk      ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv                            );
    111  
     97
    11298#if DEPTH_MAP_GENERATION
    11399  Void xWeightedAveragePdm      ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY );
    114100#endif
     101
     102  Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi );
     103  Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi );
    115104  Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
     105 
     106  Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    116107
    117 
    118   Void xDCTIF_FilterC ( Pel*  piRefC, Int iRefStride,Pel*  piDstC,Int iDstStride,Int iWidth, Int iHeight,Int iMVyFrac,Int iMVxFrac);
    119 
    120 #if HIGH_ACCURACY_BI
    121   Void xPredInterLumaBlk_ha        ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv );
    122   Void xPredInterChromaBlk_ha      ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv                            );
    123   Void xDCTIF_FilterC_ha ( Pel*  piRefC, Int iRefStride,Pel*  piDstC,Int iDstStride,Int iWidth, Int iHeight,Int iMVyFrac,Int iMVxFrac);
    124 #endif
     108  Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
     109  Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
    125110
    126111#if HHI_DMM_WEDGE_INTRA
    127112  Void xPredIntraWedgeFull       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder, Bool bDelta, UInt uiTabIdx, Int iDeltaDC1 = 0, Int iDeltaDC2 = 0 );
    128 
    129113  Void xPredIntraWedgeDir        ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder, Bool bDelta, Int iWedgeDeltaEnd, Int iDeltaDC1 = 0, Int iDeltaDC2 = 0 );
    130114  Void xGetBlockOffset           ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY );
     
    138122#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    139123  Void xDeltaDCQuantScaleUp      ( TComDataCU* pcCU, Int& riDeltaDC );
    140 #endif
    141 
    142 #if LM_CHROMA
    143   Void xGetRecPixels     ( TComPattern* pcPattern, Pel* pRecSrc, Int iRecSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth0, UInt uiHeight0 );   
    144   Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    145 #endif
    146 
    147 #if MN_DC_PRED_FILTER
    148   Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
     124  Void xDeltaDCQuantScaleDown    ( TComDataCU* pcCU, Int& riDeltaDC );
    149125#endif
    150126
     
    169145  Void predIntraChromaAng         ( TComPattern* pcTComPattern, Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, TComDataCU* pcCU, Bool bAbove, Bool bLeft );
    170146 
    171 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    172   Void  predIntraLumaDMM         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder );
    173 
    174   Void  getWedgePredDCs         ( TComWedgelet* pcWedgelet, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2, Bool bAbove, Bool bLeft );
    175   Void  calcWedgeDCs             ( TComWedgelet* pcWedgelet, Pel* piOrig, UInt uiStride, Int& riDC1, Int& riDC2 );
    176   Void  assignWedgeDCs2Pred      ( TComWedgelet* pcWedgelet, Pel* piPred,  UInt uiStride, Int   iDC1, Int   iDC2 );
    177 #endif
    178 #if HHI_DMM_PRED_TEX
    179   Void  getBestContourFromText   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge, Pel* piTextureBlock = NULL );
    180   UInt  getBestWedgeFromText     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, WedgeDist eWedgeDist = WedgeDist_SAD, Pel* piTextureBlock = NULL );
    181   Void  fillTexturePicTempBlock  ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piTempBlockY, UInt uiWidth, UInt uiHeight );
    182 #endif
    183 #if HHI_DMM_WEDGE_INTRA
    184   UInt  getBestContinueWedge     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd = 0 );
    185   Bool  getWedgeListIdx          ( WedgeList* pcWedgeList, WedgeRefList* pcWedgeRefList, UInt& ruiTabIdx, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe );
    186 #endif
    187  
    188147  Pel  predIntraGetPredValDC      ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft );
    189148 
     
    192151  Int  getPredicBufHeight()       { return m_iYuvExtHeight; }
    193152
    194 #if LM_CHROMA
    195153  Void predLMIntraChroma( TComPattern* pcPattern, Int* piSrc, Pel* pPred, UInt uiPredStride, UInt uiCWidth, UInt uiCHeight, UInt uiChromaId );
     154  Void getLumaRecPixels  ( TComPattern* pcPattern, UInt uiWidth0, UInt uiHeight0 );
     155
     156#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     157  Void  predIntraLumaDMM        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder );
     158
     159  Void  getWedgePredDCs         ( TComWedgelet* pcWedgelet, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2, Bool bAbove, Bool bLeft );
     160  Void  calcWedgeDCs            ( TComWedgelet* pcWedgelet, Pel* piOrig, UInt uiStride, Int& riDC1, Int& riDC2 );
     161  Void  assignWedgeDCs2Pred     ( TComWedgelet* pcWedgelet, Pel* piPred,  UInt uiStride, Int   iDC1, Int   iDC2 );
     162#endif
     163#if HHI_DMM_PRED_TEX
     164  Void  getBestContourFromTex   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge );
     165  UInt  getBestWedgeFromTex     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight );
     166  Void  copyTextureLumaBlock    ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );
     167#endif
     168#if HHI_DMM_WEDGE_INTRA
     169  UInt  getBestContinueWedge    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd = 0 );
     170  Bool  getWedgePatternIdx      ( WedgeRefList* pcWedgeRefList, UInt& ruiTabIdx, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe );
    196171#endif
    197172
     
    201176  Int   xGetDCValDepth    ( Int iVal1, Int iVal2, Int iVal3, Int iVal4 );
    202177  Void  xPredIntraAngDepth( Int* pSrc, Int srcStride, Pel* pDst, Int dstStride, UInt width, UInt height, UInt dirMode );
     178
    203179};
    204180
    205 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    206 // ====================================================================================================================
    207 // Class definition TComWedgeDist
    208 // ====================================================================================================================
    209 class TComWedgeDist
    210 {
    211 private:
    212   // for distortion
    213   Int                     m_iBlkWidth;
    214   Int                     m_iBlkHeight;
    215 
    216   FpDistFunc              m_afpDistortFunc[8]; // [eDFunc]
    217 #ifdef ROUNDING_CONTROL_BIPRED
    218   FpDistFuncRnd           m_afpDistortFuncRnd[4];
    219 #endif
    220 
    221 public:
    222   TComWedgeDist();
    223   virtual ~TComWedgeDist();
    224 
    225   // Distortion Functions
    226   Void    init();
    227 
    228   Void    setDistParam( UInt uiBlkWidth, UInt uiBlkHeight, WedgeDist eWDist, DistParam& rcDistParam );
    229   Void    setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride,            DistParam& rcDistParam );
    230   Void    setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false );
    231   Void    setDistParam( DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false );
    232 
    233 #ifdef ROUNDING_CONTROL_BIPRED
    234   Void    setDistParam_Bi( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride,            DistParam& rcDistParam );
    235   Void    setDistParam_Bi( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false );
    236 #endif
    237 
    238 private:
    239 
    240   //   static UInt xGetSAD           ( DistParam* pcDtParam );
    241   static UInt xGetSAD4          ( DistParam* pcDtParam );
    242   static UInt xGetSAD8          ( DistParam* pcDtParam );
    243   static UInt xGetSAD16         ( DistParam* pcDtParam );
    244   static UInt xGetSAD32         ( DistParam* pcDtParam );
    245   //   static UInt xGetSAD64         ( DistParam* pcDtParam );
    246 
    247   static UInt xGetSSE4          ( DistParam* pcDtParam );
    248   static UInt xGetSSE8          ( DistParam* pcDtParam );
    249   static UInt xGetSSE16         ( DistParam* pcDtParam );
    250   static UInt xGetSSE32         ( DistParam* pcDtParam );
    251 
    252 #ifdef ROUNDING_CONTROL_BIPRED
    253   //   static UInt xGetSAD           ( DistParam* pcDtParam, Pel* pRefY, Bool bRound );
    254   static UInt xGetSAD4          ( DistParam* pcDtParam, Pel* pRefY, Bool bRound );
    255   static UInt xGetSAD8          ( DistParam* pcDtParam, Pel* pRefY, Bool bRound );
    256   static UInt xGetSAD16         ( DistParam* pcDtParam, Pel* pRefY, Bool bRound );
    257   static UInt xGetSAD32         ( DistParam* pcDtParam, Pel* pRefY, Bool bRound );
    258   //   static UInt xGetSAD64         ( DistParam* pcDtParam, Pel* pRefY, Bool bRound );
    259 #endif
    260 
    261 public:
    262   UInt   getDistPart( Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, WedgeDist eWDist = WedgeDist_SAD );
    263 
    264 };// END CLASS DEFINITION TComWedgeDist
    265 #endif
     181//! \}
    266182
    267183#endif // __TCOMPREDICTION__
    268 
Note: See TracChangeset for help on using the changeset viewer.