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


Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

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

    r1196 r1313  
    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. 
    5  *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     4 * granted under this license.
     5 *
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4141
    4242// Include files
    43 #include "TComPic.h"
    44 #include "TComMotionInfo.h"
    45 #include "TComPattern.h"
    46 #include "TComTrQuant.h"
     43#include "TComYuv.h"
    4744#include "TComInterpolationFilter.h"
    4845#include "TComWeightPrediction.h"
     46
     47#if NH_3D_ARP
     48#include "TComPic.h"
     49#endif
     50// forward declaration
     51class TComMv;
     52class TComTU;
    4953
    5054//! \ingroup TLibCommon
     
    5660
    5761/// prediction class
     62typedef enum PRED_BUF_E
     63{
     64  PRED_BUF_UNFILTERED=0,
     65  PRED_BUF_FILTERED=1,
     66  NUM_PRED_BUF=2
     67} PRED_BUF;
     68
     69static const UInt MAX_INTRA_FILTER_DEPTHS=5;
     70
    5871class TComPrediction : public TComWeightPrediction
    5972{
     73private:
     74  static const UChar m_aucIntraFilter[MAX_NUM_CHANNEL_TYPE][MAX_INTRA_FILTER_DEPTHS];
     75
    6076protected:
    61   Int*      m_piYuvExt;
    62   Int       m_iYuvExtStride;
    63   Int       m_iYuvExtHeight;
    64  
    65   TComYuv   m_acYuvPred[2];
     77  Pel*      m_piYuvExt[MAX_NUM_COMPONENT][NUM_PRED_BUF];
     78  Int       m_iYuvExtSize;
     79
     80  TComYuv   m_acYuvPred[NUM_REF_PIC_LIST_01];
    6681  TComYuv   m_cYuvPredTemp;
    67 #if H_3D_ARP
     82#if NH_3D_ARP
    6883  TComYuv   m_acYuvPredBase[2];
    6984#endif
    70   TComYuv m_filteredBlock[4][4];
    71   TComYuv m_filteredBlockTmp[4];
    72  
     85  TComYuv m_filteredBlock[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS];
     86  TComYuv m_filteredBlockTmp[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS];
     87
    7388  TComInterpolationFilter m_if;
    74  
    75   Pel*   m_pLumaRecBuffer;       ///< array for downsampled reconstructed luma sample 
     89
     90  Pel*   m_pLumaRecBuffer;       ///< array for downsampled reconstructed luma sample
    7691  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
    77 #if H_3D_IC
     92#if NH_3D_IC
    7893  UInt   m_uiaShift[ 64 ];       // Table for multiplication to substitue of division operation
    7994#endif
    8095
    81 #if H_3D_VSP
     96#if NH_3D_VSP
    8297  Int*    m_pDepthBlock;         ///< Store a depth block, local variable, to prevent memory allocation every time
    8398  TComYuv m_cYuvDepthOnVsp;
    8499#endif
    85 
    86   Void xPredIntraAng            (Int bitDepth, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter );
    87   Void xPredIntraPlanar         ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
    88  
     100  Void xPredIntraAng            ( Int bitDepth, const Pel* pSrc, Int srcStride, Pel* pDst, Int dstStride, UInt width, UInt height, ChannelType channelType, UInt dirMode, const Bool bEnableEdgeFilters );
     101  Void xPredIntraPlanar         ( const Pel* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
     102
    89103  // motion compensation functions
    90 #if H_3D_ARP
    91   Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
     104#if NH_3D_ARP
     105  Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );
     106  Void xPredInterUniARPviewRef  ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );
    92107  Bool xCheckBiInterviewARP     ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc );
    93   Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL );
    94 #endif
    95   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
    96   Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
    97 #if H_3D_VSP
     108#endif
     109
     110  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false          );
     111  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv* pcYuvPred          );
     112#if NH_3D_VSP
    98113  Void xPredInterUniVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
    99114  Void xPredInterBiVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
    100115#endif
    101116
    102   Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
    103 #if H_3D_ARP
     117  Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth
     118#if NH_3D_ARP
    104119    , Bool filterType = false
    105120#endif
    106 #if H_3D_IC
     121#if NH_3D_IC
    107122    , Bool bICFlag    = false
    108123#endif
    109     );
    110   Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
    111 
    112 #if H_3D_ARP
    113     , Bool filterType = false
    114 #endif
    115 #if H_3D_IC
    116     , Bool bICFlag    = false
    117 #endif
    118     );
    119 
    120 #if H_3D_VSP
     124 );
     125
     126#if NH_3D_VSP
    121127  Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
    122128#endif
    123   Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); 
    124   Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    125 #if H_3D_IC
    126   Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType );
    127 #endif
    128   Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
     129
     130  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths  );
     131
     132  Void xGetLLSPrediction ( const Pel* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0, const ChromaFormat chFmt  DEBUG_STRING_FN_DECLARE(sDebug) );
     133#if NH_3D_IC
     134  Void xGetLLSICPrediction( const ComponentID compID, TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, const Int bitDepth);
     135#endif
     136  Void xDCPredFiltering( const Pel* pSrc, Int iSrcStride, Pel* pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType );
    129137  Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
    130 #if H_3D_SPIVMP
     138#if NH_3D_SPIVMP
    131139  Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );
    132140  Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );
    133141#endif
    134 #if H_3D_DIM
    135   // depth intra functions
    136   Void xPredBiSegDCs            ( Int* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 );
    137   Void xAssignBiSegDCs          ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel   valDC1, Pel   valDC2 );
    138 #if H_3D_DIM_DMM
    139   UInt xPredWedgeFromTex        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx );
    140   Void xPredContourFromTex      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge );
    141   Void xCopyTextureLumaBlock    ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );
    142 #endif
    143 #endif
     142
     143  Void destroy();
    144144
    145145public:
    146146  TComPrediction();
    147147  virtual ~TComPrediction();
    148  
    149   Void    initTempBuff();
    150  
     148
     149  Void    initTempBuff(ChromaFormat chromaFormatIDC);
     150
     151  ChromaFormat getChromaFormat() const { return m_cYuvPredTemp.getChromaFormat(); }
     152
    151153  // inter
    152154  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
    153  
     155
    154156  // motion vector prediction
    155157  Void getMvPredAMVP              ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred );
     158
     159  // Angular Intra
     160  Void predIntraAng               ( const ComponentID compID, UInt uiDirMode, Pel *piOrg /* Will be null for decoding */, UInt uiOrgStride, Pel* piPred, UInt uiStride, TComTU &rTu, const Bool bUseFilteredPredSamples, const Bool bUseLosslessDPCM = false );
     161
     162  Pel  predIntraGetPredValDC      ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight);
     163#if NH_3D_DMM
     164  Void predIntraLumaDmm           ( TComDataCU* pcCU, UInt uiAbsPartIdx, DmmID dmmType, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight );
     165  Void predContourFromTex         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool* segPattern );
     166  Void predBiSegDCs               ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool* biSegPattern, Int patternStride, Pel& predDC1, Pel& predDC2 );
     167  Void assignBiSegDCs             ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel valDC1, Pel valDC2 );
     168#endif
     169#if NH_3D_SDC_INTRA
     170  Void predConstantSDC            ( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& predDC );
     171#endif
    156172 
    157   // Angular Intra
    158   Void predIntraLumaAng           ( TComPattern* pcTComPattern, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft );
    159   Void predIntraChromaAng         ( Int* piSrc, UInt uiDirMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft );
    160  
    161 #if H_3D_DIM
    162   // Depth intra
    163   Void predIntraLumaDepth         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false
    164     , TComWedgelet* dmm4Segmentation = NULL
    165     );
    166 #if H_3D_DIM_SDC
    167   Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
    168                                     ,UInt uiIntraMode
    169                                     ,Bool orgDC=false
    170     );
    171 #endif
    172 #endif
    173  
    174 #if H_3D_DBBP
     173#if NH_3D_DBBP
    175174  PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU);
    176175  Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU);
    177   Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize );
    178 #endif
    179 
    180   Pel  predIntraGetPredValDC      ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft );
    181  
    182   Int* getPredicBuf()             { return m_piYuvExt;      }
    183   Int  getPredicBufWidth()        { return m_iYuvExtStride; }
    184   Int  getPredicBufHeight()       { return m_iYuvExtHeight; }
    185 
     176  Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY );
     177#endif
     178
     179  Pel  predIntraGetPredValDC      ( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft );
     180
     181  Pel*  getPredictorPtr           ( const ComponentID compID, const Bool bUseFilteredPredictions )
     182  {
     183    return m_piYuvExt[compID][bUseFilteredPredictions?PRED_BUF_FILTERED:PRED_BUF_UNFILTERED];
     184  }
     185
     186  // This function is actually still in TComPattern.cpp
     187  /// set parameters from CU data for accessing intra data
     188  Void initIntraPatternChType ( TComTU &rTu,
     189                              const ComponentID compID, const Bool bFilterRefSamples
     190                              DEBUG_STRING_FN_DECLARE(sDebug)
     191                              );
     192
     193  static Bool filteringIntraReferenceSamples(const ComponentID compID, UInt uiDirMode, UInt uiTuChWidth, UInt uiTuChHeight, const ChromaFormat chFmt, const Bool intraReferenceSmoothingDisabled);
     194
     195  static Bool UseDPCMForFirstPassIntraEstimation(TComTU &rTu, const UInt uiDirMode);
    186196};
    187197
Note: See TracChangeset for help on using the changeset viewer.