Changeset 443 in 3DVCSoftware for trunk/source/Lib


Ignore:
Timestamp:
26 May 2013, 15:41:34 (11 years ago)
Author:
tech
Message:
  • Reintegrated branch 6.2-dev0 rev. 442.
  • Changed version number.
  • Added coding results.
Location:
trunk/source/Lib
Files:
55 edited

Legend:

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

    r333 r443  
    5858
    5959#define HM_VERSION        "6.1"
    60 #define NV_VERSION        "6.2"                  ///< Current software version
     60#define NV_VERSION        "7.0"                  ///< Current software version
    6161
    6262// ====================================================================================================================
  • trunk/source/Lib/TLibCommon/ContextTables.h

    r332 r443  
    101101#define NUM_ALF_SVLC_CTX              3       ///< number of context models for ALF SVLC (filter coeff.)
    102102
     103#if LGE_SAO_MIGRATION_D0091
     104#define NUM_SAO_MERGE_FLAG_CTX        1       ///< number of context models for SAO merge flags
     105#define NUM_SAO_TYPE_IDX_CTX          1       ///< number of context models for SAO type index
     106#else
    103107#define NUM_SAO_FLAG_CTX              1       ///< number of context models for SAO flag
    104108#define NUM_SAO_UVLC_CTX              2       ///< number of context models for SAO UVLC
     
    108112#define NUM_SAO_MERGE_UP_FLAG_CTX     1       ///< number of context models for AO SVLC (filter coeff.)
    109113#define NUM_SAO_TYPE_IDX_CTX          2       ///< number of context models for AO SVLC (filter coeff.)
     114#endif
    110115#define CNU                          154      ///< dummy initialization value for unused context models 'Context model Not Used'
    111116
     
    128133
    129134#if RWTH_SDC_DLT_B0036
     135#if PKU_QC_DEPTH_INTRA_UNI_D0195
     136#define DEPTH_MODE_NUM_FLAG_CTX          8
     137#define DMM_DELTA_NUM_FLAG_CTX           1
     138#else
    130139#define SDC_NUM_FLAG_CTX                 3
     140#endif
    131141#define SDC_NUM_RESIDUAL_FLAG_CTX        1
     142#if !RWTH_SDC_CTX_SIMPL_D0032
    132143#define SDC_NUM_SIGN_FLAG_CTX            1
     144#endif
     145#if LGE_CONCATENATE_D0141
     146#define SDC_NUM_RESIDUAL_CTX             1
     147#else
     148#if RWTH_SDC_CTX_SIMPL_D0032
     149#define SDC_NUM_RESIDUAL_CTX             8
     150#else
    133151#define SDC_NUM_RESIDUAL_CTX             10
     152#endif
     153#endif
    134154
    135155#define SDC_NUM_PRED_MODE_CTX            5
     
    376396  { 141,  154,  159, },
    377397};
    378 
     398#if LGE_SAO_MIGRATION_D0091
     399static const UChar
     400INIT_SAO_MERGE_FLAG[3][NUM_SAO_MERGE_FLAG_CTX] =
     401{
     402  { 153,  },
     403  { 153,  },
     404  { 153,  },
     405};
     406
     407static const UChar
     408INIT_SAO_TYPE_IDX[3][NUM_SAO_TYPE_IDX_CTX] =
     409{
     410  { 200, },
     411  { 185, },
     412  { 160, },
     413};
     414#else
    379415static const UChar
    380416INIT_SAO_FLAG[3][NUM_SAO_FLAG_CTX] = 
     
    424460  { 200,  140, },
    425461};
     462#endif
    426463
    427464static const UChar
     
    487524#endif
    488525};
     526#if QC_ARP_D0177
     527#define NUM_ARPW_CTX                  4       ///< number of context models for generalized residual prediction weighting factor
     528static const UChar
     529INIT_ARPW[3][NUM_ARPW_CTX] =
     530{
     531  { 154 , 154 , 154 , 154 },
     532  { 154 , 154 , 154 , 154 },
     533  { 154 , 154 , 154 , 154 },
     534};
     535#endif
    489536
    490537#if LGE_EDGE_INTRA_A0070
     
    523570
    524571#if RWTH_SDC_DLT_B0036
     572#if PKU_QC_DEPTH_INTRA_UNI_D0195
     573static const UChar INIT_DEPTHMODE_FLAG[3][DEPTH_MODE_NUM_FLAG_CTX]=
     574{
     575  {0,  0,  64,   0, CNU,   0, CNU, 0},
     576  {0, 64,   0, CNU,   0, CNU,   0, 0},
     577  {64, 0, CNU,   0, CNU,   0,   0, 0}
     578};
     579static const UChar INIT_DMMDELTA_FLAG[3][DMM_DELTA_NUM_FLAG_CTX]=
     580{
     581  {0},
     582  {0},
     583  {64}
     584};
     585#else
    525586static const Short INIT_SDC_FLAG[3][SDC_NUM_FLAG_CTX][2] =
    526587{
     
    535596  }
    536597};
    537 
     598#endif
     599
     600#if RWTH_SDC_CTX_SIMPL_D0032
     601static const UChar INIT_SDC_RESIDUAL_FLAG[3][SDC_NUM_RESIDUAL_FLAG_CTX] =
     602{
     603  {
     604    CNU
     605   
     606  },
     607  {
     608    CNU
     609  },
     610  {
     611    CNU
     612  }
     613};
     614   
     615#if LGE_CONCATENATE_D0141
     616static const UChar INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] =
     617{
     618    {
     619         155
     620    },
     621    {
     622         155
     623    },
     624    {
     625        155
     626    }
     627};
     628#else
     629static const UChar INIT_SDC_RESIDUAL[3][SDC_NUM_RESIDUAL_CTX] =
     630{
     631  {
     632    CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU
     633  },
     634  {
     635    CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU
     636  },
     637  {
     638    CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU
     639  }
     640};
     641#endif
     642
     643static const UChar INIT_SDC_PRED_MODE[3][3*SDC_NUM_PRED_MODE_CTX] =
     644{
     645  {
     646    CNU,    CNU
     647    ,CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU
     648  },
     649  {
     650    CNU,    CNU
     651    ,CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU
     652  },
     653  {
     654    CNU,    CNU
     655    ,CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU
     656  }
     657};
     658#else
    538659static const Short INIT_SDC_RESIDUAL_FLAG[3][3*SDC_NUM_RESIDUAL_FLAG_CTX][2] =
    539660{
     
    613734};
    614735#endif
     736#endif
    615737
    616738//! \}
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r332 r443  
    5353#if MERL_VSP_C0152
    5454
     55#if MTK_D0156
     56#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && ( (!m_pcSlice->getSPS()->getUseVSPCompensation()) || (!( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )))
     57#else
    5558#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )
    56 
    57 inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo )
    58 {
     59#endif
     60
     61inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo
     62#if QC_BVSP_CleanUP_D0191
     63  , UChar *puhInterDirNeighbours
     64#endif
     65#if MERL_VSP_NBDV_RefVId_Fix_D0166
     66    , Int*     iVSPDirTrue
     67#endif
     68    )
     69{
     70#if MTK_D0156
     71    if( !m_pcSlice->getSPS()->getUseVSPCompensation() )
     72    {
     73        return;
     74    }
     75#endif
     76
    5977  Int vspIdx = (Int) pcCURef->getVSPIndex(uiIdx);
    6078  if( vspIdx != 0 )
     
    6987    if (vspIdx < 4)
    7088    {
     89#if QC_BVSP_CleanUP_D0191
     90      puhInterDirNeighbours[ iCount] = 1;
     91#endif
     92#if MERL_VSP_NBDV_RefVId_Fix_D0166
     93      if(pDInfo->iN > 0 )
     94      { // using derived disparity and store corresponding used reference list and ref idx
     95        iVSPDirTrue[idx] = pDInfo->m_aListIdx[0];
     96        assert(pDInfo->m_aRefIdx[0] < 0);
     97#if MTK_VSP_USING_NBDV_D0105
     98        pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     99#else
     100        pcMvFieldNeighbours[iCount<<1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     101#endif
     102        if ( pcCURef->getSlice()->isInterB() )
     103        {
     104#if MTK_VSP_USING_NBDV_D0105
     105          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     106#else
     107          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     108#endif
     109        }
     110      }
     111      else
     112      { // using the original neighboring block vsp reference list
     113        TComMv cMvPred = pcCURef->getCUMvField(REF_PIC_LIST_0)->getMv(uiIdx);
     114        Int    refId   = pcCURef->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiIdx);
     115
     116        assert(refId < 0);
     117        iVSPDirTrue[idx] = pcCURef->getVSPDir(uiIdx);
     118        pcMvFieldNeighbours[iCount<<1].setMvField( cMvPred, refId );
     119        if ( pcCURef->getSlice()->isInterB() )
     120        {
     121          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cMvPred, refId );
     122        }
     123      }
     124
     125#else // !MERL_VSP_NBDV_RefVId_Fix_D0166
     126
     127#if MTK_VSP_USING_NBDV_D0105
     128      pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCandNoRef[0],  NOT_VALID );
     129#else
    71130      pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
     131#endif
    72132      if ( pcCURef->getSlice()->isInterB() )
    73133      {
     134#if MTK_VSP_USING_NBDV_D0105
     135        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCandNoRef[0],  NOT_VALID );
     136#else
    74137         pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
    75       }
    76     }
    77   }
    78 }
    79 
    80 inline Bool TComDataCU::xAddVspMergeCand( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
    81                                           UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDInfo )
    82 {
     138#endif
     139      }
     140#endif
     141    }
     142  }
     143}
     144
     145inline Bool TComDataCU::xAddVspMergeCand(
     146 UChar ucVspMergePos,
     147#if !LGE_VSP_INHERIT_D0092
     148 Int vspIdx,
     149 Bool* bVspMvZeroDone,
     150#endif
     151 UInt uiDepth,
     152 Bool* abCandIsInter,
     153 Int& iCount,
     154 UChar* puhInterDirNeighbours,
     155 TComMvField* pcMvFieldNeighbours,
     156 Int* iVSPIndexTrue,
     157 Int mrgCandIdx,
     158 DisInfo* pDInfo
     159#if MERL_VSP_NBDV_RefVId_Fix_D0166
     160 , Int*  iVspDirTrue
     161#endif
     162                                          )
     163{
     164#if MTK_D0156
     165    if( !m_pcSlice->getSPS()->getUseVSPCompensation() )
     166    {
     167        return true;
     168    }
     169#endif
     170
     171#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     172  if (getSlice()->getSPS()->isDepth())
     173  {
     174    return true;
     175  }
     176#endif
     177
    83178#if MERL_VSP_C0152_BugFix_ForNoDepthCase
    84179  TComPic* pRefPicBaseDepth = NULL;
    85180  pRefPicBaseDepth = getSlice()->getRefPicBaseDepth();
    86   if(ucVspMergePos == VSP_MERGE_POS && pRefPicBaseDepth) //VSP can be used only when depth is used as input
     181  if(ucVspMergePos == VSP_MERGE_POS && pRefPicBaseDepth) // VSP can be used only when depth is used as input
    87182#else
    88183  if( ucVspMergePos == VSP_MERGE_POS )
     
    90185  if( ucVspMergePos == VSP_MERGE_POS )
    91186  {
     187#if !LGE_VSP_INHERIT_D0092
    92188    Int idx = vspIdx - 1;
    93     {
     189#endif
     190    {
     191#if LGE_VSP_INHERIT_D0092
     192      if( getSlice()->getSPS()->getViewId() != 0 )
     193#else
    94194      if( getSlice()->getSPS()->getViewId() != 0 && bVspMvZeroDone[idx] == false )
     195#endif
    95196      {
    96197        {
    97198          abCandIsInter [iCount] = true;
     199#if !LGE_VSP_INHERIT_D0092
    98200          bVspMvZeroDone[idx] = true;
     201#endif
    99202
    100203          // get Inter Dir
     
    102205            (getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2));
    103206          puhInterDirNeighbours[iCount] = iInterDir; // The direction information does not matter
     207#if QC_BVSP_CleanUP_D0191
     208         puhInterDirNeighbours[iCount] = 1;
     209#endif
     210#if LGE_VSP_INHERIT_D0092
     211#if MERL_VSP_NBDV_RefVId_Fix_D0166
     212         assert(pDInfo->m_aRefIdx[0] < 0);
     213         iVspDirTrue[0] = pDInfo->m_aListIdx[0];
     214         Int iRefIdxList0 = NOT_VALID;
     215         Int iRefIdxList1 = NOT_VALID;
     216         iRefIdxList0 = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_0)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_0));
     217         if ( getSlice()->isInterB() )
     218         {
     219            iRefIdxList1 = getSlice()->getRefPic(REF_PIC_LIST_1, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_1)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_1));
     220         }
     221
     222#if MTK_VSP_USING_NBDV_D0105
     223        //pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], pDInfo->m_aListIdx[0]==REF_PIC_LIST_0 ? iRefIdxList0 :NOT_VALID  );
     224        pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0],  iRefIdxList0 );
     225#else
     226        pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0],  iRefIdxList0 );
     227#endif
     228         if ( getSlice()->isInterB() )
     229         {
     230#if MTK_VSP_USING_NBDV_D0105
     231          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdxList1 );
     232          //pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0],  iRefIdxList1);
     233#else
     234          pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdxList1);
     235#endif
     236         }
     237         iVSPIndexTrue[iCount] = 1;
     238#else
     239
     240#if !MERL_General_Fix
     241         Int iRefIdxList0 = NOT_VALID;
     242         Int iRefIdxList1 = NOT_VALID;
     243         iRefIdxList0 = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_0)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_0));
     244         if ( getSlice()->isInterB() )
     245         {
     246           iRefIdxList1 = getSlice()->getRefPic(REF_PIC_LIST_1, 0)->getPOC()==getSlice()->getPOC() ? 0 : (getSlice()->getNewRefIdx(REF_PIC_LIST_1)==-1 ? NOT_VALID : getSlice()->getNewRefIdx(REF_PIC_LIST_1));
     247         }
     248#if MTK_VSP_USING_NBDV_D0105
     249         pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0],  iRefIdxList0 );
     250#else
     251         pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0],  iRefIdxList0 );
     252#endif
     253         if ( getSlice()->isInterB() )
     254         {
     255#if MTK_VSP_USING_NBDV_D0105
     256           pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdxList1 );
     257#else
     258           pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdxList1);
     259#endif
     260         }
     261         iVSPIndexTrue[iCount] = 1;
     262#else
     263         Int iRefIdx = NOT_VALID;
     264
     265#if QC_BVSP_CleanUP_D0191
     266         iRefIdx = getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==getSlice()->getPOC() ? 0: getSlice()->getNewRefIdx(REF_PIC_LIST_0);
     267#endif
     268#if MTK_VSP_USING_NBDV_D0105
     269         pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], iRefIdx );
     270#else
     271         pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], iRefIdx );
     272#endif
     273         if ( getSlice()->isInterB() )
     274         {
     275#if MTK_VSP_USING_NBDV_D0105
     276           pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], iRefIdx );
     277#else
     278             pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], iRefIdx );
     279#endif
     280         }
     281         iVSPIndexTrue[iCount] = 1;
     282#endif
     283#endif
     284#else
    104285          // get Mv using checked disparity vector
    105286          if (vspIdx < 4) // spatial
    106287          {
    107             pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID );
     288#if MERL_VSP_NBDV_RefVId_Fix_D0166
     289            assert(pDInfo->m_aRefIdx[0] < 0);
     290            iVspDirTrue[idx] = pDInfo->m_aListIdx[0];
     291
     292#if MTK_VSP_USING_NBDV_D0105
     293            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     294#else
     295            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     296#endif
    108297            if ( getSlice()->isInterB() )
    109298            {
     299#if MTK_VSP_USING_NBDV_D0105
     300              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], pDInfo->m_aRefIdx[0] );
     301#else
     302              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], pDInfo->m_aRefIdx[0] );
     303#endif
     304            }
     305
     306#else
     307
     308#if MTK_VSP_USING_NBDV_D0105
     309            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCandNoRef[0], NOT_VALID );
     310#else
     311            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID );
     312#endif
     313            if ( getSlice()->isInterB() )
     314            {
     315#if MTK_VSP_USING_NBDV_D0105
     316              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCandNoRef[0], NOT_VALID );
     317#else
    110318              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], NOT_VALID );
     319#endif
    111320            }
     321#endif
    112322          }
    113323          iVSPIndexTrue[idx] = iCount;
     324#endif
    114325          if ( mrgCandIdx == iCount )
    115326          {
     
    155366#if MERL_VSP_C0152
    156367  m_piVSPIndex         = NULL;
     368#if MERL_VSP_NBDV_RefVId_Fix_D0166
     369  m_piVSPDir           = NULL;
     370#endif
    157371#endif
    158372  m_puhLumaIntraDir    = NULL;
     
    225439  m_pbResPredFlag      = NULL;
    226440#endif
     441#if QC_ARP_D0177
     442  m_puhARPW           = NULL;
     443#endif
    227444#if LGE_EDGE_INTRA_A0070
    228445  m_pucEdgeCode         = NULL;
     
    241458  m_apSegmentDCOffset[1] = NULL;
    242459#endif
     460#if QC_CU_NBDV_D0181
     461  m_pDvInfo              = NULL;
     462#endif
    243463}
    244464
     
    288508    m_pbICFlag           = (Bool*  )xMalloc(Bool,   uiNumPartition);
    289509#endif
     510#if QC_CU_NBDV_D0181
     511    m_pDvInfo            = (DisInfo* )xMalloc(DisInfo,  uiNumPartition);
     512#endif
    290513    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
    291514#if MERL_VSP_C0152
    292515    m_piVSPIndex         = (Char*  )xMalloc(Char,   uiNumPartition);
     516#if MERL_VSP_NBDV_RefVId_Fix_D0166
     517    m_piVSPDir           = (Char*  )xMalloc(Char,   uiNumPartition);
     518#endif
    293519#endif
    294520#if H3D_IVRP
    295521    m_pbResPredAvailable = (Bool*  )xMalloc(Bool,   uiNumPartition);
    296522    m_pbResPredFlag      = (Bool*  )xMalloc(Bool,   uiNumPartition);
     523#if QC_ARP_D0177
     524    m_puhARPW            = new UChar[ uiNumPartition];
     525#endif
    297526#endif
    298527    m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
     
    448677#if MERL_VSP_C0152
    449678    if ( m_piVSPIndex         ) { xFree(m_piVSPIndex);          m_piVSPIndex        = NULL; }
     679#if MERL_VSP_NBDV_RefVId_Fix_D0166
     680    if ( m_piVSPDir           ) { xFree(m_piVSPDir  );          m_piVSPDir          = NULL; }
     681#endif
    450682#endif
    451683    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
     
    453685    if ( m_pbResPredAvailable ) { xFree(m_pbResPredAvailable);  m_pbResPredAvailable= NULL; }
    454686    if ( m_pbResPredFlag      ) { xFree(m_pbResPredFlag);       m_pbResPredFlag     = NULL; }
     687#endif
     688#if QC_CU_NBDV_D0181
     689    if ( m_pDvInfo            ) { xFree(m_pDvInfo);             m_pDvInfo           = NULL; }
     690#endif
     691#if QC_ARP_D0177
     692    if ( m_puhARPW           )  { delete[] m_puhARPW;          m_puhARPW          = NULL; }
    455693#endif
    456694    if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
     
    627865    m_pbSDCFlag[ui] = pcFrom->getSDCFlag(ui);
    628866#endif
     867#if QC_ARP_D0177
     868    m_puhARPW[ui] = pcFrom->getARPW( ui );
     869#endif
    629870    m_puhWidth  [ui] = pcFrom->getWidth(ui);
    630871    m_puhHeight [ui] = pcFrom->getHeight(ui);
     
    644885#if MERL_VSP_C0152
    645886    m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui];
     887#if MERL_VSP_NBDV_RefVId_Fix_D0166
     888    m_piVSPDir  [ui] = pcFrom->m_piVSPDir  [ui];
     889#endif
    646890#endif
    647891    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
     
    687931#if MERL_VSP_C0152
    688932    memset( m_piVSPIndex        + firstElement, 0,                        numElements * sizeof( *m_piVSPIndex ) );
     933#if MERL_VSP_NBDV_RefVId_Fix_D0166
     934    memset( m_piVSPDir          + firstElement, 0,                        numElements * sizeof( *m_piVSPDir   ) );
     935#endif
    689936#endif
    690937    memset( m_puhLumaIntraDir   + firstElement, 2,                        numElements * sizeof( *m_puhLumaIntraDir ) );
     
    723970    memset( m_pbResPredAvailable       + firstElement, 0    , sizeof( Bool ) * numElements );
    724971    memset( m_pbResPredFlag            + firstElement, 0    , sizeof( Bool ) * numElements );
     972#endif
     973#if QC_ARP_D0177
     974    memset( m_puhARPW                  + firstElement, 0    , sizeof( UChar ) * numElements  );
    725975#endif
    726976  }
     
    8611111#if MERL_VSP_C0152
    8621112      m_piVSPIndex[ui] = 0;
     1113#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1114      m_piVSPDir  [ui] = 0;
     1115#endif
    8631116#endif
    8641117#if H3D_IVRP
    8651118      m_pbResPredAvailable[ui] = 0;
    8661119      m_pbResPredFlag[ui]      = 0;
     1120#endif
     1121#if QC_ARP_D0177
     1122      m_puhARPW[ui] = 0;
    8671123#endif
    8681124      m_puhLumaIntraDir[ui] = 2;
     
    9721228#if MERL_VSP_C0152
    9731229  memset( m_piVSPIndex,         0, iSizeInChar );
     1230#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1231  memset( m_piVSPDir  ,         0, iSizeInChar );
     1232#endif
    9741233#endif
    9751234#if H3D_IVRP
    9761235  memset( m_pbResPredAvailable, 0, iSizeInBool  );
    9771236  memset( m_pbResPredFlag,      0, iSizeInBool  );
     1237#endif
     1238#if QC_ARP_D0177
     1239  memset( m_puhARPW,            0, iSizeInUchar  );
    9781240#endif
    9791241  memset( m_puhLumaIntraDir,    2, iSizeInUchar );
     
    10151277  memset( m_apSegmentDCOffset[1],     0, sizeof(Pel) * m_uiNumPartition);
    10161278#endif
    1017 
     1279#if QC_CU_NBDV_D0181
     1280  m_pDvInfo->bDV = false;
     1281#endif
    10181282  UChar uhWidth  = g_uiMaxCUWidth  >> uiDepth;
    10191283  UChar uhHeight = g_uiMaxCUHeight >> uiDepth;
     
    10581322#if MERL_VSP_C0152
    10591323      m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui];
     1324#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1325      m_piVSPDir  [ui]=pcCU->m_piVSPDir  [uiPartOffset+ui];
     1326#endif
    10601327#endif
    10611328      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
     
    10901357      m_pbResPredAvailable[ui] = pcCU->m_pbResPredAvailable[ uiPartOffset + ui ];
    10911358      m_pbResPredFlag     [ui] = pcCU->m_pbResPredFlag     [ uiPartOffset + ui ];
     1359#endif
     1360#if QC_ARP_D0177
     1361      m_puhARPW           [ui] = pcCU->getARPW( uiPartOffset+ui );
    10921362#endif
    10931363#if RWTH_SDC_DLT_B0036
     
    12081478#if MERL_VSP_C0152
    12091479  m_piVSPIndex          = pcCU->getVSPIndex()         + uiPart;
     1480#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1481  m_piVSPDir            = pcCU->getVSPDir  ()         + uiPart;
     1482#endif
    12101483#endif
    12111484#if H3D_IVRP
    12121485  m_pbResPredAvailable  = pcCU->getResPredAvail()     + uiPart;
    12131486  m_pbResPredFlag       = pcCU->getResPredFlag ()     + uiPart;
     1487#endif
     1488#if QC_ARP_D0177
     1489  m_puhARPW             = pcCU->getARPW() + uiPart;
    12141490#endif
    12151491  m_puhLumaIntraDir     = pcCU->getLumaIntraDir()     + uiPart;
     
    13131589  m_apSegmentDCOffset[1]    = pcCU->getSDCSegmentDCOffset(1) + uiPart;
    13141590#endif
    1315 }
    1316 
     1591#if QC_CU_NBDV_D0181
     1592  m_pDvInfo                 = pcCU->getDvInfo()              + uiPart;
     1593#endif
     1594}
     1595#if QC_CU_NBDV_D0181
     1596Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx)
     1597{
     1598  m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
     1599}
     1600#endif
    13171601// Copy inter prediction info from the biggest CU
    1318 Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList )
     1602Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
     1603#if QC_CU_NBDV_D0181
     1604  , Bool bNBDV
     1605#endif
     1606  )
    13191607{
    13201608  m_pcPic              = pcCU->getPic();
     
    13361624 
    13371625  m_pePartSize         = pcCU->getPartitionSize ()        + uiAbsPartIdx;
     1626#if QC_CU_NBDV_D0181
     1627  if(bNBDV == true)
     1628  {
     1629    m_puhWidth           = pcCU->getWidth ()                + uiAbsPartIdx;
     1630    m_puhHeight          = pcCU->getHeight()                + uiAbsPartIdx;
     1631    m_puhDepth           = pcCU->getDepth ()                + uiAbsPartIdx;
     1632  }
     1633  else
     1634  {
     1635#endif
    13381636#if HHI_INTERVIEW_SKIP
    13391637  m_pbRenderable         = pcCU->getRenderable()        + uiAbsPartIdx;
     
    13541652#if MERL_VSP_C0152
    13551653  m_piVSPIndex         = pcCU->getVSPIndex()              + uiAbsPartIdx;
     1654#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1655  m_piVSPDir           = pcCU->getVSPDir  ()              + uiAbsPartIdx;
     1656#endif
    13561657#endif
    13571658#if H3D_IVRP
     
    13591660  m_pbResPredFlag      = pcCU->getResPredFlag ()          + uiAbsPartIdx;
    13601661#endif
     1662#if QC_ARP_D0177
     1663  m_puhARPW           = pcCU->getARPW()                 + uiAbsPartIdx;
     1664#endif
    13611665  m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx;
    13621666  m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx;
     
    13691673  memcpy(m_uiSliceStartCU,pcCU->m_uiSliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition);
    13701674  memcpy(m_uiEntropySliceStartCU,pcCU->m_uiEntropySliceStartCU+uiAbsPartIdx,sizeof(UInt)*m_uiNumPartition);
     1675#if QC_CU_NBDV_D0181
     1676  }
     1677#endif
    13711678}
    13721679
    13731680// Copy small CU to bigger CU.
    13741681// One of quarter parts overwritten by predicted sub part.
    1375 Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth )
     1682Void TComDataCU::copyPartFrom( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth
     1683#if QC_ARP_D0177
     1684     ,
     1685    Bool bRP
     1686#endif
     1687    )
    13761688{
    13771689  assert( uiPartUnitIdx<4 );
     
    14051717#if MERL_VSP_C0152
    14061718  memcpy( m_piVSPIndex          + uiOffset, pcCU->getVSPIndex(),          iSizeInChar );
     1719#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1720  memcpy( m_piVSPDir            + uiOffset, pcCU->getVSPDir  (),          iSizeInChar );
     1721#endif
    14071722#endif
    14081723#if H3D_IVRP
    14091724  memcpy( m_pbResPredAvailable  + uiOffset, pcCU->getResPredAvail(),      iSizeInBool  );
    14101725  memcpy( m_pbResPredFlag       + uiOffset, pcCU->getResPredFlag(),       iSizeInBool  );
     1726#endif
     1727#if QC_ARP_D0177
     1728  memcpy( m_puhARPW            + uiOffset,  pcCU->getARPW(),              iSizeInUchar );
    14111729#endif
    14121730  memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
     
    14861804
    14871805#if LGE_EDGE_INTRA_A0070
     1806#if QC_ARP_D0177
     1807  if( !bRP && pcCU->getSlice()->getSPS()->isDepth() )
     1808#else
    14881809  if( getSlice()->getSPS()->isDepth() )
     1810#endif
    14891811  {
    14901812    memcpy( getEdgeCode( uiOffset ), pcCU->getEdgeCode(0), iSizeInUchar * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 );
     
    15411863  memcpy( rpcCU->getICFlag()            + m_uiAbsIdxInLCU, m_pbICFlag,            iSizeInBool );
    15421864#endif
     1865#if QC_CU_NBDV_D0181
     1866  memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof(* m_pDvInfo) * m_uiNumPartition );
     1867#endif
    15431868  memcpy( rpcCU->getMergeIndex()        + m_uiAbsIdxInLCU, m_puhMergeIndex,       iSizeInUchar );
    15441869#if MERL_VSP_C0152
    15451870  memcpy( rpcCU->getVSPIndex()          + m_uiAbsIdxInLCU, m_piVSPIndex,         iSizeInChar );
     1871#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1872  memcpy( rpcCU->getVSPDir  ()          + m_uiAbsIdxInLCU, m_piVSPDir  ,         iSizeInChar );
     1873#endif
    15461874#endif
    15471875#if H3D_IVRP
    15481876  memcpy( rpcCU->getResPredAvail()      + m_uiAbsIdxInLCU, m_pbResPredAvailable,  iSizeInBool  );
    15491877  memcpy( rpcCU->getResPredFlag()       + m_uiAbsIdxInLCU, m_pbResPredFlag,       iSizeInBool  );
     1878#endif
     1879#if QC_ARP_D0177
     1880  memcpy( rpcCU->getARPW()              + m_uiAbsIdxInLCU, m_puhARPW,             iSizeInUchar );
    15501881#endif
    15511882  memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
     
    16742005  memcpy( rpcCU->getMergeIndex()        + uiPartOffset, m_puhMergeIndex,       iSizeInUchar );
    16752006#if MERL_VSP_C0152
    1676   memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,         iSizeInChar );
     2007  memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,          iSizeInChar );
     2008#if MERL_VSP_NBDV_RefVId_Fix_D0166
     2009  memcpy( rpcCU->getVSPDir  ()          + uiPartOffset, m_piVSPDir  ,          iSizeInChar );
     2010#endif
    16772011#endif
    16782012#if H3D_IVRP
    16792013  memcpy( rpcCU->getResPredAvail()      + uiPartOffset, m_pbResPredAvailable,  iSizeInBool  );
    16802014  memcpy( rpcCU->getResPredFlag()       + uiPartOffset, m_pbResPredFlag,       iSizeInBool  );
     2015#endif
     2016#if QC_ARP_D0177
     2017  memcpy( rpcCU->getARPW()              + uiPartOffset, m_puhARPW,            iSizeInUchar );
    16812018#endif
    16822019  memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
     
    26703007  return uiCtx;
    26713008}
    2672 
     3009#if QC_ARP_D0177
     3010UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx )
     3011{
     3012  TComDataCU* pcTempCU;
     3013  UInt        uiTempPartIdx;
     3014  UInt        uiCtx = 0;
     3015 
     3016  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     3017  uiCtx    = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0;
     3018 
     3019  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     3020  uiCtx   += ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1): 0;
     3021 
     3022  return uiCtx;
     3023}
     3024#endif
    26733025#if LGE_ILLUCOMP_B0045
    26743026UInt TComDataCU::getCtxICFlag( UInt uiAbsPartIdx )
     
    29073259}
    29083260
     3261#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    29093262UInt TComDataCU::getCtxSDCFlag( UInt uiAbsPartIdx )
    29103263{
     
    29233276  return uiCtx;
    29243277}
     3278#endif
    29253279
    29263280Bool TComDataCU::getSDCAvailable( UInt uiAbsPartIdx )
     
    29543308  setSubPart<Char>( iVSPIdx, m_piVSPIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
    29553309}
    2956 #endif
     3310
     3311#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3312Void TComDataCU::setVSPDirSubParts ( Char iVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     3313{
     3314  setSubPart<Char>( iVSPDir, m_piVSPDir, uiAbsPartIdx, uiDepth, uiPartIdx );
     3315}
     3316#endif
     3317
     3318#endif // MERL_VSP_C0152
    29573319
    29583320#if H3D_IVRP
     
    29673329}
    29683330#endif
    2969 
     3331#if QC_CU_NBDV_D0181
     3332Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth )
     3333{
     3334  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
     3335  for (UInt ui = 0; ui < uiCurrPartNumb; ui++ )
     3336  {
     3337    m_pDvInfo[uiAbsPartIdx + ui] = cDvInfo;
     3338  }
     3339}
     3340#endif
    29703341Void TComDataCU::setChromIntraDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiDepth )
    29713342{
     
    29933364  UInt iNumbPart;
    29943365
     3366#if SHARP_ILLUCOMP_PARSE_D0060
     3367  if (!(getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N))
     3368  {
     3369    return false;
     3370  }
     3371  if (getSlice()->getIcSkipParseFlag())
     3372  {
     3373    if (getMergeFlag(uiAbsPartIdx) && getMergeIndex(uiAbsPartIdx) == 0)
     3374    {
     3375      return false;
     3376    }
     3377  }
     3378  if (getMergeFlag(uiAbsPartIdx))
     3379  {
     3380    return true;
     3381  }
     3382#endif
     3383#if !SHARP_ILLUCOMP_PARSE_D0060
    29953384  if(!getSlice()->getIsDepth())
    29963385  {
     3386#endif
    29973387    Int iWidth, iHeight;
    29983388
     
    30153405      }
    30163406    }
     3407#if !SHARP_ILLUCOMP_PARSE_D0060
    30173408  }
    30183409  else
     
    30363427    }
    30373428  }
     3429#endif
    30383430
    30393431  return false;
     
    30463438  Int iWidth, iHeight;
    30473439
     3440#if SHARP_ILLUCOMP_PARSE_D0060
     3441  if (!(getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N))
     3442  {
     3443    return false;
     3444  }
     3445  if (getSlice()->getIcSkipParseFlag())
     3446  {
     3447    if (getMergeFlag(uiAbsPartIdx) && getMergeIndex(uiAbsPartIdx) == 0)
     3448    {
     3449      return false;
     3450    }
     3451  }
     3452  if (getMergeFlag(uiAbsPartIdx))
     3453  {
     3454    return true;
     3455  }
     3456#endif
    30483457  UInt uiPartMode = getPartitionSize(uiAbsPartIdx);
    30493458
     
    35273936 */
    35283937#if MERL_VSP_C0152
    3529 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx )
     3938Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue
     3939#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3940        , Int* iVSPDirTrue
     3941#endif
     3942        , Int mrgCandIdx )
    35303943#else
    35313944Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     
    35603973  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    35613974
    3562 #if MERL_VSP_C0152
     3975#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    35633976  Bool bVspMvZeroDone[3] = {false, false, false};
    35643977#endif
     
    35843997#endif //H3D_NBDV
    35853998
    3586 #if H3D_IVRP
     3999#if H3D_IVRP & !QC_ARP_D0177
    35874000  Bool bDVAvail = true;
    35884001#endif
     
    35904003#if H3D_NBDV
    35914004  DisInfo cDisInfo;
     4005#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4006  cDisInfo.bDV = false; // default setting
     4007  cDisInfo.iN  = 0;
     4008#endif
     4009
     4010#if !QC_CU_NBDV_D0181
    35924011  cDisInfo.iN = 0;
     4012#endif
    35934013  if(!bNoPdmMerge)
    35944014  {
     
    35964016    if( !getPic()->getDepthCoded() )
    35974017#endif
     4018#if QC_CU_NBDV_D0181
     4019    {
     4020      cDisInfo.iN = getDvInfo(uiAbsPartIdx).iN;
     4021      cDisInfo.bDV = getDvInfo(uiAbsPartIdx).bDV;
     4022      cDisInfo.m_acMvCand[0] = getDvInfo(uiAbsPartIdx).m_acMvCand[0];
     4023      cDisInfo.m_aVIdxCan[0] = getDvInfo(uiAbsPartIdx).m_aVIdxCan[0];
     4024#if MTK_VSP_USING_NBDV_D0105
     4025      cDisInfo.m_acMvCandNoRef[0] = getDvInfo(uiAbsPartIdx).m_acMvCandNoRef[0];
     4026#endif
     4027#if MERL_General_Fix
     4028#if MERL_VSP_C0152
     4029#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4030      cDisInfo.m_aListIdx[0] = getDvInfo(uiAbsPartIdx).m_aListIdx[0];
     4031      cDisInfo.m_aRefIdx[0]  = getDvInfo(uiAbsPartIdx).m_aRefIdx[0];
     4032#endif
     4033#endif
     4034#endif
     4035    }
     4036#else
    35984037    getDisMvpCandNBDV(uiPUIdx, uiAbsPartIdx, &cDisInfo , true
    35994038#if MERL_VSP_C0152
     
    36014040#endif     
    36024041);
    3603   }
     4042#endif
     4043  }
     4044 
    36044045#if FCO_DVP_REFINE_C0132_C0170
    36054046  if(getPic()->getDepthCoded() )
     
    36184059  }
    36194060#endif
     4061#if !QC_CU_NBDV_D0181
    36204062  if(cDisInfo.iN==0)
    3621   {
     4063#else
     4064  if(cDisInfo.bDV == false)
     4065#endif
     4066  {
     4067#if !QC_CU_NBDV_D0181
    36224068    cDisInfo.iN = 1;
    36234069    cDisInfo.m_acMvCand[0].setHor(0);
    36244070    cDisInfo.m_acMvCand[0].setVer(0);
    36254071    cDisInfo.m_aVIdxCan[0] = 0;
    3626 #if H3D_IVRP
     4072#endif
     4073#if H3D_IVRP & !QC_ARP_D0177
    36274074    bDVAvail = false;
    36284075#endif
    36294076  }
     4077
     4078#if MERL_VSP_NBDV_RefVId_Fix_D0166 && !MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4079  if (bNoPdmMerge && cDisInfo.bDV == false)
     4080  { // purely for default setting
     4081    cDisInfo.iN = 1;
     4082    cDisInfo.m_acMvCand[0].setHor(0);
     4083    cDisInfo.m_acMvCand[0].setVer(0);
     4084    cDisInfo.m_acMvCandNoRef[0].setHor(0);
     4085    cDisInfo.m_acMvCandNoRef[0].setVer(0);
     4086    cDisInfo.m_aVIdxCan[0] = 0;
     4087
     4088    RefPicList eRefPicList = REF_PIC_LIST_0 ;
     4089    Int refFrmIdx = 0;
     4090    getRefListAndRefFrmIdx(0, eRefPicList, refFrmIdx);
     4091    cDisInfo.m_aListIdx[0] = eRefPicList;
     4092    cDisInfo.m_aRefIdx [0] = -1-refFrmIdx;
     4093   }
     4094#endif
    36304095
    36314096#if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
     
    36524117        clipMv(cMvPred);
    36534118        pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,pcMvFieldNeighbours[iCount<<1].getRefIdx());
     4119#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4120        if (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0)
     4121        {
     4122          assert(pcTextureCU->getVSPIndex(uiPartIdxCenter)!=0); 
     4123          for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_0); i++)
     4124          {
     4125            if (getSlice()->getRefPOC(REF_PIC_LIST_0, i) == getSlice()->getPOC())
     4126            {
     4127              pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,i);
     4128              break;
     4129            }
     4130          }
     4131        }
     4132#endif
    36544133      }
    36554134      if ( getSlice()->isInterB() )
     
    36644143          clipMv(cMvPred);
    36654144          pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx());
     4145#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4146          if (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0)
     4147          {
     4148            assert(pcTextureCU->getVSPIndex(uiPartIdxCenter)!=0); 
     4149            for (Int i=0; i<getSlice()->getNumRefIdx(REF_PIC_LIST_1); i++)
     4150            {
     4151              if (getSlice()->getRefPOC(REF_PIC_LIST_1, i) == getSlice()->getPOC())
     4152              {
     4153                pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,i);
     4154                break;
     4155              }
     4156            }
     4157          }
     4158#endif
    36664159        }
    36674160      }
    3668 #if MERL_VSP_C0152
    3669       xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
    3670 #endif
    3671       if ( mrgCandIdx == iCount )
    3672       {
    3673         return;
    3674       }
    3675       iCount ++;
     4161#if MERL_VSP_C0152  && !QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092
     4162#if !MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4163      xInheritVspMode( pcTextureCU, uiPartIdxCenter, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4164#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4165         , iVSPDirTrue
     4166#endif
     4167        ) ;
     4168#endif
     4169#endif
     4170#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4171      if (!((pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && !getSlice()->isInterB())
     4172        || (pcMvFieldNeighbours[iCount<<1].getRefIdx()<0 && pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()<0 && getSlice()->isInterB())))
     4173      {
     4174#endif
     4175        if ( mrgCandIdx == iCount )
     4176        {
     4177          return;
     4178        }
     4179        iCount ++;
     4180#if MTK_LGE_VSP_DEPTH_OFF_D0105_D0139
     4181      }
     4182      else
     4183      {
     4184        assert(0);
     4185      }
     4186#endif
    36764187    }
    36774188  }
     
    36874198  iPdmDir[1] = iPdmInterDir;
    36884199#endif // H3D_NBDV
    3689 #if H3D_IVRP
     4200#if H3D_IVRP & !QC_ARP_D0177
    36904201  if (m_pcSlice->getSPS()->getMultiviewResPredMode()==1 && iPdmDir[0] && !bNoPdmMerge && cCurPS == SIZE_2Nx2N && bDVAvail)
    36914202  {
     
    37274238  } 
    37284239 
    3729 #endif //  H3D_IVMP
    3730 
     4240#endif //  H3D_IVMP
     4241
     4242#if !FIX_MERGE_D
    37314243#if MERL_VSP_COMPENSATION_C0152
    37324244  //===== vsp 0 =====
    37334245  if( iCount < 4 + extraMergeCand )
    3734     if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4246    if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4247#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4248            , iVSPDirTrue
     4249#endif
     4250            )
     4251       )
    37354252      return;
     4253#endif
    37364254#endif
    37374255
     
    37514269  {
    37524270    if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx )
    3753 #if MERL_VSP_C0152
     4271#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    37544272      CHECK_ADD_YET(pcCULeft, uiLeftPartIdx, 1)
    37554273#endif
     
    38004318#endif
    38014319#if MERL_VSP_C0152
    3802         xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4320#if LGE_VSP_INHERIT_D0092
     4321        if (pcCULeft->getVSPIndex(uiLeftPartIdx)==1)
     4322        {
     4323            iVSPIndexTrue[iCount] = 1;
     4324        }
     4325#else
     4326        xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4327#if QC_BVSP_CleanUP_D0191
     4328        ,puhInterDirNeighbours
     4329#endif
     4330#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4331         , iVSPDirTrue
     4332#endif
     4333                );
     4334#endif
    38034335#endif
    38044336        if ( mrgCandIdx == iCount )
     
    38254357    }
    38264358  if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
    3827 #if MERL_VSP_C0152
     4359#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    38284360    CHECK_ADD_YET(pcCUAbove, uiAbovePartIdx, 1)
    38294361#endif
     
    38734405#endif
    38744406#if MERL_VSP_C0152
    3875      xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4407#if LGE_VSP_INHERIT_D0092
     4408    if (pcCUAbove->getVSPIndex(uiAbovePartIdx)==1)
     4409    {
     4410        iVSPIndexTrue[iCount] = 1;
     4411    }
     4412#else
     4413     xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4414#if QC_BVSP_CleanUP_D0191
     4415        ,puhInterDirNeighbours
     4416#endif
     4417#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4418       , iVSPDirTrue
     4419#endif
     4420             ) ;
     4421#endif
    38764422#endif
    38774423    if ( mrgCandIdx == iCount )
     
    38974443  }
    38984444  if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx )
    3899 #if MERL_VSP_C0152
     4445#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    39004446    CHECK_ADD_YET(pcCUAboveRight, uiAboveRightPartIdx, 1)
    39014447#endif
     
    39224468#endif
    39234469#if MERL_VSP_C0152
    3924     xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4470#if LGE_VSP_INHERIT_D0092
     4471    if (pcCUAboveRight->getVSPIndex(uiAboveRightPartIdx)==1)
     4472    {
     4473        iVSPIndexTrue[iCount] = 1;
     4474    }
     4475#else
     4476    xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4477#if QC_BVSP_CleanUP_D0191
     4478        ,puhInterDirNeighbours
     4479#endif
     4480#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4481       , iVSPDirTrue
     4482#endif
     4483            ) ;
     4484#endif
    39254485#endif
    39264486    if ( mrgCandIdx == iCount )
     
    39804540#endif // H3D_IVMP
    39814541
     4542#if MERL_VSP_COMPENSATION_C0152
     4543  //===== vsp 3 =====
     4544#if LGE_VSP_INHERIT_D0092
     4545    if ( !xAddVspMergeCand(3, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4546#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4547      , iVSPDirTrue
     4548#endif
     4549      ) )
     4550#else
     4551    if( iCount < 4 + extraMergeCand )
     4552        if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4553#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4554          , iVSPDirTrue
     4555#endif   
     4556          ) )
     4557#endif
     4558            return;
     4559#endif
     4560
     4561#if MERL_VSP_C0152
     4562#if VSP_MERGE_POS < 4
     4563#if H3D_IVMP
     4564    if( iCount < 4 + extraMergeCand )
     4565#else
     4566    if( iCount < 4 )
     4567#endif
     4568    {
     4569#endif
     4570#endif
    39824571
    39834572  //left bottom
     
    39934582  }
    39944583  if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx )
    3995 #if MERL_VSP_C0152
     4584#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    39964585    CHECK_ADD_YET(pcCULeftBottom, uiLeftBottomPartIdx, 1)
    39974586#endif
     
    40184607#endif
    40194608#if MERL_VSP_C0152
    4020      xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4609#if LGE_VSP_INHERIT_D0092
     4610    if (pcCULeftBottom->getVSPIndex(uiLeftBottomPartIdx)==1)
     4611    {
     4612        iVSPIndexTrue[iCount] = 1;
     4613    }
     4614#else
     4615    xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4616#if QC_BVSP_CleanUP_D0191
     4617        ,puhInterDirNeighbours
     4618#endif
     4619#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4620       , iVSPDirTrue
     4621#endif
     4622             ) ;
     4623#endif
    40214624#endif
    40224625    if ( mrgCandIdx == iCount )
     
    40264629    iCount ++;
    40274630  }
    4028  
    4029  
     4631
     4632#if MERL_VSP_C0152  // Is this correct here?
     4633#if VSP_MERGE_POS < 4
     4634    }
     4635#endif
     4636#endif
     4637
    40304638  // above left
    40314639#if H3D_IVMP
     
    40464654    }
    40474655    if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx )
    4048 #if MERL_VSP_C0152
     4656#if MERL_VSP_C0152 && !LGE_VSP_INHERIT_D0092
    40494657     CHECK_ADD_YET(pcCUAboveLeft, uiAboveLeftPartIdx, 1)
    40504658#endif
     
    40734681#endif
    40744682#if MERL_VSP_C0152
    4075      xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4683#if LGE_VSP_INHERIT_D0092
     4684    if (pcCUAboveLeft->getVSPIndex(uiAboveLeftPartIdx)==1)
     4685    {
     4686        iVSPIndexTrue[iCount] = 1;
     4687    }
     4688#else
     4689      xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo
     4690#if QC_BVSP_CleanUP_D0191
     4691        ,puhInterDirNeighbours
     4692#endif
     4693#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4694       , iVSPDirTrue
     4695#endif
     4696             ) ;
     4697#endif
    40764698#endif
    40774699      if ( mrgCandIdx == iCount )
     
    40864708  //===== vsp 5 =====
    40874709  if( iCount < 4 + extraMergeCand )
    4088     if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4710#if LGE_VSP_INHERIT_D0092
     4711    if ( !xAddVspMergeCand(5, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4712#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4713         , iVSPDirTrue
     4714#endif
     4715))
     4716#else
     4717    if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo
     4718#if MERL_VSP_NBDV_RefVId_Fix_D0166
     4719         , iVSPDirTrue
     4720#endif
     4721            ))
     4722#endif
    40894723      return;
    40904724#endif
     
    42764910#if MERL_VSP_C0152
    42774911      Bool bValid = true;
     4912#if LGE_VSP_INHERIT_D0092
     4913      if (iVSPIndexTrue[i]==1 || iVSPIndexTrue[j]==1) // NOT_VALID
     4914#else
    42784915      if (pcMvFieldNeighbours[i<<1].getRefIdx() < 0 || pcMvFieldNeighbours[(j<<1)+1].getRefIdx() < 0) // NOT_VALID
     4916#endif
    42794917        bValid = false;
    42804918#endif
     4919
     4920#if MTK_D0156
     4921      if( !m_pcSlice->getSPS()->getUseVSPCompensation())
     4922      {
     4923          bValid = true;
     4924      }
     4925#endif
     4926
    42814927      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)
    42824928#if MERL_VSP_C0152
     
    44475093  {
    44485094    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
    4449 #if MERL_VSP_C0152
     5095#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    44505096     && !pcCorner->getVSPIndex( uiCornerPUIdx )
    44515097#endif
     
    45935239    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    45945240  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    4595 #if MERL_VSP_C0152
     5241#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    45965242  if(! pcTmpCU->getVSPIndex(uiIdx))
    45975243#endif
     
    46185264
    46195265  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    4620 #if MERL_VSP_C0152
     5266#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    46215267  if(! pcTmpCU->getVSPIndex(uiIdx))
    46225268#endif
     
    46435289      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
    46445290  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
    4645 #if MERL_VSP_C0152
     5291#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    46465292  if(! pcTmpCU->getVSPIndex(uiIdx))
    46475293#endif
     
    46675313      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
    46685314  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    4669 #if MERL_VSP_C0152
     5315#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    46705316  if(! pcTmpCU->getVSPIndex(uiIdx))
    46715317#endif
     
    46945340    assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    46955341  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
    4696 #if MERL_VSP_C0152
     5342#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    46975343  if(! pcTmpCU->getVSPIndex(uiIdx))
    46985344#endif
     
    49025548  Int iPictureWidth  = pcBaseViewDepthPicYuv->getWidth();
    49035549  Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight();
    4904 
     5550#if !QC_BVSP_CleanUP_D0191
     5551#if LGE_ROUND_OFFSET_D0135
     5552  Int depthPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + ((mv->getHor()+2)>>2));
     5553  Int depthPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + ((mv->getVer()+2)>>2));
     5554#else
    49055555  Int depthPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + (mv->getHor()>>2));
    49065556  Int depthPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + (mv->getVer()>>2));
     5557#endif
    49075558
    49085559  Pel *pDepthPel   = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
     5560#endif
    49095561  Pel  maxDepthVal = 0;
    49105562
    49115563  if ( bSimpleDvpRefine )
    49125564  {
     5565#if LGE_ROUND_OFFSET_D0135
     5566    Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + ((mv->getHor()+2)>>2));
     5567    Int depthStartPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + ((mv->getVer()+2)>>2));
     5568    Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2));
     5569    Int depthEndPosY   = Clip3(0,   iPictureHeight - 1,  iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2));
     5570#else
    49135571    Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + (mv->getHor()>>2));
    49145572    Int depthStartPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + (mv->getVer()>>2));
    49155573    Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + (mv->getHor()>>2));
    49165574    Int depthEndPosY   = Clip3(0,   iPictureHeight - 1,  iBlkY + iBlkHeight - 1 + (mv->getVer()>>2));
     5575#endif
     5576#if !MTK_DEPTH_TO_DISP_D0138
    49175577    Int iCenterX = (depthStartPosX + depthEndPosX) >> 1;
    49185578    Int iCenterY = (depthStartPosY + depthEndPosY) >> 1;
     5579#endif
    49195580
    49205581    Pel *depthTL  = pcBaseViewDepthPicYuv->getLumaAddr();
     
    49245585    aiDepth[2] = depthTL[ (depthStartPosY) * depStride + depthEndPosX   ];      // Right Top
    49255586    aiDepth[3] = depthTL[ (depthEndPosY)   * depStride + depthEndPosX   ];      // Right Bottom
     5587#if MTK_DEPTH_TO_DISP_D0138
     5588    for (Int i = 0; i < 4; i++)
     5589#else
    49265590    aiDepth[4] = depthTL[ (iCenterY)       * depStride + iCenterX       ];      // Center
    49275591    for (Int i = 0; i < 5; i++)
     5592#endif
    49285593    {
    49295594      if (maxDepthVal < aiDepth[i])
     
    49315596    }
    49325597  }
     5598#if !QC_BVSP_CleanUP_D0191
    49335599  else
    49345600  {
     
    49435609    }
    49445610  }
     5611#endif
    49455612
    49465613  Int iDisp = aiShiftLUT[ maxDepthVal ] << iShiftPrec;
     
    49485615  return iDisp;
    49495616}
    4950 Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
     5617
     5618Void TComDataCU::estimateDVFromDM(
     5619#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5620          Int refViewIdx,
     5621#endif
     5622          UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine)
    49515623{
    49525624  if (picDepth)
     
    49625634    Int  iShiftPrec;
    49635635
    4964     getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec);
     5636    getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec
     5637#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5638            , refViewIdx
     5639#endif
     5640            );
    49655641
    49665642    Pel iDisp = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec, bSimpleDvpRefine );
     
    49915667          clipMv(cMvPred);
    49925668
    4993           TComPic* picDepth = getSlice()->getRefPicBaseDepth();
    4994 
     5669          TComPic* picDepth = NULL;
     5670#if MERL_General_Fix
     5671#if MERL_VSP_C0152
     5672#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5673          Int refPOC = getSlice()->getRefPic(eRefPicList, refId)->getPOC();
     5674          picDepth = getSlice()->getDepthRefPic(refViewIdx, refPOC);
     5675          assert(refPOC == getSlice()->getPOC());
     5676          assert(picDepth != NULL);
     5677#else
     5678          picDepth = getSlice()->getRefPicBaseDepth();
     5679#endif
     5680#endif
     5681#else
     5682          picDepth = getSlice()->getRefPicBaseDepth();
     5683#endif
     5684
     5685#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     5686          pNbDvInfo->m_acMvCandNoRef[pNbDvInfo->iN] = cMvPred;
     5687#endif
    49955688          if (picDepth && bDepthRefine)
    4996             estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
    4997 
     5689            estimateDVFromDM(
     5690#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5691                    refViewIdx,
     5692#endif
     5693                    uiPartIdx, picDepth, uiPartAddr, &cMvPred, true);
     5694
     5695
     5696#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5697          pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = eRefPicList;
     5698          pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refId;
     5699          assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0);
     5700#endif
    49985701          pNbDvInfo->m_acMvCand[ pNbDvInfo->iN   ] = cMvPred;
    49995702          pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++ ] = refViewIdx;
     
    50105713        }
    50115714      }
    5012 #if MERL_VSP_C0152
     5715#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    50135716      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
    50145717      {
    5015         TComPic* picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5718        TComPic* picDepth = NULL;
     5719
     5720#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5721        RefPicList privateRefPicList = (RefPicList) pcTmpCU->getVSPDir( uiIdx );
     5722        assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     5723        Int  refIdx = -1-pcTmpCU->getCUMvField( privateRefPicList )->getRefIdx( uiIdx ); // a trick when storing refIdx for temporal BVSP
     5724        assert(refIdx >= 0);
     5725        Int  refViewIdx = getSlice()->getRefViewId(privateRefPicList, refIdx);
     5726        Int  refPOC = getSlice()->getRefPOC(privateRefPicList, refIdx);
     5727
     5728        picDepth = getSlice()->getDepthRefPic(refViewIdx, refPOC);
     5729        assert(refPOC == getSlice()->getPOC());
     5730        assert(picDepth != NULL);
     5731#else
     5732        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5733#endif
     5734
     5735#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     5736        pNbDvInfo->m_acMvCandNoRef[pNbDvInfo->iN] = cMvPred;
     5737#endif
    50165738        if (picDepth && bDepthRefine)
    5017           estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5739          estimateDVFromDM(
     5740#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5741                  refViewIdx,
     5742#endif
     5743                  uiPartIdx, picDepth, uiPartAddr, &cMvPred);
    50185744
    50195745        cMvPred.setVer(0);
    50205746
     5747#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5748        pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] = -1-refIdx;
     5749        pNbDvInfo->m_aListIdx[ pNbDvInfo->iN ] = privateRefPicList;
     5750        pNbDvInfo->m_acMvCand[ pNbDvInfo->iN ] = cMvPred;
     5751        pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN ] = refViewIdx;
     5752        assert(pNbDvInfo->m_aRefIdx [ pNbDvInfo->iN ] < 0);
     5753        pNbDvInfo->iN++;
     5754#else
    50215755        pNbDvInfo->m_acMvCand[ pNbDvInfo->iN]   = cMvPred;
    50225756        pNbDvInfo->m_aVIdxCan[ pNbDvInfo->iN++] = 0; // refViewIdx;
     5757#endif
    50235758        return true;
    50245759      }
     
    50755810}
    50765811
    5077 
     5812#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5813Bool TComDataCU::getRefListAndRefFrmIdx(Int targetRefViewIdx, RefPicList& eRefPicList, Int& refFrmIdx)
     5814{
     5815  Bool isFound = false;
     5816  RefPicList privateRefPicList = REF_PIC_LIST_0;
     5817
     5818  refFrmIdx = 0;
     5819  for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1) && isFound == false; iList++)
     5820  {
     5821    privateRefPicList = RefPicList(iList);
     5822    for (Int refIdx = 0; refIdx < getSlice()->getNumRefIdx(privateRefPicList); refIdx++)
     5823    {
     5824      Int refViewIdx  = getSlice()->getRefViewId( privateRefPicList, refIdx);
     5825      if ( refViewIdx == targetRefViewIdx)
     5826      {
     5827        refFrmIdx = refIdx;
     5828        eRefPicList = privateRefPicList;
     5829        isFound = true;
     5830        break;
     5831      }
     5832    }
     5833  }
     5834
     5835  return isFound;
     5836}
     5837#endif
     5838
     5839#if QC_CU_NBDV_D0181
     5840Bool TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerge
     5841#else
    50785842Void TComDataCU::getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerge
     5843#endif
    50795844#if MERL_VSP_C0152
    50805845                                , Bool bDepthRefine
     
    50995864  }
    51005865
     5866#if MTK_D0156
     5867  if( !m_pcSlice->getSPS()->getUseDVPRefine() )
     5868  {
     5869      bDepthRefine = false;
     5870  }
     5871#endif
     5872
    51015873  // Get Positions 
    51025874  PartSize eCUMode    = getPartitionSize( uiPartAddr );   
     5875#if QC_CU_NBDV_D0181
     5876  assert(eCUMode == SIZE_2Nx2N);
     5877#endif
    51035878  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; 
    51045879
     
    51685943          {
    51695944            clipMv(cColMv);
    5170             TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     5945            TComPic* picDepth = NULL;
     5946#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5947            Int currPoc = getSlice()->getPOC();
     5948            picDepth = getSlice()->getDepthRefPic(iTargetViewIdx, currPoc);
     5949            assert(picDepth != NULL);
     5950#else
     5951            picDepth = getSlice()->getRefPicBaseDepth();
     5952#endif
     5953#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     5954            pDInfo->m_acMvCandNoRef[pDInfo->iN] = cColMv;
     5955#endif
    51715956            if (picDepth && bDepthRefine)
     5957#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5958              estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
     5959#else
    51725960              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv, true);
    5173 
    5174             pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5961#endif
     5962
     5963#if MERL_VSP_NBDV_RefVId_Fix_D0166
     5964            Int refFrmIdx = 0;
     5965            RefPicList privateRefPicList = REF_PIC_LIST_0;
     5966            getRefListAndRefFrmIdx(iTargetViewIdx, privateRefPicList, refFrmIdx);
     5967           
     5968            pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     5969            pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     5970            assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     5971#endif
     5972            pDInfo->m_acMvCand[ pDInfo->iN ]  = cColMv;
    51755973            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     5974#if QC_CU_NBDV_D0181
     5975            return true;
     5976#else
    51765977            return ;
     5978#endif
    51775979          }
    51785980        } // Loop positions
     
    52036005  bCheckMcpDv = true;
    52046006  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFT, bDepthRefine ) )
     6007#if !QC_CU_NBDV_D0181
    52056008    return;
    5206 
     6009#else
     6010    return true;
     6011#endif
    52076012
    52086013  //// ******* Get disparity from above block ******* /////
     
    52256030    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
    52266031    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVE, bDepthRefine ) )
     6032#if !QC_CU_NBDV_D0181
    52276033      return;
     6034#else
     6035      return true;
     6036#endif
    52286037  }
    52296038
     
    52436052    bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
    52446053    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVERIGHT, bDepthRefine ) )
     6054#if !QC_CU_NBDV_D0181
    52456055      return;
     6056#else
     6057      return true;
     6058#endif
    52466059  }
    52476060
     
    52626075    bCheckMcpDv = true;
    52636076    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_LEFTBELOW, bDepthRefine ) )
     6077#if !QC_CU_NBDV_D0181
    52646078      return;
     6079#else
     6080      return true;
     6081#endif
    52656082  }
    52666083
     
    52826099    bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1);
    52836100    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, uiPartIdx, uiPartAddr, pDInfo, bCheckMcpDv, &cMvpDvInfo, DVFROM_ABOVELEFT, bDepthRefine ) )
     6101#if !QC_CU_NBDV_D0181
    52846102      return;
     6103#else
     6104      return true;
     6105#endif
    52856106  }
    52866107
     
    52976118          clipMv( cDispVec );
    52986119
    5299           TComPic* picDepth = getSlice()->getRefPicBaseDepth();
     6120          TComPic* picDepth = NULL;
     6121#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6122          Int refPOC = getSlice()->getPOC();
     6123          picDepth = getSlice()->getDepthRefPic(0, refPOC);
     6124          assert(picDepth!=NULL);
     6125#else
     6126          picDepth = getSlice()->getRefPicBaseDepth();
     6127#endif
     6128
     6129#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     6130          pDInfo->m_acMvCandNoRef[pDInfo->iN] = cDispVec;
     6131#endif
    53006132          if (picDepth && bDepthRefine)
     6133#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6134            estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &cDispVec, true); // from base view
     6135#else
    53016136            estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cDispVec, true);
    5302 
    5303           pDInfo->m_acMvCand[ pDInfo->iN]   = cDispVec;
     6137#endif
     6138
     6139#if MERL_VSP_NBDV_RefVId_Fix_D0166 //if DVMCP is used, do a local reference frame list and idx search
     6140          Int refFrmIdx = 0;
     6141          RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     6142          getRefListAndRefFrmIdx(0, privateRefPicList, refFrmIdx); // find the reference picture from base view
     6143
     6144          pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     6145          pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     6146          assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     6147#endif
     6148
     6149          pDInfo->m_acMvCand[ pDInfo->iN ]  = cDispVec;
    53046150          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6151#if !QC_CU_NBDV_D0181
    53056152          return;
     6153#else
     6154          return true;
     6155#endif
    53066156        }
    53076157      }
    53086158    }
    53096159  }
     6160
     6161#if SEC_DEFAULT_DV_D0112
     6162  {
     6163    TComPic* picDepth = NULL;
     6164    TComMv defaultDV(0, 0);
     6165
     6166#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6167    Int refPOC = getSlice()->getPOC();
     6168    picDepth = getSlice()->getDepthRefPic(0, refPOC);
     6169    assert(picDepth!=NULL);
     6170#else
     6171    picDepth = getSlice()->getRefPicBaseDepth();
     6172#endif
     6173
     6174#if MERL_General_Fix
     6175#if QC_CU_NBDV_D0181 && MERL_VSP_C0152
     6176    pDInfo->m_acMvCandNoRef[pDInfo->iN] = defaultDV;
     6177#endif
     6178#endif
     6179
     6180    if (picDepth && bDepthRefine)
     6181    {
     6182#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6183      estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &defaultDV, true); // from base view
     6184#else
     6185      estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &defaultDV, true);
     6186#endif
     6187    }
     6188
     6189#if MERL_VSP_NBDV_RefVId_Fix_D0166
     6190    Int refFrmIdx = 0;
     6191    RefPicList privateRefPicList = REF_PIC_LIST_0 ;
     6192    getRefListAndRefFrmIdx(0, privateRefPicList, refFrmIdx); // find the reference picture from base view
     6193
     6194    pDInfo->m_aListIdx[ pDInfo->iN ]  = privateRefPicList;
     6195    pDInfo->m_aRefIdx [ pDInfo->iN ]  = -1-refFrmIdx;
     6196    assert(pDInfo->m_aRefIdx [ pDInfo->iN ] < 0);
     6197#endif
     6198    pDInfo->m_acMvCand[pDInfo->iN] = defaultDV;
     6199    pDInfo->m_aVIdxCan[pDInfo->iN] = 0;
     6200#if MERL_VSP_NBDV_RefVId_Fix_D0166  // Bug fix for Samsung code.
     6201    pDInfo->iN++;
     6202#endif
     6203  }
     6204#endif
     6205
     6206#if QC_CU_NBDV_D0181
     6207  return false;
     6208#else
    53106209  return;
     6210#endif
    53116211}
    53126212#endif
     
    53226222 */
    53236223#if H3D_IVMP
     6224#if SEC_TWO_CANDIDATES_FOR_AMVP_D0122
    53246225Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx)
    53256226{
     6227    fillMvpCandBase(uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pInfo);
     6228}
     6229#else
     6230Void TComDataCU::fillMvpCand ( UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, AMVPInfo* pInfo, Int iMVPIdx)
     6231{
     6232
    53266233  if (!m_pcSlice->getSPS()->getViewId() || !m_pcSlice->getSPS()->getMultiviewMvPredMode())
    53276234  {
     
    53506257      // Extension part
    53516258      DisInfo cDisInfo;
     6259#if QC_CU_NBDV_D0181
     6260      cDisInfo.iN = this->getDvInfo(0).iN;
     6261      cDisInfo.m_acMvCand[0]=this->getDvInfo(0).m_acMvCand[0];
     6262      cDisInfo.m_aVIdxCan[0] = this->getDvInfo(0).m_aVIdxCan[0];
     6263      cDisInfo.bDV = this->getDvInfo(0).bDV;
     6264#else
    53526265      cDisInfo.iN = 0;
    53536266#if FCO_DVP_REFINE_C0132_C0170
     
    53826295        cDisInfo.m_aVIdxCan[0] = 0;
    53836296      }
     6297#endif
    53846298      Int paiPdmRefIdx[4] = {-1, -1, -1, -1};
    53856299      Int iPdmDir[4]      = {-1, -1, -1, -1};
     
    54026316  }
    54036317}
     6318#endif
    54046319
    54056320
     
    57006615  }
    57016616 
    5702 #if MERL_VSP_C0152
     6617#if MERL_VSP_C0152&!QC_BVSP_CleanUP_D0191
    57036618  if(pcTmpCU != NULL && pcTmpCU->getVSPIndex(uiIdx))
    57046619  {
     
    58166731  }
    58176732
    5818 #if MERL_VSP_C0152
     6733#if MERL_VSP_C0152 &!QC_BVSP_CleanUP_D0191
    58196734  if(pcTmpCU->getVSPIndex(uiIdx))
    58206735  {
     
    59796894  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    59806895  iColViewIdx = pColCU->getSlice()->getViewId();
    5981 #if MERL_VSP_C0152
     6896#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    59826897  if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0)
    59836898  {
     
    70807995  memcpy( m_piVSPIndex + uiAbsPartIdxDst,  pcCU->getVSPIndex() + uiAbsPartIdxSrc, sizeof( m_piVSPIndex[0] ) * uiNumPartition );
    70817996#endif
     7997#if MERL_VSP_NBDV_RefVId_Fix_D0166
     7998  memcpy( m_piVSPDir   + uiAbsPartIdxDst,  pcCU->getVSPDir  () + uiAbsPartIdxSrc, sizeof( m_piVSPDir  [0] ) * uiNumPartition );
     7999#endif
    70828000
    70838001#if !MTK_UNCONSTRAINED_MVI_B0083
     
    71588076TComDataCU::getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv )
    71598077{
     8078#if !QC_ARP_D0177
    71608079  TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
    71618080  ROFRS( pcResidualGenerator, false );
     8081#endif
     8082
    71628083#if H3D_NBDV
    71638084  DisInfo cDisInfo;
     8085#if !QC_CU_NBDV_D0181
    71648086  cDisInfo.iN = 0;
     8087#else
     8088  cDisInfo.bDV = false;
     8089#endif
    71658090  PartSize m_peSaved =  getPartitionSize( 0 );
    71668091  m_pePartSize[0] =  SIZE_2Nx2N;
     
    71828107  else
    71838108#endif
    7184 
     8109#if !QC_CU_NBDV_D0181
    71858110  getDisMvpCandNBDV( 0, 0,  &cDisInfo, false ); 
    7186 
    71878111  if( cDisInfo.iN == 0)
     8112#else
     8113  cDisInfo.bDV = getDvInfo(0).bDV;
     8114#if MERL_VSP_C0152
     8115  cDisInfo.m_acMvCand[0] = getDvInfo(0).m_acMvCandNoRef[0];
     8116#else
     8117  cDisInfo.m_acMvCand[0] = getDvInfo(0).m_acMvCand[0];
     8118#endif
     8119  cDisInfo.m_aVIdxCan[0] = 0;
     8120  cDisInfo.iN = getDvInfo(0).iN;
     8121  if( cDisInfo.bDV == false)
     8122#endif
    71888123  {
    71898124    m_pePartSize[0] = m_peSaved;
     
    71918126  }
    71928127  else
     8128#if QC_ARP_D0177
     8129  if(m_pcSlice->getSPS()->getUseAdvRP()) 
     8130  {
     8131     m_pePartSize[0] = m_peSaved;
     8132     return true;
     8133  }
     8134  else
     8135    return false;
     8136#else
    71938137  {
    71948138    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0], bRecon );       
     
    71968140    return bAvailable;
    71978141  }
     8142#endif
    71988143#else
    71998144  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, bRecon );
     
    72018146}
    72028147#endif
    7203 
     8148#if QC_ARP_D0177
     8149Void TComDataCU::setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth )
     8150{
     8151  assert( sizeof( *m_puhARPW) == 1 );
     8152  memset( m_puhARPW + uiAbsPartIdx, w, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) );
     8153}
     8154#endif
    72048155#if LGE_EDGE_INTRA_A0070
    72058156Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion )
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r332 r443  
    195195                                      ///< value 0: non-VSP, value 1: VSP
    196196#endif
     197#if MERL_VSP_NBDV_RefVId_Fix_D0166
     198  Char*         m_piVSPDir;           ///< 0: LIST0; 1: LIST1
     199#endif
    197200#if AMP_MRG
    198201  Bool          m_bIsMergeAMP;
     
    214217  Bool*         m_pbResPredFlag;      ///< array of residual prediction flags
    215218#endif
    216 
     219#if QC_ARP_D0177
     220  UChar*        m_puhARPW;
     221#endif
    217222#if LGE_EDGE_INTRA_A0070
    218223  UChar*        m_pucEdgeCode;          ///< array of edge code
     
    268273  Pel*          m_apSegmentDCOffset[2];
    269274#endif
    270 
     275#if QC_CU_NBDV_D0181
     276  DisInfo*      m_pDvInfo;
     277#endif
    271278protected:
    272279 
     
    275282  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    276283#if MERL_VSP_C0152
    277   inline Bool   xAddVspMergeCand      ( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
    278                                         UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo );
    279   inline Void   xInheritVspMode       ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) ;
     284  inline Bool   xAddVspMergeCand      (
     285 UChar ucVspMergePos,
     286#if !LGE_VSP_INHERIT_D0092
     287 Int vspIdx,
     288 Bool* bVspMvZeroDone,
     289#endif
     290 UInt uiDepth,
     291 Bool* abCandIsInter,
     292 Int& iCount,
     293 UChar* puhInterDirNeighbours,
     294 TComMvField* pcMvFieldNeighbours,
     295 Int* iVSPIndexTrue,
     296 Int mrgCandIdx,
     297 DisInfo* pDisInfo
     298#if MERL_VSP_NBDV_RefVId_Fix_D0166
     299 , Int*   iVspDirTrue = NULL
     300#endif
     301                                        );
     302  inline Void   xInheritVspMode       ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo
     303#if QC_BVSP_CleanUP_D0191
     304   ,UChar *puhInterDirNeighbours
     305#endif
     306#if MERL_VSP_NBDV_RefVId_Fix_D0166
     307                                      , Int *iVSPDirTrue
     308#endif
     309    ) ;
    280310#endif
    281311  Void          deriveRightBottomIdx        ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB );
     
    299329 
    300330  /// compute scaling factor from POC difference
     331#if !QC_ARP_D0177
    301332  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
    302  
     333#endif
    303334  Void xDeriveCenterIdx( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxCenter );
    304335  Bool xGetCenterCol( UInt uiPartIdx, RefPicList eRefPicList, int iRefIdx, TComMv *pcMv );
     
    314345  // create / destroy / initialize / copy
    315346  // -------------------------------------------------------------------------------------------------------------------
    316  
     347#if QC_ARP_D0177
     348  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
     349#endif 
     350
    317351  Void          create                ( UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
    318352#if ADAPTIVE_QP_SELECTION
     
    326360  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
    327361  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
    328 
     362#if QC_CU_NBDV_D0181
     363  Void          copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);
     364#endif
    329365  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
    330   Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList );
    331   Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth );
     366  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
     367#if QC_CU_NBDV_D0181
     368  , Bool bNBDV = false
     369#endif
     370  );
     371  Void          copyPartFrom          ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth
     372#if QC_ARP_D0177
     373      ,
     374      Bool bRP = false
     375#endif
     376  );
    332377 
    333378  Void          copyToPic             ( UChar uiDepth );
     
    458503  Void          setVSPIndex        ( UInt uiIdx, Int n )     { m_piVSPIndex[uiIdx] = n;    }
    459504  Void          setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     505#endif
     506#if MERL_VSP_NBDV_RefVId_Fix_D0166
     507  Char*         getVSPDir          ()                        { return m_piVSPDir;                           }
     508  Char          getVSPDir          ( UInt uiIdx )            { return m_piVSPDir[uiIdx];                  }
     509  Void          setVSPDir          ( UInt uiIdx, Int n )     { m_piVSPDir[uiIdx] = n;  }
     510  Void          setVSPDirSubParts  ( Char bVSPDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     511  Bool          getRefListAndRefFrmIdx(Int targetRefViewIdx, RefPicList& eRefPicList, Int& refFrmIdx);
    460512#endif
    461513
     
    474526#endif
    475527#endif
     528#if QC_CU_NBDV_D0181
     529  DisInfo*      getDvInfo             ()                        { return m_pDvInfo;                }
     530  DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];         }
     531  Void          setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
     532#endif
    476533
    477534#if AMP_MRG
     
    537594  Bool          getUnifiedMvPredCan       ( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* iPdm, Bool bMerge );
    538595  Void          getDisMvpCand        ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo );
     596#if QC_CU_NBDV_D0181
     597  Bool          getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false
     598#else
    539599  Void          getDisMvpCandNBDV( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo , Bool bParMerg = false
     600#endif
    540601#if MERL_VSP_C0152
    541602                              , Bool bDepthRefine = false
     
    548609#if MERL_VSP_C0152
    549610  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec, Bool bSimpleDvpRefine = false);
    550   Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
     611  Void          estimateDVFromDM(
     612#if MERL_VSP_NBDV_RefVId_Fix_D0166
     613                Int refViewIdx,
     614#endif
     615                UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred, Bool bSimpleDvpRefine = false);
    551616#endif
    552617  Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
     
    568633  Bool          getResidualSamples( UInt uiPartIdx, Bool bRecon, TComYuv* pcYuv = 0 );
    569634#endif
     635#if QC_ARP_D0177
     636  UChar*        getARPW          ()                        { return m_puhARPW;               }
     637  UChar         getARPW          ( UInt uiIdx )            { return m_puhARPW[uiIdx];        }
     638  Void          setARPW          ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
     639  Void          setARPWSubParts  ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
     640  Double        getARPWFactor    ( UInt uiIdx );
     641#endif
    570642  // -------------------------------------------------------------------------------------------------------------------
    571643  // member functions for accessing partition information
     
    647719  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    648720#if MERL_VSP_C0152
    649   Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 );
     721  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue,
     722#if MERL_VSP_NBDV_RefVId_Fix_D0166
     723                Int* iVSPDir,
     724#endif
     725                Int mrgCandIdx = -1 );
    650726#else
    651727  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
     
    688764  UInt          getCtxResPredFlag               ( UInt   uiAbsPartIdx                                 );
    689765#endif
    690  
     766#if QC_ARP_D0177
     767  UInt          getCTXARPWFlag                 ( UInt   uiAbsPartIdx                                 );
     768#endif 
    691769  UInt          getSliceStartCU         ( UInt pos )                  { return m_uiSliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                          }
    692770  UInt          getEntropySliceStartCU  ( UInt pos )                  { return m_uiEntropySliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
     
    808886  Void          setSDCFlagSubParts  ( Bool bSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    809887 
     888#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    810889  UInt          getCtxSDCFlag              ( UInt uiAbsPartIdx );
     890#endif
    811891 
    812892  Bool          getSDCAvailable             ( UInt uiAbsPartIdx );
  • trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h

    r332 r443  
    8080
    8181  UInt      getPdm  ()                            { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getPredDepthMapGeneration(); } return 0; }
    82 #if H3D_IVRP
     82#if H3D_IVRP & !QC_ARP_D0177
    8383  UInt      getResPrd ()                          { if( m_aacActiveSPS[0][1] ) { return m_aacActiveSPS[0][1]->getMultiviewResPredMode  (); } return 0; }
    8484#endif
  • trunk/source/Lib/TLibCommon/TComInterpolationFilter.cpp

    r56 r443  
    7272  { -2, 10, 58, -2 }
    7373};
    74 
     74#if QC_ARP_D0177
     75const Short TComInterpolationFilter::m_lumaFilterARP[4][NTAPS_LUMA_ARP] =
     76{
     77  {64,  0},
     78  {48, 16},
     79  {32, 32},
     80  {16, 48}
     81};
     82const Short TComInterpolationFilter::m_chromaFilterARP[8][NTAPS_CHROMA_ARP] =
     83{
     84  {64,  0},
     85  {56,  8},
     86  {48, 16},
     87  {40, 24},
     88  {32, 32},
     89  {24, 40},
     90  {16, 48},
     91  {8,  56}
     92};
     93#endif
    7594// ====================================================================================================================
    7695// Private member functions
     
    320339 * \param  isLast     Flag indicating whether it is the last filtering operation
    321340 */
    322 Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast )
     341Void TComInterpolationFilter::filterHorLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast
     342#if QC_ARP_D0177
     343    ,
     344    Bool filterType
     345#endif
     346    )
    323347{
    324348  assert(frac >= 0 && frac < 4);
     
    330354  else
    331355  {
    332     filterHor<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
     356#if QC_ARP_D0177
     357    if(filterType)
     358      filterHor<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]);
     359    else
     360#endif
     361      filterHor<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
    333362  }
    334363}
     
    347376 * \param  isLast     Flag indicating whether it is the last filtering operation
    348377 */
    349 Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast )
     378Void TComInterpolationFilter::filterVerLuma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
     379#if QC_ARP_D0177
     380    ,
     381    Bool filterType
     382#endif
     383    )
    350384{
    351385  assert(frac >= 0 && frac < 4);
     
    357391  else
    358392  {
    359     filterVer<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);   
     393#if QC_ARP_D0177
     394    if(filterType)
     395      filterVer<NTAPS_LUMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]);   
     396    else
     397#endif
     398      filterVer<NTAPS_LUMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);   
    360399  }
    361400}
     
    373412 * \param  isLast     Flag indicating whether it is the last filtering operation
    374413 */
    375 Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast )
     414Void TComInterpolationFilter::filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast
     415#if QC_ARP_D0177
     416    ,
     417    Bool filterType
     418#endif
     419    )
    376420{
    377421  assert(frac >= 0 && frac < 8);
     
    383427  else
    384428  {
     429#if QC_ARP_D0177
     430    if(filterType)
     431      filterHor<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]);   
     432    else
     433#endif
    385434    filterHor<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]);
    386435  }
     
    400449 * \param  isLast     Flag indicating whether it is the last filtering operation
    401450 */
    402 Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast )
     451Void TComInterpolationFilter::filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
     452#if QC_ARP_D0177
     453    ,
     454    Bool filterType
     455#endif
     456    )
    403457{
    404458  assert(frac >= 0 && frac < 8);
     
    410464  else
    411465  {
    412     filterVer<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]);   
     466#if QC_ARP_D0177
     467    if(filterType)
     468      filterVer<NTAPS_CHROMA_ARP>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]); 
     469    else
     470#endif
     471      filterVer<NTAPS_CHROMA>(src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]);   
    413472  }
    414473}
  • trunk/source/Lib/TLibCommon/TComInterpolationFilter.h

    r56 r443  
    4444//! \ingroup TLibCommon
    4545//! \{
     46#if QC_ARP_D0177
     47#define NTAPS_LUMA_ARP    2 ///< Number of taps for luma
     48#define NTAPS_CHROMA_ARP  2 ///< Number of taps for chroma
     49#endif
    4650
    4751#define NTAPS_LUMA        8 ///< Number of taps for luma
     
    5862  static const Short m_lumaFilter[4][NTAPS_LUMA];     ///< Luma filter taps
    5963  static const Short m_chromaFilter[8][NTAPS_CHROMA]; ///< Chroma filter taps
    60  
     64#if QC_ARP_D0177
     65  static const Short m_lumaFilterARP  [4][NTAPS_LUMA_ARP];     ///< Luma filter taps
     66  static const Short m_chromaFilterARP[8][NTAPS_CHROMA_ARP]; ///< Chroma filter taps
     67#endif
     68
    6169  static Void filterCopy(const Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Bool isFirst, Bool isLast);
    6270 
     
    7381  ~TComInterpolationFilter() {}
    7482
    75   Void filterHorLuma  (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast );
    76   Void filterVerLuma  (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast );
    77   Void filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast );
    78   Void filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast );
     83  Void filterHorLuma  (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast
     84#if QC_ARP_D0177
     85    ,
     86    Bool filterType = 0
     87#endif
     88    );
     89  Void filterVerLuma  (Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
     90#if QC_ARP_D0177
     91    ,
     92    Bool filterType = 0
     93#endif
     94    );
     95  Void filterHorChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast
     96#if QC_ARP_D0177
     97    ,
     98    Bool filterType = 0
     99#endif
     100    );
     101  Void filterVerChroma(Pel *src, Int srcStride, Short *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast
     102#if QC_ARP_D0177
     103    ,
     104    Bool filterType = 0
     105#endif
     106    );
    79107};
    80108
  • trunk/source/Lib/TLibCommon/TComLoopFilter.cpp

    r296 r443  
    428428  //-- Set BS for Intra MB : BS = 4 or 3
    429429  if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ)
    430 #if MERL_VSP_C0152
     430#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    431431    || pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ)
    432432#endif
     
    438438  //-- Set BS for not Intra MB : BS = 2 or 1 or 0
    439439  if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ)
    440 #if MERL_VSP_C0152
     440#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    441441    && !pcCUP->getVSPIndex(uiPartP) && !pcCUQ->getVSPIndex(uiPartQ)
    442442#endif
     
    534534  }   // enf of "if( not Intra )"
    535535 
    536 #if MERL_VSP_C0152
     536#if MERL_VSP_C0152 & !QC_BVSP_CleanUP_D0191
    537537  if ( pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ))
    538538  {
  • trunk/source/Lib/TLibCommon/TComMotionInfo.h

    r332 r443  
    6464  TComMv m_acMvCand[ DIS_CANS ];            ///< array of motion vector predictor candidates
    6565  Int    m_aVIdxCan[ DIS_CANS ];            ///< array of motion vector predictor candidates
     66#if QC_CU_NBDV_D0181
     67  Bool bDV;
     68#if MERL_VSP_C0152
     69  TComMv m_acMvCandNoRef[ DIS_CANS ];
     70#endif
     71#endif
    6672  Int    iN;                                ///< number of motion vector predictor candidates
     73#if MERL_VSP_NBDV_RefVId_Fix_D0166
     74  Int    m_aListIdx[ DIS_CANS ];            ///< array of reference list of derived NBDV
     75  Int    m_aRefIdx [ DIS_CANS ];            ///< array of reference frame index corresponding to either RefList0/1
     76#endif
    6777} DisInfo;
    6878
  • trunk/source/Lib/TLibCommon/TComPicYuv.cpp

    r332 r443  
    488488  }
    489489}
    490 
     490#if QC_ARP_D0177
     491Void  TComPicYuv::clearPic()
     492{
     493  ::memset ( m_apiPicBufY, 0 , sizeof (Pel) * ( m_iPicWidth       + (m_iLumaMarginX   << 1)) * ( m_iPicHeight       + (m_iLumaMarginY   << 1)) );
     494  ::memset ( m_apiPicBufU, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
     495  ::memset ( m_apiPicBufV, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
     496}
     497#endif
    491498//! \}
  • trunk/source/Lib/TLibCommon/TComPicYuv.h

    r56 r443  
    183183  Void  setLumaTo    ( Pel pVal ); 
    184184  Void  setChromaTo  ( Pel pVal ); 
    185 
     185#if QC_ARP_D0177
     186  Void    clearPic();
     187#endif
    186188};// END CLASS DEFINITION TComPicYuv
    187189
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r332 r443  
    5050#endif
    5151
     52#if HHI_DELTADC_DLT_D0035
     53#define GetDepthValue2Idx(val)     (pcCU->getSlice()->getSPS()->depthValue2idx(val))
     54#define GetIdx2DepthValue(val)     (pcCU->getSlice()->getSPS()->idx2DepthValue(val))
     55#endif
     56
     57#if MERL_General_Fix
     58#if MERL_VSP_C0152
     59#if MERL_CVSP_D0165
     60Int TComPrediction::m_iRangeLuma[12]   = {14, 34, 21, 15, 36, 26, 21, 49, 41, 36, 80, 72};
     61Int TComPrediction::m_iRangeChroma[12] = { 2,  8,  5,  4, 11,  9,  8, 19, 17, 15, 34, 32};
     62#endif
     63#endif
     64#endif
     65
    5266TComPrediction::TComPrediction()
    5367: m_pLumaRecBuffer(0)
     
    7892
    7993  m_cYuvPredTemp.destroy();
    80 
     94#if QC_ARP_D0177
     95  m_acYuvPredBase[0].destroy();
     96  m_acYuvPredBase[1].destroy();
     97  m_acYuvDiff[0].destroy();
     98  m_acYuvDiff[1].destroy();
     99#endif
    81100  if( m_pLumaRecBuffer )
    82101  {
     
    119138
    120139    m_cYuvPredTemp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );
     140#if QC_ARP_D0177
     141    m_acYuvPredBase[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
     142    m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
     143    m_acYuvDiff    [0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
     144    m_acYuvDiff    [1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
     145#endif
    121146  }
    122147
     
    535560  // Do prediction
    536561  {
     562#if QC_DC_PREDICTOR_D0183
     563    Int iMean0, iMean1;
     564    getPredDCs( pbRegion, iWidth, pSrc+srcStride+1, srcStride, iMean0, iMean1 );
     565#else
    537566    //UInt uiSum0 = 0, uiSum1 = 0;
    538567    Int iSum0 = 0, iSum1 = 0;
     
    573602    iMean0 = iSum0 / iCount0; // TODO : integer op.
    574603    iMean1 = iSum1 / iCount1;
     604#endif
    575605#if LGE_EDGE_INTRA_DELTA_DC
    576606    if( bDelta )
     
    751781}
    752782
    753 #if H3D_IVRP
     783#if H3D_IVRP & !QC_ARP_D0177
    754784Void TComPrediction::residualPrediction(TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred)
    755785{
     
    768798  pcYuvPred->add(pcYuvResPred, iWidth, iHeight);
    769799}
     800#endif
     801
     802#if MERL_General_Fix
     803#if MERL_VSP_C0152
     804// Function to perform VSP block compensation
     805Void  TComPrediction::xPredInterVSPBlk(TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComMv cMv, RefPicList eRefPicList, TComYuv*& rpcYuvPred
     806                                     , Bool bi
     807#if !MERL_Bi_VSP_D0166
     808                                     , Int vspIdx
     809#endif
     810                                       )
     811{
     812  TComPic*    pRefPicBaseTxt        = NULL;
     813  TComPicYuv* pcBaseViewTxtPicYuv   = NULL;
     814  TComPicYuv* pcBaseViewDepthPicYuv = NULL;
     815  Int iBlkX = 0;
     816  Int iBlkY = 0;
     817  Int* pShiftLUT;
     818  Int  iShiftPrec;
     819
     820#if !MERL_VSP_NBDV_RefVId_Fix_D0166
     821  pRefPicBaseTxt        = pcCU->getSlice()->getRefPicBaseTxt();
     822  pcBaseViewTxtPicYuv   = pRefPicBaseTxt->getPicYuvRec();
     823  TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
     824  pcBaseViewDepthPicYuv     = pRefPicBaseDepth->getPicYuvRec();
     825
     826  Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     827  Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     828  pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec);
     829  xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred );
     830  xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred );
     831
     832#else // MERL_VSP_NBDV_RefVId_Fix_D0166
     833   // Step 1: get depth reference
     834#if QC_BVSP_CleanUP_D0191
     835  RefPicList privateRefPicList = REF_PIC_LIST_0;
     836  Int refIdxList0 = pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr );
     837  Int refIdxList1 = pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr );
     838  privateRefPicList = refIdxList0 != NOT_VALID ? REF_PIC_LIST_0 : REF_PIC_LIST_1;
     839  if(privateRefPicList == REF_PIC_LIST_1 && refIdxList1== NOT_VALID )
     840  {
     841    assert(0);
     842  }
     843  Int privateRefIdx = privateRefPicList == REF_PIC_LIST_0 ? refIdxList0 : refIdxList1;
     844  Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, privateRefIdx);
     845  Int refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, privateRefIdx);
     846#else
     847  //recover VSP reference frame according to negative refIdx number
     848  RefPicList privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr );
     849  assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     850  Int  refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); // texture ref index, a trick when storing refIdx
     851  Int  viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx);  // texture view id
     852  Int  refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, refIdx);     // texture POC
     853#endif
     854  TComPic* pRefPicBaseDepth = pcCU->getSlice()->getDepthRefPic(viewId, refPoc);
     855
     856  pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
     857  assert(refPoc == pcCU->getSlice()->getPOC());
     858  assert(pRefPicBaseDepth != NULL);
     859  assert(pcBaseViewDepthPicYuv != NULL);
     860
     861  iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     862  iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     863#if MERL_Bi_VSP_D0166
     864  // Step 2: get texture reference
     865  pRefPicBaseTxt = xGetVspRefTxt( pcCU, uiPartAddr, eRefPicList);
     866  pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec();
     867  assert(pcBaseViewTxtPicYuv != NULL);
     868
     869  // initialize the LUT according to the reference view idx
     870  pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec, pRefPicBaseTxt->getViewId());
     871
     872  // Step 3: Do compensation
     873  xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred, bi );
     874  xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), rpcYuvPred, bi );
     875#else
     876  // Step 2: get texture reference
     877  pRefPicBaseTxt = pcCU->getSlice()->getRefPic(privateRefPicList, refIdx);
     878  pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec();
     879  assert(pcBaseViewTxtPicYuv != NULL);
     880
     881  //initialize the LUT according to the reference view idx
     882  pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec, pRefPicBaseTxt->getViewId());
     883
     884  // Step 3: Do compensation
     885  xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     886  xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     887#endif
     888
     889#endif
     890}
     891
     892#endif
     893
     894#if MERL_Bi_VSP_D0166
     895TComPic*  TComPrediction::xGetVspRefTxt(TComDataCU* pcCU, UInt uiPartAddr, RefPicList eRefPicList)
     896{
     897#if QC_BVSP_CleanUP_D0191
     898  RefPicList privateRefPicList = REF_PIC_LIST_0;
     899  Int refIdxList0 = pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr );
     900  Int refIdxList1 = pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr );
     901  privateRefPicList = refIdxList0 != NOT_VALID ? REF_PIC_LIST_0 : REF_PIC_LIST_1;
     902  if(privateRefPicList == REF_PIC_LIST_1 && refIdxList1==NOT_VALID )
     903  {
     904    assert(0);
     905  }
     906  Int privateRefIdx = privateRefPicList == REF_PIC_LIST_0 ? refIdxList0 : refIdxList1;
     907  Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, privateRefIdx);
     908#else
     909  RefPicList  privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr );
     910  Int         refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr ); // texture ref index, a trick when storing refIdx
     911  Int         viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx);  // texture view id
     912#endif
     913  TComPic*    refPic = NULL;
     914
     915  assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     916
     917  if (privateRefPicList == eRefPicList)
     918  {
     919#if QC_BVSP_CleanUP_D0191
     920    Int  refIdxt = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     921#else
     922    Int  refIdxt = -1-pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     923#endif
     924    assert(refIdxt>= 0);
     925    refPic = pcCU->getSlice()->getRefPic(eRefPicList, refIdxt);
     926  }
     927  else
     928  {
     929    // Find the other interview reference in order to do VSP
     930    RefPicList otherRefPicList = privateRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     931    Bool isFound = false;
     932    for (Int iRefIdx = 0; iRefIdx <pcCU->getSlice()->getNumRefIdx(otherRefPicList); iRefIdx ++ )
     933    {
     934      Int refViewIdx  = pcCU->getSlice()->getRefViewId( otherRefPicList, iRefIdx);
     935      if ( (refViewIdx != pcCU->getSlice()->getViewId()) && (refViewIdx != viewId ) )
     936      {
     937        refPic = pcCU->getSlice()->getRefPic(otherRefPicList, iRefIdx);
     938        isFound = true;
     939        break;
     940      }
     941    }
     942
     943    if (isFound == false)
     944    {
     945#if QC_BVSP_CleanUP_D0191
     946      Int  refIdxTxt = pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr );
     947#else
     948      Int  refIdxTxt = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr );
     949#endif
     950      assert(refIdxTxt >= 0);
     951      refPic = pcCU->getSlice()->getRefPic(privateRefPicList, refIdxTxt);
     952    }
     953    assert(isFound);
     954  }
     955  assert(refPic != NULL);
     956  return refPic;
     957}
     958#endif
    770959#endif
    771960
     
    781970  if (vspIdx != 0)
    782971  {
     972#if !QC_BVSP_CleanUP_D0191
    783973    if (iRefIdx >= 0)
    784974    {
     
    786976    }
    787977    assert (iRefIdx < 0); // assert (iRefIdx == NOT_VALID);
     978#endif
    788979  }
    789980  else
     
    8101001  }
    8111002#endif
    812 
     1003#if QC_ARP_D0177
     1004  if(
     1005#if MERL_General_Fix // TODO: Maybe logically redundant, but easier to read. Need verification before being removed
     1006#if MERL_VSP_C0152
     1007       vspIdx == 0 &&
     1008#endif
     1009#endif
     1010       pcCU->getSlice()->getSPS()->isDepth() == false
     1011    && pcCU->getSlice()->getSPS()->getViewId() > 0
     1012    && pcCU->getSlice()->getSPS()->getUseAdvRP() > 0
     1013    && pcCU->getARPW( uiPartAddr ) > 0
     1014    && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()!= pcCU->getSlice()->getPOC()
     1015    && (pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N || pcCU->isSkipped(uiPartAddr))
     1016    )
     1017  {
     1018    xPredInterUniARP( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , iPartIdx , bi );
     1019  }
     1020  else
     1021  {
     1022#endif
    8131023#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
    8141024  if( pcCU->getSlice()->getSPS()->isDepth() )
     
    8161026#if MERL_VSP_C0152
    8171027    if (vspIdx != 0)
    818     { // depth, vsp
     1028    { // depth, vsp compensation
     1029#if !MERL_General_Fix
    8191030      // get depth estimator here
    8201031      TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
     
    8331044      xPredInterLumaBlkFromDM  ( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,     pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
    8341045      xPredInterChromaBlkFromDM( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1,  pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     1046#else
     1047#if MERL_Bi_VSP_D0166
     1048      xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi );
     1049#else
     1050      xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi, vspIdx );
     1051#endif
     1052#endif
    8351053    }
    8361054    else
     
    8551073#endif// MERL_VSP_C0152 //else
    8561074  }
    857   else
     1075  else  // texture
    8581076  {
    8591077#endif
    8601078#if MERL_VSP_C0152
    8611079    if ( vspIdx != 0 )
    862     { // texture, vsp
     1080    { // texture, vsp compensation
     1081#if !MERL_General_Fix
    8631082      TComPic*    pRefPicBaseTxt        = pcCU->getSlice()->getRefPicBaseTxt();
    8641083      TComPicYuv* pcBaseViewTxtPicYuv   = pRefPicBaseTxt->getPicYuvRec();
     
    8791098      xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
    8801099      xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     1100#else
     1101#if MERL_Bi_VSP_D0166
     1102      xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi );
     1103#else
     1104      xPredInterVSPBlk(pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, cMv, eRefPicList, rpcYuvPred, bi, vspIdx );
     1105#endif
     1106#endif
    8811107    }
    8821108    else//texture not VSP
     
    9111137   }
    9121138#endif
    913 }
    914 
     1139#if QC_ARP_D0177
     1140  }
     1141#endif
     1142}
     1143
     1144#if QC_ARP_D0177
     1145Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi, TComMvField * pNewMvFiled )
     1146{
     1147  Int         iRefIdx     = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
     1148  TComMv      cMv         = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     1149  Bool        bTobeScaled = false;
     1150  UChar dW = pcCU->getARPW ( uiPartAddr );
     1151  TComPic* pcPicYuvBaseCol =  NULL;
     1152  TComPic* pcPicYuvBaseRef =  NULL;
     1153  DisInfo cDistparity;
     1154
     1155  if( pNewMvFiled )
     1156  {
     1157    iRefIdx = pNewMvFiled->getRefIdx();
     1158    cMv = pNewMvFiled->getMv();
     1159  }
     1160
     1161#if QC_CU_NBDV_D0181
     1162  cDistparity.bDV           = pcCU->getDvInfo(uiPartAddr).bDV;
     1163  if( cDistparity.bDV )
     1164  {
     1165#if MERL_VSP_C0152
     1166    cDistparity.m_acMvCand[0] = pcCU->getDvInfo(0).m_acMvCandNoRef[0];
     1167#else
     1168    cDistparity.m_acMvCand[0] = pcCU->getDvInfo(0).m_acMvCand[0];
     1169#endif
     1170    assert(pcCU->getDvInfo(uiPartAddr).bDV ==  pcCU->getDvInfo(0).bDV);
     1171    cDistparity.m_aVIdxCan[0] = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan[0];
     1172    cDistparity.iN            = pcCU->getDvInfo(uiPartAddr).iN;
     1173  }
     1174  else
     1175    cDistparity.iN    =  0;
     1176#else
     1177  pcCU->getDisMvpCandNBDV( iPartIdx, uiPartAddr,  &cDistparity, false );
     1178#endif
     1179
     1180  dW = !cDistparity.iN ? 0: dW;
     1181  if( cDistparity.iN )
     1182  {
     1183    if(dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC()!= pcCU->getSlice()->getPOC())
     1184      bTobeScaled = true;
     1185    pcPicYuvBaseCol =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(),                              cDistparity.m_aVIdxCan[0] );
     1186    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC(), cDistparity.m_aVIdxCan[0] );
     1187    if( (!pcPicYuvBaseCol || pcPicYuvBaseCol->getPOC() != pcCU->getSlice()->getPOC()) || (!pcPicYuvBaseRef || pcPicYuvBaseRef->getPOC() != pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ))
     1188    {
     1189      dW = 0;
     1190      bTobeScaled = false;
     1191    }
     1192    else
     1193      assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() );
     1194    if(bTobeScaled)
     1195    {     
     1196      Int iCurrPOC = pcCU->getSlice()->getPOC();
     1197      Int iColRefPOC  = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx );
     1198      Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList,  0);
     1199      Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC);
     1200      if ( iScale != 4096 )
     1201        cMv = cMv.scaleMv( iScale );
     1202      iRefIdx = 0;
     1203    }
     1204  }
     1205  pcCU->clipMv(cMv);
     1206  TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec();
     1207  xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
     1208#if LGE_ILLUCOMP_B0045
     1209    , false
     1210#endif
     1211    , true
     1212    );
     1213  xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
     1214#if LGE_ILLUCOMP_B0045
     1215    , false
     1216#endif
     1217    , true
     1218    );
     1219  if( dW > 0 )
     1220  {
     1221    TComYuv * pYuvmB0 = &m_acYuvPredBase[0];
     1222    TComYuv * pYuvB1  = &m_acYuvPredBase[1];
     1223    assert ( cDistparity.iN == 1 );
     1224    pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
     1225    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acMvCand[0], iWidth, iHeight, pYuvB1, bi
     1226#if LGE_ILLUCOMP_B0045
     1227      , false
     1228#endif
     1229      ,  true
     1230      );
     1231    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cDistparity.m_acMvCand[0], iWidth, iHeight, pYuvB1, bi
     1232#if LGE_ILLUCOMP_B0045
     1233      , false
     1234#endif
     1235      , true
     1236      );
     1237    pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec();
     1238    TComMv cMVwithDisparity = cMv + cDistparity.m_acMvCand[0];
     1239    pcCU->clipMv(cMVwithDisparity);
     1240    xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvmB0, bi
     1241#if LGE_ILLUCOMP_B0045
     1242      , false
     1243#endif
     1244      , true
     1245      );
     1246    xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvmB0, bi
     1247#if LGE_ILLUCOMP_B0045
     1248      , false
     1249#endif
     1250      , true
     1251      );
     1252    pYuvB1->subtractARP( pYuvB1 , pYuvmB0 , uiPartAddr , iWidth , iHeight );
     1253    if(dW == 2)
     1254      pYuvB1->multiplyARP( uiPartAddr , iWidth , iHeight , dW );
     1255    rpcYuvPred->addARP( rpcYuvPred , pYuvB1 , uiPartAddr , iWidth , iHeight , !bi );
     1256  }
     1257}
     1258#endif
    9151259
    9161260#if MERL_VSP_C0152
     
    9231267  Int      iRefIdx[2] = {-1, -1};
    9241268
     1269#if MERL_Bi_VSP_D0166
     1270  Bool biDecision = 0;
     1271  Int  predDirVSP = 0;
     1272#if QC_BVSP_CleanUP_D0191
     1273  RefPicList privateRefPicList = REF_PIC_LIST_0;
     1274#endif
     1275  if (pcCU->getVSPIndex(uiPartAddr) != 0) // is VSP
     1276  {
     1277    Int biVSPAvail = 0;
     1278    //test whether VSP is Bi or Uni
     1279    //Step1. Get derived DV view id
     1280#if QC_BVSP_CleanUP_D0191
     1281    RefPicList otherRefPicList = REF_PIC_LIST_1;
     1282    Int refIdxList0 = pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr );
     1283    Int refIdxList1 = pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr );
     1284    privateRefPicList = refIdxList0 != NOT_VALID ? REF_PIC_LIST_0 : REF_PIC_LIST_1;
     1285    if(privateRefPicList == REF_PIC_LIST_1 && refIdxList1==NOT_VALID )
     1286    {
     1287      assert(0);
     1288    }
     1289    Int privateRefIdx = privateRefPicList == REF_PIC_LIST_0 ? refIdxList0 : refIdxList1;
     1290    Int viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, privateRefIdx);
     1291    Int refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, privateRefIdx);
     1292#else
     1293    Int  refIdx = pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr );
     1294    RefPicList privateRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr );
     1295    RefPicList otherRefPicList = privateRefPicList == REF_PIC_LIST_0 ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     1296    assert(privateRefPicList == REF_PIC_LIST_0 || privateRefPicList == REF_PIC_LIST_1);
     1297    Int  refIdx = -1-pcCU->getCUMvField( privateRefPicList )->getRefIdx( uiPartAddr );
     1298    assert(refIdx >= 0);
     1299    Int  viewId = pcCU->getSlice()->getRefViewId(privateRefPicList, refIdx);
     1300    Int  refPoc = pcCU->getSlice()->getRefPOC(privateRefPicList, refIdx);
     1301#endif
     1302    assert(refPoc == pcCU->getSlice()->getPOC());
     1303//    if(refPoc != pcCU->getSlice()->getPOC() )
     1304//    {
     1305//      printf("refPOC= %d, and current POC=%d\n", refPoc, pcCU->getSlice()->getPOC() );
     1306//    }
     1307    //Step 2. Get initial prediction direction value according to reference picture list availability
     1308    Int iInterDir = ((pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 && pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 0) ? 3 :
     1309      (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2));
     1310    //Step 3.  Check the availability of Bi VSP by checking the interview reference availability in the other reference list
     1311    if(iInterDir == 3)
     1312    {
     1313      for (Int jRefIdx = 0; jRefIdx <pcCU->getSlice()->getNumRefIdx(otherRefPicList); jRefIdx++ )
     1314      {
     1315        Int refViewIdx  = pcCU->getSlice()->getRefViewId( otherRefPicList, jRefIdx);
     1316        if ( (refViewIdx != pcCU->getSlice()->getViewId()) && (refViewIdx != viewId ) )
     1317        {
     1318          biVSPAvail = 1;
     1319          break;
     1320        }
     1321      }
     1322    }
     1323    //Step 4. Update the Bi VSP prediction direction
     1324    if ( iInterDir == 3 && biVSPAvail == 1)
     1325    {
     1326      biDecision   = 1;
     1327      predDirVSP = 3;
     1328    }
     1329    else
     1330    {
     1331      biDecision = 0;
     1332      if ( privateRefPicList == REF_PIC_LIST_0 )
     1333        predDirVSP = 1;
     1334      else
     1335        predDirVSP = 2;
     1336    }
     1337  }
     1338  else
     1339  {//not VSP
     1340    if( ( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 ) )
     1341      biDecision = 1;
     1342    else
     1343      biDecision = 0;
     1344  }
     1345#endif
     1346
    9251347  for ( Int iRefList = 0; iRefList < 2; iRefList++ )
    9261348  {
     
    9381360    else
    9391361    {
    940       if ( iRefList== REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID
     1362
     1363#if !MERL_Bi_VSP_D0166 //both lists should go
     1364      if ( iRefList == REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID
    9411365      {
    9421366        continue;
    9431367      }
     1368#else
     1369      //Reference list loop termination
     1370#if QC_BVSP_CleanUP_D0191
     1371      RefPicList privateVSPRefPicList = privateRefPicList;
     1372#else
     1373      RefPicList privateVSPRefPicList = (RefPicList) pcCU->getVSPDir( uiPartAddr );
     1374#endif
     1375      if( (pcCU->getVSPIndex(uiPartAddr)!=0) &&  iRefList != privateVSPRefPicList && !biDecision  )
     1376      {//when VSP mode, if it is uni prediction, the other reference list should skip
     1377        continue;
     1378      }
     1379#endif
     1380
    9441381    }
    9451382#else
     
    9531390
    9541391    pcMbYuv = &m_acYuvPred[iRefList];
     1392
     1393#if MERL_Bi_VSP_D0166
     1394    if(biDecision == 1)
     1395#else
    9551396    if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 )
     1397#endif
    9561398    {
    9571399#if MERL_VSP_C0152
     
    9931435  {
    9941436#if MERL_VSP_C0152
     1437#if !MERL_Bi_VSP_D0166
    9951438    if(pcCU->getVSPIndex(uiPartAddr))
    9961439      m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
    9971440    else
    9981441#endif
     1442#endif
    9991443    xWeightedPredictionBi( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
    10001444  }
     
    10041448  {
    10051449#if MERL_VSP_C0152
     1450#if !MERL_Bi_VSP_D0166
    10061451    if(pcCU->getVSPIndex(uiPartAddr))
    10071452      m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
    10081453    else
    10091454#endif
     1455#endif
    10101456      xWeightedPredictionUni( pcCU, &m_acYuvPred[0], uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, rpcYuvPred, iPartIdx );
    10111457  }
     
    10201466    {
    10211467#if MERL_VSP_C0152
     1468#if !MERL_Bi_VSP_D0166
    10221469      if(pcCU->getVSPIndex(uiPartAddr))
    10231470        m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
    10241471      else
    1025 #endif
     1472        xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1473#else
     1474      xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, predDirVSP );
     1475#endif
     1476#else
    10261477      xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1478#endif
    10271479    }
    10281480  }
     
    11081560 */
    11091561#if LGE_ILLUCOMP_B0045
    1110 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag)
    1111 #else
    1112 Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi )
     1562Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag
     1563#if QC_ARP_D0177
     1564    ,
     1565    Int filterType
     1566#endif
     1567    )
     1568#else
     1569Void TComPrediction::xPredInterLumaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
     1570#if QC_ARP_D0177
     1571    ,
     1572    Int filterType
     1573#endif
     1574    )
    11131575#endif
    11141576{
     
    11291591  if ( yFrac == 0 )
    11301592  {
    1131     m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac,       !bi );
     1593    m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac,       !bi
     1594#if QC_ARP_D0177
     1595    ,
     1596    filterType
     1597#endif
     1598    );
    11321599  }
    11331600  else if ( xFrac == 0 )
    11341601  {
    1135     m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi );
     1602    m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi
     1603#if QC_ARP_D0177
     1604    ,
     1605    filterType
     1606#endif
     1607    );
    11361608  }
    11371609  else
     
    11431615    Int halfFilterSize = ( filterSize >> 1 );
    11441616
    1145     m_if.filterHorLuma(ref - (halfFilterSize-1)*refStride, refStride, tmp, tmpStride, width, height+filterSize-1, xFrac, false     );
    1146     m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height,              yFrac, false, !bi);   
     1617    m_if.filterHorLuma(ref - (halfFilterSize-1)*refStride, refStride, tmp, tmpStride, width, height+filterSize-1, xFrac, false     
     1618 #if QC_ARP_D0177
     1619    ,
     1620    filterType
     1621#endif
     1622    );
     1623    m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height,              yFrac, false, !bi
     1624 #if QC_ARP_D0177
     1625    ,
     1626    filterType
     1627#endif
     1628    );   
    11471629  }
    11481630
     
    11851667 */
    11861668#if LGE_ILLUCOMP_B0045
    1187 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag )
    1188 #else
    1189 Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi )
     1669Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag
     1670#if QC_ARP_D0177
     1671    ,
     1672    Int filterType
     1673#endif   
     1674    )
     1675#else
     1676Void TComPrediction::xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
     1677#if QC_ARP_D0177
     1678  , Int filterType
     1679#endif
     1680  )
    11901681#endif
    11911682{
     
    12151706  if ( yFrac == 0 )
    12161707  {
    1217     m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi);   
    1218     m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi);   
     1708    m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi
     1709#if QC_ARP_D0177
     1710    ,
     1711    filterType
     1712#endif   
     1713    );   
     1714    m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi
     1715#if QC_ARP_D0177
     1716    ,
     1717    filterType
     1718#endif   
     1719    );   
    12191720  }
    12201721  else if ( xFrac == 0 )
    12211722  {
    1222     m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi);   
    1223     m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi);   
     1723    m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi
     1724 #if QC_ARP_D0177
     1725    ,
     1726    filterType
     1727#endif   
     1728    );   
     1729    m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi
     1730 #if QC_ARP_D0177
     1731    ,
     1732    filterType
     1733#endif   
     1734    );   
    12241735  }
    12251736  else
    12261737  {
    1227     m_if.filterHorChroma(refCb - (halfFilterSize-1)*refStride, refStride, extY,  extStride, cxWidth, cxHeight+filterSize-1, xFrac, false);
    1228     m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight  , yFrac, false, !bi);
     1738    m_if.filterHorChroma(refCb - (halfFilterSize-1)*refStride, refStride, extY,  extStride, cxWidth, cxHeight+filterSize-1, xFrac, false
     1739#if QC_ARP_D0177
     1740    ,
     1741    filterType
     1742#endif   
     1743    );
     1744    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight  , yFrac, false, !bi
     1745#if QC_ARP_D0177
     1746    ,
     1747    filterType
     1748#endif   
     1749    );
    12291750   
    1230     m_if.filterHorChroma(refCr - (halfFilterSize-1)*refStride, refStride, extY,  extStride, cxWidth, cxHeight+filterSize-1, xFrac, false);
    1231     m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight  , yFrac, false, !bi);   
     1751    m_if.filterHorChroma(refCr - (halfFilterSize-1)*refStride, refStride, extY,  extStride, cxWidth, cxHeight+filterSize-1, xFrac, false
     1752#if QC_ARP_D0177
     1753    ,
     1754    filterType
     1755#endif   
     1756    );
     1757    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight  , yFrac, false, !bi
     1758#if QC_ARP_D0177
     1759    ,
     1760    filterType
     1761#endif   
     1762    );   
    12321763  }
    12331764#if LGE_ILLUCOMP_B0045
     
    12741805// refPic: Ref picture. Full picture, with padding
    12751806// posX, posY:     PU position, texture
    1276 // size_x, size_y: PU size
     1807// sizeX, sizeY: PU size
    12771808// partAddr: z-order index
    12781809// mv: disparity vector. derived from neighboring blocks
    12791810//
    12801811// Output: dstPic, PU predictor 64x64
    1281 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
    1282                                             , TComYuv *&dstPic )
     1812Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth
     1813#if !MERL_Bi_VSP_D0166
     1814                                            , Int vspIdx
     1815#endif
     1816                                            , TComYuv *&dstPic
     1817#if MERL_Bi_VSP_D0166
     1818                                            , Bool bi
     1819#endif         
     1820                                            )
    12831821{
    12841822  Int widthLuma;
     
    13011839#endif
    13021840
     1841#if MERL_CVSP_D0165
     1842  Int widthDepth  = pPicBaseDepth->getWidth();
     1843  Int heightDepth = pPicBaseDepth->getHeight();
     1844#endif
     1845
    13031846  Int nTxtPerDepthX = widthLuma  / ( pPicBaseDepth->getWidth() );  // texture pixel # per depth pixel
    13041847  Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() );
     
    13071850  Int dstStride = dstPic->getStride();
    13081851  Int depStride =  pPicBaseDepth->getStride();
    1309   Int depthPosX = Clip3(0,   widthLuma - size_x,  (posX/nTxtPerDepthX) + (mv->getHor()>>2));
    1310   Int depthPosY = Clip3(0,   heightLuma- size_y,  (posY/nTxtPerDepthY) + (mv->getVer()>>2));
     1852#if LGE_ROUND_OFFSET_D0135
     1853  Int depthPosX = Clip3(0,   widthLuma - sizeX,  (posX/nTxtPerDepthX) + ((mv->getHor()+2)>>2));
     1854  Int depthPosY = Clip3(0,   heightLuma- sizeY,  (posY/nTxtPerDepthY) + ((mv->getVer()+2)>>2));
     1855#else
     1856  Int depthPosX = Clip3(0,   widthLuma - sizeX,  (posX/nTxtPerDepthX) + (mv->getHor()>>2));
     1857  Int depthPosY = Clip3(0,   heightLuma- sizeY,  (posY/nTxtPerDepthY) + (mv->getVer()>>2));
     1858#endif
    13111859  Pel *ref    = refPic->getLumaAddr() + posX + posY * refStride;
    13121860  Pel *dst    = dstPic->getLumaAddr(partAddr);
     
    13151863#if MERL_VSP_BLOCKSIZE_C0152 != 1
    13161864#if MERL_VSP_BLOCKSIZE_C0152 == 2
    1317   Int  dW = size_x>>1;
    1318   Int  dH = size_y>>1;
     1865  Int  dW = sizeX>>1;
     1866  Int  dH = sizeY>>1;
    13191867#endif
    13201868#if MERL_VSP_BLOCKSIZE_C0152 == 4
    1321   Int  dW = size_x>>2;
    1322   Int  dH = size_y>>2;
     1869  Int  dW = sizeX>>2;
     1870  Int  dH = sizeY>>2;
    13231871#endif
    13241872  {
     
    13421890#endif
    13431891        Int maxV = 0;
     1892#if MTK_DEPTH_TO_DISP_D0138
     1893        for (Int blockj = 0; blockj < MERL_VSP_BLOCKSIZE_C0152; blockj+=(MERL_VSP_BLOCKSIZE_C0152-1))
     1894#else
    13441895        for (Int blockj = 0; blockj < MERL_VSP_BLOCKSIZE_C0152; blockj++)
     1896#endif
    13451897        {
    13461898          Int iX = 0;
     1899#if MTK_DEPTH_TO_DISP_D0138
     1900          for (Int blocki = 0; blocki < MERL_VSP_BLOCKSIZE_C0152; blocki+=(MERL_VSP_BLOCKSIZE_C0152-1))
     1901#else
    13471902          for (Int blocki = 0; blocki < MERL_VSP_BLOCKSIZE_C0152; blocki++)
     1903#endif
    13481904          {
    13491905            if (maxV < depthTmp[iX])
     
    13811937#endif
    13821938 
     1939#if MERL_General_Fix
     1940#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1941#if MERL_CVSP_D0165
     1942  //get LUT based horizontal reference range
     1943  Int range = 0;
     1944  if( sizeX == 4 && sizeY == 8 )
     1945    range = m_iRangeLuma[0];
     1946  else if( sizeX == 8 && sizeY == 4 )
     1947    range = m_iRangeLuma[1];
     1948  else if( sizeX == 8 && sizeY == 8 )
     1949    range = m_iRangeLuma[2];
     1950  else if( sizeX == 8 && sizeY == 16 )
     1951    range = m_iRangeLuma[3];
     1952  else if( sizeX == 16 && sizeY == 8 )
     1953    range = m_iRangeLuma[4];
     1954  else if( sizeX == 16 && sizeY == 16 )
     1955    range = m_iRangeLuma[5];
     1956  else if( sizeX == 16 && sizeY == 32 )
     1957    range = m_iRangeLuma[6];
     1958  else if( sizeX == 32 && sizeY == 16 )
     1959    range = m_iRangeLuma[7];
     1960  else if( sizeX == 32 && sizeY == 32 )
     1961    range = m_iRangeLuma[8];
     1962  else if( sizeX == 32 && sizeY == 64 )
     1963    range = m_iRangeLuma[9];
     1964  else if( sizeX == 64 && sizeY == 32 )
     1965    range = m_iRangeLuma[10];
     1966  else if( sizeX == 64 && sizeY == 64 )
     1967    range = m_iRangeLuma[11];
     1968  else
     1969    assert(0);
     1970
     1971  // The minimum depth value
     1972  Int minRelativePos = 5000;
     1973  Int maxRelativePos = -5000;
     1974
     1975  Pel* depthTemp, *depthInitial=depth;
     1976  for (Int yTxt =0; yTxt<sizeY; yTxt++)
     1977  {
     1978    for (Int xTxt =0; xTxt<sizeX; xTxt++)
     1979    {
     1980      if (depthPosX+xTxt < widthDepth)
     1981        depthTemp = depthInitial + xTxt;
     1982      else
     1983        depthTemp = depthInitial + (widthDepth - depthPosX - 1);
     1984
     1985      Int disparity = pShiftLUT[ *depthTemp ] << iShiftPrec;
     1986      Int disparityInt = disparity >> 2;
     1987
     1988      if( disparity <= 0)
     1989      {
     1990        if (minRelativePos > disparityInt+xTxt)
     1991            minRelativePos = disparityInt+xTxt;
     1992      }
     1993      else
     1994      {
     1995        if (maxRelativePos < disparityInt+xTxt)
     1996            maxRelativePos = disparityInt+xTxt;
     1997      }
     1998    }
     1999    if (depthPosY+yTxt < heightDepth)
     2000      depthInitial = depthInitial + depStride;
     2001  }
     2002
     2003  Int disparity_tmp = pShiftLUT[ *depth ] << iShiftPrec;
     2004  if (disparity_tmp <= 0)
     2005    maxRelativePos = minRelativePos + range -1 ;
     2006  else
     2007    minRelativePos = maxRelativePos - range +1 ;
     2008#endif
     2009#endif
     2010#endif
     2011
    13832012#if MERL_VSP_BLOCKSIZE_C0152 != 1
    13842013  Int yDepth = 0;
    13852014#endif
    1386   for ( Int yTxt = 0; yTxt < size_y; yTxt += nTxtPerDepthY )
    1387   {
    1388     for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth++ )
    1389     {
    1390       Pel rep_depth = 0; // to store the depth value used for warping
     2015  for ( Int yTxt = 0; yTxt < sizeY; yTxt += nTxtPerDepthY )
     2016  {
     2017    for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth++ )
     2018    {
     2019      Pel repDepth = 0; // to store the depth value used for warping
    13912020#if MERL_VSP_BLOCKSIZE_C0152 == 1
    1392       rep_depth = depth[xDepth];
     2021      repDepth = depth[xDepth];
    13932022#endif
    13942023#if MERL_VSP_BLOCKSIZE_C0152 == 2
    1395       rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];
     2024      repDepth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];
    13962025#endif
    13972026#if MERL_VSP_BLOCKSIZE_C0152 == 4
    1398       rep_depth = m_pDepth[(xTxt>>2) + (yTxt>>2)*dW];
    1399 #endif
    1400 
    1401       assert( rep_depth >= 0 && rep_depth <= 255 );
    1402       Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec;
     2027      repDepth = m_pDepth[(xTxt>>2) + (yTxt>>2)*dW];
     2028#endif
     2029
     2030      assert( repDepth >= 0 && repDepth <= 255 );
     2031      Int disparity = pShiftLUT[ repDepth ] << iShiftPrec;
    14032032      Int refOffset = xTxt + (disparity >> 2);
    14042033      Int xFrac = disparity & 0x3;
     2034#if MERL_CVSP_D0165
     2035      if(refOffset<minRelativePos || refOffset>maxRelativePos)
     2036        xFrac = 0;
     2037      refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
     2038#endif
    14052039      Int absX  = posX + refOffset;
    14062040
     
    14132047
    14142048      assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
     2049#if MERL_Bi_VSP_D0166
     2050      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi );
     2051#else
    14152052      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true );
     2053#endif
     2054
    14162055    }
    14172056    ref   += refStride*nTxtPerDepthY;
     
    14212060    yDepth++;
    14222061#endif
    1423   }
    1424 }
    1425 
    1426 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
    1427                                                , TComYuv *&dstPic )
     2062
     2063  }
     2064}
     2065
     2066Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth
     2067#if !MERL_Bi_VSP_D0166
     2068                                               , Int vspIdx
     2069#endif
     2070                                               , TComYuv *&dstPic
     2071#if MERL_Bi_VSP_D0166
     2072                                               , Bool bi
     2073#endif
     2074                                               )
    14282075{
    14292076  Int refStride = refPic->getCStride();
     
    14582105    nTxtPerDepthX = widthChroma / widthDepth;
    14592106    nDepthPerTxtX = 1;
     2107#if LGE_ROUND_OFFSET_D0135
     2108    depthPosX = posX / nTxtPerDepthX + ((mv->getHor()+2)>>2);        //mv denotes the disparity for VSP
     2109#else
    14602110    depthPosX = posX / nTxtPerDepthX + (mv->getHor()>>2);        //mv denotes the disparity for VSP
     2111#endif
    14612112  }
    14622113  else
     
    14642115    nTxtPerDepthX = 1;
    14652116    nDepthPerTxtX = widthDepth / widthChroma;
     2117#if LGE_ROUND_OFFSET_D0135
     2118    depthPosX = posX * nDepthPerTxtX + ((mv->getHor()+2)>>2);        //mv denotes the disparity for VSP
     2119#else
    14662120    depthPosX = posX * nDepthPerTxtX + (mv->getHor()>>2);        //mv denotes the disparity for VSP
    1467   }
    1468   depthPosX = Clip3(0, widthDepth - (size_x<<1), depthPosX);
     2121#endif
     2122  }
     2123  depthPosX = Clip3(0, widthDepth - (sizeX<<1), depthPosX);
    14692124  if ( heightChroma > heightDepth )
    14702125  {
    14712126    nTxtPerDepthY = heightChroma / heightDepth;
    14722127    nDepthPerTxtY = 1;
     2128#if LGE_ROUND_OFFSET_D0135
     2129    depthPosY = posY / nTxtPerDepthY + ((mv->getVer()+2)>>2);     //mv denotes the disparity for VSP
     2130#else
    14732131    depthPosY = posY / nTxtPerDepthY + (mv->getVer()>>2);     //mv denotes the disparity for VSP
     2132#endif
    14742133  }
    14752134  else
     
    14772136    nTxtPerDepthY = 1;
    14782137    nDepthPerTxtY = heightDepth / heightChroma;
     2138#if LGE_ROUND_OFFSET_D0135
     2139    depthPosY = posY * nDepthPerTxtY + ((mv->getVer()+2)>>2);     //mv denotes the disparity for VSP
     2140#else
    14792141    depthPosY = posY * nDepthPerTxtY + (mv->getVer()>>2);     //mv denotes the disparity for VSP
    1480   }
    1481   depthPosY = Clip3(0, heightDepth - (size_y<<1), depthPosY);
     2142#endif
     2143  }
     2144  depthPosY = Clip3(0, heightDepth - (sizeY<<1), depthPosY);
    14822145
    14832146  Pel *refCb  = refPic->getCbAddr() + posX + posY * refStride;
     
    14912154  Int depStrideBlock = depStride * nDepthPerTxtY;
    14922155
     2156#if !MERL_Bi_VSP_D0166
    14932157  if (isDepth)
    14942158  {
    14952159     // DT: Since the call for this function is redundant, ..
    1496      for (Int y = 0; y < size_y; y++)
     2160     for (Int y = 0; y < sizeY; y++)
    14972161     {
    1498        for (Int x = 0; x < size_x; x++)
     2162       for (Int x = 0; x < sizeX; x++)
    14992163       {
    15002164         dstCb[x] = 128;
     
    15062170     return;
    15072171  }
    1508  
     2172#endif
     2173
    15092174  if ( widthChroma > widthDepth ) // We assume
    15102175  {
     
    15162181  {
    15172182#if MERL_VSP_BLOCKSIZE_C0152 == 1
    1518   Int  dW = size_x;
    1519   Int  dH = size_y;
     2183  Int  dW = sizeX;
     2184  Int  dH = sizeY;
    15202185  Int  sW = 2; // search window size
    15212186  Int  sH = 2;
    15222187#endif
    15232188#if MERL_VSP_BLOCKSIZE_C0152 == 2
    1524   Int  dW = size_x;
    1525   Int  dH = size_y;
     2189  Int  dW = sizeX;
     2190  Int  dH = sizeY;
    15262191  Int  sW = 2; // search window size
    15272192  Int  sH = 2;
    15282193#endif
    15292194#if MERL_VSP_BLOCKSIZE_C0152 == 4
    1530   Int  dW = size_x>>1;
    1531   Int  dH = size_y>>1;
     2195  Int  dW = sizeX>>1;
     2196  Int  dH = sizeY>>1;
    15322197  Int  sW = 4; // search window size
    15332198  Int  sH = 4;
     
    15942259
    15952260
    1596     // (size_x, size_y) is Chroma block size
    1597     for ( Int yTxt = 0, yDepth = 0; yTxt < size_y; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY )
    1598     {
    1599       for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX )
    1600       {
    1601         Pel rep_depth = 0; // to store the depth value used for warping
     2261#if MERL_General_Fix
    16022262#if MERL_VSP_BLOCKSIZE_C0152 == 1
    1603         rep_depth = m_pDepth[(xTxt) + (yTxt)*dW];
     2263#if MERL_CVSP_D0165
     2264  //get LUT based horizontal reference range
     2265  Int range=0;
     2266  if( sizeX == 2 && sizeY == 4 )
     2267    range = m_iRangeChroma[0];
     2268  else if( sizeX == 4 && sizeY == 2 )
     2269    range = m_iRangeChroma[1];
     2270  else if( sizeX == 4 && sizeY == 4 )
     2271    range = m_iRangeChroma[2];
     2272  else if( sizeX == 4 && sizeY == 8 )
     2273    range = m_iRangeChroma[3];
     2274  else if( sizeX == 8 && sizeY == 4 )
     2275    range = m_iRangeChroma[4];
     2276  else if( sizeX == 8 && sizeY == 8 )
     2277    range = m_iRangeChroma[5];
     2278  else if( sizeX == 8 && sizeY == 16 )
     2279    range = m_iRangeChroma[6];
     2280  else if( sizeX == 16 && sizeY == 8 )
     2281    range = m_iRangeChroma[7];
     2282  else if( sizeX == 16 && sizeY == 16 )
     2283    range = m_iRangeChroma[8];
     2284  else if( sizeX == 16 && sizeY == 32 )
     2285    range = m_iRangeChroma[9];
     2286  else if( sizeX == 32 && sizeY == 16 )
     2287    range = m_iRangeChroma[10];
     2288  else if( sizeX == 32 && sizeY == 32 )
     2289    range = m_iRangeChroma[11];
     2290  else
     2291    assert(0);
     2292 
     2293  // The minimum depth value
     2294  Int minRelativePos = 5000;
     2295  Int maxRelativePos = -5000;
     2296
     2297  Int depthTmp;
     2298  for (Int yTxt=0; yTxt<sizeY; yTxt++)
     2299  {
     2300    for (Int xTxt=0; xTxt<sizeX; xTxt++)
     2301    {
     2302      depthTmp = m_pDepth[xTxt+yTxt*dW];
     2303      Int disparity = pShiftLUT[ depthTmp ] << iShiftPrec;
     2304      Int disparityInt = disparity >> 3;//in chroma resolution
     2305
     2306      if (disparityInt < 0)
     2307      {
     2308        if (minRelativePos > disparityInt+xTxt)
     2309            minRelativePos = disparityInt+xTxt;
     2310      }
     2311      else
     2312      {
     2313        if (maxRelativePos < disparityInt+xTxt)
     2314            maxRelativePos = disparityInt+xTxt;
     2315      }
     2316    }
     2317  }
     2318
     2319  depthTmp = m_pDepth[0];
     2320  Int disparity_tmp = pShiftLUT[ depthTmp ] << iShiftPrec;
     2321  if ( disparity_tmp < 0 )
     2322    maxRelativePos = minRelativePos + range - 1;
     2323  else
     2324    minRelativePos = maxRelativePos - range + 1;
     2325
     2326#endif
     2327#endif
     2328#endif
     2329
     2330    // (sizeX, sizeY) is Chroma block size
     2331    for ( Int yTxt = 0, yDepth = 0; yTxt < sizeY; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY )
     2332    {
     2333      for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX )
     2334      {
     2335        Pel repDepth = 0; // to store the depth value used for warping
     2336#if MERL_VSP_BLOCKSIZE_C0152 == 1
     2337        repDepth = m_pDepth[(xTxt) + (yTxt)*dW];
    16042338#endif
    16052339#if MERL_VSP_BLOCKSIZE_C0152 == 2
    1606         rep_depth = m_pDepth[(xTxt) + (yTxt)*dW];
     2340        repDepth = m_pDepth[(xTxt) + (yTxt)*dW];
    16072341#endif
    16082342#if MERL_VSP_BLOCKSIZE_C0152 == 4
    1609         rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];
     2343        repDepth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];
    16102344#endif
    16112345
    16122346      // calculate the offset in the reference picture
    1613         Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec;
     2347        Int disparity = pShiftLUT[ repDepth ] << iShiftPrec;
    16142348        Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image
    16152349        Int xFrac = disparity & 0x7;
     2350#if MERL_CVSP_D0165
     2351        if(refOffset < minRelativePos || refOffset > maxRelativePos)
     2352          xFrac = 0;
     2353        refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
     2354#endif
    16162355        Int absX  = posX + refOffset;
    16172356
     
    16252364        assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 );
    16262365        assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 );
     2366#if MERL_Bi_VSP_D0166
     2367        m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
     2368        m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
     2369#else
    16272370        m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true);
    16282371        m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true);
     2372#endif
     2373
    16292374      }
    16302375      refCb += refStrideBlock;
     
    16352380    }
    16362381  }
     2382
    16372383}
    16382384
     
    16422388Void TComPrediction::xWeightedAveragePdm( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY )
    16432389{
     2390
    16442391  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
    16452392  {
     
    16612408#endif
    16622409
    1663 Void TComPrediction::xWeightedAverage( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst )
    1664 {
     2410Void TComPrediction::xWeightedAverage( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst
     2411#if MERL_Bi_VSP_D0166
     2412                                 , Int predDirVSP
     2413#endif
     2414  )
     2415{
     2416#if MERL_Bi_VSP_D0166
     2417  Bool isVSP = 0;
     2418  if (pcCU->getVSPIndex(uiPartIdx)!=0)//is VSP
     2419  {
     2420    isVSP = 1;
     2421  }
     2422
     2423  if(( !isVSP && iRefIdx0 >= 0 && iRefIdx1 >= 0 ) || ( isVSP && predDirVSP == 3 ))
     2424#else
    16652425  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     2426#endif
    16662427  {
    16672428    rpcYuvDst->addAvg( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight );
    16682429  }
     2430#if MERL_Bi_VSP_D0166
     2431  else if ( ( !isVSP && iRefIdx0 >= 0 && iRefIdx1 <  0 ) || ( isVSP && predDirVSP == 1))
     2432#else
    16692433  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     2434#endif
    16702435  {
    16712436    pcYuvSrc0->copyPartToPartYuv( rpcYuvDst, uiPartIdx, iWidth, iHeight );
    16722437  }
     2438#if MERL_Bi_VSP_D0166
     2439  else if (( !isVSP && iRefIdx0 <  0 && iRefIdx1 >= 0 ) || ( isVSP && predDirVSP == 2))
     2440#else
    16732441  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     2442#endif
    16742443  {
    16752444    pcYuvSrc1->copyPartToPartYuv( rpcYuvDst, uiPartIdx, iWidth, iHeight );
    16762445  }
     2446#if MERL_Bi_VSP_D0166
     2447  else
     2448  {//for debug test only
     2449    assert(0);
     2450  }
     2451#endif
    16772452}
    16782453
     
    20762851  iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
    20772852  iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
     2853#if LGE_ROUND_OFFSET_D0135
     2854  iRefX   = iCUPelX + ((pMv->getHor()+2) >> 2);
     2855  iRefY   = iCUPelY + ((pMv->getVer()+2) >> 2);
     2856#else
    20782857  iRefX   = iCUPelX + (pMv->getHor() >> 2);
    20792858  iRefY   = iCUPelY + (pMv->getVer() >> 2);
     2859#endif
    20802860  uiWidth = pcCU->getWidth(0);
    20812861  uiHeight = pcCU->getHeight(0);
     
    20892869  if(pcCU->getPUAbove(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelY > 0 && iRefY > 0)
    20902870  {
     2871#if LGE_ROUND_OFFSET_D0135
     2872    iRefOffset = ( (pMv->getHor()+2) >> 2 ) + ( (pMv->getVer()+2) >> 2 ) * iRefStride - iRefStride;
     2873#else
    20912874    iRefOffset = ( pMv->getHor() >> 2 ) + ( pMv->getVer() >> 2 ) * iRefStride - iRefStride;
     2875#endif
    20922876    pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset;
    20932877    pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride;
     
    21062890  if(pcCU->getPULeft(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelX > 0 && iRefX > 0)
    21072891  {
     2892#if LGE_ROUND_OFFSET_D0135
     2893    iRefOffset = ( (pMv->getHor()+2) >> 2 ) + ( (pMv->getVer()+2) >> 2 ) * iRefStride - 1;
     2894#else
    21082895    iRefOffset = ( pMv->getHor() >> 2 ) + ( pMv->getVer() >> 2 ) * iRefStride - 1;
     2896#endif
    21092897    pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset;
    21102898    pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1;
     
    22243012  iCUPelX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
    22253013  iCUPelY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[pcCU->getZorderIdxInCU()]];
     3014#if LGE_ROUND_OFFSET_D0135
     3015  iRefX   = iCUPelX + ((pMv->getHor()+2) >> 2);
     3016  iRefY   = iCUPelY + ((pMv->getVer()+2) >> 2);
     3017#else
    22263018  iRefX   = iCUPelX + (pMv->getHor() >> 2);
    22273019  iRefY   = iCUPelY + (pMv->getVer() >> 2);
     3020#endif
    22283021  uiWidth = pcCU->getWidth(0) >> 1;
    22293022  uiHeight = pcCU->getHeight(0) >> 1;
     
    22373030  if(pcCU->getPUAbove(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelY > 0 && iRefY > 0)
    22383031  {
     3032#if LGE_ROUND_OFFSET_D0135
     3033    iRefOffset = ( (pMv->getHor()+4) >> 3 ) + ( (pMv->getVer()+4) >> 3 ) * iRefStride - iRefStride;
     3034#else
    22393035    iRefOffset = ( pMv->getHor() >> 3 ) + ( pMv->getVer() >> 3 ) * iRefStride - iRefStride;
     3036#endif
    22403037    if (iChromaId == 0) // Cb
    22413038    {
     
    22623059  if(pcCU->getPULeft(uiTmpPartIdx, pcCU->getZorderIdxInCU()) && iCUPelX > 0 && iRefX > 0)
    22633060  {
     3061#if LGE_ROUND_OFFSET_D0135
     3062    iRefOffset = ( (pMv->getHor()+4) >> 3 ) + ( (pMv->getVer()+4) >> 3 ) * iRefStride - 1;
     3063#else
    22643064    iRefOffset = ( pMv->getHor() >> 3 ) + ( pMv->getVer() >> 3 ) * iRefStride - 1;
     3065#endif
    22653066    if (iChromaId == 0) // Cb
    22663067    {
     
    24263227}
    24273228
     3229#if QC_DC_PREDICTOR_D0183
     3230Void TComPrediction::getPredDCs( Bool* pbPattern, Int iStride, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2 )
     3231{
     3232  Int  iDC1, iDC2;
     3233  const Int  iTR = (   iStride - 1        ) - iMaskStride;
     3234  const Int  iTM = ( ( iStride - 1 ) >> 1 ) - iMaskStride;
     3235  const Int  iLB = (   iStride - 1        ) * iMaskStride - 1;
     3236  const Int  iLM = ( ( iStride - 1 ) >> 1 ) * iMaskStride - 1;
     3237  const UInt uiBitDepth = g_uiBitDepth + g_uiBitIncrement;
     3238
     3239  Bool bL = ( pbPattern[0] != pbPattern[(iStride-1)*iStride] );
     3240  Bool bT = ( pbPattern[0] != pbPattern[(iStride-1)]         );
     3241
     3242  if( bL == bT )
     3243  {
     3244    iDC1 = bL ? ( piMask[iTR] + piMask[iLB] )>>1 : 1<<( uiBitDepth - 1 );
     3245    iDC2 =      ( piMask[ -1] + piMask[-iMaskStride] )>>1;
     3246  }
     3247  else
     3248  {
     3249    iDC1 = bL ? piMask[iLB] : piMask[iTR];
     3250    iDC2 = bL ? piMask[iTM] : piMask[iLM];
     3251  }
     3252
     3253  riPredDC1 = pbPattern[0] ? iDC1 : iDC2;
     3254  riPredDC2 = pbPattern[0] ? iDC2 : iDC1;
     3255}
     3256#else
    24283257Void TComPrediction::getWedgePredDCs( TComWedgelet* pcWedgelet, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2, Bool bAbove, Bool bLeft )
    24293258{
     
    25033332  }
    25043333}
     3334#endif
    25053335
    25063336Void TComPrediction::calcWedgeDCs( TComWedgelet* pcWedgelet, Pel* piOrig, UInt uiStride, Int& riDC1, Int& riDC2 )
     
    28703700  Int iMaskStride = ( iWidth<<1 ) + 1;
    28713701  piMask += iMaskStride+1;
     3702#if QC_DC_PREDICTOR_D0183
     3703  getPredDCs( pcWedgelet->getPattern(), pcWedgelet->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 );
     3704#else
    28723705  getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
     3706#endif
    28733707
    28743708  // assign wedge pred DCs to prediction
    2875   if( bDelta ) { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip ( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); }
    2876   else         { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride,        iPredDC1,                   iPredDC2           ); }
     3709  if( bDelta )
     3710  {
     3711#if HHI_DELTADC_DLT_D0035
     3712    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, GetIdx2DepthValue( GetDepthValue2Idx(iPredDC1) + iDeltaDC1 ), GetIdx2DepthValue( GetDepthValue2Idx(iPredDC2) + iDeltaDC2 ) );
     3713#else
     3714    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) );
     3715#endif
     3716  }
     3717  else
     3718  {
     3719    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 );
     3720  }
    28773721}
    28783722
     
    28893733  Int iMaskStride = ( iWidth<<1 ) + 1;
    28903734  piMask += iMaskStride+1;
     3735#if QC_DC_PREDICTOR_D0183
     3736  getPredDCs( pcContourWedge->getPattern(), pcContourWedge->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 );
     3737#else
    28913738  getWedgePredDCs( pcContourWedge, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
     3739#endif
    28923740
    28933741  // assign wedge pred DCs to prediction
    2894   if( bDelta ) { assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, Clip ( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); }
    2895   else         { assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride,        iPredDC1,                   iPredDC2           ); }
     3742  if( bDelta )
     3743  {
     3744#if HHI_DELTADC_DLT_D0035
     3745    assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, GetIdx2DepthValue( GetDepthValue2Idx(iPredDC1) + iDeltaDC1 ), GetIdx2DepthValue( GetDepthValue2Idx(iPredDC2) + iDeltaDC2 ) );
     3746#else
     3747    assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) );
     3748#endif
     3749  }
     3750  else
     3751  {
     3752    assignWedgeDCs2Pred( pcContourWedge, piPred, uiStride, iPredDC1, iPredDC2 );
     3753  }
    28963754
    28973755  pcContourWedge->destroy();
     
    30643922  Int iMaskStride = ( iWidth<<1 ) + 1;
    30653923  piMask += iMaskStride+1;
     3924#if QC_DC_PREDICTOR_D0183
     3925  getPredDCs( pcWedgelet->getPattern(), pcWedgelet->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 );
     3926#else
    30663927  getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
     3928#endif
    30673929
    30683930  // assign wedge pred DCs to prediction
    3069   if( bDelta ) { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); }
    3070   else         { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1,           iPredDC2           ); }
     3931  if( bDelta )
     3932  {
     3933#if HHI_DELTADC_DLT_D0035
     3934    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, GetIdx2DepthValue( GetDepthValue2Idx(iPredDC1) + iDeltaDC1 ), GetIdx2DepthValue( GetDepthValue2Idx(iPredDC2) + iDeltaDC2 ) );
     3935#else
     3936    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) );
     3937#endif
     3938  }
     3939  else
     3940  {
     3941    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 );
     3942  }
    30713943}
    30723944
     
    30993971  Int iMaskStride = ( iWidth<<1 ) + 1;
    31003972  piMask += iMaskStride+1;
     3973#if QC_DC_PREDICTOR_D0183
     3974  getPredDCs( pcWedgelet->getPattern(), pcWedgelet->getStride(), piMask, iMaskStride, iPredDC1, iPredDC2 );
     3975#else
    31013976  getWedgePredDCs( pcWedgelet, piMask, iMaskStride, iPredDC1, iPredDC2, bAbove, bLeft );
     3977#endif
    31023978
    31033979  // assign wedge pred DCs to prediction
    3104   if( bDelta ) { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) ); }
    3105   else         { assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride,       iPredDC1,                   iPredDC2             ); }
     3980  if( bDelta )
     3981  {
     3982#if HHI_DELTADC_DLT_D0035
     3983    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, GetIdx2DepthValue( GetDepthValue2Idx(iPredDC1) + iDeltaDC1 ), GetIdx2DepthValue( GetDepthValue2Idx(iPredDC2) + iDeltaDC2 ) );
     3984#else
     3985    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, Clip( iPredDC1+iDeltaDC1 ), Clip( iPredDC2+iDeltaDC2 ) );
     3986#endif
     3987  }
     3988  else
     3989  {
     3990    assignWedgeDCs2Pred( pcWedgelet, piPred, uiStride, iPredDC1, iPredDC2 );
     3991  }
    31063992}
    31073993
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r332 r443  
    6969  TComYuv   m_acYuvPred[2];
    7070  TComYuv   m_cYuvPredTemp;
     71#if QC_ARP_D0177
     72  TComYuv   m_acYuvPredBase[2];
     73  TComYuv   m_acYuvDiff[2];
     74#endif
    7175  TComYuv m_filteredBlock[4][4];
    7276  TComYuv m_filteredBlockTmp[4];
     
    8084#if MERL_VSP_C0152
    8185  Int*   m_pDepth; ///< Local variable, to store a depth block, just to prevent allocate memory every time
     86
     87#if MERL_CVSP_D0165
     88  static Int m_iRangeLuma[12];
     89  static Int m_iRangeChroma[12];
     90#endif
    8291#endif
    8392
     
    8695 
    8796  // motion compensation functions
     97#if QC_ARP_D0177
     98  Void xPredInterUniARP       ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false, TComMvField * pNewMvFiled = NULL );
     99#endif
    88100#if MERL_VSP_C0152
    89101  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,       UInt uiAbsPartIdx,        Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false );
     
    103115      );
    104116
     117#if !MERL_General_Fix
    105118#if MERL_VSP_C0152
    106119  Void xPredInterUniBWVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi=false );
    107120  Void xPredInterBiBWVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
    108121#endif
     122#endif
    109123
    110124#if DEPTH_MAP_GENERATION
     
    113127
    114128#if LGE_ILLUCOMP_B0045
    115   Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false );
    116   Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false );
    117 #else
    118   Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi );
    119   Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi );
    120 #endif
     129  Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false
     130#if QC_ARP_D0177
     131    ,
     132    Int filterType = 0
     133#endif
     134    );
     135  Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi, Bool bICFlag = false
     136#if QC_ARP_D0177
     137    ,
     138    Int filterType = 0
     139#endif
     140    );
     141#else
     142  Void xPredInterLumaBlk  ( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
     143#if QC_ARP_D0177
     144    ,
     145    Int filterType = 0
     146#endif
     147    );
     148  Void xPredInterChromaBlk( TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *&dstPic, Bool bi
     149#if QC_ARP_D0177
     150    ,
     151    Int filterType = 0
     152#endif
     153    );
     154#endif
     155
     156#if MERL_Bi_VSP_D0166
     157  Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst,  Int predDir);
     158#else
    121159  Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
    122 
    123 #if MERL_VSP_C0152
    124   Void xPredInterLumaBlkFromDM    ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     160#endif
     161
     162#if MERL_VSP_C0152
     163#if !MERL_Bi_VSP_D0166
     164  Void xPredInterLumaBlkFromDM    ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, Int vspIdx
    125165                                  , TComYuv *&dstPic );
    126   Void xPredInterChromaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     166  Void xPredInterChromaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, Int vspIdx
    127167                                  , TComYuv *&dstPic );
    128 #endif
     168#else
     169  TComPic*  xGetVspRefTxt(TComDataCU* pcCU, UInt uiPartAddr, RefPicList eRefPicList);
     170  Void xPredInterLumaBlkFromDM    ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth,
     171    TComYuv *&dstPic, Bool bi);
     172  Void xPredInterChromaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth,
     173    TComYuv *&dstPic, Bool bi);
     174#endif
     175#endif
     176
    129177  Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    130178#if LGE_ILLUCOMP_B0045
     
    134182  Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
    135183  Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
     184
     185#if MERL_General_Fix
     186#if MERL_VSP_C0152
     187  Void xPredInterVSPBlk(TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComMv cMv, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi
     188#if !MERL_Bi_VSP_D0166
     189                                     , Int vspIdx
     190#endif
     191    );
     192#endif
     193#endif
    136194
    137195#if HHI_DMM_WEDGE_INTRA
     
    169227#endif
    170228
    171 #if H3D_IVRP
     229#if H3D_IVRP & !QC_ARP_D0177
    172230  Void residualPrediction         (TComDataCU* pcCU, TComYuv* pcYuvPred, TComYuv* pcYuvResPred);
    173231#endif
     
    191249#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    192250  Void  predIntraLumaDMM        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bAbove, Bool bLeft, Bool bEncoder );
    193 
     251#if QC_DC_PREDICTOR_D0183
     252  Void  getPredDCs              ( Bool* pbPattern, Int iPatternStride, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2 );
     253#else
    194254  Void  getWedgePredDCs         ( TComWedgelet* pcWedgelet, Int* piMask, Int iMaskStride, Int& riPredDC1, Int& riPredDC2, Bool bAbove, Bool bLeft );
     255#endif
    195256  Void  calcWedgeDCs            ( TComWedgelet* pcWedgelet, Pel* piOrig, UInt uiStride, Int& riDC1, Int& riDC2 );
    196257  Void  assignWedgeDCs2Pred     ( TComWedgelet* pcWedgelet, Pel* piPred,  UInt uiStride, Int   iDC1, Int   iDC2 );
  • trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r332 r443  
    4444
    4545
    46 #if H3D_IVRP
     46#if H3D_IVRP & !QC_ARP_D0177
    4747
    4848
     
    225225  }
    226226}
    227 
     227#endif
     228
     229#if !QC_ARP_D0177
    228230#if H3D_NBDV
    229231Bool
     
    249251}
    250252 
    251 #if H3D_NBDV
     253#if H3D_NBDV 
    252254Bool
    253255TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon) 
     
    263265  }
    264266  UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
     267#if QC_ARP_D0177
     268  if(pcPic->getSPS()->getMultiviewResPredMode())
     269  {
     270#endif
    265271#if H3D_NBDV
    266272  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
     
    269275#endif
    270276  return true;
     277#if QC_ARP_D0177
     278  }
     279  else
     280    return true;
     281#endif
    271282}
    272283
     
    345356  UInt        uiCUAddr  = pcCU->getAddr();
    346357  pcSubCU->copySubCU( pcCU, uiAbsPartIdx, uiDepth );
    347 
     358#if QC_CU_NBDV_D0181
     359  pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);
     360#endif
    348361  //--- set residual ---
    349362  switch( pcSubCU->getPredictionMode( 0 ) )
  • trunk/source/Lib/TLibCommon/TComResidualGenerator.h

    r332 r443  
    5050
    5151
    52 #if H3D_IVRP
     52#if H3D_IVRP & !QC_ARP_D0177
    5353
    5454class TComResidualGenerator
  • trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r296 r443  
    6262TComSampleAdaptiveOffset::TComSampleAdaptiveOffset()
    6363{
     64#if !LGE_SAO_MIGRATION_D0091
    6465  m_pcPic = NULL;
     66#endif
    6567  m_iOffsetBo = NULL;
    6668  m_pClipTable = NULL;
     
    7173  m_iUpBufft = NULL;
    7274  ipSwap = NULL;
     75#if !LGE_SAO_MIGRATION_D0091
    7376  m_pcYuvTmp = NULL;
     77#endif
    7478
    7579  m_pTmpU1 = NULL;
     
    8589}
    8690
     91#if !LGE_SAO_MIGRATION_D0091
    8792const Int TComSampleAdaptiveOffset::m_aiNumPartsInRow[5] =
    8893{
     
    102107  256  //level 4
    103108};
     109#endif
    104110
    105111const Int TComSampleAdaptiveOffset::m_aiNumCulPartsLevel[5] =
     
    124130  0
    125131};
    126 
     132#if !LGE_SAO_MIGRATION_D0091
    127133const UInt TComSampleAdaptiveOffset::m_iWeightSao[MAX_NUM_SAO_TYPE] =
    128134{
     
    146152  6
    147153};
     154#endif
    148155
    149156Int TComSampleAdaptiveOffset::m_iNumClass[MAX_NUM_SAO_TYPE] =
     
    187194  return idx;
    188195}
     196#if !LGE_SAO_MIGRATION_D0091
    189197/** convert quadtree Idx to Level, Row, and Col
    190198 * \param  idx,  *level,  *row,  *col
     
    223231  }
    224232}
     233#endif
    225234/** create SampleAdaptiveOffset memory.
    226235 * \param
     
    317326  }
    318327
    319 
     328#if LGE_SAO_MIGRATION_D0091
     329  if (m_iUpBuff1)
     330  {
     331      m_iUpBuff1--;
     332      delete [] m_iUpBuff1; m_iUpBuff1 = NULL;
     333  }
     334  if (m_iUpBuff2)
     335  {
     336      m_iUpBuff2--;
     337      delete [] m_iUpBuff2; m_iUpBuff2 = NULL;
     338  }
     339  if (m_iUpBufft)
     340  {
     341      m_iUpBufft--;
     342      delete [] m_iUpBufft; m_iUpBufft = NULL;
     343  }
     344#else
    320345  m_iUpBuff1--;
    321346  m_iUpBuff2--;
     
    334359    delete [] m_iUpBufft; m_iUpBufft = NULL;
    335360  }
     361#endif
    336362  if (m_pTmpL1)
    337363  {
     
    368394  initSAOParam(pcSaoParam, 0, 0, 0, -1, 0, m_iNumCuInWidth-1,  0, m_iNumCuInHeight-1,1);
    369395  initSAOParam(pcSaoParam, 0, 0, 0, -1, 0, m_iNumCuInWidth-1,  0, m_iNumCuInHeight-1,2);
     396#if !LGE_SAO_MIGRATION_D0091
    370397  for(Int j=0;j<MAX_NUM_SAO_TYPE;j++)
    371398  {
    372399    pcSaoParam->iNumClass[j] = m_iNumClass[j];
    373400  }
     401#endif
    374402  pcSaoParam->numCuInWidth  = m_iNumCuInWidth;
    375403  pcSaoParam->numCuInHeight = m_iNumCuInHeight;
     
    405433  pSaoPart->iLength     =  0;
    406434
     435#if LGE_SAO_MIGRATION_D0091
     436  pSaoPart->subTypeIdx = 0;
     437#else
    407438  pSaoPart->bandPosition = 0;
     439#endif
    408440
    409441  for (j=0;j<MAX_NUM_SAO_OFFSETS;j++)
     
    514546  for(Int c=0; c<iNumComponet; c++)
    515547  {
     548#if LGE_SAO_MIGRATION_D0091
     549    if (c<2)
     550    {
    516551    pcSaoParam->bSaoFlag[c] = 0;
     552    }
     553#else
     554    pcSaoParam->bSaoFlag[c] = 0;
     555#endif
    517556    for(Int i=0; i< m_aiNumCulPartsLevel[m_uiMaxSplitLevel]; i++)
    518557    {
     
    524563      pcSaoParam->psSaoPart[c][i].iMinDist      = MAX_INT;
    525564      pcSaoParam->psSaoPart[c][i].iMinRate      = MAX_INT;
     565#if LGE_SAO_MIGRATION_D0091
     566      pcSaoParam->psSaoPart[c][i].subTypeIdx    = 0;
     567#else
    526568      pcSaoParam->psSaoPart[c][i].bandPosition = 0;
     569#endif
    527570      for (Int j=0;j<MAX_NUM_SAO_OFFSETS;j++)
    528571      {
     
    557600  m_pcPic   = pcPic;
    558601  m_uiNumSlicesInPic = numSlicesInPic;
     602#if LGE_SAO_MIGRATION_D0091
     603  m_iSGDepth         = 0;
     604#else
    559605  m_iSGDepth         = pcPic->getSliceGranularityForNDBFilter();
     606#endif
    560607  m_bUseNIF = ( pcPic->getIndependentSliceBoundaryForNDBFilter() || pcPic->getIndependentTileBoundaryForNDBFilter() );
    561608  if(m_bUseNIF)
     
    9581005          uiEdgeType = iSignDown + m_iUpBuff1[x] + 2;
    9591006          m_iUpBuff1[x]= -iSignDown;
    960 
    9611007          pRec[x] = m_pClipTable[pRec[x] + m_iOffsetEo[uiEdgeType]];
    9621008        }
     
    10651111Void TComSampleAdaptiveOffset::SAOProcess(TComPic* pcPic, SAOParam* pcSaoParam)
    10661112{
     1113#if LGE_SAO_MIGRATION_D0091
     1114  if (pcSaoParam->bSaoFlag[0] || pcSaoParam->bSaoFlag[1])
     1115#else
    10671116  if (pcSaoParam->bSaoFlag[0])
     1117#endif
    10681118  {
    10691119#if FULL_NBIT
     
    10771127      m_pcPic->getPicYuvRec()->copyToPic(m_pcYuvTmp);
    10781128    }
    1079 
     1129#if LGE_SAO_MIGRATION_D0091
     1130    if (m_saoLcuBasedOptimization)
     1131#else
    10801132    if (m_saoInterleavingFlag)
     1133#endif
    10811134    {
    10821135      pcSaoParam->oneUnitFlag[0] = 0; 
     
    10851138    }
    10861139    Int iY  = 0;
     1140#if LGE_SAO_MIGRATION_D0091
     1141    if (pcSaoParam->bSaoFlag[0])
     1142    {
     1143        processSaoUnitAll( pcSaoParam->saoLcuParam[iY], pcSaoParam->oneUnitFlag[iY], iY);
     1144    }
     1145    if(pcSaoParam->bSaoFlag[1])
     1146    {
     1147        processSaoUnitAll( pcSaoParam->saoLcuParam[1], pcSaoParam->oneUnitFlag[1], 1);//Cb
     1148        processSaoUnitAll( pcSaoParam->saoLcuParam[2], pcSaoParam->oneUnitFlag[2], 2);//Cr
     1149    }
     1150#else
    10871151    processSaoUnitAll( pcSaoParam->saoLcuParam[iY], pcSaoParam->oneUnitFlag[iY], iY);
    10881152
     
    10971161      processSaoUnitAll( pcSaoParam->saoLcuParam[iCr], pcSaoParam->oneUnitFlag[iCr], iCr);
    10981162    }
    1099 
    1100 
     1163#endif
    11011164    m_pcPic = NULL;
    11021165  }
     
    11541217  Int  typeIdx;
    11551218
     1219#if LGE_SAO_MIGRATION_D0091
     1220  Int offset[LUMA_GROUP_NUM+1];
     1221#else
    11561222  static Int offset[LUMA_GROUP_NUM+1];
     1223#endif
    11571224  Int idxX;
    11581225  Int idxY;
     
    11641231  Int isChroma = (yCbCr == 0) ? 0:1;
    11651232  Bool mergeLeftFlag;
    1166 
    1167 
     1233#if LGE_SAO_MIGRATION_D0091
     1234  offset[0] = 0;
     1235#endif
    11681236  for (idxY = 0; idxY< frameHeightInCU; idxY++)
    11691237  {
     
    12011269    {
    12021270      addr = idxY * frameWidthInCU + idxX;
    1203 
    12041271      if (oneUnitFlag)
    12051272      {
     
    12251292            for (i=0; i<saoLcuParam[addr].length; i++)
    12261293            {
     1294#if LGE_SAO_MIGRATION_D0091
     1295              offset[ (saoLcuParam[addr].subTypeIdx +i)%SAO_MAX_BO_CLASSES  +1] = saoLcuParam[addr].offset[i] << m_uiSaoBitIncrease;
     1296#else
    12271297              offset[ (saoLcuParam[addr].bandPosition +i)%SAO_MAX_BO_CLASSES  +1] = saoLcuParam[addr].offset[i] << m_uiSaoBitIncrease;
     1298#endif
    12281299            }
    12291300
     
    13041375      saoLcuParam[i].offset[j] = 0;
    13051376    }
     1377#if LGE_SAO_MIGRATION_D0091
     1378    saoLcuParam[i].subTypeIdx   = 0;
     1379#else
    13061380    saoLcuParam[i].bandPosition = 0;
     1381#endif
    13071382  }
    13081383}
     
    13531428      saoLcuParam[addr].partIdxTmp = (Int)partIdx;
    13541429      saoLcuParam[addr].typeIdx    = saoQTPart[partIdx].iBestType;
     1430#if LGE_SAO_MIGRATION_D0091
     1431      saoLcuParam[addr].subTypeIdx   = saoQTPart[partIdx].subTypeIdx;
     1432#else
    13551433      saoLcuParam[addr].bandPosition = saoQTPart[partIdx].bandPosition;
     1434#endif
    13561435      if (saoLcuParam[addr].typeIdx!=-1)
    13571436      {
     
    13651444      {
    13661445        saoLcuParam[addr].length    = 0;
     1446#if LGE_SAO_MIGRATION_D0091
     1447        saoLcuParam[addr].subTypeIdx = saoQTPart[partIdx].subTypeIdx;
     1448#else
    13671449        saoLcuParam[addr].bandPosition = saoQTPart[partIdx].bandPosition;
     1450#endif
    13681451        for (j=0;j<MAX_NUM_SAO_OFFSETS;j++)
    13691452        {
     
    13751458}
    13761459
    1377 
    1378 
     1460#if LGE_SAO_MIGRATION_D0091
     1461Void TComSampleAdaptiveOffset::resetSaoUnit(SaoLcuParam* saoUnit)
     1462{
     1463  saoUnit->partIdx       = 0;
     1464  saoUnit->partIdxTmp    = 0;
     1465  saoUnit->mergeLeftFlag = 0;
     1466  saoUnit->mergeUpFlag   = 0;
     1467  saoUnit->typeIdx       = -1;
     1468  saoUnit->length        = 0;
     1469  saoUnit->subTypeIdx    = 0;
     1470
     1471  for (Int i=0;i<4;i++)
     1472  {
     1473    saoUnit->offset[i] = 0;
     1474  }
     1475}
     1476
     1477Void TComSampleAdaptiveOffset::copySaoUnit(SaoLcuParam* saoUnitDst, SaoLcuParam* saoUnitSrc )
     1478{
     1479  saoUnitDst->mergeLeftFlag = saoUnitSrc->mergeLeftFlag;
     1480  saoUnitDst->mergeUpFlag   = saoUnitSrc->mergeUpFlag;
     1481  saoUnitDst->typeIdx       = saoUnitSrc->typeIdx;
     1482  saoUnitDst->length        = saoUnitSrc->length;
     1483
     1484  saoUnitDst->subTypeIdx  = saoUnitSrc->subTypeIdx;
     1485  for (Int i=0;i<4;i++)
     1486  {
     1487    saoUnitDst->offset[i] = saoUnitSrc->offset[i];
     1488  }
     1489}
     1490
     1491/** PCM LF disable process.
     1492 * \param pcPic picture (TComPic) pointer
     1493 * \returns Void
     1494 *
     1495 * \note Replace filtered sample values of PCM mode blocks with the transmitted and reconstructed ones.
     1496 */
     1497Void TComSampleAdaptiveOffset::PCMLFDisableProcess (TComPic* pcPic)
     1498{
     1499  xPCMRestoration(pcPic);
     1500}
     1501
     1502/** Picture-level PCM restoration.
     1503 * \param pcPic picture (TComPic) pointer
     1504 * \returns Void
     1505 */
     1506Void TComSampleAdaptiveOffset::xPCMRestoration(TComPic* pcPic)
     1507{
     1508  Bool  bPCMFilter = (pcPic->getSlice(0)->getSPS()->getUsePCM() && pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag())? true : false;
     1509#if LOSSLESS_CODING
     1510  if(bPCMFilter || pcPic->getSlice(0)->getSPS()->getUseLossless())
     1511#else
     1512  if(bPCMFilter)
     1513#endif
     1514  {
     1515      for( UInt uiCUAddr = 0; uiCUAddr < pcPic->getNumCUsInFrame() ; uiCUAddr++ )
     1516      {
     1517          TComDataCU* pcCU = pcPic->getCU(uiCUAddr);
     1518          xPCMCURestoration(pcCU, 0, 0);
     1519      }
     1520  }
     1521}
     1522
     1523/** PCM CU restoration.
     1524 * \param pcCU pointer to current CU
     1525 * \param uiAbsPartIdx part index
     1526 * \param uiDepth CU depth
     1527 * \returns Void
     1528 */
     1529Void TComSampleAdaptiveOffset::xPCMCURestoration ( TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth )
     1530{
     1531  TComPic* pcPic     = pcCU->getPic();
     1532  UInt uiCurNumParts = pcPic->getNumPartInCU() >> (uiDepth<<1);
     1533  UInt uiQNumParts   = uiCurNumParts>>2;
     1534
     1535  // go to sub-CU
     1536  if( pcCU->getDepth(uiAbsZorderIdx) > uiDepth )
     1537  {
     1538    for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++, uiAbsZorderIdx+=uiQNumParts )
     1539    {
     1540      UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ];
     1541      UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ];
     1542      if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
     1543        xPCMCURestoration( pcCU, uiAbsZorderIdx, uiDepth+1 );
     1544    }
     1545    return;
     1546  }
     1547
     1548  // restore PCM samples
     1549  if ((pcCU->getIPCMFlag(uiAbsZorderIdx)&& pcPic->getSlice(0)->getSPS()->getPCMFilterDisableFlag()) || pcCU->isLosslessCoded( uiAbsZorderIdx))
     1550  {
     1551    xPCMSampleRestoration (pcCU, uiAbsZorderIdx, uiDepth, TEXT_LUMA    );
     1552    xPCMSampleRestoration (pcCU, uiAbsZorderIdx, uiDepth, TEXT_CHROMA_U);
     1553    xPCMSampleRestoration (pcCU, uiAbsZorderIdx, uiDepth, TEXT_CHROMA_V);
     1554  }
     1555}
     1556
     1557/** PCM sample restoration.
     1558 * \param pcCU pointer to current CU
     1559 * \param uiAbsPartIdx part index
     1560 * \param uiDepth CU depth
     1561 * \param ttText texture component type
     1562 * \returns Void
     1563 */
     1564Void TComSampleAdaptiveOffset::xPCMSampleRestoration (TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, TextType ttText)
     1565{
     1566  TComPicYuv* pcPicYuvRec = pcCU->getPic()->getPicYuvRec();
     1567  Pel* piSrc;
     1568  Pel* piPcm;
     1569  UInt uiStride;
     1570  UInt uiWidth;
     1571  UInt uiHeight;
     1572  UInt uiPcmLeftShiftBit;
     1573  UInt uiX, uiY;
     1574  UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
     1575  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsZorderIdx;
     1576  UInt uiChromaOffset = uiLumaOffset>>2;
     1577
     1578  if( ttText == TEXT_LUMA )
     1579  {
     1580    piSrc = pcPicYuvRec->getLumaAddr( pcCU->getAddr(), uiAbsZorderIdx);
     1581    piPcm = pcCU->getPCMSampleY() + uiLumaOffset;
     1582    uiStride  = pcPicYuvRec->getStride();
     1583    uiWidth  = (g_uiMaxCUWidth >> uiDepth);
     1584    uiHeight = (g_uiMaxCUHeight >> uiDepth);
     1585    if ( pcCU->isLosslessCoded(uiAbsZorderIdx) )
     1586    {
     1587      uiPcmLeftShiftBit = 0;
     1588    }
     1589    else
     1590    {
     1591        uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
     1592    }
     1593  }
     1594  else
     1595  {
     1596    if( ttText == TEXT_CHROMA_U )
     1597    {
     1598      piSrc = pcPicYuvRec->getCbAddr( pcCU->getAddr(), uiAbsZorderIdx );
     1599      piPcm = pcCU->getPCMSampleCb() + uiChromaOffset;
     1600    }
     1601    else
     1602    {
     1603      piSrc = pcPicYuvRec->getCrAddr( pcCU->getAddr(), uiAbsZorderIdx );
     1604      piPcm = pcCU->getPCMSampleCr() + uiChromaOffset;
     1605    }
     1606
     1607    uiStride = pcPicYuvRec->getCStride();
     1608    uiWidth  = ((g_uiMaxCUWidth >> uiDepth)/2);
     1609    uiHeight = ((g_uiMaxCUWidth >> uiDepth)/2);
     1610    if ( pcCU->isLosslessCoded(uiAbsZorderIdx) )
     1611    {
     1612      uiPcmLeftShiftBit = 0;
     1613    }
     1614    else
     1615    {
     1616      uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
     1617    }
     1618  }
     1619
     1620  for( uiY = 0; uiY < uiHeight; uiY++ )
     1621  {
     1622    for( uiX = 0; uiX < uiWidth; uiX++ )
     1623    {
     1624      piSrc[uiX] = (piPcm[uiX] << uiPcmLeftShiftBit);
     1625    }
     1626    piPcm += uiWidth;
     1627    piSrc += uiStride;
     1628  }
     1629}
     1630#endif
    13791631//! \}
  • trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h

    r296 r443  
    6565
    6666  static UInt m_uiMaxDepth;
     67#if !LGE_SAO_MIGRATION_D0091
    6768  static const Int m_aiNumPartsInRow[5];
    6869  static const Int m_aiNumPartsLevel[5];
     70#endif
    6971  static const Int m_aiNumCulPartsLevel[5];
    7072  static const UInt m_auiEoTable[9];
     73#if !LGE_SAO_MIGRATION_D0091
    7174  static const UInt m_auiEoTable2D[9];
    7275  static const UInt m_iWeightSao[MAX_NUM_SAO_TYPE];
     76#endif
    7377  Int *m_iOffsetBo;
    7478  Int m_iOffsetEo[LUMA_GROUP_NUM];
     
    107111  Int* m_iLcuPartIdx;
    108112  Int     m_maxNumOffsetsPerPic;
     113#if LGE_SAO_MIGRATION_D0091
     114  Bool    m_saoLcuBoundary;
     115  Bool    m_saoLcuBasedOptimization;
     116
     117  Void xPCMRestoration        (TComPic* pcPic);
     118  Void xPCMCURestoration      (TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth);
     119  Void xPCMSampleRestoration  (TComDataCU* pcCU, UInt uiAbsZorderIdx, UInt uiDepth, TextType ttText);
     120#else
    109121  Bool    m_saoInterleavingFlag;
     122#endif
    110123public:
    111124  TComSampleAdaptiveOffset         ();
     
    116129
    117130  Int  convertLevelRowCol2Idx(int level, int row, int col);
     131#if !LGE_SAO_MIGRATION_D0091
    118132  void convertIdx2LevelRowCol(int idx, int *level, int *row, int *col);
     133#endif
    119134
    120135  Void initSAOParam   (SAOParam *pcSaoParam, Int iPartLevel, Int iPartRow, Int iPartCol, Int iParentPartIdx, Int StartCUX, Int EndCUX, Int StartCUY, Int EndCUY, Int iYCbCr);
    121136  Void allocSaoParam  (SAOParam* pcSaoParam);
    122137  Void resetSAOParam  (SAOParam *pcSaoParam);
     138#if LGE_SAO_MIGRATION_D0091
     139  static Void freeSaoParam   (SAOParam *pcSaoParam);
     140#else
    123141  Void freeSaoParam   (SAOParam *pcSaoParam);
     142#endif
     143 
    124144
    125145  Void SAOProcess(TComPic* pcPic, SAOParam* pcSaoParam);
    126146  Void processSaoCu(Int iAddr, Int iSaoType, Int iYCbCr);
     147#if !LGE_SAO_MIGRATION_D0091
    127148  Void processSaoOnePart(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr);
    128149  Void processSaoQuadTree(SAOQTPart *psQTPart, UInt uiPartIdx, Int iYCbCr);
     150#endif
    129151  Pel* getPicYuvAddr(TComPicYuv* pcPicYuv, Int iYCbCr,Int iAddr = 0);
    130152
     
    138160  Void convertOnePart2SaoUnit(SAOParam *saoParam, UInt partIdx, Int yCbCr);
    139161  Void processSaoUnitAll(SaoLcuParam* saoLcuParam, Bool oneUnitFlag, Int yCbCr);
     162#if LGE_SAO_MIGRATION_D0091
     163  Void setSaoLcuBoundary (Bool bVal)  {m_saoLcuBoundary = bVal;}
     164  Bool getSaoLcuBoundary ()           {return m_saoLcuBoundary;}
     165  Void setSaoLcuBasedOptimization (Bool bVal)  {m_saoLcuBasedOptimization = bVal;}
     166  Bool getSaoLcuBasedOptimization ()           {return m_saoLcuBasedOptimization;}
     167  Void resetSaoUnit(SaoLcuParam* saoUnit);
     168  Void copySaoUnit(SaoLcuParam* saoUnitDst, SaoLcuParam* saoUnitSrc );
     169  Void PCMLFDisableProcess    ( TComPic* pcPic);                        ///< interface function for ALF process
     170#else
    140171  Void setSaoInterleavingFlag (Bool bVal)  {m_saoInterleavingFlag = bVal;}
    141172  Bool getSaoInterleavingFlag ()           {return m_saoInterleavingFlag;}
     173#endif
    142174};
    143175
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r332 r443  
    113113#if LGE_ILLUCOMP_B0045
    114114, m_bApplyIC                      ( false )
     115#if SHARP_ILLUCOMP_PARSE_D0060
     116, m_icSkipParseFlag               ( false )
     117#endif
    115118#endif
    116119#if INTER_VIEW_VECTOR_SCALING_C0115
     
    119122#endif
    120123{
     124#if MERL_VSP_NBDV_RefVId_Fix_D0166
     125  for(Int iNumCount = 0; iNumCount < MAX_VIEW_NUM; iNumCount++)
     126    m_pcListDepthPic[iNumCount] =NULL;
     127#endif
    121128  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
    122129
     
    818825
    819826  m_saoEnabledFlag = pSrc->m_saoEnabledFlag;
     827#if LGE_SAO_MIGRATION_D0091
     828  m_saoEnabledFlagChroma = pSrc->m_saoEnabledFlagChroma;
     829#else
    820830  m_saoInterleavingFlag = pSrc->m_saoInterleavingFlag;
    821831  m_saoEnabledFlagCb = pSrc->m_saoEnabledFlagCb;
    822832  m_saoEnabledFlagCr = pSrc->m_saoEnabledFlagCr;
     833#endif
    823834#if CABAC_INIT_FLAG
    824835  m_cabacInitFlag                = pSrc->m_cabacInitFlag;
     
    827838
    828839  m_bLMvdL1Zero = pSrc->m_bLMvdL1Zero;
     840#if SHARP_ILLUCOMP_PARSE_D0060
     841  m_bApplyIC = pSrc->m_bApplyIC;
     842  m_icSkipParseFlag = pSrc->m_icSkipParseFlag;
     843#endif
    829844}
    830845
     
    13871402#endif
    13881403
     1404#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1405TComPic* TComSlice::getDepthRefPic(Int viewId, Int poc)
     1406{
     1407  TComPic* pPic = NULL;
     1408
     1409  if (m_pcListDepthPic[viewId] == NULL)
     1410    return NULL;
     1411
     1412  for( TComList<TComPic*>::iterator it = m_pcListDepthPic[viewId]->begin(); it != m_pcListDepthPic[viewId]->end(); it++ )
     1413  {
     1414    TComPic* currPic = *it;
     1415    TComSlice* currSlice = currPic->getCurrSlice();
     1416    Bool isDepth = currSlice->getIsDepth();
     1417    //assert(isDepth);
     1418    if( isDepth && currPic->getPOC() == poc && currPic->getViewId() == viewId ) // (*it)->getSPS()->isDepth()
     1419    {
     1420      pPic = *it;
     1421      break;
     1422    }
     1423  }
     1424
     1425  return pPic;
     1426}
     1427#endif
     1428
     1429
     1430#if QC_ARP_D0177
     1431Void TComSlice::setARPStepNum()                                 
     1432{
     1433  Bool bAllIvRef = false;
     1434  if(!getSPS()->getUseAdvRP())
     1435    m_nARPStepNum = 0;
     1436  else
     1437  {
     1438    for( Int iRefListId = 0; iRefListId < 2; iRefListId++ )
     1439    {
     1440      RefPicList  eRefPicList = RefPicList( iRefListId );
     1441      Int iNumRefIdx = getNumRefIdx(eRefPicList);
     1442      if( iNumRefIdx <= 0 )
     1443        continue;
     1444      for (Int i = 0; i < iNumRefIdx; i++)
     1445      {
     1446        if(getRefPic( REF_PIC_LIST_0, i)->getPOC() != getPOC())
     1447        {
     1448          bAllIvRef = true;
     1449          break;
     1450        }
     1451      }
     1452      if( bAllIvRef == true )
     1453        break;
     1454    }
     1455    if(bAllIvRef== true)
     1456      m_nARPStepNum = getSPS()->getARPStepNum();
     1457    else
     1458      m_nARPStepNum = 0;
     1459  }
     1460}
     1461#endif
    13891462// ------------------------------------------------------------------------------------------------
    13901463// Video parameter set (VPS)
     
    15761649  m_uiMultiviewMvPredMode    = 0;
    15771650#endif
    1578 
     1651#if QC_ARP_D0177
     1652  m_nUseAdvResPred           = 0;
     1653  m_nARPStepNum              = 1;
     1654#endif
    15791655  ::memset( m_aiUsableInterViewRefs, 0, sizeof( m_aiUsableInterViewRefs ) );
    15801656 
     
    20442120  m_scalingList = src.m_scalingList;
    20452121  m_scalingListEnabled = src.m_scalingListEnabled;
     2122#if !LGE_SAO_MIGRATION_D0091
    20462123  m_saoInterleavingFlag = src.m_saoInterleavingFlag;
     2124#endif
    20472125
    20482126  return *this;
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r332 r443  
    5454class TComDepthMapGenerator;
    5555#endif
    56 #if H3D_IVRP
     56#if H3D_IVRP & !QC_ARP_D0177
    5757class TComResidualGenerator;
    5858#endif
     
    180180  Bool          m_bIVScalingFlag;
    181181#endif
     182
     183#if MTK_D0156
     184#if MERL_VSP_COMPENSATION_C0152
     185  Bool      m_abUseVSPCompensation[ MAX_TLAYER ];
     186#endif
     187  Bool      m_abUseDVPRefine[ MAX_TLAYER ];
     188#endif
     189
    182190public:
    183191  TComVPS();
     
    245253 
    246254#endif
     255
     256#if MTK_D0156
     257#if MERL_VSP_COMPENSATION_C0152
     258  Bool    getUseVSPCompensation( UInt tLayer ){  return m_abUseVSPCompensation[ tLayer ];}
     259  Void    setUseVSPCompensation( Bool bValue, UInt tLayer ){ m_abUseVSPCompensation[ tLayer ] = bValue;}
     260#endif
     261  Bool    getUseDVPRefine( UInt tLayer ){  return m_abUseDVPRefine[ tLayer ];}
     262  Void    setUseDVPRefine( Bool bValue, UInt tLayer ){ m_abUseDVPRefine[ tLayer ] = bValue;}
     263#endif
    247264};
    248265
     
    390407#endif
    391408#if H3D_IVRP
     409#if QC_ARP_D0177
     410  UInt         m_nUseAdvResPred;
     411  UInt         m_nARPStepNum;
     412#else
    392413  UInt  m_uiMultiviewResPredMode;
     414#endif
    393415#endif
    394416
     
    396418  TComDepthMapGenerator* m_pcDepthMapGenerator;
    397419#endif
    398 #if H3D_IVRP
     420#if H3D_IVRP & !QC_ARP_D0177
    399421  TComResidualGenerator* m_pcResidualGenerator;
     422#endif
     423
     424#if MTK_D0156
     425#if MERL_VSP_COMPENSATION_C0152
     426  Bool      m_bUseVSPCompensation;
     427#endif
     428  Bool      m_bUseDVPRefine;
    400429#endif
    401430
     
    643672  Void setPredDepthMapGeneration( UInt uiViewId, Bool bIsDepth, UInt uiPdmGenMode = 0, UInt uiPdmMvPredMode = 0, UInt uiPdmPrec = 0, Int** aaiPdmScaleNomDelta = 0, Int** aaiPdmOffset = 0 );
    644673#endif
    645 #if H3D_IVRP
     674#if H3D_IVRP & !QC_ARP_D0177
    646675  Void  setMultiviewResPredMode  ( UInt uiResPrdMode ) { m_uiMultiviewResPredMode = uiResPrdMode; }
    647676#endif
     
    658687#endif
    659688#if H3D_IVRP
     689#if QC_ARP_D0177
     690  UInt  getUseAdvRP()              { return m_nUseAdvResPred;   }
     691  Void  setUseAdvRP(UInt n)        { m_nUseAdvResPred = n;      }
     692  UInt  getARPStepNum()            { return m_nARPStepNum;      }
     693  Void  setARPStepNum(UInt n)      { m_nARPStepNum = n;         }
     694#else
    660695  UInt  getMultiviewResPredMode  ()          { return m_uiMultiviewResPredMode;   }
     696#endif
    661697#endif
    662698
     
    665701  TComDepthMapGenerator*  getDepthMapGenerator()                                              { return m_pcDepthMapGenerator; }
    666702#endif
    667 #if H3D_IVRP
     703#if H3D_IVRP & !QC_ARP_D0177
    668704  Void                    setResidualGenerator( TComResidualGenerator* pcResidualGenerator )  { m_pcResidualGenerator = pcResidualGenerator; }
    669705  TComResidualGenerator*  getResidualGenerator()                                              { return m_pcResidualGenerator; }
     706#endif
     707
     708#if MTK_D0156
     709
     710#if MERL_VSP_COMPENSATION_C0152
     711  Bool    getUseVSPCompensation( ){  return m_bUseVSPCompensation;}
     712  Void    setUseVSPCompensation( Bool bValue ){ m_bUseVSPCompensation = bValue;}
     713#endif
     714
     715  Bool    getUseDVPRefine( ){  return m_bUseDVPRefine;}
     716  Void    setUseDVPRefine( Bool bValue ){ m_bUseDVPRefine = bValue;}
     717
    670718#endif
    671719};
     
    928976  Bool      getScalingListEnabled ()          { return m_scalingListEnabled; }  //!< get ScalingList enabled/disabled in APS
    929977  TComScalingList* getScalingList ()          { return m_scalingList; }         //!< get ScalingList class pointer in APS
     978#if !LGE_SAO_MIGRATION_D0091
    930979  Bool     getSaoInterleavingFlag() {return m_saoInterleavingFlag;}             //!< get SAO interleaving flag in APS
    931980  Void     setSaoInterleavingFlag(Bool bVal) {m_saoInterleavingFlag = bVal;}    //!< set SAO interleaving flag in APS
     981#endif
    932982
    933983private:
     
    943993  Bool        m_scalingListEnabled;     //!< ScalingList enabled/disabled in APS (true for enabled)
    944994  TComScalingList*     m_scalingList;   //!< ScalingList class pointer
     995#if !LGE_SAO_MIGRATION_D0091
    945996  Bool        m_saoInterleavingFlag;    //!< SAO interleaving flag
     997#endif
    946998
    947999public:
     
    9751027  bool       m_alfEnabledFlag;
    9761028  bool       m_saoEnabledFlag;
     1029#if LGE_SAO_MIGRATION_D0091
     1030  bool       m_saoEnabledFlagChroma;      ///< SAO Cb&Cr enabled flag
     1031#else
    9771032  bool       m_saoInterleavingFlag;   ///< SAO interleaving flag
    9781033  bool       m_saoEnabledFlagCb;      ///< SAO Cb enabled flag
    9791034  bool       m_saoEnabledFlagCr;      ///< SAO Cr enabled flag
     1035#endif
    9801036  Int         m_iPPSId;               ///< picture parameter set ID
    9811037  Bool        m_PicOutputFlag;        ///< pic_output_flag
     
    11061162#if LGE_ILLUCOMP_B0045
    11071163  Bool        m_bApplyIC;
     1164#if SHARP_ILLUCOMP_PARSE_D0060
     1165  Bool        m_icSkipParseFlag;
     1166#endif
     1167#endif
     1168#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1169  TComList<TComPic*>*  m_pcListDepthPic[MAX_VIEW_NUM]; // For encoder, the list may also include texture pictures. Three views with ViewIdx = 0, 1, 2
     1170#endif
     1171#if QC_ARP_D0177
     1172  TComList<TComPic*> * m_pBaseViewRefPicList[MAX_VIEW_NUM];
     1173  UInt                 m_nARPStepNum;
    11081174#endif
    11091175#if INTER_VIEW_VECTOR_SCALING_C0115|QC_MVHEVC_B0046
     
    11151181  TComPic*     m_apcRefPicBaseTxt;
    11161182  TComPic*     m_apcRefPicBaseDepth;
     1183#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1184  Int*         m_aiShiftLUT[2]; // For reference views
     1185#else
    11171186  Int*         m_aiShiftLUT;
     1187#endif
    11181188  Int          m_iShiftPrec;
    11191189#endif
     
    11581228  Void      setSaoEnabledFlag(Bool s) {m_saoEnabledFlag =s; }
    11591229  Bool      getSaoEnabledFlag() { return m_saoEnabledFlag; }
     1230#if LGE_SAO_MIGRATION_D0091
     1231  Void      setSaoEnabledFlagChroma(Bool s) {m_saoEnabledFlagChroma =s; }       //!< set SAO Cb&Cr enabled flag
     1232  Bool      getSaoEnabledFlagChroma() { return m_saoEnabledFlagChroma; }        //!< get SAO Cb&Cr enabled flag
     1233#else
    11601234  Void      setSaoInterleavingFlag(Bool s) {m_saoInterleavingFlag =s; } //!< set SAO interleaving flag
    11611235  Bool      getSaoInterleavingFlag() { return m_saoInterleavingFlag;  } //!< get SAO interleaving flag
     
    11641238  Void      setSaoEnabledFlagCr(Bool s) {m_saoEnabledFlagCr =s; }       //!< set SAO Cr enabled flag
    11651239  Bool      getSaoEnabledFlagCr() { return m_saoEnabledFlagCr; }        //!< get SAO Cr enabled flag
     1240#endif
    11661241  Void      setRPS          ( TComReferencePictureSet *pcRPS ) { m_pcRPS = pcRPS; }
    11671242  TComReferencePictureSet*  getRPS          () { return m_pcRPS; }
     
    12531328  Void      setRefPicListMvc    ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& rapcInterViewRefPics );
    12541329  Void      setRefPOCnViewListsMvc();
    1255 
     1330#if QC_ARP_D0177
     1331  Void      setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx )      { m_pBaseViewRefPicList[iViewIdx] = pListPic; }
     1332  TComPic*  getBaseViewRefPic    ( UInt uiPOC , Int iViewIdx )                       { return xGetRefPic( *m_pBaseViewRefPicList[iViewIdx], uiPOC ); }
     1333  Void      setARPStepNum();                                 
     1334  UInt      getARPStepNum( )                                      { return m_nARPStepNum;      } 
     1335#endif
    12561336  Void      setColDir           ( UInt uiDir ) { m_uiColDir = uiDir; }
    12571337#if COLLOCATED_REF_IDX
     
    14011481  Bool      getApplyIC            ()  { return m_bApplyIC; }
    14021482  Void      xSetApplyIC           ();
     1483#if SHARP_ILLUCOMP_PARSE_D0060
     1484  Void      setIcSkipParseFlag( Bool b ) { m_icSkipParseFlag = b; }
     1485  Bool      getIcSkipParseFlag() { return m_icSkipParseFlag; }
     1486#endif
    14031487#endif
    14041488#if QC_TMVP_MRG_REFIDX_C0047
     
    14181502  TComPic*     getRefPicBaseDepth        ()                        { return  m_apcRefPicBaseDepth; }
    14191503  Void         setRefPicBaseDepth        ( TComPic* RefPic)        { m_apcRefPicBaseDepth = RefPic; }
    1420 
     1504#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1505  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec, Int iNeighborViewId) { m_aiShiftLUT[iNeighborViewId] = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
     1506  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec, Int iNeighborViewId) { pShiftLUT = m_aiShiftLUT[iNeighborViewId]; iLoG2LUTPrec = m_iShiftPrec; }
     1507#else
    14211508  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
    14221509  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; }
     1510#endif
     1511#endif
     1512
     1513#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1514  Void setListDepthPic( TComList<TComPic*>* pListDepthPic, Int viewId) { m_pcListDepthPic[viewId] = pListDepthPic; }
     1515  TComList<TComPic*>* getListDepthPic(Int viewId) { return m_pcListDepthPic[viewId]; }
     1516  TComPic*            getDepthRefPic(Int viewId, Int poc);
     1517  TComPic*            getDepthRefPic(Int refIdx);
    14231518#endif
    14241519
  • trunk/source/Lib/TLibCommon/TComWedgelet.cpp

    r296 r443  
    783783  Int deltax = x1 - x0;
    784784  Int deltay = abs(y1 - y0);
     785#if FIX_WEDGE_NOFLOAT_D0036
     786  Int error = 0;
     787  Int deltaerr = (deltay<<1);
     788#else
    785789  double error = 0.0;
    786790  double deltaerr = (double)deltay / (double)deltax;
     791#endif
    787792
    788793  Int ystep;
     
    797802
    798803    error += deltaerr;
     804#if FIX_WEDGE_NOFLOAT_D0036
     805    if( error >= deltax )
     806#else
    799807    if( error >= 0.5)
     808#endif   
    800809    {
    801810      y += ystep;
     811#if FIX_WEDGE_NOFLOAT_D0036
     812      error = error - (deltax<<1);
     813#else
    802814      error = error - 1.0;
     815#endif   
    803816    }
    804817  }
  • trunk/source/Lib/TLibCommon/TComYuv.cpp

    r332 r443  
    741741  }
    742742}
     743#if QC_ARP_D0177
     744Void TComYuv::addARP(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
     745{
     746  addARPLuma   ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth   , uiHeight    , bClip );
     747  addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip );
     748}
     749
     750Void TComYuv::addARPLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
     751{
     752  Int x, y;
     753
     754  Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );
     755  Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );
     756  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
     757
     758  UInt iSrc0Stride = pcYuvSrc0->getStride();
     759  UInt iSrc1Stride = pcYuvSrc1->getStride();
     760  UInt iDstStride  = getStride();
     761  for ( y = uiHeight-1; y >= 0; y-- )
     762  {
     763    for ( x = uiWidth-1; x >= 0; x-- )
     764    {
     765      pDst[x] = pSrc0[x] + pSrc1[x];
     766      if( bClip )
     767        pDst[x] = Clip( pDst[x] );
     768    }
     769    pSrc0 += iSrc0Stride;
     770    pSrc1 += iSrc1Stride;
     771    pDst  += iDstStride;
     772  }
     773}
     774
     775Void TComYuv::addARPChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip )
     776{
     777  Int x, y;
     778
     779  Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );
     780  Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );
     781  Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );
     782  Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );
     783  Pel* pDstU = getCbAddr( uiAbsPartIdx );
     784  Pel* pDstV = getCrAddr( uiAbsPartIdx );
     785
     786  UInt  iSrc0Stride = pcYuvSrc0->getCStride();
     787  UInt  iSrc1Stride = pcYuvSrc1->getCStride();
     788  UInt  iDstStride  = getCStride();
     789  for ( y = uiHeight-1; y >= 0; y-- )
     790  {
     791    for ( x = uiWidth-1; x >= 0; x-- )
     792    {
     793      pDstU[x] = pSrcU0[x] + pSrcU1[x];
     794      pDstV[x] = pSrcV0[x] + pSrcV1[x];
     795      if( bClip )
     796      {
     797        pDstU[x] = Clip( pDstU[x] );
     798        pDstV[x] = Clip( pDstV[x] );
     799      }
     800    }
     801
     802    pSrcU0 += iSrc0Stride;
     803    pSrcU1 += iSrc1Stride;
     804    pSrcV0 += iSrc0Stride;
     805    pSrcV1 += iSrc1Stride;
     806    pDstU  += iDstStride;
     807    pDstV  += iDstStride;
     808  }
     809}
     810
     811Void TComYuv::subtractARP(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
     812{
     813  subtractARPLuma  ( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth    , uiHeight    );
     814  subtractARPChroma( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );
     815}
     816
     817Void TComYuv::subtractARPLuma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
     818{
     819  Int x, y;
     820
     821  Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );
     822  Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );
     823  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
     824
     825  Int  iSrc0Stride = pcYuvSrc0->getStride();
     826  Int  iSrc1Stride = pcYuvSrc1->getStride();
     827  Int  iDstStride  = getStride();
     828  for ( y = uiHeight-1; y >= 0; y-- )
     829  {
     830    for ( x = uiWidth-1; x >= 0; x-- )
     831    {
     832      pDst[x] = pSrc0[x] - pSrc1[x];
     833    }
     834    pSrc0 += iSrc0Stride;
     835    pSrc1 += iSrc1Stride;
     836    pDst  += iDstStride;
     837  }
     838}
     839
     840Void TComYuv::subtractARPChroma(TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight)
     841{
     842  Int x, y;
     843
     844  Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );
     845  Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );
     846  Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );
     847  Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );
     848  Pel* pDstU  = getCbAddr( uiAbsPartIdx );
     849  Pel* pDstV  = getCrAddr( uiAbsPartIdx );
     850
     851  Int  iSrc0Stride = pcYuvSrc0->getCStride();
     852  Int  iSrc1Stride = pcYuvSrc1->getCStride();
     853  Int  iDstStride  = getCStride();
     854  for ( y = uiHeight-1; y >= 0; y-- )
     855  {
     856    for ( x = uiWidth-1; x >= 0; x-- )
     857    {
     858      pDstU[x] = pSrcU0[x] - pSrcU1[x];
     859      pDstV[x] = pSrcV0[x] - pSrcV1[x];
     860    }
     861    pSrcU0 += iSrc0Stride;
     862    pSrcU1 += iSrc1Stride;
     863    pSrcV0 += iSrc0Stride;
     864    pSrcV1 += iSrc1Stride;
     865    pDstU  += iDstStride;
     866    pDstV  += iDstStride;
     867  }
     868}
     869
     870Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
     871{
     872  multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW );
     873  multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW );
     874}
     875
     876Void TComYuv::xxMultiplyLine( Pel * pSrcDst , UInt uiWidth , UChar dW )
     877{
     878  assert( dW == 2 );
     879  for( UInt x = 0 ; x < uiWidth ; x++ )
     880    pSrcDst[x] =  pSrcDst[x] >> 1;
     881}
     882
     883Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
     884{
     885  Pel* pDst  = getLumaAddr( uiAbsPartIdx );
     886  Int  iDstStride  = getStride();
     887  for ( Int y = uiHeight-1; y >= 0; y-- )
     888  {
     889    xxMultiplyLine( pDst , uiWidth , dW );
     890    pDst  += iDstStride;
     891  }
     892}
     893
     894Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
     895{
     896  Pel* pDstU  = getCbAddr( uiAbsPartIdx );
     897  Pel* pDstV  = getCrAddr( uiAbsPartIdx );
     898
     899  Int  iDstStride  = getCStride();
     900  for ( Int y = uiHeight-1; y >= 0; y-- )
     901  {
     902    xxMultiplyLine( pDstU , uiWidth , dW );
     903    xxMultiplyLine( pDstV , uiWidth , dW );
     904    pDstU  += iDstStride;
     905    pDstV  += iDstStride;
     906  }
     907}
     908#endif
    743909//! \}
  • trunk/source/Lib/TLibCommon/TComYuv.h

    r332 r443  
    199199
    200200  __inline Pel  xClip  (Pel x )      { return ( (x < 0) ? 0 : (x > (Pel)g_uiIBDI_MAX) ? (Pel)g_uiIBDI_MAX : x ); }
     201#if QC_ARP_D0177
     202  Void    addARP           ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
     203  Void    addARPLuma       ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
     204  Void    addARPChroma     ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
     205  Void    subtractARP      ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );
     206  Void    subtractARPLuma  ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );
     207  Void    subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );
     208  Void    multiplyARP      ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );
     209  Void    multiplyARPLuma  ( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );
     210  Void    multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW );
     211private:
     212  Void    xxMultiplyLine( Pel * pSrcDst , UInt uiWidth , UChar dW );
     213#endif
    201214};// END CLASS DEFINITION TComYuv
    202215
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r332 r443  
    5959                                              // HHI_DMM_DELTADC_Q1_C0034   JCT3V-C0034: no quantization and fast encoder search for DMM delta DC values
    6060                                              // FIX_DMM_CTX_INIT_C0034 JCT3V-C0034 fix for wrong init type of DMM contexts (UChar instead of Short)
     61#define FIX_WEDGE_NOFLOAT_D0036           1   // JCT3V-D0036: Fix for aligning SW and spec (Wedgelet segmentation line generation without float)
    6162
    6263#define LGE_EDGE_INTRA_A0070              1   // JCT3V-A0070
    6364#define LGE_DMM3_SIMP_C0044               1
     65
     66#define QC_DC_PREDICTOR_D0183             1   // JCT3V-D0183: Simplified DC predictor for depth intra modes
    6467
    6568///// ***** SDC *********
     
    6770                                              // SAIT_SDC_C0096 JCT3V-C0096: Improved Simple Depth Coding(removal of DMM2 among four SDC modes(DC, Planar, DMM1 and DMM2))
    6871                                              // FIX_SDC_ENC_C0143, JCT3V-C0143 fix for unnecessary encoder checks in case of SDC
    69 
     72#if RWTH_SDC_DLT_B0036
     73#define HHI_DELTADC_DLT_D0035             1   // JCT3V-D0035: DLT for DMM deltaDC coding
     74#define INTEL_SDC64_D0193                 1   // JCT3V-D0193: SDC binary clean up (use a 1 bit binary code to signal sdc_pred_mode when CU size is 64x64)
     75#define RWTH_SDC_CTX_SIMPL_D0032          1   // JCT3V-D0032: CABAC Context Reduction for Simplified Depth Coding
     76#define LGE_CONCATENATE_D0141                 1 // JCT3V-D0141: concatenate binarization for residual index coding
     77#endif
     78#define FIX_SDC_ENC_RD_WVSO_D0163         1   // JCT3V-D0163: fix for SDC encoder rd-cost (VSO -> WVSO)
     79
     80#define PKU_QC_DEPTH_INTRA_UNI_D0195      1   // JCT3V-D0195: unified syntax table for depth intra coding tools
     81#define MTK_SAMPLE_BASED_SDC_D0110        1   // JCT3V-D0110: sample based SDC
    7082///// ***** TMVP/AMVP *********
    7183#define TMVP_DEPTH_SWITCH                 1   // JCT3V-B0092 additional encoder option only
     
    8496                                              // QC_C0051_FIXED_BY_MTK             1   // Bug fix for C0051 implementation
    8597                                              // QC_AMVP_MRG_UNIFY_IVCAN_C0051     1
     98#define SEC_TWO_CANDIDATES_FOR_AMVP_D0122 1   // SEC_TWO_CANDIDATES_FOR_AMVP_D0122, fixing # of AMVP candidates 3 to 2
    8699
    87100
     
    95108                                              // FIX_LG_RESTRICTEDRESPRED_M24766   1
    96109
     110#define QC_ARP_D0177            1             ////< advanced residual prediction
     111#if QC_ARP_D0177
     112#define QC_ARP_WFNR                       3
     113#define QC_ARP_WARNING_FIX                1   // Fix warning message for ARP
     114#endif
    97115///// ***** DISPARITY VECTOR DERIVATION *********
    98116#define H3D_NBDV                          1   // Neighboring block disparity derivation
     
    111129                                              // MTK_SIMPLIFY_DVTC_C0135           
    112130                                              // FIX_CHROMA_RESIDUAL_C0129         
     131#define QC_CU_NBDV_D0181                  1
     132
     133#define SEC_DEFAULT_DV_D0112              1
    113134
    114135///// ***** MOTION PARAMETER INHERITANCE  *********
     
    143164#endif
    144165
     166#define SHARP_ILLUCOMP_PARSE_D0060        1   // JCT3V-D0060 Removal of IC's parsing dependency
     167
    145168///// ***** INTERVIEW SKIP *********
    146169#define HHI_INTERVIEW_SKIP                1
     
    159182#define FIX_APPENCTOP_T_ONLY              1   // For Texture-only coding
    160183
     184#define LGE_ROUND_OFFSET_D0135            1   // JCT3V-D0135 Rounding offset
     185#define LGE_SAO_MIGRATION_D0091           1
     186#if LGE_SAO_MIGRATION_D0091
     187#define SAO_SKIP_RIGHT                   1  ///< H1101: disallow using unavailable pixel during RDO
     188#define SAO_ENCODING_CHOICE              1  ///< I0184: picture early termination
     189#if SAO_ENCODING_CHOICE
     190#define SAO_ENCODING_RATE                0.75
     191#define SAO_ENCODING_CHOICE_CHROMA       1 ///< J0044: picture early termination Luma and Chroma are handled separatenly
     192#if SAO_ENCODING_CHOICE_CHROMA
     193#define SAO_ENCODING_RATE_CHROMA         0.5
     194#define SAO_ENCODING_CHOICE_CHROMA_BF    1 ///  K0156: Bug fix for SAO selection consistency
     195#endif
     196#endif
     197#endif
     198
    161199///// ***** FCO  *********
    162200#define FLEX_CODING_ORDER_M23723          1
     
    174212
    175213///// ***** VSP *********
    176 #define MERL_VSP_C0152                    1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
    177                                             // LGE_SIMP_DVP_REFINE_C0112           
    178                                             // MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     214#define MERL_VSP_C0152                       1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
     215                                               // LGE_SIMP_DVP_REFINE_C0112
     216                                               // MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    179217#if MERL_VSP_C0152
    180 #define MERL_VSP_C0152_BugFix_ForNoDepthCase     1// MERL bugfix for test condition of no depth
    181 /*
    182  * Two macros are used to configure combinations of JCT3V-C0152 and JCT3V-C0131
    183  *
    184  *   a) (full) A full JCT3V-C0152 implementation, including JCT3V-C0131
    185  *      #define MERL_VSP_COMPENSATION_C0152          1
    186  *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1
    187  *
    188  *   b) (mvp2off) For partial JCT3V-C0152 excluding overlaps from JCT3V-C0131
    189  *      #define MERL_VSP_COMPENSATION_C0152          1
    190  *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  0
    191  *
    192  *   c) (nocand) For JCT3V-C0131 only
    193  *      #define MERL_VSP_COMPENSATION_C0152          0
    194  *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1
    195  */
    196 
    197 #define MERL_VSP_COMPENSATION_C0152          1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add   (nocand).
    198 
     218
     219
     220#define FIX_MERGE_D                          1 // Fix to compile merged version
     221
     222
     223#define MERL_General_Fix                     1// General fix by MERL
     224#define MERL_VSP_C0152_BugFix_ForNoDepthCase 1 // MERL bugfix for test condition of no depth
     225#define QC_BVSP_CleanUP_D0191                    1
     226
     227#define MTK_D0156                 1
     228#define LGE_VSP_INHERIT_D0092     1
     229
     230#define MERL_VSP_COMPENSATION_C0152          1 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add (nocand).
    199231
    200232#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
     233#if MERL_VSP_BLOCKSIZE_C0152 == 1
     234#define MERL_CVSP_D0165                      1 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP.
     235#else
     236#define MERL_CVSP_D0165                      0 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP.
     237#endif
     238#if LGE_VSP_INHERIT_D0092
     239#define VSP_MERGE_POS                        3 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 3.
     240#else
    201241#define VSP_MERGE_POS                        5 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 5.
    202                                                //MTK_DVPREFINE_BVSP_BUG_FIX               1
     242#endif                                               // MTK_DVPREFINE_BVSP_BUG_FIX               1
     243#define MTK_DEPTH_TO_DISP_D0138              1 // JCT3V-D0138: Use max among four corners for DoNBDV and BVSP
     244
     245#if MERL_General_Fix
     246#define MTK_LGE_VSP_DEPTH_OFF_D0105_D0139    1 // JCT3V-D0105/JCT3V-D0139: disable VSP for depth map
     247#define MTK_VSP_USING_NBDV_D0105             1 // JCT3V-D0105: use NBDV instead of DoNBDV for BVSP
     248#endif
     249
     250#if MERL_General_Fix
     251#define MERL_VSP_NBDV_RefVId_Fix_D0166       1 // JCT3V-D0166: 1: fix the NBDV with ref view selectioin; 0: always use base view with refViewIdx=0
     252#else
     253#define MERL_VSP_NBDV_RefVId_Fix_D0166       0
     254#endif
     255
     256#if MERL_VSP_NBDV_RefVId_Fix_D0166
     257#define MERL_Bi_VSP_D0166                    1 // JCT3V-D0166: 1: add supporting for Bi-VSP, the code under the macro can also handle uni-direction VSP
     258#else
     259#define MERL_Bi_VSP_D0166                    0
     260#endif
    203261
    204262#else // !MERL_VSP_C0152
    205263#define MERL_VSP_COMPENSATION_C0152          0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add
    206264#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
    207 #endif
    208 
     265#define MERL_VSP_C0152_BugFix_ForNoDepthCase 0 // MERL bugfix for test condition of no depth
     266#define MERL_CVSP_D0165                      0 // JCT3V-D0165: 1: enable CVSP; 0: disable CVSP.
     267#define MERL_VSP_NBDV_RefVId_Fix_D0166       0 // JCT3V-D0166: 1: fix the NBDV with ref view selectioin; 0: always use base view with refViewIdx=0
     268#define MERL_Bi_VSP_D0166                    0 // JCT3V-D0166: 1: add supporting for Bi-VSP, the code under the macro can also handle uni-direction VSP
     269#define MTK_VSP_USING_NBDV_D0105             0
     270#define MERL_General_Fix                     0
     271#endif
     272
     273#if !MERL_General_Fix
     274#define MTK_LGE_VSP_DEPTH_OFF_D0105_D0139    1 // JCT3V-D0105/JCT3V-D0139: disable VSP for depth map
     275#define MTK_VSP_USING_NBDV_D0105             1 // JCT3V-D0105: use NBDV instead of DoNBDV for BVSP
     276#endif
    209277
    210278///// ***** DERIVED PARAMETERS *********
     
    342410#define C2FLAG_NUMBER               1 // maximum number of largerThan2 flag coded in one chunk:  16 in HM5
    343411
     412#if !LGE_SAO_MIGRATION_D0091
    344413#define REMOVE_SAO_LCU_ENC_CONSTRAINTS_1 0  ///< disable the encoder constraint that does not test SAO/BO mode for chroma in interleaved mode
    345414#define REMOVE_SAO_LCU_ENC_CONSTRAINTS_2 0  ///< disable the encoder constraint that reduce the range of SAO/EO for chroma in interleaved mode
     415#endif
    346416#define REMOVE_SAO_LCU_ENC_CONSTRAINTS_3 0  ///< disable the encoder constraint that conditionally disable SAO for chroma for entire slice in interleaved mode
    347417#define COLLOCATED_REF_IDX      1           ///< H0442: signal collocated reference index
     
    616686  Int         iBestType;
    617687  Int         iLength;
     688#if LGE_SAO_MIGRATION_D0091
     689  Int         subTypeIdx ;                 ///< indicates EO class or BO band position
     690#else
    618691  Int         bandPosition ;
     692#endif
    619693  Int         iOffset[4];
    620694  Int         StartCUX;
     
    646720  Bool       mergeLeftFlag;
    647721  Int        typeIdx;
     722#if LGE_SAO_MIGRATION_D0091
     723  Int        subTypeIdx;
     724#else
    648725  Int        bandPosition;
     726#endif
    649727  Int        offset[4];
     728#if !LGE_SAO_MIGRATION_D0091
    650729  Int        runDiff;
    651730  Int        run;
     731#endif
    652732  Int        partIdx;
    653733  Int        partIdxTmp;
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r332 r443  
    265265    xParseDblParam( aps );   
    266266  }
     267#if !LGE_SAO_MIGRATION_D0091
    267268  READ_FLAG(uiCode, "aps_sao_interleaving_flag");      aps->setSaoInterleavingFlag( (uiCode==1)?true:false );
    268269  if(!aps->getSaoInterleavingFlag())
     
    275276  }
    276277  }
     278#endif
    277279  READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag");      aps->setAlfEnabled( (uiCode==1)?true:false );
    278280  if(aps->getAlfEnabled())