Changeset 764 in 3DVCSoftware for branches


Ignore:
Timestamp:
12 Jan 2014, 00:23:20 (11 years ago)
Author:
tech
Message:

Cleanup part 1

Location:
branches/HTM-9.2-dev0/source
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.2-dev0/source/App/TAppEncoder/TAppEncCfg.cpp

    r738 r764  
    378378#if H_3D_DIM
    379379  ("DMM",                   m_useDMM,           true,  "Depth intra model modes")
    380 #if !SEC_DMM3_RBC_F0147
    381   ("RBC",                   m_useRBC,           true,  "Region boundary chain mode")
    382 #endif
    383380  ("SDC",                   m_useSDC,           true,  "Simplified depth coding")
    384381  ("DLT",                   m_useDLT,           true,  "Depth lookup table")
     
    523520
    524521#if H_3D_IC
    525 #if SEC_ONLY_TEXTURE_IC_F0151
    526522  ("IlluCompEnable",           m_abUseIC, true, "Enable illumination compensation")
    527 #else
    528   ("IlluCompEnable",           m_abUseIC, std::vector<Bool>(2, true), "Enable illumination compensation")
    529 #endif
    530523#endif
    531524#if H_3D_INTER_SDC
     
    25182511#endif
    25192512#if H_3D_IC
    2520 #if SEC_ONLY_TEXTURE_IC_F0151
    25212513  printf( "IlluCompEnable: %d ", m_abUseIC);
    2522 #else
    2523   printf( "IlluCompEnable: %d %d ", m_abUseIC[0] ? 1 : 0, m_abUseIC[1] ? 1 : 0 );
    2524 #endif
    25252514#endif
    25262515#if H_3D_NBDV_REF
     
    25352524#if H_3D_DIM
    25362525  printf("DMM:%d ", m_useDMM );
    2537 #if !SEC_DMM3_RBC_F0147
    2538   printf("RBC:%d ", m_useRBC );
    2539 #endif
    25402526  printf("SDC:%d ", m_useSDC );
    25412527  printf("DLT:%d ", m_useDLT );
  • branches/HTM-9.2-dev0/source/App/TAppEncoder/TAppEncCfg.h

    r738 r764  
    150150#endif
    151151#if H_3D_IC
    152 #if SEC_ONLY_TEXTURE_IC_F0151
    153152  Bool   m_abUseIC;
    154 #else
    155   vector<Bool> m_abUseIC;                                    ///< flag for using illumination compensation for inter-view prediction
    156 #endif
    157153#endif
    158154#if H_3D_NBDV_REF
     
    497493#if H_3D_DIM
    498494  Bool      m_useDMM;                                        ///< flag for using DMM
    499 #if !SEC_DMM3_RBC_F0147
    500   Bool      m_useRBC;                                        ///< flag for using RBC
    501 #endif
    502495  Bool      m_useSDC;                                        ///< flag for using SDC
    503496  Bool      m_useDLT;                                        ///< flag for using DLT
  • branches/HTM-9.2-dev0/source/App/TAppEncoder/TAppEncTop.cpp

    r758 r764  
    198198#endif
    199199#if H_3D_IC
    200 #if SEC_ONLY_TEXTURE_IC_F0151
    201200    m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 || isDepth ? false : m_abUseIC );
    202 #else
    203     m_cTEncTop.setUseIC                        ( vps.getViewIndex( layerId ) == 0 ? false : m_abUseIC[isDepth ? 1 : 0] );
    204 #endif
    205201#endif
    206202  //========== Depth intra modes ==========
    207203#if H_3D_DIM
    208204    m_cTEncTop.setUseDMM                       ( isDepth ? m_useDMM               : false );
    209 #if !SEC_DMM3_RBC_F0147
    210     m_cTEncTop.setUseRBC                       ( isDepth ? m_useRBC               : false );
    211 #endif
    212205    m_cTEncTop.setUseSDC                       ( isDepth ? m_useSDC               : false );
    213206    m_cTEncTop.setUseDLT                       ( isDepth ? m_useDLT               : false );
     
    19971990
    19981991#if H_3D_DIM
    1999 #if SEC_DMM3_RBC_F0147
    20001992    vps.setVpsDepthModesFlag( layer, isDepth && !isLayerZero && (m_useDMM || m_useSDC || m_useDLT ) );
    2001 #else
    2002     vps.setVpsDepthModesFlag( layer, isDepth && !isLayerZero && (m_useDMM || m_useRBC || m_useSDC || m_useDLT ) );
    2003 #endif
    20041993#if H_3D_DIM_DLT
    20051994#if !DLT_DIFF_CODING_IN_PPS
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/ContextTables.h

    r724 r764  
    109109#define NUM_DEPTH_INTRA_MODE_CTX      8       ///< number of context models for depth intra modes
    110110#define NUM_DDC_FLAG_CTX              2       ///< number of context models for deltaDC flag (DMM or RBC)
    111 #if QC_DIM_DELTADC_UNIFY_F0132
    112111#define NUM_DDC_DATA_CTX              1       ///< number of context models for deltaDC data (DMM or RBC)
    113 #else
    114 #define NUM_DDC_DATA_CTX              2       ///< number of context models for deltaDC data (DMM or RBC)
    115 #endif
    116112#if H_3D_DIM_DMM
    117113#define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
    118 #if !SEC_DMM3_RBC_F0147
    119 #define NUM_DMM3_DATA_CTX             1       ///< number of context models for DMM3 data
    120 #endif
    121 #endif
    122 #if H_3D_DIM_RBC
    123 #define NUM_RBC_DATA_CTX              1       ///< number of context models for RBC data
    124114#endif
    125115#endif
     
    393383INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 
    394384{
    395 #if LGE_IC_CTX_F0160
    396385    { 154,  154,  154, },
    397386    { 154,  154,  154, },
    398387    { 154,  154,  154, },
    399 #else
    400   { CNU,  CNU,  CNU, },
    401   { 197,  185,  201, },
    402   { 197,  185,  201, },
    403 #endif
    404388};
    405389#endif
     
    423407INIT_DDC_DATA[3][NUM_DDC_DATA_CTX] =
    424408{
    425 #if QC_DIM_DELTADC_UNIFY_F0132
    426   { 154 },
    427   { 154 },
    428   { 154 },
    429 #else
    430   { CNU, CNU },
    431   { CNU, CNU },
    432   { CNU, CNU },
    433 #endif
     409  { 154 },
     410  { 154 },
     411  { 154 },
    434412};
    435413#if H_3D_DIM_DMM
     
    441419  { CNU },
    442420};
    443 #if !SEC_DMM3_RBC_F0147
    444 static const UChar
    445 INIT_DMM3_DATA[3][NUM_DMM3_DATA_CTX] =
    446 {
    447   { CNU },
    448   { CNU },
    449   { CNU },
    450 };
    451 #endif
    452 #endif
    453 #if H_3D_DIM_RBC
    454 static const UChar
    455 INIT_RBC_DATA[3][NUM_RBC_DATA_CTX] =
    456 {
    457   { CNU },
    458   { CNU },
    459   { CNU },
    460 };
    461421#endif
    462422#if H_3D_DIM_SDC
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/TComDataCU.cpp

    r724 r764  
    120120    m_dmmWedgeTabIdx[i] = NULL;
    121121  }
    122 #if !SEC_DMM3_RBC_F0147
    123   m_dmm3IntraTabIdx = NULL;
    124 #endif
    125 #endif
    126 #if H_3D_DIM_RBC
    127   m_pucEdgeCode     = NULL;
    128   m_pucEdgeNumber   = NULL;
    129   m_pucEdgeStartPos = NULL;
    130   m_pbEdgeLeftFirst = NULL;
    131   m_pbEdgePartition = NULL;
    132122#endif
    133123#if H_3D_DIM_SDC
     
    279269      m_dmmWedgeTabIdx[i]    = (UInt*)xMalloc(UInt, uiNumPartition);
    280270    }
    281 #if !SEC_DMM3_RBC_F0147
    282     m_dmm3IntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition);
    283 #endif
    284 #endif
    285 #if H_3D_DIM_RBC
    286     m_pucEdgeCode     = (UChar*)xMalloc(UChar, uiNumPartition * RBC_MAX_EDGE_NUM_PER_4x4);
    287     m_pucEdgeNumber   = (UChar*)xMalloc(UChar, uiNumPartition);
    288     m_pucEdgeStartPos = (UChar*)xMalloc(UChar, uiNumPartition);
    289     m_pbEdgeLeftFirst = (Bool*)xMalloc(Bool, uiNumPartition);
    290     m_pbEdgePartition = (Bool*)xMalloc(Bool, uiNumPartition * 16);
    291271#endif
    292272#if H_3D_DIM_SDC
     
    417397      if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; }
    418398    }
    419 #if !SEC_DMM3_RBC_F0147
    420     if ( m_dmm3IntraTabIdx ) { xFree( m_dmm3IntraTabIdx ); m_dmm3IntraTabIdx = NULL; }
    421 #endif
    422 #endif
    423 #if H_3D_DIM_RBC
    424     if ( m_pbEdgeLeftFirst ) { xFree( m_pbEdgeLeftFirst ); m_pbEdgeLeftFirst = NULL; }
    425     if ( m_pucEdgeStartPos ) { xFree( m_pucEdgeStartPos ); m_pucEdgeStartPos = NULL; }
    426     if ( m_pucEdgeNumber   ) { xFree( m_pucEdgeNumber   ); m_pucEdgeNumber   = NULL; }
    427     if ( m_pucEdgeCode     ) { xFree( m_pucEdgeCode     ); m_pucEdgeCode     = NULL; }
    428     if ( m_pbEdgePartition ) { xFree( m_pbEdgePartition ); m_pbEdgePartition = NULL; }
    429399#endif
    430400#if H_3D_DIM_SDC
     
    643613      memset( m_dmmWedgeTabIdx[i] + firstElement, 0,                      numElements * sizeof( *m_dmmWedgeTabIdx[i] ) );
    644614    }
    645 #if !SEC_DMM3_RBC_F0147
    646     memset( m_dmm3IntraTabIdx   + firstElement, 0,                        numElements * sizeof( *m_dmm3IntraTabIdx ) );
    647 #endif
    648 #endif
    649 #if H_3D_DIM_RBC
    650     memset( m_pucEdgeCode       + firstElement, 0,                        numElements * sizeof( *m_pucEdgeCode     ) * RBC_MAX_EDGE_NUM_PER_4x4 );
    651     memset( m_pucEdgeNumber     + firstElement, 0,                        numElements * sizeof( *m_pucEdgeNumber   ) );
    652     memset( m_pucEdgeStartPos   + firstElement, 0,                        numElements * sizeof( *m_pucEdgeStartPos ) );
    653     memset( m_pbEdgeLeftFirst   + firstElement, false,                    numElements * sizeof( *m_pbEdgeLeftFirst ) );
    654     memset( m_pbEdgePartition   + firstElement, false,                    numElements * sizeof( *m_pbEdgePartition ) * 16 );
    655615#endif
    656616#if H_3D_DIM_SDC
     
    825785        m_dmmWedgeTabIdx[i] [ui] = 0;
    826786      }
    827 #if !SEC_DMM3_RBC_F0147
    828       m_dmm3IntraTabIdx [ui] = 0;
    829 #endif
    830787#endif
    831788#if H_3D_DIM_SDC
     
    941898    memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition );
    942899  }
    943 #if !SEC_DMM3_RBC_F0147
    944   memset( m_dmm3IntraTabIdx, 0, sizeof(UInt) * m_uiNumPartition );
    945 #endif
    946 #endif
    947 #if H_3D_DIM_RBC
    948   memset( m_pucEdgeCode    , 0, iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 );
    949   memset( m_pucEdgeNumber  , 0, iSizeInUchar );
    950   memset( m_pucEdgeStartPos, 0, iSizeInUchar );
    951   memset( m_pbEdgeLeftFirst, 0, iSizeInBool );
    952   memset( m_pbEdgePartition, 0, iSizeInBool * 16 );
    953900#endif
    954901#if H_3D_DIM_SDC
     
    1028975        m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui];
    1029976      }
    1030 #if !SEC_DMM3_RBC_F0147
    1031       m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui];
    1032 #endif
    1033977#endif
    1034978#if H_3D_DIM_SDC
     
    11871131    m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart;
    11881132  }
    1189 #if !SEC_DMM3_RBC_F0147
    1190   m_dmm3IntraTabIdx = pcCU->getDmm3IntraTabIdx() + uiPart;
    1191 #endif
    1192 #endif
    1193 #if H_3D_DIM_RBC
    1194   m_pucEdgeCode     = pcCU->getEdgeCode( uiPart );
    1195   m_pucEdgeNumber   = pcCU->getEdgeNumber()      + uiPart;
    1196   m_pucEdgeStartPos = pcCU->getEdgeStartPos()    + uiPart;
    1197   m_pbEdgeLeftFirst = pcCU->getEdgeLeftFirst()   + uiPart;
    1198   m_pbEdgePartition = pcCU->getEdgePartition( uiPart );
    11991133#endif
    12001134#if H_3D_DIM_SDC
     
    13911325    memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition );
    13921326  }
    1393 #if !SEC_DMM3_RBC_F0147
    1394   memcpy( m_dmm3IntraTabIdx + uiOffset, pcCU->getDmm3IntraTabIdx(), sizeof(UInt) * uiNumPartition );
    1395 #endif
    1396 #endif
    1397 #if H_3D_DIM_RBC
    1398   memcpy( getEdgeCode( uiOffset ),       pcCU->getEdgeCode(0),      iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 );
    1399   memcpy( getEdgeNumber()    + uiOffset, pcCU->getEdgeNumber(),     iSizeInUchar );
    1400   memcpy( getEdgeStartPos()  + uiOffset, pcCU->getEdgeStartPos(),   iSizeInUchar );
    1401   memcpy( getEdgeLeftFirst() + uiOffset, pcCU->getEdgeLeftFirst(),  iSizeInBool );
    1402   memcpy( getEdgePartition( uiOffset ),  pcCU->getEdgePartition(0), iSizeInBool * 16 );
    14031327#endif
    14041328#if H_3D_DIM_SDC
     
    15231447    memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition );
    15241448  }
    1525 #if !SEC_DMM3_RBC_F0147
    1526   memcpy( rpcCU->getDmm3IntraTabIdx() + m_uiAbsIdxInLCU, m_dmm3IntraTabIdx, sizeof(UInt) * m_uiNumPartition );
    1527 #endif
    1528 #endif
    1529 #if H_3D_DIM_RBC
    1530   memcpy( rpcCU->getEdgeCode( m_uiAbsIdxInLCU ),         m_pucEdgeCode,     iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 );
    1531   memcpy( rpcCU->getEdgeNumber()      + m_uiAbsIdxInLCU, m_pucEdgeNumber,   iSizeInUchar );
    1532   memcpy( rpcCU->getEdgeStartPos()    + m_uiAbsIdxInLCU, m_pucEdgeStartPos, iSizeInUchar );
    1533   memcpy( rpcCU->getEdgeLeftFirst()   + m_uiAbsIdxInLCU, m_pbEdgeLeftFirst, iSizeInBool );
    1534   memcpy( rpcCU->getEdgePartition( m_uiAbsIdxInLCU ),    m_pbEdgePartition, iSizeInBool * 16 );
    15351449#endif
    15361450#if H_3D_DIM_SDC
     
    16411555    memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart );
    16421556  }
    1643 #if !SEC_DMM3_RBC_F0147
    1644   memcpy( rpcCU->getDmm3IntraTabIdx() + uiPartOffset, m_dmm3IntraTabIdx, sizeof(UInt) * uiQNumPart );
    1645 #endif
    1646 #endif
    1647 #if H_3D_DIM_RBC
    1648   memcpy( rpcCU->getEdgeCode( uiPartOffset ),         m_pucEdgeCode,     iSizeInUchar * RBC_MAX_EDGE_NUM_PER_4x4 );
    1649   memcpy( rpcCU->getEdgeNumber()      + uiPartOffset, m_pucEdgeNumber,   iSizeInUchar );
    1650   memcpy( rpcCU->getEdgeStartPos()    + uiPartOffset, m_pucEdgeStartPos, iSizeInUchar );
    1651   memcpy( rpcCU->getEdgeLeftFirst()   + uiPartOffset, m_pbEdgeLeftFirst, iSizeInBool );
    1652   memcpy( rpcCU->getEdgePartition( uiPartOffset ),    m_pbEdgePartition, iSizeInBool * 16 );
    16531557#endif
    16541558#if H_3D_DIM_SDC
     
    23752279  UInt        uiCtx = 0;
    23762280
    2377 #if LGE_IC_CTX_F0160
    23782281  TComDataCU* pcTempCU = NULL;
    23792282  UInt        uiTempPartIdx = 0;
     
    23842287  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
    23852288  uiCtx    += ( pcTempCU ) ? pcTempCU->isIC( uiTempPartIdx ) : 0;
    2386 #endif
    23872289
    23882290  return uiCtx;
     
    33453247 *   false: otherwise
    33463248 */
    3347 #if ETRIKHU_MERGE_REUSE_F0093
    33483249inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
    33493250  Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
    3350 #else
    3351 inline Bool TComDataCU::xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
    3352                                      Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag )
    3353 #endif
    3354 {
     3251  {
    33553252  if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() )
    33563253  {
     
    33673264  }
    33683265
    3369 #if ETRIKHU_MERGE_REUSE_F0093
    33703266  rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
    3371 #endif
    33723267 
    33733268  Bool  refViewAvailFlag = false;
     
    34543349
    34553350#if H_3D_IV_MERGE
    3456 #if ETRIKHU_MERGE_REUSE_F0093
    34573351inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv,
    34583352  Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
    3459 #else
    3460 inline Bool TComDataCU::xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* ivCandDir, TComMv* ivCandMv,
    3461                                        Int* ivCandRefIdx, Int iPosIvDC, Int* vspFlag )
    3462 #endif
    34633353{
    34643354  for(Int iLoop = 0; iLoop < 2; iLoop ++ )
     
    34793369        clipMv( cMv );
    34803370
    3481 #if ETRIKHU_MERGE_REUSE_F0093
    34823371        rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
    3483 #endif
    34843372
    34853373        abCandIsInter        [ iCount ] = true;
     
    35023390    if(ivCandDir[iLoop + 2])
    35033391    {
    3504 #if ETRIKHU_MERGE_REUSE_F0093
    35053392      TComMvField tmpMV[2];
    35063393      UChar tmpDir = ivCandDir[iLoop + 2];
    3507 #else
    3508       abCandIsInter        [ iCount ] = true;
    3509       puhInterDirNeighbours[ iCount ] = ivCandDir[iLoop + 2];
    3510 #endif
    35113394      if( ( ivCandDir[iLoop + 2] & 1 ) == 1 )
    35123395      {
    3513 #if ETRIKHU_MERGE_REUSE_F0093
    35143396        tmpMV[0].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] );
    3515 #else
    3516         pcMvFieldNeighbours[ iCount<<1 ].setMvField( ivCandMv[ (iLoop<<1) + 4 ], ivCandRefIdx[ (iLoop<<1) + 4 ] );
    3517 #endif
    35183397      }
    35193398      if( ( ivCandDir[iLoop + 2] & 2 ) == 2 )
    35203399      {
    3521 #if ETRIKHU_MERGE_REUSE_F0093
    35223400        tmpMV[1].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
    3523 #else
    3524         pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
    3525 #endif
    35263401      }
    35273402     
     
    35303405      if( !iLoop && ivCandDir[0] > 0)
    35313406      {
    3532 #if ETRIKHU_MERGE_REUSE_F0093
    35333407        if(tmpDir == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0]==tmpMV[0] && pcMvFieldNeighbours[1]==tmpMV[1])
    3534 #else
    3535         if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[0] && pcMvFieldNeighbours[0 ]== pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[1]==pcMvFieldNeighbours[(iCount<<1)+1])
    3536 #endif
    35373408        {
    35383409            bRemove                         = true;
    3539 #if !ETRIKHU_MERGE_REUSE_F0093
    3540             abCandIsInter        [ iCount ] = false; 
    3541             puhInterDirNeighbours[ iCount ] = 0;
    3542             TComMv  cZeroMv;
    3543             pcMvFieldNeighbours  [ iCount<<1   ].setMvField( cZeroMv, NOT_VALID );
    3544             pcMvFieldNeighbours  [(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    3545 #endif
    35463410        }
    35473411      }
    35483412      if(!bRemove)
    35493413      {
    3550 
    3551 #if ETRIKHU_MERGE_REUSE_F0093
    35523414        rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
    35533415
     
    35623424          pcMvFieldNeighbours[ (iCount<<1)+1 ].setMvField( ivCandMv[ (iLoop<<1) + 5 ], ivCandRefIdx[ (iLoop<<1) + 5 ] );
    35633425        }
    3564 #endif
    3565 
    35663426#if H_3D_NBDV
    35673427        if(iLoop) // For IvMcShift candidate
     
    36033463#endif
    36043464
    3605 
    3606 
    3607 
    3608 
    3609 
    3610 
    3611 
    3612 
    3613 #if ETRIKHU_MERGE_REUSE_F0093
     3465#if H_3D
    36143466Void TComDataCU::rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV)
    36153467{
     
    39993851 * \param numValidMergeCand
    40003852 */
    4001 #if ETRIKHU_MERGE_REUSE_F0093
     3853#if H_3D
    40023854Void TComDataCU::xGetInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    40033855#else
     
    40243876  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    40253877#endif
    4026 #if ETRIKHU_MERGE_REUSE_F0093
     3878#if H_3D
    40273879  TComMvField tmpMV[2];
    40283880  UChar tmpDir;
     
    40463898  {
    40473899    abCandIsInter[ui] = false;
    4048 #if H_3D_IV_MERGE
    4049     pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
    4050     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
    4051 #else
    40523900    pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
    40533901    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
    4054 #endif
    40553902  }
    40563903#endif
     
    40693916
    40703917  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
    4071 #if !ETRIKHU_MERGE_REUSE_F0093
     3918#if !H_3D
    40723919  PartSize cCurPS = getPartitionSize( uiAbsPartIdx );
    40733920#endif
    40743921  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    40753922  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    4076 #if SEC_MPI_ENABLING_MERGE_F0150
     3923#if H_3D
    40773924  Bool bMPIFlag   = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() );
    4078 #endif
    4079 #if QC_DEPTH_IV_MRG_F0125
    40803925  Bool bIsDepth = getSlice()->getIsDepth();
    4081 #if !BUGFIX_F0093
    4082   Bool bDepthIPMCAvai = false;
    4083 #endif
    40843926#endif
    40853927
    4086 #if LGE_SHARP_VSP_INHERIT_F0104
    40873928#if H_3D_IC
    40883929  Bool bICFlag = getICFlag(uiAbsPartIdx);
     
    40913932  Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
    40923933#endif
    4093 #endif
    4094 
    4095 #if ETRIKHU_MERGE_REUSE_F0093
     3934
     3935#if H_3D
    40963936  Int  iPosLeftAbove[2] = {-1, -1};
    40973937
     
    41183958#if H_3D_VSP
    41193959    if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
    4120 #if LGE_SHARP_VSP_INHERIT_F0104
    41213960#if H_3D_IC
    41223961      && !bICFlag
     
    41253964      && !bARPFlag
    41263965#endif
    4127 #endif
    41283966      )
    41293967    {
    41303968      vspFlag[numA1B1B0] = 1;
    4131 #if !MTK_VSP_SIMPLIFICATION_F0111
    4132       xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
    4133 #endif
    41343969    }
    41353970#endif
     
    41503985    if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
    41513986#endif
    4152 #if LGE_SHARP_VSP_INHERIT_F0104
    41533987#if H_3D_IC
    41543988      && !bICFlag
     
    41563990#if H_3D_ARP
    41573991      && !bARPFlag
    4158 #endif
    41593992#endif
    41603993      )
     
    41774010  {
    41784011#if H_3D_VSP
    4179 #if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111
    41804012    if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
    4181 #else
    4182     if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
    4183 #endif
    4184 #if LGE_SHARP_VSP_INHERIT_F0104
    41854013#if H_3D_IC
    41864014      && !bICFlag
     
    41894017      && !bARPFlag
    41904018#endif
    4191 #endif
    41924019      )
    41934020    {
    41944021      vspFlag[numA1B1B0] = 1;
    4195 #if !MTK_VSP_SIMPLIFICATION_F0111
    4196       xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
    4197 #endif
    41984022    }
    41994023#endif
     
    42084032#if H_3D_VSP
    42094033    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
    4210 #if LGE_SHARP_VSP_INHERIT_F0104
    42114034#if H_3D_IC
    42124035      && !bICFlag
     
    42154038      && !bARPFlag
    42164039#endif
    4217 #endif
    42184040      )
    42194041    {
    42204042      vspFlag[numA1B1B0] = 1;
    4221 #if !MTK_VSP_SIMPLIFICATION_F0111
    4222       xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
    4223 #endif
    42244043    }
    42254044#endif
     
    42354054  {
    42364055#if H_3D_VSP
    4237 #if BUGFIX_2_F0093 && MTK_VSP_SIMPLIFICATION_F0111
    42384056    if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
    4239 #else
    4240     if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
    4241 #endif
    4242 #if LGE_SHARP_VSP_INHERIT_F0104
    42434057#if H_3D_IC
    42444058      && !bICFlag
     
    42474061      && !bARPFlag
    42484062#endif
    4249 #endif
    42504063      )
    42514064    {
    42524065      vspFlag[numA1B1B0+iCountHEVC] = 1;
    4253 #if !MTK_VSP_SIMPLIFICATION_F0111
    4254       xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
    4255 #endif
    42564066    }
    42574067#endif
     
    42654075
    42664076#if H_3D_IV_MERGE
    4267  
     4077
    42684078  /////////////////////////////////////////////
    42694079  //////// TEXTURE MERGE CANDIDATE (T) ////////
    42704080  /////////////////////////////////////////////
    4271  
    4272 #if SEC_MPI_ENABLING_MERGE_F0150
     4081
    42734082  if( bMPIFlag)
    4274 #else
    4275   if( m_pcSlice->getIsDepth())
    4276 #endif
    42774083  {
    42784084    UInt uiPartIdxCenter;
    42794085    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );   
    4280 
    4281 #if ETRIKHU_MERGE_REUSE_F0093
    42824086    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
    42834087    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
    42844088    Int tRef[2]={-1, -1};
    4285 #endif
    42864089
    42874090#if H_3D_FCO
     
    42894092    TComDataCU *pcTextureCU = 0;
    42904093    if ( pcTexturePic )
    4291         pcTextureCU = pcTexturePic->getCU( getAddr() );
     4094      pcTextureCU = pcTexturePic->getCU( getAddr() );
    42924095#else
    42934096    TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
    42944097#endif
    4295  
     4098
    42964099#if H_3D_FCO
    42974100    if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     
    43004103#endif
    43014104    {
    4302 #if ETRIKHU_MERGE_REUSE_F0093
    43034105      pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, tmpMV[0] );
    43044106      tRef[0] = getPic()->isTextRefValid( REF_PIC_LIST_0, tmpMV[0].getRefIdx() );
     
    44144216        }
    44154217        iCount ++;
    4416 
    4417 #else
    4418       pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    4419       Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1].getRefIdx() );
    4420       if( (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0) && ( iValidDepRef >= 0 ) )
    4421       {
    4422         TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
    4423         const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
    4424         cMvPred+=cAdd;
    4425         cMvPred>>=2;
    4426         clipMv(cMvPred);
    4427         pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,iValidDepRef);
    4428       }
    4429       if ( getSlice()->isInterB() )
    4430       {
    4431         pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    4432         iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx() );
    4433         if( (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0) && ( iValidDepRef >= 0) )
    4434         {
    4435           TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
    4436           const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
    4437           cMvPred+=cAdd;
    4438           cMvPred>>=2;
    4439           clipMv(cMvPred);
    4440           pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,iValidDepRef);
    4441         }
    4442       }
    4443       puhInterDirNeighbours[iCount] = (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)?1:0;
    4444       puhInterDirNeighbours[iCount] += (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)?2:0;
    4445       if( puhInterDirNeighbours[iCount] != 0 )
    4446       {
    4447         abCandIsInter[iCount] = true;
    4448         if ( mrgCandIdx == iCount )
    4449         {
    4450           return;
    4451         }
    4452         iCount ++;
    4453       }
    4454 #endif
    4455       }
    4456     }
    4457   }
    4458 
    4459 
    4460 #if !ETRIKHU_MERGE_REUSE_F0093
    4461   //////////////////////////////////
    4462   //////// GET DISPARITIES  ////////
    4463   //////////////////////////////////
    4464 
    4465   DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
    4466   for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
    4467   {
    4468     inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;
    4469   }
    4470 #endif
     4218      }
     4219    }
     4220  }
    44714221
    44724222  /////////////////////////////////////////////////////////////////
     
    44754225
    44764226  Int  posIvDC          = -1;
    4477 #if !ETRIKHU_MERGE_REUSE_F0093
    4478   Bool bLeftAvai        = false;
    4479   Int  iPosLeftAbove[2] = {-1, -1};
    4480 #endif
    44814227
    44824228  // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift }; 
     
    44894235
    44904236  Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
    4491  
     4237
    44924238  if ( ivMvPredFlag )
    44934239  {
    4494     getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir
    4495 #if QC_DEPTH_IV_MRG_F0125
    4496     , bIsDepth
    4497 #endif
    4498 #if MTK_SPIVMP_F0110
    4499     , pcMvFieldSP, puhInterDirSP
    4500 #endif
    4501     );
     4240    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP );
    45024241  } 
    4503  
     4242
    45044243  ///////////////////////////////////////////////
    45054244  //////// INTER VIEW MOTION COMP(IvMC) /////////
     
    45084247  if( ivCandDir[0] )
    45094248  {
    4510 #if ETRIKHU_MERGE_REUSE_F0093
    45114249    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
    45124250    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     
    45254263    Int iCnloop=0;
    45264264
    4527 #if BUGFIX_F0093
    45284265    if (!bIsDepth)
    45294266    {
    4530 #endif
    45314267      for(Int i = 0; i < 2; i ++)
    45324268      {
     
    45424278        }     
    45434279      }
    4544 #if BUGFIX_F0093
    4545     }
    4546 #endif
    4547 #if QC_DEPTH_IV_MRG_F0125
    4548 #if BUGFIX_F0093
     4280    }
    45494281    if (bIsDepth)
    4550 #else
    4551     if ( bIsDepth && !bRemoveSpa)
    4552 #endif
    45534282    {
    45544283      iCnloop = iCount-1;
    45554284      for(; iCnloop >= 0; iCnloop --)
    45564285      {
    4557 #if BUGFIX_F0093
    45584286        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1])  // F0125 compatible with F0093
    4559 #else
    4560         if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    4561 #endif
    45624287        {
    45634288          bRemoveSpa                      = true;
     
    45654290        }
    45664291      }
    4567 #if !BUGFIX_F0093
    4568       if(!bRemoveSpa)
    4569       {
    4570         bDepthIPMCAvai = true;
    4571       }
    4572 #endif
    4573     }
    4574 #endif
     4292    }
    45754293
    45764294    if (!bRemoveSpa)
     
    46284346    if (bIvMC)
    46294347    {
    4630 #if MTK_SPIVMP_F0110
    46314348      pbSPIVMPFlag[iCount] = true;
    4632 #endif
    46334349      if( ( ivCandDir[0] & 1 ) == 1 )
    46344350      {
     
    46424358      puhInterDirNeighbours[ iCount ] = ivCandDir[0];
    46434359
    4644 #if !BUGFIX_F0093
    4645 #if QC_DEPTH_IV_MRG_F0125
    4646       if ( bDepthIPMCAvai || !bIsDepth )
    4647       {
    4648 #endif
    4649 #endif
    4650         if ( mrgCandIdx == iCount )
    4651         {
    4652           return;
    4653         }
    4654         iCount ++;
    4655 #if !BUGFIX_F0093
    4656 #if QC_DEPTH_IV_MRG_F0125
    4657       }
    4658 #endif
    4659 #endif
    4660     }
    4661 #else
    4662     abCandIsInter        [ iCount ] = true;
    4663     puhInterDirNeighbours[ iCount ] = ivCandDir[0];   
    4664 
    4665     if( ( ivCandDir[0] & 1 ) == 1 )
    4666     {
    4667       pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] );
    4668     }
    4669     if( ( ivCandDir[0] & 2 ) == 2 )
    4670     {
    4671       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] );
    4672     }
    4673 #if QC_DEPTH_IV_MRG_F0125
    4674     if ( bIsDepth )
    4675     {
    4676       Bool bRemoveSpa = false;
    4677       Int iCnloop = iCount-1;
    4678       for(; iCnloop >= 0; iCnloop --)
    4679       {
    4680         if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    4681         {
    4682           bRemoveSpa                      = true;
    4683           abCandIsInter        [ iCount ] = false;
    4684 
    4685           puhInterDirNeighbours[iCount]   = 0;
    4686           pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
    4687           pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    4688           break;
    4689         }
    4690       }
    4691       if(!bRemoveSpa)
    4692       {
    4693         bDepthIPMCAvai = true;
    4694       }
    4695     }
    4696     if ( bDepthIPMCAvai || !bIsDepth )
    4697     {
    4698 #endif
    46994360      if ( mrgCandIdx == iCount )
    47004361      {
     
    47024363      }
    47034364      iCount ++;
    4704 #if QC_DEPTH_IV_MRG_F0125
    4705     }
    4706 #endif
    4707 
    4708 #endif
    4709 
     4365    }
    47104366  }
    47114367
     
    47174373#endif
    47184374
    4719 
    4720 
    4721 
    4722 
    4723 #if ETRIKHU_MERGE_REUSE_F0093
     4375#if H_3D
    47244376  iCount += numA1B1B0;
    47254377#else
    4726 #if H_3D
    4727   ////////////////////////////
    4728   //////// LEFT (A1) /////////
    4729   ////////////////////////////
    4730 #endif
    47314378  //left
    47324379  UInt uiLeftPartIdx = 0;
     
    47484395      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    47494396    }
    4750 #if H_3D_IV_MERGE
    4751     Bool bRemoveSpa = false; //pruning to inter-view candidates
    4752 #if QC_DEPTH_IV_MRG_F0125
    4753     Int  iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1);
    4754 #else
    4755     Int  iCnloop    = iCount - 1;
    4756 #endif
    4757     for(; iCnloop >= 0; iCnloop --)
    4758     {
    4759       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    4760       {
    4761         bRemoveSpa                      = true;
    4762         abCandIsInter        [ iCount ] = false;
    4763 
    4764         //reset to the default value for MC
    4765         puhInterDirNeighbours[iCount]   = 0;
    4766         pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
    4767         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    4768         break;
    4769       }
    4770     }
    4771     if(!bRemoveSpa)
    4772     {
    4773       bLeftAvai = true;
    4774       iPosLeftAbove[0] = iCount;
    4775 #if H_3D_NBDV
    4776       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    4777       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    4778 #endif
    4779 #if H_3D_VSP
    4780       if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
    4781 #if LGE_SHARP_VSP_INHERIT_F0104
    4782 #if H_3D_IC
    4783         && !bICFlag
    4784 #endif
    4785 #if H_3D_ARP
    4786         && !bARPFlag
    4787 #endif
    4788 #endif
    4789         )
    4790       {
    4791         vspFlag[iCount] = 1;
    4792 #if !MTK_VSP_SIMPLIFICATION_F0111
    4793         xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
    4794 #endif
    4795       }
    4796 #endif
    4797       if ( mrgCandIdx == iCount )
    4798       {
    4799         return;
    4800       }
    4801       iCount ++;
    4802     }
    4803 #else // H_3D_IV_MERGE
     4397
    48044398    if ( mrgCandIdx == iCount )
    48054399    {
     
    48074401    }
    48084402    iCount ++;
    4809 #endif // H_3D_IV_MERGE
    48104403  }
    48114404
     
    48154408    return;
    48164409  }
    4817 #if H_3D
    4818   ////////////////////////////
    4819   //////// ABOVE (B1) ////////
    4820   ////////////////////////////
    4821 #endif
     4410
    48224411  // above
    48234412  UInt uiAbovePartIdx = 0;
     
    48394428      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    48404429    }
    4841 #if H_3D_IV_MERGE
    4842     Bool bRemoveSpa = false; //pruning to inter-view candidates
    4843 #if QC_DEPTH_IV_MRG_F0125
    4844     Int iCnloop;
    4845     if( bIsDepth )
    4846       iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai)  ? (iCount-2): (iCount-1));
    4847     else
    4848       iCnloop = bLeftAvai? (iCount-2): (iCount-1);
    4849 #else
    4850     Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
    4851 #endif
    4852     for(; iCnloop >= 0; iCnloop --)
    4853     {
    4854       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    4855       {
    4856         bRemoveSpa                      = true;
    4857         abCandIsInter        [ iCount ] = false;
    4858 
    4859         //reset to the default value for MC
    4860         puhInterDirNeighbours[iCount]   = 0;
    4861 
    4862         pcMvFieldNeighbours[iCount<<1]    .setMvField( cZeroMv, NOT_VALID );
    4863         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    4864         break;
    4865       }
    4866     }
    4867 
    4868     if(!bRemoveSpa)
    4869     {
    4870       iPosLeftAbove[1] = iCount;
    4871 #if H_3D_NBDV
    4872       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    4873       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    4874 #endif
    4875 #if H_3D_VSP
    4876 #if MTK_VSP_SIMPLIFICATION_F0111
    4877       if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
    4878 #if LGE_SHARP_VSP_INHERIT_F0104
    4879 #if H_3D_IC
    4880         && !bICFlag
    4881 #endif
    4882 #if H_3D_ARP
    4883         && !bARPFlag
    4884 #endif
    4885 #endif
    4886         )
    4887 #else
    4888       if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
    4889 #if LGE_SHARP_VSP_INHERIT_F0104
    4890 #if H_3D_IC
    4891         && !bICFlag
    4892 #endif
    4893 #if H_3D_ARP
    4894         && !bARPFlag
    4895 #endif
    4896 #endif
    4897         )
    4898 #endif
    4899       {
    4900 
    4901         vspFlag[iCount] = 1;
    4902 #if !MTK_VSP_SIMPLIFICATION_F0111
    4903         xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
    4904 #endif
    4905       }
    4906 #endif
    4907       if ( mrgCandIdx == iCount )
    4908       {
    4909         return;
    4910       }
    4911       iCount ++;
    4912     }
    4913 #else // H_3D_IV_MERGE
     4430
    49144431    if ( mrgCandIdx == iCount )
    49154432    {
     
    49174434    }
    49184435    iCount ++;
    4919 #endif // H_3D_IV_MERGE
    49204436  }
    49214437  // early termination
     
    49244440    return;
    49254441  }
    4926 
    4927 #if H_3D
    4928   //////////////////////////////////
    4929   //////// ABOVE RIGHT (B0) ////////
    4930   //////////////////////////////////
    4931 #endif
    49324442
    49334443  // above right
     
    49494459      pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    49504460    }
    4951 #if H_3D_NBDV
    4952     pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    4953     pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    4954 #endif
    4955 #if H_3D_VSP
    4956 #if MTK_VSP_SIMPLIFICATION_F0111
    4957     if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
    4958 #if LGE_SHARP_VSP_INHERIT_F0104
    4959 #if H_3D_IC
    4960       && !bICFlag
    4961 #endif
    4962 #if H_3D_ARP
    4963       && !bARPFlag
    4964 #endif
    4965 #endif
    4966       )
    4967 #else
    4968     if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
    4969 #if LGE_SHARP_VSP_INHERIT_F0104
    4970 #if H_3D_IC
    4971       && !bICFlag
    4972 #endif
    4973 #if H_3D_ARP
    4974       && !bARPFlag
    4975 #endif
    4976 #endif
    4977       )
    4978 #endif
    4979     {
    4980       vspFlag[iCount] = 1;
    4981 #if !MTK_VSP_SIMPLIFICATION_F0111
    4982       xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
    4983 #endif
    4984     }
    4985 #endif
     4461
    49864462    if ( mrgCandIdx == iCount )
    49874463    {
     
    50034479  /////////////////////////////////////////////
    50044480
    5005 #if ETRIKHU_MERGE_REUSE_F0093
    50064481  if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand())
    5007 #else
    5008   if( ivCandDir[1] )
    5009 #endif
    50104482  {
    50114483    assert(iCount < getSlice()->getMaxNumMergeCand());
    50124484
    5013 #if ETRIKHU_MERGE_REUSE_F0093
    50144485    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
    50154486    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     
    50224493      tmpMV[1].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
    50234494    }
    5024 #else
    5025     abCandIsInter        [ iCount ] = true;
    5026     puhInterDirNeighbours[ iCount ] = ivCandDir[1];
    5027     if( ( ivCandDir[1] & 1 ) == 1 )
    5028     {
    5029       pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
    5030     }
    5031     if( ( ivCandDir[1] & 2 ) == 2 )
    5032     {
    5033       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
    5034     }
    5035 #endif
    50364495
    50374496    Bool bRemoveSpa = false; //pruning to A1, B1
     
    50464505      {
    50474506        bRemoveSpa                      = true;
    5048 #if !ETRIKHU_MERGE_REUSE_F0093
    5049         abCandIsInter        [ iCount ] = false;
    5050         //reset to the default value for MC
    5051         puhInterDirNeighbours[iCount]   = 0;
    5052         pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
    5053         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    5054 #endif
    50554507        break;
    50564508      }     
     
    50584510    if(!bRemoveSpa)
    50594511    {
    5060 #if ETRIKHU_MERGE_REUSE_F0093
    50614512      rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, (5-iCount), iCount3DV);
    50624513      puhInterDirNeighbours[ iCount ] = ivCandDir[1];
     
    50694520        pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
    50704521      }
    5071 #endif
    50724522#if H_3D_NBDV
    50734523      pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
     
    50924542  //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
    50934543  /////////////////////////////////////////////////
    5094 #if ETRIKHU_MERGE_REUSE_F0093
    50954544  if (iCount<getSlice()->getMaxNumMergeCand())
    50964545  {
    5097 #endif
    50984546
    50994547  if (
    5100 #if LGE_SHARP_VSP_INHERIT_F0104
    51014548#if H_3D_IC
    51024549      !bICFlag &&
     
    51054552      !bARPFlag &&
    51064553#endif
    5107 #endif
    5108 #if ETRIKHU_MERGE_REUSE_F0093
    51094554      xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
    5110 #else
    5111       xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
    5112 #endif
    51134555  {
    51144556    return;
     
    51214563  }
    51224564#endif
    5123 #if ETRIKHU_MERGE_REUSE_F0093
    5124   }
    5125 #endif
    5126 
    5127 #if ETRIKHU_MERGE_REUSE_F0093
     4565#if H_3D
     4566  }
     4567#endif
     4568
     4569#if H_3D
    51284570  iCount += numA0B2;
    51294571#else
    5130 #if H_3D
    5131   ///////////////////////////////////
    5132   //////// LEFT BOTTOM (A0) ////////
    5133   ///////////////////////////////////
    5134 #endif
    5135 
    51364572  //left bottom
    51374573  UInt uiLeftBottomPartIdx = 0;
     
    51524588      pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    51534589    }
    5154 #if H_3D_NBDV
    5155     pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    5156     pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    5157 #endif
    5158 #if H_3D_VSP
    5159     if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
    5160 #if LGE_SHARP_VSP_INHERIT_F0104
    5161 #if H_3D_IC
    5162         && !bICFlag
    5163 #endif
    5164 #if H_3D_ARP
    5165         && !bARPFlag
    5166 #endif
    5167 #endif
    5168         )
    5169     {
    5170       vspFlag[iCount] = 1;
    5171 #if !MTK_VSP_SIMPLIFICATION_F0111
    5172       xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
    5173 #endif
    5174     }
    5175 #endif
    51764590    if ( mrgCandIdx == iCount )
    51774591    {
     
    51854599    return;
    51864600  }
    5187 #if H_3D
    5188   ///////////////////////////////////
    5189   //////// LEFT ABOVE (B2) ////////
    5190   ///////////////////////////////////
    5191 #endif
    51924601
    51934602  // above left
     
    52124621        pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    52134622      }
    5214 #if H_3D_NBDV
    5215       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    5216       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    5217 #endif
    5218 #if H_3D_VSP
    5219 #if MTK_VSP_SIMPLIFICATION_F0111
    5220       if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
    5221 #if LGE_SHARP_VSP_INHERIT_F0104
    5222 #if H_3D_IC
    5223           && !bICFlag
    5224 #endif
    5225 #if H_3D_ARP
    5226           && !bARPFlag
    5227 #endif
    5228 #endif
    5229           )
    5230 #else
    5231       if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
    5232 #if LGE_SHARP_VSP_INHERIT_F0104
    5233 #if H_3D_IC
    5234           && !bICFlag
    5235 #endif
    5236 #if H_3D_ARP
    5237           && !bARPFlag
    5238 #endif
    5239 #endif
    5240           )
    5241 #endif
    5242       {
    5243         vspFlag[iCount] = 1;
    5244 #if !MTK_VSP_SIMPLIFICATION_F0111
    5245         xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
    5246 #endif
    5247       }
    5248 #endif
    52494623      if ( mrgCandIdx == iCount )
    52504624      {
     
    52664640  //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
    52674641  ////////////////////////////////////////////////////
    5268 #if ETRIKHU_MERGE_REUSE_F0093
    52694642  if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() )
    52704643  {
    52714644    if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
    5272 #else
    5273   if(  ivMvPredFlag  )
    5274   {
    5275     if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag))
    5276 #endif
    52774645    {
    52784646      return;
     
    52864654#endif
    52874655
    5288 #if ETRIKHU_MERGE_REUSE_F0093
     4656#if H_3D
    52894657  if (iCountHEVC + iCount3DV > getSlice()->getMaxNumMergeCand())
    52904658  {
     
    52974665  numValidMergeCand = iCount;
    52984666#else
    5299 #if H_3D
    5300   /////////////////////////////////
    5301   //////// Collocate (COL) ////////
    5302   /////////////////////////////////
    5303 #endif
    53044667  if ( getSlice()->getEnableTMVPFlag())
    53054668  {
     
    53664729    if ( getSlice()->isInterB() )
    53674730    {
    5368 #if H_3D_TMVP
    5369       iRefIdx = 0;
    5370 #endif
    53714731      bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
    53724732      if( bExistMV == false )
     
    53854745      puhInterDirNeighbours[uiArrayAddr] = dir;
    53864746      abCandIsInter[uiArrayAddr] = true;
    5387 #if H_3D_NBDV
    5388       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    5389       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    5390 #endif
    53914747      if ( mrgCandIdx == iCount )
    53924748      {
     
    54064762  if ( getSlice()->isInterB())
    54074763  {
    5408 #if H_3D_IV_MERGE
    5409     UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3,    0, 4, 1, 4, 2, 4, 3, 4 };
    5410     UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2,    4, 0, 4, 1, 4, 2, 4, 3 };
    5411 #else
    54124764    UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    54134765    UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
    5414 #endif
    54154766
    54164767    for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
    54174768    {
    54184769      Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
    5419 #if H_3D_VSP
    5420       Bool bValid = true;
    5421       if ( vspFlag[i] == 1 || vspFlag[j] == 1 )
    5422       {
    5423         bValid = false;
    5424       }
    5425       if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) )
    5426       {
    5427         assert(bValid == true);
    5428       }
    5429 #endif
    5430 #if H_3D_VSP
    5431       if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid)
    5432 #else
    54334770      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
    5434 #endif
    54354771      {
    54364772        abCandIsInter[uiArrayAddr] = true;
     
    54884824#endif
    54894825}
    5490 
    5491 
    5492 
    5493 
    54944826#else
    54954827
     
    55034835 */
    55044836Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours
    5505 #if H_3D_VSP
    5506       , Int* vspFlag
    5507       , InheritedVSPDisInfo*  inheritedVSPDisInfo
    5508 #endif
    55094837      , Int& numValidMergeCand, Int mrgCandIdx
    55104838)
    55114839{
    55124840  UInt uiAbsPartAddr = m_uiAbsIdxInLCU + uiAbsPartIdx;
    5513 #if H_3D_IV_MERGE
    5514   ////////////////////////////
    5515   //////// INIT LISTS ////////
    5516   ////////////////////////////
    5517   TComMv cZeroMv;
    5518   Bool abCandIsInter[ MRG_MAX_NUM_CANDS_MEM ];
    5519 #else
    55204841  Bool abCandIsInter[ MRG_MAX_NUM_CANDS ];
    5521 #endif
    55224842  for( UInt ui = 0; ui < getSlice()->getMaxNumMergeCand(); ++ui )
    55234843  {
    55244844    abCandIsInter[ui] = false;
    5525 #if H_3D_IV_MERGE
    5526     pcMvFieldNeighbours[ ( ui << 1 )     ].setMvField(cZeroMv, NOT_VALID);
    5527     pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setMvField(cZeroMv, NOT_VALID);
    5528 #else
    55294845    pcMvFieldNeighbours[ ( ui << 1 )     ].setRefIdx(NOT_VALID);
    55304846    pcMvFieldNeighbours[ ( ui << 1 ) + 1 ].setRefIdx(NOT_VALID);
    5531 #endif
    55324847  }
    55334848  numValidMergeCand = getSlice()->getMaxNumMergeCand();
    5534 #if H_3D
    5535   //////////////////////////////////
    5536   //////// DERIVE LOCATIONS ////////
    5537   //////////////////////////////////
    5538 #endif
    55394849  // compute the location of the current PU
    55404850  Int xP, yP, nPSW, nPSH;
     
    55474857  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    55484858  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
    5549 #if SEC_MPI_ENABLING_MERGE_F0150
    5550   Bool bMPIFlag   = getSlice()->getVPS()->getMPIFlag( getSlice()->getLayerIdInVps() );
    5551 #endif
    5552 #if QC_DEPTH_IV_MRG_F0125
    5553   Bool bIsDepth = getSlice()->getIsDepth();
    5554   Bool bDepthIPMCAvai = false;
    5555 #endif
    5556 
    5557 #if LGE_SHARP_VSP_INHERIT_F0104
    5558 #if H_3D_IC
    5559   Bool bICFlag = getICFlag(uiAbsPartIdx);
    5560 #endif
    5561 #if H_3D_ARP
    5562   Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
    5563 #endif
    5564 #endif
    5565 
    5566 #if H_3D_IV_MERGE
    5567  
    5568   /////////////////////////////////////////////
    5569   //////// TEXTURE MERGE CANDIDATE (T) ////////
    5570   /////////////////////////////////////////////
    5571 
    5572 #if SEC_MPI_ENABLING_MERGE_F0150
    5573   if( bMPIFlag)
    5574 #else
    5575   if( m_pcSlice->getIsDepth())
    5576 #endif
    5577   {
    5578     UInt uiPartIdxCenter;
    5579     xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );   
    5580 #if H_3D_FCO
    5581     TComPic * pcTexturePic = m_pcSlice->getTexturePic();
    5582     TComDataCU *pcTextureCU = 0;
    5583     if ( pcTexturePic )
    5584         pcTextureCU = pcTexturePic->getCU( getAddr() );
    5585 #else
    5586     TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
    5587 #endif
    5588  
    5589 #if H_3D_FCO
    5590     if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) )
    5591 #else
    5592     if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
    5593 #endif
    5594     {
    5595       pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
    5596       Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1].getRefIdx() );
    5597       if( (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0) && ( iValidDepRef >= 0 ) )
    5598       {
    5599         TComMv cMvPred = pcMvFieldNeighbours[iCount<<1].getMv();
    5600         const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
    5601         cMvPred+=cAdd;
    5602         cMvPred>>=2;
    5603         clipMv(cMvPred);
    5604         pcMvFieldNeighbours[iCount<<1].setMvField(cMvPred,iValidDepRef);
    5605       }
    5606 
    5607       if ( getSlice()->isInterB() )
    5608       {
    5609         pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    5610         iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx() );
    5611         if( (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0) && ( iValidDepRef >= 0) )
    5612         {
    5613           TComMv cMvPred = pcMvFieldNeighbours[(iCount<<1)+1].getMv();
    5614           const TComMv cAdd( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
    5615           cMvPred+=cAdd;
    5616           cMvPred>>=2;
    5617           clipMv(cMvPred);
    5618           pcMvFieldNeighbours[(iCount<<1)+1].setMvField(cMvPred,iValidDepRef);
    5619         }
    5620       }
    5621 
    5622       puhInterDirNeighbours[iCount] = (pcMvFieldNeighbours[iCount<<1].getRefIdx()>=0)?1:0;
    5623       puhInterDirNeighbours[iCount] += (pcMvFieldNeighbours[(iCount<<1)+1].getRefIdx()>=0)?2:0;
    5624 
    5625       if( puhInterDirNeighbours[iCount] != 0 )
    5626       {
    5627         abCandIsInter[iCount] = true;
    5628         if ( mrgCandIdx == iCount )
    5629         {
    5630           return;
    5631         }
    5632         iCount ++;
    5633       }
    5634     }
    5635   }
    5636 
    5637   //////////////////////////////////
    5638   //////// GET DISPARITIES  ////////
    5639   //////////////////////////////////
    5640 
    5641   DisInfo cDisInfo = getDvInfo(uiAbsPartIdx);
    5642 
    5643   for(Int i = 0; i < MRG_MAX_NUM_CANDS_MEM; i++)
    5644   {
    5645     inheritedVSPDisInfo[i].m_acDvInfo = cDisInfo;
    5646   }
    5647 
    5648   /////////////////////////////////////////////////////////////////
    5649   //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC  Candidates /////
    5650   /////////////////////////////////////////////////////////////////
    5651 
    5652   Int  posIvDC          = -1;
    5653   Bool bLeftAvai        = false;
    5654   Int  iPosLeftAbove[2] = {-1, -1};
    5655 
    5656 
    5657   // { IvMCL0, IvMCL1, IvDCL0, IvDCL1, IvMCL0Shift, IvMCL1Shift, IvDCL0Shift, IvDCL1Shift }; 
    5658   // An enumerator would be appropriate here!
    5659   TComMv ivCandMv    [8];
    5660   Int    ivCandRefIdx[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
    5661 
    5662   // { IvMC, IvDC, IvMCShift, IvDCShift }; 
    5663   Int    ivCandDir   [4] = {0, 0, 0, 0};
    5664 
    5665   Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
    5666  
    5667   if ( ivMvPredFlag )
    5668   {
    5669     getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir
    5670 #if QC_DEPTH_IV_MRG_F0125
    5671     , bIsDepth
    5672 #endif
    5673     );
    5674   } 
    5675  
    5676   ///////////////////////////////////////////////
    5677   //////// INTER VIEW MOTION COMP(IvMC) /////////
    5678   ///////////////////////////////////////////////
    5679 
    5680   if( ivCandDir[0] )
    5681   {
    5682     abCandIsInter        [ iCount ] = true;
    5683     puhInterDirNeighbours[ iCount ] = ivCandDir[0];   
    5684 
    5685     if( ( ivCandDir[0] & 1 ) == 1 )
    5686     {
    5687       pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 0 ], ivCandRefIdx[ 0 ] );
    5688     }
    5689     if( ( ivCandDir[0] & 2 ) == 2 )
    5690     {
    5691       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 1 ], ivCandRefIdx[ 1 ] );
    5692     }
    5693 
    5694 #if QC_DEPTH_IV_MRG_F0125
    5695     if ( bIsDepth )
    5696     {
    5697       Bool bRemoveSpa = false;
    5698       Int iCnloop = iCount-1;
    5699       for(; iCnloop >= 0; iCnloop --)
    5700       {
    5701         if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    5702         {
    5703           bRemoveSpa                      = true;
    5704           abCandIsInter        [ iCount ] = false;
    5705 
    5706           puhInterDirNeighbours[iCount]   = 0;
    5707           pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
    5708           pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    5709           break;
    5710         }
    5711       }
    5712       if(!bRemoveSpa)
    5713       {
    5714         bDepthIPMCAvai = true;
    5715       }
    5716     }
    5717     if ( bDepthIPMCAvai || !bIsDepth )
    5718     {
    5719 #endif
    5720     if ( mrgCandIdx == iCount )
    5721     {
    5722       return;
    5723     }
    5724     iCount ++;
    5725 #if QC_DEPTH_IV_MRG_F0125
    5726     }
    5727 #endif
    5728   }
    5729 
    5730   // early termination
    5731   if (iCount == getSlice()->getMaxNumMergeCand())
    5732   {
    5733     return;
    5734   }
    5735 #endif
    5736 
    5737 #if H_3D
    5738   ////////////////////////////
    5739   //////// LEFT (A1) /////////
    5740   ////////////////////////////
    5741 #endif
     4859
    57424860  //left
    57434861  UInt uiLeftPartIdx = 0;
     
    57594877      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    57604878    }
    5761 #if H_3D_IV_MERGE
    5762     Bool bRemoveSpa = false; //pruning to inter-view candidates
    5763 #if QC_DEPTH_IV_MRG_F0125
    5764     Int  iCnloop = bDepthIPMCAvai ? (iCount-2): (iCount-1);
    5765 #else
    5766     Int  iCnloop    = iCount - 1;
    5767 #endif
    5768     for(; iCnloop >= 0; iCnloop --)
    5769     {
    5770       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    5771       {
    5772         bRemoveSpa                      = true;
    5773         abCandIsInter        [ iCount ] = false;
    5774 
    5775         //reset to the default value for MC
    5776         puhInterDirNeighbours[iCount]   = 0;
    5777         pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
    5778         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    5779         break;
    5780       }
    5781     }
    5782     if(!bRemoveSpa)
    5783     {
    5784       bLeftAvai = true;
    5785       iPosLeftAbove[0] = iCount;
    5786 #if H_3D_NBDV
    5787       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    5788       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    5789 #endif
    5790 #if H_3D_VSP
    5791       if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
    5792 #if LGE_SHARP_VSP_INHERIT_F0104
    5793 #if H_3D_IC
    5794           && !bICFlag
    5795 #endif
    5796 #if H_3D_ARP
    5797           && !bARPFlag
    5798 #endif
    5799 #endif
    5800           )
    5801       {
    5802         vspFlag[iCount] = 1;
    5803 #if !MTK_VSP_SIMPLIFICATION_F0111
    5804         xInheritVSPDisInfo(pcCULeft,uiLeftPartIdx,iCount,inheritedVSPDisInfo);
    5805 #endif
    5806       }
    5807 #endif
    5808       if ( mrgCandIdx == iCount )
    5809       {
    5810         return;
    5811       }
    5812       iCount ++;
    5813     }
    5814 #else // H_3D_IV_MERGE
    58154879    if ( mrgCandIdx == iCount )
    58164880    {
     
    58184882    }
    58194883    iCount ++;
    5820 #endif // H_3D_IV_MERGE
    58214884  }
    58224885 
     
    58264889    return;
    58274890  }
    5828 #if H_3D
    5829   ////////////////////////////
    5830   //////// ABOVE (B1) ////////
    5831   ////////////////////////////
    5832 #endif
     4891
    58334892  // above
    58344893  UInt uiAbovePartIdx = 0;
     
    58504909      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    58514910    }
    5852 #if H_3D_IV_MERGE
    5853     Bool bRemoveSpa = false; //pruning to inter-view candidates
    5854 #if QC_DEPTH_IV_MRG_F0125
    5855     Int iCnloop;
    5856     if( bIsDepth )
    5857       iCnloop = (bLeftAvai && bDepthIPMCAvai) ? (iCount-3) : ((bLeftAvai || bDepthIPMCAvai)  ? (iCount-2): (iCount-1));
    5858     else
    5859       iCnloop = bLeftAvai? (iCount-2): (iCount-1);
    5860 #else
    5861     Int  iCnloop    = bLeftAvai? (iCount-2): (iCount-1);
    5862 #endif
    5863     for(; iCnloop >= 0; iCnloop --)
    5864     {
    5865       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    5866       {
    5867         bRemoveSpa                      = true;
    5868         abCandIsInter        [ iCount ] = false;
    5869 
    5870         //reset to the default value for MC
    5871         puhInterDirNeighbours[iCount]   = 0;
    5872 
    5873         pcMvFieldNeighbours[iCount<<1]    .setMvField( cZeroMv, NOT_VALID );
    5874         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    5875         break;
    5876       }
    5877     }
    5878 
    5879     if(!bRemoveSpa)
    5880     {
    5881       iPosLeftAbove[1] = iCount;
    5882 #if H_3D_NBDV
    5883       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    5884       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    5885 #endif
    5886 #if H_3D_VSP
    5887 #if MTK_VSP_SIMPLIFICATION_F0111
    5888       if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
    5889 #if LGE_SHARP_VSP_INHERIT_F0104
    5890 #if H_3D_IC
    5891           && !bICFlag
    5892 #endif
    5893 #if H_3D_ARP
    5894           && !bARPFlag
    5895 #endif
    5896 #endif
    5897           )
    5898 #else
    5899       if (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1
    5900 #if LGE_SHARP_VSP_INHERIT_F0104
    5901 #if H_3D_IC
    5902           && !bICFlag
    5903 #endif
    5904 #if H_3D_ARP
    5905           && !bARPFlag
    5906 #endif
    5907 #endif
    5908           )
    5909 #endif
    5910       {
    5911 
    5912         vspFlag[iCount] = 1;
    5913 #if !MTK_VSP_SIMPLIFICATION_F0111
    5914         xInheritVSPDisInfo(pcCUAbove,uiAbovePartIdx,iCount,inheritedVSPDisInfo);
    5915 #endif
    5916       }
    5917 #endif
    5918       if ( mrgCandIdx == iCount )
    5919       {
    5920         return;
    5921       }
    5922       iCount ++;
    5923     }
    5924 #else // H_3D_IV_MERGE
     4911
    59254912    if ( mrgCandIdx == iCount )
    59264913    {
     
    59284915    }
    59294916    iCount ++;
    5930 #endif // H_3D_IV_MERGE
    59314917  }
    59324918  // early termination
     
    59364922  }
    59374923
    5938 #if H_3D
    5939   //////////////////////////////////
    5940   //////// ABOVE RIGHT (B0) ////////
    5941   //////////////////////////////////
    5942 #endif
    59434924
    59444925  // above right
     
    59604941      pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    59614942    }
    5962 #if H_3D_NBDV
    5963     pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    5964     pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    5965 #endif
    5966 #if H_3D_VSP
    5967 #if MTK_VSP_SIMPLIFICATION_F0111
    5968     if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
    5969 #if LGE_SHARP_VSP_INHERIT_F0104
    5970 #if H_3D_IC
    5971         && !bICFlag
    5972 #endif
    5973 #if H_3D_ARP
    5974         && !bARPFlag
    5975 #endif
    5976 #endif
    5977         )
    5978 #else
    5979     if (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1
    5980 #if LGE_SHARP_VSP_INHERIT_F0104
    5981 #if H_3D_IC
    5982         && !bICFlag
    5983 #endif
    5984 #if H_3D_ARP
    5985         && !bARPFlag
    5986 #endif
    5987 #endif
    5988         )
    5989 #endif
    5990     {
    5991       vspFlag[iCount] = 1;
    5992 #if !MTK_VSP_SIMPLIFICATION_F0111
    5993       xInheritVSPDisInfo(pcCUAboveRight,uiAboveRightPartIdx,iCount,inheritedVSPDisInfo);
    5994 #endif
    5995     }
    5996 #endif
    59974943    if ( mrgCandIdx == iCount )
    59984944    {
     
    60064952    return;
    60074953  }
    6008 
    6009 #if H_3D_IV_MERGE
    6010   /////////////////////////////////////////////
    6011   //////// INTER VIEW DISP COMP (IvDC) ////////
    6012   /////////////////////////////////////////////
    6013 
    6014   if( ivCandDir[1] )
    6015   {
    6016     assert(iCount < getSlice()->getMaxNumMergeCand());
    6017     abCandIsInter        [ iCount ] = true;
    6018     puhInterDirNeighbours[ iCount ] = ivCandDir[1];
    6019     if( ( ivCandDir[1] & 1 ) == 1 )
    6020     {
    6021       pcMvFieldNeighbours[ iCount<<1    ].setMvField( ivCandMv[ 2 ], ivCandRefIdx[ 2 ] );
    6022     }
    6023     if( ( ivCandDir[1] & 2 ) == 2 )
    6024     {
    6025       pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField( ivCandMv[ 3 ], ivCandRefIdx[ 3 ] );
    6026     }
    6027 
    6028     Bool bRemoveSpa = false; //pruning to A1, B1
    6029     for(Int i = 0; i < 2; i ++)
    6030     {
    6031       Int iCnloop = iPosLeftAbove[i];
    6032       if ( iCnloop == -1 )
    6033       {
    6034         continue;
    6035       }
    6036       if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
    6037       {
    6038         bRemoveSpa                      = true;
    6039         abCandIsInter        [ iCount ] = false;
    6040         //reset to the default value for MC
    6041         puhInterDirNeighbours[iCount]   = 0;
    6042         pcMvFieldNeighbours[iCount<<1].setMvField( cZeroMv, NOT_VALID );
    6043         pcMvFieldNeighbours[(iCount<<1)+1].setMvField( cZeroMv, NOT_VALID );
    6044         break;
    6045       }     
    6046     }
    6047     if(!bRemoveSpa)
    6048     {
    6049 #if H_3D_NBDV
    6050       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    6051       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    6052 #endif
    6053       posIvDC  = iCount;
    6054       if ( mrgCandIdx == iCount )
    6055         return;
    6056       iCount ++;
    6057 
    6058       // early termination
    6059       if (iCount == getSlice()->getMaxNumMergeCand())
    6060       {
    6061         return;
    6062       }
    6063     }
    6064   }
    6065 #endif // H_3D_IV_MERGE
    6066 
    6067 #if H_3D_VSP
    6068   /////////////////////////////////////////////////
    6069   //////// VIEW SYNTHESIS PREDICTION (VSP) ////////
    6070   /////////////////////////////////////////////////
    6071 
    6072   if (
    6073 #if LGE_SHARP_VSP_INHERIT_F0104
    6074 #if H_3D_IC
    6075       !bICFlag &&
    6076 #endif
    6077 #if H_3D_ARP
    6078       !bARPFlag &&
    6079 #endif
    6080 #endif
    6081       xAddVspCand( mrgCandIdx, &cDisInfo, iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag ) )
    6082   {
    6083     return;
    6084   }
    6085 
    6086   // early termination
    6087   if (iCount == getSlice()->getMaxNumMergeCand())
    6088   {
    6089     return;
    6090   }
    6091 #endif
    6092 #if H_3D
    6093   ///////////////////////////////////
    6094   //////// LEFT BOTTOM (A0) ////////
    6095   ///////////////////////////////////
    6096 #endif
    60974954
    60984955  //left bottom
     
    61144971      pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    61154972    }
    6116 #if H_3D_NBDV
    6117     pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    6118     pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    6119 #endif
    6120 #if H_3D_VSP
    6121     if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
    6122 #if LGE_SHARP_VSP_INHERIT_F0104
    6123 #if H_3D_IC
    6124         && !bICFlag
    6125 #endif
    6126 #if H_3D_ARP
    6127         && !bARPFlag
    6128 #endif
    6129 #endif
    6130         )
    6131     {
    6132       vspFlag[iCount] = 1;
    6133 #if !MTK_VSP_SIMPLIFICATION_F0111
    6134       xInheritVSPDisInfo(pcCULeftBottom,uiLeftBottomPartIdx,iCount,inheritedVSPDisInfo);
    6135 #endif
    6136     }
    6137 #endif
     4973
    61384974    if ( mrgCandIdx == iCount )
    61394975    {
     
    61474983    return;
    61484984  }
    6149 #if H_3D
    6150   ///////////////////////////////////
    6151   //////// LEFT ABOVE (B2) ////////
    6152   ///////////////////////////////////
    6153 #endif
    61544985
    61554986  // above left
     
    61745005        pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    61755006      }
    6176 #if H_3D_NBDV
    6177       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    6178       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    6179 #endif
    6180 #if H_3D_VSP
    6181 #if MTK_VSP_SIMPLIFICATION_F0111
    6182       if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
    6183 #if LGE_SHARP_VSP_INHERIT_F0104
    6184 #if H_3D_IC
    6185           && !bICFlag
    6186 #endif
    6187 #if H_3D_ARP
    6188           && !bARPFlag
    6189 #endif
    6190 #endif
    6191           )
    6192 #else
    6193       if (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1
    6194 #if LGE_SHARP_VSP_INHERIT_F0104
    6195 #if H_3D_IC
    6196           && !bICFlag
    6197 #endif
    6198 #if H_3D_ARP
    6199           && !bARPFlag
    6200 #endif
    6201 #endif
    6202           )
    6203 #endif
    6204       {
    6205         vspFlag[iCount] = 1;
    6206 #if !MTK_VSP_SIMPLIFICATION_F0111
    6207         xInheritVSPDisInfo(pcCUAboveLeft,uiAboveLeftPartIdx,iCount,inheritedVSPDisInfo);
    6208 #endif
    6209       }
    6210 #endif
    62115007      if ( mrgCandIdx == iCount )
    62125008      {
     
    62215017    return;
    62225018  }
    6223 #if H_3D_IV_MERGE
    6224   ////////////////////////////////////////////////////
    6225   //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
    6226   ////////////////////////////////////////////////////
    6227 
    6228   if(  ivMvPredFlag  )
    6229   {
    6230     if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag))
    6231     {
    6232       return;
    6233     }
    6234     //early termination
    6235     if (iCount == getSlice()->getMaxNumMergeCand())
    6236     {
    6237       return;
    6238     }
    6239   }
    6240 #endif
    6241 #if H_3D
    6242   /////////////////////////////////
    6243   //////// Collocate (COL) ////////
    6244   /////////////////////////////////
    6245 #endif
     5019
    62465020  if ( getSlice()->getEnableTMVPFlag())
    62475021  {
     
    63085082    if ( getSlice()->isInterB() )
    63095083    {
    6310 #if H_3D_TMVP
    6311       iRefIdx = 0;
    6312 #endif
    63135084      bExistMV = uiLCUIdx >= 0 && xGetColMVP( REF_PIC_LIST_1, uiLCUIdx, uiAbsPartAddr, cColMv, iRefIdx);
    63145085      if( bExistMV == false )
     
    63275098      puhInterDirNeighbours[uiArrayAddr] = dir;
    63285099      abCandIsInter[uiArrayAddr] = true;
    6329 #if H_3D_NBDV
    6330       pcMvFieldNeighbours[iCount<<1    ].getMv().setIDVFlag (false);
    6331       pcMvFieldNeighbours[(iCount<<1)+1].getMv().setIDVFlag (false);
    6332 #endif
    63335100      if ( mrgCandIdx == iCount )
    63345101      {
     
    63485115  if ( getSlice()->isInterB())
    63495116  {
    6350 #if H_3D_IV_MERGE
    6351     UInt uiPriorityList0[20] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3,    0, 4, 1, 4, 2, 4, 3, 4 };
    6352     UInt uiPriorityList1[20] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2,    4, 0, 4, 1, 4, 2, 4, 3 };
    6353 #else
    63545117    UInt uiPriorityList0[12] = {0 , 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3};
    63555118    UInt uiPriorityList1[12] = {1 , 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2};
    6356 #endif
    63575119
    63585120    for (Int idx=0; idx<uiCutoff*(uiCutoff-1) && uiArrayAddr!= getSlice()->getMaxNumMergeCand(); idx++)
    63595121    {
    63605122      Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
    6361 #if H_3D_VSP
    6362       Bool bValid = true;
    6363       if ( vspFlag[i] == 1 || vspFlag[j] == 1 )
    6364       {
    6365         bValid = false;
    6366       }
    6367       if( !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) )
    6368       {
    6369         assert(bValid == true);
    6370       }
    6371 #endif
    6372 #if H_3D_VSP
    6373       if (abCandIsInter[i] && abCandIsInter[j] && (puhInterDirNeighbours[i]&0x1) && (puhInterDirNeighbours[j]&0x2) && bValid)
    6374 #else
    63755123      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
    6376 #endif
    63775124      {
    63785125        abCandIsInter[uiArrayAddr] = true;
     
    64295176  numValidMergeCand = uiArrayAddr;
    64305177}
    6431 
    6432 
    64335178#endif
    64345179
     
    67705515}
    67715516
    6772 #if LGE_IC_CTX_F0160
     5517#if H_3D_IC
    67735518Bool TComDataCU::isIC( UInt uiPartIdx )
    67745519{
     
    86397384  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; }
    86407385}
    8641 #if !SEC_DMM3_RBC_F0147
    8642 Void  TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth )
    8643 {
    8644   UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
    8645   for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm3IntraTabIdx[uiAbsPartIdx+ui] = uiTIdx; }
    8646 }
    8647 #endif
    8648 #endif
    8649 #if H_3D_DIM_RBC
    8650 Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion )
    8651 {
    8652   Int iWidth;
    8653   Int iHeight;
    8654   if( uiDepth == 0 )
    8655   {
    8656     iWidth = 64;
    8657     iHeight = 64;
    8658   }
    8659   else if( uiDepth == 1 )
    8660   {
    8661     iWidth = 32;
    8662     iHeight = 32;
    8663   }
    8664   else if( uiDepth == 2 )
    8665   {
    8666     iWidth = 16;
    8667     iHeight = 16;
    8668   }
    8669   else if( uiDepth == 3 )
    8670   {
    8671     iWidth = 8;
    8672     iHeight = 8;
    8673   }
    8674   else // uiDepth == 4
    8675   {
    8676     iWidth = 4;
    8677     iHeight = 4;
    8678   }
    8679 
    8680   Int iPtr = 0;
    8681   Int iX, iY;
    8682   Int iDir = -1;
    8683   Int iDiffX = 0, iDiffY = 0;
    8684 
    8685   // 1. Edge Code -> Vert & Horz Edges
    8686   Bool*  pbEdge = (Bool*) xMalloc( Bool, 4 * iWidth * iHeight );
    8687 
    8688   for( UInt ui = 0; ui < 4 * iWidth * iHeight; ui++ )
    8689     pbEdge  [ ui ] = false;
    8690 
    8691   // Direction : left(0), right(1), top(2), bottom(3), left-top(4), right-top(5), left-bottom(6), right-bottom(7)
    8692   // Code      : 0deg(0), 45deg(1), -45deg(2), 90deg(3), -90deg(4), 135deg(5), -135deg(6)
    8693   const UChar tableDir[8][7] = { { 0, 6, 4, 3, 2, 7, 5 },
    8694   { 1, 5, 7, 2, 3, 4, 6 },
    8695   { 2, 4, 5, 0, 1, 6, 7 },
    8696   { 3, 7, 6, 1, 0, 5, 4 },
    8697   { 4, 0, 2, 6, 5, 3, 1 },
    8698   { 5, 2, 1, 4, 7, 0, 3 },
    8699   { 6, 3, 0, 7, 4, 1, 2 },
    8700   { 7, 1, 3, 5, 6, 2, 0 }};
    8701 
    8702   UChar ucCode = pucEdgeCode[iPtr++];
    8703 
    8704   if( !bLeft )
    8705   {
    8706     iX = ucStartPos;
    8707     iY = 0;
    8708 
    8709     switch(ucCode)
    8710     {
    8711     case 0: // bottom
    8712       iDir = 3;
    8713       if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8714       break;
    8715     case 2: // left-bottom
    8716       iDir = 6;
    8717       if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8718       break;
    8719     case 1: // right-bottom
    8720       iDir = 7;
    8721       if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8722       if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8723       break;
    8724     case 4: // left
    8725       iDir = 0;
    8726       assert(false);
    8727       break;
    8728     case 3: // right
    8729       iDir = 1;
    8730       if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8731       if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8732       break;
    8733     }
    8734   }
    8735   else
    8736   {
    8737     iX = 0;
    8738     iY = ucStartPos;
    8739 
    8740     switch(ucCode)
    8741     {
    8742     case 0: // right
    8743       iDir = 1;
    8744       if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8745       break;
    8746     case 1: // right-top
    8747       iDir = 5;
    8748       if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8749       if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8750       break;
    8751     case 2: // right-bottom
    8752       iDir = 7;
    8753       if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8754       break;
    8755     case 3: // top
    8756       iDir = 2;
    8757       if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8758       if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8759       break;
    8760     case 4: // bottom
    8761       iDir = 3;
    8762       assert(false);
    8763       break;
    8764     }
    8765   }
    8766 
    8767   switch( iDir )
    8768   {
    8769   case 0: // left
    8770     iDiffX = -1;
    8771     iDiffY = 0;
    8772     break;
    8773   case 1: // right
    8774     iDiffX = +1;
    8775     iDiffY = 0;
    8776     break;
    8777   case 2: // top
    8778     iDiffX = 0;
    8779     iDiffY = -1;
    8780     break;
    8781   case 3: // bottom
    8782     iDiffX = 0;
    8783     iDiffY = +1;
    8784     break;
    8785   case 4: // left-top
    8786     iDiffX = -1;
    8787     iDiffY = -1;
    8788     break;
    8789   case 5: // right-top
    8790     iDiffX = +1;
    8791     iDiffY = -1;
    8792     break;
    8793   case 6: // left-bottom
    8794     iDiffX = -1;
    8795     iDiffY = +1;
    8796     break;
    8797   case 7: // right-bottom
    8798     iDiffX = +1;
    8799     iDiffY = +1;
    8800     break;
    8801   }
    8802 
    8803   iX += iDiffX;
    8804   iY += iDiffY;
    8805 
    8806   while( iPtr < ucNumEdge )
    8807   {
    8808     ucCode = pucEdgeCode[iPtr++];
    8809 
    8810     Int iNewDir = tableDir[iDir][ucCode];
    8811 
    8812     switch( iNewDir )
    8813     {
    8814     case 0: // left
    8815       iDiffX = -1;
    8816       iDiffY = 0;
    8817       break;
    8818     case 1: // right
    8819       iDiffX = +1;
    8820       iDiffY = 0;
    8821       break;
    8822     case 2: // top
    8823       iDiffX = 0;
    8824       iDiffY = -1;
    8825       break;
    8826     case 3: // bottom
    8827       iDiffX = 0;
    8828       iDiffY = +1;
    8829       break;
    8830     case 4: // left-top
    8831       iDiffX = -1;
    8832       iDiffY = -1;
    8833       break;
    8834     case 5: // right-top
    8835       iDiffX = +1;
    8836       iDiffY = -1;
    8837       break;
    8838     case 6: // left-bottom
    8839       iDiffX = -1;
    8840       iDiffY = +1;
    8841       break;
    8842     case 7: // right-bottom
    8843       iDiffX = +1;
    8844       iDiffY = +1;
    8845       break;
    8846     }
    8847 
    8848     switch( iDir )
    8849     {
    8850     case 0: // left
    8851       switch( ucCode )
    8852       {
    8853       case 0:
    8854       case 2:
    8855         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8856         break;
    8857       case 1:
    8858       case 3:
    8859         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8860         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8861         break;
    8862       case 4:
    8863       case 6:
    8864         // no
    8865         break;
    8866       case 5:
    8867         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8868         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8869         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8870         break;
    8871       }
    8872       break;
    8873     case 1: // right
    8874       switch( ucCode )
    8875       {
    8876       case 0:
    8877       case 2:
    8878         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8879         break;
    8880       case 1:
    8881       case 3:
    8882         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8883         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8884         break;
    8885       case 4:
    8886       case 6:
    8887         // no
    8888         break;
    8889       case 5:
    8890         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8891         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8892         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8893         break;
    8894       }
    8895       break;
    8896     case 2: // top
    8897       switch( ucCode )
    8898       {
    8899       case 0:
    8900       case 2:
    8901         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8902         break;
    8903       case 1:
    8904       case 3:
    8905         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8906         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8907         break;
    8908       case 4:
    8909       case 6:
    8910         // no
    8911         break;
    8912       case 5:
    8913         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8914         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8915         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8916         break;
    8917       }
    8918       break;
    8919     case 3: // bottom
    8920       switch( ucCode )
    8921       {
    8922       case 0:
    8923       case 2:
    8924         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8925         break;
    8926       case 1:
    8927       case 3:
    8928         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8929         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8930         break;
    8931       case 4:
    8932       case 6:
    8933         // no
    8934         break;
    8935       case 5:
    8936         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8937         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8938         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8939         break;
    8940       }
    8941       break;
    8942     case 4: // left-top
    8943       switch( ucCode )
    8944       {
    8945       case 0:
    8946       case 1:
    8947         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8948         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8949         break;
    8950       case 2:
    8951       case 4:
    8952         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8953         break;
    8954       case 3:
    8955       case 5:
    8956         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8957         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8958         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8959         break;
    8960       case 6:
    8961         // no
    8962         break;
    8963       }
    8964       break;
    8965     case 5: // right-top
    8966       switch( ucCode )
    8967       {
    8968       case 0:
    8969       case 1:
    8970         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8971         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8972         break;
    8973       case 2:
    8974       case 4:
    8975         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8976         break;
    8977       case 3:
    8978       case 5:
    8979         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8980         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    8981         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    8982         break;
    8983       case 6:
    8984         // no
    8985         break;
    8986       }
    8987       break;
    8988     case 6: // left-bottom
    8989       switch( ucCode )
    8990       {
    8991       case 0:
    8992       case 1:
    8993         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8994         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    8995         break;
    8996       case 2:
    8997       case 4:
    8998         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    8999         break;
    9000       case 3:
    9001       case 5:
    9002         if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
    9003         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    9004         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    9005         break;
    9006       case 6:
    9007         // no
    9008         break;
    9009       }
    9010       break;
    9011     case 7: // right-bottom
    9012       switch( ucCode )
    9013       {
    9014       case 0:
    9015       case 1:
    9016         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    9017         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    9018         break;
    9019       case 2:
    9020       case 4:
    9021         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    9022         break;
    9023       case 3:
    9024       case 5:
    9025         if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
    9026         if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
    9027         if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
    9028         break;
    9029       case 6:
    9030         // no
    9031         break;
    9032       }
    9033       break;
    9034     }
    9035 
    9036     assert( iX >= 0 && iX <= iWidth );
    9037     assert( iY >= 0 && iY <= iHeight );
    9038 
    9039     iX += iDiffX;
    9040     iY += iDiffY;
    9041     iDir = iNewDir;
    9042   }
    9043 
    9044   // finalize edge chain
    9045   if( iX == iWidth-1 )
    9046   {
    9047     if( iY == 0 )
    9048     {
    9049       if( iDir == 1 )
    9050       {
    9051         pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
    9052       }
    9053       else if( iDir == 5 )
    9054       {
    9055         pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
    9056       }
    9057       else
    9058       {
    9059         assert(false);
    9060       }
    9061     }
    9062     else if( iY == iHeight-1 )
    9063     {
    9064       if( iDir == 3 )
    9065       {
    9066         pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
    9067       }
    9068       else if( iDir == 7 )
    9069       {
    9070         pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
    9071       }
    9072       else
    9073       {
    9074         assert(false);
    9075       }
    9076     }
    9077     else
    9078     {
    9079       if( iDir == 1 )
    9080       {
    9081         pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
    9082       }
    9083       else if( iDir == 3 )
    9084       {
    9085         pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
    9086         pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
    9087       }
    9088       else if( iDir == 5 )
    9089       {
    9090         pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
    9091       }
    9092       else if( iDir == 7 )
    9093       {
    9094         pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
    9095         pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
    9096       }
    9097       else
    9098       {
    9099         assert(false);
    9100       }
    9101     }
    9102   }
    9103   else if( iX == 0 )
    9104   {
    9105     if( iY == 0 )
    9106     {
    9107       if( iDir == 2 )
    9108       {
    9109         pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
    9110       }
    9111       else if( iDir == 4 )
    9112       {
    9113         pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
    9114       }
    9115       else
    9116       {
    9117         assert(false);
    9118       }
    9119     }
    9120     else if( iY == iHeight-1 )
    9121     {
    9122       if( iDir == 0 )
    9123       {
    9124         pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
    9125       }
    9126       else if( iDir == 6 )
    9127       {
    9128         pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
    9129       }
    9130       else
    9131       {
    9132         assert(false);
    9133       }
    9134     }
    9135     else
    9136     {
    9137       if( iDir == 0 )
    9138       {
    9139         pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
    9140       }
    9141       else if( iDir == 2 )
    9142       {
    9143         pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
    9144         pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
    9145       }
    9146       else if( iDir == 4 )
    9147       {
    9148         pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
    9149         pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
    9150       }
    9151       else if( iDir == 6 )
    9152       {
    9153         pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
    9154       }
    9155       else
    9156       {
    9157         assert(false);
    9158       }
    9159     }
    9160   }
    9161   else if( iY == 0 )
    9162   {
    9163     if( iDir == 1 )
    9164     {
    9165       pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
    9166       pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
    9167     }
    9168     else if( iDir == 2 )
    9169     {
    9170       pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
    9171     }
    9172     else if( iDir == 4 )
    9173     {
    9174       pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
    9175     }
    9176     else if( iDir == 5 )
    9177     {
    9178       pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
    9179       pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
    9180     }
    9181     else
    9182     {
    9183       assert(false);
    9184     }
    9185   }
    9186   else if( iY == iHeight-1 )
    9187   {
    9188     if( iDir == 0 )
    9189     {
    9190       pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
    9191       pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
    9192     }
    9193     else if( iDir == 3 )
    9194     {
    9195       pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
    9196     }
    9197     else if( iDir == 6 )
    9198     {
    9199       pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
    9200       pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
    9201     }
    9202     else if( iDir == 7 )
    9203     {
    9204       pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
    9205     }
    9206     else
    9207     {
    9208       assert(false);
    9209     }
    9210   }
    9211   else
    9212   {
    9213     printf("reconPartiton: wrong termination\n");
    9214     assert(false);
    9215   }
    9216 
    9217   // Reconstruct Region from Chain Code
    9218   Bool* pbVisit  = (Bool*) xMalloc( Bool, iWidth * iHeight );
    9219   Int*  piStack  = (Int* ) xMalloc( Int,  iWidth * iHeight );
    9220 
    9221   for( UInt ui = 0; ui < iWidth * iHeight; ui++ )
    9222   {
    9223     pbRegion[ ui ] = true; // fill it as region 1 (we'll discover region 0 next)
    9224     pbVisit [ ui ] = false;
    9225   }
    9226 
    9227   iPtr = 0;
    9228   piStack[iPtr++] = (0 << 8) | (0);
    9229   pbRegion[ 0 ] = false;
    9230 
    9231   while(iPtr > 0)
    9232   {
    9233     Int iTmp = piStack[--iPtr];
    9234     Int iX1, iY1;
    9235     iX1 = iTmp & 0xff;
    9236     iY1 = (iTmp >> 8) & 0xff;
    9237 
    9238     pbVisit[ iX1 + iY1 * iWidth ] = true;
    9239 
    9240     assert( iX1 >= 0 && iX1 < iWidth );
    9241     assert( iY1 >= 0 && iY1 < iHeight );
    9242 
    9243     if( iX1 > 0 && !pbEdge[ 2 * iX1 - 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 - 1 + iY1 * iWidth ] )
    9244     {
    9245       piStack[iPtr++] = (iY1 << 8) | (iX1 - 1);
    9246       pbRegion[ iX1 - 1 + iY1 * iWidth ] = false;
    9247     }
    9248     if( iX1 < iWidth - 1 && !pbEdge[ 2 * iX1 + 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 + 1 + iY1 * iWidth ] )
    9249     {
    9250       piStack[iPtr++] = (iY1 << 8) | (iX1 + 1);
    9251       pbRegion[ iX1 + 1 + iY1 * iWidth ] = false;
    9252     }
    9253     if( iY1 > 0 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 - 1) * iWidth ] && !pbVisit[ iX1 + (iY1 - 1) * iWidth ] )
    9254     {
    9255       piStack[iPtr++] = ((iY1 - 1) << 8) | iX1;
    9256       pbRegion[ iX1 + (iY1 - 1) * iWidth ] = false;
    9257     }
    9258     if( iY1 < iHeight - 1 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 + 1) * iWidth ] && !pbVisit[ iX1 + (iY1 + 1) * iWidth ] )
    9259     {
    9260       piStack[iPtr++] = ((iY1 + 1) << 8) | iX1;
    9261       pbRegion[ iX1 + (iY1 + 1) * iWidth ] = false;
    9262     }
    9263   }
    9264 
    9265   xFree( pbEdge );
    9266   xFree( pbVisit );
    9267   xFree( piStack );
    9268 }
    92697386#endif
    92707387
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/TComDataCU.h

    r724 r764  
    212212#if H_3D_DIM_DMM
    213213  UInt*         m_dmmWedgeTabIdx[DMM_NUM_TYPE];
    214 #if !SEC_DMM3_RBC_F0147
    215   UInt*         m_dmm3IntraTabIdx;
    216 #endif
    217 #endif
    218 #if H_3D_DIM_RBC
    219   UChar*        m_pucEdgeCode;          ///< array of edge code
    220   UChar*        m_pucEdgeNumber;        ///< total number of edge
    221   UChar*        m_pucEdgeStartPos;      ///< starting point position
    222   Bool*         m_pbEdgeLeftFirst;      ///< true if edge should be checked in left boundary first
    223   Bool*         m_pbEdgePartition;      ///< true if it belongs to region 1, otherwise, region 0
    224214#endif
    225215#if H_3D_DIM_SDC
     
    233223  UChar*        m_pucInterSDCMask;
    234224#endif
    235 #if ETRIKHU_MERGE_REUSE_F0093
     225#if H_3D
    236226  Bool          m_bAvailableFlagA1;    ///< A1 available flag
    237227  Bool          m_bAvailableFlagB1;    ///< B1 available flag
     
    256246  UInt*         m_sliceSegmentStartCU; ///< Start CU address of current slice
    257247  Char          m_codedQP;
    258 #if ETRIKHU_MERGE_REUSE_F0093
     248#if H_3D
    259249  DisInfo       m_cDefaultDisInfo;    ///< Default disparity information for initializing
    260250#endif
     
    266256  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    267257#if H_3D_VSP
    268 #if ETRIKHU_MERGE_REUSE_F0093
    269258  Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
    270259                             Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo);
    271 #else
    272   Bool          xAddVspCand( Int mrgCandIdx, DisInfo* pDInfo, Int& iCount,
    273                              Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag );
    274 #endif
    275260#endif
    276261#if H_3D_IV_MERGE
    277 #if ETRIKHU_MERGE_REUSE_F0093
    278262  Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv,
    279263                               Int* ivCandRefIdx, Int posIvDC, Int* vspFlag, Int &iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo   );
    280 #else
    281   Bool          xAddIvMRGCand( Int mrgCandIdx, Int& iCount, Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int*   ivCandDir, TComMv* ivCandMv,
    282                                Int* ivCandRefIdx, Int posIvDC, Int* vspFlag );
    283 #endif
    284264  Bool          xGetPosFirstAvailDmvCand( Int iCount, TComMvField* pcMvFieldNeighbours, Int*  ivCandDir, Int posIvDC, Int* vspFlag, Int& iFirDispCand );
    285265#endif
     
    519499   );
    520500   
    521 #if ETRIKHU_MERGE_REUSE_F0093
     501#if H_3D
    522502  Void          rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV);
    523503#endif
     
    584564  Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
    585565
    586 #if !SEC_DMM3_RBC_F0147
    587   UInt* getDmm3IntraTabIdx            ()                      { return m_dmm3IntraTabIdx;        }
    588   UInt  getDmm3IntraTabIdx            ( UInt uiIdx )          { return m_dmm3IntraTabIdx[uiIdx]; }
    589   Void  setDmm3IntraTabIdx            ( UInt uiIdx, UInt uh ) { m_dmm3IntraTabIdx[uiIdx] = uh;   }
    590   Void  setDmm3IntraTabIdxSubParts    ( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth );
    591 #endif
    592 #endif
    593 #if H_3D_DIM_RBC
    594   UChar* getEdgeCode( UInt uiIdx )                 { return &m_pucEdgeCode[uiIdx * RBC_MAX_EDGE_NUM_PER_4x4]; }
    595 
    596   UChar* getEdgeNumber( )                          { return m_pucEdgeNumber;           }
    597   UChar  getEdgeNumber( UInt uiIdx )               { return m_pucEdgeNumber[uiIdx];    }
    598   Void   setEdgeNumber( UInt uiIdx, UChar val )    { m_pucEdgeNumber[uiIdx] = val;     }
    599 
    600   UChar* getEdgeStartPos( )                        { return m_pucEdgeStartPos;         }
    601   UChar  getEdgeStartPos( UInt uiIdx )             { return m_pucEdgeStartPos[uiIdx];  }
    602   Void   setEdgeStartPos( UInt uiIdx, UChar val )  { m_pucEdgeStartPos[uiIdx] = val;   }
    603 
    604   Bool*  getEdgeLeftFirst( )                       { return m_pbEdgeLeftFirst;         }
    605   Bool   getEdgeLeftFirst( UInt uiIdx )            { return m_pbEdgeLeftFirst[uiIdx];  }
    606   Void   setEdgeLeftFirst( UInt uiIdx, Bool val )  { m_pbEdgeLeftFirst[uiIdx] = val;   }
    607 
    608   Bool*  getEdgePartition( UInt uiIdx )            { return &m_pbEdgePartition[uiIdx * 16]; }
    609 
    610   Void   reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion );
    611566#endif
    612567#if H_3D_DIM_SDC
     
    704659  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    705660
    706 #if ETRIKHU_MERGE_REUSE_F0093
     661#if H_3D
    707662  Bool          getAvailableFlagA1() { return m_bAvailableFlagA1;}
    708663  Bool          getAvailableFlagB1() { return m_bAvailableFlagB1;}
     
    753708  Bool          isBipredRestriction( UInt puIdx );
    754709
    755 #if LGE_IC_CTX_F0160
     710#if H_3D_IC
    756711  Bool          isIC      ( UInt uiPartIdx );
    757712#endif
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/TComPrediction.cpp

    r758 r764  
    425425  Bool dimDeltaDC = isDimDeltaDC( uiIntraMode );   
    426426  Bool isDmmMode  = (dimType <  DMM_NUM_TYPE);
    427 #if !SEC_DMM3_RBC_F0147
    428   Bool isRbcMode  = (dimType == RBC_IDX);
    429 #endif
    430427
    431428  Bool* biSegPattern  = NULL;
     
    443440        dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
    444441      } break;
    445 #if !SEC_DMM3_RBC_F0147
    446     case( DMM3_IDX ):
    447       {
    448         UInt uiTabIdx = 0;
    449         if( bFastEnc ) { uiTabIdx = pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ); }
    450         else
    451         {
    452           uiTabIdx = xPredWedgeFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, pcCU->getDmm3IntraTabIdx( uiAbsPartIdx ) );
    453           pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, uiAbsPartIdx, (pcCU->getDepth(0) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1)) );
    454         }
    455         dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]);
    456       } break;
    457 #endif
    458442    case( DMM4_IDX ):
    459443      {
     
    468452  }
    469453#endif
    470 #if H_3D_DIM_RBC
    471   if( isRbcMode )
    472   {
    473     biSegPattern  = pcCU->getEdgePartition( uiAbsPartIdx );
    474     patternStride = iWidth;
    475   }
    476 #endif
    477454
    478455  // get predicted partition values
    479456  assert( biSegPattern );
    480457  Int* piMask = NULL;
    481 #if QC_DIM_DELTADC_UNIFY_F0132 || HHI_DIM_PREDSAMP_FIX_F0171
    482458  piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering
    483 #else
    484   if( isDmmMode ) piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering for DMM
    485   else            piMask = pcCU->getPattern()->getPredictorPtr( 0, g_aucConvertToBit[ iWidth ] + 2, m_piYuvExt );
    486 #endif
    487459  assert( piMask );
    488460  Int maskStride = 2*iWidth + 1; 
     
    499471    Pel deltaDC2 = pcCU->getDimDeltaDC( dimType, 1, uiAbsPartIdx );
    500472#if H_3D_DIM_DMM
    501 #if QC_DIM_DELTADC_UNIFY_F0132 && !SEC_DMM3_RBC_F0147
    502     if( isDmmMode || isRbcMode)
    503 #else
    504473    if( isDmmMode )
    505 #endif
    506474    {
    507475#if H_3D_DIM_DLT
    508 #if DLT_DIFF_CODING_IN_PPS
    509476      segDC1 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );
    510477      segDC2 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );
    511478#else
    512       segDC1 = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );
    513       segDC2 = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );
    514 #endif
    515 #else
    516479      segDC1 = ClipY( predDC1 + deltaDC1 );
    517480      segDC2 = ClipY( predDC2 + deltaDC2 );
    518481#endif
    519     }
    520 #endif
    521 #if H_3D_DIM_RBC && !QC_DIM_DELTADC_UNIFY_F0132
    522     if( isRbcMode )
    523     {
    524       xDeltaDCQuantScaleUp( pcCU, deltaDC1 );
    525       xDeltaDCQuantScaleUp( pcCU, deltaDC2 );
    526       segDC1 = ClipY( predDC1 + deltaDC1 );
    527       segDC2 = ClipY( predDC2 + deltaDC2 );
    528482    }
    529483#endif
     
    25642518
    25652519#if H_3D_DIM_DMM
    2566 #if !SEC_DMM3_RBC_F0147
    2567 UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx )
    2568 {
    2569   TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
    2570   assert( pcPicTex != NULL );
    2571   TComDataCU*   pcColTexCU = pcPicTex->getCU(pcCU->getAddr());
    2572   UInt          uiTexPartIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
    2573   Int           uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
    2574 
    2575   assert( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 );
    2576   return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx);
    2577 }
    2578 #endif
    25792520
    25802521Void TComPrediction::xPredContourFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge )
     
    26282569#endif
    26292570
    2630 #if H_3D_DIM_RBC
    2631 Void TComPrediction::xDeltaDCQuantScaleUp( TComDataCU* pcCU, Pel& rDeltaDC )
    2632 {
    2633   Int  iSign  = rDeltaDC < 0 ? -1 : 1;
    2634   UInt uiAbs  = abs( rDeltaDC );
    2635 
    2636   Int iQp = pcCU->getQP(0);
    2637   Double dMax = (Double)( 1<<( g_bitDepthY - 1 ) );
    2638   Double dStepSize = Clip3( 1.0, dMax, pow( 2.0, iQp/10.0 - 2.0 ) );
    2639 
    2640   rDeltaDC = iSign * roftoi( uiAbs * dStepSize );
    2641   return;
    2642 }
    2643 
    2644 Void TComPrediction::xDeltaDCQuantScaleDown( TComDataCU*  pcCU, Pel& rDeltaDC )
    2645 {
    2646   Int  iSign  = rDeltaDC < 0 ? -1 : 1;
    2647   UInt uiAbs  = abs( rDeltaDC );
    2648 
    2649   Int iQp = pcCU->getQP(0);
    2650   Double dMax = (Double)( 1<<( g_bitDepthY - 1 ) );
    2651   Double dStepSize = Clip3( 1.0, dMax, pow( 2.0, iQp/10.0 - 2.0 ) );
    2652 
    2653   rDeltaDC = iSign * roftoi( uiAbs / dStepSize );
    2654   return;
    2655 }
    2656 #endif
     2571
    26572572#if H_3D_DIM_SDC
    26582573Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/TComPrediction.h

    r724 r764  
    155155  Void xCopyTextureLumaBlock    ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );
    156156#endif
    157 #if H_3D_DIM_RBC
    158   Void xDeltaDCQuantScaleUp     ( TComDataCU* pcCU, Pel& rDeltaDC );
    159   Void xDeltaDCQuantScaleDown   ( TComDataCU* pcCU, Pel& rDeltaDC );
    160 #endif
    161157#endif
    162158
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/TComRom.cpp

    r738 r764  
    612612std::vector< std::vector<TComWedgeRef>  > g_dmmWedgeRefLists;
    613613std::vector< std::vector<TComWedgeNode> > g_dmmWedgeNodeLists;
    614 #if !SEC_DMM3_RBC_F0147
    615 std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
    616 #endif
    617614
    618615Void initWedgeLists( Bool initNodeList )
     
    733730  }
    734731
    735 #if !SEC_DMM3_RBC_F0147
    736   UInt uiThrSz = DMM3_SIMPLIFY_TR;
    737   std::vector< std::vector<UInt> > auiWdgListSz;
    738   for( Int idxM=2; idxM<=34 ; idxM++)
    739   {
    740     std::vector<UInt> auiWdgList;
    741     for( Int idxW=0; idxW<racWedgeList.size(); idxW++)
    742     {
    743       UInt uiAbsDiff = abs(idxM-(Int)racWedgeList[idxW].getAng());
    744       if( uiAbsDiff <= uiThrSz )
    745       {
    746         auiWdgList.push_back(idxW);
    747       }
    748     }
    749     auiWdgListSz.push_back(auiWdgList);
    750   }
    751   g_aauiWdgLstM3.push_back(auiWdgListSz);
    752 #endif
     732
    753733}
    754734
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/TComRom.h

    r738 r764  
    172172extern       std::vector< std::vector<TComWedgeRef> >        g_dmmWedgeRefLists;
    173173extern       std::vector< std::vector<TComWedgeNode> >       g_dmmWedgeNodeLists;
    174 #if !SEC_DMM3_RBC_F0147
    175 extern       std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
    176 #endif
    177174
    178175Void initWedgeLists( Bool initNodeList = false );
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/TComWedgelet.h

    r724 r764  
    5050enum DIM_IDX
    5151{
    52 #if SEC_DMM3_RBC_F0147
    5352  DMM1_IDX = 0,
    5453  DMM4_IDX = 1,
    55 #else
    56   DMM1_IDX = 0,
    57   DMM3_IDX = 1,
    58   DMM4_IDX = 2,
    59   RBC_IDX  = 3
    60 #endif
    6154};
    6255
    63 #if SEC_DMM3_RBC_F0147
    6456#define DMM_NUM_TYPE   2
    6557#define DIM_NUM_TYPE   (DMM_NUM_TYPE)
    66 #else
    67 #define DMM_NUM_TYPE   3
    68 #define RBC_NUM_TYPE   1
    69 #define DIM_NUM_TYPE   (DMM_NUM_TYPE+RBC_NUM_TYPE)
    70 #endif
    7158#define DIM_NO_IDX     MAX_UINT
    7259
     
    7663#endif
    7764
    78 #if H_3D_DIM_RBC
    79 #define RBC_THRESHOLD              20
    80 #define RBC_MAX_EDGE_NUM_PER_4x4   8
    81 #define RBC_MAX_DISTANCE           255
    82 #endif
    83 
    8465#if H_3D_DIM_DMM
    8566#define DMM_NO_WEDGEINDEX       MAX_UINT
    8667#define DMM_NUM_WEDGE_REFINES   8
    87 #if !SEC_DMM3_RBC_F0147
    88 #define DMM3_SIMPLIFY_TR        1
    89 #endif
    9068
    9169enum WedgeResolution
  • branches/HTM-9.2-dev0/source/Lib/TLibCommon/TypeDef.h

    r762 r764  
    104104                                              // SHARP_ILLUCOMP_REFINE_E0046
    105105                                              // MTK_CLIPPING_ALIGN_IC_E0168       // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168
     106                                              // LGE_IC_CTX_F0160 //JCT3V-F0160
     107                                              // SEC_ONLY_TEXTURE_IC_F0151
    106108
    107109#if H_3D_NBDV
     
    134136                                              // TEXTURE MERGING CANDIDATE     , JCT3V-C0137
    135137                                              // QC_INRIA_MTK_MRG_E0126
     138                                              // ETRIKHU_MERGE_REUSE_F0093
    136139
    137140
     
    160163                                              // LGE_SDC_REMOVE_DC_E0158 Removal of DC mode from SDC
    161164                                              // LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1   Removal of overlap between DMM3 and DMM1
     165                                              // LGE_PRED_RES_CODING_DLT_DOMAIN_F0159 JCT3V-F0159
     166                                              // HHI_DIM_PREDSAMP_FIX_F0171
     167                                              // SEC_DMM3_RBC_F0147 Removal of DMM3 and RBC from DMMs
     168                                              // QC_DIM_DELTADC_UNIFY_F0132 Unify delta DC coding in depth intra modes
    162169
    163170#define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
     
    317324
    318325#define FIX_MISSING_MACRO_R690                  1 // Missing macro in integration to revision 690
    319 
    320326#define SEC_MPI_ENABLING_MERGE_F0150            1 // MPI flag in VPS and enabling in Merge mode
    321 #define ETRIKHU_MERGE_REUSE_F0093               1 // Reuse HEVC merge candidate list construction for base candidates, JCT3V-F0093
    322327
    323328#if H_3D_ARP
     
    340345#define MTK_VSP_SIMPLIFICATION_F0111            1 // 1. Inherited VSP also use NBDV of current CU, 2. VSP cannot be inherited from above LCU rowss
    341346#define LGE_SHARP_VSP_INHERIT_F0104             1
    342 #endif
    343 
    344 #define LGE_BUGFIX_F0158                        1 //JCT3V-F0158
    345 #define LGE_IC_CTX_F0160                        1 //JCT3V-F0160
    346 #define SEC_ONLY_TEXTURE_IC_F0151               1
    347 
    348 #if H_3D_DIM
    349 #define SEC_DMM3_RBC_F0147                      1 // Removal of DMM3 and RBC from DMMs
    350 #if !SEC_DMM3_RBC_F0147
    351 #define H_3D_DIM_RBC                            1 // Region Boundary Chain mode
    352 #endif
    353 #define QC_DIM_DELTADC_UNIFY_F0132              1 // Unify delta DC coding in depth intra modes
    354 #define HHI_DIM_PREDSAMP_FIX_F0171              1
    355 #define LGE_PRED_RES_CODING_DLT_DOMAIN_F0159    1 //JCT3V-F0159
    356347#endif
    357348#endif
  • branches/HTM-9.2-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r758 r764  
    25502550    }
    25512551#if H_3D_IC
    2552 #if SEC_ONLY_TEXTURE_IC_F0151
    25532552    else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth())
    2554 #else
    2555     else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) )
    2556 #endif
    25572553    {
    25582554      UInt uiCodeTmp = 0;
  • branches/HTM-9.2-dev0/source/Lib/TLibDecoder/TDecCu.cpp

    r758 r764  
    390390    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
    391391
    392 #if LGE_SHARP_VSP_INHERIT_F0104
    393392#if H_3D_IC
    394393    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    396395#if H_3D_ARP
    397396    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
    398 #endif
    399397#endif
    400398
     
    411409    puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
    412410#endif
    413 #if ETRIKHU_MERGE_REUSE_F0093
    414411    m_ppcCU[uiDepth]->initAvailableFlags();
    415412    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     
    419416#endif
    420417      , numValidMergeCand, uiMergeIndex );
    421 #else
    422     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
    423 #endif
    424418    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    425419#else
    426 #if ETRIKHU_MERGE_REUSE_F0093
     420#if H_3D
    427421    m_ppcCU[uiDepth]->initAvailableFlags();
    428422    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     
    496490#endif
    497491#endif
    498 #if !LGE_SHARP_VSP_INHERIT_F0104
    499 #if H_3D_IC
    500     m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    501 #endif
    502 #if H_3D_ARP
    503     m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
    504 #endif
    505 #endif
    506492
    507493    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     
    534520  // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
    535521  m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
    536 #if !LGE_SHARP_VSP_INHERIT_F0104
    537 #if H_3D_IC
    538   m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    539 #endif
    540 #if H_3D_ARP
    541   m_pcEntropyDecoder->decodeARPW    ( pcCU , uiAbsPartIdx , uiDepth ); 
    542 #endif 
    543 #endif
    544522#if H_3D_INTER_SDC
    545523  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    780758    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    781759    {
    782 #if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
     760#if H_3D
    783761#if DLT_DIFF_CODING_IN_PPS
    784762      if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
     
    797775      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
    798776        }
    799 #else
    800       pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
    801777#endif
    802778      pRecIPred[ uiX ] = pReco[ uiX ];
  • branches/HTM-9.2-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp

    r735 r764  
    111111  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
    112112
    113 #if SEC_ONLY_TEXTURE_IC_F0151
    114113  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
    115 #else
    116   if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) )
    117 #endif
    118114  {
    119115    return;
     
    245241      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
    246242      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    247 #if LGE_SHARP_VSP_INHERIT_F0104
    248243#if H_3D_IC
    249244      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    251246#if H_3D_ARP
    252247      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    253 #endif
    254248#endif
    255249      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
     
    265259          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    266260#endif
    267 #if ETRIKHU_MERGE_REUSE_F0093
    268261          pcSubCU->initAvailableFlags();
    269262          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     
    273266#endif
    274267            , numValidMergeCand );
    275 #else
    276           pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
    277 #endif
    278268          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    279269
     
    283273          }
    284274#else
    285 #if ETRIKHU_MERGE_REUSE_F0093
     275#if H_3D
    286276          pcSubCU->initAvailableFlags();
    287277          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     
    306296        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
    307297#endif
    308 #if ETRIKHU_MERGE_REUSE_F0093
    309298        pcSubCU->initAvailableFlags();
    310299        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     
    314303#endif
    315304          ,numValidMergeCand, uiMergeIndex );
    316 #else
    317         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo,numValidMergeCand, uiMergeIndex );
    318 #endif
    319305        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    320306        if(vspFlag[uiMergeIndex])
     
    323309        }
    324310#else
    325 #if ETRIKHU_MERGE_REUSE_F0093
     311#if H_3D
    326312        pcSubCU->initAvailableFlags();
    327313        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     
    381367        }
    382368      }
    383 #if LGE_SHARP_VSP_INHERIT_F0104
    384369#if H_3D_IC
    385370      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    387372#if H_3D_ARP
    388373      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    389 #endif
    390374#endif
    391375    }
  • branches/HTM-9.2-dev0/source/Lib/TLibDecoder/TDecSbac.cpp

    r758 r764  
    8989#if H_3D_DIM_DMM
    9090, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    91 #if !SEC_DMM3_RBC_F0147
    92 , m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    93 #endif
    94 #endif
    95 #if H_3D_DIM_RBC
    96 , m_cRbcDataSCModel           ( 1,             1,               NUM_RBC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    9791#endif
    9892#if H_3D_DIM_SDC
     
    178172#if H_3D_DIM_DMM
    179173  m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
    180 #if !SEC_DMM3_RBC_F0147
    181   m_cDmm3DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM3_DATA );
    182 #endif
    183 #endif
    184 #if H_3D_DIM_RBC
    185   m_cRbcDataSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_RBC_DATA );
    186174#endif
    187175#if H_3D_DIM_SDC
     
    253241#if H_3D_DIM_DMM
    254242  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
    255 #if !SEC_DMM3_RBC_F0147
    256   m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
    257 #endif
    258 #endif
    259 #if H_3D_DIM_RBC
    260   m_cRbcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_RBC_DATA );
    261243#endif
    262244#if H_3D_DIM_SDC
     
    414396}
    415397
    416 #if QC_DIM_DELTADC_UNIFY_F0132
    417398Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt uiNumSeg )
    418399{
     
    431412  }
    432413}
    433 #else
    434 Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt dimType )
    435 {
    436   UInt absValDeltaDC = 0;
    437   xReadExGolombLevel( absValDeltaDC, m_cDdcDataSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
    438   rValDeltaDC = (Pel)absValDeltaDC;
    439 
    440   if( rValDeltaDC != 0 )
    441   {
    442     UInt uiSign;
    443     m_pcTDecBinIf->decodeBinEP( uiSign );
    444     if ( uiSign )
    445     {
    446       rValDeltaDC = -rValDeltaDC;
    447     }
    448   }
    449 }
    450 #endif
     414
    451415
    452416#if H_3D_DIM_DMM
     
    461425  ruiTabIdx = uiIdx;
    462426}
    463 #if !SEC_DMM3_RBC_F0147
    464 Void TDecSbac::xParseDmm3WedgeIdx( UInt& ruiIntraIdx, Int iNumBit )
    465 {
    466   UInt uiSymbol, uiIdx = 0;
    467   for( Int i = 0; i < iNumBit; i++ )
    468   {
    469     m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm3DataSCModel.get(0, 0, 0) );
    470     uiIdx += uiSymbol << i;
    471   }
    472   ruiIntraIdx = uiIdx;
    473 }
    474 #endif
    475 #endif
    476 #if H_3D_DIM_RBC
    477 Void TDecSbac::xParseRbcEdge( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    478 {
    479   UInt uiSymbol = 0;
    480 
    481   // 1. Top(0) or Left(1)
    482   UChar ucLeft;
    483   m_pcTDecBinIf->decodeBinEP( uiSymbol );
    484   ucLeft = uiSymbol;
    485 
    486   // 2. Start position (lowest bit first)
    487   UChar ucStart = 0;
    488   for( UInt ui = 0; ui < 6 - uiDepth; ui++ )
    489   {
    490     m_pcTDecBinIf->decodeBinEP( uiSymbol );
    491     ucStart |= (uiSymbol << ui);
    492   }
    493 
    494   // 3. Number of edges
    495   UChar ucMax = 0;
    496   for( UInt ui = 0; ui < 7 - uiDepth; ui++ )
    497   {
    498     m_pcTDecBinIf->decodeBinEP( uiSymbol );
    499     ucMax |= (uiSymbol << ui);
    500   }
    501   ucMax++; // +1
    502 
    503   // 4. Edges
    504   UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * RBC_MAX_EDGE_NUM_PER_4x4 );
    505   for( Int iPtr = 0; iPtr < ucMax; iPtr++ )
    506   {
    507     UChar ucEdge = 0;
    508     UInt  uiReorderEdge = 0;
    509     for( UInt ui = 0; ui < 6; ui++ )
    510     {
    511       m_pcTDecBinIf->decodeBin( uiSymbol, m_cRbcDataSCModel.get( 0, 0, 0 ) );
    512       ucEdge <<= 1;
    513       ucEdge |= uiSymbol;
    514       if( uiSymbol == 0 )
    515         break;
    516     }
    517 
    518     switch( ucEdge )
    519     {
    520     case 0 :  // "0"       
    521       uiReorderEdge = 0;
    522       break;
    523     case 2 :  // "10"
    524       uiReorderEdge = 1;
    525       break;
    526     case 6 :  // "110"
    527       uiReorderEdge = 2;
    528       break;
    529     case 14 : // "1110"
    530       uiReorderEdge = 3;
    531       break;
    532     case 30 : // "11110"
    533       uiReorderEdge = 4;
    534       break;
    535     case 62 : // "111110"
    536       uiReorderEdge = 5;
    537       break;
    538     case 63 : // "111111"
    539       uiReorderEdge = 6;
    540       break;
    541     default :
    542       printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge);
    543       assert(false);
    544       break;
    545     }
    546     pucSymbolList[iPtr] = uiReorderEdge;
    547   }
    548   /////////////////////
    549   // Edge Reconstruction
    550   Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx );
    551   pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion );
    552   xFree( pucSymbolList );
    553 }
    554 #endif
     427#endif
     428
    555429#if H_3D_DIM_SDC
    556430Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment )
     
    11751049      pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );
    11761050    } break;
    1177 #if !SEC_DMM3_RBC_F0147
    1178   case( DMM3_IDX ):
    1179     {
    1180       UInt uiIntraIdx = 0;
    1181       xParseDmm3WedgeIdx( uiIntraIdx, g_dmm3IntraTabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
    1182       pcCU->setDmm3IntraTabIdxSubParts( uiIntraIdx, absPartIdx, depth );
    1183     } break;
    1184 #endif
    11851051  case( DMM4_IDX ): break;
    11861052#endif
    1187 #if H_3D_DIM_RBC
    1188   case( RBC_IDX ):
    1189     {
    1190       xParseRbcEdge( pcCU, absPartIdx, depth );
    1191     } break;
    1192 #endif
    11931053  default: break;
    11941054  }
    11951055
    1196 #if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
    1197   if( pcCU->getSDCFlag(absPartIdx) )
    1198   {
    1199     assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
    1200     pcCU->setTrIdxSubParts(0, absPartIdx, depth);
    1201     pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth);
    1202 
    1203     UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2;
    1204     for (UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++)
    1205     {
    1206       xParseSDCResidualData(pcCU, absPartIdx, depth, uiSeg);
    1207     }
    1208   }
    1209   else
    1210   {
    1211 #endif
    1212 #if QC_DIM_DELTADC_UNIFY_F0132
    1213     if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
    1214 #else
    1215     if( dimType < DIM_NUM_TYPE )
    1216 #endif
    1217     {
    1218       UInt symbol;
    1219 #if QC_DIM_DELTADC_UNIFY_F0132
    1220       UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1056  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
     1057  {
     1058    UInt symbol;
     1059    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1060
     1061    if( pcCU->getSDCFlag( absPartIdx ) )
     1062    {
     1063      assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
     1064      pcCU->setTrIdxSubParts(0, absPartIdx, depth);
     1065      pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth);
     1066    }
     1067
     1068    m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
     1069
     1070    if( symbol )
     1071    {
     1072      if( !pcCU->getSDCFlag( absPartIdx ) )
     1073      {
     1074        dir += symbol;
     1075      }
     1076    }
     1077    for( UInt segment = 0; segment < uiNumSegments; segment++ )
     1078    {
     1079      Pel valDeltaDC = 0;
     1080      if( symbol )
     1081      {
     1082        xParseDimDeltaDC( valDeltaDC, uiNumSegments );
     1083      }
    12211084
    12221085      if( pcCU->getSDCFlag( absPartIdx ) )
    12231086      {
    1224         assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
    1225         pcCU->setTrIdxSubParts(0, absPartIdx, depth);
    1226         pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth);
    1227       }
    1228 
    1229       m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
    1230 
    1231       if( symbol )
    1232       {
    1233         if( !pcCU->getSDCFlag( absPartIdx ) )
    1234         {
    1235           dir += symbol;
    1236         }
    1237       }
    1238       for( UInt segment = 0; segment < uiNumSegments; segment++ )
    1239       {
    1240         Pel valDeltaDC = 0;
    1241         if( symbol )
    1242         {
    1243           xParseDimDeltaDC( valDeltaDC, uiNumSegments );
    1244         }
    1245 
    1246         if( pcCU->getSDCFlag( absPartIdx ) )
    1247         {
    1248           pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
    1249         }
    1250         else
    1251         {
    1252           pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );
    1253         }
    1254       }
    1255 #else
    1256       m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
    1257       if( symbol )
    1258       {
    1259         dir += symbol;
    1260         for( UInt segment = 0; segment < 2; segment++ )
    1261         {
    1262           Pel valDeltaDC = 0;
    1263           xParseDimDeltaDC( valDeltaDC, dimType );
    1264           pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );
    1265         }
    1266       }
    1267 #endif
    1268     }
    1269 #if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
    1270   }
    1271 #endif
     1087        pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
     1088      }
     1089      else
     1090      {
     1091        pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );
     1092      }
     1093    }
     1094  }
    12721095
    12731096  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
     
    12971120  else if( puIdx == 0 )
    12981121  {
    1299 #if SEC_DMM3_RBC_F0147
    13001122    while( binNum < 1 && symbol )
    1301 #else
    1302     while( binNum < 3 && symbol )
    1303 #endif
    13041123    {
    13051124      ctxDepthMode = puIdx*3 + ((binNum >= 2) ? 2 : binNum);
     
    13081127      binNum++;
    13091128    }
    1310 #if SEC_DMM3_RBC_F0147
    1311     if( modeCode == 0 ) { dir = 0;                       sdcFlag = 0;}
    1312     else if( modeCode == 1 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
    1313 #else
    1314          if( modeCode == 0 ) { dir = 0;                       sdcFlag = 0;}
    1315     else if( modeCode == 2 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
    1316     else if( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
    1317     else if( modeCode == 7 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    1318 #endif
     1129    if( modeCode == 0 )
     1130    {
     1131      dir = 0;
     1132      sdcFlag = 0;
     1133    }
     1134    else if ( modeCode == 1 )
     1135    {
     1136      dir = (2*DMM1_IDX+DIM_OFFSET);
     1137      sdcFlag = 0;
     1138    }
    13191139  }
    13201140  else
    13211141  {
    1322 #if SEC_DMM3_RBC_F0147
    13231142    while( binNum < 4 && symbol )
    13241143    {
     
    13331152    else if ( modeCode == 14 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
    13341153    else if ( modeCode == 15 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
    1335 #else
    1336     UInt maxBinNum = 0;
    1337     m_pcTDecBinIf->decodeBinEP(symbol);
    1338     if( symbol == 1 )
    1339     {
    1340       maxBinNum = 3;
    1341     }
    1342     else
    1343     {
    1344       maxBinNum = 2;
    1345       symbol = 1;
    1346     }
    1347     while( binNum<maxBinNum && symbol )
    1348     {
    1349       ctxDepthMode = puIdx*3 + ( binNum >= 2 ? 2 : binNum );
    1350       m_pcTDecBinIf->decodeBin(symbol,m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode));
    1351       modeCode = (modeCode<<1)+symbol;
    1352       binNum++;
    1353     }
    1354     if( maxBinNum == 3 )
    1355     {
    1356       if ( modeCode == 0 )       { dir =  PLANAR_IDX;             sdcFlag = 1;}
    1357       else if ( modeCode == 2 )  { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
    1358       else if ( modeCode == 6 )  { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
    1359       else if ( modeCode == 7 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
    1360     }
    1361     else
    1362     {
    1363       if ( modeCode == 0 )       { dir = 5;                       sdcFlag = 0;}
    1364       else if ( modeCode == 2 )  { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;}
    1365       else if ( modeCode == 3 )  { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
    1366     }
    1367 #endif
     1154
    13681155  }
    13691156  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
  • branches/HTM-9.2-dev0/source/Lib/TLibDecoder/TDecSbac.h

    r758 r764  
    103103#if H_3D_DIM
    104104  Void  xReadExGolombLevel   ( UInt& ruiSymbol, ContextModel& rcSCModel  );
    105 #if QC_DIM_DELTADC_UNIFY_F0132
    106105  Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt uiNumSeg );
    107 #else
    108   Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt dimType );
    109 #endif
    110106#if H_3D_DIM_DMM
    111107  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
    112 #if !SEC_DMM3_RBC_F0147
    113   Void  xParseDmm3WedgeIdx   ( UInt& ruiIntraIdx, Int iNumBit );
    114 #endif
    115 #endif
    116 #if H_3D_DIM_RBC
    117   Void  xParseRbcEdge        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    118108#endif
    119109#if H_3D_DIM_SDC
     
    223213#if H_3D_DIM_DMM
    224214  ContextModel3DBuffer m_cDmm1DataSCModel;
    225 #if !SEC_DMM3_RBC_F0147
    226   ContextModel3DBuffer m_cDmm3DataSCModel;
    227 #endif
    228 #endif
    229 #if H_3D_DIM_RBC
    230   ContextModel3DBuffer m_cRbcDataSCModel;
    231215#endif
    232216#if H_3D_DIM_SDC 
  • branches/HTM-9.2-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp

    r763 r764  
    21242124    }
    21252125#if H_3D_IC
    2126 #if SEC_ONLY_TEXTURE_IC_F0151
    21272126    else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) && !pcSlice->getIsDepth())
    2128 #else
    2129     else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) )
    2130 #endif
    21312127    {
    21322128      WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "slice_ic_enable_flag" );
  • branches/HTM-9.2-dev0/source/Lib/TLibEncoder/TEncCfg.h

    r758 r764  
    420420#if H_3D_DIM
    421421  Bool      m_useDMM;
    422 #if !SEC_DMM3_RBC_F0147
    423   Bool      m_useRBC;
    424 #endif
    425422  Bool      m_useSDC;
    426423  Bool      m_useDLT;
     
    10031000  Bool      getUseDMM                       ()        { return m_useDMM; }
    10041001  Void      setUseDMM                       ( Bool b) { m_useDMM = b;    }
    1005 #if !SEC_DMM3_RBC_F0147
    1006   Bool      getUseRBC                       ()        { return m_useRBC; }
    1007   Void      setUseRBC                       ( Bool b) { m_useRBC = b;    }
    1008 #endif
    10091002  Bool      getUseSDC                       ()        { return m_useSDC; }
    10101003  Void      setUseSDC                       ( Bool b) { m_useSDC = b;    }
  • branches/HTM-9.2-dev0/source/Lib/TLibEncoder/TEncCu.cpp

    r735 r764  
    497497#endif
    498498#if H_3D_IC
    499 #if SEC_ONLY_TEXTURE_IC_F0151
    500499  Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE ) && !rpcTempCU->getSlice()->getIsDepth();
    501 #else
    502   Bool bICEnabled = rpcTempCU->getSlice()->getViewIndex() && ( rpcTempCU->getSlice()->getSliceType() == P_SLICE || rpcTempCU->getSlice()->getSliceType() == B_SLICE );
    503 #endif
    504500  bICEnabled = bICEnabled && rpcTempCU->getSlice()->getApplyIC();
    505501#endif
     
    17791775#endif
    17801776
    1781 #if H_3D_ARP && LGE_SHARP_VSP_INHERIT_F0104
     1777#if H_3D_ARP
    17821778  DisInfo cOrigDisInfo = rpcTempCU->getDvInfo(0);
    17831779#else
     
    17871783
    17881784#if H_3D_VSP
    1789 #if !(H_3D_ARP && LGE_SHARP_VSP_INHERIT_F0104)
     1785#if !H_3D_ARP
    17901786  Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
    17911787  memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
    17921788  InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
    1793 #if ETRIKHU_MERGE_REUSE_F0093
    17941789  rpcTempCU->m_bAvailableFlagA1 = 0;
    17951790  rpcTempCU->m_bAvailableFlagB1 = 0;
     
    17991794  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    18001795  rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag,inheritedVSPDisInfo, numValidMergeCand );
    1801 #else
    1802   rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
    1803 #endif
    1804 #endif
    1805 #else
    1806 #if ETRIKHU_MERGE_REUSE_F0093
     1796#endif
     1797#else
    18071798  rpcTempCU->m_bAvailableFlagA1 = 0;
    18081799  rpcTempCU->m_bAvailableFlagB1 = 0;
     
    18121803  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    18131804  rpcTempCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    1814 #else
    1815   rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    1816 #endif
    18171805#endif
    18181806
     
    18221810  Int mergeCandBuffer[MRG_MAX_NUM_CANDS];
    18231811#endif
    1824 #if H_3D_ARP && LGE_SHARP_VSP_INHERIT_F0104
     1812#if H_3D_ARP
    18251813for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
    18261814#else
     
    18561844    memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS*sizeof(Int) );
    18571845#endif
    1858 #if LGE_SHARP_VSP_INHERIT_F0104
    18591846    rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    18601847    rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );
     
    18761863    puhInterDirSP = new UChar[rpcTempCU->getPic()->getPicSym()->getNumPartition()];
    18771864#endif
    1878 #if ETRIKHU_MERGE_REUSE_F0093
     1865#if H_3D
    18791866    rpcTempCU->initAvailableFlags();
    18801867    rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     
    18881875    rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand );
    18891876#endif
    1890 #endif
     1877
    18911878#endif
    18921879  for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual )
     
    19501937            rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    19511938#if MTK_SPIVMP_F0110
    1952           }
    1953 #endif
    1954 #if H_3D_ARP && !QC_MTK_INTERVIEW_ARP_F0123_F0108
    1955           if( nARPW )
    1956           {
    1957             Bool bSignalflag[2] = { true, true };
    1958             for( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
    1959             {
    1960               Int iRefIdx = cMvFieldNeighbours[uiRefListIdx + 2*uiMergeCand].getRefIdx();
    1961               RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
    1962               if( iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx) )
    1963               {
    1964                 bSignalflag[uiRefListIdx] = false;
    1965               }
    1966             }
    1967             if( !bSignalflag[0] && !bSignalflag[1] )
    1968             {
    1969 #if LGE_SHARP_VSP_INHERIT_F0104
    1970               continue;
    1971 #else
    1972               rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
    1973 #endif
    1974             }
    19751939          }
    19761940#endif
  • branches/HTM-9.2-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp

    r724 r764  
    160160Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    161161{
    162 #if SEC_ONLY_TEXTURE_IC_F0151
    163162  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
    164 #else
    165   if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) )
    166 #endif
    167163  {
    168164    return;
  • branches/HTM-9.2-dev0/source/Lib/TLibEncoder/TEncSbac.cpp

    r758 r764  
    9595#if H_3D_DIM_DMM
    9696, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    97 #if !SEC_DMM3_RBC_F0147
    98 , m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
    99 #endif
    100 #endif
    101 #if H_3D_DIM_RBC
    102 , m_cRbcDataSCModel           ( 1,             1,               NUM_RBC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    10397#endif
    10498#if H_3D_DIM_SDC
     
    176170#if H_3D_DIM_DMM
    177171  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
    178 #if !SEC_DMM3_RBC_F0147
    179   m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
    180 #endif
    181 #endif
    182 #if H_3D_DIM_RBC
    183   m_cRbcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_RBC_DATA );
    184172#endif
    185173#if H_3D_DIM_SDC
     
    266254#if H_3D_DIM_DMM
    267255      curCost += m_cDmm1DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM1_DATA );
    268 #if !SEC_DMM3_RBC_F0147
    269       curCost += m_cDmm3DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM3_DATA );
    270 #endif
    271 #endif
    272 #if H_3D_DIM_RBC
    273       curCost += m_cRbcDataSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_RBC_DATA );
    274256#endif
    275257    }
     
    337319#if H_3D_DIM_DMM
    338320  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
    339 #if !SEC_DMM3_RBC_F0147
    340   m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
    341 #endif
    342 #endif
    343 #if H_3D_DIM_RBC
    344   m_cRbcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_RBC_DATA );
    345321#endif
    346322#if H_3D_DIM_SDC
     
    526502}
    527503
    528 #if QC_DIM_DELTADC_UNIFY_F0132
    529504Void TEncSbac::xCodeDimDeltaDC( Pel valDeltaDC, UInt uiNumSeg )
    530505{
     
    536511  }
    537512}
    538 #else
    539 Void TEncSbac::xCodeDimDeltaDC( Pel valDeltaDC, UInt dimType )
    540 {
    541   xWriteExGolombLevel( UInt( abs( valDeltaDC ) ), m_cDdcDataSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
    542   if( valDeltaDC != 0 )
    543   {
    544     UInt uiSign = valDeltaDC > 0 ? 0 : 1;
    545     m_pcBinIf->encodeBinEP( uiSign );
    546   }
    547 }
    548 #endif
    549513
    550514#if H_3D_DIM_DMM
     
    557521}
    558522
    559 #if !SEC_DMM3_RBC_F0147
    560 Void TEncSbac::xCodeDmm3WedgeIdx( UInt uiIntraIdx, Int iNumBit )
    561 {
    562   for( Int i = 0; i < iNumBit; i++ )
    563   {
    564     m_pcBinIf->encodeBin( ( uiIntraIdx >> i ) & 1, m_cDmm3DataSCModel.get(0, 0, 0) );
    565   }
    566 }
    567 #endif
    568 #endif
    569 #if H_3D_DIM_RBC
    570 Void TEncSbac::xCodeRbcEdge( TComDataCU* pcCU, UInt uiAbsPartIdx )
    571 {
    572   UInt   uiDepth        = pcCU->getDepth( uiAbsPartIdx ) + (pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 1 : 0);
    573   UChar* pucSymbolList  = pcCU->getEdgeCode     ( uiAbsPartIdx );
    574   UChar  ucEdgeNumber   = pcCU->getEdgeNumber   ( uiAbsPartIdx );
    575   Bool   bLeft          = pcCU->getEdgeLeftFirst( uiAbsPartIdx );
    576   UChar  ucStart        = pcCU->getEdgeStartPos ( uiAbsPartIdx );
    577   UInt   uiSymbol;
    578 
    579   // 1. Top(0) or Left(1)
    580   uiSymbol = (bLeft == false) ? 0 : 1;
    581   m_pcBinIf->encodeBinEP( uiSymbol );
    582 
    583   // 2. Start position (lowest bit first)
    584   uiSymbol = ucStart;
    585   for( UInt ui = 6; ui > uiDepth; ui-- ) // 64(0)->6, 32(1)->5, 16(2)->4, 8(3)->3, 4(4)->2
    586   {
    587     m_pcBinIf->encodeBinEP( uiSymbol & 0x1 );
    588     uiSymbol >>= 1;
    589   }
    590 
    591   // 3. Number of edges
    592   uiSymbol = ucEdgeNumber > 0 ? ucEdgeNumber - 1 : 0;
    593   for( UInt ui = 7; ui > uiDepth; ui-- ) // 64(0)->7, 32(1)->6, 16(2)->5, 8(3)->4, 4(4)->3
    594   {
    595     m_pcBinIf->encodeBinEP( uiSymbol & 0x1 );
    596     uiSymbol >>= 1;
    597   }
    598 
    599   if(uiSymbol != 0)
    600   {
    601     printf(" ucEdgeNumber %d at depth %d\n",ucEdgeNumber, uiDepth);
    602     assert(false);
    603   }
    604 
    605   // 4. Edges
    606   for( Int iPtr2 = 0; iPtr2 < ucEdgeNumber; iPtr2++ )
    607   {
    608     UInt uiReorderSymbol = pucSymbolList[iPtr2];
    609     for( UInt ui = 0; ui < uiReorderSymbol; ui++ )
    610     {
    611       m_pcBinIf->encodeBin( 1, m_cRbcDataSCModel.get( 0, 0, 0 ) );
    612     }
    613 
    614     if( uiReorderSymbol != 6 )
    615       m_pcBinIf->encodeBin( 0, m_cRbcDataSCModel.get( 0, 0, 0 ) );
    616   }
    617 }
    618 #endif
     523#endif
     524
    619525#if H_3D_DIM_SDC
    620526Void TEncSbac::xCodeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment )
     
    12391145      xCodeDmm1WedgeIdx( pcCU->getDmmWedgeTabIdx( dimType, absPartIdx ), g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
    12401146    } break;
    1241 #if !SEC_DMM3_RBC_F0147
    1242   case( DMM3_IDX ):
    1243     {
    1244       xCodeDmm3WedgeIdx( pcCU->getDmm3IntraTabIdx( absPartIdx ), g_dmm3IntraTabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
    1245     } break;
    1246 #endif
    12471147  case( DMM4_IDX ): break;
    12481148#endif
    1249 #if H_3D_DIM_RBC
    1250   case( RBC_IDX ):
    1251     {
    1252       assert( pcCU->getWidth( absPartIdx ) < 64 );
    1253       xCodeRbcEdge( pcCU, absPartIdx );
    1254     } break;
    1255 #endif
    12561149  default: break;
    12571150  }
    12581151
    1259 #if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
    1260   if( pcCU->getSDCFlag( absPartIdx ) )
    1261   {
    1262     assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
    1263     UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2;
    1264     for(UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++)
    1265     {
    1266       xCodeSDCResidualData(pcCU, absPartIdx, uiSeg);
    1267     }
    1268   }
    1269   else
    1270   {
    1271 #endif
    1272 #if QC_DIM_DELTADC_UNIFY_F0132
    1273     if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
    1274 #else
    1275     if( dimType < DIM_NUM_TYPE )
    1276 #endif
    1277     {
    1278 #if QC_DIM_DELTADC_UNIFY_F0132
    1279       UInt dimDeltaDC;
    1280       Pel  deltaDC;
    1281       UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
    1282       if( pcCU->getSDCFlag( absPartIdx ) )
    1283     {
    1284         if( uiNumSegments==1 )
    1285         {
    1286           dimDeltaDC = pcCU->getSDCSegmentDCOffset(0, absPartIdx) ? 1 : 0;
    1287         }
    1288         else
    1289         {
    1290           dimDeltaDC = ( pcCU->getSDCSegmentDCOffset(0, absPartIdx) || pcCU->getSDCSegmentDCOffset(1, absPartIdx) ) ? 1 : 0;
    1291         }
     1152  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
     1153  {
     1154    UInt dimDeltaDC;
     1155    Pel  deltaDC;
     1156    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1157    if( pcCU->getSDCFlag( absPartIdx ) )
     1158    {
     1159      if( uiNumSegments==1 )
     1160      {
     1161        dimDeltaDC = pcCU->getSDCSegmentDCOffset(0, absPartIdx) ? 1 : 0;
    12921162      }
    12931163      else
    12941164      {
    1295         dimDeltaDC = isDimDeltaDC( dir );
    1296       }
    1297 
    1298       m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
    1299 
    1300       if( dimDeltaDC )
    1301       {
    1302         for( UInt segment = 0; segment < uiNumSegments; segment++ )
    1303         {
    1304           deltaDC = pcCU->getSDCFlag( absPartIdx ) ? pcCU->getSDCSegmentDCOffset(segment, absPartIdx) : pcCU->getDimDeltaDC( dimType, segment, absPartIdx );
    1305           xCodeDimDeltaDC( deltaDC, uiNumSegments );
    1306         }
    1307       }
    1308 #else
    1309       UInt dimDeltaDC = isDimDeltaDC( dir );
    1310       m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
    1311       if( dimDeltaDC )
    1312       {
    1313         for( UInt segment = 0; segment < 2; segment++ )
    1314         {
    1315           xCodeDimDeltaDC( pcCU->getDimDeltaDC( dimType, segment, absPartIdx ), dimType );
    1316         }
    1317       }
    1318 #endif
    1319     }
    1320 #if H_3D_DIM_SDC && !QC_DIM_DELTADC_UNIFY_F0132
    1321   }
    1322 #endif
     1165        dimDeltaDC = ( pcCU->getSDCSegmentDCOffset(0, absPartIdx) || pcCU->getSDCSegmentDCOffset(1, absPartIdx) ) ? 1 : 0;
     1166      }
     1167    }
     1168    else
     1169    {
     1170      dimDeltaDC = isDimDeltaDC( dir );
     1171    }
     1172
     1173    m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get(0, 0, uiNumSegments-1) );
     1174
     1175    if( dimDeltaDC )
     1176    {
     1177      for( UInt segment = 0; segment < uiNumSegments; segment++ )
     1178      {
     1179        deltaDC = pcCU->getSDCFlag( absPartIdx ) ? pcCU->getSDCSegmentDCOffset(segment, absPartIdx) : pcCU->getDimDeltaDC( dimType, segment, absPartIdx );
     1180        xCodeDimDeltaDC( deltaDC, uiNumSegments );
     1181      }
     1182    }
     1183  }
    13231184}
    13241185
    13251186Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
    13261187{
    1327 #if SEC_DMM3_RBC_F0147
    13281188  UInt codeWordTable[3][7] =    {{0, 0, 0, 1, 0, 0, 0},{0, 2, 6, 14, 15, 0, 0},{0, 1, 0, 0, 0, 0, 0}};
    13291189  UInt codeWordLenTable[3][7] = {{0, 1, 0, 1, 0, 0, 0},{1, 2, 3,  4,  4, 0, 0},{1, 1, 0, 0, 0, 0, 0}};
    1330 #else
    1331     UInt codeWordTable[3][7] =    {{0, 0, 0, 2, 0,6, 7},{0, 0, 2, 7, 3, 6, 2},{0, 1, 0, 0, 0, 0, 0}};
    1332     UInt codeWordLenTable[3][7] = {{0, 1, 0, 2, 0,3, 3},{1, 1, 2, 3, 2, 3, 2},{1, 1, 0, 0, 0, 0, 0}};
    1333 #endif
    13341190  UInt dir = pcCU->getLumaIntraDir( absPartIdx );
    13351191  UInt puIdx = (pcCU->getWidth(absPartIdx) == 64) ? 2 : ( (pcCU->getPartitionSize(absPartIdx) == SIZE_NxN && pcCU->getWidth(absPartIdx) == 8) ? 0 : 1 );
     
    13461202    case DMM1_IDX: codeIdx = 3; break;
    13471203    case DMM4_IDX: codeIdx = 4; break;
    1348 #if !SEC_DMM3_RBC_F0147
    1349     case DMM3_IDX: codeIdx = 5; break;
    1350     case  RBC_IDX: codeIdx = 6; break;
    1351 #endif
    13521204    default:                    break;
    13531205    }
     
    13621214      default:          codeIdx = 2; break;
    13631215    }
    1364   }
    1365 #endif
    1366 #if !SEC_DMM3_RBC_F0147
    1367   if( puIdx==1 )
    1368   {
    1369       if( codeIdx==1 || codeIdx==2 || codeIdx==4 )
    1370       {
    1371           m_pcBinIf->encodeBinEP( 0 );
    1372       }
    1373       else
    1374       {
    1375           m_pcBinIf->encodeBinEP( 1 );
    1376       }
    13771216  }
    13781217#endif
  • branches/HTM-9.2-dev0/source/Lib/TLibEncoder/TEncSbac.h

    r724 r764  
    116116  Void  xWriteEpExGolomb     ( UInt uiSymbol, UInt uiCount );
    117117  Void  xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam );
    118   #if H_3D_DIM
     118#if H_3D_DIM
    119119  Void  xWriteExGolombLevel  ( UInt uiSymbol, ContextModel& rcSCModel  );
    120 #if QC_DIM_DELTADC_UNIFY_F0132
    121120  Void  xCodeDimDeltaDC      ( Pel valDeltaDC, UInt uiNumSeg );
    122 #else
    123   Void  xCodeDimDeltaDC      ( Pel valDeltaDC, UInt dimType );
    124 #endif
    125121#if H_3D_DIM_DMM
    126122  Void  xCodeDmm1WedgeIdx    ( UInt uiTabIdx, Int iNumBit );
    127 #if !SEC_DMM3_RBC_F0147
    128   Void  xCodeDmm3WedgeIdx    ( UInt uiIntraIdx, Int iNumBit );
    129 #endif
    130 #endif
    131 #if H_3D_DIM_RBC
    132   Void  xCodeRbcEdge         ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    133123#endif
    134124#if H_3D_DIM_SDC
     
    259249#if H_3D_DIM_DMM
    260250  ContextModel3DBuffer m_cDmm1DataSCModel;
    261 #if !SEC_DMM3_RBC_F0147
    262   ContextModel3DBuffer m_cDmm3DataSCModel;
    263 #endif
    264 #endif
    265 #if H_3D_DIM_RBC
    266   ContextModel3DBuffer m_cRbcDataSCModel;
    267251#endif
    268252#if H_3D_DIM_SDC 
  • branches/HTM-9.2-dev0/source/Lib/TLibEncoder/TEncSearch.cpp

    r758 r764  
    11241124      {
    11251125#endif
    1126       for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    1127       {
    1128 #if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
    1129 #if DLT_DIFF_CODING_IN_PPS
    1130         if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
    1131 #else
    1132         if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
    1133 #endif
     1126        for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1127        {
     1128#if H_3D_DIM
     1129          if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
    11341130          {
    1135 #if DLT_DIFF_CODING_IN_PPS
    11361131            pResi[ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
    1137 #else
    1138             pResi[ uiX ] = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
    1139 #endif
    11401132          }
    11411133          else
    11421134          {
    1143               pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ];
     1135            pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ];
    11441136          }
    11451137#else
    1146         pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ];
    1147 #endif
    1148       }
    1149       pOrg  += uiStride;
    1150       pResi += uiStride;
    1151       pPred += uiStride;
     1138          pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ];
     1139#endif
     1140        }
     1141        pOrg  += uiStride;
     1142        pResi += uiStride;
     1143        pPred += uiStride;
    11521144#if H_3D_DIM_ENC
    11531145      }
     
    12091201      for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    12101202      {
    1211 #if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
    1212 #if DLT_DIFF_CODING_IN_PPS
     1203#if H_3D_DIM
    12131204        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
    1214 #else
    1215         if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
    1216 #endif
    1217           {
    1218 #if DLT_DIFF_CODING_IN_PPS
    1219             pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
    1220 #else
    1221             pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
    1222 #endif
    1223           }
    1224           else
    1225           {
    1226               pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
    1227           }
     1205        {
     1206          pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
     1207        }
     1208        else
     1209        {
     1210          pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
     1211        }
    12281212#else
    12291213        pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
     
    29242908              biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
    29252909            } break;
    2926 #if !SEC_DMM3_RBC_F0147
    2927           case( DMM3_IDX ):
    2928             {
    2929 
    2930               TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
    2931               TComDataCU* pcColTexCU = pcPicTex->getCU( pcCU->getAddr() );
    2932               UInt      uiTexPartIdx = pcCU->getZorderIdxInCU() + uiPartOffset;
    2933               Int   uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
    2934 
    2935               if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 )
    2936               {
    2937              UInt uiIntraTabIdx = 0;
    2938               xSearchDmm3Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx, uiIntraTabIdx, uiColTexIntraDir );
    2939               pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth );
    2940               pcCU->setDmm3IntraTabIdxSubParts( uiIntraTabIdx, uiPartOffset, uiDepth + uiInitTrDepth );
    2941               biSegmentation = &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
    2942               }
    2943             } break;
    2944 #endif
     2910
    29452911          case( DMM4_IDX ):
    29462912            {
     
    29682934      }
    29692935#endif
    2970 #if H_3D_DIM_RBC
    2971       if( m_pcEncCfg->getUseRBC()
    2972 #if H_3D_FAST_DEPTH_INTRA
    2973           && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
    2974 #endif
    2975         )
    2976       {
    2977         if( xSearchRbcEdge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ) )
    2978         {
    2979           Pel deltaDC1 = 0; Pel deltaDC2 = 0;
    2980 #if QC_DIM_DELTADC_UNIFY_F0132
    2981           xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, pcCU->getEdgePartition( uiPartOffset ), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
    2982 #else
    2983           xSearchRbcDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, pcCU->getEdgePartition( uiPartOffset ), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
    2984 #endif
    2985           pcCU->setDimDeltaDC( RBC_IDX, 0, uiPartOffset, deltaDC1 );
    2986           pcCU->setDimDeltaDC( RBC_IDX, 1, uiPartOffset, deltaDC2 );
    2987 
    2988           uiRdModeList[ numModesForFullRD++ ] = (2*RBC_IDX  +DIM_OFFSET);
    2989           uiRdModeList[ numModesForFullRD++ ] = (2*RBC_IDX+1+DIM_OFFSET);
    2990         }
    2991       }
    2992 #endif
    29932936    }
    29942937#endif
     
    30292972      Bool bTestZeroResi = false;
    30302973#if H_3D_DIM_ENC
    3031 #if LGE_BUGFIX_F0158
    30322974      bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();
    3033 #else
    3034       bTestZeroResi |= pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->isIRAP();
    3035 #endif
    30362975#endif
    30372976#if H_3D_DIM_SDC
     
    36603599    if ( iPUIdx == 0 )
    36613600    {
    3662 #if ETRIKHU_MERGE_REUSE_F0093
     3601#if H_3D
    36633602      pcCU->initAvailableFlags();
    36643603      pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
     
    36743613        );
    36753614#else
    3676       pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours
    3677 #if H_3D_VSP
    3678                                    , vspFlag
    3679                                    , inheritedVSPDisInfo
    3680 #endif
    3681                                    , numValidMergeCand
    3682                                    );
     3615      pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    36833616#endif
    36843617    }
     
    36873620  else
    36883621  {
    3689 #if ETRIKHU_MERGE_REUSE_F0093
     3622#if H_3D
    36903623    pcCU->initAvailableFlags();
    36913624    pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand);
     
    37013634      );
    37023635#else
    3703     pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours
    3704 #if H_3D_VSP
    3705                                  , vspFlag
    3706                                  , inheritedVSPDisInfo
    3707 #endif
    3708                                  , numValidMergeCand
     3636    pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand
    37093637                                 );
    37103638#endif
     
    74777405}
    74787406
    7479 #if !SEC_DMM3_RBC_F0147
    7480 Void TEncSearch::xSearchDmm3Wedge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx, UInt colTexIntraDir )
    7481 {
    7482   ruiTabIdx       = 0;
    7483   ruiIntraTabIdx  = 0;
    7484 
    7485   // local pred buffer
    7486   TComYuv cPredYuv;
    7487   cPredYuv.create( uiWidth, uiHeight );
    7488   cPredYuv.clear();
    7489   Pel* piPred = cPredYuv.getLumaAddr();
    7490   UInt uiPredStride = cPredYuv.getStride();
    7491 
    7492   // wedge search
    7493   UInt uiBestDist = MAX_UINT;
    7494   WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
    7495   Pel refDC1 = 0; Pel refDC2 = 0;
    7496 
    7497   std::vector< std::vector<UInt> > pauiWdgLstSz = g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]];
    7498   std::vector<UInt>* pauiWdgLst = &pauiWdgLstSz[colTexIntraDir-2];
    7499   for( UInt uiIdxW = 0; uiIdxW < pauiWdgLst->size(); uiIdxW++ )
    7500   {
    7501     UInt uiIdx     =   pauiWdgLst->at(uiIdxW);
    7502     TComWedgelet* pcWedgelet = &(pacWedgeList->at(uiIdx));
    7503     xCalcBiSegDCs  ( piRef,  uiRefStride,  pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
    7504     xAssignBiSegDCs( piPred, uiPredStride, pcWedgelet->getPattern(), pcWedgelet->getStride(), refDC1, refDC2 );
    7505 
    7506     UInt uiActDist = m_pcRdCost->getDistPart( g_bitDepthY, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, TEXT_LUMA, DF_SAD );
    7507     if( uiActDist < uiBestDist || uiBestDist == MAX_UINT )
    7508     {
    7509       uiBestDist     = uiActDist;
    7510       ruiTabIdx      = uiIdx;
    7511       ruiIntraTabIdx = uiIdxW;
    7512     }
    7513   }
    7514   cPredYuv.destroy();
    7515 }
    7516 #endif
    7517 #endif
    7518 #if H_3D_DIM_RBC
    7519 Void TEncSearch::xSearchRbcDeltaDCs( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 )
    7520 {
    7521   assert( biSegPattern );
    7522   Pel origDC1 = 0; Pel origDC2 = 0;
    7523   xCalcBiSegDCs  ( piOrig,   uiStride, biSegPattern, patternStride, origDC1, origDC2 );
    7524   xAssignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, origDC1, origDC2 );
    7525 
    7526   Int* piMask = pcCU->getPattern()->getAdiOrgBuf( uiWidth, uiHeight, m_piYuvExt ); // no filtering for DMM
    7527   Int  maskStride = 2*uiWidth + 1;
    7528   Int* ptrSrc = piMask+maskStride+1;
    7529   Pel  predDC1 = 0; Pel predDC2 = 0;
    7530   xPredBiSegDCs( ptrSrc, maskStride, biSegPattern, patternStride, predDC1, predDC2 );
    7531 
    7532   rDeltaDC1 = origDC1 - predDC1;
    7533   rDeltaDC2 = origDC2 - predDC2;
    7534 
    7535 #if H_3D_VSO
    7536   if( m_pcRdCost->getUseVSO() )
    7537   {
    7538     Pel fullDeltaDC1 = rDeltaDC1;
    7539     Pel fullDeltaDC2 = rDeltaDC2;
    7540 
    7541     xDeltaDCQuantScaleDown( pcCU, fullDeltaDC1 );
    7542     xDeltaDCQuantScaleDown( pcCU, fullDeltaDC2 );
    7543 
    7544     Dist uiBestDist     = RDO_DIST_MAX;
    7545     UInt uiBestQStepDC1 = 0;
    7546     UInt uiBestQStepDC2 = 0;
    7547 
    7548     UInt uiDeltaDC1Max = abs(fullDeltaDC1);
    7549     UInt uiDeltaDC2Max = abs(fullDeltaDC2);
    7550 
    7551     //VSO Level delta DC check range extension
    7552     uiDeltaDC1Max += (uiDeltaDC1Max>>1);
    7553     uiDeltaDC2Max += (uiDeltaDC2Max>>1);
    7554 
    7555     for( UInt uiQStepDC1 = 1; uiQStepDC1 <= uiDeltaDC1Max; uiQStepDC1++  )
    7556     {
    7557       Pel iLevelDeltaDC1 = (Pel)(uiQStepDC1) * (Pel)(( fullDeltaDC1 < 0 ) ? -1 : 1);
    7558       xDeltaDCQuantScaleUp( pcCU, iLevelDeltaDC1 );
    7559       Pel testDC1 = ClipY( predDC1 + iLevelDeltaDC1 );
    7560 
    7561       for( UInt uiQStepDC2 = 1; uiQStepDC2 <= uiDeltaDC2Max; uiQStepDC2++  )
    7562       {
    7563         Pel iLevelDeltaDC2 = (Pel)(uiQStepDC2) * (Pel)(( fullDeltaDC2 < 0 ) ? -1 : 1);
    7564         xDeltaDCQuantScaleUp( pcCU, iLevelDeltaDC2 );
    7565         Pel testDC2 = ClipY( predDC2 + iLevelDeltaDC2 );
    7566 
    7567         xAssignBiSegDCs( piPredic, uiStride, biSegPattern, patternStride, testDC1, testDC2 );
    7568 
    7569         Dist uiActDist = RDO_DIST_MAX;
    7570         if( m_pcRdCost->getUseEstimatedVSD() )
    7571         {
    7572           uiActDist = m_pcRdCost->getDistPartVSD( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );
    7573         }
    7574         else
    7575         {
    7576           uiActDist = m_pcRdCost->getDistPartVSO( pcCU, uiAbsPtIdx, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false );
    7577         }
    7578 
    7579         if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
    7580         {
    7581           uiBestDist     = uiActDist;
    7582           uiBestQStepDC1 = uiQStepDC1;
    7583           uiBestQStepDC2 = uiQStepDC2;
    7584         }
    7585       }
    7586     }
    7587 
    7588     fullDeltaDC1 = (Int)(uiBestQStepDC1) * (Int)(( fullDeltaDC1 < 0 ) ? -1 : 1);
    7589     fullDeltaDC2 = (Int)(uiBestQStepDC2) * (Int)(( fullDeltaDC2 < 0 ) ? -1 : 1);
    7590     xDeltaDCQuantScaleUp( pcCU, fullDeltaDC1 );
    7591     xDeltaDCQuantScaleUp( pcCU, fullDeltaDC2 );
    7592     rDeltaDC1 = fullDeltaDC1;
    7593     rDeltaDC2 = fullDeltaDC2;
    7594   }
    7595 #endif
    7596 
    7597   xDeltaDCQuantScaleDown( pcCU, rDeltaDC1 );
    7598   xDeltaDCQuantScaleDown( pcCU, rDeltaDC2 );
    7599 }
    7600 
    7601 Bool TEncSearch::xSearchRbcEdge( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, Int iWidth, Int iHeight )
    7602 {
    7603   Bool* pbEdge  = (Bool*) xMalloc( Bool, iWidth * iHeight * 4 );
    7604 
    7605   Short* psDiffX = new Short[ iWidth * iHeight ];
    7606   Short* psDiffY = new Short[ iWidth * iHeight ];
    7607   Bool*  pbEdgeX = new Bool [ iWidth * iHeight ];
    7608   Bool*  pbEdgeY = new Bool [ iWidth * iHeight ];
    7609 
    7610   // Find Horizontal Gradient & Edge Detection ((x+1, y) - (x,y))
    7611   for( Int y=0; y<iHeight; y++ )
    7612   {
    7613     Short* psDiffXPtr = &psDiffX[ y * iHeight ];
    7614     Bool*  pbEdgeXPtr = &pbEdgeX[ y * iHeight ];
    7615     for(Int x=0; x<iWidth-1; x++ )
    7616     {
    7617       *psDiffXPtr = piRef[ x+1 + y*uiRefStride ] - piRef[ x + y*uiRefStride ];
    7618       if(*psDiffXPtr >= RBC_THRESHOLD || *psDiffXPtr <= (-1)*RBC_THRESHOLD)
    7619       {
    7620         *pbEdgeXPtr = true;
    7621       }
    7622       else
    7623       {
    7624         *pbEdgeXPtr = false;
    7625       }
    7626 
    7627       psDiffXPtr++;
    7628       pbEdgeXPtr++;
    7629     }
    7630   }
    7631 
    7632   // Find Vertical Gradient & Edge Detection((x,y+1) - (x,y))
    7633   for( Int y=0; y<iHeight-1; y++ )
    7634   {
    7635     Short* psDiffYPtr = &psDiffY[ y * iHeight ];
    7636     Bool*  pbEdgeYPtr = &pbEdgeY[ y * iHeight ];
    7637     for(Int x=0; x<iWidth; x++ )
    7638     {
    7639       *psDiffYPtr = piRef[ x + (y+1)*uiRefStride ] - piRef[ x + y*uiRefStride ];
    7640       if(*psDiffYPtr >= RBC_THRESHOLD || *psDiffYPtr <= (-1)*RBC_THRESHOLD)
    7641       {
    7642         *pbEdgeYPtr = true;
    7643       }
    7644       else
    7645       {
    7646         *pbEdgeYPtr = false;
    7647       }
    7648 
    7649       psDiffYPtr++;
    7650       pbEdgeYPtr++;
    7651     }
    7652   }
    7653 
    7654   // Eliminate local maximum
    7655   for( Int y=0; y<iHeight; y++ )
    7656   {
    7657     Short* psDiffXPtr = &psDiffX[ y * iHeight ];
    7658     Bool*  pbEdgeXPtr = &pbEdgeX[ y * iHeight ];
    7659     for( Int x=0; x<iWidth-1; x++ )
    7660     {
    7661       UShort usAbs0=0, usAbs1=0, usAbs2=0;  // 0 : left, 1 : current, 2 : right
    7662 
    7663       if( x > 0 && *(pbEdgeXPtr-1) == true )
    7664       {
    7665         if( *(psDiffXPtr-1) >= 0)
    7666         {
    7667           usAbs0 = *(psDiffXPtr-1);
    7668 
    7669         }
    7670         else
    7671         {
    7672           usAbs0 = (-1) * *(psDiffXPtr-1);
    7673         }
    7674       }
    7675       if( *pbEdgeXPtr == true )
    7676       {
    7677         if( *(psDiffXPtr) >= 0)
    7678         {
    7679           usAbs1 = *(psDiffXPtr);
    7680         }
    7681         else
    7682         {
    7683           usAbs1 = (-1) * *(psDiffXPtr);
    7684         }
    7685       }
    7686       if( x < iWidth-2 && *(pbEdgeXPtr+1) == true )
    7687       {
    7688         if( *(psDiffXPtr+1) >= 0)
    7689         {
    7690           usAbs2 = *(psDiffXPtr+1);
    7691           //bSign2 = true;
    7692         }
    7693         else
    7694         {
    7695           usAbs2 = (-1) * *(psDiffXPtr+1);
    7696         }
    7697       }
    7698 
    7699       if( x == 0 )
    7700       {
    7701         if( usAbs1 < usAbs2 )
    7702         {
    7703           *pbEdgeXPtr = false;
    7704         }
    7705       }
    7706       else if( x == iWidth-2 )
    7707       {
    7708         if( usAbs1 <= usAbs0 )
    7709           *pbEdgeXPtr = false;
    7710       }
    7711       else
    7712       {
    7713         if( usAbs2 > usAbs0 )
    7714         {
    7715           if( usAbs1 < usAbs2 )
    7716             *pbEdgeXPtr = false;
    7717         }
    7718         else
    7719         {
    7720           if( usAbs1 <= usAbs0 )
    7721             *pbEdgeXPtr = false;
    7722         }
    7723       }
    7724 
    7725       psDiffXPtr++;
    7726       pbEdgeXPtr++;
    7727     }
    7728   }
    7729 
    7730   for( Int y=0; y<iHeight-1; y++ )
    7731   {
    7732     Short* psDiffYPtr = &psDiffY[ y * iWidth ];
    7733     Bool*  pbEdgeYPtr = &pbEdgeY[ y * iWidth ];
    7734     for( Int x=0; x<iWidth; x++ )
    7735     {
    7736       UShort usAbs0=0, usAbs1=0, usAbs2=0;  // 0 : upper, 1 : current, 2 : bottom
    7737       if( y > 0 && *(pbEdgeYPtr-iWidth) == true )
    7738       {
    7739         if( *(psDiffYPtr-iWidth) >= 0)
    7740         {
    7741           usAbs0 = *(psDiffYPtr-iWidth);
    7742         }
    7743         else
    7744         {
    7745           usAbs0 = (-1) * *(psDiffYPtr-iWidth);         
    7746         }
    7747       }
    7748       if( *pbEdgeYPtr == true )
    7749       {
    7750         if( *(psDiffYPtr) >= 0)
    7751         {
    7752           usAbs1 = *(psDiffYPtr);
    7753         }
    7754         else
    7755         {
    7756           usAbs1 = (-1) * *(psDiffYPtr);
    7757         }
    7758       }
    7759       if( y < iHeight-2 && *(pbEdgeYPtr+iWidth) == true )
    7760       {
    7761         if( *(psDiffYPtr+iWidth) >= 0)
    7762         {
    7763           usAbs2 = *(psDiffYPtr+iWidth);         
    7764         }
    7765         else
    7766         {
    7767           usAbs2 = (-1) * *(psDiffYPtr+iWidth);
    7768         }
    7769       }
    7770 
    7771       if( y == 0 )
    7772       {
    7773         if( usAbs1 < usAbs2 )
    7774           *pbEdgeYPtr = false;
    7775       }
    7776       else if( y == iHeight-2 )
    7777       {
    7778         if( usAbs1 <= usAbs0 )
    7779           *pbEdgeYPtr = false;
    7780       }
    7781       else
    7782       {
    7783         if( usAbs2 > usAbs0 )
    7784         {
    7785           if( usAbs1 < usAbs2 )
    7786             *pbEdgeYPtr = false;
    7787         }
    7788         else
    7789         {
    7790           if( usAbs1 <= usAbs0 )
    7791             *pbEdgeYPtr = false;
    7792         }
    7793       }
    7794 
    7795       psDiffYPtr++;
    7796       pbEdgeYPtr++;
    7797     }
    7798   }
    7799 
    7800   // Edge Merging
    7801   for( Int i=0; i< 4 * iWidth * iHeight; i++ )
    7802     pbEdge[ i ] = false;
    7803   /// Even Line (0,2,4,6,...) => Vertical Edge
    7804   for( Int i=0; i<iHeight; i++)
    7805   {
    7806     for( Int j=0; j<iWidth-1; j++)
    7807     {
    7808       pbEdge[ (2 * j + 1) + (2 * i) * 2 * iWidth ] = pbEdgeX[ j + i * iHeight ];
    7809     }
    7810   }
    7811   /// Odd Line (1,3,5,7,...) => Horizontal Edge
    7812   for( Int i=0; i<iHeight-1; i++)
    7813   {
    7814     for( Int j=0; j<iWidth; j++)
    7815     {
    7816       pbEdge[ (2 * j) + (2 * i + 1) * 2 * iWidth ] = pbEdgeY[ j + i * iHeight ];
    7817     }
    7818   }
    7819 
    7820   // Intersection Filling
    7821   /// Vertical Edge between Horizontal Edges
    7822   for( Int i = 1; i < 2 * iHeight - 3; i += 2)
    7823   {
    7824     for( Int j = 0; j < 2 * iWidth - 1; j += 2)
    7825     {
    7826       if( pbEdge[ j + i * 2 * iWidth ] )
    7827       {
    7828         if( j != 0 && pbEdge[ (j - 2) + ((i + 2) * 2 * iWidth) ] )
    7829         {
    7830           if( !pbEdge[ (j - 1) + ((i - 1) * 2 * iWidth) ] && !pbEdge[ (j - 1) + ((i + 3) * 2 * iWidth) ] )
    7831             pbEdge[ (j - 1) + ((i + 1) * 2 * iWidth) ] = true;
    7832         }
    7833         if( j != 2 * iWidth - 2 && pbEdge[ (j + 2) + ((i + 2) * 2 * iWidth) ] )
    7834         {
    7835           if( !pbEdge[ (j + 1) + ((i - 1) * 2 * iWidth) ] && !pbEdge[ (j + 1) + ((i + 3) * 2 * iWidth) ] )
    7836             pbEdge[ (j + 1) + ((i + 1) * 2 * iWidth) ] = true;
    7837         }
    7838       }
    7839     }
    7840   }
    7841   /// Horizontal Edge between Vertical Edges
    7842   for( Int j = 1; j < 2 * iWidth - 3; j += 2)
    7843   {
    7844     for( Int i = 0; i < 2 * iHeight - 1; i += 2)
    7845     {
    7846       if( pbEdge[ j + i * 2 * iWidth ] )
    7847       {
    7848         if( i != 0 && pbEdge[ (j + 2) + ((i - 2) * 2 * iWidth) ] )
    7849         {
    7850           if( !pbEdge[ (j - 1) + ((i - 1) * 2 * iWidth) ] && !pbEdge[ (j + 3) + ((i - 1) * 2 * iWidth) ] )
    7851             pbEdge[ (j + 1) + ((i - 1) * 2 * iWidth) ] = true;
    7852         }
    7853         if( i != 2 * iHeight - 2 && pbEdge[ (j + 2) + ((i + 2) * 2 * iWidth) ] )
    7854         {
    7855           if( !pbEdge[ (j - 1) + ((i + 1) * 2 * iWidth) ] && !pbEdge[ (j + 3) + ((i + 1) * 2 * iWidth) ] )
    7856             pbEdge[ (j + 1) + ((i + 1) * 2 * iWidth) ] = true;
    7857         }
    7858       }
    7859     }
    7860   }
    7861 
    7862   // Static Pruning Unnecessary Edges
    7863   /// Step1. Stack push the unconnected edges
    7864   UShort* pusUnconnectedEdgeStack = new UShort[ 4 * iWidth * iHeight ]; // approximate size calculation
    7865   Int iUnconnectedEdgeStackPtr = 0;
    7866   //// Vertical Edges
    7867   for( Int i = 0; i < 2 * iHeight - 1; i += 2 )
    7868   {
    7869     for( Int j = 1; j < 2 * iWidth - 2; j += 2 )
    7870     {
    7871       if( pbEdge[ j + i * 2 * iWidth ] )
    7872       {
    7873         if( !xCheckTerminatedEdge( pbEdge, j, i, iWidth, iHeight ) )
    7874         {
    7875           pusUnconnectedEdgeStack[iUnconnectedEdgeStackPtr] = (i << 8) | (j);
    7876           iUnconnectedEdgeStackPtr++;
    7877         }
    7878       }
    7879     }
    7880   }
    7881 
    7882   //// Horizontal Edges
    7883   for( Int i = 1; i < 2 * iHeight - 2; i += 2 )
    7884   {
    7885     for( Int j = 0; j < 2 * iWidth - 1; j += 2 )
    7886     {
    7887       if( pbEdge[ j + i * 2 * iWidth ] )
    7888       {
    7889         if( !xCheckTerminatedEdge( pbEdge, j, i, iWidth, iHeight ) )
    7890         {
    7891           pusUnconnectedEdgeStack[iUnconnectedEdgeStackPtr] = (i << 8) | (j);
    7892           iUnconnectedEdgeStackPtr++;
    7893         }
    7894       }
    7895     }
    7896   }
    7897 
    7898   /// Step2. Remove the edges from the stack and push the new unconnected edges
    7899   //// (This step may contain duplicated edges already in the stack)
    7900   //// (But it doesn't cause any functional problems)
    7901   while( iUnconnectedEdgeStackPtr != 0 )
    7902   {
    7903     iUnconnectedEdgeStackPtr--;
    7904     Int iX = pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] & 0xff;
    7905     Int iY = pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] >> 8;
    7906 
    7907     pbEdge[ iX + iY * 2 * iWidth ] = false;
    7908 
    7909     if( iY % 2 == 1 && iX > 0 && pbEdge[ iX - 2 + iY * 2 * iWidth ] &&
    7910       !xCheckTerminatedEdge( pbEdge, iX - 2, iY, iWidth, iHeight ) ) // left
    7911     {
    7912       pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 0) << 8) | (iX - 2);
    7913       iUnconnectedEdgeStackPtr++;
    7914     }
    7915     if( iY % 2 == 1 && iX < 2 * iWidth - 2 && pbEdge[ iX + 2 + iY * 2 * iWidth ] &&
    7916       !xCheckTerminatedEdge( pbEdge, iX + 2, iY, iWidth, iHeight ) ) // right
    7917     {
    7918       pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 0) << 8) | (iX + 2);
    7919       iUnconnectedEdgeStackPtr++;
    7920     }
    7921     if( iY % 2 == 0 && iY > 0 && pbEdge[ iX + (iY - 2) * 2 * iWidth ] &&
    7922       !xCheckTerminatedEdge( pbEdge, iX, iY - 2, iWidth, iHeight ) ) // top
    7923     {
    7924       pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY - 2) << 8) | (iX + 0);
    7925       iUnconnectedEdgeStackPtr++;
    7926     }
    7927     if( iY % 2 == 0 && iY < 2 * iHeight - 2 && pbEdge[ iX + (iY + 2) * 2 * iWidth ] &&
    7928       !xCheckTerminatedEdge( pbEdge, iX, iY + 2, iWidth, iHeight ) ) // bottom
    7929     {
    7930       pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 2) << 8) | (iX + 0);
    7931       iUnconnectedEdgeStackPtr++;
    7932     }
    7933     if( iX > 0 && iY > 0 && pbEdge[ iX - 1 + (iY - 1) * 2 * iWidth ] &&
    7934       !xCheckTerminatedEdge( pbEdge, iX - 1, iY - 1, iWidth, iHeight ) ) // left-top
    7935     {
    7936       pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY - 1) << 8) | (iX - 1);
    7937       iUnconnectedEdgeStackPtr++;
    7938     }
    7939     if( iX < 2 * iWidth - 1 && iY > 0 && pbEdge[ iX + 1 + (iY - 1) * 2 * iWidth ] &&
    7940       !xCheckTerminatedEdge( pbEdge, iX + 1, iY - 1, iWidth, iHeight ) ) // right-top
    7941     {
    7942       pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY - 1) << 8) | (iX + 1);
    7943       iUnconnectedEdgeStackPtr++;
    7944     }
    7945     if( iX > 0 && iY < 2 * iHeight - 1 && pbEdge[ iX - 1 + (iY + 1) * 2 * iWidth ] &&
    7946       !xCheckTerminatedEdge( pbEdge, iX - 1, iY + 1, iWidth, iHeight ) ) // left-bottom
    7947     {
    7948       pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 1) << 8) | (iX - 1);
    7949       iUnconnectedEdgeStackPtr++;
    7950     }
    7951     if( iX < 2 * iWidth - 1 && iY < 2 * iHeight - 1 && pbEdge[ iX + 1 + (iY + 1) * 2 * iWidth ] &&
    7952       !xCheckTerminatedEdge( pbEdge, iX + 1, iY + 1, iWidth, iHeight ) ) // right-bottom
    7953     {
    7954       pusUnconnectedEdgeStack[ iUnconnectedEdgeStackPtr ] = ((iY + 1) << 8) | (iX + 1);
    7955       iUnconnectedEdgeStackPtr++;
    7956     }
    7957   }
    7958 
    7959 
    7960   // Region Generation ( edge -> region )
    7961   Bool* pbRegion = pcCU->getEdgePartition( uiAbsPtIdx );
    7962   Bool* pbVisit  = new Bool[ iWidth * iHeight ];
    7963 
    7964   for( UInt ui = 0; ui < iWidth * iHeight; ui++ )
    7965   {
    7966     pbRegion[ ui ] = true; // fill it as region 1 (we'll discover region 0 next)
    7967     pbVisit [ ui ] = false;
    7968   }
    7969 
    7970   Int* piStack = new Int[ iWidth * iHeight ];
    7971 
    7972   Int iPtr = 0;
    7973 
    7974   piStack[iPtr++] = (0 << 8) | (0);
    7975   pbRegion[ 0 ] = false;
    7976 
    7977   while(iPtr > 0)
    7978   {
    7979     Int iTmp = piStack[--iPtr];
    7980     Int iX1, iY1;
    7981     iX1 = iTmp & 0xff;
    7982     iY1 = (iTmp >> 8) & 0xff;
    7983 
    7984     pbVisit[ iX1 + iY1 * iWidth ] = true;
    7985 
    7986     assert( iX1 >= 0 && iX1 < iWidth );
    7987     assert( iY1 >= 0 && iY1 < iHeight );
    7988 
    7989     if( iX1 > 0 && !pbEdge[ 2 * iX1 - 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 - 1 + iY1 * iWidth ] )
    7990     {
    7991       piStack[iPtr++] = (iY1 << 8) | (iX1 - 1);
    7992       pbRegion[ iX1 - 1 + iY1 * iWidth ] = false;
    7993     }
    7994     if( iX1 < iWidth - 1 && !pbEdge[ 2 * iX1 + 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 + 1 + iY1 * iWidth ] )
    7995     {
    7996       piStack[iPtr++] = (iY1 << 8) | (iX1 + 1);
    7997       pbRegion[ iX1 + 1 + iY1 * iWidth ] = false;
    7998     }
    7999     if( iY1 > 0 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 - 1) * iWidth ] && !pbVisit[ iX1 + (iY1 - 1) * iWidth ] )
    8000     {
    8001       piStack[iPtr++] = ((iY1 - 1) << 8) | iX1;
    8002       pbRegion[ iX1 + (iY1 - 1) * iWidth ] = false;
    8003     }
    8004     if( iY1 < iHeight - 1 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 + 1) * iWidth ] && !pbVisit[ iX1 + (iY1 + 1) * iWidth ] )
    8005     {
    8006       piStack[iPtr++] = ((iY1 + 1) << 8) | iX1;
    8007       pbRegion[ iX1 + (iY1 + 1) * iWidth ] = false;
    8008     }
    8009   }
    8010 
    8011   ///////////
    8012   iPtr = 0;
    8013   for( Int i = 0; i < iWidth * iHeight; i++ )
    8014     pbVisit[ i ] = false;
    8015   piStack[ iPtr++ ] = (0 << 8) | (0); // initial seed
    8016   while( iPtr > 0 && iPtr < iWidth * iHeight )
    8017   {
    8018     Int iX;
    8019     Int iY;
    8020     iPtr--;
    8021     iX = piStack[ iPtr ] & 0xff;
    8022     iY = piStack[ iPtr ] >> 8;
    8023     pbVisit[ iY * iWidth + iX ] = true;
    8024 
    8025     if( iY > 0 && !pbVisit[ (iY - 1) * iWidth + iX ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ (iY - 1) * iWidth + iX ] )
    8026     {
    8027       piStack[ iPtr++ ] = ((iY - 1) << 8) | iX;
    8028     }
    8029     if( iY < iHeight - 1 && !pbVisit[ (iY + 1) * iWidth + iX ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ (iY + 1) * iWidth + iX ] )
    8030     {
    8031       piStack[ iPtr++ ] = ((iY + 1) << 8) | iX;
    8032     }
    8033     if( iX > 0 && !pbVisit[ iY * iWidth + (iX - 1) ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ iY * iWidth + (iX - 1) ] )
    8034     {
    8035       piStack[ iPtr++ ] = (iY << 8) | (iX - 1);
    8036     }
    8037     if( iX < iWidth - 1 && !pbVisit[ iY * iWidth + (iX + 1) ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ iY * iWidth + (iX + 1) ] )
    8038     {
    8039       piStack[ iPtr++ ] = (iY << 8) | (iX + 1);
    8040     }
    8041   }
    8042   assert( iPtr == 0 || iPtr == iWidth * iHeight );
    8043 
    8044   Bool bBipartition;
    8045   if( iPtr == iWidth * iHeight )
    8046   {
    8047     bBipartition = false; // single partition
    8048   }
    8049   else
    8050   {
    8051     for( Int i = 0; i < iWidth * iHeight; i++ )
    8052     {
    8053       if( !pbVisit[ i ] )
    8054       {
    8055         piStack[ iPtr++ ] = (( i / iWidth ) << 8) | ( i % iWidth );
    8056         pbVisit[ i ] = true;
    8057         break;
    8058       }
    8059     }
    8060     while( iPtr > 0 )
    8061     {
    8062       Int iX;
    8063       Int iY;
    8064       iPtr--;
    8065       iX = piStack[ iPtr ] & 0xff;
    8066       iY = piStack[ iPtr ] >> 8;
    8067       pbVisit[ iY * iWidth + iX ] = true;
    8068 
    8069       if( iY > 0 && !pbVisit[ (iY - 1) * iWidth + iX ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ (iY - 1) * iWidth + iX ] )
    8070       {
    8071         piStack[ iPtr++ ] = ((iY - 1) << 8) | iX;
    8072       }
    8073       if( iY < iHeight - 1 && !pbVisit[ (iY + 1) * iWidth + iX ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ (iY + 1) * iWidth + iX ] )
    8074       {
    8075         piStack[ iPtr++ ] = ((iY + 1) << 8) | iX;
    8076       }
    8077       if( iX > 0 && !pbVisit[ iY * iWidth + (iX - 1) ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ iY * iWidth + (iX - 1) ] )
    8078       {
    8079         piStack[ iPtr++ ] = (iY << 8) | (iX - 1);
    8080       }
    8081       if( iX < iWidth - 1 && !pbVisit[ iY * iWidth + (iX + 1) ] && pbRegion[ iY * iWidth + iX ] == pbRegion[ iY * iWidth + (iX + 1) ] )
    8082       {
    8083         piStack[ iPtr++ ] = (iY << 8) | (iX + 1);
    8084       }
    8085     }
    8086     bBipartition = true;
    8087     for( Int i = 0; i < iWidth * iHeight; i++ )
    8088     {
    8089       if( !pbVisit[ i ] )
    8090       {
    8091         bBipartition = false;
    8092         break;
    8093       }
    8094     }
    8095   }
    8096 
    8097   xFree( pbEdge );
    8098   delete[] pbEdgeX; pbEdgeX = NULL;
    8099   delete[] pbEdgeY; pbEdgeY = NULL;
    8100   delete[] psDiffX; psDiffX = NULL;
    8101   delete[] psDiffY; psDiffY = NULL;
    8102   delete[] pusUnconnectedEdgeStack; pusUnconnectedEdgeStack = NULL;
    8103   delete[] pbVisit; pbVisit = NULL;
    8104   delete[] piStack; piStack = NULL;
    8105 
    8106   if( bBipartition )
    8107   {
    8108     return xConstructChainCode( pcCU, uiAbsPtIdx, (UInt)iWidth, (UInt)iHeight );
    8109   }
    8110   else
    8111   {
    8112     return false;
    8113   }
    8114 }
    8115 
    8116 Bool TEncSearch::xCheckTerminatedEdge( Bool* pbEdge, Int iX, Int iY, Int iWidth, Int iHeight )
    8117 {
    8118   if( (iY % 2) == 0 ) // vertical edge
    8119   {
    8120     Bool bTopConnected = false;
    8121     Bool bBottomConnected = false;
    8122 
    8123     if( iY != 0 )
    8124     {
    8125       if( pbEdge[ iX + (iY - 2) * 2 * iWidth ] )
    8126         bTopConnected = true;
    8127       if( pbEdge[ (iX - 1) + (iY - 1) * 2 * iWidth ] )
    8128         bTopConnected = true;
    8129       if( pbEdge[ (iX + 1) + (iY - 1) * 2 * iWidth ] )
    8130         bTopConnected = true;
    8131     }
    8132     else
    8133     {
    8134       bTopConnected = true;
    8135     }
    8136 
    8137 
    8138     if( iY != 2 * iHeight - 2 )
    8139     {
    8140       if( pbEdge[ iX + (iY + 2) * 2 * iWidth ] )
    8141         bBottomConnected = true;
    8142       if( pbEdge[ (iX - 1) + (iY + 1) * 2 * iWidth ] )
    8143         bBottomConnected = true;
    8144       if( pbEdge[ (iX + 1) + (iY + 1) * 2 * iWidth ] )
    8145         bBottomConnected = true;
    8146     }
    8147     else
    8148     {
    8149       bBottomConnected = true;
    8150     }
    8151 
    8152 
    8153     if( bTopConnected && bBottomConnected )
    8154     {
    8155       return true;
    8156     }
    8157     else
    8158     {
    8159       return false;
    8160     }
    8161   }
    8162   else
    8163   {
    8164     Bool bLeftConnected = false;
    8165     Bool bRightConnected = false;
    8166 
    8167     if( iX != 0 )
    8168     {
    8169       if( pbEdge[ (iX - 2) + iY * 2 * iWidth ] )
    8170         bLeftConnected = true;
    8171       if( pbEdge[ (iX - 1) + (iY - 1) * 2 * iWidth ] )
    8172         bLeftConnected = true;
    8173       if( pbEdge[ (iX - 1) + (iY + 1) * 2 * iWidth ] )
    8174         bLeftConnected = true;
    8175     }
    8176     else
    8177     {
    8178       bLeftConnected = true;
    8179     }
    8180 
    8181     if( iX != 2 * iWidth - 2 )
    8182     {
    8183       if( pbEdge[ (iX + 2) + iY * 2 * iWidth ] )
    8184         bRightConnected = true;
    8185       if( pbEdge[ (iX + 1) + (iY - 1) * 2 * iWidth ] )
    8186         bRightConnected = true;
    8187       if( pbEdge[ (iX + 1) + (iY + 1) * 2 * iWidth ] )
    8188         bRightConnected = true;
    8189     }
    8190     else
    8191     {
    8192       bRightConnected = true;
    8193     }
    8194 
    8195 
    8196     if( bLeftConnected && bRightConnected )
    8197     {
    8198       return true;
    8199     }
    8200     else
    8201     {
    8202       return false;
    8203     }
    8204   }
    8205 }
    8206 Bool TEncSearch::xConstructChainCode( TComDataCU* pcCU, UInt uiAbsPtIdx, UInt uiWidth, UInt uiHeight )
    8207 {
    8208   //UInt   uiWidth    = pcCU->getWidth( uiPartIdx ) >> (bPU4x4 ? 1 : 0);
    8209   //UInt   uiHeight   = pcCU->getHeight( uiPartIdx ) >> (bPU4x4 ? 1 : 0);
    8210   Bool*  pbEdge     = (Bool*) xMalloc( Bool, uiWidth * uiHeight * 4 );
    8211   Bool*  pbVisit    = (Bool*) xMalloc( Bool, uiWidth * uiHeight * 4 );
    8212   UInt   uiMaxEdge  = uiWidth * (RBC_MAX_EDGE_NUM_PER_4x4 / 4);
    8213   Bool*  pbRegion   = pcCU->getEdgePartition( uiAbsPtIdx );
    8214   UChar* piEdgeCode = pcCU->getEdgeCode( uiAbsPtIdx );
    8215   Bool   bStartLeft = false;
    8216   Bool   bPossible  = false;
    8217   Bool   bFinish    = false;
    8218   Int    iStartPosition = -1;
    8219   Int    iPtr = 0;
    8220   Int    iDir = -1, iNextDir = -1;
    8221   Int    iArrow = -1, iNextArrow = -1;
    8222   Int    iX = -1, iY = -1;
    8223   Int    iDiffX = 0, iDiffY = 0;
    8224   UChar  iCode = 255;
    8225   UInt   uiWidth2 = uiWidth * 2;
    8226 
    8227   for( Int i = 0; i < uiWidth * uiHeight * 4; i++ )
    8228     pbEdge[ i ] = false;
    8229 
    8230   for( Int i = 0; i < uiHeight; i++ )
    8231   {
    8232     for( Int j = 0; j < uiWidth - 1; j++ )
    8233     {
    8234       if( pbRegion[ i * uiWidth + j ] != pbRegion[ i * uiWidth + j + 1 ] )
    8235         pbEdge[ i * uiWidth * 4 + j * 2 + 1 ] = true;
    8236     }
    8237   }
    8238 
    8239   for( Int i = 0; i < uiHeight - 1; i++ )
    8240   {
    8241     for( Int j = 0; j < uiWidth; j++ )
    8242     {
    8243       if( pbRegion[ (i + 0) * uiWidth + j ] != pbRegion[ (i + 1) * uiWidth + j ] )
    8244         pbEdge[ (2 * i + 1) * 2 * uiWidth + j * 2 ] = true;
    8245     }
    8246   }
    8247 
    8248   for( Int i = 1; i < uiWidth2 - 2; i+=2 )
    8249   {
    8250     if(pbEdge[ i ])
    8251     {
    8252       bPossible  = true;
    8253       bStartLeft = false;
    8254       iStartPosition = iX = i;
    8255       iY = 0;
    8256       iDir = 3;
    8257       iArrow = 3;
    8258       break;
    8259     }
    8260   }
    8261 
    8262   if( !bPossible )
    8263   {
    8264     for( Int i = 1; i < uiWidth2 - 2; i+=2 )
    8265     {
    8266       if(pbEdge[ i * uiWidth2 ])
    8267       {
    8268         bPossible  = true;
    8269         bStartLeft = true;
    8270         iX = 0;
    8271         iStartPosition = iY = i;
    8272         iDir = 1;
    8273         iArrow = 1;
    8274         break;
    8275       }
    8276     }
    8277   }
    8278 
    8279   if( bPossible )
    8280   {
    8281     for( Int i = 0; i < 4 * uiWidth * uiHeight; i++ )
    8282       pbVisit[ i ] = false;
    8283 
    8284     while( !bFinish )
    8285     {
    8286       Bool bArrowSkip = false;
    8287       pbVisit[ iX + iY * uiWidth2 ] = true;
    8288 
    8289       switch( iDir )
    8290       {
    8291       case 0: // left
    8292         if( iX > 0 && !pbVisit[ (iX - 2) + iY * uiWidth2 ] && pbEdge[ (iX - 2) + iY * uiWidth2 ] ) // left
    8293         {
    8294           iDiffX = -2;
    8295           iDiffY =  0;
    8296           iNextDir = 0;
    8297           iNextArrow = 0;
    8298         }
    8299         else if( iX > 0 && !pbVisit[ (iX - 1) + (iY - 1) * uiWidth2 ] && pbEdge[ (iX - 1) + (iY - 1) * uiWidth2 ] ) // top
    8300         {
    8301           iDiffX = -1;
    8302           iDiffY = -1;
    8303           iNextDir = 2;
    8304           iNextArrow = 4;
    8305         }
    8306         else if( iX > 0 && !pbVisit[ (iX - 1) + (iY + 1) * uiWidth2 ] && pbEdge[ (iX - 1) + (iY + 1) * uiWidth2 ] ) // bottom
    8307         {
    8308           iDiffX = -1;
    8309           iDiffY = +1;
    8310           iNextDir = 3;
    8311           iNextArrow = iArrow;
    8312           if( !(iPtr == 0 && iX == uiWidth2 - 2 && iY == uiHeight * 2 - 3) )
    8313             bArrowSkip = true;
    8314           else
    8315             iNextArrow = 3;
    8316         }
    8317         else if( iX == 0 )
    8318         {
    8319           iDiffX = 0;
    8320           iDiffY = 0;
    8321           iNextDir = iDir;
    8322           iNextArrow = iArrow;
    8323           bFinish = true;
    8324           continue;
    8325         }
    8326         else
    8327         {
    8328           iPtr = 0; // edge loop or unwanted case
    8329           bFinish = true;
    8330           //continue;
    8331           assert(false);
    8332         }
    8333         break;
    8334       case 1: // right
    8335         if( iX < uiWidth2 - 2 && !pbVisit[ (iX + 2) + iY * uiWidth2 ] && pbEdge[ (iX + 2) + iY * uiWidth2 ] ) // right
    8336         {
    8337           iDiffX = +2;
    8338           iDiffY =  0;
    8339           iNextDir = 1;
    8340           iNextArrow = 1;
    8341         }
    8342         else if( iX < uiWidth2 - 2 && !pbVisit[ (iX + 1) + (iY - 1) * uiWidth2 ] && pbEdge[ (iX + 1) + (iY - 1) * uiWidth2 ] ) // top
    8343         {
    8344           iDiffX = +1;
    8345           iDiffY = -1;
    8346           iNextDir = 2;
    8347           iNextArrow = iArrow;
    8348           if( !(iPtr == 0 && iX == 0 && iY == 1) )
    8349             bArrowSkip = true;
    8350           else
    8351             iNextArrow = 2;
    8352         }
    8353         else if( iX < uiWidth2 - 2 && !pbVisit[ (iX + 1) + (iY + 1) * uiWidth2 ] && pbEdge[ (iX + 1) + (iY + 1) * uiWidth2 ] ) // bottom
    8354         {
    8355           iDiffX = +1;
    8356           iDiffY = +1;
    8357           iNextDir = 3;
    8358           iNextArrow = 7;
    8359         }
    8360         else if( iX == uiWidth2 - 2 )
    8361         {
    8362           iDiffX = 0;
    8363           iDiffY = 0;
    8364           iNextDir = iDir;
    8365           iNextArrow = iArrow;
    8366           bFinish = true;
    8367           continue;
    8368         }
    8369         else
    8370         {
    8371           iPtr = 0; // edge loop or unwanted case
    8372           bFinish = true;
    8373           //continue;
    8374           assert(false);
    8375         }
    8376         break;
    8377       case 2: // top
    8378         if( iY > 0 && !pbVisit[ (iX - 1) + (iY - 1) * uiWidth2 ] && pbEdge[ (iX - 1) + (iY - 1) * uiWidth2 ] ) // left
    8379         {
    8380           iDiffX = -1;
    8381           iDiffY = -1;
    8382           iNextDir = 0;
    8383           iNextArrow = iArrow;
    8384           if( !(iPtr == 0 && iX == 1 && iY == uiHeight * 2 - 2) )
    8385             bArrowSkip = true;
    8386           else
    8387             iNextArrow = 0;
    8388         }
    8389         else if( iY > 0 && !pbVisit[ (iX + 1) + (iY - 1) * uiWidth2 ] && pbEdge[ (iX + 1) + (iY - 1) * uiWidth2 ] ) // right
    8390         {
    8391           iDiffX = +1;
    8392           iDiffY = -1;
    8393           iNextDir = 1;
    8394           iNextArrow = 5;
    8395         }
    8396         else if( iY > 0 && !pbVisit[ iX + (iY - 2) * uiWidth2 ] && pbEdge[ iX + (iY - 2) * uiWidth2 ] ) // top
    8397         {
    8398           iDiffX =  0;
    8399           iDiffY = -2;
    8400           iNextDir = 2;
    8401           iNextArrow = 2;
    8402         }
    8403         else if( iY == 0 )
    8404         {
    8405           iDiffX = 0;
    8406           iDiffY = 0;
    8407           iNextDir = iDir;
    8408           iNextArrow = iArrow;
    8409           bFinish = true;
    8410           continue;
    8411         }
    8412         else
    8413         {
    8414           iPtr = 0; // edge loop or unwanted case
    8415           bFinish = true;
    8416           //continue;
    8417           assert(false);
    8418         }
    8419         break;
    8420       case 3: // bottom
    8421         if( iY < uiWidth2 - 2 && !pbVisit[ (iX - 1) + (iY + 1) * uiWidth2 ] && pbEdge[ (iX - 1) + (iY + 1) * uiWidth2 ] ) // left
    8422         {
    8423           iDiffX = -1;
    8424           iDiffY = +1;
    8425           iNextDir = 0;
    8426           iNextArrow = 6;
    8427         }
    8428         else if( iY < uiWidth2 - 2 && !pbVisit[ (iX + 1) + (iY + 1) * uiWidth2 ] && pbEdge[ (iX + 1) + (iY + 1) * uiWidth2 ] ) // right
    8429         {
    8430           iDiffX = +1;
    8431           iDiffY = +1;
    8432           iNextDir = 1;
    8433           iNextArrow = iArrow;
    8434           if( !(iPtr == 0 && iX == uiWidth * 2 - 3 && iY == 0) )
    8435             bArrowSkip = true;
    8436           else
    8437             iNextArrow = 1;
    8438         }
    8439         else if( iY < uiWidth2 - 2 && !pbVisit[ iX + (iY + 2) * uiWidth2 ] && pbEdge[ iX + (iY + 2) * uiWidth2 ] ) // bottom
    8440         {
    8441           iDiffX =  0;
    8442           iDiffY = +2;
    8443           iNextDir = 3;
    8444           iNextArrow = 3;
    8445         }
    8446         else if( iY == uiWidth2 - 2 )
    8447         {
    8448           iDiffX = 0;
    8449           iDiffY = 0;
    8450           iNextDir = iDir;
    8451           iNextArrow = iArrow;
    8452           bFinish = true;
    8453           continue;
    8454         }
    8455         else
    8456         {
    8457           iPtr = 0; // edge loop or unwanted case
    8458           bFinish = true;
    8459           //continue;
    8460           assert(false);
    8461         }
    8462         break;
    8463       }
    8464 
    8465       const UChar tableCode[8][8] = { { 0, -1, 4, 3, 2, 6, 1, 5 }, // iArrow(current direction), iNextArrow(next direction)
    8466       { -1, 0, 3, 4, 5, 1, 6, 2 },
    8467       { 3, 4, 0, -1, 1, 2, 5, 6 },
    8468       { 4, 3, -1, 0, 6, 5, 2, 1 },
    8469       { 1, 6, 2, 5, 0, 4, 3, -1 },
    8470       { 5, 2, 1, 6, 3, 0, -1, 4 },
    8471       { 2, 5, 6, 1, 4, -1, 0, 3 },
    8472       { 6, 1, 5, 2, -1, 3, 4, 0 } };
    8473 
    8474       iCode = tableCode[iArrow][iNextArrow];
    8475 
    8476       if(iPtr >= uiMaxEdge)
    8477       {
    8478         iPtr = 0; // over the maximum number of edge
    8479         bPossible = false;
    8480         break;
    8481       }
    8482 
    8483       if( !bArrowSkip )
    8484       {
    8485         piEdgeCode[iPtr++] = iCode; // first edge coding
    8486         //printf("xEdgeCoding: (%d,%d)->(%d,%d) code %d\n",iX,iY, iX+iDiffX, iY+iDiffY, iCode);
    8487       }
    8488 
    8489       iX += iDiffX;
    8490       iY += iDiffY;
    8491       iDir = iNextDir;
    8492       iArrow = iNextArrow;
    8493     }
    8494   }
    8495 
    8496   pcCU->setEdgeLeftFirst( uiAbsPtIdx, bStartLeft );
    8497   pcCU->setEdgeStartPos ( uiAbsPtIdx, bStartLeft ? (iStartPosition - 1) >> 1 : (iStartPosition + 1) >> 1);
    8498   pcCU->setEdgeNumber   ( uiAbsPtIdx, iPtr );
    8499 
    8500   xFree( pbEdge );
    8501   xFree( pbVisit );
    8502 
    8503   return (iPtr != 0);
    8504 }
    8505 #endif
     7407
     7408#endif
     7409
    85067410#endif
    85077411//! \}
  • branches/HTM-9.2-dev0/source/Lib/TLibEncoder/TEncSearch.h

    r724 r764  
    351351  Void xSearchDmmDeltaDCs         ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );
    352352  Void xSearchDmm1Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx );
    353 #if !SEC_DMM3_RBC_F0147
    354   Void xSearchDmm3Wedge           ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, UInt& ruiIntraTabIdx, UInt colTexIntraDir );
    355 #endif
    356 #endif
    357 #if H_3D_DIM_RBC
    358   Void xSearchRbcDeltaDCs         ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piOrig, Pel* piPredic, UInt uiStride, Bool* biSegPattern, Int patternStride, UInt uiWidth, UInt uiHeight, Pel& rDeltaDC1, Pel& rDeltaDC2 );
    359   Bool xSearchRbcEdge             ( TComDataCU* pcCU, UInt uiAbsPtIdx, Pel* piRef, UInt uiRefStride,  Int  iWidth,  Int  iHeight );
    360  
    361   Bool xCheckTerminatedEdge       ( Bool* pbEdge, Int iX, Int iY, Int iWidth, Int iHeight );
    362   Bool xConstructChainCode        ( TComDataCU* pcCU, UInt uiAbsPtIdx, UInt uiWidth, UInt uiHeight );
    363353#endif
    364354#if H_3D_DIM_SDC
Note: See TracChangeset for help on using the changeset viewer.