Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncSearch.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/TLibEncoder/TEncSearch.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. 
     4 * granted under this license.
    55 *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    3535    \brief    encoder search class (header)
    3636*/
    37 
    3837#ifndef __TENCSEARCH__
    3938#define __TENCSEARCH__
     
    4645#include "TLibCommon/TComTrQuant.h"
    4746#include "TLibCommon/TComPic.h"
     47#include "TLibCommon/TComRectangle.h"
    4848#include "TEncEntropy.h"
    4949#include "TEncSbac.h"
     
    5858// Class definition
    5959// ====================================================================================================================
     60
     61static const UInt MAX_NUM_REF_LIST_ADAPT_SR=2;
     62static const UInt MAX_IDX_ADAPT_SR=33;
     63static const UInt NUM_MV_PREDICTORS=3;
    6064
    6165/// encoder search class
     
    6367{
    6468private:
    65   TCoeff**        m_ppcQTTempCoeffY;
    66   TCoeff**        m_ppcQTTempCoeffCb;
    67   TCoeff**        m_ppcQTTempCoeffCr;
    68   TCoeff*         m_pcQTTempCoeffY;
    69   TCoeff*         m_pcQTTempCoeffCb;
    70   TCoeff*         m_pcQTTempCoeffCr;
     69  TCoeff**        m_ppcQTTempCoeff[MAX_NUM_COMPONENT /* 0->Y, 1->Cb, 2->Cr*/];
     70  TCoeff*         m_pcQTTempCoeff[MAX_NUM_COMPONENT];
    7171#if ADAPTIVE_QP_SELECTION
    72   Int**           m_ppcQTTempArlCoeffY;
    73   Int**           m_ppcQTTempArlCoeffCb;
    74   Int**           m_ppcQTTempArlCoeffCr;
    75   Int*            m_pcQTTempArlCoeffY;
    76   Int*            m_pcQTTempArlCoeffCb;
    77   Int*            m_pcQTTempArlCoeffCr;
     72  TCoeff**        m_ppcQTTempArlCoeff[MAX_NUM_COMPONENT];
     73  TCoeff*         m_pcQTTempArlCoeff[MAX_NUM_COMPONENT];
    7874#endif
    7975  UChar*          m_puhQTTempTrIdx;
    80   UChar*          m_puhQTTempCbf[3];
    81  
     76  UChar*          m_puhQTTempCbf[MAX_NUM_COMPONENT];
     77
    8278  TComYuv*        m_pcQTTempTComYuv;
    8379  TComYuv         m_tmpYuvPred; // To be used in xGetInterPredictionError() to avoid constant memory allocation/deallocation
    84   Pel*            m_pSharedPredTransformSkip[3];
    85   TCoeff*         m_pcQTTempTUCoeffY;
    86   TCoeff*         m_pcQTTempTUCoeffCb;
    87   TCoeff*         m_pcQTTempTUCoeffCr;
    88   UChar*          m_puhQTTempTransformSkipFlag[3];
     80
     81  Char*           m_phQTTempCrossComponentPredictionAlpha[MAX_NUM_COMPONENT];
     82  Pel*            m_pSharedPredTransformSkip[MAX_NUM_COMPONENT];
     83  TCoeff*         m_pcQTTempTUCoeff[MAX_NUM_COMPONENT];
     84  UChar*          m_puhQTTempTransformSkipFlag[MAX_NUM_COMPONENT];
    8985  TComYuv         m_pcQTTempTransformSkipTComYuv;
    9086#if ADAPTIVE_QP_SELECTION
    91   Int*            m_ppcQTTempTUArlCoeffY;
    92   Int*            m_ppcQTTempTUArlCoeffCb;
    93   Int*            m_ppcQTTempTUArlCoeffCr;
    94 #endif
     87  TCoeff*         m_ppcQTTempTUArlCoeff[MAX_NUM_COMPONENT];
     88#endif
     89
    9590protected:
    9691  // interface to option
    9792  TEncCfg*        m_pcEncCfg;
    98  
     93
    9994  // interface to classes
    10095  TComTrQuant*    m_pcTrQuant;
    10196  TComRdCost*     m_pcRdCost;
    10297  TEncEntropy*    m_pcEntropyCoder;
    103  
     98
    10499  // ME parameters
    105100  Int             m_iSearchRange;
    106101  Int             m_bipredSearchRange; // Search range for bi-prediction
    107102  Int             m_iFastSearch;
    108   Int             m_aaiAdaptSR[2][33];
     103#if NH_MV
     104  Bool            m_vertRestriction;
     105#endif
     106  Int             m_aaiAdaptSR[MAX_NUM_REF_LIST_ADAPT_SR][MAX_IDX_ADAPT_SR];
    109107  TComMv          m_cSrchRngLT;
    110108  TComMv          m_cSrchRngRB;
    111   TComMv          m_acMvPredictors[3];
    112  
     109  TComMv          m_acMvPredictors[NUM_MV_PREDICTORS]; // Left, Above, AboveRight. enum MVP_DIR first NUM_MV_PREDICTORS entries are suitable for accessing.
     110
    113111  // RD computation
    114112  TEncSbac***     m_pppcRDSbacCoder;
    115113  TEncSbac*       m_pcRDGoOnSbacCoder;
    116114  DistParam       m_cDistParam;
    117  
     115
    118116  // Misc.
    119117  Pel*            m_pTempPel;
    120118  const UInt*     m_puiDFilter;
    121   Int             m_iMaxDeltaQP;
    122 
    123 #if H_3D_VSO // M17
     119
     120#if NH_3D_VSO // M17
    124121  TComYuv         m_cYuvRecTemp;
    125122#endif
     
    127124  // UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS];
    128125  UInt            m_auiMVPIdxCost[AMVP_MAX_NUM_CANDS+1][AMVP_MAX_NUM_CANDS+1]; //th array bounds
    129  
     126
     127  TComMv          m_integerMv2Nx2N[NUM_REF_PIC_LIST_01][MAX_NUM_REF];
     128
     129  Bool            m_isInitialized;
    130130public:
    131131  TEncSearch();
    132132  virtual ~TEncSearch();
    133  
    134   Void init(  TEncCfg*      pcEncCfg,
     133
     134  Void init(TEncCfg*      pcEncCfg,
    135135            TComTrQuant*  pcTrQuant,
    136136            Int           iSearchRange,
    137137            Int           bipredSearchRange,
    138138            Int           iFastSearch,
    139             Int           iMaxDeltaQP,
     139            const UInt    maxCUWidth,
     140            const UInt    maxCUHeight,
     141            const UInt    maxTotalCUDepth,
    140142            TEncEntropy*  pcEntropyCoder,
    141143            TComRdCost*   pcRdCost,
    142144            TEncSbac***   pppcRDSbacCoder,
    143145            TEncSbac*     pcRDGoOnSbacCoder );
    144  
     146
     147  Void destroy();
     148
    145149protected:
    146  
     150
    147151  /// sub-function for motion vector refinement used in fractional-pel accuracy
    148   UInt  xPatternRefinement( TComPattern* pcPatternKey,
    149                            TComMv baseRefMv,
    150                            Int iFrac, TComMv& rcMvFrac );
    151  
     152  Distortion  xPatternRefinement( TComPattern* pcPatternKey,
     153                                  TComMv baseRefMv,
     154                                  Int iFrac, TComMv& rcMvFrac, Bool bAllowUseOfHadamard
     155                                 );
     156
    152157  typedef struct
    153158  {
    154     Pel*  piRefY;
    155     Int   iYStride;
    156     Int   iBestX;
    157     Int   iBestY;
    158     UInt  uiBestRound;
    159     UInt  uiBestDistance;
    160     UInt  uiBestSad;
    161     UChar ucPointNr;
     159    Pel*        piRefY;
     160    Int         iYStride;
     161    Int         iBestX;
     162    Int         iBestY;
     163    UInt        uiBestRound;
     164    UInt        uiBestDistance;
     165    Distortion  uiBestSad;
     166    UChar       ucPointNr;
    162167  } IntTZSearchStruct;
    163  
     168
    164169  // sub-functions for ME
    165170  __inline Void xTZSearchHelp         ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStruct, const Int iSearchX, const Int iSearchY, const UChar ucPointNr, const UInt uiDistance );
     
    167172  __inline Void xTZ8PointSquareSearch ( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist );
    168173  __inline Void xTZ8PointDiamondSearch( TComPattern* pcPatternKey, IntTZSearchStruct& rcStrukt, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, const Int iStartX, const Int iStartY, const Int iDist );
    169  
    170   Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiSAD, Bool Hadamard );
     174
     175  Void xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, Distortion& ruiSAD, Bool Hadamard );
    171176
    172177public:
    173   Void  preestChromaPredMode    ( TComDataCU* pcCU,
    174                                   TComYuv*    pcOrgYuv,
    175                                   TComYuv*    pcPredYuv );
    176   Void  estIntraPredQT          ( TComDataCU* pcCU,
    177                                   TComYuv*    pcOrgYuv,
    178                                   TComYuv*    pcPredYuv,
    179                                   TComYuv*    pcResiYuv,
     178  Void  estIntraPredLumaQT      ( TComDataCU* pcCU,
     179                                  TComYuv*    pcOrgYuv,
     180                                  TComYuv*    pcPredYuv,
     181                                  TComYuv*    pcResiYuv,
    180182                                  TComYuv*    pcRecoYuv,
    181                                   UInt&       ruiDistC,
    182                                   Bool        bLumaOnly
    183 #if H_3D_DIM
     183                                  Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE]
     184                                  DEBUG_STRING_FN_DECLARE(sDebug)
     185#if NH_3D_ENC_DEPTH
    184186                                , Bool        bOnlyIVP
    185187#endif
    186188                                );
    187   Void  estIntraPredChromaQT    ( TComDataCU* pcCU,
    188                                   TComYuv*    pcOrgYuv,
    189                                   TComYuv*    pcPredYuv,
    190                                   TComYuv*    pcResiYuv,
     189
     190  Void  estIntraPredChromaQT    ( TComDataCU* pcCU,
     191                                  TComYuv*    pcOrgYuv,
     192                                  TComYuv*    pcPredYuv,
     193                                  TComYuv*    pcResiYuv,
    191194                                  TComYuv*    pcRecoYuv,
    192                                   UInt        uiPreCalcDistC );
    193 #if H_3D
     195                                  Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE]
     196                                  DEBUG_STRING_FN_DECLARE(sDebug));
     197#if NH_3D_DIS
    194198  Void  estIntraPredDIS        ( TComDataCU* pcCU,
    195199                                 TComYuv*    pcOrgYuv,
     
    200204                                 Bool        bLumaOnly );
    201205#endif 
     206
    202207  /// encoder estimation - inter prediction (non-skip)
    203208  Void predInterSearch          ( TComDataCU* pcCU,
    204209                                  TComYuv*    pcOrgYuv,
    205                                   TComYuv*&   rpcPredYuv,
    206                                   TComYuv*&   rpcResiYuv,
    207                                   TComYuv*&   rpcRecoYuv,
    208 #if H_3D_FAST_TEXTURE_ENCODING
     210                                  TComYuv*    pcPredYuv,
     211                                  TComYuv*    pcResiYuv,
     212                                  TComYuv*    pcRecoYuv
     213                                  DEBUG_STRING_FN_DECLARE(sDebug),
     214#if NH_3D_FAST_TEXTURE_ENCODING
    209215                                  Bool        bFMD,
    210216#endif
     
    214220#endif
    215221                                );
    216  
     222
    217223  /// encode residual and compute rd-cost for inter mode
    218224  Void encodeResAndCalcRdInterCU( TComDataCU* pcCU,
    219225                                  TComYuv*    pcYuvOrg,
    220226                                  TComYuv*    pcYuvPred,
    221                                   TComYuv*&   rpcYuvResi,
    222                                   TComYuv*&   rpcYuvResiBest,
    223                                   TComYuv*&   rpcYuvRec,
    224                                   Bool        bSkipRes );
    225 #if H_3D_INTER_SDC
     227                                  TComYuv*    pcYuvResi,
     228                                  TComYuv*    pcYuvResiBest,
     229                                  TComYuv*    pcYuvRec,
     230                                  Bool        bSkipResidual
     231                                  DEBUG_STRING_FN_DECLARE(sDebug) );
     232#if NH_3D_SDC_INTER
    226233  Void encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU,
    227     TComYuv* pcOrg,
    228     TComYuv* pcPred,
    229     TComYuv* pcResi,
    230     TComYuv* pcRec,
    231     Int      uiOffset,
    232     const UInt uiDepth );
    233 #endif
     234                                     TComYuv* pcOrg,
     235                                     TComYuv* pcPred,
     236                                     TComYuv* pcResi,
     237                                     TComYuv* pcRec,
     238                                     Int      uiOffset,
     239                                     const UInt uiDepth );
     240#endif
     241
    234242  /// set ME search range
    235   Void setAdaptiveSearchRange   ( Int iDir, Int iRefIdx, Int iSearchRange) { m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; }
    236  
    237   Void xEncPCM    (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType eText);
    238   Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv );
     243  Void setAdaptiveSearchRange   ( Int iDir, Int iRefIdx, Int iSearchRange) { assert(iDir < MAX_NUM_REF_LIST_ADAPT_SR && iRefIdx<Int(MAX_IDX_ADAPT_SR)); m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; }
     244
     245  Void xEncPCM    (TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piOrg, Pel* piPCM, Pel* piPred, Pel* piResi, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, const ComponentID compID );
     246  Void IPCMSearch (TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* rpcPredYuv, TComYuv* rpcResiYuv, TComYuv* rpcRecoYuv );
    239247protected:
    240  
     248
    241249  // -------------------------------------------------------------------------------------------------------------------
    242250  // Intra search
    243251  // -------------------------------------------------------------------------------------------------------------------
    244  
    245   Void  xEncSubdivCbfQT           ( TComDataCU*  pcCU,
    246                                     UInt         uiTrDepth,
    247                                     UInt         uiAbsPartIdx,
     252
     253  Void  xEncSubdivCbfQT           ( TComTU      &rTu,
    248254                                    Bool         bLuma,
    249255                                    Bool         bChroma );
    250256
    251   Void  xEncCoeffQT               ( TComDataCU*  pcCU,
    252                                     UInt         uiTrDepth,
    253                                     UInt         uiAbsPartIdx,
    254                                     TextType     eTextType,
     257  Void  xEncCoeffQT               ( TComTU &rTu,
     258                                    ComponentID  component,
    255259                                    Bool         bRealCoeff );
    256260  Void  xEncIntraHeader           ( TComDataCU*  pcCU,
     
    259263                                    Bool         bLuma,
    260264                                    Bool         bChroma );
    261   UInt  xGetIntraBitsQT           ( TComDataCU*  pcCU,
    262                                     UInt         uiTrDepth,
    263                                     UInt         uiAbsPartIdx,
     265  UInt  xGetIntraBitsQT           ( TComTU &rTu,
    264266                                    Bool         bLuma,
    265267                                    Bool         bChroma,
    266268                                    Bool         bRealCoeff );
    267   UInt  xGetIntraBitsQTChroma    ( TComDataCU*   pcCU,
    268                                    UInt          uiTrDepth,
    269                                    UInt          uiAbsPartIdx,
    270                                    UInt          uiChromaId,
     269
     270  UInt  xGetIntraBitsQTChroma    ( TComTU &rTu,
     271                                   ComponentID compID,
    271272                                   Bool          bRealCoeff );
    272  
    273   Void  xIntraCodingLumaBlk       ( TComDataCU*  pcCU,
    274                                     UInt         uiTrDepth,
    275                                     UInt         uiAbsPartIdx,
    276                                     TComYuv*     pcOrgYuv,
    277                                     TComYuv*     pcPredYuv,
    278                                     TComYuv*     pcResiYuv,
    279 #if H_3D_VSO
     273
     274  Void  xIntraCodingTUBlock       (       TComYuv*      pcOrgYuv,
     275                                          TComYuv*      pcPredYuv,
     276                                          TComYuv*      pcResiYuv,
     277                                          Pel           resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
     278                                    const Bool          checkCrossCPrediction,
     279#if NH_3D_VSO
    280280                                    Dist&        ruiDist,
    281281#else
    282                                     UInt&        ruiDist,
    283 #endif
    284                                     Int         default0Save1Load2 = 0
    285 #if H_3D_DIM_ENC
    286                                   , Bool          zeroResi = false
    287 #endif
    288                                     );
    289   Void  xIntraCodingChromaBlk     ( TComDataCU*  pcCU,
    290                                     UInt         uiTrDepth,
    291                                     UInt         uiAbsPartIdx,
    292                                     TComYuv*     pcOrgYuv,
    293                                     TComYuv*     pcPredYuv,
    294                                     TComYuv*     pcResiYuv,
    295                                     UInt&        ruiDist,
    296                                     UInt         uiChromaId,
    297                                     Int          default0Save1Load2 = 0 );
    298 
    299   Void  xRecurIntraCodingQT       ( TComDataCU*  pcCU,
    300                                     UInt         uiTrDepth,
    301                                     UInt         uiAbsPartIdx,
    302                                     Bool         bLumaOnly,
    303                                     TComYuv*     pcOrgYuv,
    304                                     TComYuv*     pcPredYuv,
    305                                     TComYuv*     pcResiYuv,
    306 #if H_3D_VSO
     282                                    Distortion&   ruiDist,
     283#endif
     284const ComponentID   compID,
     285                                          TComTU        &rTu
     286                                    DEBUG_STRING_FN_DECLARE(sTest)
     287                                         ,Int           default0Save1Load2 = 0
     288#if NH_3D_ENC_DEPTH
     289                                  , Bool          zeroResiFlag = false
     290#endif
     291                                   );
     292
     293  Void  xRecurIntraCodingLumaQT   ( TComYuv*    pcOrgYuv,
     294                                    TComYuv*    pcPredYuv,
     295                                    TComYuv*    pcResiYuv,
     296                                    Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
     297#if NH_3D_VSO
    307298                                    Dist&        ruiDistY,
    308299#else
    309                                     UInt&        ruiDistY,
    310 #endif
    311                                     UInt&        ruiDistC,
     300                                    Distortion& ruiDistY,
     301#endif
    312302#if HHI_RQT_INTRA_SPEEDUP
    313                                    Bool         bCheckFirst,
    314 #endif
    315                                    Double&      dRDCost
    316 #if H_3D_DIM_ENC
    317                                    , Bool          zeroResi = false
    318 #endif
    319                                    );
    320  
    321   Void  xSetIntraResultQT         ( TComDataCU*  pcCU,
    322                                     UInt         uiTrDepth,
    323                                     UInt         uiAbsPartIdx,
    324                                     Bool         bLumaOnly,
    325                                     TComYuv*     pcRecoYuv );
    326  
    327   Void  xRecurIntraChromaCodingQT ( TComDataCU*  pcCU,
    328                                     UInt         uiTrDepth,
    329                                     UInt         uiAbsPartIdx,
    330                                     TComYuv*     pcOrgYuv,
    331                                     TComYuv*     pcPredYuv,
    332                                     TComYuv*     pcResiYuv,
    333                                     UInt&        ruiDist );
    334   Void  xSetIntraResultChromaQT   ( TComDataCU*  pcCU,
    335                                     UInt         uiTrDepth,
    336                                     UInt         uiAbsPartIdx,
    337                                     TComYuv*     pcRecoYuv );
    338  
    339   Void  xStoreIntraResultQT       ( TComDataCU*  pcCU,
    340                                     UInt         uiTrDepth,
    341                                     UInt         uiAbsPartIdx,
    342                                     Bool         bLumaOnly );
    343   Void  xLoadIntraResultQT        ( TComDataCU*  pcCU,
    344                                     UInt         uiTrDepth,
    345                                     UInt         uiAbsPartIdx,
    346                                     Bool         bLumaOnly );
    347   Void xStoreIntraResultChromaQT  ( TComDataCU*  pcCU,
    348                                     UInt         uiTrDepth,
    349                                     UInt         uiAbsPartIdx,
    350                                     UInt         stateU0V1Both2 );
    351   Void xLoadIntraResultChromaQT   ( TComDataCU*  pcCU,
    352                                     UInt         uiTrDepth,
    353                                     UInt         uiAbsPartIdx,
    354                                     UInt         stateU0V1Both2 );
    355 
    356 #if H_3D
     303                                    Bool         bCheckFirst,
     304#endif
     305                                    Double&      dRDCost,
     306                                    TComTU      &rTu
     307                                    DEBUG_STRING_FN_DECLARE(sDebug)
     308#if NH_3D_ENC_DEPTH
     309                                  , Bool        zeroResiFlag = false
     310#endif
     311                                  );
     312
     313  Void  xSetIntraResultLumaQT     ( TComYuv*     pcRecoYuv,
     314                                    TComTU &rTu);
     315
     316  Void xStoreCrossComponentPredictionResult  (       Pel    *pResiLuma,
     317                                               const Pel    *pBestLuma,
     318                                                     TComTU &rTu,
     319                                               const Int     xOffset,
     320                                               const Int     yOffset,
     321                                               const Int     strideResi,
     322                                               const Int     strideBest );
     323
     324  Char xCalcCrossComponentPredictionAlpha    (       TComTU &rTu,
     325                                               const ComponentID compID,
     326                                               const Pel*        piResiL,
     327                                               const Pel*        piResiC,
     328                                               const Int         width,
     329                                               const Int         height,
     330                                               const Int         strideL,
     331                                               const Int         strideC );
     332
     333  Void  xRecurIntraChromaCodingQT ( TComYuv*    pcOrgYuv,
     334                                    TComYuv*    pcPredYuv,
     335                                    TComYuv*    pcResiYuv,
     336                                    Pel         resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE],
     337#if NH_3D_VSO
     338                                    Dist&       ruiDist,
     339#else
     340                                    Distortion& ruiDist,
     341#endif
     342                                    TComTU      &rTu
     343                                    DEBUG_STRING_FN_DECLARE(sDebug));
     344
     345  Void  xSetIntraResultChromaQT   ( TComYuv*    pcRecoYuv, TComTU &rTu);
     346
     347  Void  xStoreIntraResultQT       ( const ComponentID compID, TComTU &rTu);
     348  Void  xLoadIntraResultQT        ( const ComponentID compID, TComTU &rTu);
     349#if NH_3D_DIS
    357350  Void xIntraCodingDIS           ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode );
    358351#endif
    359 #if H_3D_DIM
     352
    360353  // -------------------------------------------------------------------------------------------------------------------
    361354  // Depth intra search
    362355  // -------------------------------------------------------------------------------------------------------------------
    363   Void xCalcBiSegDCs              ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2 );
    364 #if H_3D_DIM_DMM
     356#if NH_3D_DMM
     357  Void xCalcBiSegDCs              ( Pel* ptrSrc, UInt srcStride, Bool* biSegPattern, Int patternStride, Pel& valDC1, Pel& valDC2, Pel defaultVal, Bool subSamp = false );
    365358  Void xSearchDmmDeltaDCs         ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );
    366359  Void xSearchDmm1Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx );
    367360#endif
    368 #if H_3D_DIM_SDC
     361#if NH_3D_SDC_INTRA
    369362  Void xIntraCodingSDC            ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi    );
    370 #endif
    371 #endif
     363  Void xCalcConstantSDC           ( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& valDC );
     364#endif
     365
    372366
    373367  // -------------------------------------------------------------------------------------------------------------------
    374368  // Inter search (AMP)
    375369  // -------------------------------------------------------------------------------------------------------------------
    376  
     370
    377371  Void xEstimateMvPredAMVP        ( TComDataCU* pcCU,
    378372                                    TComYuv*    pcOrgYuv,
     
    382376                                    TComMv&     rcMvPred,
    383377                                    Bool        bFilled = false
    384                                   , UInt*       puiDistBiP = NULL
    385                                   #if ZERO_MVD_EST
    386                                   , UInt*       puiDist = NULL
    387                                   #endif
     378                                  , Distortion* puiDistBiP = NULL
    388379                                     );
    389  
     380
    390381  Void xCheckBestMVP              ( TComDataCU* pcCU,
    391382                                    RefPicList  eRefPicList,
     
    394385                                    Int&        riMVPIdx,
    395386                                    UInt&       ruiBits,
    396                                     UInt&       ruiCost );
    397  
    398   UInt xGetTemplateCost           ( TComDataCU* pcCU,
    399                                     UInt        uiPartIdx,
     387                                    Distortion& ruiCost );
     388
     389  Distortion xGetTemplateCost    ( TComDataCU*  pcCU,
    400390                                    UInt        uiPartAddr,
    401391                                    TComYuv*    pcOrgYuv,
     
    408398                                    Int         iSizeX,
    409399                                    Int         iSizeY
    410                                   #if ZERO_MVD_EST
    411                                   , UInt&       ruiDist
    412                                   #endif
    413400                                   );
    414  
    415  
     401
     402
    416403  Void xCopyAMVPInfo              ( AMVPInfo*   pSrc, AMVPInfo* pDst );
    417404  UInt xGetMvpIdxBits             ( Int iIdx, Int iNum );
    418405  Void xGetBlkBits                ( PartSize  eCUMode, Bool bPSlice, Int iPartIdx,  UInt uiLastMode, UInt uiBlkBit[3]);
    419  
    420   Void xMergeEstimation           ( TComDataCU*     pcCU,
    421                                     TComYuv*        pcYuvOrg,
    422                                     Int             iPartIdx,
    423                                     UInt&           uiInterDir,
    424                                     TComMvField*    pacMvField,
    425                                     UInt&           uiMergeIndex,
    426                                     UInt&           ruiCost
    427                                   , TComMvField* cMvFieldNeighbours, 
    428                                     UChar* uhInterDirNeighbours
    429 #if H_3D_VSP
     406
     407  Void xMergeEstimation           ( TComDataCU*  pcCU,
     408                                    TComYuv*     pcYuvOrg,
     409                                    Int          iPartIdx,
     410                                    UInt&        uiInterDir,
     411                                    TComMvField* pacMvField,
     412                                    UInt&        uiMergeIndex,
     413                                    Distortion&  ruiCost,
     414                                    TComMvField* cMvFieldNeighbours,
     415                                    UChar*       uhInterDirNeighbours,
     416                                    Int&         numValidMergeCand
     417#if NH_3D_VSP
    430418                                  , Int* vspFlag
    431419#endif
    432 #if H_3D_SPIVMP
     420#if NH_3D_SPIVMP
    433421                                  , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
    434422#endif
    435                                   , Int& numValidMergeCand
    436423                                   );
    437424
    438425  Void xRestrictBipredMergeCand   ( TComDataCU*     pcCU,
    439426                                    UInt            puIdx,
    440                                     TComMvField*    mvFieldNeighbours, 
    441                                     UChar*          interDirNeighbours, 
     427                                    TComMvField*    mvFieldNeighbours,
     428                                    UChar*          interDirNeighbours,
    442429                                    Int             numValidMergeCand );
    443430
     431
    444432  // -------------------------------------------------------------------------------------------------------------------
    445433  // motion estimation
    446434  // -------------------------------------------------------------------------------------------------------------------
    447  
    448   Void xMotionEstimation          ( TComDataCU*   pcCU,
    449                                     TComYuv*      pcYuvOrg,
    450                                     Int           iPartIdx,
    451                                     RefPicList    eRefPicList,
    452                                     TComMv*       pcMvPred,
    453                                     Int           iRefIdxPred,
    454                                     TComMv&       rcMv,
    455                                     UInt&         ruiBits,
    456                                     UInt&         ruiCost,
    457                                     Bool          bBi = false  );
    458  
    459   Void xTZSearch                  ( TComDataCU*   pcCU,
    460                                     TComPattern*  pcPatternKey,
    461                                     Pel*          piRefY,
    462                                     Int           iRefStride,
    463                                     TComMv*       pcMvSrchRngLT,
    464                                     TComMv*       pcMvSrchRngRB,
    465                                     TComMv&       rcMv,
    466                                     UInt&         ruiSAD );
    467  
    468 #if H_MV
    469   Void xSetSearchRange           (  TComDataCU* pcCU,
    470                                     TComMv& cMvPred,
    471                                     Int iSrchRng,
    472                                     TComMv& rcMvSrchRngLT,
    473                                     TComMv& rcMvSrchRngRB,
    474                                     Bool bMv_VRng_Restricted,
    475                                     Int iVerDispSrchRng );
     435
     436  Void xMotionEstimation          ( TComDataCU*  pcCU,
     437                                    TComYuv*     pcYuvOrg,
     438                                    Int          iPartIdx,
     439                                    RefPicList   eRefPicList,
     440                                    TComMv*      pcMvPred,
     441                                    Int          iRefIdxPred,
     442                                    TComMv&      rcMv,
     443                                    UInt&        ruiBits,
     444                                    Distortion&  ruiCost,
     445                                    Bool         bBi = false  );
     446
     447  Void xTZSearch                  ( TComDataCU*  pcCU,
     448                                    TComPattern* pcPatternKey,
     449                                    Pel*         piRefY,
     450                                    Int          iRefStride,
     451                                    TComMv*      pcMvSrchRngLT,
     452                                    TComMv*      pcMvSrchRngRB,
     453                                    TComMv&      rcMv,
     454                                    Distortion&  ruiSAD,
     455                                    const TComMv *pIntegerMv2Nx2NPred
     456                                    );
     457
     458  Void xTZSearchSelective         ( TComDataCU*  pcCU,
     459                                    TComPattern* pcPatternKey,
     460                                    Pel*         piRefY,
     461                                    Int          iRefStride,
     462                                    TComMv*      pcMvSrchRngLT,
     463                                    TComMv*      pcMvSrchRngRB,
     464                                    TComMv&      rcMv,
     465                                    Distortion&  ruiSAD,
     466                                    const TComMv *pIntegerMv2Nx2NPred
     467                                    );
     468
     469  Void xSetSearchRange            ( TComDataCU*  pcCU,
     470                                    TComMv&      cMvPred,
     471                                    Int          iSrchRng,
     472                                    TComMv&      rcMvSrchRngLT,
     473                                    TComMv&      rcMvSrchRngRB );
     474
     475  Void xPatternSearchFast         ( TComDataCU*  pcCU,
     476                                    TComPattern* pcPatternKey,
     477                                    Pel*         piRefY,
     478                                    Int          iRefStride,
     479                                    TComMv*      pcMvSrchRngLT,
     480                                    TComMv*      pcMvSrchRngRB,
     481                                    TComMv&      rcMv,
     482                                    Distortion&  ruiSAD,
     483                                    const TComMv* pIntegerMv2Nx2NPred
     484                                  );
     485
     486  Void xPatternSearch             ( TComPattern* pcPatternKey,
     487                                    Pel*         piRefY,
     488                                    Int          iRefStride,
     489                                    TComMv*      pcMvSrchRngLT,
     490                                    TComMv*      pcMvSrchRngRB,
     491                                    TComMv&      rcMv,
     492                                    Distortion&  ruiSAD );
     493
     494  Void xPatternSearchFracDIF      (
     495                                    Bool         bIsLosslessCoded,
     496                                    TComPattern* pcPatternKey,
     497                                    Pel*         piRefY,
     498                                    Int          iRefStride,
     499                                    TComMv*      pcMvInt,
     500                                    TComMv&      rcMvHalf,
     501                                    TComMv&      rcMvQter,
     502                                    Distortion&  ruiCost
     503                                   );
     504
     505  Void xExtDIFUpSamplingH( TComPattern* pcPattern );
     506  Void xExtDIFUpSamplingQ( TComPattern* pcPatternKey, TComMv halfPelRef );
     507
     508  // -------------------------------------------------------------------------------------------------------------------
     509  // T & Q & Q-1 & T-1
     510  // -------------------------------------------------------------------------------------------------------------------
     511
     512  Void xEncodeInterResidualQT( const ComponentID compID, TComTU &rTu );
     513#if NH_3D_VSO // M26
     514  Void xEstimateInterResidualQT( TComYuv* pcResi, TComYuv* pcOrg, TComYuv* pcPred,  Double &rdCost, UInt &ruiBits, Dist       &ruiDist, Dist       *puiZeroDist, TComTU &rTu DEBUG_STRING_FN_DECLARE(sDebug) );
    476515#else
    477   Void xSetSearchRange            ( TComDataCU*   pcCU,
    478                                     TComMv&       cMvPred,
    479                                     Int           iSrchRng,
    480                                     TComMv&       rcMvSrchRngLT,
    481                                     TComMv&       rcMvSrchRngRB );
    482 #endif
    483  
    484   Void xPatternSearchFast         ( TComDataCU*   pcCU,
    485                                     TComPattern*  pcPatternKey,
    486                                     Pel*          piRefY,
    487                                     Int           iRefStride,
    488                                     TComMv*       pcMvSrchRngLT,
    489                                     TComMv*       pcMvSrchRngRB,
    490                                     TComMv&       rcMv,
    491                                     UInt&         ruiSAD );
    492  
    493   Void xPatternSearch             ( TComPattern*  pcPatternKey,
    494                                     Pel*          piRefY,
    495                                     Int           iRefStride,
    496                                     TComMv*       pcMvSrchRngLT,
    497                                     TComMv*       pcMvSrchRngRB,
    498                                     TComMv&       rcMv,
    499                                     UInt&         ruiSAD );
    500  
    501   Void xPatternSearchFracDIF      ( TComDataCU*   pcCU,
    502                                     TComPattern*  pcPatternKey,
    503                                     Pel*          piRefY,
    504                                     Int           iRefStride,
    505                                     TComMv*       pcMvInt,
    506                                     TComMv&       rcMvHalf,
    507                                     TComMv&       rcMvQter,
    508                                     UInt&         ruiCost
    509                                    ,Bool biPred
    510                                    );
    511  
    512   Void xExtDIFUpSamplingH( TComPattern* pcPattern, Bool biPred  );
    513   Void xExtDIFUpSamplingQ( TComPattern* pcPatternKey, TComMv halfPelRef, Bool biPred );
    514  
    515   // -------------------------------------------------------------------------------------------------------------------
    516   // T & Q & Q-1 & T-1
    517   // -------------------------------------------------------------------------------------------------------------------
    518  
    519   Void xEncodeResidualQT( TComDataCU* pcCU, UInt uiAbsPartIdx, const UInt uiDepth, Bool bSubdivAndCbf, TextType eType );
    520 #if H_3D_VSO // M26
    521   Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, Dist &ruiDist, Dist *puiZeroDist );
    522 #else
    523   Void xEstimateResidualQT( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx, UInt absTUPartIdx,TComYuv* pcResi, const UInt uiDepth, Double &rdCost, UInt &ruiBits, UInt &ruiDist, UInt *puiZeroDist );
    524 #endif
    525   Void xSetResidualQTData( TComDataCU* pcCU, UInt uiQuadrant, UInt uiAbsPartIdx,UInt absTUPartIdx, TComYuv* pcResi, UInt uiDepth, Bool bSpatial );
    526  
    527   UInt  xModeBitsIntra ( TComDataCU* pcCU, UInt uiMode, UInt uiPU, UInt uiPartOffset, UInt uiDepth, UInt uiInitTrDepth );
     516  Void xEstimateInterResidualQT( TComYuv* pcResi                                  , Double &rdCost, UInt &ruiBits, Distortion &ruiDist, Distortion *puiZeroDist, TComTU &rTu DEBUG_STRING_FN_DECLARE(sDebug) );
     517#endif
     518  Void xSetInterResidualQTData( TComYuv* pcResi, Bool bSpatial, TComTU &rTu  );
     519
     520  UInt  xModeBitsIntra ( TComDataCU* pcCU, UInt uiMode, UInt uiPartOffset, UInt uiDepth, const ChannelType compID );
    528521  UInt  xUpdateCandList( UInt uiMode, Double uiCost, UInt uiFastCandNum, UInt * CandModeList, Double * CandCostList );
    529  
     522
    530523  // -------------------------------------------------------------------------------------------------------------------
    531524  // compute symbol bits
    532525  // -------------------------------------------------------------------------------------------------------------------
    533  
    534   Void xAddSymbolBitsInter        ( TComDataCU*   pcCU,
    535                                    UInt          uiQp,
    536                                    UInt          uiTrMode,
    537                                    UInt&         ruiBits,
    538                                    TComYuv*&     rpcYuvRec,
    539                                    TComYuv*      pcYuvPred,
    540                                    TComYuv*&     rpcYuvResi );
    541  
     526
     527  Void xAddSymbolBitsInter       ( TComDataCU*   pcCU,
     528                                   UInt&         ruiBits);
     529
    542530  Void  setWpScalingDistParam( TComDataCU* pcCU, Int iRefIdx, RefPicList eRefPicListCur );
    543   inline  Void  setDistParamComp( UInt uiComp )  { m_cDistParam.uiComp = uiComp; }
    544  
     531  inline  Void  setDistParamComp( ComponentID compIdx )  { m_cDistParam.compIdx = compIdx; }
     532
    545533};// END CLASS DEFINITION TEncSearch
    546534
Note: See TracChangeset for help on using the changeset viewer.