Changeset 1279 in 3DVCSoftware for branches/HTM-14.1-update-dev1


Ignore:
Timestamp:
15 Jul 2015, 14:57:32 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev2@1277.

Location:
branches/HTM-14.1-update-dev1
Files:
59 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-14.1-update-dev1

  • branches/HTM-14.1-update-dev1/source/App/TAppEncoder/TAppEncTop.cpp

    r1249 r1279  
    291291    m_cTEncTop.setDWeight                      ( isDepth ? m_iDWeight             : 0     );
    292292#endif // H_3D_VSO
    293 #if H_3D_IC
     293#if NH_3D_IC
    294294    m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );
    295295    m_cTEncTop.setUseICLowLatencyEnc           ( m_bUseLowLatencyICEnc );
  • branches/HTM-14.1-update-dev1/source/Lib/TAppCommon/TAppComCamPara.cpp

    r1239 r1279  
    13731373  Int  iSourceViewNum = m_aiBaseViews[ iViewIdx ];
    13741374  Double dBaseLine = 0.0;
    1375   Double dFL1 = 0.0, dCS1 = 0.0, dCP1 = 0.0, dZN1 = 0.0, dZF1 = 0.0;
     1375  Double dFL1 = 1.0, dCS1 = 1.0, dCP1 = 1.0, dZN1 = 1.0, dZF1 = 1.0;
    13761376  Bool bInterpolated = false;
    13771377  double dPos[3] = {0.0, 0.0, 0.0};
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/CommonDef.h

    r1200 r1279  
    363363#endif
    364364
    365 #if H_3D_IV_MERGE
     365#if NH_3D_MLC  || NH_3D_ARP
    366366#define MRG_MAX_NUM_CANDS_MEM       (MRG_MAX_NUM_CANDS+1) // one extra for inter-view motion prediction
    367367#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/ContextTables.h

    r1258 r1279  
    162162#define NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX  1
    163163
    164 #if H_3D_ARP
     164#if NH_3D_ARP
    165165#define NUM_ARPW_CTX                  3       ///< number of context models for weighting factor index used by advanced residual prediction
    166166#endif
    167167
    168 #if H_3D_IC
     168#if NH_3D_IC
    169169#define NUM_IC_FLAG_CTX               1       ///< number of context models for illumination compensation flag
    170170#endif
     
    186186#define NUM_DDC_FLAG_CTX              2       ///< number of context models for deltaDC flag (SDC only)
    187187#endif
    188 #if H_3D_DBBP
     188#if NH_3D_DBBP
    189189#define DBBP_NUM_FLAG_CTX                 1
    190190#endif
     
    540540//! \}
    541541
    542 #if H_3D_ARP
     542#if NH_3D_ARP
    543543static const UChar
    544544INIT_ARPW[3][NUM_ARPW_CTX] =
     
    550550
    551551#endif
    552 #if H_3D_IC
     552#if NH_3D_IC
    553553static const UChar
    554554INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 
     
    616616};
    617617#endif
    618 #if H_3D_DBBP
     618#if NH_3D_DBBP
    619619static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =
    620620{
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComCodingStatistics.h

    r1239 r1279  
    8181  STATS__CABAC_BITS__ESCAPE_BITS,
    8282
     83#if NH_3D_DBBP
     84  STATS__CABAC_BITS__DBBP_FLAG,
     85#endif
     86#if NH_3D_ARP
     87  STATS__CABAC_BITS__ARP_FLAG,
     88#endif
    8389  STATS__CABAC_BITS__SAO,
    8490  STATS__CABAC_TRM_BITS,
     
    9399  STATS__CABAC_BITS__ALIGNED_ESCAPE_BITS,
    94100
     101#if NH_3D_IC
     102  STATS__CABAC_BITS__3D_IC,
     103#endif
    95104#if NH_3D_DMM || NH_3D_SDC_INTRA || H_3D_INTER_SDC
    96105  STATS__CABAC_BITS__DELTADC_SIGN_EP,
     
    147156    "CABAC_BITS__SIGN_BIT",
    148157    "CABAC_BITS__ESCAPE_BITS",
     158#if NH_3D_DBBP
     159    "CABAC_BITS__DBBP_FLAG",
     160#endif
    149161    "CABAC_BITS__SAO",
    150162    "CABAC_TRM_BITS",
     
    158170    "CABAC_BITS__ALIGNED_SIGN_BIT",
    159171    "CABAC_BITS__ALIGNED_ESCAPE_BITS"
     172
     173#if NH_3D_IC
     174    "CABAC_BITS__3D_IC"
     175#endif
    160176#if NH_3D_DMM || NH_3D_SDC_INTRA || H_3D_INTER_SDC
    161177   ,"STATS__CABAC_BITS__DELTADC_SIGN_EP"
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComDataCU.cpp

    r1258 r1279  
    120120  m_bDecSubCu          = false;
    121121
    122 #if H_3D_NBDV
     122#if NH_3D_NBDV
    123123  m_pDvInfo              = NULL;
    124124#endif
    125 #if H_3D_VSP
     125#if NH_3D_VSP
    126126  m_piVSPFlag            = NULL;
    127127#endif
    128 #if H_3D_SPIVMP
     128#if NH_3D_SPIVMP
    129129  m_pbSPIVMPFlag         = NULL;
    130130#endif
    131 #if H_3D_ARP
     131#if NH_3D_ARP
    132132  m_puhARPW              = NULL;
    133133#endif
    134 #if H_3D_IC
     134#if NH_3D_IC
    135135  m_pbICFlag             = NULL;
    136136#endif
    137137#if H_3D_INTER_SDC
    138138#endif
    139 #if H_3D_DBBP
     139#if NH_3D_DBBP
    140140  m_pbDBBPFlag         = NULL;
    141141#endif
     
    180180    m_pbMergeFlag        = (Bool*  )xMalloc(Bool,   uiNumPartition);
    181181    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
    182 #if H_3D_VSP
     182#if NH_3D_VSP
    183183    m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
    184184#endif
    185 #if H_3D_SPIVMP
     185#if NH_3D_SPIVMP
    186186    m_pbSPIVMPFlag       = (Bool*  )xMalloc(Bool,   uiNumPartition);
    187187#endif
     
    203203    }
    204204
    205 #if H_3D_NBDV
     205#if NH_3D_NBDV
    206206    m_pDvInfo            = (DisInfo* )xMalloc(DisInfo,  uiNumPartition);
    207207#endif
     
    244244    }
    245245
    246 #if H_3D_ARP
    247     m_puhARPW            = new UChar[ uiNumPartition];
    248 #endif
    249 #if H_3D_IC
     246#if NH_3D_ARP
     247    m_puhARPW            = (UChar*  )xMalloc(UChar,   uiNumPartition);
     248#endif
     249#if NH_3D_IC
    250250    m_pbICFlag           = (Bool* )xMalloc(Bool,   uiNumPartition);
    251251#endif
     
    263263    m_apSegmentDCOffset[1]  = (Pel*)xMalloc(Pel, uiNumPartition);
    264264#endif
    265 #if H_3D_DBBP
     265#if NH_3D_DBBP
    266266    m_pbDBBPFlag         = (Bool*  )xMalloc(Bool,   uiNumPartition);
    267267#endif
     
    362362    }
    363363
    364 #if H_3D_VSP
    365     if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
    366 #endif
    367 #if H_3D_SPIVMP
     364#if NH_3D_VSP
     365    if ( m_piVSPFlag )
     366    {
     367      xFree(m_piVSPFlag);
     368      m_piVSPFlag = NULL;
     369    }
     370#endif
     371#if NH_3D_SPIVMP
    368372    if ( m_pbSPIVMPFlag       ) { xFree(m_pbSPIVMPFlag);           m_pbSPIVMPFlag         = NULL; }
    369373#endif
     
    453457      m_acCUMvField[rpl].destroy();
    454458    }
    455 #if H_3D_NBDV
     459#if NH_3D_NBDV
    456460    if ( m_pDvInfo            ) { xFree(m_pDvInfo);             m_pDvInfo           = NULL; }
    457461#endif
    458462
    459463
    460 #if H_3D_ARP
    461     if ( m_puhARPW            ) { delete[] m_puhARPW;           m_puhARPW           = NULL; }
    462 #endif
    463 #if H_3D_IC
     464#if NH_3D_ARP
     465    if ( m_puhARPW            ) { xFree(m_puhARPW);             m_puhARPW           = NULL; }
     466#endif
     467#if NH_3D_IC
    464468    if ( m_pbICFlag           ) { xFree(m_pbICFlag);            m_pbICFlag          = NULL; }
    465469#endif
     
    478482    if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]);  m_apSegmentDCOffset[1]  = NULL; }
    479483#endif   
    480 #if H_3D_DBBP
     484#if NH_3D_DBBP
    481485    if ( m_pbDBBPFlag         ) { xFree(m_pbDBBPFlag);          m_pbDBBPFlag        = NULL; }
    482486#endif
     
    583587  memset( m_puhHeight         , maxCUHeight,                m_uiNumPartition * sizeof( *m_puhHeight ) );
    584588
    585 #if H_3D_ARP
    586     m_puhARPW   [ui] = pcFrom->getARPW( ui );
    587 #endif
    588 #if H_3D_IC
    589     m_pbICFlag[ui]   =  pcFrom->m_pbICFlag[ui];
    590 #endif
    591 
     589#if NH_3D_IC
     590  memset( m_pbICFlag          , false,                      m_uiNumPartition * sizeof( *m_pbICFlag ) );
     591#endif
    592592  for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++)
    593593  {
     
    608608  memset( m_puhMergeIndex     , 0,                        m_uiNumPartition * sizeof( *m_puhMergeIndex ) );
    609609
    610 #if H_3D_VSP
    611     m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
    612 #endif
    613 #if H_3D_SPIVMP
    614     m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui];
     610#if NH_3D_VSP
     611  memset( m_piVSPFlag         , 0,                        m_uiNumPartition * sizeof( *m_piVSPFlag ) );
     612#endif
     613#if NH_3D_SPIVMP
     614  memset( m_pbSPIVMPFlag      , 0,                     m_uiNumPartition * sizeof( *m_pbSPIVMPFlag ) );   
    615615#endif
    616616#if NH_3D_SDC_INTRA
    617617  memset( m_pbSDCFlag, false, m_uiNumPartition * sizeof( *m_pbSDCFlag ) );
    618618#endif
    619 #if H_3D_DBBP
    620     m_pbDBBPFlag[ui] = pcFrom->m_pbDBBPFlag[ui];
    621 #endif
    622 #if H_3D_VSP
    623     memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
    624 #endif
    625 #if H_3D_SPIVMP
    626     memset( m_pbSPIVMPFlag      + firstElement, 0,                        numElements * sizeof( *m_pbSPIVMPFlag ) );
     619#if NH_3D_DBBP
     620  memset( m_pbDBBPFlag , false, m_uiNumPartition * sizeof( *m_pbDBBPFlag ));
    627621#endif
    628622
     
    632626  }
    633627
    634 #if H_3D_ARP
    635     memset( m_puhARPW           + firstElement, 0,                        numElements * sizeof( UChar )         );
    636 #endif
    637 #if H_3D_IC
    638     memset( m_pbICFlag          + firstElement, false,                    numElements * sizeof( *m_pbICFlag )   );
    639 #endif
    640 
     628#if NH_3D_ARP
     629  memset( m_puhARPW      ,      0,        m_uiNumPartition * sizeof( *m_puhARPW )         );
     630#endif
    641631
    642632
     
    653643    memset( m_apSegmentDCOffset[0],     0,                m_uiNumPartition * sizeof( *m_apSegmentDCOffset[0] ) );
    654644    memset( m_apSegmentDCOffset[1],     0,                m_uiNumPartition * sizeof( *m_apSegmentDCOffset[1] ) );
    655 #endif
    656 #if H_3D_DBBP
    657     memset( m_pbDBBPFlag        + firstElement, false,                    numElements * sizeof( *m_pbDBBPFlag ) );
    658645#endif
    659646
     
    770757    m_pbMergeFlag[ui]   = 0;
    771758    m_puhMergeIndex[ui] = 0;
    772 #if H_3D_VSP
    773       m_piVSPFlag[ui] = 0;
    774 #endif
    775 #if H_3D_SPIVMP
    776       m_pbSPIVMPFlag[ui] = 0;
     759#if NH_3D_VSP
     760    m_piVSPFlag[ui]    = 0;
     761#endif
     762#if NH_3D_SPIVMP
     763    m_pbSPIVMPFlag[ui] = 0;
    777764#endif
    778765
     
    787774      m_puhCbf[comp][ui] = 0;
    788775    }
    789 #if H_3D_ARP
     776#if NH_3D_ARP
    790777      m_puhARPW[ui] = 0;
    791778#endif
    792 #if H_3D_IC
     779#if NH_3D_IC
    793780      m_pbICFlag[ui]  = false;
    794781#endif
     
    808795      m_apSegmentDCOffset[1][ui] = 0;
    809796#endif
    810 #if H_3D_DBBP
     797#if NH_3D_DBBP
    811798      m_pbDBBPFlag[ui] = false;
    812799#endif
     
    864851  memset( m_pbMergeFlag,        0, iSizeInBool  );
    865852  memset( m_puhMergeIndex,      0, iSizeInUchar );
    866 #if H_3D_VSP
     853#if NH_3D_VSP
    867854  memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
    868855#endif
    869 #if H_3D_SPIVMP
     856#if NH_3D_SPIVMP
    870857  memset( m_pbSPIVMPFlag,       0, sizeof( Bool  ) * m_uiNumPartition );
    871858#endif
     
    886873    memset( m_explicitRdpcmMode[comp],             NUMBER_OF_RDPCM_MODES, iSizeInUchar );
    887874  }
    888 #if H_3D_ARP
    889   memset( m_puhARPW,            0, iSizeInUchar  );
    890 #endif
    891875
    892876  memset( m_puhDepth,     uiDepth, iSizeInUchar );
     
    894878  memset( m_puhHeight,         uhHeight, iSizeInUchar );
    895879  memset( m_pbIPCMFlag,        0, iSizeInBool  );
    896 #if H_3D_IC
     880#if NH_3D_ARP
     881  memset( m_puhARPW,           0, iSizeInUchar  );
     882#endif
     883#if NH_3D_IC
    897884  memset( m_pbICFlag,          0, iSizeInBool  );
    898885#endif
     
    910897  memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition   );
    911898#endif
    912 #if H_3D_DBBP
    913   memset( m_pbDBBPFlag,         0, iSizeInBool  );
     899#if NH_3D_DBBP
     900  memset( m_pbDBBPFlag,         0, sizeof(Bool) * m_uiNumPartition  );
    914901#endif
    915902
     
    937924      m_ucDISType[ui]   = pcCU->getDISType(uiPartOffset+ui);
    938925#endif
    939 #if H_3D_VSP
    940       m_piVSPFlag[ui]=pcCU->m_piVSPFlag[uiPartOffset+ui];
    941       m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
    942 #endif
    943 #if H_3D_SPIVMP
    944       m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];
    945 #endif
    946 #if H_3D_ARP
     926#if NH_3D_VSP
     927    m_piVSPFlag[ui] = pcCU->m_piVSPFlag[uiPartOffset+ui];
     928    m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
     929#endif
     930#if NH_3D_SPIVMP
     931    m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];
     932#endif
     933#if NH_3D_ARP
    947934      m_puhARPW           [ui] = pcCU->getARPW( uiPartOffset+ui );
    948935#endif
    949 #if H_3D_IC
     936#if NH_3D_IC
    950937      m_pbICFlag          [ui] = pcCU->m_pbICFlag[uiPartOffset+ui];
    951938#endif
     
    963950    m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1] [ uiPartOffset + ui ];
    964951#endif
    965 #if H_3D_DBBP
     952#if NH_3D_DBBP
    966953      m_pbDBBPFlag[ui]=pcCU->m_pbDBBPFlag[uiPartOffset+ui];
    967954#endif
     
    10341021  m_pePredMode=pcCU->getPredictionMode()  + uiPart;
    10351022  m_CUTransquantBypass  = pcCU->getCUTransquantBypass()+uiPart;
    1036 #if H_3D_NBDV
     1023#if NH_3D_NBDV
    10371024  m_pDvInfo             = pcCU->getDvInfo()           + uiPart;
    10381025#endif
     
    10401027  m_pbMergeFlag         = pcCU->getMergeFlag()        + uiPart;
    10411028  m_puhMergeIndex       = pcCU->getMergeIndex()       + uiPart;
    1042 #if H_3D_VSP
     1029#if NH_3D_VSP
    10431030  m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
    10441031#endif
    1045 #if H_3D_SPIVMP
     1032#if NH_3D_SPIVMP
    10461033  m_pbSPIVMPFlag        = pcCU->getSPIVMPFlag()          + uiPart;
    10471034#endif
    1048 #if H_3D_ARP
     1035#if NH_3D_ARP
    10491036  m_puhARPW             = pcCU->getARPW()             + uiPart;
    10501037#endif
    1051 #if H_3D_IC
     1038#if NH_3D_IC
    10521039  m_pbICFlag            = pcCU->getICFlag()           + uiPart;
    10531040#endif
     
    10811068  m_apSegmentDCOffset[1]    = pcCU->getSDCSegmentDCOffset(1)  + uiPart;
    10821069#endif 
    1083 #if H_3D_DBBP
     1070#if NH_3D_DBBP
    10841071  m_pbDBBPFlag              = pcCU->getDBBPFlag()         + uiPart;
    10851072#endif
     
    11281115}
    11291116
    1130 #if H_3D_NBDV
     1117#if NH_3D_NBDV
    11311118Void TComDataCU::copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx)
    11321119{
     
    11371124// Copy inter prediction info from the biggest CU
    11381125Void TComDataCU::copyInterPredInfoFrom    ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
    1139 #if H_3D_NBDV
     1126#if NH_3D_NBDV
    11401127  , Bool bNBDV
    11411128#endif
     
    11681155
    11691156  m_pePartSize         = pcCU->getPartitionSize ()        + uiAbsPartIdx;
    1170 #if H_3D_NBDV
     1157#if NH_3D_NBDV
    11711158  if(bNBDV == true)
    11721159  {
     
    11891176  m_pbMergeFlag        = pcCU->getMergeFlag()             + uiAbsPartIdx;
    11901177  m_puhMergeIndex      = pcCU->getMergeIndex()            + uiAbsPartIdx;
    1191 #if H_3D_VSP
     1178#if NH_3D_VSP
    11921179  m_piVSPFlag          = pcCU->getVSPFlag()               + uiAbsPartIdx;
    11931180  m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
    11941181#endif
    1195 #if H_3D_SPIVMP
     1182#if NH_3D_SPIVMP
    11961183  m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()            + uiAbsPartIdx;
    11971184#endif
     
    11991186  m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx;
    12001187  m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx;
    1201 #if H_3D_ARP
     1188#if NH_3D_ARP
    12021189  m_puhARPW            = pcCU->getARPW()                  + uiAbsPartIdx;
    12031190#endif   
    1204 #if H_3D_DBBP
     1191#if NH_3D_DBBP
    12051192  m_pbDBBPFlag       = pcCU->getDBBPFlag()              + uiAbsPartIdx;
    12061193#endif
    12071194
    12081195  m_acCUMvField[ eRefPicList ].linkToWithOffset( pcCU->getCUMvField(eRefPicList), uiAbsPartIdx );
    1209 #if H_3D_NBDV
    1210   }
    1211 #endif
    1212 #if H_3D_IC
     1196#if NH_3D_NBDV
     1197  }
     1198#endif
     1199#if NH_3D_IC
    12131200  m_pbICFlag           = pcCU->getICFlag()                + uiAbsPartIdx;
    12141201#endif
     
    12471234  memcpy( m_pbMergeFlag         + uiOffset, pcCU->getMergeFlag(),         iSizeInBool  );
    12481235  memcpy( m_puhMergeIndex       + uiOffset, pcCU->getMergeIndex(),        iSizeInUchar );
    1249 #if H_3D_VSP
     1236#if NH_3D_VSP
    12501237  memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( Char ) * uiNumPartition );
    12511238  memcpy( m_pDvInfo             + uiOffset, pcCU->getDvInfo(),            sizeof( *m_pDvInfo ) * uiNumPartition );
    12521239#endif
    1253 #if H_3D_SPIVMP
     1240#if NH_3D_SPIVMP  || NH_3D_DBBP
    12541241  memcpy( m_pbSPIVMPFlag        + uiOffset, pcCU->getSPIVMPFlag(),        sizeof( Bool ) * uiNumPartition );
    12551242#endif
     
    12831270  memcpy( m_apSegmentDCOffset[1]  + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition);
    12841271#endif
    1285 #if H_3D_DBBP
     1272#if NH_3D_DBBP
    12861273  memcpy( m_pbDBBPFlag          + uiOffset, pcCU->getDBBPFlag(),          iSizeInBool  );
     1274#endif
     1275#if NH_3D_ARP
     1276  memcpy( m_puhARPW             + uiOffset, pcCU->getARPW(),              iSizeInUchar );
    12871277#endif
    12881278
     
    13261316  }
    13271317
    1328 #if H_3D_ARP
    1329   memcpy( m_puhARPW             + uiOffset, pcCU->getARPW(),              iSizeInUchar );
    1330 #endif
    1331 #if H_3D_IC
     1318#if NH_3D_IC
    13321319  memcpy( m_pbICFlag            + uiOffset, pcCU->getICFlag(),            iSizeInBool );
    13331320#endif
     
    13591346
    13601347  memcpy( pCtu->getQP() + m_absZIdxInCtu, m_phQP, sizeInChar  );
    1361 #if H_3D_NBDV
    1362   memcpy( rpcCU->getDvInfo()         + m_uiAbsIdxInLCU, m_pDvInfo,    sizeof(* m_pDvInfo)    * m_uiNumPartition );
     1348#if NH_3D_NBDV
     1349  memcpy( pCtu->getDvInfo() + m_absZIdxInCtu, m_pDvInfo, sizeof(* m_pDvInfo) * m_uiNumPartition );
    13631350#endif
    13641351
     
    13691356  memcpy( pCtu->getMergeFlag()         + m_absZIdxInCtu, m_pbMergeFlag,         iSizeInBool  );
    13701357  memcpy( pCtu->getMergeIndex()        + m_absZIdxInCtu, m_puhMergeIndex,       iSizeInUchar );
    1371   #if H_3D_VSP
    1372   memcpy( rpcCU->getVSPFlag()           + m_uiAbsIdxInLCU, m_piVSPFlag,           sizeof( Char ) * m_uiNumPartition );
    1373   memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
    1374 #endif
    1375 #if H_3D_SPIVMP
    1376   memcpy( rpcCU->getSPIVMPFlag()        + m_uiAbsIdxInLCU, m_pbSPIVMPFlag,        sizeof( Bool ) * m_uiNumPartition );
     1358#if NH_3D_VSP
     1359  memcpy( pCtu->getVSPFlag()           + m_absZIdxInCtu, m_piVSPFlag,           sizeof( Char ) * m_uiNumPartition );
     1360#endif
     1361#if NH_3D_DBBP
     1362  memcpy( pCtu->getDvInfo()            + m_absZIdxInCtu, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
     1363#endif
     1364#if NH_3D_SPIVMP
     1365  memcpy( pCtu->getSPIVMPFlag()        + m_absZIdxInCtu, m_pbSPIVMPFlag,        sizeof( Bool ) * m_uiNumPartition );
    13771366#endif
    13781367
     
    14061395  memcpy( pCtu->getSDCSegmentDCOffset(1) + m_absZIdxInCtu, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition);
    14071396#endif
    1408 #if H_3D_DBBP
    1409   memcpy( rpcCU->getDBBPFlag()          + m_uiAbsIdxInLCU, m_pbDBBPFlag,          iSizeInBool  );
     1397#if NH_3D_DBBP
     1398  memcpy( pCtu->getDBBPFlag()          + m_absZIdxInCtu, m_pbDBBPFlag,          iSizeInBool  );
     1399#endif
     1400#if NH_3D_ARP
     1401  memcpy( pCtu->getARPW()              + m_absZIdxInCtu, m_puhARPW,             iSizeInUchar );
    14101402#endif
    14111403
     
    14421434  }
    14431435
    1444 #if H_3D_ARP
    1445   memcpy( rpcCU->getARPW()             + m_uiAbsIdxInLCU, m_puhARPW,             iSizeInUchar );
    1446 #endif
    1447 #if H_3D_IC
    1448   memcpy( rpcCU->getICFlag()           + m_uiAbsIdxInLCU, m_pbICFlag,            iSizeInBool );
    1449 #endif
    1450 
     1436#if NH_3D_IC
     1437  memcpy( pCtu->getICFlag() + m_absZIdxInCtu, m_pbICFlag, sizeof( *m_pbICFlag ) * m_uiNumPartition );
     1438#endif
    14511439  pCtu->getTotalBins() = m_uiTotalBins;
    14521440}
    1453 #if H_3D_VSP
    1454   memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
    1455 #endif
    14561441#if H_3D_SPIVMP
    14571442  memcpy( rpcCU->getSPIVMPFlag()        + uiPartOffset, m_pbSPIVMPFlag,        sizeof(Bool) * uiQNumPart );
    1458 #endif
    1459 #if H_3D_DBBP
    1460   memcpy( rpcCU->getDBBPFlag()          + uiPartOffset, m_pbDBBPFlag,          iSizeInBool  );
    1461 #endif
    1462 #if H_3D_ARP
    1463   memcpy( rpcCU->getARPW()             + uiPartOffset, m_puhARPW,             iSizeInUchar );
    1464 #endif
    1465 #if H_3D_IC
    1466   memcpy( rpcCU->getICFlag()           + uiPartOffset, m_pbICFlag,            iSizeInBool );
    14671443#endif
    14681444
     
    20171993  return uiCtx;
    20181994}
    2019 #if H_3D_ARP
     1995#if NH_3D_ARP
    20201996UInt TComDataCU::getCTXARPWFlag( UInt uiAbsPartIdx )
    20211997{
     
    20242000  UInt        uiCtx = 0;
    20252001 
    2026   pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     2002  pcTempCU = getPULeft( uiTempPartIdx, m_absZIdxInCtu + uiAbsPartIdx );
    20272003  uiCtx    = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0;
    20282004    return uiCtx;
    20292005}
    20302006#endif
    2031 #if H_3D_DBBP
     2007#if NH_3D_DBBP
    20322008Pel* TComDataCU::getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride)
    20332009{
     2010  const TComSPS* sps = getSlice()->getSPS();
     2011  UInt uiMaxCUWidth = sps->getMaxCUWidth();
     2012  UInt uiMaxCUHeight = sps->getMaxCUHeight();
     2013 
    20342014  // get coded and reconstructed depth view
    20352015  TComPicYuv* depthPicYuv = NULL;
     
    20372017 
    20382018  // DBBP is a texture coding tool
    2039   if( getSlice()->getIsDepth() )
    2040   {
    2041     return NULL;
    2042   } 
     2019  assert( !getSlice()->getIsDepth() );
     2020 
    20432021#if H_3D_FCO
    20442022  TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     
    20672045    depthPicYuv   = baseDepthPic->getPicYuvRec();
    20682046    depthPicYuv->extendPicBorder();
    2069     uiDepthStride = depthPicYuv->getStride();
     2047    uiDepthStride = depthPicYuv->getStride(COMPONENT_Y);
    20702048   
    2071     Int iBlkX = ( getAddr() % baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ];
    2072     Int iBlkY = ( getAddr() / baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ];
     2049    Int iBlkX = ( getCtuRsAddr() % baseDepthPic->getFrameWidthInCtus() ) * uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCtu()+uiAbsPartIdx ] ];
     2050    Int iBlkY = ( getCtuRsAddr() / baseDepthPic->getFrameWidthInCtus() ) * uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCtu()+uiAbsPartIdx ] ];
    20732051   
    2074     Int iPictureWidth  = depthPicYuv->getWidth();
    2075     Int iPictureHeight = depthPicYuv->getHeight();
     2052    Int iPictureWidth  = depthPicYuv->getWidth(COMPONENT_Y);
     2053    Int iPictureHeight = depthPicYuv->getHeight(COMPONENT_Y);
    20762054   
    20772055   
    20782056    Bool depthRefineFlag = false;
    2079 #if H_3D_NBDV_REF
    2080     depthRefineFlag = m_pcSlice->getDepthRefinementFlag(  );
    2081 #endif // H_3D_NBDV_REF
     2057#if NH_3D_NBDV_REF
     2058    depthRefineFlag = m_pcSlice->getDepthRefinementFlag();
     2059#endif // NH_3D_NBDV_REF
    20822060   
    20832061    TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV;
     
    20902068    Int depthPosY = Clip3(0,   iPictureHeight - 1, iBlkY + ((cDv.getVer()+2)>>2));
    20912069   
    2092     pDepthPels = depthPicYuv->getLumaAddr() + depthPosX + depthPosY * uiDepthStride;
     2070    pDepthPels = depthPicYuv->getAddr(COMPONENT_Y) + depthPosX + depthPosY * uiDepthStride;
    20932071  }
    20942072#endif
     
    21022080#endif
    21032081
    2104 #if H_3D_DBBP
     2082#if NH_3D_DBBP
    21052083Void TComDataCU::setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    21062084{
     
    23922370}
    23932371
    2394 #if H_3D_SPIVMP
     2372#if NH_3D_SPIVMP
    23952373Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    23962374{
     
    23992377#endif
    24002378
    2401 #if H_3D_VSP
     2379#if NH_3D_VSP
    24022380Void TComDataCU::setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    24032381{
    24042382  setSubPart<Char>( iVSPFlag, m_piVSPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
    24052383}
    2406 #if H_3D_VSP
    24072384template<typename T>
    24082385Void TComDataCU::setSubPartT( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx )
    24092386{
    2410   UInt uiCurrPartNumQ = (m_pcPic->getNumPartInCU() >> (2 * uiCUDepth)) >> 2;
     2387  UInt uiCurrPartNumQ = (m_pcPic->getNumPartitionsInCtu() >> (2 * uiCUDepth)) >> 2;
    24112388  switch ( m_pePartSize[ uiCUAddr ] )
    24122389  {
     
    25402517}
    25412518#endif
    2542 #endif
    25432519
    25442520Void TComDataCU::setInterDirSubParts( UInt uiDir, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     
    26262602
    26272603// This is for use by a leaf/sub CU object only, with no additional AbsPartIdx
    2628 #if H_3D_IC
     2604#if NH_3D_IC || NH_3D_VSP
    26292605Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU)
    26302606{
     
    29602936}
    29612937
    2962 #if H_3D_VSP
    2963 
     2938#if NH_3D_VSP
    29642939/** Add a VSP merging candidate
    29652940 * \Inputs
     
    30152990        predFlag[iRefListIdX] = 1;
    30162991        mvVSP[0+iRefListIdX].setMvField( pDInfo->m_acNBDV, i );
    3017 #if H_3D_NBDV
     2992#if NH_3D_NBDV
    30182993        mvVSP[0+iRefListIdX].getMv().setIDVFlag (false);
    30192994#endif
     
    30232998
    30242999  dirVSP = (predFlag[0] | (predFlag[1] << 1));
    3025   m_mergCands[MRG_VSP].setCand( mvVSP, dirVSP, true, false);
     3000  m_mergCands[MRG_VSP].setCand( mvVSP, dirVSP, true
     3001#if NH_3D_SPIVMP
     3002    , false
     3003#endif
     3004    );
    30263005  if ( mrgCandIdx == iCount )
    30273006  {
     
    30333012  return false;
    30343013}
    3035 
    3036 #endif
    3037 
    3038 #if H_3D_IV_MERGE
     3014#endif
     3015
     3016#if NH_3D_IV_MERGE
    30393017inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int* ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx )
    30403018{
     
    30673045      if(!bRemove)
    30683046      {
    3069 #if H_3D_NBDV
     3047#if NH_3D_NBDV
    30703048        if(iLoop) // For IvMcShift candidate
    30713049        {
     
    30883066
    30893067#endif
    3090 #if H_3D
     3068#if NH_3D_MLC
     3069/** Construct a extended list of merging candidates
     3070 * \param pcMvFieldNeighbours
     3071 * \param puhInterDirNeighbours
     3072 * \param vspFlag
     3073 * \param pbSPIVMPFlag
     3074 * \param numValidMergeCand
     3075 */
    30913076Void TComDataCU::buildMCL(TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    3092 #if H_3D_VSP
     3077#if NH_3D_VSP
    30933078  , Int* vspFlag
    30943079#endif
    3095 #if H_3D_SPIVMP
     3080#if NH_3D_SPIVMP
    30963081  , Bool* pbSPIVMPFlag
    30973082#endif
     
    30993084  )
    31003085{
    3101   if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))  // for only dependent texture
     3086  if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))
    31023087  {
    31033088    return;
     
    31153100    extMergeCandList[ui<<1].setMvField(cZeroMv, NOT_VALID);
    31163101    extMergeCandList[(ui<<1)+1].setMvField(cZeroMv, NOT_VALID);
     3102#if NH_3D_VSP
    31173103    vspFlag[ui] = 0;
    3118   }
    3119 
    3120   // add candidates to temporal list
    3121   // insert MPI ... IvShift candidate
     3104#endif
     3105  }
     3106
     3107  // insert MPI ... IvShift candidate to extMergeCandList
    31223108  for (Int i=0; i<=MRG_IVSHIFT; i++)
    31233109  {
    31243110    if (m_mergCands[i].m_bAvailable)
    31253111    {
    3126       m_mergCands[i].getCand(iCount, extMergeCandList, uhInterDirNeighboursExt, vspFlag, pbSPIVMPFlag);
     3112      m_mergCands[i].getCand(iCount, extMergeCandList, uhInterDirNeighboursExt
     3113#if NH_3D_VSP
     3114        , vspFlag
     3115#endif
     3116#if NH_3D_SPIVMP
     3117        , pbSPIVMPFlag
     3118#endif
     3119        );
    31273120      iCount++;
    31283121      if (iCount >= getSlice()->getMaxNumMergeCand())
     
    31313124  }
    31323125
    3133   // insert remaining base candidates
    3134   while (iCount < getSlice()->getMaxNumMergeCand() && m_baseListidc < getSlice()->getMaxNumMergeCand())
    3135   {
    3136     uhInterDirNeighboursExt[iCount] = puhInterDirNeighbours[m_baseListidc];
    3137     extMergeCandList[iCount<<1].setMvField(pcMvFieldNeighbours[m_baseListidc<<1].getMv(), pcMvFieldNeighbours[m_baseListidc<<1].getRefIdx());
     3126  Int iCountBase = m_numSpatialCands;
     3127  // insert remaining base candidates to extMergeCandList
     3128  while (iCount < getSlice()->getMaxNumMergeCand() && iCountBase < getSlice()->getMaxNumMergeCand())
     3129  {
     3130    uhInterDirNeighboursExt[iCount] = puhInterDirNeighbours[iCountBase];
     3131    extMergeCandList[iCount<<1].setMvField(pcMvFieldNeighbours[iCountBase<<1].getMv(), pcMvFieldNeighbours[iCountBase<<1].getRefIdx());
    31383132    if ( getSlice()->isInterB() )
    31393133    {
    3140       extMergeCandList[(iCount<<1)+1].setMvField(pcMvFieldNeighbours[(m_baseListidc<<1)+1].getMv(), pcMvFieldNeighbours[(m_baseListidc<<1)+1].getRefIdx());
    3141     }
    3142     m_baseListidc++;
     3134      extMergeCandList[(iCount<<1)+1].setMvField(pcMvFieldNeighbours[(iCountBase<<1)+1].getMv(), pcMvFieldNeighbours[(iCountBase<<1)+1].getRefIdx());
     3135    }
     3136    iCountBase++;
    31433137    iCount++;
    31443138  }
     
    31623156}
    31633157
    3164 /** Constructs a list of merging candidates
     3158
     3159
     3160/** Derive 3D merge candidates
    31653161 * \param uiAbsPartIdx
    31663162 * \param uiPUIdx
    3167  * \param uiDepth
    31683163 * \param pcMvFieldNeighbours
     3164 * \param puhInterDirNeighbours
     3165 * \param pcMvFieldSP
    31693166 * \param puhInterDirNeighbours
    31703167 * \param numValidMergeCand
    31713168 */
    3172 // HM 12.0 based merge candidate list construction
    3173 
    3174 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
    3175 {
    3176 
    3177   UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
    3178   Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
     3169Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     3170#if NH_3D_SPIVMP
     3171      , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     3172#endif
     3173      , Int& numValidMergeCand, Int mrgCandIdx
     3174)
     3175{
     3176#if NH_3D_IV_MERGE
    31793177  TComMv cZeroMv;
    3180   for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
    3181   {
    3182     abCandIsInter[ui] = false;
    3183     pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
    3184     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
     3178  TComMvField tmpMV[2]; 
     3179#endif
     3180
     3181  //////////////////////////////////
     3182  //////// GET DISPARITIES  ////////
     3183  //////////////////////////////////
     3184#if NH_3D_IV_MERGE
     3185  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
     3186  m_cDefaultDisInfo = cDisInfo;
     3187#elif NH_3D_VSP
     3188  // for xAddVspCand()
     3189  DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
     3190#endif
     3191
     3192  if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))
     3193  {
     3194    return;
    31853195  }
    31863196  numValidMergeCand = getSlice()->getMaxNumMergeCand();
     3197  //////////////////////////////////
     3198  //////// DERIVE LOCATIONS ////////
     3199  //////////////////////////////////
    31873200  // compute the location of the current PU
    31883201  Int xP, yP, nPSW, nPSH;
     
    31903203
    31913204  Int iCount = 0;
    3192 
    31933205  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    3194   PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
    31953206  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    31963207  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    3197 
    3198   //left
    3199   UInt uiLeftPartIdx = 0;
    3200   TComDataCU* pcCULeft = 0;
    3201   pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
    3202   Bool isAvailableA1 = pcCULeft &&
    3203     pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
    3204     !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
    3205     !pcCULeft->isIntra( uiLeftPartIdx ) ;
    3206   if ( isAvailableA1 )
    3207   {
    3208     m_bAvailableFlagA1 = 1;
    3209     abCandIsInter[iCount] = true;
    3210     // get Inter Dir
    3211     puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
    3212     // get Mv from Left
    3213     pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3214     if ( getSlice()->isInterB() )
    3215     {
    3216       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3217     }
    3218 
    3219     iCount ++;
    3220   }
    3221  
    3222   // early termination
    3223   if (iCount == getSlice()->getMaxNumMergeCand())
    3224   {
    3225     return;
    3226   }
    3227   // above
    3228   UInt uiAbovePartIdx = 0;
    3229   TComDataCU* pcCUAbove = 0;
    3230   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
    3231   Bool isAvailableB1 = pcCUAbove &&
    3232   pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
    3233   !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
    3234   !pcCUAbove->isIntra( uiAbovePartIdx );
    3235   if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    3236   {
    3237     m_bAvailableFlagB1 = 1;
    3238     abCandIsInter[iCount] = true;
    3239     // get Inter Dir
    3240     puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    3241     // get Mv from Left
    3242     pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3243     if ( getSlice()->isInterB() )
    3244     {
    3245       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3246     }
    3247     if ( mrgCandIdx == iCount )
    3248     {
    3249       return;
    3250     }
    3251     iCount ++;
    3252   }
    3253   // early termination
    3254   if (iCount == getSlice()->getMaxNumMergeCand())
    3255   {
    3256     return;
    3257   }
    3258 
    3259   // above right
    3260   UInt uiAboveRightPartIdx = 0;
    3261   TComDataCU* pcCUAboveRight = 0;
    3262   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
    3263   Bool isAvailableB0 = pcCUAboveRight &&
    3264   pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
    3265   !pcCUAboveRight->isIntra( uiAboveRightPartIdx );
    3266   if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    3267   {
    3268     m_bAvailableFlagB0 = 1;
    3269     abCandIsInter[iCount] = true;
    3270     // get Inter Dir
    3271     puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx );
    3272     // get Mv from Left
    3273     pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3274     if ( getSlice()->isInterB() )
    3275     {
    3276       pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3277     }
    3278     if ( mrgCandIdx == iCount )
    3279     {
    3280       return;
    3281     }
    3282     iCount ++;
    3283   }
    3284   // early termination
    3285   if (iCount == getSlice()->getMaxNumMergeCand())
    3286   {
    3287     return;
    3288   }
    3289 
    3290   //left bottom
    3291   UInt uiLeftBottomPartIdx = 0;
    3292   TComDataCU* pcCULeftBottom = 0;
    3293   pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
    3294   Bool isAvailableA0 = pcCULeftBottom &&
    3295   pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
    3296   !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ;
    3297   if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    3298   {
    3299     m_bAvailableFlagA0 = 1;
    3300     abCandIsInter[iCount] = true;
    3301     // get Inter Dir
    3302     puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx );
    3303     // get Mv from Left
    3304     pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3305     if ( getSlice()->isInterB() )
    3306     {
    3307       pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3308     }
    3309     if ( mrgCandIdx == iCount )
    3310     {
    3311       return;
    3312     }
    3313     iCount ++;
    3314   }
    3315   // early termination
    3316   if (iCount == getSlice()->getMaxNumMergeCand())
    3317   {
    3318     return;
    3319   }
    3320   // above left
    3321   if( iCount < 4 )
    3322   {
    3323     UInt uiAboveLeftPartIdx = 0;
    3324     TComDataCU* pcCUAboveLeft = 0;
    3325     pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
    3326     Bool isAvailableB2 = pcCUAboveLeft &&
    3327     pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
    3328     !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx );
    3329     if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    3330         && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) )
    3331     {
    3332       m_bAvailableFlagB2 = 1;
    3333       abCandIsInter[iCount] = true;
    3334       // get Inter Dir
    3335       puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx );
    3336       // get Mv from Left
    3337       pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    3338       if ( getSlice()->isInterB() )
    3339       {
    3340         pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    3341       }
    3342       if ( mrgCandIdx == iCount )
    3343       {
    3344         return;
    3345       }
    3346       iCount ++;
    3347     }
    3348   }
    3349   // early termination
    3350   if (iCount == getSlice()->getMaxNumMergeCand())
    3351   {
    3352     return;
    3353   }
    3354   if ( getSlice()->getEnableTMVPFlag())
    3355   {
    3356     //>> MTK colocated-RightBottom
    3357     UInt uiPartIdxRB;
    3358 
    3359     deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 
    3360 
    3361     UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    3362     UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
    3363 
    3364     TComMv cColMv;
    3365     Int iRefIdx;
    3366     Int uiLCUIdx = -1;
    3367 
    3368     if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    3369     {
    3370     }
    3371     else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    3372     {
    3373     }
    3374     else
    3375     {
    3376       if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    3377         ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
    3378       {
    3379         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
    3380         uiLCUIdx = getAddr();
    3381       }
    3382       else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
    3383       {
    3384         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    3385       }
    3386       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
    3387       {
    3388         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    3389         uiLCUIdx = getAddr() + 1;
    3390       }
    3391       else //is the right bottom corner of LCU                       
    3392       {
    3393         uiAbsPartAddr = 0;
    3394       }
    3395     }
    3396 
    3397     iRefIdx = 0;
    3398     Bool bExistMV = false;
    3399     UInt uiPartIdxCenter;
    3400     UInt uiCurLCUIdx = getAddr();
    3401     Int dir = 0;
    3402     UInt uiArrayAddr = iCount;
    3403     xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );
    3404     bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
    3405     if( bExistMV == false )
    3406     {
    3407       bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
    3408     }
    3409     if( bExistMV )
    3410     {
    3411       dir |= 1;
    3412       pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx );
    3413     }
    3414 
    3415     if ( getSlice()->isInterB() )
    3416     {
    3417 #if H_3D_TMVP
    3418       iRefIdx = 0;
    3419 #endif
    3420       bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
    3421       if( bExistMV == false )
    3422       {
    3423         bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
    3424       }
    3425       if( bExistMV )
    3426       {
    3427         dir |= 2;
    3428         pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx );
    3429       }
    3430     }
    3431 
    3432     if (dir != 0)
    3433     {
    3434       puhInterDirNeighbours[uiArrayAddr] = dir;
    3435       abCandIsInter[uiArrayAddr] = true;
    3436 #if H_3D_NBDV
    3437       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    3438       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    3439 #endif
    3440       if ( mrgCandIdx == iCount )
    3441       {
    3442         return;
    3443       }
    3444       iCount++;
    3445     }
    3446   }
    3447   // early termination
    3448   if (iCount == getSlice()->getMaxNumMergeCand())
    3449   {
    3450     return;
    3451   }
    3452   UInt uiArrayAddr = iCount;
    3453   UInt uiCutoff = uiArrayAddr;
    3454  
    3455   if ( getSlice()->isInterB() && iCount<5)  // JCT3V-F0129 by Qualcomm
    3456   {
    3457     UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    3458     UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
    3459 
    3460     for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
    3461     {
    3462       Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
    3463       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
    3464       {
    3465         abCandIsInter[uiArrayAddr] = true;
    3466         puhInterDirNeighbours[uiArrayAddr] = 3;
    3467 
    3468         // get Mv from cand[i] and cand[j]
    3469         pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
    3470         pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx());
    3471 
    3472         Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() );
    3473         Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() );
    3474         if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv())
    3475         {
    3476           abCandIsInter[uiArrayAddr] = false;
    3477         }
    3478         else
    3479         {
    3480           uiArrayAddr++;
    3481         }
    3482       }
    3483     }
    3484   }
    3485   // early termination
    3486   if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
    3487   {
    3488     return;
    3489   }
    3490  
    3491   Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
    3492   Int r = 0;
    3493   Int refcnt = 0;
    3494   while (uiArrayAddr < getSlice()->getMaxNumMergeCand())
    3495   {
    3496     abCandIsInter[uiArrayAddr] = true;
    3497     puhInterDirNeighbours[uiArrayAddr] = 1;
    3498     pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r);
    3499 
    3500     if ( getSlice()->isInterB() )
    3501     {
    3502       puhInterDirNeighbours[uiArrayAddr] = 3;
    3503       pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r);
    3504     }
    3505     uiArrayAddr++;
    3506     if ( refcnt == iNumRefIdx - 1 )
    3507     {
    3508       r = 0;
    3509     }
    3510     else
    3511     {
    3512       ++r;
    3513       ++refcnt;
    3514     }
    3515   }
    3516  
    3517   numValidMergeCand = uiArrayAddr;
    3518 }
    3519 
    3520 
    3521 
    3522 /** Constructs a list of merging candidates
    3523  * \param uiAbsPartIdx
    3524  * \param uiPUIdx
    3525  * \param uiDepth
    3526  * \param pcMvFieldNeighbours
    3527  * \param puhInterDirNeighbours
    3528  * \param numValidMergeCand
    3529  */
    3530 #if H_3D
    3531 Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    3532 #else
    3533 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    3534 #endif
    3535 #if H_3D_SPIVMP
    3536       , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
    3537 #endif
    3538       , Int& numValidMergeCand, Int mrgCandIdx
    3539 )
    3540 {
    3541 #if H_3D_IV_MERGE
    3542   ////////////////////////////
    3543   //////// INIT LISTS ////////
    3544   ////////////////////////////
    3545   TComMv cZeroMv;
    3546 #else
    3547   Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    3548 #endif
    3549 #if H_3D
    3550   TComMvField tmpMV[2];
    3551   UChar tmpDir;
    3552 
    3553 
    3554   //////////////////////////////////
    3555   //////// GET DISPARITIES  ////////
    3556   //////////////////////////////////
    3557   DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
    3558   m_cDefaultDisInfo = cDisInfo;
    3559 
    3560   if (!( getSlice()->getIsDepth() || getSlice()->getViewIndex()>0))  // current slice is not both dependent view or depth
    3561   {
    3562     return;
    3563   }
    3564 #else
    3565   for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
    3566   {
    3567     abCandIsInter[ui] = false;
    3568     pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
    3569     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
    3570   }
    3571 #endif
    3572 
    3573   numValidMergeCand = getSlice()->getMaxNumMergeCand();
    3574 #if H_3D
    3575   //////////////////////////////////
    3576   //////// DERIVE LOCATIONS ////////
    3577   //////////////////////////////////
    3578 #endif
    3579   // compute the location of the current PU
    3580   Int xP, yP, nPSW, nPSH;
    3581   this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    3582 
    3583   Int iCount = 0;
    3584 
    3585   UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    3586 #if !H_3D
    3587   PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
    3588 #endif
    3589   deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    3590   deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    3591 #if H_3D
     3208#if NH_3D_TEXT_MERGE
    35923209  Bool bMPIFlag   = getSlice()->getMpiFlag();
     3210  Int  tmpDir;
     3211#endif
     3212#if NH_3D_IV_MERGE || NH_3D_TEXT_MERGE
    35933213  Bool bIsDepth = getSlice()->getIsDepth();
    3594 #endif 
    3595 
    3596 #if H_3D_IC
     3214#endif
     3215
     3216#if NH_3D_IC
    35973217  Bool bICFlag = getICFlag(uiAbsPartIdx);
    35983218#endif
    3599 #if H_3D_ARP
     3219#if NH_3D_ARP
    36003220  Bool bARPFlag = getARPW(uiAbsPartIdx) > 0;
    36013221#endif
    3602 #if H_3D_DBBP
     3222#if NH_3D_DBBP
    36033223  Bool bDBBPFlag = getDBBPFlag(uiAbsPartIdx);
    36043224  assert(bDBBPFlag == getDBBPFlag(0)); 
    36053225#endif
    36063226
    3607 #if H_3D
    3608 #if H_3D_NBDV
     3227#if NH_3D_NBDV
    36093228  for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++) 
    36103229  {
    3611     pcMvFieldNeighbours[i<<1    ].getMv().setIDVFlag (false);
    3612     pcMvFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false);
    3613   }
    3614 #endif
    3615   // Clean version for MCL construction align with WD
    3616   // init mergCands list
     3230    pcMFieldNeighbours[i<<1    ].getMv().setIDVFlag (false);
     3231    pcMFieldNeighbours[(i<<1)+1].getMv().setIDVFlag (false);
     3232  }
     3233#endif
     3234  // init containers
    36173235  for (Int i = 0; i<MRG_IVSHIFT+1; i++)
    3618   {
    36193236    m_mergCands[i].init();
    3620   }
    3621 
    3622   m_baseListidc = 0;
    3623 
     3237
     3238  m_numSpatialCands = 0;
     3239
     3240  //////////////////////////////////
     3241  ///////// GET VSP FLAGS //////////
     3242  //////////////////////////////////
    36243243  //left
    36253244  UInt uiLeftPartIdx = 0;
     
    36293248  if (getAvailableFlagA1())
    36303249  {
    3631     m_mergCands[MRG_A1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    3632 #if H_3D_VSP
     3250    m_mergCands[MRG_A1].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
     3251#if NH_3D_VSP
    36333252    , (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
    3634 #if H_3D_IC
     3253#if NH_3D_IC
    36353254      && !bICFlag
    36363255#endif
    3637 #if H_3D_ARP
     3256#if NH_3D_ARP
    36383257      && !bARPFlag
    36393258#endif
    3640 #if H_3D_DBBP
     3259#if NH_3D_DBBP
    36413260      && !bDBBPFlag
    36423261#endif
    36433262      )
    36443263#endif
     3264#if NH_3D_SPIVMP
    36453265      , false
     3266#endif
    36463267      );
    3647     m_baseListidc++;
     3268    m_numSpatialCands++;
    36483269  }
    36493270
    36503271  // above
    3651 
    36523272  if (getAvailableFlagB1())
    36533273  {
    3654     m_mergCands[MRG_B1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    3655 #if H_3D_VSP
     3274    m_mergCands[MRG_B1].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
     3275#if NH_3D_VSP
    36563276    , false
    36573277#endif
     3278#if NH_3D_SPIVMP
    36583279      , false
     3280#endif
    36593281      );
    3660     m_baseListidc++;
     3282    m_numSpatialCands++;
    36613283  }
    36623284
    36633285  // above right
    3664 
    36653286  if (getAvailableFlagB0())
    36663287  {
    3667     m_mergCands[MRG_B0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    3668 #if H_3D_VSP
    3669     ,
    3670       false
    3671 #endif
     3288    m_mergCands[MRG_B0].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
     3289#if NH_3D_VSP
     3290    , false
     3291#endif
     3292#if NH_3D_SPIVMP
    36723293      , false
     3294#endif
    36733295      );
    3674     m_baseListidc++;
     3296    m_numSpatialCands++;
    36753297  }
    36763298
    36773299  // left bottom
    3678 
    36793300  if (getAvailableFlagA0())
    36803301  {
    3681     m_mergCands[MRG_A0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    3682 #if H_3D_VSP
     3302    m_mergCands[MRG_A0].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
     3303#if NH_3D_VSP
    36833304    , false
    36843305#endif
     3306#if NH_3D_SPIVMP
    36853307      , false
     3308#endif
    36863309      );
    3687     m_baseListidc++;
     3310    m_numSpatialCands++;
    36883311  }
    36893312
    36903313  // above left
    3691 
    36923314  if (getAvailableFlagB2())
    36933315  {
    3694     m_mergCands[MRG_B2].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    3695 #if H_3D_VSP
     3316    m_mergCands[MRG_B2].setCand( &pcMFieldNeighbours[m_numSpatialCands<<1], puhInterDirNeighbours[m_numSpatialCands]
     3317#if NH_3D_VSP
    36963318    , false
    36973319#endif
     3320#if NH_3D_SPIVMP
    36983321      , false
     3322#endif
    36993323      );
    3700     m_baseListidc++;
    3701   }
    3702 
    3703 #endif
    3704 
    3705 
    3706 #if H_3D_IV_MERGE
     3324    m_numSpatialCands++;
     3325  }
     3326
     3327
     3328#if NH_3D_TEXT_MERGE
    37073329
    37083330  /////////////////////////////////////////////
     
    37303352
    37313353      this->getPartIndexAndSize( uiPUIdx, uiPartAddr, iWidth, iHeight );
    3732       pcTexRec->getTopLeftSamplePos( this->getAddr(), this->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
     3354      pcTexRec->getTopLeftSamplePos( this->getCtuRsAddr(), this->getZorderIdxInCtu() + uiPartAddr, iCurrPosX, iCurrPosY );
    37333355
    37343356      Int iPUWidth, iPUHeight, iNumPart, iNumPartLine;
     
    37553377
    37563378      Int         iTexPosX, iTexPosY;
     3379#if NH_3D_INTEGER_MV_DEPTH
    37573380      const TComMv cMvRounding( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
    3758 
     3381#endif
    37593382      Int         iCenterPosX = iCurrPosX + ( ( iWidth /  iPUWidth ) >> 1 )  * iPUWidth + ( iPUWidth >> 1 );
    37603383      Int         iCenterPosY = iCurrPosY + ( ( iHeight /  iPUHeight ) >> 1 )  * iPUHeight + (iPUHeight >> 1);
     
    37703393
    37713394      pcTexRec->getCUAddrAndPartIdx( iCenterPosX , iCenterPosY , iTexCenterCUAddr, iTexCenterAbsPartIdx );
    3772       TComDataCU* pcDefaultCU    = pcTexPic->getCU( iTexCenterCUAddr );
     3395      TComDataCU* pcDefaultCU    = pcTexPic->getCtu( iTexCenterCUAddr );
    37733396
    37743397      if( pcDefaultCU->getPredictionMode( iTexCenterAbsPartIdx ) != MODE_INTRA )
     
    37893412              {
    37903413                bSPIVMPFlag = true;
     3414#if NH_3D_INTEGER_MV_DEPTH
    37913415                TComMv cMv = cDefaultMvField.getMv() + cMvRounding;
    37923416                cMv >>= 2;
     3417#else
     3418                TComMv cMv = cDefaultMvField.getMv();
     3419#endif
    37933420                cMvFieldSaved[eCurrRefPicList].setMvField(cMv, iRefPicList) ;
    37943421                break;
     
    38153442            iTexPosY     = i + iOffsetY;
    38163443            pcTexRec->getCUAddrAndPartIdx( iTexPosX, iTexPosY, iTexCUAddr, iTexAbsPartIdx );
    3817             pcTexCU  = pcTexPic->getCU( iTexCUAddr );
     3444            pcTexCU  = pcTexPic->getCtu( iTexCUAddr );
    38183445
    38193446            if( pcTexCU && !pcTexCU->isIntra(iTexAbsPartIdx) )
     
    38273454                if( (cTexMvField.getRefIdx()>=0) && ( iValidDepRef >= 0 ) )
    38283455                {
     3456#if NH_3D_INTEGER_MV_DEPTH
    38293457                  TComMv cMv = cTexMvField.getMv() + cMvRounding;
    38303458                  cMv >>=2;         
     3459#else
     3460                  TComMv cMv = cTexMvField.getMv();
     3461#endif         
    38313462                  pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iValidDepRef);
    38323463                }
     
    38473478          }
    38483479        }
    3849 #if H_3D
    3850       }
    3851 #endif
     3480      }
    38523481#if H_3D_FCO
    38533482    }
     
    38773506    }
    38783507  }
     3508#endif
     3509
     3510#if NH_3D_IV_MERGE
    38793511  /////////////////////////////////////////////////////////////////
    38803512  //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC  Candidates /////
     
    38943526  if ( ivMvPredFlag && cDisInfo.m_aVIdxCan!=-1)
    38953527  {
     3528#if NH_3D_IC
    38963529    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP, bICFlag );
     3530#else
     3531    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP, false );
     3532#endif
    38973533  } 
    38983534
     
    39503586        spiMvpFlag = true;
    39513587      }
    3952 #if H_3D_DBBP
     3588#if NH_3D_DBBP
    39533589      spiMvpFlag &= !bDBBPFlag;
    39543590#endif
     
    39713607#endif
    39723608
     3609  iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable;
     3610
     3611#if NH_3D_VSP
     3612  /////////////////////////////////////////////////
     3613  //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
     3614  /////////////////////////////////////////////////
     3615  if (iCount<getSlice()->getMaxNumMergeCand())
     3616  {
     3617    if (
     3618      (!getAvailableFlagA1() || !(pcCULeft->getVSPFlag(uiLeftPartIdx) != 0)) &&
     3619#if NH_3D_IC
     3620      !bICFlag &&
     3621#endif
     3622#if NH_3D_ARP
     3623      !bARPFlag &&
     3624#endif
    39733625#if H_3D
    3974   iCount += m_mergCands[MRG_A1].m_bAvailable + m_mergCands[MRG_B1].m_bAvailable;
     3626      (nPSW + nPSH > 12) &&
     3627#endif
     3628#if NH_3D_DBBP
     3629      !bDBBPFlag &&
     3630#endif
     3631      xAddVspCand( mrgCandIdx, &cDisInfo, iCount ) )
     3632    {
     3633      return;
     3634    }
     3635
     3636    // early termination
     3637    if (iCount == getSlice()->getMaxNumMergeCand())
     3638    {
     3639      return;
     3640    }
     3641  }
     3642#endif
     3643
     3644  iCount += m_mergCands[MRG_B0].m_bAvailable;
     3645
     3646#if NH_3D_IV_MERGE
     3647  /////////////////////////////////////////////
     3648  //////// INTER VIEW DISP COMP (IvDC) ////////
     3649  /////////////////////////////////////////////
     3650  if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
     3651  {
     3652    assert(iCount < getSlice()->getMaxNumMergeCand());
     3653
     3654    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     3655    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     3656    if( ( ivCandDir[1] & 1 ) == 1 )
     3657    {
     3658      tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
     3659    }
     3660    if( ( ivCandDir[1] & 2 ) == 2 )
     3661    {
     3662      tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
     3663    }
     3664
     3665    Bool bRemoveSpa = false; //pruning to A1, B1
     3666    for(Int i = 0; i < 2; i ++)
     3667    {
     3668      if ( !m_mergCands[MRG_A1+i].m_bAvailable )
     3669      {
     3670        continue;
     3671      }
     3672      if (ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])
     3673      {
     3674        bRemoveSpa                      = true;
     3675        break;
     3676      }     
     3677    }
     3678    if(!bRemoveSpa)
     3679    {
     3680#if NH_3D_NBDV
     3681      tmpMV[0].getMv().setIDVFlag (false);
     3682      tmpMV[1].getMv().setIDVFlag (false);
     3683#endif
     3684      m_mergCands[MRG_IVDC].setCand( tmpMV, ivCandDir[1], false, false);
     3685
     3686      if ( mrgCandIdx == iCount )
     3687        return;
     3688      iCount ++;
     3689
     3690      // early termination
     3691      if (iCount == getSlice()->getMaxNumMergeCand())
     3692      {
     3693        return;
     3694      }
     3695    }
     3696  }
     3697#endif // H_3D_IV_MERGE
     3698
     3699  iCount += m_mergCands[MRG_A0].m_bAvailable + m_mergCands[MRG_B2].m_bAvailable;
     3700
     3701#if NH_3D_IV_MERGE
     3702  ////////////////////////////////////////////////////
     3703  //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
     3704  ////////////////////////////////////////////////////
     3705  if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
     3706  {
     3707    if(xAddIvMRGCand( mrgCandIdx,  iCount, ivCandDir, ivCandMv, ivCandRefIdx ) )
     3708    {
     3709      return;
     3710    }
     3711    //early termination
     3712    if (iCount == getSlice()->getMaxNumMergeCand())
     3713    {
     3714      return;
     3715    }
     3716  }
     3717#endif
     3718}
     3719#endif
     3720
     3721//! Construct a list of merging candidates
     3722Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     3723{
     3724  UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx;
     3725#if NH_3D_MLC
     3726  Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
    39753727#else
     3728  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
     3729#endif
     3730  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
     3731  {
     3732    abCandIsInter[ui] = false;
     3733    pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
     3734    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
     3735  }
     3736  numValidMergeCand = getSlice()->getMaxNumMergeCand();
     3737  // compute the location of the current PU
     3738  Int xP, yP, nPSW, nPSH;
     3739  this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
     3740
     3741  Int iCount = 0;
     3742
     3743  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
     3744  PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
     3745  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
     3746  deriveLeftBottomIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
     3747
    39763748  //left
    39773749  UInt uiLeftPartIdx = 0;
    39783750  TComDataCU* pcCULeft = 0;
    39793751  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
     3752
    39803753  Bool isAvailableA1 = pcCULeft &&
    3981     pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
    3982     !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
    3983     !pcCULeft->isIntra( uiLeftPartIdx ) ;
     3754                       pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
     3755                       !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
     3756                       pcCULeft->isInter( uiLeftPartIdx ) ;
     3757
    39843758  if ( isAvailableA1 )
    39853759  {
     3760#if NH_3D_MLC
     3761    m_bAvailableFlagA1 = 1;
     3762#endif
    39863763    abCandIsInter[iCount] = true;
    39873764    // get Inter Dir
     
    39933770      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    39943771    }
    3995 
    39963772    if ( mrgCandIdx == iCount )
    39973773    {
     
    40023778
    40033779  // early termination
    4004   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3780  if (iCount == getSlice()->getMaxNumMergeCand())
    40053781  {
    40063782    return;
    40073783  }
    4008 
    40093784  // above
    40103785  UInt uiAbovePartIdx = 0;
    40113786  TComDataCU* pcCUAbove = 0;
    40123787  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
     3788
    40133789  Bool isAvailableB1 = pcCUAbove &&
    4014     pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
    4015     !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
    4016     !pcCUAbove->isIntra( uiAbovePartIdx );
     3790                       pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
     3791                       !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
     3792                       pcCUAbove->isInter( uiAbovePartIdx );
     3793
    40173794  if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    40183795  {
     3796#if NH_3D_MLC
     3797    m_bAvailableFlagB1 = 1;
     3798#endif
    40193799    abCandIsInter[iCount] = true;
    40203800    // get Inter Dir
     
    40263806      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    40273807    }
    4028 
    40293808    if ( mrgCandIdx == iCount )
    40303809    {
     
    40343813  }
    40353814  // early termination
    4036   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3815  if (iCount == getSlice()->getMaxNumMergeCand())
    40373816  {
    40383817    return;
     
    40433822  TComDataCU* pcCUAboveRight = 0;
    40443823  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
     3824
    40453825  Bool isAvailableB0 = pcCUAboveRight &&
    4046     pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
    4047     !pcCUAboveRight->isIntra( uiAboveRightPartIdx );
     3826                       pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
     3827                       pcCUAboveRight->isInter( uiAboveRightPartIdx );
     3828
    40483829  if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    40493830  {
     3831#if NH_3D_MLC
     3832    m_bAvailableFlagB0 = 1;
     3833#endif
    40503834    abCandIsInter[iCount] = true;
    40513835    // get Inter Dir
     
    40573841      pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    40583842    }
    4059 
    40603843    if ( mrgCandIdx == iCount )
    40613844    {
     
    40653848  }
    40663849  // early termination
    4067   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3850  if (iCount == getSlice()->getMaxNumMergeCand())
    40683851  {
    40693852    return;
    40703853  }
    4071 #endif
    4072 
    4073 
    4074 #if H_3D_VSP
    4075   /////////////////////////////////////////////////
    4076   //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
    4077   /////////////////////////////////////////////////
    4078   if (iCount<getSlice()->getMaxNumMergeCand())
    4079   {
    4080     if (
    4081       (!getAvailableFlagA1() || !(pcCULeft->getVSPFlag(uiLeftPartIdx) != 0)) &&
    4082 #if H_3D_IC
    4083       !bICFlag &&
    4084 #endif
    4085 #if H_3D_ARP
    4086       !bARPFlag &&
    4087 #endif
    4088 #if H_3D
    4089       (nPSW + nPSH > 12) &&
    4090 #endif
    4091 #if H_3D_DBBP
    4092       !bDBBPFlag &&
    4093 #endif
    4094       xAddVspCand( mrgCandIdx, &cDisInfo, iCount ) )
    4095     {
    4096       return;
    4097     }
    4098 
    4099     // early termination
    4100     if (iCount == getSlice()->getMaxNumMergeCand())
    4101     {
    4102       return;
    4103     }
    4104 #endif
    4105 #if H_3D_VSP
    4106   }
    4107 #endif
    4108 
    4109 #if H_3D
    4110   iCount += m_mergCands[MRG_B0].m_bAvailable;
    4111 #endif
    4112 
    4113 
    4114 #if H_3D_IV_MERGE
    4115   /////////////////////////////////////////////
    4116   //////// INTER VIEW DISP COMP (IvDC) ////////
    4117   /////////////////////////////////////////////
    4118   if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
    4119   {
    4120     assert(iCount < getSlice()->getMaxNumMergeCand());
    4121 
    4122     tmpMV[0].setMvField( cZeroMv, NOT_VALID );
    4123     tmpMV[1].setMvField( cZeroMv, NOT_VALID );
    4124     if( ( ivCandDir[1] & 1 ) == 1 )
    4125     {
    4126       tmpMV[0].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
    4127     }
    4128     if( ( ivCandDir[1] & 2 ) == 2 )
    4129     {
    4130       tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
    4131     }
    4132 
    4133     Bool bRemoveSpa = false; //pruning to A1, B1
    4134     for(Int i = 0; i < 2; i ++)
    4135     {
    4136       if ( !m_mergCands[MRG_A1+i].m_bAvailable )
    4137       {
    4138         continue;
    4139       }
    4140       if (ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])
    4141       {
    4142         bRemoveSpa                      = true;
    4143         break;
    4144       }     
    4145     }
    4146     if(!bRemoveSpa)
    4147     {
    4148 #if H_3D_NBDV
    4149       tmpMV[0].getMv().setIDVFlag (false);
    4150       tmpMV[1].getMv().setIDVFlag (false);
    4151 #endif
    4152       m_mergCands[MRG_IVDC].setCand( tmpMV, ivCandDir[1], false, false);
    4153 
    4154       if ( mrgCandIdx == iCount )
    4155         return;
    4156       iCount ++;
    4157 
    4158       // early termination
    4159       if (iCount == getSlice()->getMaxNumMergeCand())
    4160       {
    4161         return;
    4162       }
    4163     }
    4164   }
    4165 #endif // H_3D_IV_MERGE
    4166 
    4167 
    4168 #if H_3D
    4169   iCount += m_mergCands[MRG_A0].m_bAvailable + m_mergCands[MRG_B2].m_bAvailable;
    4170 #else
     3854
    41713855  //left bottom
    41723856  UInt uiLeftBottomPartIdx = 0;
    41733857  TComDataCU* pcCULeftBottom = 0;
    41743858  pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
     3859
    41753860  Bool isAvailableA0 = pcCULeftBottom &&
    4176   pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
    4177   !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ;
     3861                       pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
     3862                       pcCULeftBottom->isInter( uiLeftBottomPartIdx ) ;
     3863
    41783864  if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    41793865  {
     3866#if NH_3D_MLC
     3867    m_bAvailableFlagA0 = 1;
     3868#endif
    41803869    abCandIsInter[iCount] = true;
    41813870    // get Inter Dir
     
    41943883  }
    41953884  // early termination
    4196   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3885  if (iCount == getSlice()->getMaxNumMergeCand())
    41973886  {
    41983887    return;
    41993888  }
    42003889
    4201   // above left 
     3890  // above left
    42023891  if( iCount < 4 )
    42033892  {
     
    42053894    TComDataCU* pcCUAboveLeft = 0;
    42063895    pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
     3896
    42073897    Bool isAvailableB2 = pcCUAboveLeft &&
    4208     pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
    4209     !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx );
     3898                         pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
     3899                         pcCUAboveLeft->isInter( uiAboveLeftPartIdx );
     3900
    42103901    if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    42113902        && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) )
    42123903    {
     3904#if NH_3D_MLC
     3905      m_bAvailableFlagB2 = 1;
     3906#endif
    42133907      abCandIsInter[iCount] = true;
    42143908      // get Inter Dir
     
    42283922  }
    42293923  // early termination
    4230   if (iCount == getSlice()->getMaxNumMergeCand()) 
     3924  if (iCount == getSlice()->getMaxNumMergeCand())
    42313925  {
    42323926    return;
    42333927  }
    4234 #endif
    4235 
    4236 
    4237 #if H_3D_IV_MERGE
    4238   ////////////////////////////////////////////////////
    4239   //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
    4240   ////////////////////////////////////////////////////
    4241   if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
    4242   {
    4243     if(xAddIvMRGCand( mrgCandIdx,  iCount, ivCandDir, ivCandMv, ivCandRefIdx ) )
    4244     {
    4245       return;
    4246     }
    4247     //early termination
    4248     if (iCount == getSlice()->getMaxNumMergeCand())
    4249     {
    4250       return;
    4251     }
    4252   }
    4253 #endif
    4254 #if !H_3D
    4255   if ( getSlice()->getEnableTMVPFlag())
     3928
     3929  if ( getSlice()->getEnableTMVPFlag() )
    42563930  {
    42573931    //>> MTK colocated-RightBottom
    42583932    UInt uiPartIdxRB;
    42593933
    4260     deriveRightBottomIdx( uiPUIdx, uiPartIdxRB ); 
     3934    deriveRightBottomIdx( uiPUIdx, uiPartIdxRB );
    42613935
    42623936    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    4263     UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     3937    const UInt numPartInCtuWidth  = m_pcPic->getNumPartInCtuWidth();
     3938    const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight();
    42643939
    42653940    TComMv cColMv;
    42663941    Int iRefIdx;
    4267     Int uiLCUIdx = -1;
    4268 
    4269     if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
    4270     {
    4271     }
    4272     else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    4273     {
    4274     }
    4275     else
    4276     {
    4277       if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    4278         ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
    4279       {
    4280         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
    4281         uiLCUIdx = getAddr();
    4282       }
    4283       else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
    4284       {
    4285         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
    4286       }
    4287       else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     3942    Int ctuRsAddr = -1;
     3943
     3944    if (   ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () )  // image boundary check
     3945        && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     3946    {
     3947      if ( ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 ) &&           // is not at the last column of CTU
     3948        ( uiAbsPartIdxTmp / numPartInCtuWidth < numPartInCtuHeight - 1 ) )              // is not at the last row    of CTU
     3949      {
     3950        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + numPartInCtuWidth + 1 ];
     3951        ctuRsAddr = getCtuRsAddr();
     3952      }
     3953      else if ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 )           // is not at the last column of CTU But is last row of CTU
     3954      {
     3955        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];
     3956      }
     3957      else if ( uiAbsPartIdxTmp / numPartInCtuWidth < numPartInCtuHeight - 1 )          // is not at the last row of CTU But is last column of CTU
    42883958      {
    42893959        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    4290         uiLCUIdx = getAddr() + 1;
    4291       }
    4292       else //is the right bottom corner of LCU                       
     3960        ctuRsAddr = getCtuRsAddr() + 1;
     3961      }
     3962      else //is the right bottom corner of CTU
    42933963      {
    42943964        uiAbsPartAddr = 0;
    42953965      }
    42963966    }
    4297    
    4298    
     3967
    42993968    iRefIdx = 0;
     3969
    43003970    Bool bExistMV = false;
    43013971    UInt uiPartIdxCenter;
    4302     UInt uiCurLCUIdx = getAddr();
    43033972    Int dir = 0;
    43043973    UInt uiArrayAddr = iCount;
    43053974    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );
    4306     bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_0, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx );
     3975    bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_0, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx );
    43073976    if( bExistMV == false )
    43083977    {
    4309       bExistMV = xGetColMVP( REF_PIC_LIST_0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
     3978      bExistMV = xGetColMVP( REF_PIC_LIST_0, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx );
    43103979    }
    43113980    if( bExistMV )
     
    43173986    if ( getSlice()->isInterB() )
    43183987    {
    4319       bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
     3988#if NH_3D_TMVP
     3989      iRefIdx = 0;
     3990#endif
     3991      bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_1, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx);
    43203992      if( bExistMV == false )
    43213993      {
    4322         bExistMV = xGetColMVP( REF_PIC_LIST_1, uiCurLCUIdx, uiPartIdxCenter, cColMv, iRefIdx );
     3994        bExistMV = xGetColMVP( REF_PIC_LIST_1, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx );
    43233995      }
    43243996      if( bExistMV )
     
    43284000      }
    43294001    }
    4330    
     4002
    43314003    if (dir != 0)
    43324004    {
    43334005      puhInterDirNeighbours[uiArrayAddr] = dir;
    43344006      abCandIsInter[uiArrayAddr] = true;
     4007#if NH_3D_NBDV
     4008      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     4009      pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
     4010#endif
     4011
    43354012      if ( mrgCandIdx == iCount )
    43364013      {
     
    43404017    }
    43414018  }
    4342   // early termination 
    4343   if (iCount == getSlice()->getMaxNumMergeCand()) 
     4019  // early termination
     4020  if (iCount == getSlice()->getMaxNumMergeCand())
    43444021  {
    43454022    return;
    43464023  }
     4024
    43474025  UInt uiArrayAddr = iCount;
    43484026  UInt uiCutoff = uiArrayAddr;
    4349    
    4350   if ( getSlice()->isInterB())
    4351   {
    4352     UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    4353     UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
     4027
     4028#if NH_3D_MLC
     4029  if ( getSlice()->isInterB() && iCount<5)
     4030#else
     4031  if ( getSlice()->isInterB() )
     4032#endif
     4033  {
     4034    static const UInt NUM_PRIORITY_LIST=12;
     4035    static const UInt uiPriorityList0[NUM_PRIORITY_LIST] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
     4036    static const UInt uiPriorityList1[NUM_PRIORITY_LIST] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
    43544037
    43554038    for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
    43564039    {
    4357       Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
     4040      assert(idx<NUM_PRIORITY_LIST);
     4041      Int i = uiPriorityList0[idx];
     4042      Int j = uiPriorityList1[idx];
    43584043      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
    43594044      {
     
    43794064  }
    43804065  // early termination
    4381   if (uiArrayAddr == getSlice()->getMaxNumMergeCand()) 
     4066  if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
    43824067  {
    43834068    return;
    43844069  }
     4070
    43854071  Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
     4072
    43864073  Int r = 0;
    43874074  Int refcnt = 0;
     
    43984085    }
    43994086    uiArrayAddr++;
     4087
    44004088    if ( refcnt == iNumRefIdx - 1 )
    44014089    {
     
    44084096    }
    44094097  }
    4410 
    44114098  numValidMergeCand = uiArrayAddr;
    4412 #endif
    4413 }
    4414 #else
    4415 
    4416 //! Construct a list of merging candidates
    4417 Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
    4418 {
    4419   UInt uiAbsPartAddr = m_absZIdxInCtu + uiAbsPartIdx;
    4420   Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    4421   for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
    4422   {
    4423     abCandIsInter[ui] = false;
    4424     pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
    4425     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
    4426   }
    4427   numValidMergeCand = getSlice()->getMaxNumMergeCand();
    4428   // compute the location of the current PU
    4429   Int xP, yP, nPSW, nPSH;
    4430   this->getPartPosition(uiPUIdx, xP, yP, nPSW, nPSH);
    4431 
    4432   Int iCount = 0;
    4433 
    4434   UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    4435   PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
    4436   deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    4437   deriveLeftBottomIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    4438 
    4439   //left
    4440   UInt uiLeftPartIdx = 0;
    4441   TComDataCU* pcCULeft = 0;
    4442   pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
    4443 
    4444   Bool isAvailableA1 = pcCULeft &&
    4445                        pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
    4446                        !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
    4447                        pcCULeft->isInter( uiLeftPartIdx ) ;
    4448 
    4449   if ( isAvailableA1 )
    4450   {
    4451     abCandIsInter[iCount] = true;
    4452     // get Inter Dir
    4453     puhInterDirNeighbours[iCount] = pcCULeft->getInterDir( uiLeftPartIdx );
    4454     // get Mv from Left
    4455     pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4456     if ( getSlice()->isInterB() )
    4457     {
    4458       pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4459     }
    4460     if ( mrgCandIdx == iCount )
    4461     {
    4462       return;
    4463     }
    4464     iCount ++;
    4465   }
    4466 
    4467   // early termination
    4468   if (iCount == getSlice()->getMaxNumMergeCand())
    4469   {
    4470     return;
    4471   }
    4472   // above
    4473   UInt uiAbovePartIdx = 0;
    4474   TComDataCU* pcCUAbove = 0;
    4475   pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
    4476 
    4477   Bool isAvailableB1 = pcCUAbove &&
    4478                        pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
    4479                        !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
    4480                        pcCUAbove->isInter( uiAbovePartIdx );
    4481 
    4482   if ( isAvailableB1 && (!isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
    4483   {
    4484     abCandIsInter[iCount] = true;
    4485     // get Inter Dir
    4486     puhInterDirNeighbours[iCount] = pcCUAbove->getInterDir( uiAbovePartIdx );
    4487     // get Mv from Left
    4488     pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4489     if ( getSlice()->isInterB() )
    4490     {
    4491       pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4492     }
    4493     if ( mrgCandIdx == iCount )
    4494     {
    4495       return;
    4496     }
    4497     iCount ++;
    4498   }
    4499   // early termination
    4500   if (iCount == getSlice()->getMaxNumMergeCand())
    4501   {
    4502     return;
    4503   }
    4504 
    4505   // above right
    4506   UInt uiAboveRightPartIdx = 0;
    4507   TComDataCU* pcCUAboveRight = 0;
    4508   pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
    4509 
    4510   Bool isAvailableB0 = pcCUAboveRight &&
    4511                        pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
    4512                        pcCUAboveRight->isInter( uiAboveRightPartIdx );
    4513 
    4514   if ( isAvailableB0 && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    4515   {
    4516     abCandIsInter[iCount] = true;
    4517     // get Inter Dir
    4518     puhInterDirNeighbours[iCount] = pcCUAboveRight->getInterDir( uiAboveRightPartIdx );
    4519     // get Mv from Left
    4520     pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4521     if ( getSlice()->isInterB() )
    4522     {
    4523       pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4524     }
    4525     if ( mrgCandIdx == iCount )
    4526     {
    4527       return;
    4528     }
    4529     iCount ++;
    4530   }
    4531   // early termination
    4532   if (iCount == getSlice()->getMaxNumMergeCand())
    4533   {
    4534     return;
    4535   }
    4536 
    4537   //left bottom
    4538   UInt uiLeftBottomPartIdx = 0;
    4539   TComDataCU* pcCULeftBottom = 0;
    4540   pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
    4541 
    4542   Bool isAvailableA0 = pcCULeftBottom &&
    4543                        pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
    4544                        pcCULeftBottom->isInter( uiLeftBottomPartIdx ) ;
    4545 
    4546   if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    4547   {
    4548     abCandIsInter[iCount] = true;
    4549     // get Inter Dir
    4550     puhInterDirNeighbours[iCount] = pcCULeftBottom->getInterDir( uiLeftBottomPartIdx );
    4551     // get Mv from Left
    4552     pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4553     if ( getSlice()->isInterB() )
    4554     {
    4555       pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4556     }
    4557     if ( mrgCandIdx == iCount )
    4558     {
    4559       return;
    4560     }
    4561     iCount ++;
    4562   }
    4563   // early termination
    4564   if (iCount == getSlice()->getMaxNumMergeCand())
    4565   {
    4566     return;
    4567   }
    4568 
    4569   // above left
    4570   if( iCount < 4 )
    4571   {
    4572     UInt uiAboveLeftPartIdx = 0;
    4573     TComDataCU* pcCUAboveLeft = 0;
    4574     pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
    4575 
    4576     Bool isAvailableB2 = pcCUAboveLeft &&
    4577                          pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
    4578                          pcCUAboveLeft->isInter( uiAboveLeftPartIdx );
    4579 
    4580     if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    4581         && ( !isAvailableB1 || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) ) )
    4582     {
    4583       abCandIsInter[iCount] = true;
    4584       // get Inter Dir
    4585       puhInterDirNeighbours[iCount] = pcCUAboveLeft->getInterDir( uiAboveLeftPartIdx );
    4586       // get Mv from Left
    4587       pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4588       if ( getSlice()->isInterB() )
    4589       {
    4590         pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4591       }
    4592       if ( mrgCandIdx == iCount )
    4593       {
    4594         return;
    4595       }
    4596       iCount ++;
    4597     }
    4598   }
    4599   // early termination
    4600   if (iCount == getSlice()->getMaxNumMergeCand())
    4601   {
    4602     return;
    4603   }
    4604 
    4605   if ( getSlice()->getEnableTMVPFlag() )
    4606   {
    4607     //>> MTK colocated-RightBottom
    4608     UInt uiPartIdxRB;
    4609 
    4610     deriveRightBottomIdx( uiPUIdx, uiPartIdxRB );
    4611 
    4612     UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    4613     const UInt numPartInCtuWidth  = m_pcPic->getNumPartInCtuWidth();
    4614     const UInt numPartInCtuHeight = m_pcPic->getNumPartInCtuHeight();
    4615 
    4616     TComMv cColMv;
    4617     Int iRefIdx;
    4618     Int ctuRsAddr = -1;
    4619 
    4620     if (   ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () )  // image boundary check
    4621         && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
    4622     {
    4623       if ( ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 ) &&           // is not at the last column of CTU
    4624         ( uiAbsPartIdxTmp / numPartInCtuWidth < numPartInCtuHeight - 1 ) )              // is not at the last row    of CTU
    4625       {
    4626         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + numPartInCtuWidth + 1 ];
    4627         ctuRsAddr = getCtuRsAddr();
    4628       }
    4629       else if ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 )           // is not at the last column of CTU But is last row of CTU
    4630       {
    4631         uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + numPartInCtuWidth + 1) % m_pcPic->getNumPartitionsInCtu() ];
    4632       }
    4633       else if ( uiAbsPartIdxTmp / numPartInCtuWidth < numPartInCtuHeight - 1 )          // is not at the last row of CTU But is last column of CTU
    4634       {
    4635         uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
    4636         ctuRsAddr = getCtuRsAddr() + 1;
    4637       }
    4638       else //is the right bottom corner of CTU
    4639       {
    4640         uiAbsPartAddr = 0;
    4641       }
    4642     }
    4643 
    4644     iRefIdx = 0;
    4645 
    4646     Bool bExistMV = false;
    4647     UInt uiPartIdxCenter;
    4648     Int dir = 0;
    4649     UInt uiArrayAddr = iCount;
    4650     xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );
    4651     bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_0, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx );
    4652     if( bExistMV == false )
    4653     {
    4654       bExistMV = xGetColMVP( REF_PIC_LIST_0, getCtuRsAddr(), uiPartIdxCenter,  cColMv, iRefIdx );
    4655     }
    4656     if( bExistMV )
    4657     {
    4658       dir |= 1;
    4659       pcMvFieldNeighbours[ 2 * uiArrayAddr ].setMvField( cColMv, iRefIdx );
    4660     }
    4661 
    4662     if ( getSlice()->isInterB() )
    4663     {
    4664       bExistMV = ctuRsAddr >= 0 && xGetColMVP( REF_PIC_LIST_1, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx);
    4665       if( bExistMV == false )
    4666       {
    4667         bExistMV = xGetColMVP( REF_PIC_LIST_1, getCtuRsAddr(), uiPartIdxCenter, cColMv, iRefIdx );
    4668       }
    4669       if( bExistMV )
    4670       {
    4671         dir |= 2;
    4672         pcMvFieldNeighbours[ 2 * uiArrayAddr + 1 ].setMvField( cColMv, iRefIdx );
    4673       }
    4674     }
    4675 
    4676     if (dir != 0)
    4677     {
    4678       puhInterDirNeighbours[uiArrayAddr] = dir;
    4679       abCandIsInter[uiArrayAddr] = true;
    4680 
    4681       if ( mrgCandIdx == iCount )
    4682       {
    4683         return;
    4684       }
    4685       iCount++;
    4686     }
    4687   }
    4688   // early termination
    4689   if (iCount == getSlice()->getMaxNumMergeCand())
    4690   {
    4691     return;
    4692   }
    4693 
    4694   UInt uiArrayAddr = iCount;
    4695   UInt uiCutoff = uiArrayAddr;
    4696 
    4697   if ( getSlice()->isInterB() )
    4698   {
    4699     static const UInt NUM_PRIORITY_LIST=12;
    4700     static const UInt uiPriorityList0[NUM_PRIORITY_LIST] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    4701     static const UInt uiPriorityList1[NUM_PRIORITY_LIST] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
    4702 
    4703     for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
    4704     {
    4705       assert(idx<NUM_PRIORITY_LIST);
    4706       Int i = uiPriorityList0[idx];
    4707       Int j = uiPriorityList1[idx];
    4708       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
    4709       {
    4710         abCandIsInter[uiArrayAddr] = true;
    4711         puhInterDirNeighbours[uiArrayAddr] = 3;
    4712 
    4713         // get Mv from cand[i] and cand[j]
    4714         pcMvFieldNeighbours[uiArrayAddr << 1].setMvField(pcMvFieldNeighbours[i<<1].getMv(), pcMvFieldNeighbours[i<<1].getRefIdx());
    4715         pcMvFieldNeighbours[( uiArrayAddr << 1 ) + 1].setMvField(pcMvFieldNeighbours[(j<<1)+1].getMv(), pcMvFieldNeighbours[(j<<1)+1].getRefIdx());
    4716 
    4717         Int iRefPOCL0 = m_pcSlice->getRefPOC( REF_PIC_LIST_0, pcMvFieldNeighbours[(uiArrayAddr<<1)].getRefIdx() );
    4718         Int iRefPOCL1 = m_pcSlice->getRefPOC( REF_PIC_LIST_1, pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getRefIdx() );
    4719         if (iRefPOCL0 == iRefPOCL1 && pcMvFieldNeighbours[(uiArrayAddr<<1)].getMv() == pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv())
    4720         {
    4721           abCandIsInter[uiArrayAddr] = false;
    4722         }
    4723         else
    4724         {
    4725           uiArrayAddr++;
    4726         }
    4727       }
    4728     }
    4729   }
    4730   // early termination
    4731   if (uiArrayAddr == getSlice()->getMaxNumMergeCand())
    4732   {
    4733     return;
    4734   }
    4735 
    4736   Int iNumRefIdx = (getSlice()->isInterB()) ? min(m_pcSlice->getNumRefIdx(REF_PIC_LIST_0), m_pcSlice->getNumRefIdx(REF_PIC_LIST_1)) : m_pcSlice->getNumRefIdx(REF_PIC_LIST_0);
    4737 
    4738   Int r = 0;
    4739   Int refcnt = 0;
    4740   while (uiArrayAddr < getSlice()->getMaxNumMergeCand())
    4741   {
    4742     abCandIsInter[uiArrayAddr] = true;
    4743     puhInterDirNeighbours[uiArrayAddr] = 1;
    4744     pcMvFieldNeighbours[uiArrayAddr << 1].setMvField( TComMv(0, 0), r);
    4745 
    4746     if ( getSlice()->isInterB() )
    4747     {
    4748       puhInterDirNeighbours[uiArrayAddr] = 3;
    4749       pcMvFieldNeighbours[(uiArrayAddr << 1) + 1].setMvField(TComMv(0, 0), r);
    4750     }
    4751     uiArrayAddr++;
    4752 
    4753     if ( refcnt == iNumRefIdx - 1 )
    4754     {
    4755       r = 0;
    4756     }
    4757     else
    4758     {
    4759       ++r;
    4760       ++refcnt;
    4761     }
    4762   }
    4763   numValidMergeCand = uiArrayAddr;
    4764 }
    4765 #endif
     4099}
    47664100
    47674101/** Check whether the current PU and a spatial neighboring PU are in a same ME region.
     
    49784312    }
    49794313    if ( ctuRsAddr >= 0 && xGetColMVP( eRefPicList, ctuRsAddr, uiAbsPartAddr, cColMv, iRefIdx_Col
    4980 #if H_3D_TMVP
     4314#if NH_3D_TMVP
    49814315         , 0
    49824316#endif
     
    49904324      xDeriveCenterIdx( uiPartIdx, uiPartIdxCenter );
    49914325      if (xGetColMVP( eRefPicList, getCtuRsAddr(), uiPartIdxCenter,  cColMv, iRefIdx_Col
    4992 #if H_3D_TMVP
     4326#if NH_3D_TMVP
    49934327         , 0
    49944328#endif
     
    50214355  UInt partAddr;
    50224356
    5023 #if H_3D_DBBP
     4357#if NH_3D_DBBP
    50244358  if( getDBBPFlag(0) )
    50254359  {
     
    50414375  const TComSPS &sps=*(m_pcSlice->getSPS());
    50424376  Int  iMvShift = 2;
    5043 #if H_3D_IC
     4377#if NH_3D_INTEGER_MV_DEPTH
    50444378  if( getSlice()->getIsDepth() )
    50454379    iMvShift = 0;
     
    51144448  return ( getSkipFlag( uiPartIdx ) );
    51154449}
    5116 
    5117 #if H_3D_IC
    5118 Bool TComDataCU::isIC( UInt uiPartIdx )
    5119 {
    5120     if ( m_pcSlice->isIntra () )
    5121     {
    5122         return false;
    5123     }
    5124     return ( ( getSkipFlag(uiPartIdx) || getPredictionMode(uiPartIdx) == MODE_INTER) && getICFlag( uiPartIdx ) && isICFlagRequired( uiPartIdx ) );
    5125 }
    5126 #endif
    51274450
    51284451// ====================================================================================================================
     
    53424665
    53434666Bool TComDataCU::xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
    5344 #if H_3D_TMVP
     4667#if NH_3D_TMVP
    53454668  , Bool bMRG
    53464669#endif
     
    53944717  if ( bIsCurrRefLongTerm != bIsColRefLongTerm )
    53954718  {
    5396 #if H_3D_TMVP
     4719#if NH_3D_TMVP
    53974720    Int iAlterRefIdx  = m_pcSlice->getAlterRefIdx(eRefPicList);
    53984721    if(bMRG && iAlterRefIdx > 0)
     
    54074730#endif
    54084731    return false;
    5409 #if H_3D_TMVP
     4732#if NH_3D_TMVP
    54104733    }
    54114734#endif
     
    54144737  if ( bIsCurrRefLongTerm || bIsColRefLongTerm )
    54154738  {
    5416 #if H_3D_TMVP
     4739#if NH_3D_TMVP
    54174740    Int iCurrViewId    = m_pcSlice->getViewId ();
    54184741    Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewId ();
    5419     Int iColViewId     = pColCU->getSlice()->getViewId();
    5420     Int iColRefViewId  = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewId();
     4742    Int iColViewId     = pColCtu->getSlice()->getViewId();
     4743    Int iColRefViewId  = pColCtu->getSlice()->getRefPic( eColRefPicList, pColCtu->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewId();
    54214744    iScale = 4096;
    54224745    if ( iCurrRefViewId != iCurrViewId && iColViewId != iColRefViewId )
     
    54324755#endif
    54334756    rcMv = cColMv;
    5434 #if H_3D_TMVP
     4757#if NH_3D_TMVP
    54354758    }
    54364759#endif
     
    55754898#endif
    55764899
    5577 #if H_3D_IV_MERGE
     4900#if NH_3D_IV_MERGE
    55784901Void TComDataCU::getDispforDepth (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
    55794902{
     
    55854908    Int iViewIdx = getSlice()->getDefaultRefViewIdx();
    55864909    pDisp->m_aVIdxCan = iViewIdx;
    5587     Int iDisp     = getSlice()->getDepthToDisparityB( iViewIdx )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ];
     4910    Int iDisp     = getSlice()->getDepthToDisparityB( iViewIdx )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 1 )) ];
    55884911
    55894912    cMv.setHor(iDisp);
     
    56544977}
    56554978#endif
    5656 #if H_3D_NBDV
     4979#if NH_3D_NBDV
    56574980//Notes from QC:
    5658 //TBD#1: DoNBDV related contributions are just partially integrated under the marco of H_3D_NBDV_REF, remove this comment once DoNBDV and BVSP are done
     4981//TBD#1: DoNBDV related contributions are just partially integrated under the marco of NH_3D_NBDV_REF, remove this comment once DoNBDV and BVSP are done
    56594982//TBD#2: set of DvMCP values need to be done as part of inter-view motion prediction process. Remove this comment once merge related integration is done
    56604983//To be checked: Parallel Merge features for NBDV, related to DV_DERIVATION_PARALLEL_B0096 and LGE_IVMP_PARALLEL_MERGE_B0136 are not integrated. The need of these features due to the adoption of CU-based NBDV is not clear. We need confirmation on this, especially by proponents
    56614984Void TComDataCU::getDisMvpCandNBDV( DisInfo* pDInfo
    5662 #if H_3D_NBDV_REF
     4985#if NH_3D_NBDV_REF
    56634986, Bool bDepthRefine
    56644987#endif
     
    56835006    }
    56845007  }
    5685 #if H_3D_NBDV_REF
     5008#if NH_3D_NBDV_REF
    56865009  if( !m_pcSlice->getDepthRefinementFlag( ) )
    56875010  {
     
    57065029    ///*** Derive center position ***
    57075030    UInt uiPartIdxCenter;
    5708     Int  uiLCUIdx   = getAddr();
     5031    Int  uiLCUIdx = getCtuRsAddr();
    57095032    xDeriveCenterIdx(uiPartIdx, uiPartIdxCenter );
    57105033
     
    57335056        pDInfo->m_aVIdxCan  = iTargetViewIdx;
    57345057
    5735 #if H_3D_NBDV_REF
     5058#if NH_3D_NBDV_REF
    57365059        TComPic* picDepth = NULL;   
    57375060#if H_3D_FCO_VSP_DONBDV_E0163
     
    57555078        }
    57565079        pDInfo->m_acDoNBDV  = cColMv;
    5757 #endif //H_3D_NBDV_REF
     5080#endif //NH_3D_NBDV_REF
    57585081        return;
    57595082      }
     
    57695092  bCheckMcpDv = true;
    57705093  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFT
    5771 #if H_3D_NBDV_REF
     5094#if NH_3D_NBDV_REF
    57725095    , bDepthRefine
    57735096#endif
     
    57795102  if(pcTmpCU != NULL )
    57805103  {
    5781     bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
     5104    bCheckMcpDv = ( ( getCtuRsAddr() - pcTmpCU->getCtuRsAddr() ) == 0);
    57825105    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVE
    5783 #if H_3D_NBDV_REF
     5106#if NH_3D_NBDV_REF
    57845107      , bDepthRefine
    57855108#endif
     
    58005123          pDInfo->m_acNBDV = cDispVec;
    58015124          pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ];
    5802 #if H_3D_NBDV_REF
     5125#if NH_3D_NBDV_REF
    58035126#if H_3D_FCO_VSP_DONBDV_E0163
    58045127          TComPic* picDepth  = NULL;
     
    58385161    pDInfo->m_aVIdxCan = getSlice()->getDefaultRefViewIdx();
    58395162
    5840 #if H_3D_NBDV_REF
     5163#if NH_3D_NBDV_REF
    58415164    TComPic* picDepth = NULL;
    58425165#if H_3D_FCO_VSP_DONBDV_E0163
     
    58645187}
    58655188
    5866 #if H_3D_NBDV_REF
     5189#if NH_3D_NBDV_REF
    58675190Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iBlkWidth, Int iBlkHeight, Int* aiShiftLUT )
    58685191{
    5869   Int iPictureWidth  = pcBaseViewDepthPicYuv->getWidth();
    5870   Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight();
    5871  
     5192  Int iPictureWidth  = pcBaseViewDepthPicYuv->getWidth(COMPONENT_Y);
     5193  Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight(COMPONENT_Y);
     5194
    58725195  Int depthStartPosX = Clip3(0,   iPictureWidth - 1,  iBlkX + ((mv->getHor()+2)>>2));
    58735196  Int depthStartPosY = Clip3(0,   iPictureHeight - 1, iBlkY + ((mv->getVer()+2)>>2));
     
    58755198  Int depthEndPosY   = Clip3(0,   iPictureHeight - 1, iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2));
    58765199
    5877   Pel* depthTL  = pcBaseViewDepthPicYuv->getLumaAddr();
    5878   Int depStride =  pcBaseViewDepthPicYuv->getStride();
     5200  Pel* depthTL  = pcBaseViewDepthPicYuv->getAddr(COMPONENT_Y);
     5201  Int depStride =  pcBaseViewDepthPicYuv->getStride(COMPONENT_Y);
    58795202
    58805203  Pel  maxDepthVal = 0;
     
    58915214  if (picDepth)
    58925215  {
    5893     UInt uiAbsPartAddrCurrCU = m_uiAbsIdxInLCU + uiPartAddr;
     5216    UInt uiAbsPartAddrCurrCU = m_absZIdxInCtu + uiPartAddr;
    58945217    Int iWidth, iHeight;
    58955218    getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); // The modified value of uiPartAddr won't be used any more
    58965219
    58975220    TComPicYuv* pcBaseViewDepthPicYuv = picDepth->getPicYuvRec();
    5898     Int iBlkX = ( getAddr() % picDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
    5899     Int iBlkY = ( getAddr() / picDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
     5221    const TComSPS   &sps =*(getSlice()->getSPS());
     5222    Int iBlkX = ( getCtuRsAddr() % picDepth->getFrameWidthInCtus() ) * sps.getMaxCUWidth()  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
     5223    Int iBlkY = ( getCtuRsAddr() / picDepth->getFrameWidthInCtus() ) * sps.getMaxCUHeight() + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
    59005224
    59015225    Int* aiShiftLUT = getSlice()->getDepthToDisparityB(refViewIdx );
     
    59055229  }
    59065230}
    5907 #endif //H_3D_NBDV_REF
     5231#endif //NH_3D_NBDV_REF
    59085232
    59095233
    59105234Bool TComDataCU::xCheckSpatialNBDV( TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paIDVInfo, UInt uiMvpDvPos
    5911 #if H_3D_NBDV_REF
     5235#if NH_3D_NBDV_REF
    59125236, Bool bDepthRefine
    59135237#endif
     
    59305254          pNbDvInfo->m_acNBDV = cMvPred;
    59315255          pNbDvInfo->m_aVIdxCan = refViewIdx;
    5932 #if H_3D_NBDV_REF
     5256#if NH_3D_NBDV_REF
    59335257          TComPic* picDepth = NULL;
    59345258          assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC());         
     
    59765300{
    59775301  UInt uiPartIdx = 0;
    5978   UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth(); 
    5979   Int uiLCUIdx = getAddr();
     5302  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInCtuWidth(); 
     5303  Int uiLCUIdx = getCtuRsAddr();
    59805304
    59815305  UInt uiPartIdxRB;
     
    59835307  UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
    59845308
    5985   if (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
     5309  if (( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() )>= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
    59865310  {
    59875311    riLCUIdxRBNb  = -1;
    59885312    riPartIdxRBNb = -1;
    59895313  }
    5990   else if(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     5314  else if(( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() )>= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
    59915315  {
    59925316    riLCUIdxRBNb  = -1;
     
    59965320  {
    59975321    if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
    5998       ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     5322      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInCtuHeight() - 1 ) ) // is not at the last row    of LCU
    59995323    {
    60005324      riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     
    60065330      riLCUIdxRBNb  = -1;
    60075331    }
    6008     else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     5332    else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInCtuHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
    60095333    {
    60105334      riPartIdxRBNb = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     
    60225346Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth )
    60235347{
    6024   UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
     5348#if NH_3D_VSP // bug fix
     5349  UInt uiCurrPartNumb = m_pcPic->getNumPartitionsInCtu() >> (uiDepth << 1);
     5350  assert(m_pcPic->getNumPartitionsInCtu() ==m_pcPic->getNumPartInCtuWidth()*m_pcPic->getNumPartInCtuHeight());
     5351
     5352#else
     5353  UInt uiCurrPartNumb = m_pcPic->getNumPartInCtuWidth() >> (uiDepth << 1);
     5354#endif
    60255355  for (UInt ui = 0; ui < uiCurrPartNumb; ui++ )
    60265356  {
     
    60285358  }
    60295359}
    6030 #if H_3D_VSP
     5360#if NH_3D_VSP  || NH_3D_DBBP
    60315361Void TComDataCU::setDvInfoSubParts( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth )
    60325362{
     
    60415371  Int iColViewIdx, iColRefViewIdx;
    60425372  TComPic *pColPic = getSlice()->getRefPic( eRefPicList, refidx);
    6043   TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
     5373  TComDataCU *pColCU = pColPic->getCtu( uiCUAddr );
    60445374  iColViewIdx = pColCU->getSlice()->getViewIndex();
    6045   if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiPartUnitIdx))
     5375  if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==NUMBER_OF_PART_SIZES||pColCU->isIntra(uiPartUnitIdx))
    60465376  {
    60475377    return false;
     
    61055435
    61065436  Bool depthRefineFlag = false;
    6107 #if H_3D_NBDV_REF
     5437#if NH_3D_NBDV_REF
    61085438  depthRefineFlag = m_pcSlice->getDepthRefinementFlag( );
    6109 #endif // H_3D_NBDV_REF
     5439#endif // NH_3D_NBDV_REF
    61105440
    61115441  TComMv      cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV;
     
    61615491#endif
    61625492
    6163 #if H_3D_SPIVMP
     5493#if NH_3D_SPIVMP
    61645494Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight)
    61655495{
     
    61785508Void TComDataCU::getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr )
    61795509{
    6180   uiBaseAbsPartIdx += m_uiAbsIdxInLCU;
     5510  uiBaseAbsPartIdx += m_absZIdxInCtu;
    61815511  Int iBasePelX = g_auiRasterToPelX[g_auiZscanToRaster[uiBaseAbsPartIdx]];
    61825512  Int iBasePelY = g_auiRasterToPelY[g_auiZscanToRaster[uiBaseAbsPartIdx]];
    61835513  Int iCurrPelX = iBasePelX + iPartIdx%iNumPartLine * iWidth;
    61845514  Int iCurrPelY = iBasePelY + iPartIdx/iNumPartLine * iHeight;
    6185   Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + iCurrPelX/getPic()->getMinCUWidth();
     5515  Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInCtuWidth() + iCurrPelX/getPic()->getMinCUWidth();
    61865516  ruiPartAddr = g_auiRasterToZscan[iCurrRaster];
    6187   ruiPartAddr -= m_uiAbsIdxInLCU
     5517  ruiPartAddr -= m_absZIdxInCtu
    61885518}
    61895519
    61905520Void TComDataCU::setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight )
    61915521{
    6192   uiAbsPartIdx += getZorderIdxInCU();
     5522  uiAbsPartIdx += getZorderIdxInCtu();
    61935523  Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];
    61945524  Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
     
    62025532    for (Int j=iStartPelX; j < iEndPelX; j += getPic()->getMinCUWidth())
    62035533    {
    6204       iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + j/getPic()->getMinCUWidth();
     5534      iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInCtuWidth() + j/getPic()->getMinCUWidth();
    62055535      uiPartAddr = g_auiRasterToZscan[iCurrRaster];
    6206       uiPartAddr -= getZorderIdxInCU(); 
     5536      uiPartAddr -= getZorderIdxInCtu(); 
    62075537
    62085538      m_puhInterDir[uiPartAddr] = uiDir;
     
    62125542#endif
    62135543
    6214 #if H_3D_IV_MERGE
     5544#if NH_3D_IV_MERGE
    62155545Bool
    62165546TComDataCU::getInterViewMergeCands(UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc , Bool bIsDepth           
    6217 #if H_3D_SPIVMP
     5547#if NH_3D_SPIVMP
    62185548, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
    62195549#endif
     
    62345564
    62355565  Int  iCurrPosX, iCurrPosY;
    6236   pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
    6237 
    6238 #if !H_3D_SPIVMP
     5566  pcBaseRec->getTopLeftSamplePos( getCtuRsAddr(), getZorderIdxInCtu() + uiPartAddr, iCurrPosX, iCurrPosY );
     5567
     5568#if !NH_3D_SPIVMP
    62395569  iCurrPosX  += ( iWidth  >> 1 );
    62405570  iCurrPosY  += ( iHeight >> 1 );
     
    62425572
    62435573  Bool depthRefineFlag = false;
    6244 #if H_3D_NBDV_REF
     5574#if NH_3D_NBDV_REF
    62455575  depthRefineFlag = m_pcSlice->getDepthRefinementFlag( );
    6246 #endif // H_3D_NBDV_REF
     5576#endif // NH_3D_NBDV_REF
    62475577
    62485578  TComMv      cDv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV;
     
    62535583
    62545584  Bool abPdmAvailable[8] =  {false, false, false, false, false, false, false, false};
    6255 #if H_3D_NBDV
     5585#if NH_3D_NBDV
    62565586  for( Int i = 0; i < 8; i++)
    62575587  {
     
    62635593  {
    62645594
    6265 #if H_3D_SPIVMP
     5595#if NH_3D_SPIVMP
    62665596    ////////////////////////////////
    62675597    //////////sub-PU IvMC///////////
     
    62695599    if(!m_pcSlice->getIsDepth())
    62705600    {
     5601#if H_3D_DBBP
    62715602      if (!getDBBPFlag(0))
     5603#else
     5604      if (1)
     5605#endif
    62725606      {
    62735607        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     
    63015635        }
    63025636
    6303         Int iRefCenterPosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCenterPosX + ( (cDv.getHor() + 2 ) >> 2 ) );
    6304         Int iRefCenterPosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCenterPosY + ( (cDv.getVer() + 2 ) >> 2 ) );
     5637        Int iRefCenterPosX   = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCenterPosX + ( (cDv.getHor() + 2 ) >> 2 ) );
     5638        Int iRefCenterPosY   = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCenterPosY + ( (cDv.getVer() + 2 ) >> 2 ) );
    63055639
    63065640        pcBaseRec->getCUAddrAndPartIdx( iRefCenterPosX , iRefCenterPosY , iRefCenterCUAddr, iRefCenterAbsPartIdx );
    6307         TComDataCU* pcDefaultCU    = pcBasePic->getCU( iRefCenterCUAddr );
     5641        TComDataCU* pcDefaultCU    = pcBasePic->getCtu( iRefCenterCUAddr );
    63085642        if(!( pcDefaultCU->getPredictionMode( iRefCenterAbsPartIdx ) == MODE_INTRA ))
    63095643        {
     
    63295663                      abPdmAvailable[ uiCurrRefListId ] = true;
    63305664                      TComMv cMv(cDefaultMvField.getHor(), cDefaultMvField.getVer());
    6331 #if H_3D_NBDV
    6332 #if H_3D_IV_MERGE
     5665#if NH_3D_NBDV
     5666#if NH_3D_IV_MERGE
    63335667                      if( !bIsDepth )
    63345668                      {
     
    63385672                        cMv.setIDVVer    (cDv.getVer()); 
    63395673                        cMv.setIDVVId    (iViewIndex);
    6340 #if H_3D_IV_MERGE
     5674#if NH_3D_IV_MERGE
    63415675                      }
    63425676#endif
     
    63635697            for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iSPWidth)
    63645698            {
    6365               iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 ));
    6366               iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 ));
     5699              iBasePosX   = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 ));
     5700              iBasePosY   = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 ));
    63675701
    63685702              pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY, iBaseCUAddr, iBaseAbsPartIdx );
    6369               pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     5703              pcBaseCU    = pcBasePic->getCtu( iBaseCUAddr );
    63705704              if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA ))
    63715705              {
     
    64355769    ////////////////////////////////
    64365770
    6437 #if H_3D_SPIVMP
     5771#if NH_3D_SPIVMP
    64385772    if(m_pcSlice->getIsDepth())
    64395773    {
     
    64415775      iCurrPosY  += ( iHeight >> 1 );
    64425776    }
     5777#if H_3D_DBBP
    64435778    for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++)
    64445779#else
     5780    for(Int iLoopCan = ( m_pcSlice->getIsDepth() ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++)
     5781#endif
     5782#else
    64455783    for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
    64465784#endif
     
    64525790      Int         iBaseAbsPartIdx;
    64535791
    6454       Int offsetW = (iLoopCan == 0) ? 0 : ( iWidth  * 2 );
    6455       Int offsetH = (iLoopCan == 0) ? 0 : ( iHeight * 2 );
    6456 
    6457       Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) );
    6458       Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) );
     5792      Int offsetW = (iLoopCan == 0) ? 0 : ( iWidth  * 2);
     5793      Int offsetH = (iLoopCan == 0) ? 0 : ( iHeight * 2);
     5794
     5795      Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth (COMPONENT_Y) - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) );
     5796      Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight(COMPONENT_Y) - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) );
    64595797      pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
    64605798
    6461       TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     5799      TComDataCU* pcBaseCU    = pcBasePic->getCtu( iBaseCUAddr );
    64625800      if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA ))
    64635801      {
     
    64865824                    abPdmAvailable[ (uiCurrRefListId + (iLoopCan<<2)) ] = true;
    64875825                    TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
    6488 #if H_3D_NBDV
    6489 #if H_3D_IV_MERGE
     5826#if NH_3D_NBDV
     5827#if NH_3D_IV_MERGE
    64905828                    if( !bIsDepth )
    64915829                    {
     
    64955833                      cMv.setIDVVer    (cDv.getVer()); 
    64965834                      cMv.setIDVVId    (iViewIndex);
    6497 #if H_3D_IV_MERGE
     5835#if NH_3D_IV_MERGE
    64985836                    }
    64995837#endif
     
    65115849      }
    65125850    }
    6513 #if H_3D_SPIVMP
     5851#if NH_3D_SPIVMP
     5852#if H_3D_DBBP
    65145853    for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getDBBPFlag(0)) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++)
     5854#else
     5855    for(Int iLoopCan = ( m_pcSlice->getIsDepth()  ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++)
     5856#endif
    65155857#else
    65165858    for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
     
    65415883            abPdmAvailable[ iRefListId + 2 + (iLoopCan<<2) ] = true;
    65425884            paiPdmRefIdx  [ iRefListId + 2 + (iLoopCan<<2) ] = iPdmRefIdx;
    6543 #if H_3D_NBDV_REF
     5885#if NH_3D_NBDV_REF
    65445886            TComMv cMv = depthRefineFlag ? pDInfo->m_acDoNBDV : pDInfo->m_acNBDV;
    65455887#endif
    65465888            cMv.setHor( cMv.getHor() + ioffsetDV );
    6547 #if H_3D_IV_MERGE
     5889#if NH_3D_IV_MERGE
    65485890            if( bIsDepth )
    65495891            {
     
    65665908}
    65675909#endif
    6568 #if H_3D_ARP
     5910#if NH_3D_ARP
    65695911Void TComDataCU::setARPWSubParts ( UChar w, UInt uiAbsPartIdx, UInt uiDepth )
    65705912{
    6571   assert( sizeof( *m_puhARPW) == 1 );
    6572   memset( m_puhARPW + uiAbsPartIdx, w, m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ) );
    6573 }
    6574 #endif
    6575 
    6576 #if H_3D_IC
     5913  setSubPart<UChar>( w, m_puhARPW, uiAbsPartIdx, uiDepth, 0 );
     5914}
     5915#endif
     5916
     5917#if NH_3D_IC
    65775918Void TComDataCU::setICFlagSubParts( Bool bICFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    65785919{
    6579   memset( m_pbICFlag + uiAbsPartIdx, bICFlag, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) );
     5920  memset( m_pbICFlag + uiAbsPartIdx, bICFlag, (m_pcPic->getNumPartitionsInCtu() >> ( 2 * uiDepth ))*sizeof(Bool) );
    65805921}
    65815922
     
    66365977#endif
    66375978
    6638 #if H_3D_VSP
     5979#if NH_3D_VSP
    66395980Void TComDataCU::setMvFieldPUForVSP( TComDataCU* pcCU, UInt partAddr, Int width, Int height, RefPicList eRefPicList, Int iRefIdx, Int &vspSize )
    66405981{
     
    66926033  TComCUMvField *cuMvField = cu->getCUMvField( refPicList );
    66936034  Int partAddrRasterSubPULine  = g_auiZscanToRaster[ partAddr ];
    6694   Int numPartsLine    = cu->getPic()->getNumPartInWidth();
     6035  Int numPartsLine    = cu->getPic()->getNumPartInCtuWidth();
    66956036
    66966037  Int nTxtPerMvInfoX = 4; // cu->getPic()->getMinCUWidth();
    66976038  Int nTxtPerMvInfoY = 4; // cu->getPic()->getMinCUHeight();
    66986039
    6699   Int refDepStride = picRefDepth->getStride();
     6040  Int refDepStride = picRefDepth->getStride( COMPONENT_Y );
    67006041
    67016042  TComMv tmpMv(0, 0);
     
    67036044
    67046045  Int refDepOffset  = ( (dv->getHor()+2) >> 2 ) + ( (dv->getVer()+2) >> 2 ) * refDepStride;
    6705   Pel *refDepth     = picRefDepth->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr ) + refDepOffset;
     6046  Pel *refDepth     = picRefDepth->getAddr( COMPONENT_Y, cu->getCtuRsAddr(), cu->getZorderIdxInCtu() + partAddr ) + refDepOffset;
    67066047
    67076048  if ((height % 8))
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComDataCU.h

    r1258 r1279  
    5050#include "TComPattern.h"
    5151
    52 #if H_3D_ARP
    53 #include "TComYuv.h"
    54 #endif
    5552#if H_3D
    5653#include <algorithm>
     
    6562static const UInt NUM_MOST_PROBABLE_MODES=3;
    6663
    67 #if H_3D_DBBP
     64#if NH_3D_DBBP
    6865typedef struct _DBBPTmpData
    6966{
     
    167164  Char*         m_apiMVPNum[NUM_REF_PIC_LIST_01];       ///< array of number of possible motion vectors predictors
    168165  Bool*         m_pbIPCMFlag;         ///< array of intra_pcm flags
    169 #if H_3D_NBDV
     166#if NH_3D_NBDV
    170167  DisInfo*      m_pDvInfo;
    171168#endif
    172 #if H_3D_VSP
     169#if NH_3D_VSP
    173170  Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not  ///< 0: non-VSP; 1: VSP
    174171#endif
    175 #if H_3D_SPIVMP
     172#if NH_3D_SPIVMP
    176173  Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP ///< 0: non-SPIVMP; 1: SPIVMP
    177174#endif
    178 #if H_3D_ARP
     175#if NH_3D_ARP
    179176  UChar*        m_puhARPW;
    180177#endif
    181 #if H_3D_IC
     178#if NH_3D_IC
    182179  Bool*         m_pbICFlag;           ///< array of IC flags
    183180#endif
     
    190187  Pel*          m_apSegmentDCOffset[2];
    191188#endif
    192 #if H_3D_DBBP
     189#if NH_3D_DBBP
    193190  Bool*         m_pbDBBPFlag;        ///< array of DBBP flags
    194191  DbbpTmpData   m_sDBBPTmpData;
    195192#endif
    196 #if H_3D
     193#if NH_3D_MLC
    197194  Bool          m_bAvailableFlagA1;    ///< A1 available flag
    198195  Bool          m_bAvailableFlagB1;    ///< B1 available flag
     
    217214  UInt          m_uiTotalBins;        ///< sum of partition bins
    218215  Char          m_codedQP;
    219 #if H_3D
    220   DisInfo       m_cDefaultDisInfo;    ///< Default disparity information for initializing
    221 #endif
    222 #if H_3D_IV_MERGE
    223   TComMotionCand  m_mergCands[MRG_IVSHIFT+1];
    224   Int           m_baseListidc;
     216#if NH_3D_MLC
     217  DisInfo         m_cDefaultDisInfo;    ///< Default disparity information for initializing
     218  TComMotionCand  m_mergCands[MRG_IVSHIFT+1];   ///< Motion candidates for merge mode
     219  Int             m_numSpatialCands;
    225220#endif
    226221
     
    232227  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    233228  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    234 #if H_3D_VSP
     229#if NH_3D_VSP
    235230  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount);
    236231#endif
    237 #if H_3D_IV_MERGE
     232#if NH_3D_IV_MERGE
    238233  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Int*   ivCandDir, TComMv* ivCandMv, Int* ivCandRefIdx );
    239234#endif
     
    241236  Void          deriveRightBottomIdx        ( UInt uiPartIdx, UInt& ruiPartIdxRB );
    242237  Bool          xGetColMVP( RefPicList eRefPicList, Int ctuRsAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
    243 #if H_3D_TMVP
     238#if NH_3D_TMVP
    244239  ,  Bool bMRG = true
    245240#endif
     
    248243
    249244  /// compute scaling factor from POC difference
    250 #if !H_3D_ARP
     245#if !NH_3D_ARP
    251246  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
    252247#endif
     
    254249  Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter );
    255250
    256 #if H_3D_VSP
     251#if NH_3D_VSP
    257252  Void xSetMvFieldForVSP  ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );
    258253#endif
     
    265260  // create / destroy / initialize / copy
    266261  // -------------------------------------------------------------------------------------------------------------------
    267 #if H_3D_ARP
     262#if NH_3D_ARP
     263  /// compute scaling factor from POC difference
    268264  Int           xGetDistScaleFactor   ( Int iCurrPOC, Int iCurrRefPOC, Int iColPOC, Int iColRefPOC );
    269265#endif
     
    279275  Void          initSubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx, UInt uiDepth, Int qp );
    280276  Void          setOutsideCUPart      ( UInt uiAbsPartIdx, UInt uiDepth );
    281 #if H_3D_NBDV
    282   Void          copyDVInfoFrom (TComDataCU* pcCU, UInt uiAbsPartIdx);
     277#if NH_3D_NBDV
     278  Void          copyDVInfoFrom        (TComDataCU* pcCU, UInt uiAbsPartIdx);
    283279#endif
    284280
    285281  Void          copySubCU             ( TComDataCU* pcCU, UInt uiPartUnitIdx );
    286282  Void          copyInterPredInfoFrom ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefPicList
    287 #if H_3D_NBDV
     283#if NH_3D_NBDV
    288284  , Bool bNBDV = false
    289285#endif
     
    316312#endif
    317313
     314#if NH_3D_ARP
     315  Void          setSlice              ( TComSlice* pcSlice)     { m_pcSlice = pcSlice;       }
     316  Void          setPic                ( TComDataCU* pcCU  )     { m_pcPic              = pcCU->getPic(); }
     317#endif
    318318  // -------------------------------------------------------------------------------------------------------------------
    319319  // member functions for CU data
     
    326326  Void          setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth );
    327327
    328 #if H_3D_DBBP
     328#if NH_3D_DBBP
    329329  Pel*          getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);
    330330#endif
     
    350350  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
    351351
    352 #if H_3D_DBBP
     352#if NH_3D_DBBP
    353353  Bool*         getDBBPFlag           ()                        { return m_pbDBBPFlag;               }
    354354  Bool          getDBBPFlag           ( UInt uiIdx )            { return m_pbDBBPFlag[uiIdx];        }
     
    451451  template <typename T>
    452452  Void          setSubPart            ( T bParameter, T* pbBaseCtu, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
    453 #if H_3D_VSP
     453#if H_3D_VSP || NH_3D_DBBP
    454454  template<typename T>
    455455  Void          setSubPartT           ( T uiParameter, T* puhBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
     
    477477  Void          setIPCMFlag           (UInt uiIdx, Bool b )     { m_pbIPCMFlag[uiIdx] = b;           }
    478478  Void          setIPCMFlagSubParts   (Bool bIpcmFlag, UInt uiAbsPartIdx, UInt uiDepth);
    479 #if H_3D_NBDV
     479#if NH_3D_NBDV
    480480  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiDepth );
     481#if H_3D_VSP || NH_3D_DBBP
    481482  Void          setDvInfoSubParts     ( DisInfo cDvInfo, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth);
     483#endif
    482484  DisInfo*      getDvInfo             ()                        { return m_pDvInfo;                 }
    483485  DisInfo       getDvInfo             (UInt uiIdx)              { return m_pDvInfo[uiIdx];          }
    484486#endif
    485 #if H_3D_NBDV
     487#if NH_3D_NBDV
    486488  Void          xDeriveRightBottomNbIdx(Int &uiLCUIdxRBNb, Int &uiPartIdxRBNb );
    487489  Bool          xCheckSpatialNBDV (TComDataCU* pcTmpCU, UInt uiIdx, DisInfo* pNbDvInfo, Bool bSearchForMvpDv, IDVInfo* paMvpDvInfo,
    488490                                   UInt uiMvpDvPos
    489 #if H_3D_NBDV_REF
     491#if NH_3D_NBDV_REF
    490492  , Bool bDepthRefine = false
    491493#endif
     
    493495  Bool          xGetColDisMV      ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
    494496  Void          getDisMvpCandNBDV ( DisInfo* pDInfo
    495 #if H_3D_NBDV_REF
     497#if NH_3D_NBDV_REF
    496498   , Bool bDepthRefine = false
    497499#endif
    498500   );
    499501   
     502#if NH_3D_IV_MERGE
     503  Void          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
     504#endif
     505
    500506#if H_3D
    501507  Void          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
    502508  Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
    503509#endif
    504 #if H_3D_NBDV_REF
     510#if NH_3D_NBDV_REF
    505511  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT );
    506512  Void          estimateDVFromDM(Int refViewIdx, UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred );
    507 #endif //H_3D_NBDV_REF
     513#endif //NH_3D_NBDV_REF
    508514#endif
    509515#if NH_3D_DIS
     
    513519  Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
    514520#endif
    515 #if H_3D_SPIVMP
     521#if NH_3D_SPIVMP
    516522  Void          getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight);
    517523  Void          getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr );
    518524  Void          setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight );
    519525#endif
    520 #if H_3D_IV_MERGE
     526#if NH_3D_IV_MERGE
    521527  Bool          getInterViewMergeCands          ( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo, Int* availableMcDc, Bool bIsDepth           
    522528
    523 #if H_3D_SPIVMP
     529#if NH_3D_SPIVMP
    524530    , TComMvField* pcMFieldSP, UChar* puhInterDirSP
    525531#endif   
     
    527533    );   
    528534#endif
    529 #if H_3D_ARP
     535#if NH_3D_ARP
    530536  UChar*        getARPW            ()                        { return m_puhARPW;               }
    531537  UChar         getARPW            ( UInt uiIdx )            { return m_puhARPW[uiIdx];        }
    532538  Void          setARPW            ( UInt uiIdx, UChar w )   { m_puhARPW[uiIdx] = w;           }
    533539  Void          setARPWSubParts    ( UChar w, UInt uiAbsPartIdx, UInt uiDepth );
    534   Double        getARPWFactor      ( UInt uiIdx );
    535 #endif
    536 #if H_3D_IC
     540#endif
     541#if NH_3D_IC
    537542  Bool*         getICFlag          ()                        { return m_pbICFlag;               }
    538543  Bool          getICFlag          ( UInt uiIdx )            { return m_pbICFlag[uiIdx];        }
     
    540545  Void          setICFlagSubParts  ( Bool bICFlag,  UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    541546  Bool          isICFlagRequired   ( UInt uiAbsPartIdx );
     547  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
     548#elif NH_3D_VSP
    542549  Void          getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx = 0, Bool bLCU = false);
    543550#else
     
    647654  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    648655
    649 #if H_3D
    650   Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;}
    651   Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;}
    652   Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;}
    653   Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;}
    654   Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;}
     656#if NH_3D_MLC
     657  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;   }
     658  Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;   }
     659  Bool          getAvailableFlagB0() { return m_bAvailableFlagB0;   }
     660  Bool          getAvailableFlagA0() { return m_bAvailableFlagA0;   }
     661  Bool          getAvailableFlagB2() { return m_bAvailableFlagB2;   }
    655662  Void          initAvailableFlags() { m_bAvailableFlagA1 = m_bAvailableFlagB1 = m_bAvailableFlagB0 = m_bAvailableFlagA0 = m_bAvailableFlagB2 = 0;  }
    656663  Void          buildMCL(TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
    657 #if H_3D_VSP
     664#if NH_3D_VSP
    658665    , Int* vspFlag
    659666#endif
    660 #if H_3D_SPIVMP
     667#if NH_3D_SPIVMP
    661668    , Bool* pbSPIVMPFlag
    662669#endif
    663670    , Int& numValidMergeCand
    664671    );
    665   Void          getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1);
    666   Void          xGetInterMergeCandidates ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
    667 #else
     672  Void          xGetInterMergeCandidates      ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours
     673#if NH_3D_SPIVMP
     674  , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     675#endif
     676  , Int& numValidMergeCand, Int mrgCandIdx = -1 );
     677#endif
    668678  Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
    669 #endif
    670 #if H_3D_SPIVMP
    671                                             , TComMvField* pcMvFieldSP, UChar* puhInterDirSP
    672 #endif
    673 
    674 #if H_3D_VSP
    675 #if H_3D_SPIVMP
     679
     680#if NH_3D_VSP
     681#if NH_3D_SPIVMP
    676682  Bool*         getSPIVMPFlag        ()                        { return m_pbSPIVMPFlag;          }
    677683  Bool          getSPIVMPFlag        ( UInt uiIdx )            { return m_pbSPIVMPFlag[uiIdx];   }
     
    698704  Bool          isBipredRestriction( UInt puIdx );
    699705
    700 #if H_3D_IC
    701   Bool          isIC      ( UInt uiPartIdx );
    702 #endif
    703 
    704706  // -------------------------------------------------------------------------------------------------------------------
    705707  // member functions for symbol prediction (most probable / mode conversion)
     
    720722  UInt          getCtxSkipFlag                  ( UInt   uiAbsPartIdx                                 );
    721723  UInt          getCtxInterDir                  ( UInt   uiAbsPartIdx                                 );
    722 #if H_3D_ARP
     724#if NH_3D_ARP
    723725  UInt          getCTXARPWFlag                  ( UInt   uiAbsPartIdx                                 );
    724726#endif 
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComInterpolationFilter.cpp

    r1200 r1279  
    7575};
    7676
    77 #if H_3D_ARP
     77#if NH_3D_ARP
    7878const Short TComInterpolationFilter::m_lumaFilterARP[4][NTAPS_LUMA_ARP] =
    7979{
     
    361361 */
    362362Void TComInterpolationFilter::filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isLast, const ChromaFormat fmt, const Int bitDepth
    363 #if H_3D_ARP
     363#if NH_3D_ARP
    364364    , Bool filterType
    365365#endif
     
    372372  else if (isLuma(compID))
    373373  {
    374 #if H_3D_ARP
     374    assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
     375#if NH_3D_ARP
    375376    if(filterType)
    376377    {
    377       filterHor<NTAPS_LUMA_ARP>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]);
     378      filterHor<NTAPS_LUMA_ARP>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilterARP[frac]);
    378379    }
    379380    else
    380381    {
    381382#endif
    382 
    383     assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
    384383    filterHor<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
    385 #if H_3D_ARP
     384#if NH_3D_ARP
    386385    }
    387386#endif
     
    392391    const UInt csx = getComponentScaleX(compID, fmt);
    393392    assert(frac >=0 && csx<2 && (frac<<(1-csx)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
     393#if NH_3D_ARP
     394    if(filterType)
     395    {
     396      filterHor<NTAPS_CHROMA_ARP>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]);
     397    }
     398    else
     399    {
     400#endif
    394401    filterHor<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac<<(1-csx)]);
     402#if NH_3D_ARP
     403    }
     404#endif
    395405  }
    396406}
     
    414424 */
    415425Void TComInterpolationFilter::filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth
    416 #if H_3D_ARP
     426#if NH_3D_ARP
    417427    , Bool filterType
    418428#endif
     
    425435  else if (isLuma(compID))
    426436  {
    427 #if H_3D_ARP
     437    assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
     438#if NH_3D_ARP
    428439    if(filterType)
    429440    {
    430       filterVer<NTAPS_LUMA_ARP>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]);   
     441      filterVer<NTAPS_LUMA_ARP>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilterARP[frac]);   
    431442    }
    432443    else
    433444    {
    434445#endif
    435     assert(frac >= 0 && frac < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
    436446    filterVer<NTAPS_LUMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_lumaFilter[frac]);
    437 #if H_3D_ARP
     447#if NH_3D_ARP
    438448    }
    439449#endif
     
    444454    const UInt csy = getComponentScaleY(compID, fmt);
    445455    assert(frac >=0 && csy<2 && (frac<<(1-csy)) < CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS);
     456#if NH_3D_ARP
     457    if(filterType)
     458    {
     459      filterVer<NTAPS_CHROMA_ARP>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]);   
     460    }
     461    else
     462    {
     463#endif
    446464    filterVer<NTAPS_CHROMA>(bitDepth, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac<<(1-csy)]);
    447   }
    448 }
    449 
    450 #if H_3D_ARP
    451     , Bool filterType
    452 #endif
    453 
    454 #if H_3D_ARP
    455     if(filterType)
    456     {
    457       filterHor<NTAPS_CHROMA_ARP>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilterARP[frac]);
    458     }
    459     else
    460     {
    461 #endif
    462 #if H_3D_ARP
    463     }
    464 #endif
    465 #if H_3D_ARP
    466     , Bool filterType
    467 #endif
    468 #if H_3D_ARP
    469     if(filterType)
    470     {
    471       filterVer<NTAPS_CHROMA_ARP>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilterARP[frac]);
    472     }
    473     else
    474     {
    475 #endif
    476 #if H_3D_ARP
    477     }
    478 #endif
    479 
    480 
    481 
     465#if NH_3D_ARP
     466    }
     467#endif
     468    }
     469    }
    482470//! \}
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComInterpolationFilter.h

    r1200 r1279  
    4545//! \{
    4646
    47 #if H_3D_ARP
     47#if NH_3D_ARP
    4848#define NTAPS_LUMA_ARP    2 ///< Number of taps for luma
    4949#define NTAPS_CHROMA_ARP  2 ///< Number of taps for chroma
     
    6363  static const TFilterCoeff m_lumaFilter[LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_LUMA];     ///< Luma filter taps
    6464  static const TFilterCoeff m_chromaFilter[CHROMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS][NTAPS_CHROMA]; ///< Chroma filter taps
    65 #if H_3D_ARP
     65#if NH_3D_ARP
    6666  static const Short m_lumaFilterARP  [4][NTAPS_LUMA_ARP];     ///< Luma filter taps for ARP
    6767  static const Short m_chromaFilterARP[8][NTAPS_CHROMA_ARP];   ///< Chroma filter taps for ARP
     
    8383
    8484  Void filterHor(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac,               Bool isLast, const ChromaFormat fmt, const Int bitDepth
    85 #if H_3D_ARP
     85#if NH_3D_ARP
    8686    , Bool filterType = false
    8787#endif
    8888);
    8989  Void filterVer(const ComponentID compID, Pel *src, Int srcStride, Pel *dst, Int dstStride, Int width, Int height, Int frac, Bool isFirst, Bool isLast, const ChromaFormat fmt, const Int bitDepth
    90 #if H_3D_ARP
     90#if NH_3D_ARP
    9191    , Bool filterType = false
    9292#endif
     
    9494};
    9595
    96 #if H_3D_ARP
    97     , Bool filterType = false
    98 #endif
    99 #if H_3D_ARP
    100     , Bool filterType = false
    101 #endif
    102 
    10396//! \}
    10497
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComMotionInfo.cpp

    r1200 r1279  
    4040#include "assert.h"
    4141#include <stdlib.h>
    42 #if H_3D_SPIVMP
     42#if NH_3D_SPIVMP
    4343#include "TComDataCU.h"
    4444#include "TComPic.h"
     
    328328}
    329329
    330 #if H_3D_SPIVMP
     330#if NH_3D_SPIVMP
    331331Void TComCUMvField::setMvFieldSP( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  )
    332332{
    333   uiAbsPartIdx += pcCU->getZorderIdxInCU();
     333  uiAbsPartIdx += pcCU->getZorderIdxInCtu();
    334334  Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];
    335335  Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
     
    341341    for (Int j=iStartPelX; j < iEndPelX; j += pcCU->getPic()->getMinCUWidth())
    342342    {
    343       Int iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth();
     343      Int iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInCtuWidth() + j/pcCU->getPic()->getMinCUWidth();
    344344      Int uiPartAddr = g_auiRasterToZscan[iCurrRaster];
    345       uiPartAddr -= pcCU->getZorderIdxInCU(); 
     345      uiPartAddr -= pcCU->getZorderIdxInCtu(); 
    346346
    347347      m_pcMv[uiPartAddr] = cMvField.getMv();
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComMotionInfo.h

    r1196 r1279  
    5050// ====================================================================================================================
    5151
    52 #if H_3D_SPIVMP
     52#if NH_3D_SPIVMP
    5353class TComDataCU;
    5454#endif
     
    6060} AMVPInfo;
    6161
    62 #if H_3D_NBDV
     62#if NH_3D_NBDV
    6363typedef struct _DisCand
    6464{
    6565  TComMv m_acNBDV;              // DV from NBDV
    66 #if H_3D_NBDV_REF
     66#if NH_3D_NBDV_REF
    6767  TComMv m_acDoNBDV;            // DV from DoNBDV
    6868#endif 
     
    107107  Int getHor   () const { return  m_acMv.getHor(); }
    108108  Int getVer   () const { return  m_acMv.getVer(); }
    109 #if H_3D_IV_MERGE
     109#if NH_3D_IV_MERGE
    110110  Bool operator== ( const TComMvField& rcMv ) const
    111111  {
     
    167167  Void    setAllRefIdx ( Int iRefIdx,                 PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
    168168  Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
    169 #if H_3D_SPIVMP
     169#if NH_3D_SPIVMP
    170170  Void    setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  );
    171171#endif
    172 #if H_3D_VSP
     172#if NH_3D_VSP
    173173  Void    setMv         ( Int iIdx, TComMv const & rcMv ) { m_pcMv[iIdx] = rcMv; }
    174174  Void    setRefIdx     ( Int iIdx, Int iRefIdx )         { m_piRefIdx[iIdx] = iRefIdx; }
     
    192192//! \}
    193193
    194 #if H_3D_IV_MERGE
     194#if NH_3D_MLC
     195/// class for container of merge candidate
    195196class TComMotionCand
    196197{
     
    199200  TComMvField           m_cMvField[2];
    200201  UChar                 m_uDir;
    201 #if H_3D_VSP
     202#if NH_3D_VSP
    202203  Int                   m_iVspFlag;
    203 #endif 
     204#endif
     205#if NH_3D_SPIVMP
    204206  Bool                  m_bSPIVMPFlag;
     207#endif
    205208
    206209public:
     
    209212    m_bAvailable = false;
    210213    m_uDir = 0;
    211 #if H_3D_VSP
     214#if NH_3D_VSP
    212215    m_iVspFlag = 0;
    213216#endif
     217#if NH_3D_SPIVMP
    214218    m_bSPIVMPFlag = false;
     219#endif
    215220  }
    216221
     
    226231    m_bAvailable = false;
    227232    m_uDir = 0;
    228 #if H_3D_VSP
     233#if NH_3D_VSP
    229234    m_iVspFlag = 0;
    230235#endif
     236#if NH_3D_SPIVMP
    231237    m_bSPIVMPFlag = false;
     238#endif
    232239    m_cMvField[0].setMvField(cZeroMv, NOT_VALID);
    233240    m_cMvField[1].setMvField(cZeroMv, NOT_VALID);
     
    235242
    236243  Void setCand(TComMvField* pcMvFieldNeighbours, UChar uhInterDirNeighbours
    237 #if H_3D_VSP
     244#if NH_3D_VSP
    238245    , Int vspFlag
    239246#endif
     247#if NH_3D_SPIVMP
    240248    , Bool bSPIVMPFlag
     249#endif
    241250    )
    242251  {
     
    245254    m_cMvField[1] = pcMvFieldNeighbours[1];
    246255    m_uDir = uhInterDirNeighbours;
    247 #if H_3D_VSP
     256#if NH_3D_VSP
    248257    m_iVspFlag = vspFlag;
    249258#endif
     259#if NH_3D_SPIVMP
    250260    m_bSPIVMPFlag = bSPIVMPFlag;
    251   }
    252 
    253 
     261#endif
     262  }
     263 
    254264  Void getCand(Int iCount, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    255 #if H_3D_VSP
     265#if NH_3D_VSP
    256266    , Int* vspFlag
    257267#endif
     268#if NH_3D_SPIVMP
    258269    , Bool* pbSPIVMPFlag
     270#endif
    259271    )
    260272  {
     
    262274    pcMvFieldNeighbours[(iCount<<1) + 1] = m_cMvField[1];
    263275    puhInterDirNeighbours[iCount] = m_uDir;
    264 #if H_3D_VSP
     276#if NH_3D_VSP
    265277    vspFlag[iCount] = m_iVspFlag;
    266278#endif
     279#if NH_3D_SPIVMP
    267280    pbSPIVMPFlag[iCount] = m_bSPIVMPFlag;
     281#endif
    268282  }
    269283};
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComMv.h

    r1200 r1279  
    5757  Short m_iHor;     ///< horizontal component of motion vector
    5858  Short m_iVer;     ///< vertical component of motion vector
    59 #if H_3D_NBDV
     59#if NH_3D_NBDV
    6060  Bool  m_bIDV;       
    6161  Short m_iIDVHor;   
     
    7272  m_iHor(0),
    7373  m_iVer(0)
    74 #if H_3D_NBDV
     74#if NH_3D_NBDV
    7575  , m_bIDV(false)
    7676  , m_iIDVHor(0)
     
    8484  m_iHor(iHor),
    8585  m_iVer(iVer)
    86  #if H_3D_NBDV
     86 #if NH_3D_NBDV
    8787  , m_bIDV(false)
    8888  , m_iIDVHor(0)
     
    101101  Void  setVer    ( Short i )                   { m_iVer = i;                               }
    102102  Void  setZero   ()                            { m_iHor = m_iVer = 0;
    103  #if H_3D_NBDV
     103 #if NH_3D_NBDV
    104104   m_bIDV = false; m_iIDVHor = m_iIDVVer = 0;
    105105   m_iIDVVId = 0;
    106106#endif
    107107 }
    108 #if H_3D_NBDV
     108#if NH_3D_NBDV
    109109  Void   setIDVHor  (Short i)                    {m_iIDVHor = i;}
    110110  Void   setIDVVer  (Short i)                    {m_iIDVVer = i;}
     
    120120  Int   getAbsHor () const { return abs( m_iHor );   }
    121121  Int   getAbsVer () const { return abs( m_iVer );   }
    122 #if H_3D_NBDV
     122#if NH_3D_NBDV
    123123  Short getIDVHor () const { return m_iIDVHor;       }
    124124  Short getIDVVer () const { return m_iIDVVer;       }
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPattern.h

    r1200 r1279  
    8181//  TComPatternParam  m_cPatternCb;
    8282  //TComPatternParam  m_cPatternCr;
    83 #if H_3D_IC
     83#if NH_3D_IC
    8484  Bool              m_bICFlag;
    8585#endif
     
    9898  Int   getBitDepthY()            { return m_cPatternY.m_bitDepth; }
    9999
    100 #if H_3D_IC
     100#if NH_3D_IC
    101101  Bool  getICFlag()               { return m_bICFlag; }
    102102  Void  setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; }
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPic.cpp

    r1200 r1279  
    7575    m_apcPicYuv[i]      = NULL;
    7676  }
    77 #if H_3D_QTLPC
     77#if NH_3D_QTLPC
    7878  m_bReduceBitsQTL    = 0;
    7979#endif
    80 #if H_3D_NBDV
     80#if NH_3D_NBDV
    8181  m_iNumDdvCandPics   = 0;
    8282  m_eRapRefList       = REF_PIC_LIST_0;
     
    143143}
    144144#if NH_3D
     145#if NH_3D_ARP
     146Void TComPic::getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx )
     147{
     148  Int iMaxCUWidth   = (Int) ( getPicSym()->getSPS().getMaxCUWidth()  );
     149  Int iMaxCuHeight  = (Int) ( getPicSym()->getSPS().getMaxCUHeight() );
     150
     151  UInt uiMaxTotalCUDepth = getPicSym()->getSPS().getMaxTotalCUDepth();
     152  Int iBaseUnitWidth  = iMaxCUWidth >> uiMaxTotalCUDepth;
     153  Int iBaseUnitHeight = iMaxCUWidth >> uiMaxTotalCUDepth;
     154
     155  Int iNumCuInWidth   = getPicYuvRec()->getWidth(COMPONENT_Y) / iMaxCUWidth;
     156  iNumCuInWidth      += ( getPicYuvRec()->getWidth(COMPONENT_Y) % iMaxCUWidth ) ? 1 : 0;
     157
     158
     159  Int iCuX            = iX / iMaxCUWidth;
     160  Int iCuY            = iY / iMaxCuHeight;
     161  Int iBaseX          = ( iX - iCuX * iMaxCUWidth  ) / iBaseUnitWidth;
     162  Int iBaseY          = ( iY - iCuY * iMaxCuHeight ) / iBaseUnitHeight;
     163  Int iCuSizeInBases  = iMaxCuHeight                 / iBaseUnitWidth;
     164
     165  riCuAddr            = iCuY   * iNumCuInWidth + iCuX;
     166  Int iRastPartIdx    = iBaseY * iCuSizeInBases  + iBaseX;
     167  riAbsZorderIdx      = g_auiRasterToZscan[ iRastPartIdx ];
     168}
     169#endif
    145170Void TComPic::compressMotion(Int scale)
    146171#else
     
    283308  return getPicYuv( layerIdInNuh, poc, recon );
    284309}
    285 #if H_3D_ARP
     310#if NH_3D_ARP
    286311TComList<TComPic*>* TComPicLists::getPicList( Int layerIdInNuh )
    287312{
     
    303328#endif // NH_MV
    304329
    305 #if H_3D_NBDV
    306 Int TComPic::getDisCandRefPictures( Int iColPOC )
     330#if NH_3D_NBDV
     331Int TComPic::getDisCandRefPictures(Int iColPOC)
    307332{
    308333  UInt       uiTempLayerCurr = 7;
     
    310335  UInt       numDdvCandPics  = 0;
    311336
    312   if ( !currSlice->getEnableTMVPFlag() )
     337  if(!currSlice->getEnableTMVPFlag())
     338  {
    313339    return numDdvCandPics;
     340  }
    314341
    315342  numDdvCandPics += 1;
     
    318345  UInt pocDiff = 255;
    319346
    320   for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
    321   {
    322     UInt x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();
    323 
    324     for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
     347  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr++)
     348  {
     349    Bool x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();
     350
     351    for(UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
    325352    {
    326353      if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex()
    327         && (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC) && numDdvCandPics!=2)
     354         && (x == currSlice->getColFromL0Flag() || currSlice->getRefPOC((RefPicList)x, i) != iColPOC) && numDdvCandPics != 2)
    328355      {
    329356        TComSlice* refSlice    = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx());
    330         Bool       bRAP        = (refSlice->getViewIndex() && refSlice->isIRAP())? 1: 0;
     357        Bool       bRAP        = (refSlice->getViewIndex() && refSlice->isIRAP()) ? 1 : 0;
    331358        UInt       uiTempLayer = currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer();
    332359       
    333         if( bRAP )
     360        if(bRAP)
    334361        {
    335362          this->setRapRefIdx(i);
     
    350377  UInt idx = 0;
    351378 
    352   for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
    353   {
    354     UInt x = lpNr? currSlice->getColFromL0Flag() : 1-currSlice->getColFromL0Flag();
     379  for(UInt lpNr = 0; lpNr < (currSlice->isInterB() ? 2 : 1); lpNr++)
     380  {
     381    Bool x = lpNr ? currSlice->getColFromL0Flag() : 1 - currSlice->getColFromL0Flag();
    355382   
    356     for (UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
     383    for(UInt i = 0; i < currSlice->getNumRefIdx(RefPicList(x)); i++)
    357384    {
    358385      Int iTempPoc = currSlice->getRefPic((RefPicList)x, i)->getPOC();
    359       Int iTempDiff = (iTempPoc > pocCurr) ? (iTempPoc - pocCurr): (pocCurr - iTempPoc);
     386      Int iTempDiff = (iTempPoc > pocCurr) ? (iTempPoc - pocCurr) : (pocCurr - iTempPoc);
    360387     
    361       if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() &&  (x == currSlice->getColFromL0Flag()||currSlice->getRefPOC((RefPicList)x, i)!= iColPOC)
    362         && currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer() == uiTempLayerCurr && pocDiff > iTempDiff)
     388      if(currSlice->getViewIndex() == currSlice->getRefPic((RefPicList)x, i)->getViewIndex() && (x == currSlice->getColFromL0Flag() || currSlice->getRefPOC((RefPicList)x, i) != iColPOC)
     389         && currSlice->getRefPic((RefPicList)x, i)->getSlice(getCurrSliceIdx())->getTLayer() == uiTempLayerCurr && pocDiff > iTempDiff)
    363390      {
    364391        pocDiff = iTempDiff;
     
    369396  }
    370397
    371   if( pocDiff < 255 )
     398  if(pocDiff < 255)
    372399  {
    373400    this->setRapRefIdx(idx);
    374     this->setRapRefList((RefPicList) z );
     401    this->setRapRefList((RefPicList) z);
    375402    numDdvCandPics = 2;
    376403  }
     
    383410  TComSlice* currSlice = getSlice(getCurrSliceIdx());
    384411  const Int numCandPics = this->getNumDdvCandPics();
     412
    385413  for(Int curCandPic = 0; curCandPic < numCandPics; curCandPic++)
    386414  {
    387415    RefPicList eCurRefPicList   = REF_PIC_LIST_0 ;
    388416    Int        curCandPicRefIdx = 0;
    389     if( curCandPic == 0 )
     417    if(curCandPic == 0)
    390418    {
    391       eCurRefPicList   = RefPicList(currSlice->isInterB() ? 1-currSlice->getColFromL0Flag() : 0);
     419      eCurRefPicList   = RefPicList(currSlice->isInterB() ? 1 - currSlice->getColFromL0Flag() : 0);
    392420      curCandPicRefIdx = currSlice->getColRefIdx();
    393421    }
     
    397425      curCandPicRefIdx = this->getRapRefIdx();
    398426    }
    399     TComPic* pcCandColPic = currSlice->getRefPic( eCurRefPicList, curCandPicRefIdx);
    400     TComSlice* pcCandColSlice = pcCandColPic->getSlice(0);// currently only support single slice
     427
     428    TComPic* pcCandColPic = currSlice->getRefPic(eCurRefPicList, curCandPicRefIdx);
     429    TComSlice* pcCandColSlice = pcCandColPic->getSlice(0); // currently only support single slice
    401430
    402431    if(!pcCandColSlice->isIntra())
    403432    {
    404       for( Int iColRefDir = 0; iColRefDir < (pcCandColSlice->isInterB() ? 2: 1); iColRefDir ++ )
    405       {
    406         for( Int iColRefIdx =0; iColRefIdx < pcCandColSlice->getNumRefIdx(( RefPicList )iColRefDir ); iColRefIdx++)
     433      for(Int iColRefDir = 0; iColRefDir < (pcCandColSlice->isInterB() ? 2 : 1); iColRefDir++)
     434      {
     435        for(Int iColRefIdx = 0; iColRefIdx < pcCandColSlice->getNumRefIdx((RefPicList)iColRefDir); iColRefIdx++)
    407436        {
    408437          m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = false;
    409438          Int iColViewIdx    = pcCandColSlice->getViewIndex();
    410           Int iColRefViewIdx = pcCandColSlice->getRefPic( ( RefPicList )iColRefDir, iColRefIdx)->getViewIndex();
     439          Int iColRefViewIdx = pcCandColSlice->getRefPic((RefPicList)iColRefDir, iColRefIdx)->getViewIndex();
    411440          if(iColViewIdx == iColRefViewIdx)
     441          {
    412442            continue;
    413 
    414           for(Int iCurrRefDir = 0;(iCurrRefDir < (currSlice->isInterB() ? 2: 1)) && (m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] == false ); iCurrRefDir++)
     443          }
     444
     445          for(Int iCurrRefDir = 0; (iCurrRefDir < (currSlice->isInterB() ? 2 : 1)) && (m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] == false); iCurrRefDir++)
    415446          {
    416             for( Int iCurrRefIdx =0; iCurrRefIdx < currSlice->getNumRefIdx(( RefPicList )iCurrRefDir ); iCurrRefIdx++)
     447            for(Int iCurrRefIdx = 0; iCurrRefIdx < currSlice->getNumRefIdx((RefPicList)iCurrRefDir); iCurrRefIdx++)
    417448            {
    418               if( currSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx )->getViewIndex() == iColRefViewIdx )
     449              if(currSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iColRefViewIdx)
    419450              { 
    420451                m_abTIVRINCurrRL[curCandPic][iColRefDir][iColRefIdx] = true;
     
    428459  }
    429460}
     461
    430462Bool TComPic::isTempIVRefValid(Int currCandPic, Int iColRefDir, Int iColRefIdx)
    431463{
     
    433465}
    434466
    435 Void TComPic::checkTextureRef(  )
     467Void TComPic::checkTextureRef()
    436468{
    437469  TComSlice* pcCurrSlice = getSlice(getCurrSliceIdx());
    438   TComPic* pcTextPic = pcCurrSlice->getTexturePic();
     470  TComPic* pcTextPic = pcCurrSlice->getIvPic(0, getViewIndex());
    439471#if H_3D_FCO
    440472  if ( pcTextPic )
    441473  {
    442474#endif
    443 
    444475    TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
    445476
    446     for( Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB()? 2:1) ) && !pcTextSlice->isIntra(); iTextRefDir ++ )
    447     {
    448       for( Int iTextRefIdx =0; iTextRefIdx<pcTextSlice->getNumRefIdx(( RefPicList )iTextRefDir ); iTextRefIdx++)
    449       {
    450         Int iTextRefPOC    = pcTextSlice->getRefPOC( ( RefPicList )iTextRefDir, iTextRefIdx);
    451         Int iTextRefViewId = pcTextSlice->getRefPic( ( RefPicList )iTextRefDir, iTextRefIdx)->getViewIndex();
     477    for(Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB() ? 2 :1) ) && !pcTextSlice->isIntra(); iTextRefDir++)
     478    {
     479      for(Int iTextRefIdx =0; iTextRefIdx < pcTextSlice->getNumRefIdx((RefPicList)iTextRefDir); iTextRefIdx++)
     480      {
     481        Int iTextRefPOC    = pcTextSlice->getRefPOC((RefPicList)iTextRefDir, iTextRefIdx);
     482        Int iTextRefViewId = pcTextSlice->getRefPic((RefPicList)iTextRefDir, iTextRefIdx)->getViewIndex();
    452483        m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;
    453484        Int iCurrRefDir = iTextRefDir;
    454         for( Int iCurrRefIdx =0; ( iCurrRefIdx<pcCurrSlice->getNumRefIdx(( RefPicList )iCurrRefDir ) ) && ( m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0 ) ; iCurrRefIdx++)
     485
     486        for(Int iCurrRefIdx = 0; (iCurrRefIdx<pcCurrSlice->getNumRefIdx((RefPicList)iCurrRefDir)) && (m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0); iCurrRefIdx++)
    455487        {
    456           if( pcCurrSlice->getRefPOC( ( RefPicList )iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&
    457             pcCurrSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId )
     488          if(pcCurrSlice->getRefPOC((RefPicList)iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&
     489             pcCurrSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId)
    458490          { 
    459491            m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;
     
    461493        }
    462494      }
    463 
    464495    }
    465496#if H_3D_FCO
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPic.h

    r1200 r1279  
    9494#endif
    9595#endif
    96 #if H_3D_QTLPC
     96#if NH_3D_QTLPC
    9797  Bool                  m_bReduceBitsQTL;
    9898#endif
    99 #if H_3D_NBDV
     99#if NH_3D_NBDV
    100100  UInt        m_uiRapRefIdx;
    101101  RefPicList  m_eRapRefList;
    102102  Int         m_iNumDdvCandPics;
    103   Bool        m_abTIVRINCurrRL  [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists
     103  Bool        m_abTIVRINCurrRL [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists
    104104  Int         m_aiTexToDepRef  [2][MAX_NUM_REF];
    105105#endif
     
    132132#endif
    133133#endif
    134 #if H_3D_QTLPC
     134#if NH_3D_QTLPC
    135135  Bool          getReduceBitsFlag ()             { return m_bReduceBitsQTL;     }
    136136  Void          setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag;    }
     
    182182#endif
    183183#if NH_3D
     184#if NH_3D_ARP
     185  Void          getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx );
     186#endif
    184187  Void          compressMotion(Int scale);
    185188#else   
     
    209212  Void          print( Bool legend );
    210213#endif
    211 #if H_3D_NBDV
     214#if NH_3D_NBDV
    212215  Int           getNumDdvCandPics()                    {return m_iNumDdvCandPics;   }
    213216  Int           getDisCandRefPictures(Int iColPOC);
     
    248251  Void        push_back( TComList<TComPic*>* list ) { m_lists.push_back( list );   }
    249252  Int         size     ()                           { return (Int) m_lists.size(); }
    250 #if H_3D_ARP
     253#if NH_3D_ARP
    251254  TComList<TComPic*>*  getPicList   ( Int layerIdInNuh );
    252255#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPicYuv.cpp

    r1200 r1279  
    9191  m_iPicHeight        = iPicHeight;
    9292
    93 #if H_3D_IV_MERGE
     93#if NH_3D_IV_MERGE
     94  m_iCuWidth        = uiMaxCUWidth;
     95  m_iCuHeight       = uiMaxCUHeight;
     96
    9497  m_iNumCuInWidth   = m_iPicWidth / m_iCuWidth;
    9598  m_iNumCuInWidth  += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0;
     
    292295  fclose(pFile);
    293296}
    294 #if H_3D
    295 #if H_3D_IV_MERGE
     297#if NH_3D_IV_MERGE
    296298Void
    297299TComPicYuv::getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY )
     
    319321  riAbsZorderIdx      = g_auiRasterToZscan[ iRastPartIdx ];
    320322}
    321 #endif
     323
     324#endif
     325
     326#if H_3D
    322327Void TComPicYuv::setLumaTo( Pel pVal )
    323328{
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPicYuv.h

    r1200 r1279  
    8080
    8181  Bool  m_bIsBorderExtended;
    82 #if H_3D_IV_MERGE
     82#if NH_3D_IV_MERGE
    8383  Int   m_iBaseUnitWidth;       ///< Width of Base Unit (with maximum depth or minimum size, m_iCuWidth >> Max. Depth)
    8484  Int   m_iBaseUnitHeight;      ///< Height of Base Unit (with maximum depth or minimum size, m_iCuHeight >> Max. Depth)
    8585  Int   m_iNumCuInWidth;
     86  Int   m_iCuWidth;             ///< Width of Coding Unit (CU)
     87  Int   m_iCuHeight;            ///< Height of Coding Unit (CU)
    8688#endif
    8789
     
    168170  Void  setLumaTo    ( Pel pVal ); 
    169171  Void  setChromaTo  ( Pel pVal ); 
    170 #if H_3D_IV_MERGE
     172#if NH_3D_IV_MERGE
    171173  // sample to block and block to sample conversion
    172174  Void  getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY );
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPrediction.cpp

    r1243 r1279  
    8282    }
    8383  }
    84 #if H_3D_VSP
    85   m_pDepthBlock = (Int*) malloc(MAX_NUM_SPU_W*MAX_NUM_SPU_W*sizeof(Int));
     84#if NH_3D_VSP
     85  m_pDepthBlock = (Int*) malloc(MAX_NUM_PART_IDXS_IN_CTU_WIDTH*MAX_NUM_PART_IDXS_IN_CTU_WIDTH*sizeof(Int));
    8686  if (m_pDepthBlock == NULL)
    8787  {
     
    9494TComPrediction::~TComPrediction()
    9595{
    96 #if H_3D_VSP
     96#if NH_3D_VSP
    9797  if (m_pDepthBlock != NULL)
    9898  {
     
    123123  m_cYuvPredTemp.destroy();
    124124
    125 #if H_3D_ARP
     125#if NH_3D_ARP
    126126  m_acYuvPredBase[0].destroy();
    127127  m_acYuvPredBase[1].destroy();
     
    182182
    183183    m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC );
    184 #if H_3D_ARP
    185     m_acYuvPredBase[0] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    186     m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    187 #endif
    188 #if H_3D_VSP
    189     m_cYuvDepthOnVsp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );
     184#if NH_3D_ARP
     185    m_acYuvPredBase[0] .create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC );
     186    m_acYuvPredBase[1] .create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC );
     187#endif
     188#if NH_3D_VSP
     189    m_cYuvDepthOnVsp.create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC );
    190190#endif
    191191
     
    201201    }
    202202  }
    203 #if H_3D_IC
     203#if NH_3D_IC
    204204  m_uiaShift[0] = 0;
    205205  for( Int i = 1; i < 64; i++ )
     
    584584      Int RefPOCL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getPOC();
    585585      Int RefPOCL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getPOC();
    586 #if H_3D_ARP
     586#if NH_3D_ARP
    587587      if(!pcCU->getARPW(PartAddr) && RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr))
    588588#else
     
    597597}
    598598
    599 #if H_3D_SPIVMP
     599#if NH_3D_SPIVMP
    600600Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr )
    601601{
     
    606606    pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]);
    607607  }
     608#if H_3D_ARP // check this!
    608609  if( pcCU->getARPW( uiPartAddr ) != 0 )
    609610  {
    610611    return;
    611612  }
     613#endif
    612614
    613615  // horizontal sub-PU merge
     
    683685#endif
    684686
    685 #if H_3D_DBBP
     687#if NH_3D_DBBP
    686688PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU)
    687689{
     690  const TComSPS* sps = pcCU->getSlice()->getSPS();
     691  UInt uiMaxCUWidth = sps->getMaxCUWidth();
     692  UInt uiMaxCUHeight = sps->getMaxCUHeight();
     693 
    688694  // find virtual partitioning for this CU based on depth block
    689695  // segmentation of texture block --> mask IDs
     
    693699  Int iSumDepth = 0;
    694700  Int iSubSample = 4;
    695   Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth();
    696   Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight();
     701  Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth(COMPONENT_Y);
     702  Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(COMPONENT_Y);
    697703  TComMv cDv = pcCU->getSlice()->getDepthRefinementFlag(  ) ? pcCU->getDvInfo(0).m_acDoNBDV : pcCU->getDvInfo(0).m_acNBDV;
    698704  if( pcCU->getSlice()->getDepthRefinementFlag(  ) )
     
    700706    cDv.setVer(0);
    701707  }
    702   Int iBlkX = ( pcCU->getAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2);
    703   Int iBlkY = ( pcCU->getAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2);
     708  Int iBlkX = ( pcCU->getCtuRsAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getHor()+2)>>2);
     709  Int iBlkY = ( pcCU->getCtuRsAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getVer()+2)>>2);
    704710 
    705711  UInt t=0;
     
    788794  }
    789795
    790   PartSize matchedPartSize = SIZE_NONE;
     796  PartSize matchedPartSize = NUMBER_OF_PART_SIZES;
    791797
    792798  Int iMaxMatchSum = 0;
     
    803809  }
    804810
    805   AOF( matchedPartSize != SIZE_NONE );
     811  AOF( matchedPartSize != NUMBER_OF_PART_SIZES );
    806812
    807813  return matchedPartSize;
     
    810816Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU)
    811817{
     818  const TComSPS* sps = pcCU->getSlice()->getSPS();
     819  UInt uiMaxCUWidth = sps->getMaxCUWidth();
     820  UInt uiMaxCUHeight = sps->getMaxCUHeight();
     821 
    812822  // segmentation of texture block --> mask IDs
    813823  Pel*  pDepthBlockStart      = pDepthPels;
     
    821831  iSumDepth  = pDepthPels[ 0 ];
    822832 
    823   Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth();
    824   Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(); 
     833  Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth(COMPONENT_Y);
     834  Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(COMPONENT_Y); 
    825835  TComMv cDv = pcCU->getSlice()->getDepthRefinementFlag(  ) ? pcCU->getDvInfo(0).m_acDoNBDV : pcCU->getDvInfo(0).m_acNBDV;
    826836  if( pcCU->getSlice()->getDepthRefinementFlag(  ) )
     
    828838    cDv.setVer(0);
    829839  }
    830   Int iBlkX = ( pcCU->getAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2);
    831   Int iBlkY = ( pcCU->getAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2);
     840  Int iBlkX = ( pcCU->getCtuRsAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getHor()+2)>>2);
     841  Int iBlkY = ( pcCU->getCtuRsAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCtus() ) * uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCtu() ] ]+ ((cDv.getVer()+2)>>2);
    832842  if (iBlkX>(Int)(iPictureWidth - uiWidth))
    833843  {
     
    944954}
    945955
    946 Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize )
    947 {
    948   Pel*  piSrc[2]    = {pInYuv[0]->getLumaAddr(uiPartAddr), pInYuv[1]->getLumaAddr(uiPartAddr)};
    949   UInt  uiSrcStride = pInYuv[0]->getStride();
    950   Pel*  piDst       = pOutYuv->getLumaAddr(uiPartAddr);
    951   UInt  uiDstStride = pOutYuv->getStride();
     956Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY )
     957{
     958  Pel*  piSrc[2]    = {pInYuv[0]->getAddr(COMPONENT_Y, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Y, uiPartAddr)};
     959  UInt  uiSrcStride = pInYuv[0]->getStride(COMPONENT_Y);
     960  Pel*  piDst       = pOutYuv->getAddr(COMPONENT_Y, uiPartAddr);
     961  UInt  uiDstStride = pOutYuv->getStride(COMPONENT_Y);
    952962 
    953963  UInt  uiMaskStride= MAX_CU_SIZE;
     
    988998        right  = (x==uiWidth-1)  ? tmpTar[y*uiWidth+x] : tmpTar[y*uiWidth+x+1];
    989999       
    990         piDst[x] = (l!=r) ? ClipY( Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 )) : tmpTar[y*uiWidth+x];
     1000        piDst[x] = (l!=r) ? ClipBD( Pel(( left + (tmpTar[y*uiWidth+x] << 1) + right ) >> 2 ), bitDepthY) : tmpTar[y*uiWidth+x];
    9911001      }
    9921002      piDst     += uiDstStride;
     
    10061016        bottom = (y==uiHeight-1) ? tmpTar[y*uiWidth+x] : tmpTar[(y+1)*uiWidth+x];
    10071017       
    1008         piDst[x] = (t!=b) ? ClipY( Pel(( top + (tmpTar[y*uiWidth+x] << 1) + bottom ) >> 2 )) : tmpTar[y*uiWidth+x];
     1018        piDst[x] = (t!=b) ? ClipBD( Pel(( top + (tmpTar[y*uiWidth+x] << 1) + bottom ) >> 2 ), bitDepthY) : tmpTar[y*uiWidth+x];
    10091019      }
    10101020      piDst     += uiDstStride;
     
    10191029 
    10201030  // now combine chroma
    1021   Pel*  piSrcU[2]       = { pInYuv[0]->getCbAddr(uiPartAddr), pInYuv[1]->getCbAddr(uiPartAddr) };
    1022   Pel*  piSrcV[2]       = { pInYuv[0]->getCrAddr(uiPartAddr), pInYuv[1]->getCrAddr(uiPartAddr) };
    1023   UInt  uiSrcStrideC    = pInYuv[0]->getCStride();
    1024   Pel*  piDstU          = pOutYuv->getCbAddr(uiPartAddr);
    1025   Pel*  piDstV          = pOutYuv->getCrAddr(uiPartAddr);
    1026   UInt  uiDstStrideC    = pOutYuv->getCStride();
     1031  Pel*  piSrcU[2]       = { pInYuv[0]->getAddr(COMPONENT_Cb, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Cb, uiPartAddr) };
     1032  Pel*  piSrcV[2]       = { pInYuv[0]->getAddr(COMPONENT_Cr, uiPartAddr), pInYuv[1]->getAddr(COMPONENT_Cr, uiPartAddr) };
     1033  UInt  uiSrcStrideC    = pInYuv[0]->getStride(COMPONENT_Cb);
     1034  Pel*  piDstU          = pOutYuv->getAddr(COMPONENT_Cb, uiPartAddr);
     1035  Pel*  piDstV          = pOutYuv->getAddr(COMPONENT_Cr, uiPartAddr);
     1036  UInt  uiDstStrideC    = pOutYuv->getStride(COMPONENT_Cb);
    10271037  UInt  uiWidthC        = uiWidth >> 1;
    10281038  UInt  uiHeightC       = uiHeight >> 1;
     
    10701080        if (l!=r)
    10711081        {
    1072           filSrcU = ClipC( Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 ));
    1073           filSrcV = ClipC( Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 ));
     1082          filSrcU = ClipBD( Pel(( leftU + (tmpTarU[y*uiWidthC+x] << 1) + rightU ) >> 2 ), bitDepthY);
     1083          filSrcV = ClipBD( Pel(( leftV + (tmpTarV[y*uiWidthC+x] << 1) + rightV ) >> 2 ), bitDepthY);
    10741084        }
    10751085        else
     
    11031113        if (t!=b)
    11041114        {
    1105           filSrcU = ClipC( Pel(( topU + (tmpTarU[y*uiWidthC+x] << 1) + bottomU ) >> 2 ));
    1106           filSrcV = ClipC( Pel(( topV + (tmpTarV[y*uiWidthC+x] << 1) + bottomV ) >> 2 ));
     1115          filSrcU = ClipBD( Pel(( topU + (tmpTarU[y*uiWidthC+x] << 1) + bottomU ) >> 2 ), bitDepthY);
     1116          filSrcV = ClipBD( Pel(( topV + (tmpTarV[y*uiWidthC+x] << 1) + bottomV ) >> 2 ), bitDepthY);
    11071117        }
    11081118        else
     
    11411151  {
    11421152    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    1143 #if H_3D_VSP
     1153#if NH_3D_VSP
    11441154    if ( pcCU->getVSPFlag(uiPartAddr) == 0)
    11451155    {
    11461156#endif
    1147     if ( eRefPicList != REF_PIC_LIST_X )
    1148     {
    1149       if( pcCU->getSlice()->getPPS()->getUseWP())
    1150       {
    1151         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     1157      if ( eRefPicList != REF_PIC_LIST_X )
     1158      {
     1159        if( pcCU->getSlice()->getPPS()->getUseWP())
     1160        {
     1161          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     1162        }
     1163        else
     1164        {
     1165          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     1166        }
     1167        if ( pcCU->getSlice()->getPPS()->getUseWP() )
     1168        {
     1169          xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     1170        }
    11521171      }
    11531172      else
    11541173      {
    1155         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    1156       }
    1157       if ( pcCU->getSlice()->getPPS()->getUseWP() )
    1158       {
    1159         xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    1160       }
    1161     }
    1162     else
    1163     {
    1164 #if H_3D_SPIVMP
     1174#if NH_3D_SPIVMP
    11651175        if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0) 
    11661176        {
     
    11941204        {
    11951205#endif
     1206          if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
     1207          {
     1208            xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     1209          }
     1210          else
     1211          {
     1212            xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
     1213          }
     1214#if NH_3D_SPIVMP
     1215        }
     1216#endif
     1217      }
     1218#if NH_3D_VSP
     1219    }
     1220    else
     1221    {
    11961222      if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    11971223      {
    1198         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     1224        xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
    11991225      }
    12001226      else
    12011227      {
    1202         xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    1203       }
    1204 #if H_3D_SPIVMP
    1205         }
    1206 #endif
    1207     }
    1208 #if H_3D_VSP
     1228        xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
     1229      }
     1230    }
     1231#endif
     1232    return;
     1233  }
     1234
     1235  for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartitions(); iPartIdx++ )
     1236  {
     1237    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
     1238
     1239#if NH_3D_VSP
     1240    if ( pcCU->getVSPFlag(uiPartAddr) == 0 )
     1241    {
     1242#endif
     1243    if ( eRefPicList != REF_PIC_LIST_X )
     1244    {
     1245      if( pcCU->getSlice()->getPPS()->getUseWP())
     1246      {
     1247        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
     1248      }
     1249      else
     1250      {
     1251        xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     1252      }
     1253      if ( pcCU->getSlice()->getPPS()->getUseWP() )
     1254      {
     1255        xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
     1256      }
    12091257    }
    12101258    else
    12111259    {
    1212       if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    1213       {
    1214         xPredInterUniVSP( pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
    1215       }
    1216       else
    1217       {
    1218         xPredInterBiVSP ( pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    1219       }
    1220     }
    1221 #endif
    1222     return;
    1223   }
    1224 
    1225   for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartitions(); iPartIdx++ )
    1226   {
    1227     pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    1228 
    1229 #if H_3D_VSP
    1230     if ( pcCU->getVSPFlag(uiPartAddr) == 0 )
    1231     {
    1232 #endif
    1233     if ( eRefPicList != REF_PIC_LIST_X )
    1234     {
    1235       if( pcCU->getSlice()->getPPS()->getUseWP())
    1236       {
    1237         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true );
    1238       }
    1239       else
    1240       {
    1241         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    1242       }
    1243       if ( pcCU->getSlice()->getPPS()->getUseWP() )
    1244       {
    1245         xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred );
    1246       }
    1247     }
    1248     else
    1249     {
    1250 #if H_3D_SPIVMP
    1251        if (pcCU->getSPIVMPFlag(uiPartAddr)!=0) 
     1260#if NH_3D_SPIVMP
     1261      if (pcCU->getSPIVMPFlag(uiPartAddr)!=0) 
    12521262      {
    12531263        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     
    12791289      {
    12801290#endif
    1281       if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    1282       {
    1283         xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
    1284       }
    1285       else
    1286       {
    1287         xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    1288       }
    1289 #if H_3D_SPIVMP
    1290        }
    1291 #endif
    1292     }
    1293 #if H_3D_VSP
     1291        if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
     1292        {
     1293          xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     1294        }
     1295        else
     1296        {
     1297          xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
     1298        }
     1299#if NH_3D_SPIVMP
     1300      }
     1301#endif
     1302    }
     1303#if NH_3D_VSP
    12941304    }
    12951305    else
     
    13171327  pcCU->checkMvVertRest(cMv, eRefPicList, iRefIdx );
    13181328#endif
    1319 #if H_3D_ARP
    1320   if(pcCU->getARPW( uiPartAddr ) > 0  && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC())
    1321   {
    1322     xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );
     1329#if NH_3D_ARP
     1330  if(  pcCU->getARPW( uiPartAddr ) > 0 )
     1331  {
     1332    if( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC() )
     1333  {
     1334      xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , pcYuvPred , bi );
    13231335  }
    13241336  else
    13251337  {
    1326     if(  pcCU->getARPW( uiPartAddr ) > 0
    1327       && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N
    1328       && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()!= pcCU->getSlice()->getPOC()
    1329       )
    1330     {
    1331       xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi );
     1338      xPredInterUniARP( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, bi );
     1339    }     
    13321340    }
    13331341    else
    13341342    {
    13351343#endif
    1336 #if H_3D_IC
    1337       Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() );
    1338       xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
    1339 #if H_3D_ARP
    1340         , false
    1341 #endif
    1342         , bICFlag );
    1343       bICFlag = bICFlag && (iWidth > 8);
    1344       xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
    1345 #if H_3D_ARP
     1344  for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++)
     1345  {
     1346    const ComponentID compID=ComponentID(comp);
     1347#if NH_3D_IC
     1348    Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() != pcCU->getSlice()->getViewIndex() ) && ( isLuma(compID) || (iWidth > 8) );
     1349      xPredInterBlk(compID,  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID))
     1350#if NH_3D_ARP
    13461351        , false
    13471352#endif
    13481353        , bICFlag );
    13491354#else
    1350 
    1351   for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++)
    1352   {
    1353     const ComponentID compID=ComponentID(comp);
    13541355    xPredInterBlk  (compID,  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) );
    1355   }
    1356 #endif
    1357 #if H_3D_ARP
    1358     }
    1359   }
    1360 #endif
    1361 }
    1362 
    1363 #if H_3D_VSP
     1356#endif
     1357  }
     1358#if NH_3D_ARP
     1359  }
     1360#endif
     1361}
     1362
     1363#if NH_3D_VSP
    13641364Void TComPrediction::xPredInterUniVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi )
    13651365{
     
    13821382Void TComPrediction::xPredInterUniSubPU( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU, Int heightSubPU )
    13831383{
    1384   UInt numPartsInLine       = pcCU->getPic()->getNumPartInWidth();
     1384  UInt numPartsInLine       = pcCU->getPic()->getNumPartInCtuWidth();
    13851385  UInt horiNumPartsInSubPU  = widthSubPU >> 2;
    13861386  UInt vertNumPartsInSubPU  = (heightSubPU >> 2) * numPartsInLine;
     
    13981398      pcCU->clipMv(cMv);
    13991399
    1400       xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi );
    1401       xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi );
    1402 
    1403     }
    1404   }
    1405 }
    1406 
    1407 #endif
    1408 
    1409 #if H_3D_ARP
    1410 Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
    1411 {
    1412   Int         iRefIdx      = pNewMvFiled ? pNewMvFiled->getRefIdx() : pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
    1413   TComMv      cMv          = pNewMvFiled ? pNewMvFiled->getMv()     : pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     1400      xPredInterBlk( COMPONENT_Y,  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
     1401      xPredInterBlk( COMPONENT_Cb, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) );
     1402      xPredInterBlk( COMPONENT_Cr, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) );
     1403    }
     1404  }
     1405}
     1406#endif
     1407
     1408#if NH_3D_ARP
     1409//temporal ARP
     1410Void TComPrediction::xPredInterUniARP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi )
     1411{
     1412  Int         iRefIdx      = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
     1413  TComMv      cMv          = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
    14141414  Bool        bTobeScaled  = false;
    14151415  TComPic* pcPicYuvBaseCol = NULL;
    14161416  TComPic* pcPicYuvBaseRef = NULL;
    14171417
    1418 #if H_3D_NBDV
     1418#if NH_3D_NBDV
    14191419  DisInfo cDistparity;
    14201420  cDistparity.m_acNBDV = pcCU->getDvInfo(0).m_acNBDV;
     
    14251425  UChar dW = pcCU->getARPW ( uiPartAddr );
    14261426
    1427   {
    14281427    Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList);
    1429     if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() )
    1430     {
    1431       bTobeScaled = true;
    1432     }
    1433 
    1434     pcPicYuvBaseCol =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(),                              cDistparity.m_aVIdxCan );
    1435 
    1436     pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan );
    1437 
    1438     if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan))
     1428  if (arpRefIdx < 0 || !pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan))
    14391429    {
    14401430      dW = 0;
     
    14431433    else
    14441434    {
    1445       assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC() );
     1435    if( arpRefIdx != iRefIdx )
     1436    {
     1437      bTobeScaled = true;
     1438    }
     1439    pcPicYuvBaseCol =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(),                              cDistparity.m_aVIdxCan );
     1440    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan );
    14461441    }
    14471442
     
    14501445      Int iCurrPOC    = pcCU->getSlice()->getPOC();
    14511446      Int iColRefPOC  = pcCU->getSlice()->getRefPOC( eRefPicList, iRefIdx );
    1452       Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList,  0);
     1447    Int iCurrRefPOC = pcCU->getSlice()->getRefPOC( eRefPicList, arpRefIdx );
    14531448      Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iCurrPOC, iColRefPOC);
    14541449      if ( iScale != 4096 )
     
    14561451        cMv = cMv.scaleMv( iScale );
    14571452      }
    1458       iRefIdx = 0;
    1459     }
     1453    iRefIdx = arpRefIdx;
    14601454  }
    14611455
    14621456  pcCU->clipMv(cMv);
    14631457  TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec();
    1464   xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true );
    1465   xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), true );
     1458
     1459  for (UInt comp=COMPONENT_Y; comp< rpcYuvPred->getNumberValidComponents(); comp++)
     1460  {
     1461    const ComponentID compID=ComponentID(comp);
     1462    xPredInterBlk  ( compID,  pcCU, pcPicYuvRef, uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 ), pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true );
     1463  }
    14661464
    14671465  if( dW > 0 )
     
    14791477    pcCU->clipMv( cNBDV );
    14801478   
    1481     pcPicYuvRef = pcPicYuvBaseCol->getPicYuvRec();
    1482     xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true );
    1483     if (iWidth > 8)
    1484       xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, true );
     1479    TComPicYuv* pcPicYuvBaseColRec = pcPicYuvBaseCol->getPicYuvRec();
     1480    TComPicYuv* pcPicYuvBaseRefRec = pcPicYuvBaseRef->getPicYuvRec();
    14851481   
    1486     pcPicYuvRef = pcPicYuvBaseRef->getPicYuvRec();
    1487     xPredInterLumaBlk  ( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true );
    1488  
    1489     if (iWidth > 8)
    1490       xPredInterChromaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, true );
     1482    UInt uiCompNum = ( iWidth > 8 ) ? 3: 1;
     1483    for (UInt comp=COMPONENT_Y; comp< uiCompNum; comp++)
     1484    {
     1485      const ComponentID compID=ComponentID(comp);
     1486      xPredInterBlk  ( compID,  pcCU, pcPicYuvBaseColRec, uiPartAddr, &cNBDV, iWidth, iHeight, pYuvB0, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true );
     1487      xPredInterBlk  ( compID,  pcCU, pcPicYuvBaseRefRec, uiPartAddr, &cMVwithDisparity, iWidth, iHeight, pYuvB1, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true );
     1488    }   
    14911489   
    14921490    pYuvB0->subtractARP( pYuvB0 , pYuvB1 , uiPartAddr , iWidth , iHeight );
     
    14961494      pYuvB0->multiplyARP( uiPartAddr , iWidth , iHeight , dW );
    14971495    }
    1498     rpcYuvPred->addARP( rpcYuvPred , pYuvB0 , uiPartAddr , iWidth , iHeight , !bi );
     1496    rpcYuvPred->addARP( rpcYuvPred , pYuvB0 , uiPartAddr , iWidth , iHeight , !bi, pcCU->getSlice()->getSPS()->getBitDepths() );
    14991497  }
    15001498}
     
    15051503  TComMv      cDMv          = pcCU->getCUMvField( eBaseRefPicList )->getMv( uiPartAddr );
    15061504  TComPic* pcPicYuvBaseCol  = pcCU->getSlice()->getRefPic( eBaseRefPicList, iRefIdx ); 
    1507   TComPicYuv* pcYuvBaseCol  = pcPicYuvBaseCol->getPicYuvRec();
    1508   Int uiLCUAddr,uiAbsPartAddr;
    15091505  Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
    15101506  Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2);
     
    15121508  irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX);
    15131509  irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 
    1514   pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
    1515   TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
     1510
     1511  Int uiLCUAddr,uiAbsPartAddr;
     1512  pcPicYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
     1513  TComDataCU *pColCU = pcPicYuvBaseCol->getCtu( uiLCUAddr );
    15161514
    15171515  TComPic* pcPicYuvBaseTRef = NULL;
     
    15651563}
    15661564
    1567 Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
     1565//inter-view ARP
     1566Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi )
    15681567{
    15691568  Int         iRefIdx       = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
     
    15781577  Bool bTMVAvai = false;     
    15791578  TComMv cBaseTMV;
    1580   if( pNewMvFiled )
    1581   {
    1582     iRefIdx = pNewMvFiled->getRefIdx();
    1583     cDMv = pNewMvFiled->getMv();
    1584   }
     1579
    15851580  pcCU->clipMv(cTempDMv);
    15861581
    1587   assert(dW > 0);
    1588   if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex()))
    1589   {
    1590     dW = 0;
    1591   }
    1592   Int uiLCUAddr,uiAbsPartAddr;
    15931582  Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
    15941583  Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2);
     
    15961585  irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX);
    15971586  irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 
    1598   pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
    1599   TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
     1587 
     1588  Int uiLCUAddr,uiAbsPartAddr;
     1589  pcPicYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
     1590  TComDataCU *pColCU = pcPicYuvBaseCol->getCtu( uiLCUAddr );
    16001591  if( pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getIsDepth() )
    16011592  {
     
    16681659      RefPicList eRefPicListCurr = RefPicList(iList);
    16691660      Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr);
    1670       if( iRef != -1)
     1661      if( iRef != -1 && pcCU->getSlice()->getArpRefPicAvailable( eRefPicListCurr, pcPicYuvBaseCol->getViewIndex()))
    16711662      {
    16721663        pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 
     
    17021693  }
    17031694
    1704   xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ),        bTMVAvai);
    1705   xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ),        bTMVAvai);
    1706 
    1707   if( dW > 0 && bTMVAvai )
    1708   {
     1695  for (UInt comp=COMPONENT_Y; comp< rpcYuvPred->getNumberValidComponents(); comp++)
     1696  {
     1697    const ComponentID compID=ComponentID(comp);
     1698    xPredInterBlk  ( compID,  pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi || ( dW > 0 && bTMVAvai ), pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), bTMVAvai );
     1699  }
     1700
     1701  if( dW > 0 )
     1702  {
     1703    assert ( bTMVAvai );
    17091704    TComYuv*    pYuvCurrTRef    = &m_acYuvPredBase[0];
    17101705    TComYuv*    pYuvBaseTRef    = &m_acYuvPredBase[1];
     
    17201715      pYuvCurrTRef->clear(); pYuvBaseTRef->clear();
    17211716    }
    1722     xPredInterLumaBlk  ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true,   true);
    1723 
    1724     if (iWidth > 8)
    1725       xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true,   true);
    1726 
    1727     xPredInterLumaBlk  ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, true,   true);
    1728 
    1729     if (iWidth > 8)
    1730       xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, true,   true);
     1717
     1718    UInt uiCompNum = ( iWidth > 8 ) ? 3: 1;
     1719    for (UInt comp=COMPONENT_Y; comp< uiCompNum; comp++)
     1720    {
     1721      const ComponentID compID=ComponentID(comp);
     1722      xPredInterBlk  ( compID,  pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true );
     1723      xPredInterBlk  ( compID,  pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv, iWidth, iHeight, pYuvBaseTRef, true, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)), true );
     1724    }
    17311725
    17321726    pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight ); 
     
    17351729      pYuvCurrTRef->multiplyARP( uiPartAddr , iWidth , iHeight , dW );
    17361730    }
    1737     rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi );
     1731    rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi, pcCU->getSlice()->getSPS()->getBitDepths() );
    17381732  }
    17391733}
     
    17901784}
    17911785
    1792 #if H_3D_VSP
    1793 
     1786#if NH_3D_VSP
    17941787Void TComPrediction::xPredInterBiVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred )
    17951788{
     
    18131806  }
    18141807
    1815   xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
    1816 }
    1817 
     1808  xWeightedAverage( &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, pcCU->getSlice()->getSPS()->getBitDepths() );
     1809}
    18181810#endif
    18191811
     
    18351827
    18361828Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth
    1837 #if H_3D_ARP
     1829#if NH_3D_ARP
    18381830    , Bool filterType
    18391831#endif
    1840 #if H_3D_IC
     1832#if NH_3D_IC
    18411833    , Bool bICFlag
    18421834#endif
     
    18571849  Int     yFrac  = mv->getVer() & ((1<<shiftVer)-1);
    18581850
    1859 #if H_3D_IC
     1851#if NH_3D_INTEGER_MV_DEPTH
    18601852  if( cu->getSlice()->getIsDepth() )
    18611853  {
    18621854    refOffset = mv->getHor() + mv->getVer() * refStride;
    1863     ref       = refPic->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr ) + refOffset;
     1855    ref       = refPic->getAddr(compID, cu->getCtuRsAddr(), cu->getZorderIdxInCtu() + partAddr ) + refOffset;
    18641856    xFrac     = 0;
    18651857    yFrac     = 0;
     
    18741866  if ( yFrac == 0 )
    18751867  {
    1876 #if H_3D_IC
    1877     m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac,       !bi || bICFlag
     1868#if NH_3D_IC
     1869    m_if.filterHor(compID, ref, refStride, dst,  dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag, chFmt, bitDepth
    18781870#else
    18791871    m_if.filterHor(compID, ref, refStride, dst,  dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt, bitDepth
    18801872#endif
    1881 #if H_3D_ARP
     1873#if NH_3D_ARP
    18821874    , filterType
    18831875#endif
     
    18861878  else if ( xFrac == 0 )
    18871879  {
    1888 #if H_3D_IC
    1889     m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi || bICFlag
     1880#if NH_3D_IC
     1881    m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag, chFmt, bitDepth
    18901882#else
    18911883    m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt, bitDepth
    18921884#endif
    1893 #if H_3D_ARP
     1885#if NH_3D_ARP
    18941886    , filterType
    18951887#endif
     
    19041896
    19051897    m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false,      chFmt, bitDepth
    1906 #if H_3D_ARP
     1898#if NH_3D_ARP
    19071899    , filterType
    19081900#endif
    19091901);
    1910 #if H_3D_IC
    1911     m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height,              yFrac, false, !bi || bICFlag
     1902#if NH_3D_IC
     1903    m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight,               yFrac, false, !bi || bICFlag, chFmt, bitDepth
    19121904#else
    19131905    m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight,               yFrac, false, !bi, chFmt, bitDepth
    19141906#endif
    1915 #if H_3D_ARP
     1907#if NH_3D_ARP
    19161908    , filterType
    19171909#endif
     
    19191911  }
    19201912
    1921 #if H_3D_IC
     1913#if NH_3D_IC
    19221914  if( bICFlag )
    19231915  {
    19241916    Int a, b, i, j;
    19251917    const Int iShift = IC_CONST_SHIFT;
    1926 
    1927     xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_LUMA );
    1928 
    1929 
    1930     for ( i = 0; i < height; i++ )
    1931     {
    1932       for ( j = 0; j < width; j++ )
    1933       {
    1934           dst[j] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, ( ( a*dst[j] ) >> iShift ) + b );
     1918    Pel *dst2 = dst;
     1919
     1920    xGetLLSICPrediction( compID, cu, mv, refPic, a, b, bitDepth );
     1921
     1922    for ( i = 0; i < cxHeight; i++ )
     1923    {
     1924      for ( j = 0; j < cxWidth; j++ )
     1925      {
     1926        dst[j] = Clip3( 0, ( 1 << bitDepth ) - 1, ( ( a*dst[j] ) >> iShift ) + b );
    19351927      }
    19361928      dst += dstStride;
     
    19391931    if(bi)
    19401932    {
    1941       Pel *dst2      = dstPic->getLumaAddr( partAddr );
    1942       Int shift = IF_INTERNAL_PREC - g_bitDepthY;
    1943       for (i = 0; i < height; i++)
    1944       {
    1945         for (j = 0; j < width; j++)
    1946         {
    1947           Short val = dst2[j] << shift;
    1948           dst2[j] = val - (Short)IF_INTERNAL_OFFS;
     1933      Int shift = IF_INTERNAL_PREC - bitDepth;
     1934      for (i = 0; i < cxHeight; i++)
     1935      {
     1936        for (j = 0; j < cxWidth; j++)
     1937        {
     1938          Pel val = dst2[j] << shift;
     1939          dst2[j] = val - (Pel)IF_INTERNAL_OFFS;
    19491940        }
    19501941        dst2 += dstStride;
     
    19561947}
    19571948
    1958 
    1959 #if H_3D_ARP
    1960     , Bool filterType
    1961 #endif
    1962 #if H_3D_IC
    1963     , Bool bICFlag
    1964 #endif
    1965 #if H_3D_IC
    1966     m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag
    1967 #else
    1968 #endif
    1969 #if H_3D_ARP
    1970     , filterType
    1971 #endif
    1972 #if H_3D_IC
    1973     m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag
    1974 #else
    1975 #endif
    1976 #if H_3D_ARP
    1977     , filterType
    1978 #endif
    1979 #if H_3D_IC
    1980     m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag
    1981 #else
    1982 #endif
    1983 #if H_3D_ARP
    1984     , filterType
    1985 #endif
    1986 #if H_3D_IC
    1987     m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag
    1988 #else
    1989 #endif
    1990 #if H_3D_ARP
    1991     , filterType
    1992 #endif
    1993 #if H_3D_ARP
    1994     , filterType
    1995 #endif 
    1996 #if H_3D_IC
    1997     m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight  , yFrac, false, !bi || bICFlag
    1998 #else
    1999 #endif
    2000 #if H_3D_ARP
    2001     , filterType
    2002 #endif
    2003 #if H_3D_ARP
    2004     , filterType
    2005 #endif
    2006 #if H_3D_IC
    2007     m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight  , yFrac, false, !bi || bICFlag
    2008 #else
    2009 #endif
    2010 #if H_3D_ARP
    2011     , filterType
    2012 #endif
    2013 #if H_3D_IC
    2014   if( bICFlag )
    2015   {
    2016     Int a, b, i, j;
    2017     const Int iShift = IC_CONST_SHIFT;
    2018 
    2019     xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_U ); // Cb
    2020     for ( i = 0; i < cxHeight; i++ )
    2021     {
    2022       for ( j = 0; j < cxWidth; j++ )
    2023       {
    2024           dstCb[j] = Clip3(  0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCb[j] ) >> iShift ) + b );
    2025       }
    2026       dstCb += dstStride;
    2027     }
    2028     xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_V ); // Cr
    2029     for ( i = 0; i < cxHeight; i++ )
    2030     {
    2031       for ( j = 0; j < cxWidth; j++ )
    2032       {
    2033           dstCr[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCr[j] ) >> iShift ) + b );
    2034       }
    2035       dstCr += dstStride;
    2036     }
    2037 
    2038     if(bi)
    2039     {
    2040       Pel* dstCb2 = dstPic->getCbAddr( partAddr );
    2041       Pel* dstCr2 = dstPic->getCrAddr( partAddr );
    2042       Int shift = IF_INTERNAL_PREC - g_bitDepthC;
    2043       for (i = 0; i < cxHeight; i++)
    2044       {
    2045         for (j = 0; j < cxWidth; j++)
    2046         {
    2047           Short val = dstCb2[j] << shift;
    2048           dstCb2[j] = val - (Short)IF_INTERNAL_OFFS;
    2049 
    2050           val = dstCr2[j] << shift;
    2051           dstCr2[j] = val - (Short)IF_INTERNAL_OFFS;
    2052         }
    2053         dstCb2 += dstStride;
    2054         dstCr2 += dstStride;
    2055       }
    2056     }
    2057   }
    2058 #endif
    20591949Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths
    20601950 )
     
    22012091          (uiDirMode==HOR_IDX || uiDirMode==VER_IDX);
    22022092}
    2203 #if H_3D_IC
     2093#if NH_3D_IC
    22042094/** Function for deriving the position of first non-zero binary bit of a value
    22052095 * \param x input value
     
    22312121/** Function for deriving LM illumination compensation.
    22322122 */
    2233 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType )
     2123Void TComPrediction::xGetLLSICPrediction( const ComponentID compID, TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, const Int bitDepth )
    22342124{
    22352125  TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec();
    22362126  Pel *pRec = NULL, *pRef = NULL;
    22372127  UInt uiWidth, uiHeight, uiTmpPartIdx;
    2238   Int iRecStride = ( eType == TEXT_LUMA ) ? pRecPic->getStride() : pRecPic->getCStride();
    2239   Int iRefStride = ( eType == TEXT_LUMA ) ? pRefPic->getStride() : pRefPic->getCStride();
     2128  Int iRecStride = pRecPic->getStride(compID);
     2129  Int iRefStride = pRefPic->getStride(compID);
    22402130  Int iRefOffset, iHor, iVer;
    22412131  iHor = pcCU->getSlice()->getIsDepth() ? pMv->getHor() : ( ( pMv->getHor() + 2 ) >> 2 );
    22422132  iVer = pcCU->getSlice()->getIsDepth() ? pMv->getVer() : ( ( pMv->getVer() + 2 ) >> 2 );
    2243   if( eType != TEXT_LUMA )
     2133  if( !isLuma(compID) )
    22442134  {
    22452135    iHor = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getHor() + 1 ) >> 1 ) : ( ( pMv->getHor() + 4 ) >> 3 );
    22462136    iVer = pcCU->getSlice()->getIsDepth() ? ( ( pMv->getVer() + 1 ) >> 1 ) : ( ( pMv->getVer() + 4 ) >> 3 );
    22472137  }
    2248   uiWidth  = ( eType == TEXT_LUMA ) ? pcCU->getWidth( 0 )  : ( pcCU->getWidth( 0 )  >> 1 );
    2249   uiHeight = ( eType == TEXT_LUMA ) ? pcCU->getHeight( 0 ) : ( pcCU->getHeight( 0 ) >> 1 );
     2138  uiWidth  = pcCU->getWidth( 0 ) >> pRefPic->getComponentScaleX(compID);
     2139  uiHeight = pcCU->getHeight( 0 ) >> pRefPic->getComponentScaleY(compID);
    22502140
    22512141  Int i, j, iCountShift = 0;
    22522142
    2253   // LLS parameters estimation -->
     2143  // LLS parameters estimation
    22542144
    22552145  Int x = 0, y = 0, xx = 0, xy = 0;
    2256   Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12);
    2257 
    2258   if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) )
     2146  Int precShift = std::max(0, bitDepth - 12);
     2147
     2148  UInt partAddr = 0;
     2149  if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCtu() ) )
    22592150  {
    22602151    iRefOffset = iHor + iVer * iRefStride - iRefStride;
    2261     if( eType == TEXT_LUMA )
    2262     {
    2263       pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset;
    2264       pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride;
    2265     }
    2266     else if( eType == TEXT_CHROMA_U )
    2267     {
    2268       pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset;
    2269       pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride;
    2270     }
    2271     else
    2272     {
    2273       assert( eType == TEXT_CHROMA_V );
    2274       pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset;
    2275       pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - iRecStride;
    2276     }
    2277 
     2152    pRef = pRefPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) + iRefOffset;
     2153    pRec = pRecPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) - iRecStride;
    22782154    for( j = 0; j < uiWidth; j+=2 )
    22792155    {
    22802156      x += pRef[j];
    22812157      y += pRec[j];
    2282       if ( eType == TEXT_LUMA )
     2158      if( isLuma(compID) )
    22832159      {
    22842160        xx += (pRef[j] * pRef[j])>>precShift;
     
    22892165  }
    22902166
    2291   if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) )
     2167  if( pcCU->getPULeft( uiTmpPartIdx, pcCU->getZorderIdxInCtu() ) )
    22922168  {
    22932169    iRefOffset = iHor + iVer * iRefStride - 1;
    2294     if( eType == TEXT_LUMA )
    2295     {
    2296       pRef = pRefPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset;
    2297       pRec = pRecPic->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1;
    2298     }
    2299     else if( eType == TEXT_CHROMA_U )
    2300     {
    2301       pRef = pRefPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset;
    2302       pRec = pRecPic->getCbAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1;
    2303     }
    2304     else
    2305     {
    2306       assert( eType == TEXT_CHROMA_V );
    2307       pRef = pRefPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) + iRefOffset;
    2308       pRec = pRecPic->getCrAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() ) - 1;
    2309     }
    2310 
     2170    pRef = pRefPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) + iRefOffset;
     2171    pRec = pRecPic->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + partAddr ) - 1;
    23112172    for( i = 0; i < uiHeight; i+=2 )
    23122173    {
    23132174      x += pRef[0];
    23142175      y += pRec[0];
    2315       if ( eType == TEXT_LUMA )
     2176      if( isLuma(compID) )
    23162177      {
    23172178        xx += (pRef[0] * pRef[0])>>precShift;
     
    23312192  }
    23322193
    2333   if (  eType != TEXT_LUMA )
    2334   {
    2335     a = 32;
     2194  if( !isLuma(compID) )
     2195  {
     2196    a = ( 1 << IC_CONST_SHIFT );
    23362197    b = (  y - x + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift;
    23372198  }
     
    23432204  Int a2 = ( xx << iCountShift ) - ((x * x) >> precShift);
    23442205  const Int iShift = IC_CONST_SHIFT;
    2345   {
    2346     {
    23472206      const Int iShiftA2 = 6;
    23482207      const Int iAccuracyShift = 15;
     
    23502209      Int iScaleShiftA2 = 0;
    23512210      Int iScaleShiftA1 = 0;
    2352       Int a1s = a1;
    2353       Int a2s = a2;
     2211    Int a1s;
     2212    Int a2s;
    23542213
    23552214      a1 = Clip3(0, 2*a2, a1);
     
    23792238    }
    23802239  }   
    2381   }
    2382 }
    23832240#endif
    23842241
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComPrediction.h

    r1243 r1279  
    4545#include "TComWeightPrediction.h"
    4646
     47#if NH_3D_ARP
     48#include "TComPic.h"
     49#endif
    4750// forward declaration
    4851class TComMv;
     
    7780  TComYuv   m_acYuvPred[NUM_REF_PIC_LIST_01];
    7881  TComYuv   m_cYuvPredTemp;
    79 #if H_3D_ARP
     82#if NH_3D_ARP
    8083  TComYuv   m_acYuvPredBase[2];
    8184#endif
     
    8790  Pel*   m_pLumaRecBuffer;       ///< array for downsampled reconstructed luma sample
    8891  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
    89 #if H_3D_IC
     92#if NH_3D_IC
    9093  UInt   m_uiaShift[ 64 ];       // Table for multiplication to substitue of division operation
    9194#endif
    9295
    93 #if H_3D_VSP
     96#if NH_3D_VSP
    9497  Int*    m_pDepthBlock;         ///< Store a depth block, local variable, to prevent memory allocation every time
    9598  TComYuv m_cYuvDepthOnVsp;
     
    100103
    101104  // motion compensation functions
    102 #if H_3D_ARP
    103   Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false, TComMvField * pNewMvFiled = NULL );
     105#if NH_3D_ARP
     106  Void xPredInterUniARP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );
     107  Void xPredInterUniARPviewRef  ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi );
    104108  Bool xCheckBiInterviewARP     ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eBaseRefPicList, TComPic*& pcPicYuvCurrTRef, TComMv& cBaseTMV, Int& iCurrTRefPoc );
    105   Void xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled = NULL );
    106109#endif
    107110
    108111  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi=false          );
    109112  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv* pcYuvPred          );
    110 #if H_3D_VSP
     113#if NH_3D_VSP
    111114  Void xPredInterUniVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi=false          );
    112115  Void xPredInterBiVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred );
     
    114117
    115118  Void xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth
    116 #if H_3D_ARP
     119#if NH_3D_ARP
    117120    , Bool filterType = false
    118121#endif
    119 #if H_3D_IC
     122#if NH_3D_IC
    120123    , Bool bICFlag    = false
    121124#endif
    122125 );
    123126
    124 #if H_3D_ARP
    125     , Bool filterType = false
    126 #endif
    127 #if H_3D_IC
    128     , Bool bICFlag    = false
    129 #endif
    130 #if H_3D_VSP
     127#if NH_3D_VSP
    131128  Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
    132129#endif
     
    135132
    136133  Void xGetLLSPrediction ( const Pel* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0, const ChromaFormat chFmt  DEBUG_STRING_FN_DECLARE(sDebug) );
    137 #if H_3D_IC
    138   Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType );
     134#if NH_3D_IC
     135  Void xGetLLSICPrediction( const ComponentID compID, TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, const Int bitDepth);
    139136#endif
    140137  Void xDCPredFiltering( const Pel* pSrc, Int iSrcStride, Pel* pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType );
    141138  Bool xCheckIdenticalMotion    ( TComDataCU* pcCU, UInt PartAddr);
    142 #if H_3D_SPIVMP
     139#if NH_3D_SPIVMP
    143140  Bool xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 );
    144141  Void xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr );
     
    174171#endif
    175172 
    176 #if H_3D_DBBP
     173#if NH_3D_DBBP
    177174  PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize, TComDataCU*& pcCU);
    178175  Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask, TComDataCU*& pcCU);
    179   Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize );
     176  Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr, UInt partSize, Int bitDepthY );
    180177#endif
    181178
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRdCost.cpp

    r1209 r1279  
    311311  m_bUseEstimatedVSD        = false;
    312312#endif
    313 #if H_3D_DBBP
     313#if NH_3D_DBBP
    314314  m_bUseMask                = false;
    315315#endif
     
    340340  rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    341341
    342 #if H_3D_DBBP
     342#if NH_3D_DBBP
    343343  if( m_bUseMask )
    344344  {
     
    397397  }
    398398
    399 #if H_3D_DBBP
     399#if NH_3D_DBBP
    400400  if( m_bUseMask )
    401401  {
     
    446446  }
    447447
    448 #if H_3D_DBBP
     448#if NH_3D_DBBP
    449449  if( m_bUseMask )
    450450  {
     
    468468  rcDP.bitDepth   = bitDepth;
    469469  rcDP.DistFunc   = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ];
    470 #if H_3D_DBBP
     470#if NH_3D_DBBP
    471471  if( m_bUseMask )
    472472  {
     
    561561  cDtParam.bitDepth     = bitDepth;
    562562
    563 #if H_3D_IC
     563#if NH_3D_IC
    564564  cDtParam.bUseIC       = false;
    565565#endif
     
    602602  cDtParam.bitDepth   = bitDepth;
    603603
     604#if NH_3D_IC_FIX
     605  cDtParam.bUseIC       = false;
     606#endif
     607#if H_3D_INTER_SDC_FIX
     608  cDtParam.bUseSDCMRSAD = false;
     609#endif
     610
    604611  Dist dist = cDtParam.DistFunc( &cDtParam );
    605612
     
    648655// ====================================================================================================================
    649656
    650 #if H_3D_DBBP
     657#if NH_3D_DBBP
    651658// --------------------------------------------------------------------------------------------------------------------
    652659// Masked distortion functions
     
    689696 
    690697  AOF(!pcDtParam->bApplyWeight);
    691 #if H_3D_IC
     698#if NH_3D_IC
    692699  AOF(!pcDtParam->bUseIC);
    693700#endif
     
    763770    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    764771  }
    765 #if H_3D_IC
     772#if NH_3D_IC
    766773  if( pcDtParam->bUseIC )
    767774  {
     
    805812  }
    806813
    807 #if H_3D_IC
     814#if NH_3D_IC
    808815  if( pcDtParam->bUseIC )
    809816  {
     
    850857  }
    851858
    852 #if H_3D_IC
     859#if NH_3D_IC
    853860  if( pcDtParam->bUseIC )
    854861  {
     
    899906  }
    900907
    901 #if H_3D_IC
     908#if NH_3D_IC
    902909  if( pcDtParam->bUseIC )
    903910  {
     
    955962    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    956963  }
    957 #if H_3D_IC
     964#if NH_3D_IC
    958965  if( pcDtParam->bUseIC )
    959966  {
     
    10031010Distortion TComRdCost::xGetSAD16N( DistParam* pcDtParam )
    10041011{
    1005 #if H_3D_IC
     1012#if NH_3D_IC
    10061013  if( pcDtParam->bUseIC )
    10071014  {
     
    10631070  }
    10641071
    1065 #if H_3D_IC
     1072#if NH_3D_IC
    10661073  if( pcDtParam->bUseIC )
    10671074  {
     
    11361143  }
    11371144
    1138 #if H_3D_IC
     1145#if NH_3D_IC
    11391146  if( pcDtParam->bUseIC )
    11401147  {
     
    12011208  }
    12021209
    1203 #if H_3D_IC
     1210#if NH_3D_IC
    12041211  if( pcDtParam->bUseIC )
    12051212  {
     
    13051312    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    13061313  }
    1307 #if H_3D_IC
     1314#if NH_3D_IC
    13081315  if( pcDtParam->bUseIC )
    13091316  {
     
    13881395
    13891396
    1390 #if H_3D_IC || H_3D_INTER_SDC
     1397#if NH_3D_IC || H_3D_INTER_SDC
    13911398UInt TComRdCost::xGetSADic( DistParam* pcDtParam )
    13921399{
    13931400  if ( pcDtParam->bApplyWeight )
    13941401  {
    1395     return xGetSADw( pcDtParam );
     1402    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    13961403  }
    13971404  Pel* piOrg   = pcDtParam->pOrg;
     
    14411448  if ( pcDtParam->bApplyWeight )
    14421449  {
    1443     return xGetSADw( pcDtParam );
     1450    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    14441451  }
    14451452  Pel* piOrg   = pcDtParam->pOrg;
     
    14981505  if ( pcDtParam->bApplyWeight )
    14991506  {
    1500     return xGetSADw( pcDtParam );
     1507    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    15011508  }
    15021509  Pel* piOrg      = pcDtParam->pOrg;
     
    15671574  if ( pcDtParam->bApplyWeight )
    15681575  {
    1569     return xGetSADw( pcDtParam );
     1576    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    15701577  }
    15711578  Pel* piOrg   = pcDtParam->pOrg;
     
    16601667  if ( pcDtParam->bApplyWeight )
    16611668  {
    1662     return xGetSADw( pcDtParam );
     1669    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    16631670  }
    16641671  Pel* piOrg   = pcDtParam->pOrg;
     
    18351842  if ( pcDtParam->bApplyWeight )
    18361843  {
    1837     return xGetSADw( pcDtParam );
     1844    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    18381845  }
    18391846  Pel* piOrg   = pcDtParam->pOrg;
     
    19771984  if ( pcDtParam->bApplyWeight )
    19781985  {
    1979     return xGetSADw( pcDtParam );
     1986    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    19801987  }
    19811988  Pel* piOrg   = pcDtParam->pOrg;
     
    20942101  if ( pcDtParam->bApplyWeight )
    20952102  {
    2096     return xGetSADw( pcDtParam );
     2103    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    20972104  }
    20982105  Pel* piOrg   = pcDtParam->pOrg;
     
    23322339  if ( pcDtParam->bApplyWeight )
    23332340  {
    2334     return xGetSADw( pcDtParam );
     2341    return TComRdCostWeightPrediction::xGetSADw( pcDtParam );
    23352342  }
    23362343
     
    33273334    return TComRdCostWeightPrediction::xGetHADsw( pcDtParam );
    33283335  }
    3329 #if H_3D_IC
     3336#if NH_3D_IC
    33303337  if( pcDtParam->bUseIC )
    33313338  {
     
    34033410}
    34043411
    3405 #if H_3D_IC || H_3D_INTER_SDC
     3412#if NH_3D_IC || H_3D_INTER_SDC
    34063413UInt TComRdCost::xGetHADsic( DistParam* pcDtParam )
    34073414{
    34083415  if ( pcDtParam->bApplyWeight )
    34093416  {
    3410     return xGetHADsw( pcDtParam );
     3417    return TComRdCostWeightPrediction::xGetHADsw( pcDtParam );
    34113418  }
    34123419  Pel* piOrg   = pcDtParam->pOrg;
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRdCost.h

    r1209 r1279  
    9191  Int   iStrideVir;
    9292#endif
    93 #if H_3D_IC
     93#if NH_3D_IC
    9494  Bool  bUseIC;
    9595#endif
     
    167167#endif
    168168  Int                     m_iCostScale;
    169 #if H_3D_DBBP
     169#if NH_3D_DBBP
    170170  Bool                    m_bUseMask;
    171171#endif
     
    206206  Void    setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false );
    207207
    208 #if H_3D_DBBP
     208#if NH_3D_DBBP
    209209  Void    setUseMask(Bool b) { m_bUseMask = b; }
    210210#endif
     
    256256  static Distortion xGetSSE64         ( DistParam* pcDtParam );
    257257  static Distortion xGetSSE16N        ( DistParam* pcDtParam );
    258 #if H_3D_IC || H_3D_INTER_SDC
     258#if NH_3D_IC || H_3D_INTER_SDC
    259259  static UInt xGetSADic         ( DistParam* pcDtParam );
    260260  static UInt xGetSAD4ic        ( DistParam* pcDtParam );
     
    283283#endif
    284284
    285 #if H_3D_IC || H_3D_INTER_SDC
     285#if NH_3D_IC || H_3D_INTER_SDC
    286286  static UInt xGetSAD12ic       ( DistParam* pcDtParam );
    287287  static UInt xGetSAD24ic       ( DistParam* pcDtParam );
     
    294294
    295295
    296 #if H_3D_IC || H_3D_INTER_SDC
     296#if NH_3D_IC || H_3D_INTER_SDC
    297297  static UInt xGetHADsic          ( DistParam* pcDtParam );
    298298#endif
     
    302302  static Distortion xCalcHADs4x4      ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );
    303303  static Distortion xCalcHADs8x8      ( Pel *piOrg, Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep );
    304 #if H_3D_DBBP
     304#if NH_3D_DBBP
    305305  static UInt xGetMaskedSSE     ( DistParam* pcDtParam );
    306306  static UInt xGetMaskedSAD     ( DistParam* pcDtParam );
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRom.cpp

    r1247 r1279  
    546546Bool g_disableNumbering = false;
    547547Bool g_disableHLSTrace = false;
    548 UInt64 g_stopAtCounter       = 937234;
     548UInt64 g_stopAtCounter       = 4660;
    549549Bool g_traceCopyBack         = false;
    550550Bool g_decTraceDispDer       = false;
     
    686686  }
    687687  Bool stopFlag = false;
    688   if ( g_stopAtPos && poc == 0 && layerId == 2 )
     688  if ( g_stopAtPos && poc == 16 && layerId == 1 )
    689689  {
    690690    Bool stopAtCU = true;
    691691    if ( stopAtCU )        // Stop at CU with specific size
    692692    {   
    693       stopFlag = ( cuPelX  == 0 ) && ( cuPelY  == 0 ) && ( cuWidth == 8 ) && ( cuHeight == 8 );
     693      stopFlag = ( cuPelX  == 0 ) && ( cuPelY  == 0 ) && ( cuWidth == 32 ) && ( cuHeight == 32 );
    694694    }
    695695    else
     
    711711  if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  )
    712712  {
    713     if ( g_stopAtCounter == g_nSymbolCounter )
    714     {
    715       std::cout << "Break point here." << std::endl;
    716     }
     713    incSymbolCounter(); 
    717714    if ( !g_disableNumbering )
    718715    { 
    719       fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
     716      fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
    720717    }
    721718    fprintf( g_hTrace, "%-50s       : %d\n", symbolName, val );     
    722     fflush ( g_hTrace );
    723     g_nSymbolCounter++;
    724   }
     719    fflush ( g_hTrace );   
     720  }
     721}
     722UInt64 incSymbolCounter( )
     723{
     724  g_nSymbolCounter++; 
     725  if ( g_stopAtCounter == g_nSymbolCounter )
     726  {
     727    std::cout << "Break point here." << std::endl;
     728  } 
     729  return g_nSymbolCounter;
    725730}
    726731Void writeToTraceFile( const Char* symbolName, Bool doIt )
     
    728733  if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  )
    729734  {
     735    incSymbolCounter();
    730736    fprintf( g_hTrace, "%s", symbolName );   
    731     fflush ( g_hTrace );
    732     g_nSymbolCounter++;
     737    fflush ( g_hTrace );   
    733738  }
    734739}
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRom.h

    r1247 r1279  
    196196 Void           writeToTraceFile( const Char* symbolName, Int val, Bool doIt );
    197197 Void           writeToTraceFile( const Char* symbolName, Bool doIt );
     198 incSymbolCounter incSymbolCounter();         
    198199 Void           stopAtPos       ( Int poc, Int layerId, Int cuPelX, Int cuPelY, Int cuWidth, Int cuHeight );           
    199200#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComSlice.cpp

    r1258 r1279  
    140140, m_pocMsbValRequiredFlag         (false)
    141141#endif
    142 #if H_3D_IC
     142#if NH_3D_IC
    143143, m_bApplyIC                      (false)
    144144, m_icSkipParseFlag               (false)
     
    278278    m_iSliceChromaQpDelta[component] = 0;
    279279  }
    280 #if H_3D_IV_MERGE
     280#if NH_3D_IV_MERGE
    281281  m_maxNumMergeCand = MRG_MAX_NUM_CANDS_MEM;
    282282#else
     
    289289  m_cabacInitFlag        = false;
    290290  m_enableTMVPFlag = true;
    291 #if H_3D_TMVP
     291#if NH_3D_TMVP
    292292  m_aiAlterRefIdx[0]                  = -1;
    293293  m_aiAlterRefIdx[1]                  = -1;
     
    824824  }
    825825}
    826 #if H_3D
    827 #if H_3D_TMVP
     826#if NH_3D
     827#if NH_3D_TMVP
    828828Void TComSlice::generateAlterRefforTMVP()
    829829{
     
    11711171  m_bApplyDIS = pSrc->m_bApplyDIS;
    11721172#endif
    1173 #if H_3D_IC
     1173#if NH_3D_IC
    11741174  m_bApplyIC = pSrc->m_bApplyIC;
    11751175  m_icSkipParseFlag = pSrc->m_icSkipParseFlag;
     
    19961996      m_dimensionId[i][j] = 0;
    19971997    }
    1998 #if H_3D_ARP
     1998#if NH_3D_ARP
    19991999#endif
    20002000  } 
     
    35713571#endif
    35723572}
    3573 #if H_3D
    3574 Void TComSlice::setDefaultRefView( )
    3575 {
    3576   setDefaultRefViewIdx( -1 );
    3577   setDefaultRefViewIdxAvailableFlag( false );
     3573#if NH_3D_NBDV
     3574Void TComSlice::setDefaultRefView()
     3575{
     3576  setDefaultRefViewIdx(-1);
     3577  setDefaultRefViewIdxAvailableFlag(false);
    35783578
    35793579  Int valid = 0;
    35803580  Int DefaultRefViewIdx = -1;
    3581   for( UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++ )
    3582   {
    3583     for( Int iRefListId = 0; ( iRefListId < (isInterB() ? 2 : 1) ) && !isIntra() && valid == 0; iRefListId++ )
    3584     {
    3585       RefPicList eRefPicList = RefPicList( iRefListId );
    3586       Int        iNumRefPics = getNumRefIdx( eRefPicList );
    3587       for( Int i = 0; i < iNumRefPics; i++ )
     3581
     3582  for(UInt curViewIdx = 0; curViewIdx < getViewIndex() && valid == 0; curViewIdx++)
     3583  {
     3584    for(Int iRefListId = 0; (iRefListId < (isInterB() ? 2 : 1)) && !isIntra() && valid == 0; iRefListId++)
     3585    {
     3586      RefPicList eRefPicList = RefPicList(iRefListId);
     3587      Int        iNumRefPics = getNumRefIdx(eRefPicList);
     3588
     3589      for(Int i = 0; i < iNumRefPics; i++)
    35883590      {
    3589         if(getPOC() == getRefPic( eRefPicList, i )->getPOC() && curViewIdx == getRefPic( eRefPicList, i )->getViewIndex())
     3591        if(getPOC() == getRefPic(eRefPicList, i)->getPOC() && curViewIdx == getRefPic(eRefPicList, i)->getViewIndex())
    35903592        {
    35913593          valid = 1;
     
    35963598    }
    35973599  }
    3598   if( valid )
    3599   {
    3600     setDefaultRefViewIdx( DefaultRefViewIdx );
    3601     setDefaultRefViewIdxAvailableFlag( true );   
    3602   }
    3603 }
    3604 #endif
    3605 
    3606 #if H_3D_ARP
     3600
     3601  if(valid)
     3602  {
     3603    setDefaultRefViewIdx(DefaultRefViewIdx);
     3604    setDefaultRefViewIdxAvailableFlag(true);
     3605  }
     3606}
     3607#endif
     3608
     3609#if NH_3D_ARP
    36073610Void TComSlice::setARPStepNum( TComPicLists*ivPicLists )
    36083611{
     
    36743677    }
    36753678  }
    3676 }
    3677 #endif
    3678 
    3679 #if H_3D_IC
     3679  if( m_nARPStepNum > 1)
     3680  {
     3681    for(Int i = 0; i < getNumActiveRefLayerPics(); i ++ )
     3682    {
     3683      Int  iLayerId = getRefPicLayerId( i );
     3684      Int  iViewIdx =   getVPS()->getViewIndex(iLayerId);
     3685      Bool bIsDepth = ( getVPS()->getDepthId  ( iLayerId ) == 1 );
     3686      if( iViewIdx<getViewIndex() && !bIsDepth )
     3687      {
     3688        setBaseViewRefPicList( ivPicLists->getPicList( iLayerId ), iViewIdx );
     3689      }
     3690    }
     3691  }
     3692}
     3693#endif
     3694
     3695#if NH_3D_IC
    36803696// This is an encoder only function and should be moved to TEncSlice or TEncSearch!!
    36813697Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc)
     
    37663782    {
    37673783      // Histogram building - luminance
    3768       Int iMaxPelValue = ( 1 << g_bitDepthY );
     3784      Int iMaxPelValue = ( 1 << getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
    37693785      Int *aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue );
    37703786      Int *aiCurrHist   = (Int *) xMalloc( Int,iMaxPelValue );
     
    37723788      memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) );
    37733789
    3774       Int iWidth   = pcCurrPicYuv->getWidth();
    3775       Int iHeight  = pcCurrPicYuv->getHeight();
    3776 
    3777       Pel* pCurrY   = pcCurrPicYuv ->getLumaAddr();
    3778       Pel* pRefOrgY = pcRefPicYuvOrg  ->getLumaAddr();
    3779       Int iCurrStride = pcCurrPicYuv->getStride();
    3780       Int iRefStride = pcRefPicYuvOrg->getStride();
    3781 
     3790      Int iWidth   = pcCurrPicYuv->getWidth(COMPONENT_Y);
     3791      Int iHeight  = pcCurrPicYuv->getHeight(COMPONENT_Y);
     3792      Pel* pCurrY   = pcCurrPicYuv->getAddr(COMPONENT_Y);
     3793      Pel* pRefOrgY = pcRefPicYuvOrg->getAddr(COMPONENT_Y);
     3794      Int iCurrStride = pcCurrPicYuv->getStride(COMPONENT_Y);
     3795      Int iRefStride = pcRefPicYuvOrg->getStride(COMPONENT_Y);
    37823796      for ( Int y = 0; y < iHeight; y++ )
    37833797      {
     
    38333847  setupLUT = setupLUT || getViewSynthesisPredFlag( );
    38343848
    3835 #if H_3D_NBDV_REF
     3849#if NH_3D_NBDV_REF
    38363850  setupLUT = setupLUT || getDepthRefinementFlag( );
    38373851#endif 
    38383852
    3839 #if H_3D_IV_MERGE
     3853#if NH_3D_IV_MERGE
    38403854  setupLUT = setupLUT || ( getIvMvPredFlag() && getIsDepth() );
    38413855#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComSlice.h

    r1251 r1279  
    26022602  IntAry2d   m_aaiCodedOffset;
    26032603#endif
    2604 #if H_3D_TMVP
     2604#if NH_3D_TMVP
    26052605  Int        m_aiAlterRefIdx   [2];
    26062606#endif
    2607 #if H_3D_ARP
     2607#if NH_3D_ARP
    26082608  Bool       m_arpRefPicAvailable[2][MAX_NUM_LAYERS];
    26092609  TComList<TComPic*> * m_pBaseViewRefPicList[MAX_NUM_LAYERS];
     
    26142614  std::vector<Int> m_pocsInCurrRPSs;
    26152615#endif
    2616 #if H_3D_IC
     2616#if NH_3D_IC
    26172617  Bool       m_bApplyIC;
    26182618  Bool       m_icSkipParseFlag;
     
    26302630#endif
    26312631#endif
    2632 #if H_3D_IC
     2632#if NH_3D_IC
    26332633  Int*       m_aICEnableCandidate;
    26342634  Int*       m_aICEnableNum;
     
    27182718  TComPic*                    getIvPic( Bool depthFlag, Int viewIndex) const         { return  m_ivPicsCurrPoc[ depthFlag ? 1 : 0 ][ viewIndex ];    }
    27192719  TComPic*                    getTexturePic       ()                                 { return  m_ivPicsCurrPoc[0][ m_viewIndex ];                    }
    2720 #endif                                                                                                                                               
    2721 #if H_3D_IC                                                                                                                                         
     2720#endif                           
     2721#if NH_3D_IC                                                                                                                                         
    27222722  Void                        setApplyIC( Bool b )                                   { m_bApplyIC = b;                                               }
    27232723  Bool                        getApplyIC()                                           { return m_bApplyIC;                                            }
     
    27272727  Bool                        getIcSkipParseFlag()                                   { return m_icSkipParseFlag;                                     }
    27282728#endif                                                                                                                                               
    2729 #if H_3D_ARP                                                                                                                                         
     2729#if NH_3D_ARP                                                                                                                                         
    27302730  Void                        setBaseViewRefPicList( TComList<TComPic*> *pListPic, Int iViewIdx )      { m_pBaseViewRefPicList[iViewIdx] = pListPic; }                 
    27312731  Void                        setARPStepNum( TComPicLists*ivPicLists );                                                                             
     
    29292929  Int                         getViewIndex   ()                 const                { return m_viewIndex;                                           }
    29302930#if NH_3D
    2931 #if H_3D_TMVP
     2931#if NH_3D_TMVP
    29322932  Void                        generateAlterRefforTMVP ();   
    29332933  Void                        setAlterRefIdx          ( RefPicList e, Int i )        { m_aiAlterRefIdx[e]    = i;                                    }
    29342934  Int                         getAlterRefIdx          ( RefPicList e )               { return  m_aiAlterRefIdx[e];                                   }
    29352935#endif                                                                                                                                               
    2936 #if H_3D_ARP                                                                                                                                         
     2936#if NH_3D_ARP                                                                                                                                         
    29372937  Int                         getFirstTRefIdx        ( RefPicList e )                { return  m_aiFirstTRefIdx[e];                                  }
    29382938  Void                        setFirstTRefIdx        ( RefPicList e, Int i )         { m_aiFirstTRefIdx[e]    = i;                                   }
     
    29662966  Int*                        getDepthToDisparityB( Int refViewIdx )                 { return m_depthToDisparityB[ getVPS()->getVoiInVps( refViewIdx) ];}
    29672967  Int*                        getDepthToDisparityF( Int refViewIdx )                 { return m_depthToDisparityF[ getVPS()->getVoiInVps( refViewIdx) ];}
    2968 #if H_3D_IC                                                                                                                                             
     2968#if NH_3D_IC                                                                                                                                             
    29692969  Void                        setICEnableCandidate( Int* icEnableCandidate)          { m_aICEnableCandidate = icEnableCandidate;                     }
    29702970  Void                        setICEnableNum( Int* icEnableNum)                      { m_aICEnableNum = icEnableNum;                                 }
     
    30823082  Int                         getMpiSubPbSize           ( )                          { return m_mpiSubPbSize           ;                             };
    30833083  Int                         getSubPbSize              ( )                          { return m_subPbSize              ;                             };
     3084#if NH_3D_NBDV
     3085  Int                         getDefaultRefViewIdx()                                 { return m_iDefaultRefViewIdx;                                  }
     3086  Void                        setDefaultRefViewIdx(Int iViewIdx)                     { m_iDefaultRefViewIdx = iViewIdx;                              }
     3087
     3088  Bool                        getDefaultRefViewIdxAvailableFlag()                    { return m_bDefaultRefViewIdxAvailableFlag;                     }
     3089  Void                        setDefaultRefViewIdxAvailableFlag(Bool bViewIdx)       { m_bDefaultRefViewIdxAvailableFlag = bViewIdx;                 }
     3090  Void                        setDefaultRefView( );
     3091#endif
    30843092#endif
    30853093  // Inference
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComYuv.cpp

    r1200 r1279  
    487487}
    488488
    489 #if H_3D_ARP
    490 Void TComYuv::addARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )
    491 {
    492   addARPLuma   ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth   , uiHeight    , bClip );
    493   addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip );
    494 }
    495 
    496 Void TComYuv::addARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )
     489#if NH_3D_ARP
     490Void TComYuv::addARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths )
     491{
     492  addARPLuma   ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth   , uiHeight    , bClip , clipBitDepths);
     493  addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip , clipBitDepths);
     494}
     495
     496Void TComYuv::addARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths )
    497497{
    498498  Int x, y;
    499499
    500   Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );
    501   Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );
    502   Pel* pDst  = getLumaAddr( uiAbsPartIdx );
    503 
    504   UInt iSrc0Stride = pcYuvSrc0->getStride();
    505   UInt iSrc1Stride = pcYuvSrc1->getStride();
    506   UInt iDstStride  = getStride();
    507   Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY;
     500  Pel* pSrc0 = pcYuvSrc0->getAddr( COMPONENT_Y, uiAbsPartIdx );
     501  Pel* pSrc1 = pcYuvSrc1->getAddr( COMPONENT_Y, uiAbsPartIdx );
     502  Pel* pDst  = getAddr( COMPONENT_Y, uiAbsPartIdx );
     503
     504  UInt iSrc0Stride = pcYuvSrc0->getStride(COMPONENT_Y);
     505  UInt iSrc1Stride = pcYuvSrc1->getStride(COMPONENT_Y);
     506  UInt iDstStride  = getStride(COMPONENT_Y);
     507  const Int clipbd = clipBitDepths.recon[CHANNEL_TYPE_LUMA];
     508  Int iIFshift = IF_INTERNAL_PREC - clipbd;
    508509  Int iOffSet  = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;
    509510  for ( y = uiHeight-1; y >= 0; y-- )
     
    514515      if( bClip )
    515516      {
    516         pDst[x] = ClipY( ( pDst[x] + iOffSet ) >> iIFshift );
     517        pDst[x] = Pel(ClipBD<Int>(Int( ( pDst[x] + iOffSet ) >> iIFshift ), clipbd));
    517518      }
    518519    }
     
    523524}
    524525
    525 Void TComYuv::addARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip )
     526Void TComYuv::addARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip, const BitDepths &clipBitDepths )
    526527{
    527528  Int x, y;
    528529
    529   Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );
    530   Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );
    531   Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );
    532   Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );
    533   Pel* pDstU = getCbAddr( uiAbsPartIdx );
    534   Pel* pDstV = getCrAddr( uiAbsPartIdx );
    535 
    536   UInt  iSrc0Stride = pcYuvSrc0->getCStride();
    537   UInt  iSrc1Stride = pcYuvSrc1->getCStride();
    538   UInt  iDstStride  = getCStride();
    539 
    540   Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;
     530  Pel* pSrcU0 = pcYuvSrc0->getAddr( COMPONENT_Cb, uiAbsPartIdx );
     531  Pel* pSrcU1 = pcYuvSrc1->getAddr( COMPONENT_Cb, uiAbsPartIdx );
     532  Pel* pSrcV0 = pcYuvSrc0->getAddr( COMPONENT_Cr, uiAbsPartIdx );
     533  Pel* pSrcV1 = pcYuvSrc1->getAddr( COMPONENT_Cr, uiAbsPartIdx );
     534  Pel* pDstU = getAddr( COMPONENT_Cb, uiAbsPartIdx );
     535  Pel* pDstV = getAddr( COMPONENT_Cr, uiAbsPartIdx );
     536
     537  UInt  iSrc0StrideCb = pcYuvSrc0->getStride(COMPONENT_Cb);
     538  UInt  iSrc1StrideCb = pcYuvSrc1->getStride(COMPONENT_Cb);
     539  UInt  iDstStrideCb  = getStride(COMPONENT_Cb);
     540
     541  UInt  iSrc0StrideCr = pcYuvSrc0->getStride(COMPONENT_Cr);
     542  UInt  iSrc1StrideCr = pcYuvSrc1->getStride(COMPONENT_Cr);
     543  UInt  iDstStrideCr  = getStride(COMPONENT_Cr);
     544
     545  const Int clipbd = clipBitDepths.recon[CHANNEL_TYPE_CHROMA];
     546  Int iIFshift = IF_INTERNAL_PREC - clipbd;
    541547  Int iOffSet  = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS;
    542548
     
    549555      if( bClip )
    550556      {
    551         pDstU[x] = ClipC( ( pDstU[x] + iOffSet ) >> iIFshift );
    552         pDstV[x] = ClipC( ( pDstV[x] + iOffSet ) >> iIFshift );
    553       }
    554     }
    555 
     557        pDstU[x] = Pel(ClipBD<Int>( Int( ( pDstU[x] + iOffSet ) >> iIFshift ), clipbd));
     558        pDstV[x] = Pel(ClipBD<Int>( Int( ( pDstV[x] + iOffSet ) >> iIFshift ), clipbd));
     559      }
     560    }
     561
     562    pSrcU0 += iSrc0StrideCb;
     563    pSrcU1 += iSrc1StrideCb;
     564    pSrcV0 += iSrc0StrideCr;
     565    pSrcV1 += iSrc1StrideCr;
     566    pDstU  += iDstStrideCb;
     567    pDstV  += iDstStrideCr;
     568  }
     569}
     570
     571Void TComYuv::subtractARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )
     572{
     573  subtractARPLuma  ( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth    , uiHeight    );
     574
     575  if (uiWidth > 8 && pcYuvSrc1->getNumberValidComponents() > 1)
     576  {
     577    subtractARPChroma( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );
     578}
     579}
     580
     581Void TComYuv::subtractARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )
     582{
     583  Int x, y;
     584
     585  Pel* pSrc0 = pcYuvSrc0->getAddr(COMPONENT_Y, uiAbsPartIdx );
     586  Pel* pSrc1 = pcYuvSrc1->getAddr(COMPONENT_Y, uiAbsPartIdx );
     587  Pel* pDst  = getAddr           (COMPONENT_Y, uiAbsPartIdx );
     588
     589  Int  iSrc0Stride = pcYuvSrc0->getStride(COMPONENT_Y);
     590  Int  iSrc1Stride = pcYuvSrc1->getStride(COMPONENT_Y);
     591  Int  iDstStride  = getStride(COMPONENT_Y);
     592  for ( y = uiHeight-1; y >= 0; y-- )
     593  {
     594    for ( x = uiWidth-1; x >= 0; x-- )
     595    {
     596      pDst[x] = pSrc0[x] - pSrc1[x];
     597    }
     598    pSrc0 += iSrc0Stride;
     599    pSrc1 += iSrc1Stride;
     600    pDst  += iDstStride;
     601  }
     602}
     603
     604Void TComYuv::subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )
     605{
     606  Int x, y;
     607
     608  Pel* pSrcU0 = pcYuvSrc0->getAddr(COMPONENT_Cb, uiAbsPartIdx );
     609  Pel* pSrcU1 = pcYuvSrc1->getAddr(COMPONENT_Cb, uiAbsPartIdx );
     610  Pel* pSrcV0 = pcYuvSrc0->getAddr(COMPONENT_Cr, uiAbsPartIdx );
     611  Pel* pSrcV1 = pcYuvSrc1->getAddr(COMPONENT_Cr, uiAbsPartIdx );
     612  Pel* pDstU  = getAddr(COMPONENT_Cb, uiAbsPartIdx );
     613  Pel* pDstV  = getAddr(COMPONENT_Cr, uiAbsPartIdx );
     614
     615  Int  iSrc0Stride = pcYuvSrc0->getStride(COMPONENT_Cb);
     616  Int  iSrc1Stride = pcYuvSrc1->getStride(COMPONENT_Cb);
     617  Int  iDstStride  = getStride( COMPONENT_Cb );
     618  for ( y = uiHeight-1; y >= 0; y-- )
     619  {
     620    for ( x = uiWidth-1; x >= 0; x-- )
     621    {
     622      pDstU[x] = pSrcU0[x] - pSrcU1[x];
     623      pDstV[x] = pSrcV0[x] - pSrcV1[x];
     624    }
    556625    pSrcU0 += iSrc0Stride;
    557626    pSrcU1 += iSrc1Stride;
     
    563632}
    564633
    565 Void TComYuv::subtractARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )
    566 {
    567   subtractARPLuma  ( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth    , uiHeight    );
    568 
    569   if (uiWidth > 8)
    570     subtractARPChroma( pcYuvSrc0, pcYuvSrc1,  uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 );
    571 }
    572 
    573 Void TComYuv::subtractARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )
    574 {
    575   Int x, y;
    576 
    577   Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx );
    578   Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx );
    579   Pel* pDst  = getLumaAddr( uiAbsPartIdx );
    580 
    581   Int  iSrc0Stride = pcYuvSrc0->getStride();
    582   Int  iSrc1Stride = pcYuvSrc1->getStride();
    583   Int  iDstStride  = getStride();
    584   for ( y = uiHeight-1; y >= 0; y-- )
    585   {
    586     for ( x = uiWidth-1; x >= 0; x-- )
    587     {
    588       pDst[x] = pSrc0[x] - pSrc1[x];
    589     }
    590     pSrc0 += iSrc0Stride;
    591     pSrc1 += iSrc1Stride;
    592     pDst  += iDstStride;
    593   }
    594 }
    595 
    596 Void TComYuv::subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight )
    597 {
    598   Int x, y;
    599 
    600   Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx );
    601   Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx );
    602   Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx );
    603   Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx );
    604   Pel* pDstU  = getCbAddr( uiAbsPartIdx );
    605   Pel* pDstV  = getCrAddr( uiAbsPartIdx );
    606 
    607   Int  iSrc0Stride = pcYuvSrc0->getCStride();
    608   Int  iSrc1Stride = pcYuvSrc1->getCStride();
    609   Int  iDstStride  = getCStride();
    610   for ( y = uiHeight-1; y >= 0; y-- )
    611   {
    612     for ( x = uiWidth-1; x >= 0; x-- )
    613     {
    614       pDstU[x] = pSrcU0[x] - pSrcU1[x];
    615       pDstV[x] = pSrcV0[x] - pSrcV1[x];
    616     }
    617     pSrcU0 += iSrc0Stride;
    618     pSrcU1 += iSrc1Stride;
    619     pSrcV0 += iSrc0Stride;
    620     pSrcV1 += iSrc1Stride;
    621     pDstU  += iDstStride;
    622     pDstV  += iDstStride;
    623   }
    624 }
    625 
    626634Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
    627635{
    628636  multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW );
    629637
    630   if (uiWidth > 8)
     638  if ( uiWidth > 8 && getNumberValidComponents() > 1 )
     639  {
    631640    multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW );
     641}
    632642}
    633643
     
    641651Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
    642652{
    643   Pel* pDst  = getLumaAddr( uiAbsPartIdx );
    644   Int  iDstStride  = getStride();
     653  Pel* pDst  = getAddr(COMPONENT_Y, uiAbsPartIdx );
     654  Int  iDstStride  = getStride(COMPONENT_Y);
    645655  for ( Int y = uiHeight-1; y >= 0; y-- )
    646656  {
     
    652662Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW )
    653663{
    654   Pel* pDstU  = getCbAddr( uiAbsPartIdx );
    655   Pel* pDstV  = getCrAddr( uiAbsPartIdx );
    656 
    657   Int  iDstStride  = getCStride();
     664  Pel* pDstU  = getAddr( COMPONENT_Cb, uiAbsPartIdx );
     665  Pel* pDstV  = getAddr( COMPONENT_Cr, uiAbsPartIdx );
     666
     667  Int  iDstStride  = getStride( COMPONENT_Cb );
    658668  for ( Int y = uiHeight-1; y >= 0; y-- )
    659669  {
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComYuv.h

    r1200 r1279  
    206206#if NH_3D
    207207  Void         addClipPartLuma( Int bitDepth, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize );
    208 #if H_3D_ARP
    209   Void         addARP                     ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
    210   Void         addARPLuma                 ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
    211   Void         addARPChroma               ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip );
     208#if NH_3D_ARP
     209  Void         addARP                     ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip, const BitDepths &clipBitDepths );
     210  Void         addARPLuma                 ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip, const BitDepths &clipBitDepths );
     211  Void         addARPChroma               ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight , Bool bClip, const BitDepths &clipBitDepths );
    212212  Void         subtractARP                ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );
    213213  Void         subtractARPLuma            ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight );
  • branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TypeDef.h

    r1258 r1279  
    6767#if NH_MV
    6868#define H_MV_ENC_DEC_TRAC                 1  //< CU/PU level tracking
     69#define H_MV_ENC_DEC_TRAC_FIX             1  // by SHARP
    6970
    7071#if NH_3D
    7172#define NH_3D_VSO                         1
     73#define NH_3D_NBDV                        1
     74#define NH_3D_TMVP                        1   // QC_TMVP_C0047
     75                                              // Sony_M23639
     76                                              // H_3D_TMVP_SCALING_FIX_K0053       1   // QC/CY for K0053
     77#define NH_3D_IC                          1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
     78                                              // Unifying rounding offset, for IC part, JCT3V-D0135
     79                                              // SHARP_ILLUCOMP_REFINE_E0046
     80                                              // MTK_CLIPPING_ALIGN_IC_E0168       // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168
     81                                              // LGE_IC_CTX_F0160 //JCT3V-F0160
     82                                              // SEC_ONLY_TEXTURE_IC_F0151
     83                                              // MTK_IC_FLAG_CABAC_SIMP_G0061
     84                                              // SEC_IC_ARP_SIG_G0072, Disabling IC when ARP is enabled, option 1 in JCT3V-G0072, part 2 in JCT3V-G0121
     85                                              // MTK_LOW_LATENCY_IC_ENCODING_H0086  Low-latency IC encoding in JCT3V-H0086
     86                                              // MTK_LOW_LATENCY_IC_ENCODING_H0086_FIX  1  // Remove the global variables used in JCT3V-H0086
     87                                              // SEC_IC_NEIGHBOR_CLIP_I0080    // Clipping of neighboring sample position, JCT3V-I0080
     88                                              // LGE_CHROMA_IC_J0050_J0034
     89
     90#define NH_3D_IC_FIX                      1   // Fix uninitialized value in cDtParam.bUseIC (it happened on intra block)
     91#define NH_3D_FULL_PEL_DEPTH_MAP_MV_ACC   1   // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     92
     93#define NH_3D_QTLPC                       1   // OL_QTLIMIT_PREDCODING_B0068 //JCT3V-B0068
     94                                              // HHI_QTLPC_RAU_OFF_C0160 JCT3V-C0160 change 2: quadtree limitation and predictive coding switched off in random access units
     95                                              // MTK_TEX_DEP_PAR_G0055 Texture-partition-dependent depth partition. JCT3V-G0055
     96
     97#define NH_3D_NBDV_REF                    1
     98#define NH_3D_MLC                         1
     99#define NH_3D_VSP                         1
     100#define NH_3D_IV_MERGE                    1
     101#define NH_3D_SPIVMP                      1
     102#define NH_3D_INTEGER_MV_DEPTH            1
     103#define NH_3D_TEXT_MERGE                  1
     104#define NH_3D_DBBP                         1
     105#define BUF_FIX 1
     106#define NH_3D_ARP                         1  // Advanced residual prediction (ARP), JCT3V-D0177
     107                                              // QC_MTK_INTERVIEW_ARP_F0123_F0108 JCT3V-F0123; JCT3V-F0108
     108                                              // SHARP_ARP_REF_CHECK_F0105        ARP reference picture selection and DPB check
     109                                              // LGE_ARP_CTX_F0161                JCT3V-F0161
     110                                              // MTK_ARP_FLAG_CABAC_SIMP_G0061 Use 2 context for ARP flag referring to only left neighbor block in JCT3V-G0061
     111                                              // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G0053
     112                                              // MTK_ALIGN_SW_WD_BI_PRED_ARP_H0085  Align the SW and WD for the bi-prediction ARP PUs by disallowing non-normative fast bi-prediction for ARP PUs, JCT3V-H0085
     113                                              // QC_I0051_ARP_SIMP         
     114                                              // SHARP_ARP_CHROMA_I0104     
     115                                              // MTK_I0072_IVARP_SCALING_FIX
     116                                              // SEC_ARP_VIEW_REF_CHECK_J0037    Signaling iv_res_pred_weight_idx when the current slice has both view and temporal reference picture(s), JCT3V-J0037 item1
     117                                              // SEC_ARP_REM_ENC_RESTRICT_K0035    Removal of encoder restriction of ARP, JCT3V-K0035
     118
    72119#define NH_3D_DMM                         1   // Depth modeling modes
    73120#define NH_3D_DLT                         1   // Depth Lookup Table
     
    108155                                              // MTK_TEXTURE_MRGCAND_BUGFIX_E0182  Bug fix for TEXTURE MERGING CANDIDATE     , JCT3V-E0182
    109156                                              // LGE_SIMP_DISP_AVAIL_J0041    // Use 2 status for disparity availability - DISP_AVAILABLE and DISP_NONE
    110 #define H_3D_ARP                          1   // Advanced residual prediction (ARP), JCT3V-D0177
    111                                               // QC_MTK_INTERVIEW_ARP_F0123_F0108 JCT3V-F0123; JCT3V-F0108
    112                                               // SHARP_ARP_REF_CHECK_F0105        ARP reference picture selection and DPB check
    113                                               // LGE_ARP_CTX_F0161                JCT3V-F0161
    114                                               // MTK_ARP_FLAG_CABAC_SIMP_G0061 Use 2 context for ARP flag referring to only left neighbor block in JCT3V-G0061
    115                                               // MTK_ARP_REF_SELECTION_G0053 ARP Reference picture selection in JCT3V-G0053
    116                                               // MTK_ALIGN_SW_WD_BI_PRED_ARP_H0085  Align the SW and WD for the bi-prediction ARP PUs by disallowing non-normative fast bi-prediction for ARP PUs, JCT3V-H0085
    117                                               // QC_I0051_ARP_SIMP         
    118                                               // SHARP_ARP_CHROMA_I0104     
    119                                               // MTK_I0072_IVARP_SCALING_FIX
    120                                               // SEC_ARP_VIEW_REF_CHECK_J0037    Signaling iv_res_pred_weight_idx when the current slice has both view and temporal reference picture(s), JCT3V-J0037 item1
    121                                               // SEC_ARP_REM_ENC_RESTRICT_K0035    Removal of encoder restriction of ARP, JCT3V-K0035
    122157#define H_3D_IC                           1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
    123158                                              // Unifying rounding offset, for IC part, JCT3V-D0135
     
    133168                                              // SEC_IC_NEIGHBOR_CLIP_I0080    // Clipping of neighboring sample position, JCT3V-I0080
    134169                                              // LGE_CHROMA_IC_J0050_J0034
    135 #if H_3D_NBDV
     170#if NH_3D_NBDV
    136171#define H_3D_NBDV_REF                     1   // Depth oriented neighboring block disparity derivation
    137172                                              // MTK_D0156
     
    237272                                              // LGE_INTER_SDC_E0156 Enable inter SDC for depth coding
    238273                                              // SEC_INTER_SDC_G0101 Improved inter SDC with multiple DC candidates
     274#define H_3D_INTER_SDC_FIX                1
    239275#define H_3D_SPIVMP                       1   // H_3D_SPIVMP JCT3V-F0110: Sub-PU level inter-view motion prediction
    240276                                              // SEC_SPIVMP_MCP_SIZE_G0077, Apply SPIVMP only to 2Nx2N partition, JCT3V-G0077
     
    298334#endif
    299335////   ****** NEIGHBOURING BLOCK-BASED DISPARITY VECTOR  *********
    300 #if H_3D_NBDV
     336#if NH_3D_NBDV
    301337#define DVFROM_LEFT                       0
    302338#define DVFROM_ABOVE                      1
     
    304340#endif
    305341///// ***** ADVANCED INTERVIEW RESIDUAL PREDICTION *********
    306 #if H_3D_ARP
     342#if NH_3D_ARP
    307343#define H_3D_ARP_WFNR                     3
    308344#endif
     
    320356/// GT: Move values which are not flags to CommonDef.h and convert to static int !!
    321357///////////////////////////////////////////////////////////////////////////////////
    322 ///// ***** VIEW SYNTHESIS PREDICTION *********
    323 #if H_3D_VSP
    324 #define H_3D_VSP_BLOCKSIZE                4   // Supported values: 1, 2, and 4
    325 #if H_3D_VSP_BLOCKSIZE == 1
    326 #define H_3D_VSP_CONSTRAINED              1   // Constrained VSP @ 1x1
    327 #else
    328 #define H_3D_VSP_CONSTRAINED              0
    329 #endif
    330 #endif
    331358///// ***** ILLUMATION COMPENSATION *********
    332 #if H_3D_IC
     359#if NH_3D_IC
    333360#define IC_REG_COST_SHIFT                 7
    334361#define IC_CONST_SHIFT                    5
     
    337364#endif
    338365///// ***** DEPTH BASED BLOCK PARTITIONING *********
    339 #if H_3D_DBBP
     366#if NH_3D_DBBP
    340367#define DBBP_INVALID_SHORT                (-4)
    341368#define DBBP_PACK_MODE               SIZE_2NxN
     
    721748  MD_ABOVE_LEFT         ///< MVP of above left block
    722749};
    723 #if H_3D
     750#if NH_3D_MLC
    724751enum DefaultMergCandOrder
    725752{
     
    734761  MRG_A0,               ///< Left bottom
    735762  MRG_B2,               ///< Above left
    736   MRG_IVSHIFT,          ///< Shifted IVMC of Shifted IVDC. (These are mutually exclusive)
     763  MRG_IVSHIFT,          ///< Shifted IVMC or Shifted IVDC. (These are mutually exclusive)
    737764  MRG_COL               ///< Temporal co-located
    738765};
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/SyntaxElementParser.cpp

    r1200 r1279  
    6363  if ( !g_disableNumbering )
    6464  {
    65 #endif
    66   fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    67 #if H_MV_ENC_DEC_TRAC
    68   }
     65    incSymbolCounter();
     66    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
     67  }
     68#else
     69    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    6970#endif
    7071  if (length < 10)
     
    9394  if ( !g_disableNumbering )
    9495  {
    95 #endif
     96  incSymbolCounter();
     97  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
     98  }
     99#else
    96100  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    97 #if H_MV_ENC_DEC_TRAC
    98   }
    99101#endif
    100102  fprintf( g_hTrace, "%-50s ue(v) : %u\n", pSymbolName, rValue );
     
    115117  }
    116118  if ( !g_disableNumbering )
    117   {
    118 #endif
    119   fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    120 #if H_MV_ENC_DEC_TRAC
    121   }
     119  { 
     120    incSymbolCounter();
     121    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
     122  }
     123#else
     124    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    122125#endif
    123126  fprintf( g_hTrace, "%-50s se(v) : %d\n", pSymbolName, rValue );
     
    139142  if ( !g_disableNumbering )
    140143  {
    141 #endif
     144    incSymbolCounter();
     145    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
     146  }
     147#else
    142148  fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    143 #if H_MV_ENC_DEC_TRAC
    144   }
    145149#endif
    146150  fprintf( g_hTrace, "%-50s u(1)  : %d\n", pSymbolName, rValue );
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1258 r1279  
    27732773    }
    27742774
    2775 #if H_3D_IC
     2775#if NH_3D_IC
    27762776    else if(    pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE )
    27772777             && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0
     
    27862786      if ( uiCodeTmp )
    27872787      {
    2788         READ_FLAG ( uiCodeTmp, "ic_skip_mergeidx0" );
     2788        READ_FLAG ( uiCodeTmp, "slice_ic_disabled_merge_zero_idx_flag" );
    27892789        pcSlice->setIcSkipParseFlag( uiCodeTmp );
    27902790      }
     
    27952795    {
    27962796      READ_UVLC( uiCode, "five_minus_max_num_merge_cand");
    2797 #if H_3D_IV_MERGE
     2797#if NH_3D_IV_MERGE
    27982798      pcSlice->setMaxNumMergeCand(( ( pcSlice->getMpiFlag() || pcSlice->getIvMvPredFlag() || pcSlice->getViewSynthesisPredFlag() ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode);
    27992799#else
     
    33663366}
    33673367
    3368 #if H_3D_ARP
     3368#if NH_3D_ARP
    33693369Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    33703370{
     
    33723372}
    33733373#endif
    3374 #if H_3D_IC
     3374#if NH_3D_IC
    33753375Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    33763376{
     
    33853385
    33863386#endif
    3387 #if H_3D_DBBP
     3387#if NH_3D_DBBP
    33883388  Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    33893389  {
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecCAVLC.h

    r1258 r1279  
    117117  Void parseMergeFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
    118118  Void parseMergeIndex      ( TComDataCU* pcCU, UInt& ruiMergeIndex );
    119 #if H_3D_ARP
     119#if NH_3D_ARP
    120120  Void parseARPW            ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    121121#endif
    122 #if H_3D_IC
     122#if NH_3D_IC
    123123  Void  parseICFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    124124#endif
     
    129129  Void  parseSDCFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    130130#endif
    131 #if H_3D_DBBP
     131#if NH_3D_DBBP
    132132  Void  parseDBBPFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    133133#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecCu.cpp

    r1258 r1279  
    5252  m_ppcYuvReco = NULL;
    5353  m_ppcCU      = NULL;
    54 #if H_3D_DBBP
     54#if NH_3D_DBBP
    5555  m_ppcYuvRecoDBBP = NULL;
    5656#endif
     
    8181  m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1];
    8282  m_ppcCU      = new TComDataCU*[m_uiMaxDepth-1];
    83 #if H_3D_DBBP
     83#if NH_3D_DBBP
    8484  m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1];
    8585#endif
     
    9595    m_ppcYuvReco[ui] = new TComYuv;    m_ppcYuvReco[ui]->create( uiWidth, uiHeight, chromaFormatIDC );
    9696    m_ppcCU     [ui] = new TComDataCU; m_ppcCU     [ui]->create( chromaFormatIDC, uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) );
    97 #if H_3D_DBBP
    98     m_ppcYuvRecoDBBP[ui] = new TComYuv;    m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight );
     97#if NH_3D_DBBP
     98    m_ppcYuvRecoDBBP[ui] = new TComYuv;    m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight, chromaFormatIDC );
    9999#endif
    100100}
     
    119119    m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL;
    120120    m_ppcCU     [ui]->destroy(); delete m_ppcCU     [ui]; m_ppcCU     [ui] = NULL;
    121 #if H_3D_DBBP
     121#if NH_3D_DBBP
    122122    m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL;
    123123#endif
     
    127127  delete [] m_ppcYuvReco; m_ppcYuvReco = NULL;
    128128  delete [] m_ppcCU     ; m_ppcCU      = NULL;
    129 #if H_3D_DBBP
     129#if NH_3D_DBBP
    130130  delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL;
    131131#endif
     
    152152    setIsChromaQpAdjCoded(true);
    153153  }
    154 
     154 
    155155  // start from the top level CU
    156156  xDecodeCU( pCtu, 0, 0, isLastCtuOfSliceSegment);
     
    163163Void TDecCu::decompressCtu( TComDataCU* pCtu )
    164164{
    165 #if !H_3D_IV_MERGE
     165#if !NH_3D_IV_MERGE
    166166  xDecompressCU( pCtu, 0,  0 );
    167167#endif
     
    283283    pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
    284284  }
    285 #if H_3D_NBDV
     285#if NH_3D_NBDV
    286286  DisInfo DvInfo;
    287287  DvInfo.m_acNBDV.setZero();
    288288  DvInfo.m_aVIdxCan = 0;
    289 #if H_3D_NBDV_REF 
     289#if NH_3D_NBDV_REF 
    290290  DvInfo.m_acDoNBDV.setZero();
    291291#endif
     
    293293if(!pcCU->getSlice()->isIntra())
    294294  {
    295 #if H_3D_ARP && H_3D_IV_MERGE
    296     if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() )
     295#if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP
     296    if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
    297297#else
     298#if NH_3D_IV_MERGE && NH_3D_VSP
     299    if( pcCU->getSlice()->getIvMvPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
     300#else
     301#if NH_3D_ARP && NH_3D_VSP
     302    if( pcCU->getSlice()->getIvResPredFlag() || pcCU->getSlice()->getViewSynthesisPredFlag() )
     303#else
     304#if NH_3D_VSP
     305    if( pcCU->getSlice()->getViewSynthesisPredFlag() )
     306#else
    298307#if H_3D_ARP
    299     if( pcCU->getSlice()->getVPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) )
     308    if( pcCU->getSlice()->getIvResPredFlag( ) )
    300309#else
    301310#if H_3D_IV_MERGE
    302311    if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) )
    303312#else
     313#if NH_3D_DBBP
     314    if( pcCU->getSlice()->getDepthBasedBlkPartFlag() )
     315#else
    304316    if (0)
    305317#endif
    306318#endif
    307319#endif
    308     {
    309       m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true );
    310       m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx);
     320#endif
     321#endif
     322#endif
     323#endif
     324    {
     325      m_ppcCU[uiDepth]->copyInterPredInfoFrom(pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true);
     326      m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);
    311327      PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0);
    312328      UChar cWidTemp     = m_ppcCU[uiDepth]->getWidth(0);
    313329      UChar cHeightTemp  = m_ppcCU[uiDepth]->getHeight(0);
    314       m_ppcCU[uiDepth]->setWidth  ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth)  );
    315       m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth)  );
    316       m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
    317 #if H_3D_IV_MERGE
     330      m_ppcCU[uiDepth]->setWidth (0, pcCU->getSlice()->getSPS()->getMaxCUWidth () / (1 << uiDepth));
     331      m_ppcCU[uiDepth]->setHeight(0, pcCU->getSlice()->getSPS()->getMaxCUHeight() / (1 << uiDepth));
     332      m_ppcCU[uiDepth]->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth);     
     333#if NH_3D_IV_MERGE
    318334      if( pcCU->getSlice()->getIsDepth())
    319335      {
     
    323339      {
    324340#endif
    325 #if H_3D_NBDV_REF
     341#if NH_3D_NBDV_REF
    326342      if( pcCU->getSlice()->getDepthBasedBlkPartFlag() )  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
    327343      {
     
    333349        m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
    334350      }
    335 #if H_3D_IV_MERGE
     351#if NH_3D_IV_MERGE
    336352      }
    337353#endif
     
    346362      }
    347363#endif
    348 
    349364      pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);
    350       m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth );
    351       m_ppcCU[uiDepth]->setWidth  ( 0, cWidTemp );
    352       m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp );
     365      m_ppcCU[uiDepth]->setPartSizeSubParts(ePartTemp, 0, uiDepth);
     366      m_ppcCU[uiDepth]->setWidth(0, cWidTemp);
     367      m_ppcCU[uiDepth]->setHeight(0, cHeightTemp);
    353368     }
    354369  }
     
    381396    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
    382397    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
    383 #if H_3D_IV_MERGE
     398#if NH_3D_IV_MERGE
    384399    m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);
     400    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
     401    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     402#else
     403#if NH_3D_MLC
    385404    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    386405    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    389408    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
    390409#endif
     410#endif
    391411    Int numValidMergeCand = 0;
    392412    for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui )
     
    396416    m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth );
    397417    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
    398 #if H_3D_ARP
     418#if NH_3D_ARP
    399419    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
    400420#endif
    401 #if H_3D_IC
     421#if NH_3D_IC
    402422    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    403423#endif
    404424
    405 #if H_3D_VSP
     425
     426#if NH_3D_VSP
    406427    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    407428    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    408 #if H_3D_SPIVMP
     429#endif
     430#if NH_3D_SPIVMP
    409431    Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
    410432    memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    411433    TComMvField*  pcMvFieldSP;
    412434    UChar* puhInterDirSP;
    413     pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];
    414     puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
    415 #endif
     435    pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];
     436    puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()];
     437#endif
     438
     439#if NH_3D_MLC
    416440    m_ppcCU[uiDepth]->initAvailableFlags();
     441#endif
    417442    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     443#if NH_3D_MLC
    418444    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
    419 #if H_3D_SPIVMP
     445#if NH_3D_SPIVMP
    420446      , pcMvFieldSP, puhInterDirSP
    421447#endif
    422448      , numValidMergeCand, uiMergeIndex );
    423449
    424     m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
    425 #if H_3D_SPIVMP
     450    m_ppcCU[uiDepth]->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
     451#if NH_3D_VSP
     452      , vspFlag
     453#endif
     454#if NH_3D_SPIVMP
    426455      , bSPIVMPFlag
    427456#endif
    428457      , numValidMergeCand );
     458#endif
     459#if NH_3D_VSP
    429460    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    430 #else
    431 #if H_3D
    432     m_ppcCU[uiDepth]->initAvailableFlags();
    433     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    434     m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    435 #else
    436     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    437 #endif
    438 #endif
     461#endif
     462
    439463    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    440464
     
    448472        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
    449473        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
    450 #if H_3D_VSP
     474#if NH_3D_VSP
    451475        if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 )
    452476        {
     
    481505      }
    482506    }
    483 #if H_3D_SPIVMP
     507#if NH_3D_SPIVMP
    484508    pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    485509    if (bSPIVMPFlag[uiMergeIndex])
     
    506530
    507531    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment );
    508 #if H_3D_IV_MERGE
     532#if NH_3D_IV_MERGE
    509533    xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
    510534#endif
     
    531555#endif
    532556      xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment );
    533 #if H_3D_IV_MERGE
     557#if NH_3D_IV_MERGE
    534558      xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
    535559#endif
     
    551575#endif
    552576  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, isLastCtuOfSliceSegment );
    553 #if H_3D_IV_MERGE
     577#if NH_3D_IV_MERGE
    554578  xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
    555579#endif
     
    574598{
    575599  TComPic* pcPic = pCtu->getPic();
    576 #if !H_3D_IV_MERGE
     600#if !NH_3D_IV_MERGE
    577601  TComSlice * pcSlice = pCtu->getSlice();
    578602  const TComSPS &sps=*(pcSlice->getSPS());
     
    617641  {
    618642    case MODE_INTER:
    619 #if H_3D_DBBP
     643#if NH_3D_DBBP
    620644    if( m_ppcCU[uiDepth]->getDBBPFlag(0) )
    621645    {
     
    637661      }
    638662#endif
    639 #if H_3D_DBBP
     663#if NH_3D_DBBP
    640664    }
    641665#endif
     
    852876#endif
    853877
    854 #if H_3D_DBBP
     878#if NH_3D_DBBP
    855879Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    856880{
     
    858882  AOF(!pcCU->getSlice()->isIntra());
    859883  PartSize ePartSize = pcCU->getPartitionSize( 0 );
     884 
     885  Int bitDepthY = pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
    860886 
    861887  // get collocated depth block
     
    878904 
    879905  // first, extract the two sets of motion parameters
    880   UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
     906  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4;
    881907  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
    882908  {
     
    884910   
    885911    pDBBPTmpData->auhInterDir[uiSegment] = pcCU->getInterDir(uiPartAddr);
     912    assert( pDBBPTmpData->auhInterDir[uiSegment] == 1 || pDBBPTmpData->auhInterDir[uiSegment] == 2  );  // only uni-prediction allowed
    886913   
    887914    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     
    891918    }
    892919   
     920#if H_3D
    893921    AOF( pcCU->getARPW(uiPartAddr) == 0 );
    894922    AOF( pcCU->getICFlag(uiPartAddr) == false );
    895923    AOF( pcCU->getSPIVMPFlag(uiPartAddr) == false );
    896924    AOF( pcCU->getVSPFlag(uiPartAddr) == 0 );
     925#endif
    897926  }
    898927 
     
    934963 
    935964  // reconstruct final prediction signal by combining both segments
    936   m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize);
     965  m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0), 0, ePartSize, bitDepthY);
    937966
    938967  // inter recon
    939   xDecodeInterTexture( pcCU, 0, uiDepth );
     968  xDecodeInterTexture( pcCU, uiDepth );
    940969 
    941970  // clip for only non-zero cbp case
    942   if  ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) )
    943   {
    944     m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
     971  if  ( ( pcCU->getCbf( 0, COMPONENT_Y ) ) || ( pcCU->getCbf( 0, COMPONENT_Cb ) ) || ( pcCU->getCbf(0, COMPONENT_Cr ) ) )
     972  {
     973    m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() );
    945974  }
    946975  else
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecCu.h

    r1258 r1279  
    6262  TComDataCU**        m_ppcCU;            ///< CU data array
    6363
    64 #if H_3D_DBBP
     64#if NH_3D_DBBP
    6565  TComYuv**           m_ppcYuvRecoDBBP;
    6666#endif
     
    102102  Void xReconInter              ( TComDataCU* pcCU, UInt uiDepth );
    103103
    104 #if H_3D_DBBP
     104#if NH_3D_DBBP
    105105  Void xReconInterDBBP          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    106106#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecEntropy.cpp

    r1258 r1279  
    104104}
    105105
    106 #if H_3D_ARP
     106#if NH_3D_ARP
    107107Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    108108{
     
    123123#endif
    124124
    125 #if H_3D_IC
     125#if NH_3D_IC
    126126Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    127127{
    128128  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
    129129
     130#if NH_3D_ARP
    130131  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 )
     132#else
     133  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
     134#endif
    131135  {
    132136    return;
     
    234238  UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) );
    235239  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4;
    236 #if H_3D_IV_MERGE
     240//#if H_3D_IV_MERGE
     241#if NH_3D_MLC
    237242  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    238243  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    241246  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
    242247#endif
    243 #if H_3D_SPIVMP
     248#if NH_3D_SPIVMP
    244249  Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];     
    245   TComMvField*  pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];
    246   UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
    247 #endif
    248 #if H_3D_IV_MERGE
     250  TComMvField*  pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];
     251  UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()];
     252#endif
     253#if NH_3D_IV_MERGE
    249254  pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);
    250255#endif
     
    258263  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
    259264  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
    260 #if H_3D
     265#if NH_3D
    261266  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
    262267  {
     
    290295
    291296  ////// Parse CUs extension syntax
     297#if NH_3D_DBBP
    292298  decodeDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );
    293   decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth );
    294 
    295 #if H_3D_ARP
     299#endif
     300  //decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth );
     301
     302#if NH_3D_ARP
    296303  decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    297304#endif
    298 #if H_3D_IC
     305#if NH_3D_IC
    299306  decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    300307#endif
     
    306313    {
    307314      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    308 #if H_3D_DBBP
     315#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
     316      if (bDebugPredEnabled)
     317      {
     318        std::cout << "Coded merge flag, CU absPartIdx: " << uiAbsPartIdx << " PU(" << uiPartIdx << ") absPartIdx: " << uiSubPartIdx;
     319        std::cout << " merge index: " << (UInt)pcCU->getMergeIndex(uiSubPartIdx) << std::endl;
     320      }
     321#endif
     322
     323#if NH_3D_DBBP
    309324      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )
    310325#else
     
    312327#endif
    313328      {
    314         pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
    315         if ( !isMerged )
    316         {
    317 #if H_3D_VSP
     329        if ( !hasMergedCandList )
     330        {
     331          pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set.
     332
     333#if NH_3D_MLC
     334#if NH_3D_VSP
    318335          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    319336          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    320 #if H_3D_SPIVMP
     337#endif
     338#if NH_3D_SPIVMP
    321339          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    322340#endif
    323341          pcSubCU->initAvailableFlags();
    324           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     342#endif
     343          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     344#if NH_3D_MLC
    325345          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
    326 #if H_3D_SPIVMP
     346#if NH_3D_SPIVMP
    327347            , pcMvFieldSP, puhInterDirSP
    328348#endif
    329349            , numValidMergeCand );
    330           pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
    331 #if H_3D_SPIVMP
     350          pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
     351#if NH_3D_VSP
     352            , vspFlag
     353#endif
     354#if NH_3D_SPIVMP
    332355            , bSPIVMPFlag
    333356#endif
    334357            , numValidMergeCand );
     358#if NH_3D_VSP
    335359          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    336 
    337 #else
    338 #if H_3D
    339           pcSubCU->initAvailableFlags();
    340           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
    341           pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    342 
    343 #else
    344           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    345 #endif
    346 #endif
    347           isMerged = true;
    348         }
    349         pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth );
     360#endif
     361#endif
     362          pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore.
     363          hasMergedCandList = true;
     364        }
    350365      }
    351366      else
    352367      {
    353         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    354 #if H_3D_VSP
     368#if NH_3D_MLC
     369#if NH_3D_VSP
    355370        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    356371        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    357 #if H_3D_SPIVMP
     372#endif
     373#if NH_3D_SPIVMP
    358374        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    359375#endif
    360376        pcSubCU->initAvailableFlags();
     377#endif
    361378        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     379#if NH_3D_MLC
    362380        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
    363 #if H_3D_SPIVMP
     381#if NH_3D_SPIVMP
    364382          , pcMvFieldSP, puhInterDirSP
    365383#endif
    366384          ,numValidMergeCand, uiMergeIndex );
    367         pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
    368 #if H_3D_SPIVMP
     385        pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
     386#if NH_3D_VSP
     387          , vspFlag
     388#endif
     389#if NH_3D_SPIVMP
    369390          , bSPIVMPFlag
    370391#endif
    371392          ,numValidMergeCand );
     393#if NH_3D_VSP
    372394        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    373 #else
    374 #if H_3D
    375         pcSubCU->initAvailableFlags();
    376         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    377         pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    378 #else
    379         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
    380395#endif
    381396#endif
     
    385400      TComMv cTmpMv( 0, 0 );
    386401      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
    387       {       
     402      {
    388403        if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
    389404        {
     
    392407          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    393408          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    394 #if H_3D_VSP
    395 #if H_3D_DBBP
     409#if NH_3D_VSP
     410#if NH_3D_DBBP
    396411          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )
    397412#else
     
    412427        }
    413428      }
    414 #if H_3D_SPIVMP
     429#if NH_3D_SPIVMP
    415430      pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 
    416431      if (bSPIVMPFlag[uiMergeIndex] != 0)
     
    443458        {
    444459          decodeMvsAMVP   ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
     460#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
     461          if (bDebugPredEnabled)
     462          {
     463            std::cout << "refListIdx: " << uiRefListIdx << std::endl;
     464            std::cout << "MVD horizontal: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getHor() << std::endl;
     465            std::cout << "MVD vertical:   " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getVer() << std::endl;
     466            std::cout << "MVPIdxPU: " << pcCU->getMVPIdx(RefPicList( uiRefListIdx ), uiSubPartIdx) << std::endl;
     467            std::cout << "InterDir: " << (UInt)pcCU->getInterDir(uiSubPartIdx) << std::endl;
     468          }
     469#endif
    445470        }
    446471      }
     
    474499      }
    475500#endif
     501#if NH_3D_IC
     502      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     503#endif
    476504
    477505      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     
    481509        {
    482510          pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set.
     511
     512#if NH_3D_MLC
     513#if NH_3D_VSP
     514          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     515          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     516#endif
     517#if NH_3D_SPIVMP
     518          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     519#endif
     520          pcSubCU->initAvailableFlags();
     521#endif
    483522          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     523#if NH_3D_MLC
     524          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
     525#if NH_3D_SPIVMP
     526            , pcMvFieldSP, puhInterDirSP
     527#endif
     528            , numValidMergeCand );
     529          pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
     530#if NH_3D_VSP
     531            , vspFlag
     532#endif
     533#if NH_3D_SPIVMP
     534            , bSPIVMPFlag
     535#endif
     536            , numValidMergeCand );
     537#if NH_3D_VSP
     538          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
     539#endif
     540#endif
    484541          pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore.
    485542          hasMergedCandList = true;
     
    489546      {
    490547        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     548
     549#if NH_3D_MLC
     550#if NH_3D_VSP
     551        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     552        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     553#endif
     554#if NH_3D_SPIVMP
     555        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     556#endif
     557        pcSubCU->initAvailableFlags();
     558#endif
    491559        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     560#if NH_3D_MLC
     561        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
     562#if NH_3D_SPIVMP
     563          , pcMvFieldSP, puhInterDirSP
     564#endif
     565          ,numValidMergeCand, uiMergeIndex );
     566        pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
     567#if NH_3D_VSP
     568          , vspFlag
     569#endif
     570#if NH_3D_SPIVMP
     571          , bSPIVMPFlag
     572#endif
     573          ,numValidMergeCand );
     574#if NH_3D_VSP
     575        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
     576#endif
     577#endif
    492578      }
    493579
     
    503589          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    504590          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    505 
    506         }
    507       }
     591#if NH_3D_VSP
     592          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
     593          {
     594            if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
     595            {
     596              UInt dummy;
     597              Int vspSize;
     598              Int width, height;
     599              pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );
     600              pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );
     601              pcCU->setVSPFlag( uiSubPartIdx, vspSize );
     602            }
     603          }
     604#endif
     605        }
     606      }
     607#if NH_3D_SPIVMP
     608      pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 
     609      if (bSPIVMPFlag[uiMergeIndex] != 0)
     610      {
     611        Int iWidth, iHeight;
     612        UInt uiIdx;
     613        pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );
     614
     615        UInt uiSPAddr;
     616
     617        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     618
     619        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     620
     621        for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
     622        {
     623          pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
     624          pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
     625          pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
     626          pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
     627        }
     628      }
     629#endif
    508630    }
    509631    else
     
    529651        }
    530652      }
     653#if NH_3D_IC
     654      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     655#endif
    531656    }
    532657
     
    539664  }
    540665#endif
    541 #if H_3D_SPIVMP
     666#if NH_3D_SPIVMP
    542667  delete[] pcMvFieldSP;
    543668  delete[] puhInterDirSP;
     
    607732}
    608733
    609 #if H_3D
     734#if NH_3D
    610735Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )
    611736{
     
    10611186}
    10621187#endif
    1063 #if H_3D_DBBP
     1188#if NH_3D_DBBP
    10641189Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    10651190{
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecEntropy.h

    r1258 r1279  
    8383  virtual Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) = 0;
    8484  virtual Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex ) = 0;
    85 #if H_3D_ARP
     85#if NH_3D_ARP
    8686  virtual Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    8787#endif
    88 #if H_3D_IC
     88#if NH_3D_IC
    8989  virtual Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    9090#endif
     
    9595  virtual Void parseSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    9696#endif
    97 #if H_3D_DBBP
     97#if NH_3D_DBBP
    9898  virtual Void parseDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    9999#endif
     
    145145  Void decodeMvdPU        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList );
    146146  Void decodeMVPIdxPU     ( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList );
    147 #if H_3D
     147#if NH_3D
    148148  Void decodeMvsAMVP      ( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx,
    149149RefPicList eRefList );
     
    174174  Void decodePartSize          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    175175
    176 #if H_3D_ARP
     176#if NH_3D_ARP
    177177  Void decodeARPW              ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    178178#endif
    179 #if H_3D_IC
     179#if NH_3D_IC
    180180  Void decodeICFlag            ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    181181#endif
     
    184184  Void decodeSDCFlag           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    185185#endif
    186 #if H_3D_DBBP
     186#if NH_3D_DBBP
    187187  Void decodeDBBPFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    188188#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecGop.cpp

    r1200 r1279  
    122122  }
    123123
    124 #if H_3D_NBDV
     124#if NH_3D_NBDV
    125125  if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
    126126  {
    127     Int iColPoc = pcSlice->getRefPOC(RefPicList(1-pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
    128     rpcPic->setNumDdvCandPics(rpcPic->getDisCandRefPictures(iColPoc));
     127    Int iColPoc = pcSlice->getRefPOC(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
     128    pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc));
    129129  }
    130130
    131131  if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
    132132  {
    133     rpcPic->checkTemporalIVRef();
     133    pcPic->checkTemporalIVRef();
    134134  }
    135135
    136136  if(pcSlice->getIsDepth())
    137137  {
    138     rpcPic->checkTextureRef();
     138    pcPic->checkTextureRef();
    139139  }
    140140#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecSbac.cpp

    r1258 r1279  
    7373, m_cCUMergeFlagExtSCModel                   ( 1,             1,                      NUM_MERGE_FLAG_EXT_CTX               , m_contextModels + m_numContextModels, m_numContextModels)
    7474, m_cCUMergeIdxExtSCModel                    ( 1,             1,                      NUM_MERGE_IDX_EXT_CTX                , m_contextModels + m_numContextModels, m_numContextModels)
    75 #if H_3D_ARP
     75#if NH_3D_ARP
    7676, m_cCUPUARPWSCModel          ( 1,             1,               NUM_ARPW_CTX                  , m_contextModels + m_numContextModels, m_numContextModels)
    7777#endif
    78 #if H_3D_IC
     78#if NH_3D_IC
    7979, m_cCUICFlagSCModel          ( 1,             1,               NUM_IC_FLAG_CTX               , m_contextModels + m_numContextModels, m_numContextModels)
    8080#endif
     
    120120, m_cDdcFlagSCModel                          ( 1,             1,                     NUM_DDC_FLAG_CTX                      , m_contextModels + m_numContextModels, m_numContextModels)
    121121#endif
    122 #if H_3D_DBBP
     122#if NH_3D_DBBP
    123123, m_cDBBPFlagSCModel                         ( 1,             1,                     DBBP_NUM_FLAG_CTX                     , m_contextModels + m_numContextModels, m_numContextModels)
    124124#endif
     
    165165  m_cCUMergeFlagExtSCModel.initBuffer             ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT );
    166166  m_cCUMergeIdxExtSCModel.initBuffer              ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT );
    167 #if H_3D_ARP
     167#if NH_3D_ARP
    168168  m_cCUPUARPWSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_ARPW );
    169169#endif
    170 #if H_3D_IC
     170#if NH_3D_IC
    171171  m_cCUICFlagSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_IC_FLAG );
    172172#endif
     
    211211  m_cDdcFlagSCModel.initBuffer                    ( sliceType, qp, (UChar*)INIT_DDC_FLAG );
    212212#endif
    213 #if H_3D_DBBP
     213#if NH_3D_DBBP
    214214  m_cDBBPFlagSCModel.initBuffer                   ( sliceType, qp, (UChar*)INIT_DBBP_FLAG );
    215215#endif
     
    238238}
    239239
    240 #if H_3D_ARP
    241   m_cCUPUARPWSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_ARPW );
    242 #endif
    243 #if H_3D_IC
    244   m_cCUICFlagSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );
    245 #endif
    246 #if H_3D_DBBP
    247   m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
    248 #endif
    249240
    250241
     
    651642
    652643  UInt uiSymbol;
    653 #if H_3D_QTLPC
     644#if NH_3D_QTLPC
    654645  Bool bParseSplitFlag    = true;
    655646  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();
     
    666657#endif
    667658  {
    668     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
     659    TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());
    669660    assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth);
    670661    bParseSplitFlag         = (pcTextureCU->getDepth(uiAbsPartIdx) > uiDepth);
     
    681672  DTRACE_CABAC_T( "\tSplitFlag\n" )
    682673#endif
    683 #if H_3D_QTLPC
     674#if NH_3D_QTLPC
    684675  }
    685676  else
     
    713704  assert ( pcCU->getSlice()->getSPS()->getLog2DiffMaxMinCodingBlockSize() == log2DiffMaxMinCodingBlockSize);
    714705
    715 #if H_3D_QTLPC
     706#if NH_3D_QTLPC
    716707  Bool bParsePartSize    = true;
    717708
     
    732723#endif
    733724  {
    734     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
     725    TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());
    735726    assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth);
    736727    if(pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth )
     
    749740  if ( pcCU->isIntra( uiAbsPartIdx ) )
    750741  {
    751 #if H_3D_QTLPC
     742#if NH_3D_QTLPC
    752743    if(bParsePartSize)
    753744    {
     
    762753    }
    763754    eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN;
    764 #if H_3D_QTLPC
     755#if NH_3D_QTLPC
    765756    }
    766757#endif
     
    780771  else
    781772  {
    782 #if H_3D_QTLPC
     773#if NH_3D_QTLPC
    783774    if(bParsePartSize)
    784775    {
     
    824815      }
    825816    }
    826 #if H_3D_QTLPC
     817#if NH_3D_QTLPC
    827818      }
    828819      else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)
    829820      {
    830821        UInt uiMaxNumBits = 1;
    831         if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     822        if ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )
    832823        {
    833824          uiMaxNumBits ++;
     
    835826        for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
    836827        {
    837           m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) );
     828          m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype) );
    838829          if ( uiSymbol )
    839830          {
     
    843834        }
    844835        eMode = (PartSize) uiMode;
    845         if(uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==1 )
     836        if(uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==1 )
    846837        {
    847838          eMode = SIZE_2NxN;
    848839        }
    849         else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth )==0  && uiSymbol==0)
     840        else if (uiMode && (( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )==0)  && uiSymbol==0)
    850841        {
    851842          eMode = SIZE_2NxN;
    852843        }
    853         else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==0)
    854         {
    855           m_pcTDecBinIf->decodeBinEP(uiSymbol);
     844        else if (uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==0)
     845        {
     846          m_pcTDecBinIf->decodeBinEP(uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype));
    856847          eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);
    857848        }
     
    860851      {
    861852        UInt uiMaxNumBits = 1;
    862         if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     853        if (  ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )
    863854        {
    864855          uiMaxNumBits ++;
     
    866857        for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
    867858        {
    868           m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) );
     859          m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype));
    869860          if ( uiSymbol )
    870861          {
     
    874865        }
    875866        eMode = (PartSize) uiMode;
    876         if(uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==1 )
     867        if(uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==1 )
    877868        {
    878869          eMode = SIZE_Nx2N;
    879870        }
    880         else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth )==0  && uiSymbol==0)
     871        else if (uiMode && (( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize )==0)  && uiSymbol==0)
    881872        {
    882873          eMode = SIZE_Nx2N;
    883874        }
    884         else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==0)
    885         {
    886           m_pcTDecBinIf->decodeBinEP(uiSymbol);
     875        else if (uiMode && ( ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiDepth < log2DiffMaxMinCodingBlockSize ) && uiSymbol==0)
     876        {
     877          m_pcTDecBinIf->decodeBinEP(uiSymbol RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(ctype));
    887878          eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);
    888879        }
     
    896887      DTRACE_CU("part_mode", eMode )
    897888#endif
    898 #if H_3D_QTLPC
     889#if NH_3D_QTLPC
    899890    }
    900891#endif
     
    22782269}
    22792270
    2280 #if H_3D_ARP
     2271#if NH_3D_ARP
    22812272Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    22822273{
    2283   UInt uiMaxW = pcCU->getSlice()->getARPStepNum() - 1;
    22842274  UInt uiW = 0;
    22852275  UInt uiOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx);
    22862276  UInt uiCode = 0;
    22872277
    2288   assert ( uiMaxW > 0 );
    2289 
    2290   m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 0 + uiOffset ) );
     2278  m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 0 + uiOffset ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__ARP_FLAG));
    22912279
    22922280  uiW = uiCode;
    22932281  if( 1 == uiW )   
    22942282  {
    2295     m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 2 ) );
     2283    m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 2 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__ARP_FLAG));
    22962284    uiW += ( 1 == uiCode ? 1 : 0 );
    22972285  }
     
    23032291#endif
    23042292
    2305 #if H_3D_IC
     2293#if NH_3D_IC
    23062294/** parse illumination compensation flag
    23072295 * \param pcCU
     
    23132301{
    23142302  UInt uiSymbol = 0;
    2315   m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) );
     2303  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__3D_IC) );
     2304
    23162305#if !H_MV_ENC_DEC_TRAC
    23172306  DTRACE_CABAC_VL( g_nSymbolCounter++ );
     
    25232512#endif
    25242513
    2525 #if H_3D_DBBP
     2514#if NH_3D_DBBP
    25262515Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    25272516{
     
    25312520  UInt uiSymbol = 0;
    25322521 
    2533   m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
     2522  m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DBBP_FLAG) );
    25342523  DTRACE_CU("dbbp_flag", uiSymbol)
    25352524  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
    25362525  AOF( ePartSize == SIZE_2NxN || ePartSize == SIZE_Nx2N );
    2537   UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
     2526  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4;
    25382527  pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx, 0, uiDepth);
    25392528  pcCU->setDBBPFlagSubParts(uiSymbol, uiAbsPartIdx+uiPUOffset, 1, uiDepth);
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecSbac.h

    r1258 r1279  
    122122  Void  parseSDCFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    123123#endif
    124 #if H_3D_DBBP
     124#if NH_3D_DBBP
    125125  Void parseDBBPFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    126126#endif
     
    143143  Void parseMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
    144144  Void parseMergeIndex    ( TComDataCU* pcCU, UInt& ruiMergeIndex );
    145 #if H_3D_ARP
     145#if NH_3D_ARP
    146146  Void parseARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    147147#endif
    148 #if H_3D_IC
     148#if NH_3D_IC
    149149  Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    150150#endif
     
    188188  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
    189189  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
    190 #if H_3D_ARP
     190#if NH_3D_ARP
    191191  ContextModel3DBuffer m_cCUPUARPWSCModel;
    192192#endif
    193 #if H_3D_IC
     193#if NH_3D_IC
    194194  ContextModel3DBuffer m_cCUICFlagSCModel;
    195195#endif
     
    238238  ContextModel3DBuffer m_cDdcFlagSCModel;
    239239#endif
    240 #if H_3D_DBBP
     240#if NH_3D_DBBP
    241241  ContextModel3DBuffer m_cDBBPFlagSCModel;
    242242#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecSlice.cpp

    r1200 r1279  
    9090  g_bJustDoIt = g_bEncDecTraceEnable;
    9191#endif
     92#if H_MV_ENC_DEC_TRAC
     93#if ENC_DEC_TRACE
     94  incSymbolCounter();
     95#endif
     96  DTRACE_CABAC_VL( g_nSymbolCounter );
     97#else
    9298  DTRACE_CABAC_VL( g_nSymbolCounter++ );
     99#endif
    93100  DTRACE_CABAC_T( "\tPOC: " );
    94101  DTRACE_CABAC_V( pcPic->getPOC() );
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecTop.cpp

    r1251 r1279  
    292292
    293293
    294 #if H_3D_IV_MERGE
     294#if NH_3D_IV_MERGE
    295295Void
    296296CamParsCollector::copyCamParamForSlice( TComSlice* pcSlice )
     
    423423{
    424424#if ENC_DEC_TRACE
     425#if H_MV_ENC_DEC_TRAC_FIX
     426  if (g_hTrace != stdout && g_hTrace != NULL)
     427#else
    425428  if (g_hTrace != stdout)
     429#endif
    426430  {
    427431    fclose( g_hTrace );
     432#if H_MV_ENC_DEC_TRAC_FIX
     433    g_hTrace = NULL;
     434#endif
    428435  }
    429436#endif
     
    11421149    pcSlice->getTempRefPicLists( m_cListPic, m_refPicSetInterLayer0, m_refPicSetInterLayer1, tempRefPicLists, usedAsLongTerm, numPocTotalCurr);
    11431150    pcSlice->setRefPicList     ( tempRefPicLists, usedAsLongTerm, numPocTotalCurr, true );
    1144 #if H_3D
     1151#if NH_3D_NBDV
    11451152    pcSlice->setDefaultRefView();
    11461153#endif
    1147 #if H_3D_ARP
     1154#if NH_3D_ARP
    11481155    pcSlice->setARPStepNum(m_ivPicLists);
    1149     if( pcSlice->getARPStepNum() > 1 )
    1150     {
    1151       // GT: This seems to be broken, not all nuh_layer_ids are necessarily present
    1152       for(Int iLayerId = 0; iLayerId < nalu.m_nuhLayerId; iLayerId ++ )
    1153       {
    1154         Int  iViewIdx =   pcSlice->getVPS()->getViewIndex(iLayerId);
    1155         Bool bIsDepth = ( pcSlice->getVPS()->getDepthId  ( iLayerId ) == 1 );
    1156         if( iViewIdx<getViewIndex() && !bIsDepth )
    1157         {
    1158           pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx );
    1159         }
    1160       }
    1161     }
    11621156#endif
    11631157#else
     
    11671161#if NH_3D
    11681162    pcSlice->checkInCompPredRefLayers();
    1169 #if H_3D_IV_MERGE
     1163#if NH_3D_IV_MERGE
    11701164#if H_3D_FCO
    11711165    //assert( !getIsDepth() );
     
    12261220    //---------------
    12271221    pcSlice->setRefPOCList();
    1228 #if  H_3D_TMVP
     1222#if  NH_3D_TMVP
    12291223    if(pcSlice->getLayerId())
    12301224    {
     
    12641258  }
    12651259
    1266 #if H_3D_IV_MERGE
     1260#if NH_3D_IV_MERGE
    12671261#if H_3D_FCO
    12681262  if( !pcSlice->getIsDepth() && m_pcCamParsCollector )
  • branches/HTM-14.1-update-dev1/source/Lib/TLibDecoder/TDecTop.h

    r1239 r1279  
    8181  Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
    8282
    83 #if H_3D_IV_MERGE
     83#if NH_3D_IV_MERGE
    8484  Void  copyCamParamForSlice( TComSlice* pcSlice );
    8585#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/SyntaxElementWriter.cpp

    r1200 r1279  
    5252    if ( !g_disableNumbering )
    5353    {
    54 #endif
     54      incSymbolCounter();
     55      fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
     56    }
     57#else
    5558    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    56 #if H_MV_ENC_DEC_TRAC
    57     }
    5859#endif
    5960
     
    7778    if ( !g_disableNumbering )
    7879    {
    79 #endif
     80      incSymbolCounter();
     81      fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
     82    }
     83#else
    8084    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    81 #if H_MV_ENC_DEC_TRAC
    82     }
    8385#endif
    8486
     
    9597    if ( !g_disableNumbering )
    9698    {
    97 #endif
     99      incSymbolCounter();
     100      fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
     101    }
     102#else
    98103    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    99 #if H_MV_ENC_DEC_TRAC
    100     }
    101104#endif
    102105
     
    113116    if ( !g_disableNumbering )
    114117    {
     118      incSymbolCounter();
     119      fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter );
     120    }
     121#else
     122     fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    115123#endif
    116     fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
    117 #if H_MV_ENC_DEC_TRAC
    118     }
    119 #endif
     124
    120125    fprintf( g_hTrace, "%-50s u(1)  : %d\n", pSymbolName, value );
    121126  }
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1258 r1279  
    21262126      xCodePredWeightTable( pcSlice );
    21272127    }
    2128 #if H_3D_IC
     2128#if NH_3D_IC
    21292129    else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE )
    21302130      && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0
     
    21352135      if( pcSlice->getApplyIC() )
    21362136      {
    2137         WRITE_FLAG( pcSlice->getIcSkipParseFlag() ? 1 : 0, "ic_skip_mergeidx0" );
    2138       }
    2139     }
    2140 #endif
    2141 #if H_3D_IV_MERGE
     2137        WRITE_FLAG( pcSlice->getIcSkipParseFlag() ? 1 : 0, "slice_ic_disabled_merge_zero_idx_flag" );
     2138      }
     2139    }
     2140#endif
     2141#if NH_3D_IV_MERGE
    21422142    assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS_MEM);
    21432143#else
     
    21462146    if (!pcSlice->isIntra())
    21472147    {
    2148 #if H_3D_IV_MERGE
     2148#if NH_3D_IV_MERGE
    21492149      WRITE_UVLC( ( ( pcSlice->getMpiFlag( ) || pcSlice->getIvMvPredFlag( ) || pcSlice->getViewSynthesisPredFlag( ) ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS ) - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand");
    21502150#else
     
    25222522}
    25232523
    2524 #if H_3D_ARP
     2524#if NH_3D_ARP
    25252525Void TEncCavlc::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx )
    25262526{
     
    25292529#endif
    25302530
    2531 #if H_3D_IC
     2531#if NH_3D_IC
    25322532Void TEncCavlc::codeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
    25332533{
     
    28382838#endif
    28392839   
    2840 #if H_3D_DBBP
     2840#if NH_3D_DBBP
    28412841Void TEncCavlc::codeDBBPFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx )
    28422842{
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCavlc.h

    r1258 r1279  
    129129  Void  codeDeltaDC      ( TComDataCU* /*pcCU*/, UInt /*absPartIdx*/ ) { assert(0); };
    130130#endif
    131 #if H_3D_ARP
     131#if NH_3D_ARP
    132132  Void codeARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    133133#endif
    134 #if H_3D_IC
     134#if NH_3D_IC
    135135  Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    136136#endif
     
    139139  Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    140140#endif
    141 #if H_3D_DBBP
     141#if NH_3D_DBBP
    142142  Void codeDBBPFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    143143#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCfg.h

    r1219 r1279  
    572572  Void      setMaxTotalCUDepth              ( UInt  u )      { m_maxTotalCUDepth = u; }
    573573  Void      setLog2DiffMaxMinCodingBlockSize( UInt  u )      { m_log2DiffMaxMinCodingBlockSize = u; }
    574 #if H_3D_IC
     574#if NH_3D_IC
    575575  Void       setUseIC                       ( Bool bVal )    { m_bUseIC = bVal; }
    576576  Bool       getUseIC                       ()               { return m_bUseIC; }
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCu.cpp

    r1258 r1279  
    6868  m_ppcTempCU      = new TComDataCU*[m_uhTotalDepth-1];
    6969
    70 #if H_3D_ARP
     70#if NH_3D_ARP
    7171  m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1];
    7272#endif
     
    7979  m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1];
    8080  m_ppcOrigYuv     = new TComYuv*[m_uhTotalDepth-1];
    81 #if H_3D_DBBP
     81#if NH_3D_DBBP
    8282  m_ppcOrigYuvDBBP = new TComYuv*[m_uhTotalDepth-1];
    8383#endif
     
    9292    m_ppcBestCU[i] = new TComDataCU; m_ppcBestCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
    9393    m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
    94 #if H_3D_ARP
    95     m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
     94#if NH_3D_ARP
     95    m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( chromaFormat, uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
    9696#endif 
    9797
     
    105105
    106106    m_ppcOrigYuv    [i] = new TComYuv; m_ppcOrigYuv    [i]->create(uiWidth, uiHeight, chromaFormat);
    107 #if H_3D_DBBP
    108     m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight);
     107#if NH_3D_DBBP
     108    m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight, chromaFormat);
    109109#endif
    110110
     
    146146      m_ppcTempCU[i]->destroy();      delete m_ppcTempCU[i];      m_ppcTempCU[i] = NULL;
    147147    }
    148 #if H_3D_ARP
     148#if NH_3D_ARP
    149149    if(m_ppcWeightedTempCU[i])
    150150    {
     
    180180      m_ppcOrigYuv[i]->destroy();     delete m_ppcOrigYuv[i];     m_ppcOrigYuv[i] = NULL;
    181181    }
    182 #if H_3D_DBBP
     182#if NH_3D_DBBP
    183183    if(m_ppcOrigYuvDBBP[i])
    184184    {
     
    198198  }
    199199
    200 #if H_3D_ARP
     200#if NH_3D_ARP
    201201  if(m_ppcWeightedTempCU)
    202202  {
     
    240240    m_ppcOrigYuv = NULL;
    241241  }
    242 #if H_3D_DBBP
     242#if NH_3D_DBBP
    243243  if(m_ppcOrigYuvDBBP)
    244244  {
     
    280280  m_ppcTempCU[0]->initCtu( pCtu->getPic(), pCtu->getCtuRsAddr() );
    281281
     282#if NH_3D_ARP
     283  m_ppcWeightedTempCU[0]->initCtu( pCtu->getPic(), pCtu->getCtuRsAddr() );
     284#endif
     285
    282286#if KWU_RC_MADPRED_E0227
    283287  m_LCUPredictionSAD = 0;
     
    413417
    414418
    415 #if H_3D_QTLPC
     419#if NH_3D_QTLPC
    416420  Bool  bLimQtPredFalg    = pcPic->getSlice(0)->getQtPredFlag();
    417421  TComPic *pcTexture      = rpcBestCU->getSlice()->getTexturePic();
     
    429433  m_ppcOrigYuv[uiDepth]->copyFromPicYuv( pcPic->getPicYuvOrg(), rpcBestCU->getCtuRsAddr(), rpcBestCU->getZorderIdxInCtu() );
    430434
    431 #if H_3D_QTLPC 
     435#if NH_3D_QTLPC 
    432436  Bool    bTrySplit     = true;
    433437  Bool    bTrySplitDQP  = true;
     
    441445  Bool    earlyDetectionSkipMode = false;
    442446
    443 #if H_3D_VSP
     447#if NH_3D_NBDV
    444448  DisInfo DvInfo;
    445449  DvInfo.m_acNBDV.setZero();
    446450  DvInfo.m_aVIdxCan = 0;
    447 #if H_3D_NBDV_REF
     451#if NH_3D_NBDV_REF
    448452  DvInfo.m_acDoNBDV.setZero();
    449453#endif
     
    505509  }
    506510
    507 #if H_3D_IC
     511#if NH_3D_IC
    508512  Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ) && !rpcTempCU->getSlice()->getIsDepth();
    509513  bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC();
     
    529533      }
    530534
    531 #if H_3D_QTLPC
     535#if NH_3D_QTLPC
    532536      bTrySplit    = true;
    533537#endif
     
    547551
    548552      rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    549 #if H_3D_QTLPC
     553#if NH_3D_QTLPC
    550554      //logic for setting bTrySplit using the partition information that is stored of the texture colocated CU
    551555#if H_3D_FCO
     
    555559#endif
    556560      {
    557         TComDataCU* pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() ); //Corresponding texture LCU
    558         UInt uiCUIdx            = rpcBestCU->getZorderIdxInCU();
     561        TComDataCU* pcTextureCU = pcTexture->getCtu( rpcBestCU->getCtuRsAddr() ); //Corresponding texture LCU
     562        UInt uiCUIdx            = rpcBestCU->getZorderIdxInCtu();
    559563        assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth); //Depth cannot be more partitioned than the texture.
    560564        if (pcTextureCU->getDepth(uiCUIdx) > uiDepth || pcTextureCU->getPartitionSize(uiCUIdx) == SIZE_NxN) //Texture was split.
     
    584588#endif
    585589
    586 #if H_3D_NBDV
     590#if NH_3D_NBDV
    587591      if( rpcTempCU->getSlice()->getSliceType() != I_SLICE )
    588592      {
    589 #if H_3D_ARP && H_3D_IV_MERGE
    590         if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getIvMvPredFlag() )
     593#if NH_3D_ARP && NH_3D_IV_MERGE && NH_3D_VSP
     594        if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() )
    591595#else
    592 #if H_3D_ARP
    593         if( rpcTempCU->getSlice()->getVPS()->getUseAdvRP(rpcTempCU->getSlice()->getLayerId()) )
     596#if NH_3D_IV_MERGE && NH_3D_VSP
     597        if( rpcTempCU->getSlice()->getIvMvPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() )
     598#else
     599#if NH_3D_ARP && NH_3D_VSP
     600        if( rpcTempCU->getSlice()->getIvResPredFlag() || rpcTempCU->getSlice()->getViewSynthesisPredFlag() )
     601#else
     602#if NH_3D_VSP
     603        if( rpcTempCU->getSlice()->getViewSynthesisPredFlag() )
     604#else
     605#if NH_3D_ARP
     606        if( rpcTempCU->getSlice()->getIvResPredFlag() )
    594607#else
    595608#if H_3D_IV_MERGE
    596609        if( rpcTempCU->getSlice()->getVPS()->getIvMvPredFlag(rpcTempCU->getSlice()->getLayerId()) )
    597610#else
     611#if NH_3D_DBBP
     612        if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() )
     613#else
    598614        if (0)
     615#endif
     616#endif
     617#endif
     618#endif
    599619#endif
    600620#endif
     
    602622        {
    603623          PartSize ePartTemp = rpcTempCU->getPartitionSize(0);
    604           rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
    605 #if H_3D_IV_MERGE
     624          rpcTempCU->setPartSizeSubParts(SIZE_2Nx2N, 0, uiDepth);
     625#if NH_3D_IV_MERGE
    606626          if (rpcTempCU->getSlice()->getIsDepth() )
    607627          {
     
    611631          {
    612632#endif
    613 #if H_3D_NBDV_REF
     633#if NH_3D_NBDV_REF
    614634            if( rpcTempCU->getSlice()->getDepthRefinementFlag() )
    615635            {
     
    621641              rpcTempCU->getDisMvpCandNBDV(&DvInfo);
    622642            }
    623 #if H_3D_IV_MERGE
     643#if NH_3D_IV_MERGE
    624644          }
    625645#endif
     
    642662      if( rpcBestCU->getSlice()->getSliceType() != I_SLICE )
    643663      {
    644 #if H_3D_IC
     664#if NH_3D_IC
    645665        for( UInt uiICId = 0; uiICId < ( bICEnabled ? 2 : 1 ); uiICId++ )
    646666        {
     
    650670        if(m_pcEncCfg->getUseEarlySkipDetection())
    651671        {
    652 #if H_3D_IC
     672#if NH_3D_IC
    653673            rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
    654674#endif
     
    659679          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N
    660680#endif
    661 #if H_3D_VSP
    662             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     681#if NH_3D_VSP  || NH_3D_DBBP
     682          rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    663683#endif
    664684        }
    665685        // SKIP
    666 #if H_3D_IC
     686#if NH_3D_IC
    667687          rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
    668688#endif
     
    673693
    674694        rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    675 #if H_3D_VSP
    676           rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     695#if NH_3D_VSP  || NH_3D_DBBP
     696        rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    677697#endif
    678698
     
    680700        {
    681701          // 2Nx2N, NxN
    682 #if H_3D_IC
     702#if NH_3D_IC
    683703            rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
    684704#endif
     
    690710          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    691711#endif
    692 #if H_3D_VSP
    693             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    694 #endif
    695 #if H_3D_DBBP
     712#if NH_3D_VSP  || NH_3D_DBBP
     713          rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     714#endif
     715#if NH_3D_DBBP
    696716            if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
    697717            {
    698718              xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );
    699719              rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode  );
    700 #if H_3D_VSP
     720#if NH_3D_VSP  || NH_3D_DBBP
    701721              rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    702722#endif
     
    709729          }
    710730        }
    711 #if H_3D_IC
     731#if NH_3D_IC
    712732        }
    713733#endif
    714734      }
    715 #if H_3D_QTLPC     
     735#if NH_3D_QTLPC     
    716736      if(depthMapDetect && !bIntraSliceDetect && !rapPic && ( m_pcEncCfg->getUseQTL() || bLimQtPredFalg ))
    717737      {
     
    768788          {
    769789            if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() && doNotBlockPu
    770 #if H_3D_QTLPC
     790#if NH_3D_QTLPC
    771791                && bTrySplit
    772792#endif
     
    780800#endif
    781801              rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    782 #if H_3D_VSP
    783                 rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     802#if NH_3D_VSP || NH_3D_DBBP
     803              rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    784804#endif
    785805
     
    788808
    789809          if(doNotBlockPu
    790 #if H_3D_QTLPC
     810#if NH_3D_QTLPC
    791811            && bTryNx2N
    792812#endif
     
    799819#endif
    800820            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    801 #if H_3D_VSP
     821#if NH_3D_VSP || NH_3D_DBBP
    802822            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    803823#endif
     
    809829          }
    810830          if(doNotBlockPu
    811 #if H_3D_QTLPC
     831#if NH_3D_QTLPC
    812832            && bTry2NxN
    813833#endif
     
    822842
    823843            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    824 #if H_3D_VSP
     844#if NH_3D_VSP || NH_3D_DBBP
    825845            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    826846#endif
     
    850870            {
    851871              if(doNotBlockPu
    852 #if H_3D_QTLPC
     872#if NH_3D_QTLPC
    853873                && bTry2NxN
    854874#endif
     
    861881#endif
    862882                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    863 #if H_3D_VSP
     883#if NH_3D_VSP || NH_3D_DBBP
    864884                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    865885#endif
     
    870890              }
    871891              if(doNotBlockPu
    872 #if H_3D_QTLPC
     892#if NH_3D_QTLPC
    873893                && bTry2NxN
    874894#endif
     
    882902
    883903                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    884 #if H_3D_VSP
     904#if NH_3D_VSP || NH_3D_DBBP
    885905                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    886906#endif
     
    896916            {
    897917              if(doNotBlockPu
    898 #if H_3D_QTLPC
     918#if NH_3D_QTLPC
    899919                && bTry2NxN
    900920#endif
     
    909929
    910930                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    911 #if H_3D_VSP
     931#if NH_3D_VSP || NH_3D_DBBP
    912932                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    913933#endif
     
    918938              }
    919939              if(doNotBlockPu
    920 #if H_3D_QTLPC
     940#if NH_3D_QTLPC
    921941                && bTry2NxN
    922942#endif
     
    929949#endif
    930950                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    931 #if H_3D_VSP
     951#if NH_3D_VSP || NH_3D_DBBP
    932952                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    933953#endif
     
    945965            {
    946966              if(doNotBlockPu
    947 #if H_3D_QTLPC
     967#if NH_3D_QTLPC
    948968                && bTryNx2N
    949969#endif
     
    957977
    958978                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    959 #if H_3D_VSP
     979#if NH_3D_VSP || NH_3D_DBBP
    960980                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    961981#endif
     
    966986              }
    967987              if(doNotBlockPu
    968 #if H_3D_QTLPC
     988#if NH_3D_QTLPC
    969989                && bTryNx2N
    970990#endif
     
    977997#endif
    978998                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    979 #if H_3D_VSP
     999#if NH_3D_VSP || NH_3D_DBBP
    9801000                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    9811001#endif
     
    9861006            {
    9871007              if(doNotBlockPu
    988 #if H_3D_QTLPC
     1008#if NH_3D_QTLPC
    9891009                && bTryNx2N
    9901010#endif
     
    9971017#endif
    9981018                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    999 #if H_3D_VSP
     1019#if NH_3D_VSP || NH_3D_DBBP
    10001020                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    10011021#endif
     
    10061026              }
    10071027              if(doNotBlockPu
    1008 #if H_3D_QTLPC
     1028#if NH_3D_QTLPC
    10091029                && bTryNx2N
    10101030#endif
     
    10181038#endif
    10191039                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    1020 #if H_3D_VSP
     1040#if NH_3D_VSP || NH_3D_DBBP
    10211041                rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    10221042#endif
     
    10271047
    10281048#else
    1029 #if H_3D_QTLPC
     1049#if NH_3D_QTLPC
    10301050            if (bTry2NxN)
    10311051            {
     
    10341054            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
    10351055            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    1036 #if H_3D_VSP
    1037               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     1056#if NH_3D_VSP || NH_3D_DBBP
     1057            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    10381058#endif
    10391059            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
    10401060            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    1041 #if H_3D_VSP
    1042               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    1043 #endif
    1044 #if H_3D_QTLPC
     1061#if NH_3D_VSP || NH_3D_DBBP
     1062            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     1063#endif
     1064#if NH_3D_QTLPC
    10451065            }
    10461066            if (bTryNx2N)
     
    10491069            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
    10501070            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    1051 #if H_3D_VSP
    1052               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     1071#if NH_3D_VSP || NH_3D_DBBP
     1072            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    10531073#endif
    10541074            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
    10551075            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    1056 #if H_3D_VSP
    1057               rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    1058 #endif
    1059 #if H_3D_QTLPC
     1076#if NH_3D_VSP || NH_3D_DBBP
     1077            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     1078#endif
     1079#if NH_3D_QTLPC
    10601080            }
    10611081#endif
     
    11131133          if( uiDepth == sps.getLog2DiffMaxMinCodingBlockSize() )
    11141134          {
    1115 #if H_3D_QTLPC //Try IntraNxN
     1135#if NH_3D_QTLPC //Try IntraNxN
    11161136              if(bTrySplit)
    11171137              {
     
    11291149              rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    11301150            }
    1131 #if H_3D_QTLPC
     1151#if NH_3D_QTLPC
    11321152              }
    11331153#endif
     
    12451265
    12461266    // further split
    1247 #if H_3D_QTLPC
    1248     if( bSubBranch && bTrySplitDQP && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )
     1267#if NH_3D_QTLPC
     1268
     1269    if( bSubBranch && bTrySplitDQP && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() )
    12491270#else
    12501271    if( bSubBranch && uiDepth < sps.getLog2DiffMaxMinCodingBlockSize() )
     
    12671288      DEBUG_STRING_NEW(sTempDebug)
    12681289
     1290#if NH_3D_ARP
     1291      m_ppcWeightedTempCU[uhNextDepth]->setSlice( m_ppcWeightedTempCU[ uiDepth]->getSlice());
     1292      m_ppcWeightedTempCU[uhNextDepth]->setPic  ( m_ppcWeightedTempCU[ uiDepth] );
     1293#endif
    12691294      for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ )
    12701295      {
     
    15721597
    15731598    m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx );
    1574 #if H_3D_ARP
     1599#if NH_3D_ARP
    15751600    m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
    15761601#endif
    1577 #if H_3D_IC
     1602#if NH_3D_IC
    15781603    m_pcEntropyCoder->encodeICFlag  ( pcCU, uiAbsPartIdx );
    15791604#endif
     
    16091634  // prediction Info ( Intra : direction mode, Inter : Mv, reference idx )
    16101635  m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx );
    1611 #if H_3D
     1636#if NH_3D_DBBP
    16121637  m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx );
    16131638#endif
     
    16151640  m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx );
    16161641#endif 
    1617 #if H_3D_ARP
     1642#if NH_3D_ARP
    16181643  m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
    16191644#endif
    1620 #if H_3D_IC
     1645#if NH_3D_IC
    16211646  m_pcEntropyCoder->encodeICFlag  ( pcCU, uiAbsPartIdx );
    16221647#endif
     
    17601785{
    17611786  assert( rpcTempCU->getSlice()->getSliceType() != I_SLICE );
    1762 #if H_3D_IV_MERGE
     1787#if NH_3D_MLC
    17631788  TComMvField  cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    17641789  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    17751800  }
    17761801  UChar uhDepth = rpcTempCU->getDepth( 0 );
    1777 #if H_3D_IC
     1802#if NH_3D_IC
    17781803  Bool bICFlag = rpcTempCU->getICFlag( 0 );
    17791804#endif
     
    17891814#endif
    17901815
    1791 #if H_3D_ARP
     1816#if NH_3D_ARP
    17921817  DisInfo cOrigDisInfo = rpcTempCU->getDvInfo(0);
    17931818#else
     
    17951820
    17961821  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to CTU level
    1797 #if H_3D_VSP
    1798 #if !H_3D_ARP
     1822
     1823#if NH_3D_SPIVMP
     1824  Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
     1825  memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
     1826  TComMvField*  pcMvFieldSP;
     1827  UChar* puhInterDirSP;
     1828  pcMvFieldSP = new TComMvField[rpcTempCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];
     1829  puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartitionsInCtu()];
     1830#endif
     1831
     1832#if NH_3D_VSP
     1833#if !NH_3D_ARP
    17991834  Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    18001835  memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    1801   InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
    1802   rpcTempCU->m_bAvailableFlagA1 = 0;
    1803   rpcTempCU->m_bAvailableFlagB1 = 0;
    1804   rpcTempCU->m_bAvailableFlagB0 = 0;
    1805   rpcTempCU->m_bAvailableFlagA0 = 0;
    1806   rpcTempCU->m_bAvailableFlagB2 = 0;
     1836#if NH_3D_MLC
     1837  rpcTempCU->initAvailableFlags();
     1838#endif
    18071839  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    1808   rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand );
    1809 #endif
    1810 #else
    1811 #if H_3D
    1812   rpcTempCU->m_bAvailableFlagA1 = 0;
    1813   rpcTempCU->m_bAvailableFlagB1 = 0;
    1814   rpcTempCU->m_bAvailableFlagB0 = 0;
    1815   rpcTempCU->m_bAvailableFlagA0 = 0;
    1816   rpcTempCU->m_bAvailableFlagB2 = 0;
    1817   rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    1818   rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    1819 #else
     1840#if NH_3D_MLC
     1841  rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
     1842#if NH_3D_SPIVMP
     1843    , pcMvFieldSP, puhInterDirSP
     1844#endif
     1845    , numValidMergeCand
     1846    );
     1847
     1848  rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag
     1849#if NH_3D_SPIVMP
     1850    , bSPIVMPFlag
     1851#endif
     1852    , numValidMergeCand
     1853    );
     1854#endif
     1855#endif
     1856#else
     1857#if NH_3D_MLC
     1858  rpcTempCU->initAvailableFlags();
     1859#endif
    18201860  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    1821 #endif
    1822 #endif
    1823 #if H_3D_IV_MERGE
     1861#if NH_3D_MLC
     1862  rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
     1863#if H_3D_SPIVMP
     1864    , pcMvFieldSP, puhInterDirSP
     1865#endif
     1866    , numValidMergeCand
     1867    );
     1868#if NH_3D_MLC
     1869  rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours
     1870#if H_3D_SPIVMP
     1871    , bSPIVMPFlag
     1872#endif
     1873    , numValidMergeCand
     1874    );
     1875#endif
     1876#endif
     1877#endif
     1878
     1879#if NH_3D_MLC
    18241880  Int mergeCandBuffer[MRG_MAX_NUM_CANDS_MEM];
    18251881#else
    18261882  Int mergeCandBuffer[MRG_MAX_NUM_CANDS];
    18271883#endif
    1828 #if H_3D_ARP
    1829 for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
     1884#if NH_3D_MLC
     1885  for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
    18301886#else
    18311887  for( UInt ui = 0; ui < numValidMergeCand; ++ui )
    18321888#endif
    1833 
    18341889  {
    18351890    mergeCandBuffer[ui] = 0;
     
    18491904  DEBUG_STRING_NEW(bestStr)
    18501905
    1851 #if H_3D_ARP
     1906#if NH_3D_ARP
    18521907  Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;
     1908#if NH_3D_IC
    18531909  if( nARPWMax < 0 || bICFlag )
     1910#else
     1911  if( nARPWMax < 0 )
     1912#endif
    18541913  {
    18551914    nARPWMax = 0;
     
    18571916  for( Int nARPW=nARPWMax; nARPW >= 0 ; nARPW-- )
    18581917  {
     1918#if NH_3D_IV_MERGE
    18591919    memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS_MEM*sizeof(Int) );
     1920#else
     1921    memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS * sizeof(Int) );
     1922#endif
    18601923    rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    18611924    rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
    1862 #if H_3D_IC
     1925#if NH_3D_IC
    18631926    rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );
    18641927#endif
    18651928    rpcTempCU->getDvInfo(0) = cOrigDisInfo;
    1866     rpcTempCU->setDvInfoSubParts(cOrigDisInfo, 0, 0, uhDepth );
     1929    rpcTempCU->setDvInfoSubParts(cOrigDisInfo, 0, uhDepth );
     1930#if NH_3D_VSP
    18671931    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    18681932    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    1869 #if H_3D_SPIVMP
    1870     Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
    1871     memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    1872     TComMvField*  pcMvFieldSP;
    1873     UChar* puhInterDirSP;
    1874     pcMvFieldSP = new TComMvField[rpcTempCU->getPic()->getPicSym()->getNumPartition()*2];
    1875     puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartition()];
    1876 #endif
    1877 #if H_3D
     1933#endif
     1934#if NH_3D
     1935#if NH_3D_MLC
    18781936    rpcTempCU->initAvailableFlags();
     1937#endif
    18791938    rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    18801939    rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
    1881 #if H_3D_SPIVMP
     1940#if NH_3D_SPIVMP
    18821941      , pcMvFieldSP, puhInterDirSP
    18831942#endif
     
    18851944      );
    18861945
    1887     rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours, vspFlag
    1888 #if H_3D_SPIVMP
     1946    rpcTempCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours
     1947#if NH_3D_VSP
     1948      , vspFlag
     1949#endif
     1950#if NH_3D_SPIVMP
    18891951      , bSPIVMPFlag
    18901952#endif
     
    18931955
    18941956#else
    1895     rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, numValidMergeCand );
     1957    rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    18961958#endif
    18971959
     
    19031965    for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
    19041966    {
    1905 #if H_3D_IC
     1967#if NH_3D_IC
    19061968      if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() )
    19071969      {
     
    19201982          // set MC parameters
    19211983          rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to CTU level
    1922 #if H_3D_IC
     1984#if NH_3D_IC
    19231985          rpcTempCU->setICFlagSubParts( bICFlag, 0, 0, uhDepth );
    1924 #endif
    1925 #if H_3D_ARP
    1926           rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
    19271986#endif
    19281987          rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag, 0, uhDepth );
     
    19311990          rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to CTU level
    19321991          rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to CTU level
    1933 #if H_3D_VSP
     1992#if NH_3D_ARP
     1993          rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
     1994#endif
     1995
     1996#if NH_3D_VSP
    19341997          rpcTempCU->setVSPFlagSubParts( vspFlag[uiMergeCand], 0, 0, uhDepth );
    19351998#endif
    1936 #if H_3D_SPIVMP
     1999#if NH_3D_SPIVMP
    19372000          rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth);
    19382001          if (bSPIVMPFlag[uiMergeCand])
     
    19532016          else
    19542017#endif
    1955 #if H_3D_VSP
    19562018          {
     2019#if NH_3D_VSP
    19572020            if ( vspFlag[uiMergeCand] )
    19582021            {
     
    19842047            {
    19852048#endif
    1986           rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to CTU level
    1987           rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1988           rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1989 #if H_3D_VSP
     2049            rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to CTU level
     2050            rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     2051            rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     2052#if NH_3D_VSP
    19902053            }
     2054#endif
    19912055          }
    1992 #endif
    19932056          // do MC
    19942057          m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     
    20242087          rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
    20252088#endif
    2026 #if H_3D_VSP // possible bug fix
     2089#if NH_3D_VSP
    20272090          if( rpcTempCU->getSkipFlag(0) )
    20282091          {
     
    21572220  }
    21582221  DEBUG_STRING_APPEND(sDebug, bestStr)
    2159 #if H_3D_SPIVMP
     2222#if NH_3D_ARP
     2223 }
     2224#endif
     2225#if NH_3D_SPIVMP
    21602226 delete[] pcMvFieldSP;
    21612227 delete[] puhInterDirSP;
    21622228#endif
    2163 #if H_3D_ARP
    2164  }
    2165 #endif
    2166 
    21672229}
    21682230
     
    21812243
    21822244  // prior to this, rpcTempCU will have just been reset using rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    2183 #if H_3D
     2245#if H_3D || NH_3D_ARP
    21842246  const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0);
    21852247#endif
     
    21892251#endif
    21902252  UChar uhDepth = rpcTempCU->getDepth( 0 );
    2191 #if H_3D_ARP
     2253#if NH_3D_ARP
    21922254    Bool bFirstTime = true;
    21932255    Int nARPWMax    = rpcTempCU->getSlice()->getARPStepNum() - 1;
     2256#if NH_3D_IC
    21942257    if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) )
     2258#else
     2259    if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N )
     2260#endif
    21952261    {
    21962262      nARPWMax = 0;
     
    22202286  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
    22212287  rpcTempCU->setChromaQpAdjSubParts( rpcTempCU->getCUTransquantBypass(0) ? 0 : m_cuChromaQpOffsetIdxPlus1, 0, uhDepth );
    2222 #if H_3D_ARP
     2288#if NH_3D_ARP
    22232289      rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
    22242290#endif
    2225 #if H_3D_ARP
     2291#if NH_3D_ARP
    22262292      if( bFirstTime == false && nARPWMax )
    22272293      {
     
    22462312  m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
    22472313#endif
    2248 #if H_3D_ARP
     2314#if NH_3D_ARP
    22492315        if( nARPWMax )
    22502316        {
     
    22572323  if ( !rpcTempCU->getMergeAMP() )
    22582324  {
    2259 #if H_3D_ARP
     2325#if NH_3D_ARP
    22602326        if( nARPWMax )
    22612327        {
     
    22782344
    22792345  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false DEBUG_STRING_PASS_INTO(sTest) );
    2280 #if H_3D_VSP // possible bug fix
    2281       if( rpcTempCU->getQtRootCbf(0)==0 )
    2282       {
    2283         rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
    2284       }
     2346#if NH_3D_VSP
     2347  if( rpcTempCU->getQtRootCbf(0)==0 )
     2348  {
     2349    rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
     2350  }
    22852351#endif
    22862352#if NH_3D_VSO // M4
     
    23742440      }
    23752441#endif
    2376 #if H_3D_ARP
     2442#if NH_3D_ARP
    23772443    }
    23782444#endif
     
    23822448}
    23832449
    2384 #if H_3D_DBBP
     2450#if NH_3D_DBBP
    23852451Void TEncCu::xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment )
    23862452{
    2387   UInt  uiWidth     = pOrigYuv->getWidth ( );
    2388   UInt  uiHeight    = pOrigYuv->getHeight( );
    2389   Pel*  piSrc       = pOrigYuv->getLumaAddr( );
    2390   UInt  uiSrcStride = pOrigYuv->getStride();
    2391   Pel*  piDst       = pOrigYuvTemp->getLumaAddr( );
    2392   UInt  uiDstStride = pOrigYuvTemp->getStride();
     2453  UInt  uiWidth     = pOrigYuv->getWidth (COMPONENT_Y);
     2454  UInt  uiHeight    = pOrigYuv->getHeight(COMPONENT_Y);
     2455  Pel*  piSrc       = pOrigYuv->getAddr(COMPONENT_Y);
     2456  UInt  uiSrcStride = pOrigYuv->getStride(COMPONENT_Y);
     2457  Pel*  piDst       = pOrigYuvTemp->getAddr(COMPONENT_Y);
     2458  UInt  uiDstStride = pOrigYuvTemp->getStride(COMPONENT_Y);
    23932459 
    23942460  UInt  uiMaskStride= MAX_CU_SIZE;
     
    24152481 
    24162482  // now invalidate chroma
    2417   Pel*  piSrcU       = pOrigYuv->getCbAddr();
    2418   Pel*  piSrcV       = pOrigYuv->getCrAddr();
    2419   UInt  uiSrcStrideC = pOrigYuv->getCStride();
    2420   Pel*  piDstU       = pOrigYuvTemp->getCbAddr( );
    2421   Pel*  piDstV       = pOrigYuvTemp->getCrAddr( );
    2422   UInt  uiDstStrideC = pOrigYuvTemp->getCStride();
     2483  Pel*  piSrcU       = pOrigYuv->getAddr(COMPONENT_Cb);
     2484  Pel*  piSrcV       = pOrigYuv->getAddr(COMPONENT_Cr);
     2485  UInt  uiSrcStrideC = pOrigYuv->getStride(COMPONENT_Cb);
     2486  Pel*  piDstU       = pOrigYuvTemp->getAddr(COMPONENT_Cb);
     2487  Pel*  piDstV       = pOrigYuvTemp->getAddr(COMPONENT_Cr);
     2488  UInt  uiDstStrideC = pOrigYuvTemp->getStride(COMPONENT_Cb);
    24232489  pMask = pMaskStart;
    24242490 
     
    24412507  }
    24422508}
    2443 
     2509#endif
     2510
     2511#if NH_3D_DBBP
    24442512Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )
    24452513{
     
    24632531  AOF( uiWidth == uiHeight );
    24642532 
    2465 #if H_3D_DBBP
    2466   // Is this correct here, was under the macro SEC_DBBP_DISALLOW_8x8_I0078, however the function is related to Single Depth Mode
     2533#if NH_3D_DBBP
    24672534  if(uiWidth <= 8)
    24682535  {
     
    25152582    rpcTempCU->getDBBPTmpData()->eVirtualPartSize = eVirtualPartSize;
    25162583    rpcTempCU->getDBBPTmpData()->uiVirtualPartIndex = uiSegment;
    2517     m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], false, false, bUseMRG );
     2584    m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], false, bUseMRG );
    25182585    m_pcRdCost->setUseMask(false);
    25192586   
     
    25242591    pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0);
    25252592   
     2593#if NH_3D_VSP
    25262594    AOF( rpcTempCU->getSPIVMPFlag(0) == false );
    25272595    AOF( rpcTempCU->getVSPFlag(0) == 0 );
     2596#endif
    25282597   
    25292598    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     
    25442613  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
    25452614 
    2546   UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxCUDepth() - uhDepth ) << 1 ) ) >> 4;
     2615  UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uhDepth ) << 1 ) ) >> 4;
    25472616  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
    25482617  {
     
    25702639 
    25712640  // reconstruct final prediction signal by combining both segments
    2572   m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize);
     2641  Int bitDepthY = rpcTempCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
     2642  m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize, bitDepthY);
    25732643  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
    25742644 
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCu.h

    r1258 r1279  
    6969  TComDataCU**            m_ppcBestCU;      ///< Best CUs in each depth
    7070  TComDataCU**            m_ppcTempCU;      ///< Temporary CUs in each depth
    71 #if H_3D_ARP
     71#if NH_3D_ARP
    7272  TComDataCU**            m_ppcWeightedTempCU;
    7373#endif
     
    8282  TComYuv**               m_ppcOrigYuv;     ///< Original Yuv for each depth
    8383
    84 #if H_3D_DBBP
     84#if NH_3D_DBBP
    8585  TComYuv**               m_ppcOrigYuvDBBP;
    8686#endif
     
    155155  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
    156156#endif
    157 #if H_3D_DBBP
     157#if NH_3D_DBBP
    158158  Void  xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment );
    159159  Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncEntropy.cpp

    r1258 r1279  
    148148}
    149149
    150 #if H_3D_IC
     150#if NH_3D_IC
    151151Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    152152{
     153#if NH_3D_ARP
    153154  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 )
     155#else
     156  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
     157#endif
    154158  {
    155159    return;
     
    184188#endif
    185189
    186 #if H_3D_ARP
     190#if NH_3D_ARP
    187191Void TEncEntropy::encodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx )
    188192{
     
    870874
    871875#endif
    872 #if H_3D_DBBP
     876#if NH_3D_DBBP
    873877Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    874878{
     879  if( bRD )
     880  {
     881    uiAbsPartIdx = 0;
     882  }
     883 
    875884  if( pcCU->getSlice()->getDepthBasedBlkPartFlag() &&
    876885    ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN ||
     
    879888      pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
    880889  {
    881     if( bRD )
    882     {
    883       uiAbsPartIdx = 0;
    884     }
    885890    m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );
    886891  }
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncEntropy.h

    r1258 r1279  
    8787  virtual Void codeDeltaDC       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    8888#endif
    89 #if H_3D_ARP
     89#if NH_3D_ARP 
    9090  virtual Void codeARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9191#endif
    92 #if H_3D_IC
     92#if NH_3D_IC
    9393  virtual Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9494#endif
     
    9696  virtual Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9797#endif
    98 #if H_3D_DBBP
     98#if NH_3D_DBBP
    9999  virtual Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    100100#endif
     
    175175  Void encodeMergeFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    176176  Void encodeMergeIndex   ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    177 #if H_3D_ARP
     177#if NH_3D_ARP
    178178  Void encodeARPW         ( TComDataCU* pcCU, UInt uiAbspartIdx );
    179179#endif
    180 #if H_3D_IC
     180#if NH_3D_IC
    181181  Void encodeICFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    182182#endif
     
    187187  Void encodeSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    188188#endif
    189 #if H_3D_DBBP
     189#if NH_3D_DBBP
    190190  Void encodeDBBPFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    191191#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncGOP.cpp

    r1200 r1279  
    155155#endif
    156156#endif
    157 #if H_3D_IC
     157#if NH_3D_IC
    158158  m_aICEnableCandidate   = pcTEncTop->getICEnableCandidate();
    159159  m_aICEnableNum         = pcTEncTop->getICEnableNum();
     
    14431443    }   
    14441444
    1445 #if H_3D_IV_MERGE
     1445#if NH_3D_IV_MERGE
    14461446    // This needs to be done after initialization of 3D tool parameters.
    14471447    pcSlice->setMaxNumMergeCand      ( m_pcCfg->getMaxNumMergeCand()   + ( ( pcSlice->getMpiFlag( ) || pcSlice->getIvMvPredFlag( ) || pcSlice->getViewSynthesisPredFlag( )   ) ? 1 : 0 ));
     
    14711471    pcSlice->setRefPicList ( rcListPic );
    14721472#endif
    1473 #if H_3D
     1473#if NH_3D_NBDV
    14741474    pcSlice->setDefaultRefView();
    14751475#endif
    1476 #if H_3D_ARP
     1476#if NH_3D_ARP
    14771477    //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh
    14781478    pcSlice->setARPStepNum(m_ivPicLists);
    1479     if(pcSlice->getARPStepNum() > 1)
    1480     {
    1481       for(Int iLayerId = 0; iLayerId < getLayerId(); iLayerId ++ )
    1482       {
    1483         Int  iViewIdx =   pcSlice->getVPS()->getViewIndex(iLayerId);
    1484         Bool bIsDepth = ( pcSlice->getVPS()->getDepthId  ( iLayerId ) == 1 );
    1485         if( iViewIdx<getViewIndex() && !bIsDepth )
    1486         {
    1487           pcSlice->setBaseViewRefPicList( m_ivPicLists->getPicList( iLayerId ), iViewIdx );
    1488         }
    1489       }
    1490     }
    1491 #endif
    1492 #if H_3D_IC
     1479#endif
     1480#if NH_3D_IC
    14931481    pcSlice->setICEnableCandidate( m_aICEnableCandidate );         
    14941482    pcSlice->setICEnableNum( m_aICEnableNum );         
     
    15471535
    15481536    pcSlice->setList1IdxToList0Idx();
    1549 #if H_3D_TMVP
     1537#if NH_3D_TMVP
    15501538    if(pcSlice->getLayerId())
    15511539      pcSlice->generateAlterRefforTMVP();
     
    17311719    UInt uiNumSliceSegments = 1;
    17321720
    1733 #if H_3D_NBDV
     1721#if NH_3D_NBDV
    17341722      if(pcSlice->getViewIndex() && !pcSlice->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
    17351723      {
    1736         Int iColPoc = pcSlice->getRefPOC(RefPicList(1-pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
     1724        Int iColPoc = pcSlice->getRefPOC(RefPicList(1 - pcSlice->getColFromL0Flag()), pcSlice->getColRefIdx());
    17371725        pcPic->setNumDdvCandPics(pcPic->getDisCandRefPictures(iColPoc));
    17381726      }
     
    17431731#endif
    17441732
    1745 #if H_3D_NBDV
     1733#if NH_3D_NBDV
    17461734      if(pcSlice->getViewIndex() && !pcSlice->getIsDepth() && !pcSlice->isIntra()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
    17471735      {
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncGOP.h

    r1200 r1279  
    132132#endif
    133133#endif
    134 #if H_3D_IC
     134#if NH_3D_IC
    135135  Int*                    m_aICEnableCandidate;
    136136  Int*                    m_aICEnableNum;
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncSbac.cpp

    r1258 r1279  
    6868, m_cCUMergeFlagExtSCModel             ( 1,             1,                      NUM_MERGE_FLAG_EXT_CTX               , m_contextModels + m_numContextModels, m_numContextModels)
    6969, m_cCUMergeIdxExtSCModel              ( 1,             1,                      NUM_MERGE_IDX_EXT_CTX                , m_contextModels + m_numContextModels, m_numContextModels)
    70 #if H_3D_ARP
     70#if NH_3D_ARP
    7171, m_cCUPUARPWSCModel                   ( 1,             1,                      NUM_ARPW_CTX                         , m_contextModels + m_numContextModels, m_numContextModels)
    7272#endif                                                                                                               
    73 #if H_3D_IC                                                                                                         
     73#if NH_3D_IC                                                                                                         
    7474, m_cCUICFlagSCModel                   ( 1,             1,                      NUM_IC_FLAG_CTX                      , m_contextModels + m_numContextModels, m_numContextModels)
    7575#endif
     
    115115, m_cDdcFlagSCModel                    ( 1,             1,                      NUM_DDC_FLAG_CTX                     , m_contextModels + m_numContextModels, m_numContextModels)
    116116#endif                                                                                                         
    117 #if H_3D_DBBP                                                                                                 
     117#if NH_3D_DBBP
    118118, m_cDBBPFlagSCModel                   ( 1,             1,                       DBBP_NUM_FLAG_CTX                   , m_contextModels + m_numContextModels, m_numContextModels)
    119119#endif
     
    149149  m_cCUMergeFlagExtSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT);
    150150  m_cCUMergeIdxExtSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT);
    151 #if H_3D_ARP
     151#if NH_3D_ARP
    152152  m_cCUPUARPWSCModel.initBuffer                   ( eSliceType, iQp, (UChar*)INIT_ARPW );
    153153#endif
    154 #if H_3D_IC
     154#if NH_3D_IC
    155155  m_cCUICFlagSCModel.initBuffer                   ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );
    156156#endif
     
    196196  m_cDdcFlagSCModel.initBuffer                    ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    197197#endif                                           
    198 #if H_3D_DBBP                                   
     198#if NH_3D_DBBP
    199199  m_cDBBPFlagSCModel.initBuffer                   ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
    200200#endif
     
    237237      curCost += m_cCUMergeFlagExtSCModel.calcCost             ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT);
    238238      curCost += m_cCUMergeIdxExtSCModel.calcCost              ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT);
    239 #if H_3D_ARP
     239#if NH_3D_ARP
    240240      curCost += m_cCUPUARPWSCModel.calcCost                   ( curSliceType, qp, (UChar*)INIT_ARPW );
    241241#endif                                                     
    242 #if H_3D_IC                                               
     242#if NH_3D_IC                                               
    243243      curCost += m_cCUICFlagSCModel.calcCost                   ( curSliceType, qp, (UChar*)INIT_IC_FLAG );
    244244#endif                                                     
     
    246246      curCost += m_cSDCFlagSCModel.calcCost                    ( curSliceType, qp, (UChar*)INIT_SDC_FLAG );
    247247#endif                                                     
    248 #if H_3D_DBBP                                             
     248#if NH_3D_DBBP
    249249      curCost += m_cDBBPFlagSCModel.calcCost                   ( curSliceType, qp, (UChar*)INIT_DBBP_FLAG );
    250250#endif
     
    297297  }
    298298}
    299 #if H_3D_ARP
    300   m_cCUPUARPWSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_ARPW );
    301 #endif
    302 #if H_3D_IC
    303   m_cCUICFlagSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_IC_FLAG );
    304 #endif
    305 #if H_3D_DBBP
    306   m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
    307 #endif
    308299
    309300
     
    576567{
    577568  PartSize eSize         = pcCU->getPartitionSize( uiAbsPartIdx );
    578 #if H_3D_QTLPC
     569#if NH_3D_QTLPC
    579570  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();
    580571  TComPic *pcTexture     = pcCU->getSlice()->getTexturePic();
     
    593584#endif
    594585  {
    595     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
    596     UInt uiCUIdx            = (pcCU->getZorderIdxInCU() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCU();
     586    TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());
     587    UInt uiCUIdx            = (pcCU->getZorderIdxInCtu() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCtu();
    597588    assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);
    598589    if(pcTextureCU->getDepth(uiCUIdx) == uiDepth )
     
    625616  DTRACE_CU("part_mode", eSize )
    626617#endif       
    627 #if H_3D_QTLPC
     618#if NH_3D_QTLPC
    628619    if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N)
    629620    {
     
    699690    }
    700691  }
    701 #if H_3D_QTLPC
     692#if NH_3D_QTLPC
    702693    }
    703694    else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)
     
    716707        {
    717708          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
    718           if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     709          if (  pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )
    719710          {     
    720711            m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     
    751742        {
    752743          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
    753           if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     744          if ( pcCU->getSlice()->getSPS()->getUseAMP() && uiDepth < log2DiffMaxMinCodingBlockSize )
    754745          {     
    755746            m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     
    894885}
    895886
    896 #if H_3D_ARP
     887#if NH_3D_ARP
    897888Void TEncSbac::codeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx )
    898889{
     
    914905#endif
    915906
    916 #if H_3D_IC
     907#if NH_3D_IC
    917908/** code Illumination Compensation flag
    918909 * \param pcCU
     
    949940
    950941  assert( uiCtx < 3 );
    951 #if H_3D_QTLPC
     942#if NH_3D_QTLPC
    952943  Bool bCodeSplitFlag    = true;
    953944
     
    966957#endif
    967958  {
    968     TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
    969     UInt uiCUIdx            = (pcCU->getZorderIdxInCU() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCU();
     959    TComDataCU *pcTextureCU = pcTexture->getCtu(pcCU->getCtuRsAddr());
     960    UInt uiCUIdx            = (pcCU->getZorderIdxInCtu() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCtu();
    970961    assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);
    971962    bCodeSplitFlag          = (pcTextureCU->getDepth(uiCUIdx) > uiDepth);
     
    26352626#endif
    26362627
    2637 #if H_3D_DBBP
     2628#if NH_3D_DBBP
    26382629Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
    26392630{
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncSbac.h

    r1258 r1279  
    143143  Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    144144  Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    145 #if H_3D_ARP
     145#if NH_3D_ARP
    146146  Void codeARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    147147#endif
    148 #if H_3D_IC
     148#if NH_3D_IC
    149149  Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    150150#endif
     
    155155  Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    156156#endif
    157 #if H_3D_DBBP
     157#if NH_3D_DBBP
    158158  Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    159159#endif
     
    210210  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
    211211  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
    212 #if H_3D_ARP
     212#if NH_3D_ARP
    213213  ContextModel3DBuffer m_cCUPUARPWSCModel;
    214214#endif
    215 #if H_3D_IC
     215#if NH_3D_IC
    216216  ContextModel3DBuffer m_cCUICFlagSCModel;
    217217#endif
     
    261261  ContextModel3DBuffer m_cDdcFlagSCModel;
    262262#endif
    263 #if H_3D_DBBP
     263#if NH_3D_DBBP
    264264  ContextModel3DBuffer m_cDBBPFlagSCModel;
    265265#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncSearch.cpp

    r1258 r1279  
    340340
    341341  piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX;
    342 #if H_3D_IC
     342#if NH_3D_IC
    343343  m_cDistParam.bUseIC = pcPatternKey->getICFlag();
    344344#endif
     
    851851
    852852    setDistParamComp(COMPONENT_Y);
    853 #if H_3D_IC
     853#if NH_3D_IC
    854854    m_cDistParam.bUseIC = pcPatternKey->getICFlag();
    855855#endif
     
    29012901      const Bool bUseHadamard=pcCU->getCUTransquantBypass(0) == 0;
    29022902      m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard);
     2903
     2904#if NH_3D_IC_FIX
     2905      distParam.bUseIC = false;
     2906#endif
     2907#if H_3D_INTER_SDC_FIX
     2908      distParam.bUseSDCMRSAD = false;
     2909#endif
    29032910      distParam.bApplyWeight = false;
    29042911      for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )
     
    38353842                            iWidth, iHeight, m_pcEncCfg->getUseHADME() && (pcCU->getCUTransquantBypass(iPartIdx) == 0) );
    38363843
    3837 #if H_3D_IC
     3844#if NH_3D_IC
    38383845  cDistParam.bUseIC = false;
    38393846#endif
     
    38473854//! estimation of best merge coding
    38483855Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, Distortion& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand
    3849 #if H_3D_VSP
     3856#if NH_3D_VSP
    38503857                                 , Int* vspFlag
    38513858#endif
    3852 #if H_3D_SPIVMP
     3859#if NH_3D_SPIVMP
    38533860                                 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
    38543861#endif
     
    38623869  UInt uiDepth = pcCU->getDepth( uiAbsPartIdx );
    38633870
    3864 #if H_3D_DBBP
     3871#if NH_3D_DBBP
    38653872  DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
    38663873  if( pcCU->getDBBPFlag(0) )
     
    38693876    AOF( iPUIdx == 0 );
    38703877    AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );
    3871     AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );
     3878    AOF( pDBBPTmpData->eVirtualPartSize != NUMBER_OF_PART_SIZES );
    38723879   
    38733880    // temporary change of partition size for candidate derivation
     
    38943901
    38953902  PartSize partSize = pcCU->getPartitionSize( 0 );
    3896 #if H_3D_DBBP
     3903#if NH_3D_DBBP
    38973904  if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(0) == false )
    38983905#else
     
    39033910    {
    39043911      pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set
    3905 #if H_3D
     3912#if NH_3D_MLC
    39063913      pcCU->initAvailableFlags();
    3907       pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
     3914      pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    39083915      pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
    3909 #if H_3D_SPIVMP
     3916#if NH_3D_SPIVMP
    39103917        , pcMvFieldSP, puhInterDirSP
    39113918#endif
     
    39143921
    39153922      pcCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours
    3916 #if H_3D_VSP
     3923#if NH_3D_VSP
    39173924        , vspFlag
    39183925#endif
    3919 #if H_3D_SPIVMP
     3926#if NH_3D_SPIVMP
    39203927        , pbSPIVMPFlag
    39213928#endif
    3922                                         , numValidMergeCand
     3929        , numValidMergeCand
    39233930        );
    39243931#else
     
    39303937  else
    39313938  {
    3932 #if H_3D
     3939#if NH_3D_MLC
    39333940    pcCU->initAvailableFlags();
    3934     pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
     3941    pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    39353942    pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours
    3936 #if H_3D_SPIVMP
     3943#if NH_3D_SPIVMP
    39373944      , pcMvFieldSP, puhInterDirSP
    39383945#endif
     
    39413948
    39423949    pcCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours
    3943 #if H_3D_VSP
     3950#if NH_3D_VSP
    39443951      , vspFlag
    39453952#endif
    3946 #if H_3D_SPIVMP
     3953#if NH_3D_SPIVMP
    39473954      , pbSPIVMPFlag
    39483955#endif
    3949                                       , numValidMergeCand
     3956      , numValidMergeCand
    39503957      );
    39513958#else
     
    39563963  xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    39573964
    3958 #if H_3D_DBBP
     3965#if NH_3D_DBBP
    39593966  if( pcCU->getDBBPFlag(0) )
    39603967  {
     
    39793986
    39803987    PartSize ePartSize = pcCU->getPartitionSize( 0 );
    3981 #if H_3D_VSP
     3988#if NH_3D_VSP
    39823989    pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
    39833990#endif
    39843991
    3985 #if H_3D_SPIVMP
     3992#if NH_3D_SPIVMP
    39863993    pcCU->setSPIVMPFlagSubParts( pbSPIVMPFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ));
    39873994    if (pbSPIVMPFlag[uiMergeCand])
     
    40024009    else
    40034010#endif
    4004 #if H_3D_VSP
    4005 #if H_3D_DBBP
     4011#if NH_3D_VSP
     4012#if NH_3D_DBBP
    40064013      if ( vspFlag[uiMergeCand] && !pcCU->getDBBPFlag(0) )
    40074014#else
     
    40394046    pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
    40404047    pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
    4041 #if H_3D_VSP
     4048#if NH_3D_VSP
    40424049      }
    40434050#endif
     
    41504157  Distortion   biPDistTemp = std::numeric_limits<Distortion>::max();
    41514158
    4152 #if H_3D_IV_MERGE
     4159#if NH_3D_IV_MERGE
    41534160  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    41544161  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
     
    41854192
    41864193    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
    4187 #if H_3D_VSP
     4194#if NH_3D_VSP
    41884195    pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) );
    41894196#endif
     
    45284535    } // end if bTestNormalMC
    45294536#endif
    4530 #if H_3D_DBBP
     4537#if NH_3D_DBBP
    45314538    // test merge mode for DBBP (2Nx2N)
    45324539    if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N || pcCU->getDBBPFlag(0) )
     
    45684575      Distortion uiMRGCost = std::numeric_limits<Distortion>::max();
    45694576
    4570 #if H_3D_VSP
     4577#if NH_3D_VSP
    45714578      Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    45724579      memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     
    45774584      DisInfo OriginalDvInfo = pcCU->getDvInfo(uiAbsPartIdx);
    45784585#endif
    4579 #if H_3D_SPIVMP
     4586#if NH_3D_SPIVMP
    45804587      Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
    45814588      memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    45824589      TComMvField*  pcMvFieldSP;
    45834590      UChar* puhInterDirSP;
    4584       pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];
    4585       puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
    4586 #endif
    4587       xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours
    4588 
    4589 #if H_3D_VSP
     4591      pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2];
     4592      puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()];
     4593#endif
     4594      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand
     4595#if NH_3D_VSP
    45904596                      , vspFlag
    45914597#endif
    4592 #if H_3D_SPIVMP
     4598#if NH_3D_SPIVMP
    45934599                      , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
    45944600#endif
    4595 , numValidMergeCand);
     4601                      );
    45964602
    45974603      if ( uiMRGCost < uiMECost )
     
    46004606        pcCU->setMergeFlagSubParts ( true,          uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    46014607        pcCU->setMergeIndexSubParts( uiMRGIndex,    uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    4602 #if H_3D_VSP
     4608#if NH_3D_VSP
    46034609        pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    46044610#endif
    4605 #if H_3D_SPIVMP
     4611#if NH_3D_SPIVMP
    46064612        pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 
    46074613        if (bSPIVMPFlag[uiMRGIndex]!=0)
     
    46264632        else
    46274633#endif
    4628 #if H_3D_VSP
    4629 #if H_3D_DBBP
     4634#if NH_3D_VSP
     4635#if NH_3D_DBBP
    46304636        if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) )
    46314637#else
     
    46634669        pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );
    46644670        pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );
     4671#if NH_3D_VSP
     4672          }
     4673#endif
    46654674#if H_3D
    46664675          }
     
    46764685      else
    46774686      {
    4678 #if H_3D_SPIVMP       
     4687#if NH_3D_SPIVMP       
    46794688        pcCU->setSPIVMPFlagSubParts(0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    46804689#endif
     
    46824691        pcCU->setMergeFlagSubParts( false,        uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    46834692        pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    4684 #if H_3D_VSP
     4693#if NH_3D_VSP
    46854694        pcCU->setVSPFlagSubParts ( 0,             uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    46864695        pcCU->setDvInfoSubParts(OriginalDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     
    46894698        pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );
    46904699      }
    4691 #if H_3D_SPIVMP
     4700#if NH_3D_SPIVMP
    46924701      delete[] pcMvFieldSP;
    46934702      delete[] puhInterDirSP;
     
    47254734  {
    47264735
    4727 #if H_3D_DBBP
     4736#if NH_3D_DBBP
    47284737    DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
    47294738    if( pcCU->getDBBPFlag(0) )
     
    47324741      AOF( uiPartIdx == 0 );
    47334742      AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );
    4734       AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );
     4743      AOF( pDBBPTmpData->eVirtualPartSize != NUMBER_OF_PART_SIZES );
    47354744      AOF( iRoiWidth == iRoiHeight );
    47364745     
     
    47574766
    47584767    pcCU->fillMvpCand( uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pcAMVPInfo );
    4759 #if H_3D_DBBP
     4768#if NH_3D_DBBP
    47604769    if( pcCU->getDBBPFlag(0) )
    47614770    {
     
    49784987  pcCU->clipMv( cMvCand );
    49794988
    4980 #if H_3D_IC
     4989#if NH_3D_IC
    49814990  Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() );
    49824991#endif
     
    49854994  if ( pcCU->getSlice()->testWeightPred() && pcCU->getSlice()->getSliceType()==P_SLICE )
    49864995  {
    4987     xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
     4996    xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA)
     4997#if NH_3D_ARP
     4998      , false //add this for IC, otherwise, it could be removed
     4999#endif
     5000      );
    49885001  }
    49895002  else
    49905003  {
    49915004    xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA)
    4992 #if H_3D_ARP
     5005#if NH_3D_ARP
    49935006      , false
    49945007#endif
    4995 #if H_3D_IC
     5008#if NH_3D_IC
    49965009    , bICFlag
    49975010#endif
     
    50385051  pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
    50395052
    5040 #if H_3D_IC
     5053#if NH_3D_IC
    50415054  Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getViewIndex() );
    50425055  pcPatternKey->setICFlag( bICFlag );
     
    50855098
    50865099  m_pcRdCost->setPredictor  ( *pcMvPred );
    5087 #if H_3D_IC
     5100#if NH_3D_INTEGER_MV_DEPTH
    50885101  if( pcCU->getSlice()->getIsDepth() )
    50895102  {
     
    50945107#endif
    50955108    m_pcRdCost->setCostScale  ( 2 );   
    5096 #if H_3D_IC
     5109#if NH_3D_INTEGER_MV_DEPTH
    50975110  }
    50985111#endif
     
    51215134
    51225135  m_pcRdCost->getMotionCost( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) );
    5123 #if H_3D_IC
     5136#if NH_3D_INTEGER_MV_DEPTH
    51245137  if( ! pcCU->getSlice()->getIsDepth() )
    51255138  {
     
    51345147  rcMv += (cMvHalf <<= 1);
    51355148  rcMv +=  cMvQter;
    5136 #if H_3D_IC
     5149#if NH_3D_INTEGER_MV_DEPTH
    51375150  }
    51385151#endif
    51395152
    51405153  UInt uiMvBits = m_pcRdCost->getBits( rcMv.getHor(), rcMv.getVer() );
    5141 #if H_3D_IC
     5154#if NH_3D_INTEGER_MV_DEPTH
    51425155  if( pcCU->getSlice()->getIsDepth() )
    51435156  {
     
    51535166{
    51545167  Int  iMvShift = 2;
    5155 #if H_3D_IC
     5168#if NH_3D_INTEGER_MV_DEPTH
    51565169  if( pcCU->getSlice()->getIsDepth() )
    51575170  {
     
    52285241      m_cDistParam.bitDepth = pcPatternKey->getBitDepthY();
    52295242
    5230 #if H_3D_IC
     5243#if NH_3D_IC
    52315244      m_cDistParam.bUseIC = pcPatternKey->getICFlag();
    52325245#endif
     
    53115324  UInt uiSearchRange = m_iSearchRange;
    53125325  pcCU->clipMv( rcMv );
    5313 #if H_3D_IC
     5326#if NH_3D_INTEGER_MV_DEPTH
    53145327  if( ! pcCU->getSlice()->getIsDepth() )
    53155328#endif
     
    53315344      TComMv cMv = m_acMvPredictors[index];
    53325345      pcCU->clipMv( cMv );
    5333 #if H_3D_IC
     5346#if NH_3D_INTEGER_MV_DEPTH
    53345347      if( ! pcCU->getSlice()->getIsDepth() )
    53355348      {     
    53365349#endif
    53375350        cMv >>= 2;
    5338 #if H_3D_IC
     5351#if NH_3D_INTEGER_MV_DEPTH
    53395352      }
    53405353#endif
     
    57595772    m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
    57605773    m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, true );
    5761 #if H_3D_ARP
     5774#if NH_3D_ARP
    57625775    m_pcEntropyCoder->encodeARPW( pcCU, 0 );
    57635776#endif
    5764 #if H_3D_IC
     5777#if NH_3D_IC
    57655778    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
    57665779#endif
     
    58555868  const Double zeroCost     = (pcCU->isLosslessCoded( 0 )) ? (nonZeroCost+1) : (m_pcRdCost->calcRdCost( zeroResiBits, zeroDistortion ));
    58565869#endif
    5857 #if H_3D_SPIVMP
    5858     if ( dZeroCost < dCost || pcCU->getQtRootCbf(0)==0)
     5870#if NH_3D_SPIVMP
     5871    if ( zeroCost < nonZeroCost || pcCU->getQtRootCbf(0)==0)
    58595872#else
    58605873  if ( zeroCost < nonZeroCost || !pcCU->getQtRootCbf(0) )
     
    70787091    m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
    70797092    m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, true);
    7080 #if H_3D_ARP
     7093#if NH_3D_ARP
    70817094    m_pcEntropyCoder->encodeARPW( pcCU, 0 );
    70827095#endif
    7083 #if H_3D_IC
     7096#if NH_3D_IC
    70847097    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
    70857098#endif
     
    71057118    m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
    71067119#endif
    7107 #if H_3D_ARP
     7120#if NH_3D_ARP
    71087121    m_pcEntropyCoder->encodeARPW( pcCU , 0  );
    71097122#endif
    7110 #if H_3D_IC
     7123#if NH_3D_IC
    71117124    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
    71127125#endif
    7113 #if H_3D
     7126#if NH_3D_DBBP
    71147127    m_pcEntropyCoder->encodeDBBPFlag( pcCU, 0, true );
    71157128#endif
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncSearch.h

    r1258 r1279  
    411411                                    TComMvField* cMvFieldNeighbours,
    412412                                    UChar*       uhInterDirNeighbours,
    413 #if H_3D_VSP
     413                                    Int&         numValidMergeCand
     414#if NH_3D_VSP
    414415                                  , Int* vspFlag
    415416#endif
    416 #if H_3D_SPIVMP
     417#if NH_3D_SPIVMP
    417418                                  , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
    418419#endif
    419                                     Int&         numValidMergeCand
    420420                                   );
    421421
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncSlice.cpp

    r1200 r1279  
    226226  rpcSlice->setPicOutputFlag( true );
    227227  rpcSlice->setPOC( pocCurr );
    228 #if H_3D_IC
     228#if NH_3D_IC
    229229  rpcSlice->setApplyIC( false );
    230230#endif
     
    567567  rpcSlice->setSliceSegmentMode     ( m_pcCfg->getSliceSegmentMode()     );
    568568  rpcSlice->setSliceSegmentArgument ( m_pcCfg->getSliceSegmentArgument() );
    569 #if H_3D_IV_MERGE
     569#if NH_3D_IV_MERGE
    570570#else
    571571  rpcSlice->setMaxNumMergeCand        ( m_pcCfg->getMaxNumMergeCand()        );
     
    823823#endif
    824824
    825 #if H_3D_IC
    826   if ( pcEncTop->getViewIndex() && pcEncTop->getUseIC() &&
     825#if NH_3D_IC
     826  if ( m_pcCfg->getViewIndex() && m_pcCfg->getUseIC() &&
    827827       !( ( pcSlice->getSliceType() == P_SLICE && pcSlice->getPPS()->getUseWP() ) || ( pcSlice->getSliceType() == B_SLICE && pcSlice->getPPS()->getWPBiPred() ) )
    828828     )
    829829  {
    830     pcSlice ->xSetApplyIC(pcEncTop->getUseICLowLatencyEnc());
     830    pcSlice ->xSetApplyIC(m_pcCfg->getUseICLowLatencyEnc());
    831831    if ( pcSlice->getApplyIC() )
    832832    {
     
    11211121  g_bJustDoIt = g_bEncDecTraceEnable;
    11221122#endif
     1123#if H_MV_ENC_DEC_TRAC
     1124#if ENC_DEC_TRACE
     1125  incSymbolCounter();
     1126#endif
     1127  DTRACE_CABAC_VL( g_nSymbolCounter );
     1128#else
    11231129  DTRACE_CABAC_VL( g_nSymbolCounter++ );
     1130#endif
    11241131  DTRACE_CABAC_T( "\tPOC: " );
    11251132  DTRACE_CABAC_V( pcPic->getPOC() );
     
    11941201    }
    11951202
    1196 #if H_3D_QTLPC
    1197     rpcPic->setReduceBitsFlag(true);
     1203#if NH_3D_QTLPC
     1204    pcPic->setReduceBitsFlag(true);
    11981205#endif
    11991206    if ( pcSlice->getSPS()->getUseSAO() )
     
    12661273      }
    12671274    }
    1268 #if H_3D_QTLPC
    1269     rpcPic->setReduceBitsFlag(false);
     1275#if NH_3D_QTLPC
     1276    pcPic->setReduceBitsFlag(false);
    12701277#endif
    12711278  } // CTU-loop
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncTop.cpp

    r1251 r1279  
    7979  m_ivPicLists = NULL;
    8080#endif
    81 #if H_3D_IC
     81#if NH_3D_IC
    8282  m_aICEnableCandidate = NULL;
    8383  m_aICEnableNum = NULL;
     
    227227
    228228  xInitPPSforTiles();
    229 #if H_3D_IC
     229#if NH_3D_IC
    230230  m_aICEnableCandidate = new Int[ 10 ];
    231231  m_aICEnableNum = new Int[ 10 ];
  • branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncTop.h

    r1200 r1279  
    8181  TComPicLists*           m_ivPicLists;                   ///< access to picture lists of other layers
    8282#endif
    83 #if H_3D_IC
     83#if NH_3D_IC
    8484  Int *m_aICEnableCandidate;
    8585  Int *m_aICEnableNum;
     
    158158  TComPicLists* getIvPicLists() { return m_ivPicLists; }
    159159#endif
    160 #if H_3D_IC
     160#if NH_3D_IC
    161161  Int*      getICEnableCandidate() { return m_aICEnableCandidate; }
    162162  Int*      getICEnableNum() { return m_aICEnableNum; }
     
    208208  Void                    setSps3dExtension     ( TComSps3dExtension sps3dExtension ) { m_cSPS.setSps3dExtension( sps3dExtension );  };
    209209#endif
    210 #if H_3D_IC
     210#if NH_3D_IC
    211211  Void                    setICEnableCandidate         ( Int* ICEnableCandidate) { m_aICEnableCandidate = ICEnableCandidate; }
    212212  Void                    setICEnableNum         ( Int* ICEnableNum) { m_aICEnableNum = ICEnableNum; }
Note: See TracChangeset for help on using the changeset viewer.