Changeset 100 in 3DVCSoftware for trunk/source/Lib/TLibCommon


Ignore:
Timestamp:
9 Aug 2012, 12:53:16 (13 years ago)
Author:
tech
Message:

Adopted modifications:

  • disparity vector generation (A0097)
  • inter-view motion prediction modification (A0049)
  • simplification of disparity vector derivation (A0126)
  • region boundary chain coding (A0070)
  • residual skip intra (A0087)
  • VSO modification (A0033/A0093)

+ Clean ups + Bug fixes

Update of cfg files (A0033 modification 2)

Location:
trunk/source/Lib/TLibCommon
Files:
24 edited

Legend:

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

    r77 r100  
    5858
    5959#define HM_VERSION        "6.1"
    60 #define NV_VERSION        "3.1rc1"                 ///< Current software version
     60#define NV_VERSION        "4.0rc1"                 ///< Current software version
    6161
    6262// ====================================================================================================================
     
    130130#if ( HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED )
    131131#define DEPTH_MAP_GENERATION        1
     132#define PDM_REMOVE_DEPENDENCE       1      //bug-fix for DMDV JCT2-A0095
    132133#else
    133134#define DEPTH_MAP_GENERATION        0
     
    138139#define PDM_NO_INTER_UPDATE               1         // no update for inter (but not inter-view) predicted blocks
    139140#define PDM_MERGE_POS                     0         // position of pdm in merge list (0..4)
    140 #if SAIT_IMPROV_MOTION_PRED_M24829
     141#if SAIT_IMPROV_MOTION_PRED_M24829&!QC_MULTI_DIS_CAN
    141142#define PDM_AMVP_POS                      0         // position of pdm in amvp list  (0..3)
    142143#else
     
    170171#define STD_CAM_PARAMETERS_PRECISION 5        ///< quarter luma sample accuarcy for derived disparities (as default)
    171172
    172 #define LOG2_DISP_PREC_LUT                              2                               ///< log2 of disparity precision used in integer disparity LUTs
     173#define LOG2_DISP_PREC_LUT           2          ///< log2 of disparity precision used in integer disparity LUTs
    173174
    174175// ====================================================================================================================
     
    400401#define Clip3( MinVal, MaxVal, a)   ( ((a)<(MinVal)) ? (MinVal) : (((a)>(MaxVal)) ? (MaxVal) :(a)) )  ///< general min/max clip
    401402#define RemoveBitIncrement(x)       ( (x + ( (1 << g_uiBitIncrement) >> 1 )) >> g_uiBitIncrement )     ///< Remove Bit increment
     403
     404#if SAIT_VSO_EST_A0033
     405#define ROUND(a)  (((a) < 0)? (int)((a) - 0.5) : (int)((a) + 0.5))
     406#endif
    402407
    403408// ====================================================================================================================
     
    495500  NAL_UNIT_UNSPECIFIED_24,
    496501#if VIDYO_VPS_INTEGRATION
    497         NAL_UNIT_VPS,
     502  NAL_UNIT_VPS,
    498503#else
    499504  NAL_UNIT_UNSPECIFIED_25,
  • trunk/source/Lib/TLibCommon/ContextTables.h

    r56 r100  
    152152#endif
    153153
     154#if LGE_EDGE_INTRA
     155#define NUM_EDGE_INTRA_CTX            1
     156#if LGE_EDGE_INTRA_DELTA_DC
     157#define NUM_EDGE_INTRA_DELTA_DC_CTX   2 // one for Delta_DC flag, another for Delta_DC value
     158#endif
     159#endif
     160
    154161// ====================================================================================================================
    155162// Tables
     
    12721279  }
    12731280};
     1281
     1282#if LGE_EDGE_INTRA
     1283static const Short
     1284INIT_EDGE_INTRA[3][NUM_EDGE_INTRA_CTX] =
     1285{
     1286  {
     1287    CNU
     1288  },
     1289  {
     1290    CNU
     1291  },
     1292  {
     1293    CNU
     1294  }
     1295};
     1296
     1297#if LGE_EDGE_INTRA_DELTA_DC
     1298static const Short
     1299INIT_EDGE_INTRA_DELTA_DC[3][NUM_EDGE_INTRA_DELTA_DC_CTX] =
     1300{
     1301  {
     1302    CNU, CNU
     1303  },
     1304  {
     1305    CNU, CNU
     1306  },
     1307  {
     1308    CNU, CNU
     1309  }
     1310};
     1311#endif
     1312#endif
     1313
    12741314#endif
    12751315
    12761316//! \}
    12771317
    1278 
    1279 #endif
    1280 
     1318#endif
     1319
  • trunk/source/Lib/TLibCommon/NAL.h

    r77 r100  
    5252#endif
    5353#if VIDYO_VPS_INTEGRATION
    54         unsigned    m_layerId;
     54  unsigned    m_layerId;
    5555  unsigned    m_temporalId;  ///< temporal_id
    5656#else
     
    100100    m_isDepth     = isDepth;
    101101#else
    102                 m_layerId = layerId;
     102    m_layerId = layerId;
    103103#endif
    104104    m_temporalId  = temporalID;
     
    124124    m_isDepth     = isDepth;
    125125#else
    126                 m_layerId = layerId;
     126    m_layerId = layerId;
    127127#endif
    128128    m_temporalId  = temporalID;
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r81 r100  
    141141  m_pbResPredFlag      = NULL;
    142142#endif
     143#if LGE_EDGE_INTRA
     144  m_pucEdgeCode         = NULL;
     145  m_pucEdgeNumber       = NULL;
     146  m_pucEdgeStartPos     = NULL;
     147  m_pbEdgeLeftFirst     = NULL;
     148  m_pbEdgePartition     = NULL;
     149#if LGE_EDGE_INTRA_DELTA_DC
     150  m_piEdgeDeltaDC0      = NULL;
     151  m_piEdgeDeltaDC1      = NULL;
     152#endif
     153#endif
    143154}
    144155
     
    259270    m_piContourPredTexDeltaDC2 = (Int* )xMalloc(Int,  uiNumPartition);
    260271#endif
     272#if LGE_EDGE_INTRA
     273    m_pucEdgeCode       = (UChar*)xMalloc(UChar, uiNumPartition * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4);
     274    m_pucEdgeNumber     = (UChar*)xMalloc(UChar, uiNumPartition);
     275    m_pucEdgeStartPos   = (UChar*)xMalloc(UChar, uiNumPartition);
     276    m_pbEdgeLeftFirst   = (Bool*) xMalloc(Bool,  uiNumPartition);
     277    m_pbEdgePartition   = (Bool*) xMalloc(Bool,  uiNumPartition * 16);
     278#if LGE_EDGE_INTRA_DELTA_DC
     279    m_piEdgeDeltaDC0    = (Int* ) xMalloc(Int,   uiNumPartition);
     280    m_piEdgeDeltaDC1    = (Int* ) xMalloc(Int,   uiNumPartition);
     281#endif
     282#endif
    261283  }
    262284  else
     
    359381    if ( m_piContourPredTexDeltaDC2 ) { xFree(m_piContourPredTexDeltaDC2); m_piContourPredTexDeltaDC2 = NULL; }
    360382#endif   
     383#if LGE_EDGE_INTRA
     384  if ( m_pbEdgeLeftFirst  ) { xFree(m_pbEdgeLeftFirst);   m_pbEdgeLeftFirst = NULL; }
     385  if ( m_pucEdgeStartPos  ) { xFree(m_pucEdgeStartPos);   m_pucEdgeStartPos = NULL; }
     386  if ( m_pucEdgeNumber    ) { xFree(m_pucEdgeNumber);     m_pucEdgeNumber   = NULL; }
     387  if ( m_pucEdgeCode      ) { xFree(m_pucEdgeCode);       m_pucEdgeCode     = NULL; }
     388  if ( m_pbEdgePartition    ) { xFree(m_pbEdgePartition); m_pbEdgePartition = NULL; }
     389#if LGE_EDGE_INTRA_DELTA_DC
     390  if ( m_piEdgeDeltaDC0     ) { xFree(m_piEdgeDeltaDC0);  m_piEdgeDeltaDC0  = NULL; }
     391  if ( m_piEdgeDeltaDC1     ) { xFree(m_piEdgeDeltaDC1);  m_piEdgeDeltaDC1  = NULL; }
     392#endif
     393#endif
    361394    m_acCUMvField[0].destroy();
    362395    m_acCUMvField[1].destroy();
     
    10931126  m_piContourPredTexDeltaDC2 = pcCU->getContourPredTexDeltaDC2() + uiPart;   
    10941127#endif
     1128#if LGE_EDGE_INTRA
     1129  if( pcCU->getSlice()->getSPS()->isDepth() )
     1130  {
     1131    m_pucEdgeCode         = pcCU->getEdgeCode( uiPart );
     1132    m_pucEdgeNumber       = pcCU->getEdgeNumber() + uiPart;
     1133    m_pucEdgeStartPos     = pcCU->getEdgeStartPos() + uiPart;
     1134    m_pbEdgeLeftFirst     = pcCU->getEdgeLeftFirst() + uiPart;
     1135    m_pbEdgePartition     = pcCU->getEdgePartition( uiPart );
     1136#if LGE_EDGE_INTRA_DELTA_DC
     1137    m_piEdgeDeltaDC0      = pcCU->getEdgeDeltaDC0() + uiPart;
     1138    m_piEdgeDeltaDC1      = pcCU->getEdgeDeltaDC1() + uiPart;
     1139#endif
     1140  }
     1141#endif
    10951142}
    10961143
     
    12501297  memcpy( m_piContourPredTexDeltaDC2 + uiOffset, pcCU->getContourPredTexDeltaDC2(), sizeof( Int  ) * uiNumPartition );
    12511298#endif
     1299
     1300#if LGE_EDGE_INTRA
     1301  if( getSlice()->getSPS()->isDepth() )
     1302  {
     1303    memcpy( getEdgeCode( uiOffset ), pcCU->getEdgeCode(0), iSizeInUchar * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 );
     1304    memcpy( getEdgeNumber() + uiOffset, pcCU->getEdgeNumber(), iSizeInUchar );
     1305    memcpy( getEdgeStartPos() + uiOffset, pcCU->getEdgeStartPos(), iSizeInUchar );
     1306    memcpy( getEdgeLeftFirst() + uiOffset, pcCU->getEdgeLeftFirst(), iSizeInBool );
     1307    memcpy( getEdgePartition( uiOffset ), pcCU->getEdgePartition(0), iSizeInBool * 16 );
     1308#if LGE_EDGE_INTRA_DELTA_DC
     1309    memcpy( getEdgeDeltaDC0() + uiOffset, pcCU->getEdgeDeltaDC0(), sizeof( Int  ) * uiNumPartition );
     1310    memcpy( getEdgeDeltaDC1() + uiOffset, pcCU->getEdgeDeltaDC1(), sizeof( Int  ) * uiNumPartition );
     1311#endif
     1312  }
     1313#endif
     1314
    12521315#if HHI_MPI
    12531316  memcpy( m_piTextureModeDepth + uiOffset, pcCU->getTextureModeDepth(), sizeof( Int ) * uiNumPartition );
     
    13521415  memcpy( rpcCU->getContourPredTexDeltaDC2() + m_uiAbsIdxInLCU, m_piContourPredTexDeltaDC2, sizeof( Int  ) * m_uiNumPartition );
    13531416#endif
     1417
     1418#if LGE_EDGE_INTRA
     1419  if( rpcCU->getSlice()->getSPS()->isDepth() )
     1420  {
     1421    memcpy( rpcCU->getEdgeCode( m_uiAbsIdxInLCU ),        m_pucEdgeCode,    iSizeInUchar * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 );
     1422    memcpy( rpcCU->getEdgeNumber()    + m_uiAbsIdxInLCU,  m_pucEdgeNumber,  iSizeInUchar );
     1423    memcpy( rpcCU->getEdgeStartPos()  + m_uiAbsIdxInLCU,  m_pucEdgeStartPos,iSizeInUchar );
     1424    memcpy( rpcCU->getEdgeLeftFirst() + m_uiAbsIdxInLCU,  m_pbEdgeLeftFirst,iSizeInBool );
     1425    memcpy( rpcCU->getEdgePartition( m_uiAbsIdxInLCU ),   m_pbEdgePartition,iSizeInBool * 16 );
     1426#if LGE_EDGE_INTRA_DELTA_DC
     1427    memcpy( rpcCU->getEdgeDeltaDC0() + m_uiAbsIdxInLCU,   m_piEdgeDeltaDC0, sizeof( Int  ) * m_uiNumPartition );
     1428    memcpy( rpcCU->getEdgeDeltaDC1() + m_uiAbsIdxInLCU,   m_piEdgeDeltaDC1, sizeof( Int  ) * m_uiNumPartition );
     1429#endif
     1430  }
     1431#endif
     1432
    13541433#if HHI_MPI
    13551434  memcpy( rpcCU->getTextureModeDepth() + m_uiAbsIdxInLCU, m_piTextureModeDepth, sizeof( Int ) * m_uiNumPartition );
     
    14551534  memcpy( rpcCU->getContourPredTexDeltaDC2() + uiPartOffset, m_piContourPredTexDeltaDC2, sizeof( Int  ) * uiQNumPart );
    14561535#endif
     1536
     1537#if LGE_EDGE_INTRA
     1538  if( rpcCU->getSlice()->getSPS()->isDepth() )
     1539  {
     1540    memcpy( rpcCU->getEdgeCode( uiPartOffset ),       m_pucEdgeCode,    iSizeInUchar * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 );
     1541    memcpy( rpcCU->getEdgeNumber()    + uiPartOffset, m_pucEdgeNumber,  iSizeInUchar );
     1542    memcpy( rpcCU->getEdgeStartPos()  + uiPartOffset, m_pucEdgeStartPos,iSizeInUchar );
     1543    memcpy( rpcCU->getEdgeLeftFirst() + uiPartOffset, m_pbEdgeLeftFirst,iSizeInBool );
     1544    memcpy( rpcCU->getEdgePartition( uiPartOffset ),  m_pbEdgePartition,iSizeInBool * 16 );
     1545#if LGE_EDGE_INTRA_DELTA_DC
     1546    memcpy( rpcCU->getEdgeDeltaDC0() + uiPartOffset,  m_piEdgeDeltaDC0, sizeof( Int  ) * uiQNumPart  );
     1547    memcpy( rpcCU->getEdgeDeltaDC1() + uiPartOffset,  m_piEdgeDeltaDC1, sizeof( Int  ) * uiQNumPart  );
     1548#endif
     1549  }
     1550#endif
     1551
    14571552#if HHI_MPI
    14581553  memcpy( rpcCU->getTextureModeDepth() + uiPartOffset, m_piTextureModeDepth, sizeof( Int ) * uiQNumPart  );
     
    23322427  mapDMMtoIntraMode( iLeftIntraDir );
    23332428#endif
     2429#if LGE_EDGE_INTRA
     2430  mapEdgeIntratoDC( iLeftIntraDir );
     2431#endif
    23342432 
    23352433  // Get intra direction of above PU
     
    23432441#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    23442442  mapDMMtoIntraMode( iAboveIntraDir );
     2443#endif
     2444#if LGE_EDGE_INTRA
     2445  mapEdgeIntratoDC( iAboveIntraDir );
    23452446#endif
    23462447 
     
    24262527  return uiPredNum;
    24272528}
     2529
     2530#if LGE_EDGE_INTRA
     2531UInt TComDataCU::getCtxEdgeIntra( UInt uiAbsPartIdx )
     2532{
     2533  UInt        uiCtx = 0;
     2534  return uiCtx;
     2535}
     2536#endif
    24282537
    24292538UInt TComDataCU::getCtxSplitFlag( UInt uiAbsPartIdx, UInt uiDepth )
     
    28862995Void TComDataCU::getPartIndexAndSize( UInt uiPartIdx, UInt& ruiPartAddr, Int& riWidth, Int& riHeight, UInt uiAbsPartIdx, Bool bLCU)
    28872996{
    2888         UInt uiNumPartition  = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition;
    2889         UInt uiTmpAbsPartIdx = bLCU ? uiAbsPartIdx : 0;
    2890 
    2891         switch ( m_pePartSize[uiTmpAbsPartIdx] )
    2892         {
    2893         case SIZE_2NxN:
    2894                 riWidth = getWidth(uiTmpAbsPartIdx);      riHeight = getHeight(uiTmpAbsPartIdx) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 1;
    2895                 break;
    2896         case SIZE_Nx2N:
    2897                 riWidth = getWidth(uiTmpAbsPartIdx) >> 1; riHeight = getHeight(uiTmpAbsPartIdx);      ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 2;
    2898                 break;
    2899         case SIZE_NxN:
    2900                 riWidth = getWidth(uiTmpAbsPartIdx) >> 1; riHeight = getHeight(uiTmpAbsPartIdx) >> 1; ruiPartAddr = ( uiNumPartition >> 2 ) * uiPartIdx;
    2901                 break;
    2902         case SIZE_2NxnU:
    2903                 riWidth     = getWidth(uiTmpAbsPartIdx);
    2904                 riHeight    = ( uiPartIdx == 0 ) ?  getHeight(uiTmpAbsPartIdx) >> 2 : ( getHeight(uiTmpAbsPartIdx) >> 2 ) + ( getHeight(uiTmpAbsPartIdx) >> 1 );
    2905                 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 3;
    2906                 break;
    2907         case SIZE_2NxnD:
    2908                 riWidth     = getWidth(uiTmpAbsPartIdx);
    2909                 riHeight    = ( uiPartIdx == 0 ) ?  ( getHeight(uiTmpAbsPartIdx) >> 2 ) + ( getHeight(uiTmpAbsPartIdx) >> 1 ) : getHeight(uiTmpAbsPartIdx) >> 2;
    2910                 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 1) + (uiNumPartition >> 3);
    2911                 break;
    2912         case SIZE_nLx2N:
    2913                 riWidth     = ( uiPartIdx == 0 ) ? getWidth(uiTmpAbsPartIdx) >> 2 : ( getWidth(uiTmpAbsPartIdx) >> 2 ) + ( getWidth(uiTmpAbsPartIdx) >> 1 );
    2914                 riHeight    = getHeight(uiTmpAbsPartIdx);
    2915                 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 4;
    2916                 break;
    2917         case SIZE_nRx2N:
    2918                 riWidth     = ( uiPartIdx == 0 ) ? ( getWidth(uiTmpAbsPartIdx) >> 2 ) + ( getWidth(uiTmpAbsPartIdx) >> 1 ) : getWidth(uiTmpAbsPartIdx) >> 2;
    2919                 riHeight    = getHeight(uiTmpAbsPartIdx);
    2920                 ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 2) + (uiNumPartition >> 4);
    2921                 break;
    2922         default:
    2923 #if HHI_FIX
     2997  UInt uiNumPartition  = bLCU ? (getWidth(uiAbsPartIdx)*getHeight(uiAbsPartIdx) >> 4) : m_uiNumPartition;
     2998  UInt uiTmpAbsPartIdx = bLCU ? uiAbsPartIdx : 0;
     2999
     3000  switch ( m_pePartSize[uiTmpAbsPartIdx] )
     3001  {
     3002  case SIZE_2NxN:
     3003    riWidth = getWidth(uiTmpAbsPartIdx);      riHeight = getHeight(uiTmpAbsPartIdx) >> 1; ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 1;
     3004    break;
     3005  case SIZE_Nx2N:
     3006    riWidth = getWidth(uiTmpAbsPartIdx) >> 1; riHeight = getHeight(uiTmpAbsPartIdx);      ruiPartAddr = ( uiPartIdx == 0 )? 0 : uiNumPartition >> 2;
     3007    break;
     3008  case SIZE_NxN:
     3009    riWidth = getWidth(uiTmpAbsPartIdx) >> 1; riHeight = getHeight(uiTmpAbsPartIdx) >> 1; ruiPartAddr = ( uiNumPartition >> 2 ) * uiPartIdx;
     3010    break;
     3011  case SIZE_2NxnU:
     3012    riWidth     = getWidth(uiTmpAbsPartIdx);
     3013    riHeight    = ( uiPartIdx == 0 ) ?  getHeight(uiTmpAbsPartIdx) >> 2 : ( getHeight(uiTmpAbsPartIdx) >> 2 ) + ( getHeight(uiTmpAbsPartIdx) >> 1 );
     3014    ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 3;
     3015    break;
     3016  case SIZE_2NxnD:
     3017    riWidth     = getWidth(uiTmpAbsPartIdx);
     3018    riHeight    = ( uiPartIdx == 0 ) ?  ( getHeight(uiTmpAbsPartIdx) >> 2 ) + ( getHeight(uiTmpAbsPartIdx) >> 1 ) : getHeight(uiTmpAbsPartIdx) >> 2;
     3019    ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 1) + (uiNumPartition >> 3);
     3020    break;
     3021  case SIZE_nLx2N:
     3022    riWidth     = ( uiPartIdx == 0 ) ? getWidth(uiTmpAbsPartIdx) >> 2 : ( getWidth(uiTmpAbsPartIdx) >> 2 ) + ( getWidth(uiTmpAbsPartIdx) >> 1 );
     3023    riHeight    = getHeight(uiTmpAbsPartIdx);
     3024    ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : uiNumPartition >> 4;
     3025    break;
     3026  case SIZE_nRx2N:
     3027    riWidth     = ( uiPartIdx == 0 ) ? ( getWidth(uiTmpAbsPartIdx) >> 2 ) + ( getWidth(uiTmpAbsPartIdx) >> 1 ) : getWidth(uiTmpAbsPartIdx) >> 2;
     3028    riHeight    = getHeight(uiTmpAbsPartIdx);
     3029    ruiPartAddr = ( uiPartIdx == 0 ) ? 0 : (uiNumPartition >> 2) + (uiNumPartition >> 4);
     3030    break;
     3031  default:
    29243032    assert ( m_pePartSize[uiTmpAbsPartIdx ] == SIZE_2Nx2N );
    2925 #else
    2926                 assert ( m_pePartSize[0] == SIZE_2Nx2N );
    2927 #endif
    2928                 riWidth = getWidth(uiTmpAbsPartIdx);      riHeight = getHeight(uiTmpAbsPartIdx);      ruiPartAddr = 0;
    2929                 break;
    2930         }
     3033    riWidth = getWidth(uiTmpAbsPartIdx);      riHeight = getHeight(uiTmpAbsPartIdx);      ruiPartAddr = 0;
     3034    break;
     3035  }
    29313036}
    29323037#else
     
    29753080Int TComDataCU::getResiPredMode(UInt uiPartAddr)
    29763081{
    2977         Int iAddResiShift = -1;
    2978 
    2979         for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
    2980         {
    2981                 RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
    2982                 Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
    2983                 if(iBestRefIdx >= 0 && getSlice()->getViewId() == getSlice()->getRefViewId(eRefList, iBestRefIdx))
    2984                         iAddResiShift++;
    2985         }
    2986 
    2987         return iAddResiShift;
     3082  Int iAddResiShift = -1;
     3083
     3084  for(UInt uiRefIdx = 0; uiRefIdx < 2; uiRefIdx++)
     3085  {
     3086    RefPicList eRefList = uiRefIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     3087    Int iBestRefIdx = getCUMvField(eRefList)->getRefIdx(uiPartAddr);
     3088    if(iBestRefIdx >= 0 && getSlice()->getViewId() == getSlice()->getRefViewId(eRefList, iBestRefIdx))
     3089      iAddResiShift++;
     3090  }
     3091
     3092  return iAddResiShift;
    29883093}
    29893094
    29903095Void TComDataCU::getPUResiPredShift(Int *iPUResiPredShift, UInt uiAbsPartIndex)
    29913096{
    2992         UInt uiPartSize = getPartitionSize(uiAbsPartIndex);
    2993         UInt uiPartAddr;
    2994         Int iWidth, iHeight;
    2995         Int iAddResiShift;
    2996 
    2997         if(uiPartSize == SIZE_2Nx2N)
    2998         {
    2999                 iAddResiShift = getResiPredMode(uiAbsPartIndex);
    3000                 for(UInt i = 0; i < 4; i++)
    3001                         iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiAbsPartIndex) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
    3002                 return;
    3003         }
    3004 
    3005         if(uiPartSize == SIZE_2NxN || uiPartSize == SIZE_2NxnU || uiPartSize == SIZE_2NxnD)
    3006         {
    3007                 for(UInt i = 0; i < 2; i++)
    3008                 {
    3009                         getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
    3010                         uiPartAddr += uiAbsPartIndex;
    3011                         iAddResiShift = getResiPredMode(uiPartAddr);
    3012                         iPUResiPredShift[2*i] = iPUResiPredShift[2*i+1] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
    3013                 }
    3014                 return;
    3015         }
    3016 
    3017         if(uiPartSize == SIZE_Nx2N || uiPartSize == SIZE_nLx2N || uiPartSize == SIZE_nRx2N)
    3018         {
    3019                 for(UInt i = 0; i < 2; i++)
    3020                 {
    3021                         getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
    3022                         uiPartAddr += uiAbsPartIndex;
    3023                         iAddResiShift = getResiPredMode(uiPartAddr);
    3024                         iPUResiPredShift[i] = iPUResiPredShift[2+i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
    3025                 }
    3026                 return;
    3027         }
    3028 
    3029         if(uiPartSize == SIZE_NxN)
    3030         {
    3031                 for(UInt i = 0; i < 4; i++)
    3032                 {
    3033                         getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
    3034                         uiPartAddr += uiAbsPartIndex;
    3035                         iAddResiShift = getResiPredMode(uiPartAddr);
    3036                         iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
    3037                 }
    3038         }
     3097  UInt uiPartSize = getPartitionSize(uiAbsPartIndex);
     3098  UInt uiPartAddr;
     3099  Int iWidth, iHeight;
     3100  Int iAddResiShift;
     3101
     3102  if(uiPartSize == SIZE_2Nx2N)
     3103  {
     3104    iAddResiShift = getResiPredMode(uiAbsPartIndex);
     3105    for(UInt i = 0; i < 4; i++)
     3106      iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiAbsPartIndex) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
     3107    return;
     3108  }
     3109
     3110  if(uiPartSize == SIZE_2NxN || uiPartSize == SIZE_2NxnU || uiPartSize == SIZE_2NxnD)
     3111  {
     3112    for(UInt i = 0; i < 2; i++)
     3113    {
     3114      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
     3115      uiPartAddr += uiAbsPartIndex;
     3116      iAddResiShift = getResiPredMode(uiPartAddr);
     3117      iPUResiPredShift[2*i] = iPUResiPredShift[2*i+1] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
     3118    }
     3119    return;
     3120  }
     3121
     3122  if(uiPartSize == SIZE_Nx2N || uiPartSize == SIZE_nLx2N || uiPartSize == SIZE_nRx2N)
     3123  {
     3124    for(UInt i = 0; i < 2; i++)
     3125    {
     3126      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
     3127      uiPartAddr += uiAbsPartIndex;
     3128      iAddResiShift = getResiPredMode(uiPartAddr);
     3129      iPUResiPredShift[i] = iPUResiPredShift[2+i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
     3130    }
     3131    return;
     3132  }
     3133
     3134  if(uiPartSize == SIZE_NxN)
     3135  {
     3136    for(UInt i = 0; i < 4; i++)
     3137    {
     3138      getPartIndexAndSize(i, uiPartAddr, iWidth, iHeight, uiAbsPartIndex, true);
     3139      uiPartAddr += uiAbsPartIndex;
     3140      iAddResiShift = getResiPredMode(uiPartAddr);
     3141      iPUResiPredShift[i] = (getSlice()->getPPS()->getUseWP() || getInterDir(uiPartAddr) != 3) ? (iAddResiShift >= 0 ? 0 : -1) : (iAddResiShift >= 0 ? 1-iAddResiShift : -1);
     3142    }
     3143  }
    30393144
    30403145}
     
    33583463  TComMv  acPdmMv       [2];
    33593464  Int     aiPdmRefIdx   [2] = {-1, -1};
     3465
     3466#if LGE_DVMCP
     3467  acPdmMv[0].m_bDvMcp = acPdmMv[1].m_bDvMcp = false;
     3468#endif
     3469
     3470#if QC_MULTI_DIS_CAN
     3471  DisInfo cDisInfo;
     3472  cDisInfo.iN = 0;
     3473  if(!bNoPdmMerge)
     3474  {
     3475#if LGE_DVMCP
     3476    getDisMvpCand2(uiPUIdx, uiAbsPartIdx, &cDisInfo, true );
     3477#else
     3478    getDisMvpCand (uiPUIdx, uiAbsPartIdx, &cDisInfo );
     3479#endif
     3480  }
     3481  if(cDisInfo.iN==0)
     3482  {
     3483    cDisInfo.iN = 1;
     3484    cDisInfo.m_acMvCand[0].setHor(0);
     3485    cDisInfo.m_acMvCand[0].setVer(0);
     3486    cDisInfo.m_aVIdxCan[0] = 0;
     3487  }
     3488  Int     iPdmInterDir      = cDisInfo.iN==0? 0:getPdmMergeCandidateDisCan ( uiPUIdx, aiPdmRefIdx, acPdmMv, &cDisInfo  );
     3489#else
    33603490  Int     iPdmInterDir      = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv );
     3491#endif
    33613492
    33623493  if( iPdmInterDir && !bNoPdmMerge && PDM_MERGE_POS == 0 )
     
    34133544      pcCULeft->getMvField( pcCULeft, uiLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    34143545    }
     3546#if LGE_DVMCP
     3547    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
     3548    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
     3549#endif
    34153550#if SIMP_MRG_PRUN
    34163551    if ( mrgCandIdx == iCount )
     
    34853620      pcCUAbove->getMvField( pcCUAbove, uiAbovePartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    34863621    }
     3622#if LGE_DVMCP
     3623    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
     3624    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
     3625#endif
    34873626#if SIMP_MRG_PRUN
    34883627    if ( mrgCandIdx == iCount )
     
    35523691      pcCUAboveRight->getMvField( pcCUAboveRight, uiAboveRightPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    35533692    }
     3693#if LGE_DVMCP
     3694    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
     3695    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
     3696#endif
    35543697#if SIMP_MRG_PRUN
    35553698    if ( mrgCandIdx == iCount )
     
    36163759      pcCULeftBottom->getMvField( pcCULeftBottom, uiLeftBottomPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    36173760    }
     3761#if LGE_DVMCP
     3762    pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
     3763    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
     3764#endif
    36183765#if SIMP_MRG_PRUN
    36193766    if ( mrgCandIdx == iCount )
     
    36893836        pcCUAboveLeft->getMvField( pcCUAboveLeft, uiAboveLeftPartIdx, REF_PIC_LIST_1, pcMvFieldNeighbours[(iCount<<1)+1] );
    36903837      }
     3838#if LGE_DVMCP
     3839      pcMvFieldNeighbours[iCount<<1    ].getMv().m_bDvMcp = false;
     3840      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
     3841#endif
    36913842#if SIMP_MRG_PRUN
    36923843      if ( mrgCandIdx == iCount )
     
    38053956        puhInterDirNeighbours[uiArrayAddr] = 1;
    38063957      }
     3958#if LGE_DVMCP
     3959      pcMvFieldNeighbours[uiArrayAddr<<1    ].getMv().m_bDvMcp = false;
     3960      pcMvFieldNeighbours[(uiArrayAddr<<1)+1].getMv().m_bDvMcp = false;
     3961#endif
    38073962#if SIMP_MRG_PRUN
    38083963      if ( mrgCandIdx == iCount )
     
    42744429  return m_pcSlice->getSPS()->getAMVPMode(m_puhDepth[uiIdx]);
    42754430}
     4431#if QC_MULTI_DIS_CAN
     4432/** construct a list of disparity motion vectors from the neighbouring PUs **/
     4433Void TComDataCU::getDisMvpCand ( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo )
     4434{
     4435  PartSize eCUMode = getPartitionSize( uiPartAddr );
     4436  TComDataCU* pcTmpCU = NULL;
     4437  pDInfo->iN = 0;
     4438
     4439  RefPicList eRefPicList = REF_PIC_LIST_0 ;
     4440  //-- Get Spatial MV
     4441  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
     4442  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     4443
     4444  deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
     4445  deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
     4446
     4447  UInt uiIdx = 0;
     4448#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4449    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
     4450#else
     4451    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
     4452#endif
     4453  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     4454  {
     4455    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4456    {
     4457      eRefPicList = RefPicList(iList);
     4458      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4459      if( refId >= 0)
     4460      {
     4461        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4462        if (refViewIdx!= m_pcSlice->getViewId())
     4463        {
     4464           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4465           clipMv(cMvPred);
     4466           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4467           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4468           return;
     4469        }
     4470      }
     4471    }
     4472  }
     4473#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4474      pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
     4475#else
     4476    pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
     4477#endif
     4478
     4479  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4480  {
     4481    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4482    {
     4483      eRefPicList = RefPicList(iList);
     4484      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4485      if( refId >= 0)
     4486      {
     4487        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4488        if (refViewIdx!= m_pcSlice->getViewId())
     4489        {
     4490           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4491           clipMv(cMvPred);
     4492           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4493           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4494           return;
     4495        }
     4496      }
     4497    }
     4498  }
     4499
     4500#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4501      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
     4502#else
     4503      pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
     4504#endif
     4505  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     4506  {
     4507    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4508    {
     4509      eRefPicList = RefPicList(iList);
     4510      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4511      if( refId >= 0)
     4512      {
     4513        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4514        if (refViewIdx!= m_pcSlice->getViewId())
     4515        {
     4516           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4517           clipMv(cMvPred);
     4518           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4519           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4520           return;
     4521        }
     4522      }
     4523    }
     4524  }
     4525#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4526      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
     4527#else
     4528      pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
     4529#endif
     4530  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4531  {
     4532    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4533    {
     4534      eRefPicList = RefPicList(iList);
     4535      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4536      if( refId >= 0)
     4537      {
     4538        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4539        if (refViewIdx!= m_pcSlice->getViewId())
     4540        {
     4541           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4542           clipMv(cMvPred);
     4543           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4544           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4545           return;
     4546        }
     4547      }
     4548    }
     4549  }
     4550
     4551  // Above predictor search
     4552#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4553      pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
     4554    assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
     4555#else
     4556      pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
     4557#endif
     4558  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4559  {
     4560    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4561    {
     4562      eRefPicList = RefPicList(iList);
     4563      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4564      if( refId >= 0)
     4565      {
     4566        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4567        if (refViewIdx!= m_pcSlice->getViewId())
     4568        {
     4569           TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4570           clipMv(cMvPred);
     4571           pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4572           pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4573           return;
     4574        }
     4575      }
     4576    }
     4577  }
     4578  //Get temporal MV
     4579  TComMv cColMv;
     4580  Int iTargetViewIdx = 0;
     4581  Int iTStartViewIdx = 0;
     4582  UInt uiPartIdxRB, uiBRIdx;
     4583  Int uiViewIdxCurr= getSlice()->getViewId();
     4584
     4585  UInt uiAbsPartAddr;
     4586  int uiLCUIdx = getAddr();
     4587  Int uiLCUnew = uiLCUIdx;
     4588  eCUMode = getPartitionSize( 0 );
     4589  deriveRightBottomIdx( eCUMode, uiPartIdx, uiPartIdxRB ); 
     4590  uiBRIdx = uiPartIdxLT;
     4591  UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     4592  if ( (( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples() ) &&(( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ))  // image boundary check
     4593  {
     4594    if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     4595      ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     4596    {
     4597      uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     4598    }
     4599    else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     4600    {
     4601      uiBRIdx = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     4602      uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU();
     4603    }
     4604    else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     4605    {
     4606      uiBRIdx = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     4607      uiLCUnew = uiLCUIdx + 1;
     4608    }
     4609    else //is the right bottom corner of LCU                       
     4610    {
     4611      uiBRIdx = 0;
     4612      uiLCUnew = uiLCUIdx + m_pcPic->getFrameWidthInCU() + 1;
     4613    }
     4614  }
     4615
     4616  Int MaxRef = getSlice()->getNumRefIdx(RefPicList(0));
     4617  UInt uiNumPartInCUHeight = m_pcPic->getNumPartInHeight();
     4618  UInt uiPUVert = (UInt)((Int)g_auiZscanToRaster[uiPartIdxLB]/(Int)(uiNumPartInCUWidth)-(Int)g_auiZscanToRaster[uiPartIdxLT]/(Int)(uiNumPartInCUWidth));
     4619  UInt uiPUHorStart  = g_auiZscanToRaster[uiPartIdxLT];
     4620  UInt uiPUHorEnd    = g_auiZscanToRaster[uiPartIdxRT];
     4621  for( Int i= 0; i< getSlice()->getNumRefIdx(RefPicList(0)); i ++)
     4622  {
     4623    getSlice()->getRefPic( RefPicList(0), i)->setCandPicCheckedFlag(0);
     4624  }
     4625  for( Int i= 0; i< getSlice()->getNumRefIdx(RefPicList(1)); i ++)
     4626  {
     4627    getSlice()->getRefPic( RefPicList(1), i)->setCandPicCheckedFlag(0);
     4628  }
     4629  {
     4630    //check the col-located picture
     4631    eRefPicList = RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0);
     4632#if COLLOCATED_REF_IDX
     4633    Int lpRef = getSlice()->getColRefIdx();
     4634#else
     4635    Int lpRef = 0;
     4636#endif
     4637    if( m_pcSlice->getViewId() == getSlice()->getRefPic( eRefPicList, lpRef)->getViewId() )
     4638    {
     4639      if (uiViewIdxCurr > 1) 
     4640      {
     4641        if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     4642        {
     4643          clipMv(cColMv);
     4644          pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
     4645          pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     4646          return ;
     4647        }
     4648      }
     4649      for(UInt uiLoopVert = 0; uiLoopVert <= uiPUVert; uiLoopVert+=4)
     4650        for( uiIdx = uiPUHorStart; uiIdx <= uiPUHorEnd; uiIdx +=4 )
     4651        {
     4652          uiAbsPartAddr = g_auiRasterToZscan[uiIdx+uiNumPartInCUWidth*uiLoopVert];
     4653          if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) )
     4654          {
     4655            clipMv(cColMv);
     4656            pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
     4657            pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     4658            return ;
     4659          }
     4660        }
     4661        for(UInt uiIdx_y = 0; uiIdx_y <uiNumPartInCUHeight; uiIdx_y +=4 )
     4662          for(UInt uiIdx_X = 0; uiIdx_X <uiNumPartInCUWidth; uiIdx_X +=4 )
     4663          {
     4664            uiIdx = uiIdx_X + uiIdx_y * uiNumPartInCUWidth;
     4665            uiAbsPartAddr = g_auiRasterToZscan[uiIdx];
     4666            if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList,  lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) )
     4667            {
     4668              clipMv(cColMv);
     4669              pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
     4670              pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     4671              return ;
     4672            }
     4673          }
     4674          if (uiViewIdxCurr == 1) 
     4675          {
     4676            if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     4677            {
     4678              clipMv(cColMv);
     4679              pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
     4680              pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     4681              return ;
     4682            }
     4683          }
     4684    }
     4685    getSlice()->getRefPic( eRefPicList, lpRef)->setCandPicCheckedFlag(1);
     4686  }
     4687  {
     4688    //check the remaining reference pictures in list0 and list1
     4689    if(getSlice()->isInterB())
     4690    {
     4691      if(getSlice()->getNumRefIdx(RefPicList(0))< getSlice()->getNumRefIdx(RefPicList(1)))
     4692        MaxRef = getSlice()->getNumRefIdx(RefPicList(1));
     4693    }
     4694    for(Int lpRef = 0; lpRef < MaxRef; lpRef++)
     4695    {
     4696      for(Int lpNr = 0; lpNr < (getSlice()->isInterB() ? 2: 1); lpNr ++)
     4697      {
     4698        eRefPicList = RefPicList(0);
     4699        if(getSlice()->isInterB())
     4700          eRefPicList = RefPicList(lpNr==0 ? (getSlice()->getColDir()): (1-getSlice()->getColDir()));
     4701        if(getSlice()->getRefPic( eRefPicList, lpRef)->getCandPicCheckedFlag())
     4702          continue;
     4703       
     4704        if(lpRef >= getSlice()->getNumRefIdx(eRefPicList)||(m_pcSlice->getViewId() != getSlice()->getRefPic( eRefPicList, lpRef)->getViewId()))
     4705          continue;
     4706        if (uiViewIdxCurr > 1 )
     4707        {
     4708          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     4709          {
     4710          clipMv(cColMv);
     4711          pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
     4712          pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     4713          return ;
     4714          }
     4715        }
     4716        for(UInt uiLoopVert = 0; uiLoopVert <= uiPUVert; uiLoopVert += 4)
     4717          for( uiIdx = uiPUHorStart; uiIdx <= uiPUHorEnd; uiIdx += 4 )
     4718          {
     4719            uiAbsPartAddr = g_auiRasterToZscan[uiIdx+uiNumPartInCUWidth*uiLoopVert];
     4720            if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) )
     4721            {
     4722              clipMv(cColMv);
     4723              pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
     4724              pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     4725              return ;
     4726            }
     4727          }
     4728        for(UInt uiIdx_y = 0; uiIdx_y <uiNumPartInCUHeight; uiIdx_y += 4 )
     4729          for(UInt uiIdx_X = 0; uiIdx_X <uiNumPartInCUWidth; uiIdx_X += 4 )
     4730          {
     4731            uiIdx = uiIdx_X + uiIdx_y * uiNumPartInCUWidth;
     4732            uiAbsPartAddr = g_auiRasterToZscan[uiIdx];
     4733            if ( uiLCUIdx >= 0 && xGetColDisMV( eRefPicList,  lpRef, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetViewIdx, iTStartViewIdx ) )
     4734            {
     4735              clipMv(cColMv);
     4736              pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
     4737              pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     4738              return ;
     4739            }
     4740          }
     4741        if (uiViewIdxCurr == 1 )
     4742        {
     4743          if( (uiLCUnew >= 0 && xGetColDisMV( eRefPicList, lpRef, uiLCUnew, uiBRIdx, cColMv, iTargetViewIdx, iTStartViewIdx)) )
     4744          {
     4745            clipMv(cColMv);
     4746            pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
     4747            pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     4748            return ;
     4749          }
     4750        }
     4751        getSlice()->getRefPic( eRefPicList, lpRef)->setCandPicCheckedFlag(1);
     4752      }//reference lists
     4753    }//reference indices
     4754  }//remaining pictures
     4755}
     4756
     4757#if LGE_DVMCP
     4758Void TComDataCU::getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo, Bool bMerge, RefPicList eRefPicList0, Int iRefIdx0 )
     4759{
     4760  PartSize eCUMode = getPartitionSize( uiPartAddr );
     4761  TComDataCU* pcTmpCU = NULL;
     4762  TComDataCU* pcCULeft = NULL;
     4763  pDInfo->iN = 0;
     4764
     4765  RefPicList eRefPicList = REF_PIC_LIST_0 ;
     4766  //-- Get Spatial MV
     4767  UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB;
     4768  UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     4769
     4770  Int   aiDvMcpDvCand[2][7] = {{0,},    {0,}}; // dummy, 5 spatial + 1 temporal, DV-MCP ÁÖº¯ ºí·°¿¡¼­ »ç¿ëµÈ DV¸¦ ÀúÀå
     4771  Bool  abDvMcpFlag  [2][7] = {{false,},{false,}};
     4772  //Int   aiRefPOC     [2][7] = {{-1,},{-1}}; // debug
     4773  TComMv cTmpMvPred, cMv;
     4774  Bool  bTmpIsSkipped = false;
     4775  Bool  bDvMcpIsFound = false;
     4776
     4777  deriveLeftRightTopIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLT, uiPartIdxRT );
     4778  deriveLeftBottomIdxGeneral( eCUMode, uiPartAddr, uiPartIdx, uiPartIdxLB );
     4779
     4780  UInt uiIdx = 0;
     4781#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4782  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
     4783#else
     4784  pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
     4785#endif
     4786
     4787  pcCULeft = pcTmpCU;
     4788  UInt uiLeftPartIdx = uiIdx;
     4789  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     4790  {
     4791    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     4792    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4793    {
     4794      eRefPicList = RefPicList(iList);
     4795      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4796      if( refId >= 0)
     4797      {
     4798        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4799        if (refViewIdx!= m_pcSlice->getViewId()) // DCP
     4800        {
     4801          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4802          clipMv(cMvPred);
     4803          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4804          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4805          return;
     4806        }
     4807        else // MCP
     4808        {
     4809          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4810          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     4811          {
     4812            aiDvMcpDvCand[iList][DVFROM_LEFT] = cTmpMvPred.m_iDvMcpDispX;
     4813            abDvMcpFlag  [iList][DVFROM_LEFT] = true;
     4814            bDvMcpIsFound = true;
     4815          }
     4816        }
     4817      }
     4818    }
     4819  }
     4820
     4821#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4822  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT, true, false, true);
     4823#else
     4824  pcTmpCU = getPUAbove(uiIdx, uiPartIdxRT);
     4825#endif
     4826
     4827  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4828  {
     4829    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     4830    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4831    {
     4832      eRefPicList = RefPicList(iList);
     4833      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4834      if( refId >= 0)
     4835      {
     4836        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4837        if (refViewIdx!= m_pcSlice->getViewId())
     4838        {
     4839          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4840          clipMv(cMvPred);
     4841          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4842          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4843          return;
     4844        }
     4845        else // MCP
     4846        {
     4847          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4848          if( cTmpMvPred.m_bDvMcp  && bTmpIsSkipped )
     4849          {
     4850            aiDvMcpDvCand[iList][DVFROM_ABOVE] = cTmpMvPred.m_iDvMcpDispX;
     4851            abDvMcpFlag  [iList][DVFROM_ABOVE] = true;
     4852            bDvMcpIsFound = true;
     4853          }
     4854        }
     4855      }
     4856    }
     4857  }
     4858
     4859#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4860  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, false, true);
     4861#else
     4862  pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true, true, true);
     4863#endif
     4864  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     4865  {
     4866    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     4867    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4868    {
     4869      eRefPicList = RefPicList(iList);
     4870      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4871      if( refId >= 0)
     4872      {
     4873        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4874        if (refViewIdx!= m_pcSlice->getViewId())
     4875        {
     4876          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4877          clipMv(cMvPred);
     4878          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4879          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4880          return;
     4881        }
     4882        else  // MCP
     4883        {
     4884          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4885          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     4886          {
     4887            aiDvMcpDvCand[iList][DVFROM_ABOVERIGHT] = cTmpMvPred.m_iDvMcpDispX;
     4888            abDvMcpFlag  [iList][DVFROM_ABOVERIGHT] = true;
     4889            bDvMcpIsFound = true;
     4890          }
     4891        }
     4892      }
     4893    }
     4894  }
     4895
     4896#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4897  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true, false);
     4898#else
     4899  pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB);
     4900#endif
     4901  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4902  {
     4903    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     4904    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4905    {
     4906      eRefPicList = RefPicList(iList);
     4907      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4908      if( refId >= 0)
     4909      {
     4910        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4911        if (refViewIdx!= m_pcSlice->getViewId())
     4912        {
     4913          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4914          clipMv(cMvPred);
     4915          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4916          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4917          return;
     4918        }
     4919        else // MCP
     4920        {
     4921          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4922          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     4923          {
     4924            aiDvMcpDvCand[iList][DVFROM_LEFTBELOW] = cTmpMvPred.m_iDvMcpDispX;
     4925            abDvMcpFlag  [iList][DVFROM_LEFTBELOW] = true;
     4926            bDvMcpIsFound = true;
     4927          }
     4928        }
     4929      }
     4930    }
     4931  }
     4932
     4933  // Above predictor search
     4934#if MVP_AT_ENTROPYSLICE_BOUNDARY
     4935  pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true, false, true);
     4936  assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
     4937#else
     4938  pcTmpCU = getPUAboveLeft(uiIdx, uiPartIdxLT, true, true, true);
     4939#endif
     4940  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     4941  {
     4942    bTmpIsSkipped = pcTmpCU->isSkipped( uiIdx );
     4943    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     4944    {
     4945      eRefPicList = RefPicList(iList);
     4946      Int refId = pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) ;
     4947      if( refId >= 0)
     4948      {
     4949        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
     4950        if (refViewIdx!= m_pcSlice->getViewId())
     4951        {
     4952          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4953          clipMv(cMvPred);
     4954          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     4955          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     4956          return;
     4957        }
     4958        else // MCP
     4959        {
     4960          cTmpMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
     4961          if( cTmpMvPred.m_bDvMcp && bTmpIsSkipped )
     4962          {
     4963            aiDvMcpDvCand[iList][DVFROM_ABOVELEFT] = cTmpMvPred.m_iDvMcpDispX;
     4964            abDvMcpFlag  [iList][DVFROM_ABOVELEFT] = true;
     4965            bDvMcpIsFound = true;
     4966          }
     4967        }
     4968      }
     4969    }
     4970  }
     4971
     4972  // copied from getInterMergeCand()
     4973  if ( getSlice()->getPPS()->getEnableTMVPFlag() )
     4974  {
     4975    UInt uiPUIdx = uiPartIdx;
     4976    UInt uiAbsPartAddr = uiPartAddr;
     4977
     4978    // col [2]
     4979    Int iRefIdxSkip[2] = {-1, -1};
     4980    if( !bMerge )
     4981    {
     4982      iRefIdxSkip[ eRefPicList0 ] = iRefIdx0;
     4983    }
     4984    else
     4985    {
     4986      for (Int i=0; i<2; i++)
     4987      {
     4988        RefPicList  eRefPicList1 = ( i==1 ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
     4989#if SET_MERGE_TMVP_REFIDX
     4990        Int iRefIdxTmp;
     4991        if ( uiPUIdx != 0 )
     4992        {
     4993          iRefIdxTmp = 0;
     4994        }
     4995        else
     4996        {   
     4997          iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
     4998        }
     4999#else     
     5000        Int iRefIdxTmp = (pcCULeft != NULL) ? pcCULeft->getCUMvField(eRefPicList1)->getRefIdx(uiLeftPartIdx) : -1;
     5001#endif
     5002        iRefIdxSkip[i] = (iRefIdxTmp != -1) ? iRefIdxTmp : 0;
     5003      }
     5004    }
     5005
     5006    //>> MTK colocated-RightBottom
     5007    UInt uiPartIdxRB;
     5008    Int uiLCUIdx = getAddr();
     5009    eCUMode = getPartitionSize( 0 );
     5010
     5011    deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); 
     5012
     5013    UInt uiAbsPartIdxTmp = g_auiZscanToRaster[uiPartIdxRB];
     5014    //UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     5015
     5016    TComMv cColMv;
     5017    Int iRefIdx;
     5018
     5019    if      ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth() ) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )  // image boundary check
     5020    {
     5021      uiLCUIdx = -1;
     5022    }
     5023    else if ( ( m_pcPic->getCU(m_uiCUAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples() )
     5024    {
     5025      uiLCUIdx = -1;
     5026    }
     5027    else
     5028    {
     5029      if ( ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 ) &&           // is not at the last column of LCU
     5030        ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) ) // is not at the last row    of LCU
     5031      {
     5032        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + uiNumPartInCUWidth + 1 ];
     5033        uiLCUIdx = getAddr();
     5034      }
     5035      else if ( uiAbsPartIdxTmp % uiNumPartInCUWidth < uiNumPartInCUWidth - 1 )           // is not at the last column of LCU But is last row of LCU
     5036      {
     5037        uiAbsPartAddr = g_auiRasterToZscan[ (uiAbsPartIdxTmp + uiNumPartInCUWidth + 1) % m_pcPic->getNumPartInCU() ];
     5038        uiLCUIdx = -1 ;
     5039      }
     5040      else if ( uiAbsPartIdxTmp / uiNumPartInCUWidth < m_pcPic->getNumPartInHeight() - 1 ) // is not at the last row of LCU But is last column of LCU
     5041      {
     5042        uiAbsPartAddr = g_auiRasterToZscan[ uiAbsPartIdxTmp + 1 ];
     5043        uiLCUIdx = getAddr() + 1;
     5044      }
     5045      else //is the right bottom corner of LCU                       
     5046      {
     5047        uiAbsPartAddr = 0;
     5048        uiLCUIdx = -1 ;
     5049      }
     5050    }
     5051
     5052    Bool bExistMV = false;
     5053    UInt uiPartIdxCenter;
     5054    UInt uiCurLCUIdx = getAddr();
     5055    xDeriveCenterIdx( eCUMode, uiPUIdx, uiPartIdxCenter );
     5056
     5057    Int iTargetView, iStartView;
     5058    if( !bMerge ) // AMVP
     5059    {
     5060      bExistMV = uiLCUIdx >= 0 && xGetColDisMV( eRefPicList0, iRefIdx0, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
     5061      if( bExistMV == false )
     5062      {
     5063        bExistMV = xGetColDisMV( eRefPicList0, iRefIdx0, uiCurLCUIdx, uiPartIdxCenter, cColMv, iTargetView, iStartView );
     5064      }
     5065      if( bExistMV ) // DV is found
     5066      {
     5067        if( cColMv.m_bDvMcp == false ) //=> DCP, if true => DV-MCP
     5068        {
     5069          clipMv(cColMv);
     5070          pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5071          pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
     5072          return;
     5073        }
     5074        else // DV-MCP
     5075        {
     5076          aiDvMcpDvCand[eRefPicList0][DVFROM_COL] = cColMv.getHor();
     5077          abDvMcpFlag  [eRefPicList0][DVFROM_COL] = true;
     5078          bDvMcpIsFound = true;
     5079        }
     5080      }
     5081    }
     5082    else // MERGE
     5083    {
     5084      iRefIdx = iRefIdxSkip[0];
     5085      bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
     5086      if( bExistMV == false )
     5087      {
     5088        bExistMV = xGetColDisMV( REF_PIC_LIST_0, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
     5089      }
     5090      if( bExistMV )
     5091      {
     5092        if( cColMv.m_bDvMcp == false ) // DCP
     5093        {
     5094          clipMv(cColMv);
     5095          pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5096          pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
     5097          return;
     5098        }
     5099        else { // // DV-MCP
     5100          aiDvMcpDvCand[0][DVFROM_COL] = cColMv.getHor();
     5101          abDvMcpFlag  [0][DVFROM_COL] = true;
     5102          bDvMcpIsFound = true;
     5103        };
     5104
     5105        if ( getSlice()->isInterB() )
     5106        {       
     5107          iRefIdx = iRefIdxSkip[1];
     5108          bExistMV = uiLCUIdx >= 0 && xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiLCUIdx, uiAbsPartAddr, cColMv, iTargetView, iStartView );
     5109          if( bExistMV == false )
     5110          {
     5111            bExistMV = xGetColDisMV( REF_PIC_LIST_1, iRefIdx, uiCurLCUIdx, uiPartIdxCenter,  cColMv, iTargetView, iStartView );
     5112          }
     5113          if( bExistMV )
     5114          {
     5115            if( cColMv.m_bDvMcp == false ) // DCP
     5116            {
     5117              clipMv(cColMv);
     5118              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     5119              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetView;
     5120              return;
     5121            }
     5122            else // DV-MCP
     5123            {
     5124              aiDvMcpDvCand[1][DVFROM_COL] = cColMv.getHor();
     5125              abDvMcpFlag  [1][DVFROM_COL] = true;
     5126              bDvMcpIsFound = true;
     5127            };
     5128          }
     5129        }
     5130      }
     5131    }
     5132  } // if TMVP Flag
     5133
     5134  if( bDvMcpIsFound ) // skip dvmcp
     5135  {
     5136    for( Int i=1 ; i<7 ; i++ ) // 5 spatial + 1 temporal
     5137    {
     5138      for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     5139      {
     5140        if( abDvMcpFlag[iList][i]==true )
     5141        {
     5142          TComMv dv( aiDvMcpDvCand[iList][ i ], 0 );
     5143          clipMv( dv );
     5144          pDInfo->m_acMvCand[ pDInfo->iN  ] = dv;
     5145          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     5146          return;
     5147        }
     5148
     5149      }
     5150    }
     5151  }
     5152
     5153  return;
     5154
     5155}
     5156#endif
     5157
     5158#endif
    42765159
    42775160/** Constructs a list of candidates for AMVP
     
    42955178  }
    42965179 
     5180#if QC_MULTI_DIS_CAN
     5181  DisInfo cDisInfo;
     5182  cDisInfo.iN = 0;
     5183  if(m_pcSlice->getSPS()->getViewId() && m_pcSlice->getSPS()->getMultiviewMvPredMode())
     5184  {
     5185#if LGE_DVMCP
     5186    getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false, eRefPicList, iRefIdx );
     5187#else
     5188    getDisMvpCand (uiPartIdx, uiPartAddr, &cDisInfo );
     5189#endif
     5190  }
     5191  if(cDisInfo.iN==0)
     5192  {
     5193    cDisInfo.iN = 1;
     5194    cDisInfo.m_acMvCand[0].setHor(0);
     5195    cDisInfo.m_acMvCand[0].setVer(0);
     5196    cDisInfo.m_aVIdxCan[0] = 0;
     5197  }
     5198#endif
    42975199#if HHI_INTER_VIEW_MOTION_PRED
    42985200#if ( PDM_AMVP_POS == 0 )
    42995201  // get inter-view mv predictor (at position 0)
    43005202  TComMv  cPdmMvPred;
     5203#if QC_MULTI_DIS_CAN
     5204  if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
     5205#else
    43015206  if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
     5207#endif
    43025208  {
    43035209    clipMv( cPdmMvPred );
     
    43545260  // get inter-view mv predictor (at position 1)
    43555261  TComMv  cPdmMvPred;
     5262#if QC_MULTI_DIS_CAN
     5263  if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
     5264#else
    43565265  if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
     5266#endif
    43575267  {
    43585268    clipMv( cPdmMvPred );
     
    44025312  // get inter-view mv predictor (at position 2)
    44035313  TComMv  cPdmMvPred;
     5314#if QC_MULTI_DIS_CAN
     5315  if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
     5316#else
    44045317  if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
     5318#endif
    44055319  {
    44065320    clipMv( cPdmMvPred );
     
    44185332    }
    44195333  }
     5334#if  QC_MULTI_DIS_CAN
     5335  if ( getSlice()->getViewId()!=0 && pInfo->iN == 3 )
     5336  {
     5337    if ( pInfo->m_acMvCand[ 1 ] == pInfo->m_acMvCand[ 2 ] )
     5338    {
     5339      pInfo->iN = 2;
     5340      if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
     5341        pInfo->iN = 1;
     5342    }
     5343    else
     5344    {
     5345      if( pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 1 ] )
     5346      {
     5347        pInfo->m_acMvCand[1 ] = pInfo->m_acMvCand[ 2 ];
     5348        pInfo->iN = 2;
     5349      }
     5350      else if (pInfo->m_acMvCand[ 0 ] == pInfo->m_acMvCand[ 2 ])
     5351      {
     5352         pInfo->iN = 2;
     5353      }
     5354    }
     5355  }
     5356#endif
    44205357#endif
    44215358
     
    44885425  // get inter-view mv predictor (at position 3)
    44895426  TComMv  cPdmMvPred;
     5427#if QC_MULTI_DIS_CAN
     5428  if( getPdmMvPredDisCan( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred, &cDisInfo ) )
     5429#else
    44905430  if( getPdmMvPred( uiPartIdx, eRefPicList, iRefIdx, cPdmMvPred ) )
     5431#endif
    44915432  {
    44925433    clipMv( cPdmMvPred );
     
    46745615  {
    46755616    TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    4676    
     5617#if LGE_DVMCP
     5618    cMvPred.m_bDvMcp = false;
     5619#endif
    46775620    pInfo->m_acMvCand[ pInfo->iN++] = cMvPred;
    46785621    return true;
     
    47095652    {
    47105653      TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
     5654#if LGE_DVMCP
     5655      cMvPred.m_bDvMcp = false;
     5656#endif
    47115657      pInfo->m_acMvCand[ pInfo->iN++] = cMvPred;
    47125658      return true;
     
    48405786  Int iNeibRefPOC;
    48415787
    4842 #if HHI_FIX
    48435788  if( pcTmpCU->getCUMvField(eRefPicList2nd)->getRefIdx(uiIdx) >= 0 )
    48445789  {
     
    48495794    {
    48505795      TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList2nd)->getMv(uiIdx);
    4851 
     5796#if LGE_DVMCP
     5797      cMvPred.m_bDvMcp = false;
     5798#endif
    48525799      clipMv(cMvPred);
    48535800      pInfo->m_acMvCand[ pInfo->iN++] = cMvPred;
     
    48555802    }
    48565803  }
    4857 #endif
     5804
    48585805  //---------------  V1 (END) ------------------//
    48595806  if( pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx) >= 0)
     
    48775824      rcMv = cMvPred.scaleMv( iScale );
    48785825    }
     5826#if LGE_DVMCP
     5827    rcMv.m_bDvMcp = false;
     5828#endif
    48795829    pInfo->m_acMvCand[ pInfo->iN++] = rcMv;
    48805830    return true;
     
    49015851      rcMv = cMvPred.scaleMv( iScale );
    49025852    }
     5853#if LGE_DVMCP
     5854    rcMv.m_bDvMcp = false;
     5855#endif
    49035856    pInfo->m_acMvCand[ pInfo->iN++] = rcMv;
    49045857    return true;
     
    49085861}
    49095862
     5863#if QC_MULTI_DIS_CAN
     5864Bool TComDataCU::xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx )
     5865{
     5866#if LGE_DVMCP
     5867  Int  iDvMcpDispX[2] = {-1,};
     5868  Bool bDvMcpFlag [2] = { false, };
     5869  Int iCurrViewIdx = m_pcSlice->getViewId();
     5870#endif
     5871
     5872  UInt uiAbsPartAddr = uiPartUnitIdx;
     5873
     5874  RefPicList  eColRefPicList = REF_PIC_LIST_0;
     5875  Int iColViewIdx, iColRefViewIdx;
     5876  TComPic *pColPic = getSlice()->getRefPic( eRefPicList, refidx);
     5877  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
     5878  iColViewIdx = pColCU->getSlice()->getViewId();
     5879
     5880
     5881  if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiAbsPartAddr))
     5882  {
     5883    return false;
     5884  }
     5885#if LGE_DVMCP
     5886  Bool bColIsSkipped = pColCU->isSkipped( uiAbsPartAddr );
     5887#endif
     5888  for (Int ilist = 0; ilist < (pColCU->getSlice()->isInterB()? 2:1); ilist++)
     5889  {
     5890    if(pColCU->getSlice()->isInterB())
     5891    {
     5892      if(ilist == 0 )
     5893        eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(1-getSlice()->getColDir());
     5894      else
     5895        eColRefPicList = getSlice()->getCheckLDC() ? (eRefPicList== REF_PIC_LIST_0? REF_PIC_LIST_1:REF_PIC_LIST_0 ): RefPicList(getSlice()->getColDir());
     5896    }
     5897
     5898    Int iColRefIdx = pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr);
     5899
     5900    if (iColRefIdx < 0)
     5901    {
     5902      continue;
     5903    }
     5904
     5905    iColRefViewIdx = pColCU->getSlice()->getRefPic(eColRefPicList, iColRefIdx)->getViewId();
     5906
     5907    if ( iColViewIdx    == iColRefViewIdx ) // temporal vector
     5908    {
     5909#if LGE_DVMCP
     5910      if( iColViewIdx >0 )
     5911      {
     5912        TComMv tmpMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
     5913        if( tmpMv.m_bDvMcp && bColIsSkipped ) // DV-MCP SKIP
     5914        {
     5915          iDvMcpDispX[ilist] = tmpMv.m_iDvMcpDispX;
     5916          bDvMcpFlag [ilist] = true;
     5917          iTargetViewIdx  = 0; //iColRefViewIdx ;
     5918          iStartViewIdx   = 0; //iCurrViewIdx; //iColViewIdx   ;
     5919        }
     5920      }
     5921#endif
     5922      continue;
     5923    }
     5924    else
     5925    {
     5926      rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
     5927#if LGE_DVMCP
     5928      rcMv.m_bDvMcp = false;
     5929#endif
     5930      iTargetViewIdx  = iColRefViewIdx ;
     5931      iStartViewIdx   = iColViewIdx   ;
     5932      return true;   
     5933    }
     5934  }
     5935
     5936#if LGE_DVMCP
     5937  for( Int ilist=0 ; ilist<2 ; ilist++ )
     5938  {
     5939    if( bDvMcpFlag[ilist] )
     5940    {
     5941      rcMv.setHor( iDvMcpDispX[ilist] );
     5942      rcMv.setVer( 0 );
     5943      rcMv.m_bDvMcp = true;
     5944      iTargetViewIdx  = 0; //iColRefViewIdx ;
     5945      iStartViewIdx   = iCurrViewIdx; //iColViewIdx   ;
     5946      return true;
     5947    }
     5948  }
     5949#endif
     5950
     5951  return false;
     5952}
     5953#endif
    49105954/**
    49115955 * \param eRefPicList
     
    49846028  iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx();
    49856029#else
    4986 #if HHI_FIX
    49876030  if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != pColCU->getSlice()->getViewId() )
    4988 #else
    4989   if( pColCU->getSlice()->getRefViewId( eColRefPicList, iColRefIdx ) != m_pcSlice->getRefPic( eRefPicList, riRefIdx )->getViewId() )
    4990 #endif
    49916031  {
    49926032    return false;
     
    50046044  else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC))
    50056045    iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx);
    5006 #if HHI_FIX //GT: fix reported by Sony
    50076046  else
    50086047    return false;
    5009 #endif
     6048
    50106049#else
    50116050  iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
     
    59516990// -------------------------------------------------------------------------------------------------------------------
    59526991#if HHI_INTER_VIEW_MOTION_PRED
     6992#if !QC_MULTI_DIS_CAN
    59536993Int
    59546994TComDataCU::getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
     
    59677007  return pcDepthMapGenerator->getPdmMvPred( this, uiPartIdx, eRefPicList, iRefIdx, rcMv, bMerge );
    59687008}
     7009#else
     7010Int
     7011TComDataCU::getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo )
     7012{
     7013  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
     7014  ROFRS( pcDepthMapGenerator, 0 );
     7015  return pcDepthMapGenerator->getPdmMergeCandidate( this, uiPartIdx, paiPdmRefIdx, pacPdmMv, pDInfo );
     7016}
     7017Bool
     7018TComDataCU::getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge )
     7019{
     7020  TComDepthMapGenerator* pcDepthMapGenerator = m_pcSlice->getSPS()->getDepthMapGenerator();
     7021  ROFRS( pcDepthMapGenerator, false );
     7022  if (pDInfo->iN > 0 && pcDepthMapGenerator->getDisCanPdmMvPred(this, uiPartIdx, eRefPicList, iRefIdx, rcMv, pDInfo, bMerge )) //bug fix li
     7023    return true;
     7024  return false;
     7025}
     7026#endif
    59697027
    59707028
     
    59887046  TComResidualGenerator*  pcResidualGenerator = m_pcSlice->getSPS()->getResidualGenerator();
    59897047  ROFRS( pcResidualGenerator, false );
     7048#if QC_MULTI_DIS_CAN
     7049  DisInfo cDisInfo;
     7050  cDisInfo.iN = 0;
     7051  PartSize m_peSaved =  getPartitionSize( 0 );
     7052  m_pePartSize[0] =  SIZE_2Nx2N;
     7053#if LGE_DVMCP
     7054  getDisMvpCand2( 0, 0,  &cDisInfo, true );
     7055#else
     7056  getDisMvpCand        ( 0, 0,  &cDisInfo );
     7057#endif
     7058  if( cDisInfo.iN == 0)
     7059  {
     7060    m_pePartSize[0] = m_peSaved;
     7061    return false;
     7062  }
     7063  else
     7064  {
     7065    Bool bAvailable = pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv, cDisInfo.m_acMvCand[0].getHor()
     7066#if QC_SIMPLIFIEDIVRP_M24938
     7067      , bRecon
     7068#endif
     7069      );
     7070    m_pePartSize[0] = m_peSaved;
     7071    return bAvailable;
     7072  }
     7073#else
    59907074  return pcResidualGenerator->getResidualSamples( this, uiPartIdx, pcYuv
    59917075#if QC_SIMPLIFIEDIVRP_M24938
     
    59937077#endif
    59947078    );
    5995 }
     7079#endif
     7080}
     7081#endif
     7082
     7083#if LGE_EDGE_INTRA
     7084Void TComDataCU::reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion )
     7085{
     7086  Int iWidth;
     7087  Int iHeight;
     7088  if( uiDepth == 0 )
     7089  {
     7090    iWidth = 64;
     7091    iHeight = 64;
     7092  }
     7093  else if( uiDepth == 1 )
     7094  {
     7095    iWidth = 32;
     7096    iHeight = 32;
     7097  }
     7098  else if( uiDepth == 2 )
     7099  {
     7100    iWidth = 16;
     7101    iHeight = 16;
     7102  }
     7103  else if( uiDepth == 3 )
     7104  {
     7105    iWidth = 8;
     7106    iHeight = 8;
     7107  }
     7108  else // uiDepth == 4
     7109  {
     7110    iWidth = 4;
     7111    iHeight = 4;
     7112  }
     7113
     7114  Int iPtr = 0;
     7115  Int iX, iY;
     7116  Int iDir = -1;
     7117  Int iDiffX = 0, iDiffY = 0;
     7118
     7119  // 1. Edge Code -> Vert & Horz Edges
     7120  Bool*  pbEdge = (Bool*) xMalloc( Bool, 4 * iWidth * iHeight );
     7121
     7122  for( UInt ui = 0; ui < 4 * iWidth * iHeight; ui++ )
     7123    pbEdge  [ ui ] = false;
     7124
     7125  // Direction : left(0), right(1), top(2), bottom(3), left-top(4), right-top(5), left-bottom(6), right-bottom(7)
     7126  // Code      : 0deg(0), 45deg(1), -45deg(2), 90deg(3), -90deg(4), 135deg(5), -135deg(6)
     7127  const UChar tableDir[8][7] = { { 0, 6, 4, 3, 2, 7, 5 },
     7128  { 1, 5, 7, 2, 3, 4, 6 },
     7129  { 2, 4, 5, 0, 1, 6, 7 },
     7130  { 3, 7, 6, 1, 0, 5, 4 },
     7131  { 4, 0, 2, 6, 5, 3, 1 },
     7132  { 5, 2, 1, 4, 7, 0, 3 },
     7133  { 6, 3, 0, 7, 4, 1, 2 },
     7134  { 7, 1, 3, 5, 6, 2, 0 }};
     7135
     7136  UChar ucCode = pucEdgeCode[iPtr++];
     7137
     7138  if( !bLeft )
     7139  {
     7140    iX = ucStartPos;
     7141    iY = 0;
     7142
     7143    switch(ucCode)
     7144    {
     7145    case 0: // bottom
     7146      iDir = 3;
     7147      if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7148      break;
     7149    case 2: // left-bottom
     7150      iDir = 6;
     7151      if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7152      break;
     7153    case 1: // right-bottom
     7154      iDir = 7;
     7155      if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7156      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7157      break;
     7158    case 4: // left
     7159      iDir = 0;
     7160      assert(false);
     7161      break;
     7162    case 3: // right
     7163      iDir = 1;
     7164      if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7165      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7166      break;
     7167    }
     7168  }
     7169  else
     7170  {
     7171    iX = 0;
     7172    iY = ucStartPos;
     7173
     7174    switch(ucCode)
     7175    {
     7176    case 0: // right
     7177      iDir = 1;
     7178      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7179      break;
     7180    case 1: // right-top
     7181      iDir = 5;
     7182      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7183      if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7184      break;
     7185    case 2: // right-bottom
     7186      iDir = 7;
     7187      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7188      break;
     7189    case 3: // top
     7190      iDir = 2;
     7191      if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7192      if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7193      break;
     7194    case 4: // bottom
     7195      iDir = 3;
     7196      assert(false);
     7197      break;
     7198    }
     7199  }
     7200
     7201  switch( iDir )
     7202  {
     7203  case 0: // left
     7204    iDiffX = -1;
     7205    iDiffY = 0;
     7206    break;
     7207  case 1: // right
     7208    iDiffX = +1;
     7209    iDiffY = 0;
     7210    break;
     7211  case 2: // top
     7212    iDiffX = 0;
     7213    iDiffY = -1;
     7214    break;
     7215  case 3: // bottom
     7216    iDiffX = 0;
     7217    iDiffY = +1;
     7218    break;
     7219  case 4: // left-top
     7220    iDiffX = -1;
     7221    iDiffY = -1;
     7222    break;
     7223  case 5: // right-top
     7224    iDiffX = +1;
     7225    iDiffY = -1;
     7226    break;
     7227  case 6: // left-bottom
     7228    iDiffX = -1;
     7229    iDiffY = +1;
     7230    break;
     7231  case 7: // right-bottom
     7232    iDiffX = +1;
     7233    iDiffY = +1;
     7234    break;
     7235  }
     7236
     7237  iX += iDiffX;
     7238  iY += iDiffY;
     7239
     7240  while( iPtr < ucNumEdge )
     7241  {
     7242    ucCode = pucEdgeCode[iPtr++];
     7243
     7244    Int iNewDir = tableDir[iDir][ucCode];
     7245
     7246    switch( iNewDir )
     7247    {
     7248    case 0: // left
     7249      iDiffX = -1;
     7250      iDiffY = 0;
     7251      break;
     7252    case 1: // right
     7253      iDiffX = +1;
     7254      iDiffY = 0;
     7255      break;
     7256    case 2: // top
     7257      iDiffX = 0;
     7258      iDiffY = -1;
     7259      break;
     7260    case 3: // bottom
     7261      iDiffX = 0;
     7262      iDiffY = +1;
     7263      break;
     7264    case 4: // left-top
     7265      iDiffX = -1;
     7266      iDiffY = -1;
     7267      break;
     7268    case 5: // right-top
     7269      iDiffX = +1;
     7270      iDiffY = -1;
     7271      break;
     7272    case 6: // left-bottom
     7273      iDiffX = -1;
     7274      iDiffY = +1;
     7275      break;
     7276    case 7: // right-bottom
     7277      iDiffX = +1;
     7278      iDiffY = +1;
     7279      break;
     7280    }
     7281
     7282    switch( iDir )
     7283    {
     7284    case 0: // left
     7285      switch( ucCode )
     7286      {
     7287      case 0:
     7288      case 2:
     7289        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7290        break;
     7291      case 1:
     7292      case 3:
     7293        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7294        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7295        break;
     7296      case 4:
     7297      case 6:
     7298        // no
     7299        break;
     7300      case 5:
     7301        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7302        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7303        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7304        break;
     7305      }
     7306      break;
     7307    case 1: // right
     7308      switch( ucCode )
     7309      {
     7310      case 0:
     7311      case 2:
     7312        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7313        break;
     7314      case 1:
     7315      case 3:
     7316        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7317        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7318        break;
     7319      case 4:
     7320      case 6:
     7321        // no
     7322        break;
     7323      case 5:
     7324        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7325        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7326        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7327        break;
     7328      }
     7329      break;
     7330    case 2: // top
     7331      switch( ucCode )
     7332      {
     7333      case 0:
     7334      case 2:
     7335        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7336        break;
     7337      case 1:
     7338      case 3:
     7339        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7340        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7341        break;
     7342      case 4:
     7343      case 6:
     7344        // no
     7345        break;
     7346      case 5:
     7347        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7348        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7349        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7350        break;
     7351      }
     7352      break;
     7353    case 3: // bottom
     7354      switch( ucCode )
     7355      {
     7356      case 0:
     7357      case 2:
     7358        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7359        break;
     7360      case 1:
     7361      case 3:
     7362        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7363        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7364        break;
     7365      case 4:
     7366      case 6:
     7367        // no
     7368        break;
     7369      case 5:
     7370        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7371        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7372        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7373        break;
     7374      }
     7375      break;
     7376    case 4: // left-top
     7377      switch( ucCode )
     7378      {
     7379      case 0:
     7380      case 1:
     7381        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7382        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7383        break;
     7384      case 2:
     7385      case 4:
     7386        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7387        break;
     7388      case 3:
     7389      case 5:
     7390        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7391        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7392        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7393        break;
     7394      case 6:
     7395        // no
     7396        break;
     7397      }
     7398      break;
     7399    case 5: // right-top
     7400      switch( ucCode )
     7401      {
     7402      case 0:
     7403      case 1:
     7404        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7405        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7406        break;
     7407      case 2:
     7408      case 4:
     7409        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7410        break;
     7411      case 3:
     7412      case 5:
     7413        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7414        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7415        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7416        break;
     7417      case 6:
     7418        // no
     7419        break;
     7420      }
     7421      break;
     7422    case 6: // left-bottom
     7423      switch( ucCode )
     7424      {
     7425      case 0:
     7426      case 1:
     7427        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7428        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7429        break;
     7430      case 2:
     7431      case 4:
     7432        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7433        break;
     7434      case 3:
     7435      case 5:
     7436        if(iY > 0) pbEdge[ 2 * iX + (2 * (iY - 1) + 1) * 2 * iWidth ] = true;
     7437        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7438        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7439        break;
     7440      case 6:
     7441        // no
     7442        break;
     7443      }
     7444      break;
     7445    case 7: // right-bottom
     7446      switch( ucCode )
     7447      {
     7448      case 0:
     7449      case 1:
     7450        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7451        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7452        break;
     7453      case 2:
     7454      case 4:
     7455        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7456        break;
     7457      case 3:
     7458      case 5:
     7459        if(iX > 0) pbEdge[ 2 * (iX - 1) + 1 + iY * 4 * iWidth ] = true;
     7460        if(iX < iWidth - 1) pbEdge[ 2 * (iX + 0) + 1 + iY * 4 * iWidth ] = true;
     7461        if(iY < iHeight - 1) pbEdge[ 2 * iX + (2 * (iY + 0) + 1) * 2 * iWidth ] = true;
     7462        break;
     7463      case 6:
     7464        // no
     7465        break;
     7466      }
     7467      break;
     7468    }
     7469
     7470    assert( iX >= 0 && iX <= iWidth );
     7471    assert( iY >= 0 && iY <= iHeight );
     7472
     7473    iX += iDiffX;
     7474    iY += iDiffY;
     7475    iDir = iNewDir;
     7476  }
     7477
     7478  // finalize edge chain
     7479  if( iX == iWidth-1 )
     7480  {
     7481    if( iY == 0 )
     7482    {
     7483      if( iDir == 1 )
     7484      {
     7485        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
     7486      }
     7487      else if( iDir == 5 )
     7488      {
     7489        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
     7490      }
     7491      else
     7492      {
     7493        assert(false);
     7494      }
     7495    }
     7496    else if( iY == iHeight-1 )
     7497    {
     7498      if( iDir == 3 )
     7499      {
     7500        pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
     7501      }
     7502      else if( iDir == 7 )
     7503      {
     7504        pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
     7505      }
     7506      else
     7507      {
     7508        assert(false);
     7509      }
     7510    }
     7511    else
     7512    {
     7513      if( iDir == 1 )
     7514      {
     7515        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
     7516      }
     7517      else if( iDir == 3 )
     7518      {
     7519        pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
     7520        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
     7521      }
     7522      else if( iDir == 5 )
     7523      {
     7524        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
     7525      }
     7526      else if( iDir == 7 )
     7527      {
     7528        pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
     7529        pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
     7530      }
     7531      else
     7532      {
     7533        assert(false);
     7534      }
     7535    }
     7536  }
     7537  else if( iX == 0 )
     7538  {
     7539    if( iY == 0 )
     7540    {
     7541      if( iDir == 2 )
     7542      {
     7543        pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
     7544      }
     7545      else if( iDir == 4 )
     7546      {
     7547        pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
     7548      }
     7549      else
     7550      {
     7551        assert(false);
     7552      }
     7553    }
     7554    else if( iY == iHeight-1 )
     7555    {
     7556      if( iDir == 0 )
     7557      {
     7558        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
     7559      }
     7560      else if( iDir == 6 )
     7561      {
     7562        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
     7563      }
     7564      else
     7565      {
     7566        assert(false);
     7567      }
     7568    }
     7569    else
     7570    {
     7571      if( iDir == 0 )
     7572      {
     7573        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
     7574      }
     7575      else if( iDir == 2 )
     7576      {
     7577        pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
     7578        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
     7579      }
     7580      else if( iDir == 4 )
     7581      {
     7582        pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
     7583        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
     7584      }
     7585      else if( iDir == 6 )
     7586      {
     7587        pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
     7588      }
     7589      else
     7590      {
     7591        assert(false);
     7592      }
     7593    }
     7594  }
     7595  else if( iY == 0 )
     7596  {
     7597    if( iDir == 1 )
     7598    {
     7599      pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
     7600      pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
     7601    }
     7602    else if( iDir == 2 )
     7603    {
     7604      pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
     7605    }
     7606    else if( iDir == 4 )
     7607    {
     7608      pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
     7609    }
     7610    else if( iDir == 5 )
     7611    {
     7612      pbEdge[ 2 * iX + (2 * iY + 1) * 2 * iWidth ] = true;
     7613      pbEdge[ 2 * iX + 1 + 2 * iY * 2 * iWidth ] = true;
     7614    }
     7615    else
     7616    {
     7617      assert(false);
     7618    }
     7619  }
     7620  else if( iY == iHeight-1 )
     7621  {
     7622    if( iDir == 0 )
     7623    {
     7624      pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
     7625      pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
     7626    }
     7627    else if( iDir == 3 )
     7628    {
     7629      pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
     7630    }
     7631    else if( iDir == 6 )
     7632    {
     7633      pbEdge[ 2 * iX + (2 * iY - 1) * 2 * iWidth ] = true;
     7634      pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
     7635    }
     7636    else if( iDir == 7 )
     7637    {
     7638      pbEdge[ 2 * iX - 1 + 2 * iY * 2 * iWidth ] = true;
     7639    }
     7640    else
     7641    {
     7642      assert(false);
     7643    }
     7644  }
     7645  else
     7646  {
     7647    printf("xPredIntraEdge: wrong termination\n");
     7648    assert(false);
     7649  }
     7650
     7651  // Reconstruct Region from Chain Code
     7652  Bool* pbVisit  = (Bool*) xMalloc( Bool, iWidth * iHeight );
     7653  Int*  piStack  = (Int* ) xMalloc( Int,  iWidth * iHeight );
     7654
     7655  for( UInt ui = 0; ui < iWidth * iHeight; ui++ )
     7656  {
     7657    pbRegion[ ui ] = true; // fill it as region 1 (we'll discover region 0 next)
     7658    pbVisit [ ui ] = false;
     7659  }
     7660
     7661  iPtr = 0;
     7662  piStack[iPtr++] = (0 << 8) | (0);
     7663  pbRegion[ 0 ] = false;
     7664
     7665  while(iPtr > 0)
     7666  {
     7667    Int iTmp = piStack[--iPtr];
     7668    Int iX1, iY1;
     7669    iX1 = iTmp & 0xff;
     7670    iY1 = (iTmp >> 8) & 0xff;
     7671
     7672    pbVisit[ iX1 + iY1 * iWidth ] = true;
     7673
     7674    assert( iX1 >= 0 && iX1 < iWidth );
     7675    assert( iY1 >= 0 && iY1 < iHeight );
     7676
     7677    if( iX1 > 0 && !pbEdge[ 2 * iX1 - 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 - 1 + iY1 * iWidth ] )
     7678    {
     7679      piStack[iPtr++] = (iY1 << 8) | (iX1 - 1);
     7680      pbRegion[ iX1 - 1 + iY1 * iWidth ] = false;
     7681    }
     7682    if( iX1 < iWidth - 1 && !pbEdge[ 2 * iX1 + 1 + 4 * iY1 * iWidth ] && !pbVisit[ iX1 + 1 + iY1 * iWidth ] )
     7683    {
     7684      piStack[iPtr++] = (iY1 << 8) | (iX1 + 1);
     7685      pbRegion[ iX1 + 1 + iY1 * iWidth ] = false;
     7686    }
     7687    if( iY1 > 0 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 - 1) * iWidth ] && !pbVisit[ iX1 + (iY1 - 1) * iWidth ] )
     7688    {
     7689      piStack[iPtr++] = ((iY1 - 1) << 8) | iX1;
     7690      pbRegion[ iX1 + (iY1 - 1) * iWidth ] = false;
     7691    }
     7692    if( iY1 < iHeight - 1 && !pbEdge[ 2 * iX1 + 2 * (2 * iY1 + 1) * iWidth ] && !pbVisit[ iX1 + (iY1 + 1) * iWidth ] )
     7693    {
     7694      piStack[iPtr++] = ((iY1 + 1) << 8) | iX1;
     7695      pbRegion[ iX1 + (iY1 + 1) * iWidth ] = false;
     7696    }
     7697  }
     7698
     7699  xFree( pbEdge );
     7700  xFree( pbVisit );
     7701  xFree( piStack );
     7702}
     7703
    59967704#endif
    59977705
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r77 r100  
    214214#endif
    215215
     216#if LGE_EDGE_INTRA
     217  UChar*        m_pucEdgeCode;          ///< array of edge code
     218  UChar*        m_pucEdgeNumber;        ///< total number of edge
     219  UChar*        m_pucEdgeStartPos;      ///< starting point position
     220  Bool*         m_pbEdgeLeftFirst;      ///< true if edge should be checked in left boundary first
     221  Bool*         m_pbEdgePartition;      ///< true if it belongs to region 1, otherwise, region 0
     222#if LGE_EDGE_INTRA_DELTA_DC
     223  Int*          m_piEdgeDeltaDC0;
     224  Int*          m_piEdgeDeltaDC1;
     225#endif
     226#endif
     227
    216228  // -------------------------------------------------------------------------------------------------------------------
    217229  // misc. variables
     
    256268  Void          deriveRightBottomIdx        ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB );
    257269  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx );
     270#if QC_MULTI_DIS_CAN
     271  Bool          xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
     272#endif
    258273 
    259274#if !AMVP_PRUNING_SIMPLIFICATION
     
    503518
    504519#if HHI_INTER_VIEW_MOTION_PRED
     520#if !QC_MULTI_DIS_CAN
    505521  Int           getPdmMergeCandidate( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
    506522  Bool          getPdmMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge = false );
     523#else
     524  Bool          getPdmMvPredDisCan( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge = false );
     525  Int           getPdmMergeCandidateDisCan( UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo );
     526  Void          getDisMvpCand        ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo );
     527#if LGE_DVMCP
     528  Void          getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo, Bool bMerge=false, RefPicList eRefPicList=REF_PIC_LIST_X, Int iRefIdx=-1 );
     529#endif
     530
     531#endif
    507532  Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
    508533#endif
     
    659684  UInt          getEntropySliceStartCU  ( UInt pos )                  { return m_uiEntropySliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
    660685  UInt&         getTotalBins            ()                            { return m_uiTotalBins;                                                                                                  }
     686
     687#if LGE_EDGE_INTRA
     688  UInt          getCtxEdgeIntra ( UInt uiAbsPartIdx );
     689#endif
     690
    661691  // -------------------------------------------------------------------------------------------------------------------
    662692  // member functions for RD cost storage
     
    734764  Void  setContourPredTexDeltaDC2SubParts ( Int iDC2, UInt uiAbsPartIdx, UInt uiDepth );
    735765#endif
     766
     767#if LGE_EDGE_INTRA
     768  UChar*        getEdgeCode( UInt uiIdx )                 { return &m_pucEdgeCode[uiIdx * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4]; }
     769  UChar*        getEdgeNumber( )                          { return m_pucEdgeNumber;           }
     770  UChar         getEdgeNumber( UInt uiIdx )               { return m_pucEdgeNumber[uiIdx];    }
     771  Void          setEdgeNumber( UInt uiIdx, UChar val )    { m_pucEdgeNumber[uiIdx] = val;     }
     772  UChar*        getEdgeStartPos( )                        { return m_pucEdgeStartPos;         }
     773  UChar         getEdgeStartPos( UInt uiIdx )             { return m_pucEdgeStartPos[uiIdx];  }
     774  Void          setEdgeStartPos( UInt uiIdx, UChar val )  { m_pucEdgeStartPos[uiIdx] = val;   }
     775  Bool*         getEdgeLeftFirst( )                       { return m_pbEdgeLeftFirst;         }
     776  Bool          getEdgeLeftFirst( UInt uiIdx )            { return m_pbEdgeLeftFirst[uiIdx];  }
     777  Void          setEdgeLeftFirst( UInt uiIdx, Bool val )  { m_pbEdgeLeftFirst[uiIdx] = val;   }
     778  Bool*         getEdgePartition( UInt uiIdx )              { return &m_pbEdgePartition[uiIdx * 16]; }
     779  Void          reconPartition( UInt uiAbsPartIdx, UInt uiDepth, Bool bLeft, UChar ucStartPos, UChar ucNumEdge, UChar* pucEdgeCode, Bool* pbRegion );
     780
     781#if LGE_EDGE_INTRA_DELTA_DC
     782  Int*          getEdgeDeltaDC0( )                          { return m_piEdgeDeltaDC0; }
     783  Int*          getEdgeDeltaDC1( )                          { return m_piEdgeDeltaDC1; }
     784  Int           getEdgeDeltaDC0( UInt uiIdx )               { return m_piEdgeDeltaDC0[uiIdx]; }
     785  Int           getEdgeDeltaDC1( UInt uiIdx )               { return m_piEdgeDeltaDC1[uiIdx]; }
     786  Void          setEdgeDeltaDC0( UInt uiIdx, Int val )      { m_piEdgeDeltaDC0[uiIdx] = val;  }
     787  Void          setEdgeDeltaDC1( UInt uiIdx, Int val )      { m_piEdgeDeltaDC1[uiIdx] = val;  }
     788#endif
     789#endif
    736790};
    737791
  • trunk/source/Lib/TLibCommon/TComDepthMapGenerator.cpp

    r77 r100  
    7878  m_uiSubSampExpX       = uiSubSampExpX;
    7979  m_uiSubSampExpY       = uiSubSampExpY;
     80#if !QC_MULTI_DIS_CAN
    8081  m_ppcYuv              = new TComYuv*    [ m_uiMaxDepth ];
    8182  m_ppcCU               = new TComDataCU* [ m_uiMaxDepth ];
     
    9192  m_cTmpPic.create( uiPicWidth >> m_uiSubSampExpX, uiPicHeight >> m_uiSubSampExpY, uiMaxCUWidth >> m_uiSubSampExpX, uiMaxCUHeight >> m_uiSubSampExpY, uiMaxCUDepth );
    9293  xSetChroma( &m_cTmpPic, ( 1 << uiOrgBitDepth ) >> 1 );
     94#endif
    9395  m_bCreated    = true;
    9496}
     
    100102  {
    101103    m_bCreated    = false;
     104#if !QC_MULTI_DIS_CAN
    102105    for( UInt uiDepth = 0; uiDepth < m_uiMaxDepth; uiDepth++ )
    103106    {
     
    114117    delete [] m_ppcCU;  m_ppcCU  = 0;
    115118    m_cTmpPic.destroy();
     119#endif
    116120    m_uiMaxDepth          = 0;
    117121    m_uiOrgDepthBitDepth  = 0;
     
    163167  m_bPDMAvailable = false;
    164168  m_uiCurrViewId  = pcPic->getSPS()->getViewId();
    165 
     169#if PDM_REMOVE_DEPENDENCE
     170  pcPic->setStoredPDMforV2(0);
     171#endif
    166172  // update SPS list and AU pic list and set depth map generator in SPS
    167173#if VIDYO_VPS_INTEGRATION
     
    218224  if( m_uiCurrViewId )
    219225  {
     226#if PDM_REMOVE_DEPENDENCE
     227    UInt      uiBaseVId   = m_auiBaseIdList[0];
     228#else
    220229    Bool      bCheckVId1  = ( m_uiCurrViewId > 1 && m_auiBaseIdList[0] == 0 );
    221230    UInt      uiBaseVId   = ( bCheckVId1 ? 1 : m_auiBaseIdList[0] );
     231#endif
    222232    TComPic*  pcBasePic   = m_pcAUPicAccess->getPic( uiBaseVId );
    223233    SliceType eSliceType  = pcBasePic->getCurrSlice()->getSliceType();
     
    367377}
    368378
    369 
     379#if !QC_MULTI_DIS_CAN
    370380Bool
    371381TComDepthMapGenerator::predictDepthMap( TComPic* pcPic )
     
    398408        pcBasePic->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(m_pcSPSAccess->getPdm()), PDM_SUB_SAMP_EXP_Y(m_pcSPSAccess->getPdm()) );
    399409        xClearDepthMap( pcBasePic );
     410#if PDM_REMOVE_DEPENDENCE
     411        xClearDepthMap( pcBasePic, PDM_UNDEFINED_DEPTH, 1 );
     412#endif
    400413      }
    401414#if PDM_OUTPUT_PRED_DEPTH_MAP
     
    442455  {
    443456    xClearDepthMap( pcPic );
     457#if PDM_REMOVE_DEPENDENCE
     458    xClearDepthMap( pcPic, PDM_UNDEFINED_DEPTH, 1 );
     459#endif
    444460  }
    445461  return bUndefined;
     
    463479
    464480  // predict depth map using current coding symbols
     481#if PDM_REMOVE_DEPENDENCE
     482  pcPic->setStoredPDMforV2(0);
     483  xPredictDepthMap( pcPic );
     484  if(m_uiCurrViewId==0)
     485  {
     486    pcPic->setStoredPDMforV2(1);
     487    xPredictDepthMap( pcPic );
     488    pcPic->setStoredPDMforV2(0);
     489  }
     490#else
    465491  xPredictDepthMap( pcPic );
    466492#if PDM_OUTPUT_PRED_DEPTH_MAP
     
    469495    dumpDepthMap( pcPic, acFilenameBase );
    470496  }
     497#endif
    471498#endif
    472499
     
    481508#endif
    482509  }
     510#if PDM_REMOVE_DEPENDENCE
     511  if( m_uiCurrViewId == 2 )
     512  {
     513    TComPic* pcBasePic = m_pcAUPicAccess->getPic( 0 );
     514    AOF( pcBasePic );
     515    xConvertDepthMapCurr2Ref( pcBasePic, pcPic );
     516#if PDM_OUTPUT_PRED_DEPTH_MAP
     517    dumpDepthMap( pcBasePic, acFilenameBase );
     518#endif
     519  }
     520#endif
    483521}
    484522
     
    501539  Int         iSrcStride  = pcPicYuv->getStride   ();
    502540  Int         iDstStride  = m_cTmpPic.getStride   ();
     541#if PDM_REMOVE_DEPENDENCE
     542  if(pcPic->getStoredPDMforV2())
     543     pcPicYuv    = pcPic->getPredDepthMapTemp();
     544#endif
    503545  Pel*        pSrcSamples = pcPicYuv->getLumaAddr ( 0 );
    504546  Pel*        pDstSamples = m_cTmpPic.getLumaAddr ( 0 );
     
    520562  m_cTmpPic.dump( acFilename, ( pcPic->getPOC() != 0 )  );
    521563}
    522 
     564#endif
    523565
    524566#if HHI_INTER_VIEW_MOTION_PRED
     
    563605
    564606#if HHI_INTER_VIEW_MOTION_PRED
     607#if QC_MULTI_DIS_CAN
     608Int
     609TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo )
     610#else
    565611Int
    566612TComDepthMapGenerator::getPdmMergeCandidate( TComDataCU* pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv )
    567 {
     613#endif
     614{
     615#if MTK_INTERVIEW_MERGE_A0049
     616  AOF  ( m_bCreated && m_bInit );
     617
     618#if !QC_MULTI_DIS_CAN
     619  ROFRS( m_bPDMAvailable, 0 );
     620#endif
     621
     622  TComSlice*    pcSlice     = pcCU->getSlice ();
     623  TComSPS*      pcSPS       = pcSlice->getSPS();
     624  AOF  ( pcSPS->getViewId() == m_uiCurrViewId );
     625  Bool          bPdmMerge   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE );
     626  ROTRS( !bPdmMerge, 0 );
     627
     628  Bool abPdmAvailable[2] = {false,false};
     629
     630  Int iValid = 0;
     631  Int iViewId = 0;
     632  for( UInt uiBId = 0; uiBId < m_uiCurrViewId && iValid==0; uiBId++ )
     633  {
     634    UInt        uiBaseId    = m_auiBaseIdList[ uiBId ];
     635    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
     636    for( Int iRefListId = 0; iRefListId < 2 && iValid==0; iRefListId++ )
     637    {
     638      RefPicList  eRefPicListTest = RefPicList( iRefListId );
     639      Int         iNumRefPics = pcSlice->getNumRefIdx( eRefPicListTest ) ;
     640      for( Int iRefIndex = 0; iRefIndex < iNumRefPics; iRefIndex++ )
     641      {
     642        if(pcBasePic->getPOC() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getPOC()
     643          && pcBasePic->getViewId() == pcSlice->getRefPic( eRefPicListTest, iRefIndex )->getViewId())
     644        {
     645          iValid=1;
     646          iViewId = uiBaseId;
     647          break;
     648        }
     649      }
     650    }
     651  }
     652  if (iValid == 0)
     653    return 0;
     654
     655  //--- get base CU/PU and check prediction mode ---
     656  TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( iViewId );
     657  TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
     658
     659#if QC_MULTI_DIS_CAN
     660  Int  iCurrPosX, iCurrPosY;
     661  UInt          uiPartAddr;
     662  Int           iWidth;
     663  Int           iHeight;
     664
     665  pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight );
     666  pcBaseRec->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
     667  iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
     668  iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
     669
     670  Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (pDInfo->m_acMvCand[0].getHor() + 2 ) >> 2 ) );
     671  Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (pDInfo->m_acMvCand[0].getVer() + 2 ) >> 2 ));
     672  Int         iBaseCUAddr;
     673  Int         iBaseAbsPartIdx;
     674  pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
     675#else
     676  Int  iPrdDepth, iCurrPosX, iCurrPosY;
     677  Bool bAvailable  = xGetPredDepth( pcCU, uiPartIdx, iPrdDepth, &iCurrPosX, &iCurrPosY );
     678  AOF( bAvailable );
     679  TComPicYuv* pcBasePdm   = pcBasePic->getPredDepthMap();
     680  Int         iDisparity  = xGetDisparityFromVirtDepth( iViewId, iPrdDepth );
     681  Int         iShiftX     = m_uiSubSampExpX + 2;
     682  Int         iAddX       = ( 1 << iShiftX ) >> 1;
     683  Int         iBasePosX   = Clip3( 0, pcBasePdm->getWidth () - 1, iCurrPosX + ( ( iDisparity + iAddX ) >> iShiftX ) );
     684  Int         iBasePosY   = Clip3( 0, pcBasePdm->getHeight() - 1, iCurrPosY                               );
     685  Int         iBaseCUAddr;
     686  Int         iBaseAbsPartIdx;
     687  pcBaseRec->getCUAddrAndPartIdx( iBasePosX<< m_uiSubSampExpX , iBasePosY<< m_uiSubSampExpY , iBaseCUAddr, iBaseAbsPartIdx );
     688#endif
     689
     690  TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     691
     692  if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTER || pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_SKIP )
     693  {
     694    for( UInt uiBaseRefListId = 0; uiBaseRefListId < 2; uiBaseRefListId++ )
     695    {
     696      RefPicList  eBaseRefPicList = RefPicList( uiBaseRefListId );
     697      TComMvField cBaseMvField;
     698      pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
     699      Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
     700
     701      if (iBaseRefIdx >= 0)
     702      {
     703        Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx);
     704        if (iBaseRefPOC != pcSlice->getPOC())   
     705        {
     706          for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eBaseRefPicList ); iPdmRefIdx++)
     707          {
     708            if (iBaseRefPOC == pcSlice->getRefPOC(eBaseRefPicList, iPdmRefIdx))
     709            {
     710              abPdmAvailable[ uiBaseRefListId ] = true;
     711              paiPdmRefIdx  [ uiBaseRefListId ] = iPdmRefIdx;
     712              TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
     713#if LGE_DVMCP
     714              cMv.m_bDvMcp = true;
     715              cMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor();
     716#endif
     717              pcCU->clipMv( cMv );
     718              pacPdmMv      [ uiBaseRefListId ] = cMv;
     719              break;
     720            }
     721          }
     722        }
     723      }
     724    }
     725  }
     726  Int iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 );
     727
     728  if (iPdmInterDir == 0)
     729  {
     730    for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ )
     731    {
     732      RefPicList  eRefPicList       = RefPicList( iRefListId );
     733      Int         iNumRefPics       = pcSlice->getNumRefIdx( eRefPicList );
     734      for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ )
     735{
     736        if( pcSlice->getRefPOC( eRefPicList, iPdmRefIdx ) == pcSlice->getPOC())
     737        {
     738          abPdmAvailable[ iRefListId ] = true;
     739          paiPdmRefIdx  [ iRefListId ] = iPdmRefIdx;
     740#if QC_MULTI_DIS_CAN
     741          TComMv cMv = pDInfo->m_acMvCand[0];
     742          cMv.setVer(0);
     743#else
     744          TComMv cMv(iDisparity, 0);
     745#endif
     746          pcCU->clipMv( cMv );
     747          pacPdmMv      [ iRefListId ] = cMv;
     748          break;
     749        }
     750      }
     751    }
     752    iPdmInterDir = ( abPdmAvailable[0] ? 1 : 0 ) + ( abPdmAvailable[1] ? 2 : 0 ) ;
     753  }
     754
     755  return iPdmInterDir;
     756
     757#else
    568758  Int  iMaxNumInterPics  = 1;
    569759  Int  iMaxNumAllPics    = 2;
     
    580770      if( pcCU->getSlice()->getRefPOC( eRefPicList, iPdmRefIdx ) != pcCU->getSlice()->getPOC() )
    581771      {
     772#if QC_MULTI_DIS_CAN
     773        if( getDisCanPdmMvPred (pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, pDInfo, true ) )       
     774#else
    582775        if( getPdmMvPred( pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, true ) )
     776#endif
    583777        {
    584778          pcCU->clipMv( cMv );
     
    602796      for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ )
    603797      {
     798#if QC_MULTI_DIS_CAN
     799        if ( getDisCanPdmMvPred (pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, pDInfo, true ) )
     800#else
    604801        if( getPdmMvPred( pcCU, uiPartIdx, eRefPicList, iPdmRefIdx, cMv, true ) )
     802#endif
    605803        {
    606804          pcCU->clipMv( cMv );
     
    615813  }
    616814  return iPdmInterDir;
    617 }
    618 
    619 
     815#endif
     816}
     817
     818#if QC_MULTI_DIS_CAN
     819Bool
     820TComDepthMapGenerator::getDisCanPdmMvPred    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge )
     821{
     822#if LGE_DVMCP
     823  rcMv.m_bDvMcp = false;
     824#endif
     825  AOF  ( m_bCreated && m_bInit );
     826  AOF  ( iRefIdx >= 0 );
     827  AOF  ( pcCU );
     828  //ROFRS( m_bPDMAvailable, false );
     829  TComSlice*    pcSlice     = pcCU->getSlice ();
     830  TComSPS*      pcSPS       = pcSlice->getSPS();
     831  AOF  ( pcSPS->getViewId() == m_uiCurrViewId );
     832  TComPic*      pcRefPic    = pcSlice->getRefPic( eRefPicList, iRefIdx );
     833  UInt          uiRefViewId = pcRefPic->getSPS()->getViewId();
     834  Int           iRefPoc     = pcRefPic->getPOC();
     835  Bool          bInterview  = ( uiRefViewId < m_uiCurrViewId );
     836  AOT(  bInterview && iRefPoc != pcSlice->getPOC() );
     837  AOT( !bInterview && iRefPoc == pcSlice->getPOC() );
     838  Bool          bPdmIView   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_IVIEW ) == PDM_USE_FOR_IVIEW );
     839  Bool          bPdmInter   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_INTER ) == PDM_USE_FOR_INTER );
     840  Bool          bPdmMerge   = ( ( pcSPS->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE );
     841  ROTRS( ( bInterview && !bMerge ) && !bPdmIView, false );
     842  ROTRS( (!bInterview && !bMerge ) && !bPdmInter, false );
     843  ROTRS(                  bMerge   && !bPdmMerge, false );
     844  Int  iCurrPosX, iCurrPosY;
     845  TComMv cDisMv;
     846
     847  if( bInterview )
     848  {
     849    rcMv = pDInfo->m_acMvCand[0];
     850    rcMv.setVer(0);
     851    return      true;
     852  }
     853  for( UInt uiBId = 0; uiBId < m_uiCurrViewId; uiBId++ )
     854  {
     855    UInt        uiBaseId    = uiBId;  //m_auiBaseIdList[ uiBId ];
     856
     857    if (m_uiCurrViewId >1 && uiBaseId ==1 )
     858      continue;
     859
     860    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
     861    TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
     862    UInt          uiPartAddr;
     863    Int           iWidth;
     864    Int           iHeight;
     865
     866    pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight );
     867    pcBaseRec->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
     868    iCurrPosX  += ( ( iWidth  - 1 ) >> 1 );
     869    iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
     870    Int         iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (pDInfo->m_acMvCand[0].getHor() + 2 ) >> 2 ) );
     871    Int         iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (pDInfo->m_acMvCand[0].getVer() + 2 ) >> 2 )); 
     872    Int         iBaseCUAddr;
     873    Int         iBaseAbsPartIdx;
     874    pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
     875    TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     876    if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_INTER && pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_SKIP )
     877    {
     878      continue;
     879    }
     880    for( UInt uiBaseRefListId = 0; uiBaseRefListId < 2; uiBaseRefListId++ )
     881    {
     882      RefPicList  eBaseRefPicList = RefPicList( uiBaseRefListId );
     883      TComMvField cBaseMvField;
     884      pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
     885      Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
     886      Int         iBaseRefPoc     = ( iBaseRefIdx >= 0 ? pcBaseCU->getSlice()->getRefPic( eBaseRefPicList, iBaseRefIdx )->getPOC() : -(1<<30) );
     887      if( iBaseRefIdx >= 0 && iBaseRefPoc == iRefPoc )
     888      {
     889        rcMv.set( cBaseMvField.getHor(), cBaseMvField.getVer() );
     890#if LGE_DVMCP
     891        // save disparity vector when a merge candidate for IVMP is set as DV-MCP
     892        if( bMerge )
     893        {
     894          rcMv.m_bDvMcp = true;
     895          rcMv.m_iDvMcpDispX = pDInfo->m_acMvCand[0].getHor();
     896        }
     897        else { // AMVP ?
     898          rcMv.m_bDvMcp = false;
     899        }
     900#endif
     901        return true;
     902      }
     903    }
     904  }
     905  return false;
     906}
     907#else
    620908Bool 
    621909TComDepthMapGenerator::getPdmMvPred( TComDataCU* pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge )
     
    664952    //--- get base CU/PU and check prediction mode ---
    665953    UInt        uiBaseId    = m_auiBaseIdList[ uiBId ];
     954#if PDM_REMOVE_DEPENDENCE
     955    if( uiBaseId != 0)
     956      continue;
     957#endif
    666958    TComPic*    pcBasePic   = m_pcAUPicAccess->getPic( uiBaseId );
    667959    TComPicYuv* pcBasePdm   = pcBasePic->getPredDepthMap();
     
    697989  return false;
    698990}
     991#endif
    699992
    700993
     
    7441037
    7451038
    746 
     1039#if !QC_MULTI_DIS_CAN
    7471040/*=======================================================*
    7481041 *=====                                             =====*
     
    7601053  AOF( pcRef->getPredDepthMap()->getWidth () == pcCur->getPredDepthMap()->getWidth () );
    7611054  AOF( pcRef->getPredDepthMap()->getHeight() == pcCur->getPredDepthMap()->getHeight() );
    762 
     1055#if PDM_REMOVE_DEPENDENCE
     1056  if( pcCur->getViewId() == 1)
     1057    xClearDepthMap( pcRef );
     1058  else if (pcCur->getViewId() == 2)
     1059    xClearDepthMap( pcRef, PDM_UNDEFINED_DEPTH, 1 );
     1060#else
    7631061  xClearDepthMap( pcRef );
     1062#endif
    7641063  TComPicYuv* pcCurDepthMap =  pcCur->getPredDepthMap    ();
    7651064  TComPicYuv* pcRefDepthMap =  pcRef->getPredDepthMap    ();
     
    7711070  Pel*        pRefSamples   =  pcRefDepthMap->getLumaAddr( 0 );
    7721071  Int         iRefViewIdx   =  pcRef->getViewId();
     1072#if PDM_REMOVE_DEPENDENCE
     1073  if( pcCur->getViewId() == 2)
     1074  {
     1075    pcRefDepthMap =  pcRef->getPredDepthMapTemp();
     1076    pRefSamples   =  pcRefDepthMap->getLumaAddr( 0 );
     1077  }
     1078#endif
    7731079  Int         iShiftX       = m_uiSubSampExpX + 2;
    7741080  Int         iAddX         = ( 1 << iShiftX ) >> 1;
     
    7991105  AOF( pcCur->getSPS()->getViewId()  > pcRef->getSPS()->getViewId() );
    8001106  AOF( pcCur->getPredDepthMap() );
     1107#if PDM_REMOVE_DEPENDENCE
     1108  if(pcCur->getViewId() == 1)
     1109  {
     1110    AOF( pcRef->getPredDepthMap() );
     1111  }else
     1112  {
     1113    AOF( pcRef->getPredDepthMapTemp() );
     1114  }
     1115#else
    8011116  AOF( pcRef->getPredDepthMap() );
     1117#endif
    8021118  AOF( pcRef->getPredDepthMap()->getWidth () == pcCur->getPredDepthMap()->getWidth () );
    8031119  AOF( pcRef->getPredDepthMap()->getHeight() == pcCur->getPredDepthMap()->getHeight() );
     
    8051121  xClearDepthMap( pcCur );
    8061122  TComPicYuv* pcRefDepthMap =  pcRef->getPredDepthMap    ();
     1123#if PDM_REMOVE_DEPENDENCE
     1124  if(pcCur->getViewId() == 2)
     1125    pcRefDepthMap =  pcRef->getPredDepthMapTemp        ();
     1126#endif
    8071127  TComPicYuv* pcCurDepthMap =  pcCur->getPredDepthMap    ();
    8081128  Int         iWidth        =  pcRefDepthMap->getWidth   ();
     
    8441164  }
    8451165  Bool    bUndefined = xFillDepthMapHoles( pcPic );
     1166#if PDM_REMOVE_DEPENDENCE
     1167  if(pcPic->getStoredPDMforV2() == 1){
     1168  pcPic->getPredDepthMapTemp()->setBorderExtension( false );
     1169  pcPic->getPredDepthMapTemp()->extendPicBorder   ();
     1170  }else{
     1171#endif
    8461172  pcPic->getPredDepthMap()->setBorderExtension( false );
    8471173  pcPic->getPredDepthMap()->extendPicBorder   ();
     1174#if PDM_REMOVE_DEPENDENCE
     1175  }
     1176#endif
    8481177  return  bUndefined;
    8491178}
     
    8551184  Bool        bUndefined  = false;     
    8561185  TComPicYuv* pcDepthMap  = pcPic->getPredDepthMap  ();
     1186#if PDM_REMOVE_DEPENDENCE
     1187  if(pcPic->getViewId()==0 && pcPic->getStoredPDMforV2()==1)
     1188    pcDepthMap  = pcPic->getPredDepthMapTemp  ();
     1189#endif
    8571190  Int         iWidth      = pcDepthMap->getWidth    ();
    8581191  Int         iHeight     = pcDepthMap->getHeight   ();
     
    8881221        {
    8891222          bUndefined = true;
    890                   break;
     1223          break;
    8911224        }
    8921225        iX = iE - 1;
     
    9131246
    9141247Void
    915 TComDepthMapGenerator::xClearDepthMap( TComPic* pcPic, Int iVal )
     1248TComDepthMapGenerator::xClearDepthMap( TComPic* pcPic, Int iVal
     1249#if PDM_REMOVE_DEPENDENCE
     1250,
     1251Int forFirstNonBaseView
     1252#endif
     1253)
    9161254{
    9171255  TComPicYuv* pcDepthMap  = pcPic->getPredDepthMap  ();
     
    9201258  Int         iStride     = pcDepthMap->getStride   ();
    9211259  Pel*        pDMSamples  = pcDepthMap->getLumaAddr ( 0 );
     1260#if PDM_REMOVE_DEPENDENCE
     1261  if( forFirstNonBaseView == 1)
     1262  {
     1263    pcDepthMap  = pcPic->getPredDepthMapTemp  ();
     1264    pDMSamples  = pcDepthMap->getLumaAddr ( 0 );
     1265  }
     1266#endif
    9221267  for( Int iY = 0; iY < iHeight; iY++, pDMSamples += iStride )
    9231268  {
     
    9891334  TComYuv*    pcSubDM   = m_ppcYuv[ uiDepth ];
    9901335  TComPicYuv* pcPicDM   = pcCU->getPic()->getPredDepthMap();
     1336#if PDM_REMOVE_DEPENDENCE
     1337  if( pcCU->getPic()->getStoredPDMforV2() == 1)
     1338    pcPicDM   = pcCU->getPic()->getPredDepthMapTemp();
     1339#endif
    9911340  UInt        uiCUAddr  = pcCU->getAddr();
    9921341  pcSubCU->copySubCU( pcCU, uiAbsPartIdx, uiDepth );
     
    10751424    UInt  uiZOrderIdx     = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
    10761425    Pel*  pPicDepthMap    = pcCU->getPic()->getPredDepthMap()->getLumaAddr( pcCU->getAddr(), uiZOrderIdx );
     1426#if PDM_REMOVE_DEPENDENCE
     1427    if(pcCU->getPic()->getStoredPDMforV2()==1)
     1428      pPicDepthMap    = pcCU->getPic()->getPredDepthMapTemp()->getLumaAddr( pcCU->getAddr(), uiZOrderIdx );
     1429#endif
    10771430    Int   iPicStride      = pcCU->getPic()->getPredDepthMap()->getStride  ();
    10781431    for( UInt uiY = 0; uiY < uiHeight; uiY++, pDepthMap += uiStride, pPicDepthMap += iPicStride )
     
    15111864  return        true;
    15121865}
     1866#endif
    15131867
    15141868#endif // DEPTH_MAP_GENERATION
  • trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h

    r77 r100  
    136136
    137137  Void  initViewComponent     ( TComPic*      pcPic );
     138#if !QC_MULTI_DIS_CAN
    138139  Bool  predictDepthMap       ( TComPic*      pcPic );
    139140  Void  updateDepthMap        ( TComPic*      pcPic );
    140141  Void  dumpDepthMap          ( TComPic*      pcPic, char* pFilenameBase );
     142#endif
    141143
    142144#if HHI_INTER_VIEW_MOTION_PRED
     
    149151  Int   getDisparity          ( TComPic*      pcPic, Int iPosX, Int iPosY, UInt uiRefViewId );
    150152#if HHI_INTER_VIEW_MOTION_PRED
     153#if QC_MULTI_DIS_CAN
     154  Int   getPdmMergeCandidate ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDInfo );
     155  Bool  getPdmMvPredDisCan    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge );
     156  Bool  getDisCanPdmMvPred    ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, DisInfo* pDInfo, Bool bMerge );
     157#else
    151158  Int   getPdmMergeCandidate  ( TComDataCU*   pcCU, UInt uiPartIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv );
    152159  Bool  getPdmMvPred          ( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv, Bool bMerge );
     160#endif
    153161  Bool  getIViewOrgDepthMvPred( TComDataCU*   pcCU, UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
    154162#endif
     
    163171private:
    164172  // picture operations
     173#if !QC_MULTI_DIS_CAN
    165174  Bool  xConvertDepthMapCurr2Ref  ( TComPic*    pcRef, TComPic* pcCur );
    166175  Bool  xConvertDepthMapRef2Curr  ( TComPic*    pcCur, TComPic* pcRef );
    167176  Bool  xPredictDepthMap          ( TComPic*    pcPic );
    168177  Bool  xFillDepthMapHoles        ( TComPic*    pcPic );
    169   Void  xClearDepthMap            ( TComPic*    pcPic, Int      iVal  = PDM_UNDEFINED_DEPTH );
     178  Void  xClearDepthMap            ( TComPic*    pcPic, Int      iVal  = PDM_UNDEFINED_DEPTH
     179#if PDM_REMOVE_DEPENDENCE
     180  ,
     181  Int forFirstNonBaseView = 0
     182#endif
     183  );
    170184  Void  xSetChroma                ( TComPicYuv* pcPic, Int      iVal  );
    171185
     
    182196  Void  xInterPUDepthMapPrediction( TComDataCU* pcCU, TComYuv* pcCUDepthMap, UInt uiPartIdx );                      // PU inter prediction
    183197  Bool  xGetPredDepth             ( TComDataCU* pcCU, UInt uiPartIdx, Int& riPrdDepth, Int* piPosX = 0, Int* piPosY = 0 );
    184 
     198#endif
    185199  // conversion functions
    186200  Int   xGetVirtDepthFromDisparity( UInt uiBaseId, Int iDisparity )
  • trunk/source/Lib/TLibCommon/TComMotionInfo.h

    r56 r100  
    5959
    6060// ====================================================================================================================
     61#if QC_MULTI_DIS_CAN
     62typedef struct _DisCand
     63{
     64  TComMv m_acMvCand[ DIS_CANS ];            ///< array of motion vector predictor candidates
     65  Int    m_aVIdxCan[ DIS_CANS ];            ///< array of motion vector predictor candidates
     66  Int    iN;                                ///< number of motion vector predictor candidates
     67} DisInfo;
     68#endif
    6169// Class definition
    6270// ====================================================================================================================
  • trunk/source/Lib/TLibCommon/TComMv.h

    r56 r100  
    5757public:
    5858 
     59#if LGE_DVMCP
     60  Bool  m_bDvMcp;       // is dv-mcp ?
     61  Int   m_iDvMcpDispX;  // disparity for dv-mcp
     62#endif
     63
    5964  // ------------------------------------------------------------------------------------------------------------------
    6065  // constructors
     
    6469  m_iHor(0),
    6570  m_iVer(0)
     71#if LGE_DVMCP
     72  , m_bDvMcp(false)
     73  , m_iDvMcpDispX(0)
     74#endif
    6675  {
    6776  }
     
    7079  m_iHor(iHor),
    7180  m_iVer(iVer)
     81#if LGE_DVMCP
     82  , m_bDvMcp(false)
     83  , m_iDvMcpDispX(0)
     84#endif
    7285  {
    7386  }
  • trunk/source/Lib/TLibCommon/TComPattern.cpp

    r56 r100  
    675675{
    676676  Int* piSrc;
     677#if LGE_EDGE_INTRA
     678  mapEdgeIntratoDC( uiDirMode );
     679#endif
    677680  assert(log2BlkSize >= 2 && log2BlkSize < 7);
    678681#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r56 r100  
    5555#if DEPTH_MAP_GENERATION
    5656  m_pcPredDepthMap    = NULL;
     57#if PDM_REMOVE_DEPENDENCE
     58  m_pcPredDepthMap_temp    = NULL;
     59#endif
    5760#endif
    5861#if HHI_INTER_VIEW_MOTION_PRED
     
    136139    m_pcPredDepthMap = NULL;
    137140  }
     141#if PDM_REMOVE_DEPENDENCE
     142  if( m_pcPredDepthMap_temp )         //  estimated depth map
     143  {
     144    m_pcPredDepthMap_temp->destroy();
     145    delete m_pcPredDepthMap_temp;
     146    m_pcPredDepthMap_temp = NULL;
     147  }                     
     148#endif
    138149#endif
    139150#if HHI_INTER_VIEW_MOTION_PRED
     
    179190  m_pcPredDepthMap    = new TComPicYuv;
    180191  m_pcPredDepthMap    ->create( iWidth >> uiSubSampExpX, iHeight >> uiSubSampExpY, uiMaxCuWidth >> uiSubSampExpX, uiMaxCuHeight >> uiSubSampExpY, uiMaxCuDepth );
     192#if PDM_REMOVE_DEPENDENCE
     193  m_pcPredDepthMap_temp    = new TComPicYuv;
     194  m_pcPredDepthMap_temp    ->create( iWidth >> uiSubSampExpX, iHeight >> uiSubSampExpY, uiMaxCuWidth >> uiSubSampExpX, uiMaxCuHeight >> uiSubSampExpY, uiMaxCuDepth );
     195#endif
    181196}
    182197#endif
     
    224239    m_pcPredDepthMap = NULL;
    225240  }
     241#if PDM_REMOVE_DEPENDENCE
     242  if(m_pcPredDepthMap_temp)
     243  {
     244    m_pcPredDepthMap_temp->destroy();
     245    delete m_pcPredDepthMap_temp;
     246    m_pcPredDepthMap_temp = NULL;
     247  }
     248#endif
    226249}
    227250#endif
  • trunk/source/Lib/TLibCommon/TComPic.h

    r77 r100  
    6767#if DEPTH_MAP_GENERATION
    6868  TComPicYuv*           m_pcPredDepthMap;         //  estimated depth map
     69#if PDM_REMOVE_DEPENDENCE
     70  TComPicYuv*           m_pcPredDepthMap_temp;         //  estimated depth map
     71  Bool                  m_bPDMV2;                       
     72#endif
     73#endif
     74
     75#if LG_ZEROINTRADEPTHRESI_M26039
     76  Int                   m_uiIntraPeriod;
    6977#endif
    7078
    7179#if HHI_INTER_VIEW_MOTION_PRED
    7280  TComPicYuv*           m_pcOrgDepthMap;          //  original depth map
     81#if QC_MULTI_DIS_CAN
     82  Bool          m_checked;
     83#endif
    7384#endif
    7485#if HHI_INTER_VIEW_RESIDUAL_PRED
     
    123134  TComVPS*      getVPS()              { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getVPS();  }
    124135#endif
     136#if LG_ZEROINTRADEPTHRESI_M26039
     137  Int           getIntraPeriod()                           { return  m_uiIntraPeriod; }
     138  Void          setIntraPeriod(Int uiIntraPeriod)          { m_uiIntraPeriod = uiIntraPeriod; }
     139#endif
    125140  TComSPS*      getSPS()              { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getSPS();  }
    126141  Int           getPOC()              { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC();  }
    127142  Int           getViewId()           { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getViewId(); }
    128   TComDataCU*&  getCU( UInt uiCUAddr )  { return  m_apcPicSym->getCU( uiCUAddr ); }
     143  TComDataCU*&  getCU( UInt uiCUAddr ){ return  m_apcPicSym->getCU( uiCUAddr ); }
    129144 
    130145  TComPicYuv*   getPicYuvOrg()        { return  m_apcPicYuv[0]; }
     
    136151#if DEPTH_MAP_GENERATION
    137152  TComPicYuv*   getPredDepthMap()     { return  m_pcPredDepthMap; }
    138 #endif
    139 
     153#if PDM_REMOVE_DEPENDENCE
     154  TComPicYuv*   getPredDepthMapTemp()           { return  m_pcPredDepthMap_temp; }
     155  Void          setStoredPDMforV2  (Bool flag)  { m_bPDMV2 = flag;}
     156  Bool          getStoredPDMforV2  ()           { return m_bPDMV2;}
     157#endif
     158
     159#endif
    140160#if HHI_INTER_VIEW_MOTION_PRED
    141161  TComPicYuv*   getOrgDepthMap()      { return  m_pcOrgDepthMap; }
     162#if QC_MULTI_DIS_CAN
     163  Void          setCandPicCheckedFlag (Bool bchecked)   { m_checked = bchecked; }
     164  Bool          getCandPicCheckedFlag ()                { return m_checked;}
     165#endif
    142166#endif
    143167
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r56 r100  
    4646// ====================================================================================================================
    4747
     48#if LGE_EDGE_INTRA
     49#define MAX_DISTANCE_EDGEINTRA 255
     50#endif
     51
    4852TComPrediction::TComPrediction()
    4953: m_pLumaRecBuffer(0)
     
    419423}
    420424
     425#if LGE_EDGE_INTRA
     426Void TComPrediction::predIntraLumaEdge ( TComDataCU* pcCU, TComPattern* pcTComPattern, UInt uiAbsPartIdx, Int iWidth, Int iHeight, Pel* piPred, UInt uiStride, Bool bDelta )
     427{
     428  Pel *piDst = piPred;
     429  Int *piSrc;
     430  Int iSrcStride = ( iWidth<<1 ) + 1;
     431  Int iDstStride = uiStride;
     432
     433  piSrc = pcTComPattern->getPredictorPtr( 0, g_aucConvertToBit[ iWidth ] + 2, m_piYuvExt );
     434
     435  xPredIntraEdge ( pcCU, uiAbsPartIdx, iWidth, iHeight, piSrc, iSrcStride, piDst, iDstStride
     436#if LGE_EDGE_INTRA_DELTA_DC
     437    , bDelta
     438#endif
     439    );
     440}
     441
     442Pel  TComPrediction::xGetNearestNeighbor( Int x, Int y, Int* pSrc, Int srcStride, Int iWidth, Int iHeight, Bool* bpRegion )
     443{
     444  Bool bLeft = (x < y) ? true : false;
     445  Bool bFound = false;
     446  Int  iFoundX = -1, iFoundY = -1;
     447  Int  cResult = 0;
     448
     449  UChar* piTopDistance = new UChar[iWidth];
     450  UChar* piLeftDistance = new UChar[iHeight];
     451
     452  for( Int i = 0; i < iWidth; i++ )
     453  {
     454    int Abs = x > i ? x - i : i - x;
     455    piTopDistance[ i ] = y + Abs;
     456
     457    Abs = y > i ? y - i : i - y;
     458    piLeftDistance[ i ] = x + Abs;
     459  }
     460
     461  for( Int dist = 0; dist < MAX_DISTANCE_EDGEINTRA && !bFound; dist++ )
     462  {
     463    if( !bLeft )
     464    {
     465      for( Int i = 0; i < iWidth; i++ )
     466      {
     467        if( piTopDistance[ i ] == dist )
     468        {
     469          if( bpRegion[ i ] == bpRegion[ x + y * iWidth ] )
     470          {
     471            iFoundX = i;
     472            iFoundY = 0;
     473            bFound = true;
     474          }
     475        }
     476      }
     477      for( Int i = 0; i < iHeight; i++ )
     478      {
     479        if( piLeftDistance[ i ] == dist )
     480        {
     481          if( bpRegion[ i * iWidth ] == bpRegion[ x + y * iWidth ] )
     482          {
     483            iFoundX = 0;
     484            iFoundY = i;
     485            bFound = true;
     486          }
     487        }
     488      }
     489    }
     490    else
     491    {
     492      for( Int i = 0; i < iHeight; i++ )
     493      {
     494        if( piLeftDistance[ i ] == dist )
     495        {
     496          if( bpRegion[ i * iWidth ] == bpRegion[ x + y * iWidth ] )
     497          {
     498            iFoundX = 0;
     499            iFoundY = i;
     500            bFound = true;
     501          }
     502        }
     503      }
     504      for( Int i = 0; i < iWidth; i++ )
     505      {
     506        if( piTopDistance[ i ] == dist )
     507        {
     508          if( bpRegion[ i ] == bpRegion[ x + y * iWidth ] )
     509          {
     510            iFoundX = i;
     511            iFoundY = 0;
     512            bFound = true;
     513          }
     514        }
     515      }
     516    }
     517  }
     518
     519  if( iFoundY == 0 )
     520  {
     521    cResult = pSrc[ iFoundX + 1 ];
     522  }
     523  else // iFoundX == 0
     524  {
     525    cResult = pSrc[ (iFoundY + 1) * srcStride ];
     526  }
     527
     528  delete[] piTopDistance;  piTopDistance = NULL;
     529  delete[] piLeftDistance; piLeftDistance = NULL;
     530
     531  assert( bFound );
     532
     533  return cResult;
     534}
     535
     536Void TComPrediction::xPredIntraEdge( TComDataCU* pcCU, UInt uiAbsPartIdx, Int iWidth, Int iHeight, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, Bool bDelta )
     537{
     538  Pel* pDst = rpDst;
     539  Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx );
     540
     541  // Do prediction
     542  {
     543    //UInt uiSum0 = 0, uiSum1 = 0;
     544    Int iSum0 = 0, iSum1 = 0;
     545    //UInt uiMean0, uiMean1;
     546    Int iMean0, iMean1;
     547    //UInt uiCount0 = 0, uiCount1 = 0;
     548    Int iCount0 = 0, iCount1 = 0;
     549    for( UInt ui = 0; ui < iWidth; ui++ )
     550    {
     551      if( pbRegion[ ui ] == false )
     552      {
     553        iSum0 += (pSrc[ ui + 1 ]);
     554        iCount0++;
     555      }
     556      else
     557      {
     558        iSum1 += (pSrc[ ui + 1 ]);
     559        iCount1++;
     560      }
     561    }
     562    for( UInt ui = 0; ui < iHeight; ui++ ) // (0,0) recount (to avoid division)
     563    {
     564      if( pbRegion[ ui * iWidth ] == false )
     565      {
     566        iSum0 += (pSrc[ (ui + 1) * srcStride ]);
     567        iCount0++;
     568      }
     569      else
     570      {
     571        iSum1 += (pSrc[ (ui + 1) * srcStride ]);
     572        iCount1++;
     573      }
     574    }
     575    if( iCount0 == 0 )
     576      assert(false);
     577    if( iCount1 == 0 )
     578      assert(false);
     579    iMean0 = iSum0 / iCount0; // TODO : integer op.
     580    iMean1 = iSum1 / iCount1;
     581#if LGE_EDGE_INTRA_DELTA_DC
     582    if( bDelta )
     583    {
     584      Int iDeltaDC0 = pcCU->getEdgeDeltaDC0( uiAbsPartIdx );
     585      Int iDeltaDC1 = pcCU->getEdgeDeltaDC1( uiAbsPartIdx );
     586      xDeltaDCQuantScaleUp( pcCU, iDeltaDC0 );
     587      xDeltaDCQuantScaleUp( pcCU, iDeltaDC1 );
     588      iMean0 = Clip( iMean0 + iDeltaDC0 );
     589      iMean1 = Clip( iMean1 + iDeltaDC1 );
     590    }
     591#endif
     592    for( UInt ui = 0; ui < iHeight; ui++ )
     593    {
     594      for( UInt uii = 0; uii < iWidth; uii++ )
     595      {
     596        if( pbRegion[ uii + ui * iWidth ] == false )
     597          pDst[ uii + ui * dstStride ] = iMean0;
     598        else
     599          pDst[ uii + ui * dstStride ] = iMean1;
     600      }
     601    }
     602  }
     603}
     604#endif
     605
    421606#if DEPTH_MAP_GENERATION
    422607Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     
    569754  {
    570755    UInt uiRShift = 0;
    571     xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift, 0 );
     756#if PDM_REMOVE_DEPENDENCE
     757    if( pcCU->getPic()->getStoredPDMforV2() == 1 )
     758      xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMapTemp(), uiPartAddr, &cMv, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift, 0 );
     759    else
     760#endif
     761      xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift, 0 );
     762
    572763    return;
    573764  }
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r56 r100  
    125125#endif
    126126
     127#if LGE_EDGE_INTRA
     128  Pel  xGetNearestNeighbor  ( Int x, Int y, Int* pSrc, Int srcStride, Int iWidth, Int iHeight, Bool* bpRegion );
     129  Void xPredIntraEdge       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Int iWidth, Int iHeight, Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, Bool bDelta = false );
     130#endif
     131
    127132public:
    128133  TComPrediction();
     
    170175  Bool  getWedgePatternIdx      ( WedgeRefList* pcWedgeRefList, UInt& ruiTabIdx, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe );
    171176#endif
     177#if LGE_EDGE_INTRA
     178  Void predIntraLumaEdge          ( TComDataCU* pcCU, TComPattern* pcTComPattern, UInt uiAbsPartIdx, Int iWidth, Int iHeight, Pel* piPred, UInt uiStride, Bool bDelta = false );
     179#endif
    172180
    173181  // simplified intra pred for "virtual" depth maps
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r81 r100  
    4545//! \{
    4646
     47#if SAIT_VSO_EST_A0033
     48Double TComRdCost::m_dDisparityCoeff = 1.0;
     49#endif
     50
    4751TComRdCost::TComRdCost()
    4852{
     
    232236  m_afpDistortFunc[28] = TComRdCost::xGetHADs;
    233237 
     238#if SAIT_VSO_EST_A0033
     239  m_afpDistortFunc[29]  = TComRdCost::xGetVSD;
     240  m_afpDistortFunc[30]  = TComRdCost::xGetVSD4;
     241  m_afpDistortFunc[31]  = TComRdCost::xGetVSD8;
     242  m_afpDistortFunc[32]  = TComRdCost::xGetVSD16;
     243  m_afpDistortFunc[33]  = TComRdCost::xGetVSD32;
     244  m_afpDistortFunc[34]  = TComRdCost::xGetVSD64;
     245  m_afpDistortFunc[35]  = TComRdCost::xGetVSD16N;
     246#endif
     247
    234248#if !FIX203
    235249  m_puiComponentCostOriginP = NULL;
     
    248262  m_uiNumberRefPics         = 0;
    249263  m_bUseVSO                 = false;
     264#if SAIT_VSO_EST_A0033
     265  m_bUseEstimatedVSD        = false;
     266#endif
    250267  m_uiVSOMode               = 0;
    251268  m_fpDistortFuncVSO        = NULL;
     
    273290   
    274291    m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ];
    275 #if HHI_FIX
    276292    m_puiMultiviewRegCostHorOrgP  = new UInt[ 4 * iSubPelSearchLimit ];
    277293    m_puiMultiviewRegCostVerOrgP  = new UInt[ 4 * iSubPelSearchLimit ];
    278 #endif
     294
    279295    iSubPelSearchLimit *= 2;
    280296   
    281297    m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit;
    282 #if HHI_FIX
     298
    283299    m_puiMultiviewRegCostHor = m_puiMultiviewRegCostHorOrgP + iSubPelSearchLimit;
    284300    m_puiMultiviewRegCostVer = m_puiMultiviewRegCostVerOrgP + iSubPelSearchLimit;
    285 #endif
     301
    286302   
    287303    for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++)
    288304    {
    289305      m_puiComponentCost[n] = xGetComponentBits( n );
    290 #if HHI_FIX
    291306      m_puiMultiviewRegCostHor[n] = xGetComponentBits( n );  // first version
    292307      m_puiMultiviewRegCostVer[n] = xGetComponentBits( n );  // first version
    293 #endif
    294308    }
    295309  }
     
    303317    m_puiComponentCostOriginP = NULL;
    304318  }
    305 #if HHI_FIX
     319
    306320  if( m_puiMultiviewRegCostHorOrgP )
    307321    {
     
    314328    m_puiMultiviewRegCostVerOrgP = NULL;
    315329  }
    316 #endif
    317330}
    318331#endif
     
    565578}
    566579
     580
     581#if SAIT_VSO_EST_A0033
     582UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, Pel* piVirRec, Pel* piVirOrg, Int iVirStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc )
     583{
     584  AOT( ( m_dDisparityCoeff <= 0 ) || ( m_dDisparityCoeff > 10 ) );
     585
     586  DistParam cDtParam;
     587  setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam );
     588  cDtParam.pOrg       = piOrg;
     589  cDtParam.pCur       = piCur;
     590  cDtParam.pVirRec    = piVirRec;
     591  cDtParam.pVirOrg    = piVirOrg;
     592  cDtParam.iStrideVir = iVirStride;
     593  cDtParam.iStrideOrg = iOrgStride;
     594  cDtParam.iStrideCur = iCurStride;
     595  cDtParam.iStep      = 1;
     596
     597  cDtParam.bApplyWeight = false;
     598  cDtParam.uiComp       = 255;    // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed.
     599
     600  return cDtParam.DistFunc( &cDtParam );
     601}
     602#endif
    567603
    568604
     
    20262062#endif
    20272063
     2064
     2065#if SAIT_VSO_EST_A0033
     2066UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride,  Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y )
     2067{
     2068  Double dD;
     2069  Int iTemp;
     2070
     2071  dD = ( (Double) ( dDM >> g_uiBitIncrement ) ) * m_dDisparityCoeff;
     2072
     2073  iTemp = (Int) ROUND( 0.5 * fabs(dD) * ( abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x-1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x+1+y*iVirStride ] ) ) );
     2074
     2075  return (UInt) ( (iTemp*iTemp)>>1 );
     2076}
     2077
     2078UInt TComRdCost::xGetVSD( DistParam* pcDtParam )
     2079{
     2080  Pel* piOrg    = pcDtParam->pOrg;
     2081  Pel* piCur    = pcDtParam->pCur;
     2082  Pel* piVirRec = pcDtParam->pVirRec;
     2083  Pel* piVirOrg = pcDtParam->pVirOrg;
     2084  Int  iRows    = pcDtParam->iRows;
     2085  Int  iCols    = pcDtParam->iCols;
     2086  Int  iStrideOrg = pcDtParam->iStrideOrg;
     2087  Int  iStrideCur = pcDtParam->iStrideCur;
     2088  Int  iStrideVir = pcDtParam->iStrideVir;
     2089
     2090  UInt uiSum = 0;
     2091  UInt uiShift = g_uiBitIncrement<<1;
     2092
     2093  Int dDM;
     2094
     2095  for ( Int y = 0 ; y < iRows ; y++ )
     2096  {
     2097    for (Int x = 0; x < iCols; x++ )
     2098    {
     2099      dDM = (Int) ( piOrg[x  ] - piCur[x  ] );
     2100      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     2101    }
     2102    piOrg += iStrideOrg;
     2103    piCur += iStrideCur;
     2104  }
     2105
     2106  return ( uiSum );
     2107}
     2108
     2109UInt TComRdCost::xGetVSD4( DistParam* pcDtParam )
     2110{
     2111  Pel* piOrg   = pcDtParam->pOrg;
     2112  Pel* piCur   = pcDtParam->pCur;
     2113  Pel* piVirRec = pcDtParam->pVirRec;
     2114  Pel* piVirOrg = pcDtParam->pVirOrg;
     2115  Int  iRows   = pcDtParam->iRows;
     2116  Int  iStrideOrg = pcDtParam->iStrideOrg;
     2117  Int  iStrideCur = pcDtParam->iStrideCur;
     2118  Int  iStrideVir = pcDtParam->iStrideVir;
     2119
     2120  UInt uiSum = 0;
     2121  UInt uiShift = g_uiBitIncrement<<1;
     2122
     2123  Int dDM;
     2124
     2125  for ( Int y = 0 ; y < iRows ; y++ )
     2126  {
     2127    dDM = (Int) ( piOrg[0] - piCur[0] );  uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 0, y ) ) >> uiShift;
     2128    dDM = (Int) ( piOrg[1] - piCur[1] );  uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 1, y ) ) >> uiShift;
     2129    dDM = (Int) ( piOrg[2] - piCur[2] );  uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 2, y ) ) >> uiShift;
     2130    dDM = (Int) ( piOrg[3] - piCur[3] );  uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 3, y ) ) >> uiShift;
     2131
     2132    piOrg += iStrideOrg;
     2133    piCur += iStrideCur;
     2134  }
     2135
     2136  return ( uiSum );
     2137}
     2138
     2139UInt TComRdCost::xGetVSD8( DistParam* pcDtParam )
     2140{
     2141  Pel* piOrg   = pcDtParam->pOrg;
     2142  Pel* piCur   = pcDtParam->pCur;
     2143  Pel* piVirRec = pcDtParam->pVirRec;
     2144  Pel* piVirOrg = pcDtParam->pVirOrg;
     2145  Int  iRows   = pcDtParam->iRows;
     2146  Int  iStrideOrg = pcDtParam->iStrideOrg;
     2147  Int  iStrideCur = pcDtParam->iStrideCur;
     2148  Int  iStrideVir = pcDtParam->iStrideVir;
     2149
     2150  UInt uiSum = 0;
     2151  UInt uiShift = g_uiBitIncrement<<1;
     2152
     2153  Int dDM;
     2154
     2155  for ( Int y = 0 ; y < iRows ; y++ )
     2156  {
     2157    for (Int x = 0; x < 8; x++ )
     2158    {
     2159      dDM = (Int) ( piOrg[x] - piCur[x] );
     2160      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     2161    }
     2162    piOrg += iStrideOrg;
     2163    piCur += iStrideCur;
     2164  }
     2165
     2166  return ( uiSum );
     2167}
     2168
     2169UInt TComRdCost::xGetVSD16( DistParam* pcDtParam )
     2170{
     2171  Pel* piOrg   = pcDtParam->pOrg;
     2172  Pel* piCur   = pcDtParam->pCur;
     2173  Pel* piVirRec = pcDtParam->pVirRec;
     2174  Pel* piVirOrg = pcDtParam->pVirOrg;
     2175  Int  iRows   = pcDtParam->iRows;
     2176  Int  iStrideOrg = pcDtParam->iStrideOrg;
     2177  Int  iStrideCur = pcDtParam->iStrideCur;
     2178  Int  iStrideVir = pcDtParam->iStrideVir;
     2179
     2180  UInt uiSum = 0;
     2181  UInt uiShift = g_uiBitIncrement<<1;
     2182
     2183  Int dDM;
     2184
     2185  for ( Int y = 0 ; y < iRows ; y++ )
     2186  {
     2187    for (Int x = 0; x < 16; x++ )
     2188    {
     2189      dDM = (Int) ( piOrg[x] - piCur[x] );
     2190      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     2191    }
     2192    piOrg += iStrideOrg;
     2193    piCur += iStrideCur;
     2194  }
     2195
     2196  return ( uiSum );
     2197}
     2198
     2199UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam )
     2200{
     2201  Pel* piOrg   = pcDtParam->pOrg;
     2202  Pel* piCur   = pcDtParam->pCur;
     2203  Pel* piVirRec = pcDtParam->pVirRec;
     2204  Pel* piVirOrg = pcDtParam->pVirOrg;
     2205  Int  iRows   = pcDtParam->iRows;
     2206  Int  iCols   = pcDtParam->iCols;
     2207  Int  iStrideOrg = pcDtParam->iStrideOrg;
     2208  Int  iStrideCur = pcDtParam->iStrideCur;
     2209  Int  iStrideVir = pcDtParam->iStrideVir;
     2210
     2211  UInt uiSum = 0;
     2212  UInt uiShift = g_uiBitIncrement<<1;
     2213
     2214  Int dDM;
     2215
     2216  for ( Int y = 0 ; y < iRows ; y++ )
     2217  {
     2218    for (Int x = 0; x < iCols; x+=16 )
     2219    {
     2220      for ( Int k = 0 ; k < 16 ; k++ )
     2221      {
     2222        dDM = (Int) ( piOrg[x+k] - piCur[x+k] );
     2223        uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x+k, y ) >> uiShift;
     2224      }
     2225    }
     2226    piOrg += iStrideOrg;
     2227    piCur += iStrideCur;
     2228  }
     2229
     2230  return ( uiSum );
     2231}
     2232
     2233UInt TComRdCost::xGetVSD32( DistParam* pcDtParam )
     2234{
     2235  Pel* piOrg   = pcDtParam->pOrg;
     2236  Pel* piCur   = pcDtParam->pCur;
     2237  Pel* piVirRec = pcDtParam->pVirRec;
     2238  Pel* piVirOrg = pcDtParam->pVirOrg;
     2239  Int  iRows   = pcDtParam->iRows;
     2240  Int  iStrideOrg = pcDtParam->iStrideOrg;
     2241  Int  iStrideCur = pcDtParam->iStrideCur;
     2242  Int  iStrideVir = pcDtParam->iStrideVir;
     2243
     2244  UInt uiSum = 0;
     2245  UInt uiShift = g_uiBitIncrement<<1;
     2246
     2247  Int dDM;
     2248
     2249  for ( Int y = 0 ; y < iRows ; y++ )
     2250  {
     2251    for (Int x = 0; x < 32 ; x++ )
     2252    {
     2253      dDM = (Int) ( piOrg[x] - piCur[x] );
     2254      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     2255    }
     2256    piOrg += iStrideOrg;
     2257    piCur += iStrideCur;
     2258  }
     2259
     2260  return ( uiSum );
     2261}
     2262
     2263UInt TComRdCost::xGetVSD64( DistParam* pcDtParam )
     2264{
     2265  Pel* piOrg      = pcDtParam->pOrg;
     2266  Pel* piCur      = pcDtParam->pCur;
     2267  Pel* piVirRec   = pcDtParam->pVirRec;
     2268  Pel* piVirOrg   = pcDtParam->pVirOrg;
     2269  Int  iRows      = pcDtParam->iRows;
     2270  Int  iStrideOrg = pcDtParam->iStrideOrg;
     2271  Int  iStrideCur = pcDtParam->iStrideCur;
     2272  Int  iStrideVir = pcDtParam->iStrideVir;
     2273
     2274  UInt uiSum = 0;
     2275  UInt uiShift = g_uiBitIncrement<<1;
     2276
     2277  Int dDM;
     2278
     2279  for ( Int y = 0 ; y < iRows ; y++ )
     2280  {
     2281    for (Int x = 0; x < 64; x++ )
     2282    {
     2283      dDM = (Int) ( piOrg[x] - piCur[x] );
     2284      uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     2285    }
     2286    piOrg += iStrideOrg;
     2287    piCur += iStrideCur;
     2288  }
     2289
     2290  return ( uiSum );
     2291}
     2292
     2293#endif
     2294
    20282295// --------------------------------------------------------------------------------------------------------------------
    20292296// HADAMARD with step (used in fractional search)
     
    26682935{
    26692936  AOT(bSAD);
     2937#ifdef LGE_VSO_EARLY_SKIP_A0093
     2938  RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur, piOrg, iOrgStride); 
     2939#else
    26702940  RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur ); 
     2941#endif
    26712942
    26722943  RMDist iDistMin = (RMDist) RDO_DIST_MIN;
  • trunk/source/Lib/TLibCommon/TComRdCost.h

    r81 r100  
    8080  Int   iStrideOrg;
    8181  Int   iStrideCur;
     82#if SAIT_VSO_EST_A0033
     83  Pel*  pVirRec;
     84  Pel*  pVirOrg;
     85  Int   iStrideVir;
     86#endif
    8287  Int   iRows;
    8388  Int   iCols;
     
    105110    pOrg = NULL;
    106111    pCur = NULL;
     112#if SAIT_VSO_EST_A0033
     113    pVirRec = NULL;
     114    pVirOrg = NULL;;
     115    iStrideVir = 0;
     116#endif
    107117    iStrideOrg = 0;
    108118    iStrideCur = 0;
     
    145155  UInt                    m_uiLambdaMotionSSE;
    146156  Double                  m_dFrameLambda;
     157#if SAIT_VSO_EST_A0033
     158  static Double           m_dDisparityCoeff;
     159#endif
    147160 
    148161#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
     
    192205  Void    setFrameLambda ( Double dLambda ) { m_dFrameLambda = dLambda; }
    193206 
     207#if SAIT_VSO_EST_A0033
     208  Void    setDisparityCoeff( Double dDisparityCoeff ) { m_dDisparityCoeff = dDisparityCoeff; }
     209  Double  getDisparityCoeff()                         { return m_dDisparityCoeff; }
     210#endif
     211
    194212#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
    195213  Void   setLambdaScale  ( Double dLambdaScale) { m_dLambdaScale = dLambdaScale; }
     
    222240{
    223241     m_uiCost = (bSad ? m_uiLambdaMotionSAD + iAdd : m_uiLambdaMotionSSE + iAdd);
    224 #if HHI_FIX
    225242    m_uiLambdaMVReg = ( bSad ? m_uiLambdaMVRegSAD         : m_uiLambdaMVRegSSE         );
    226 #endif
     243
    227244   }
    228245  Void    setPredictor( TComMv& rcMv )
     
    301318  static UInt xGetSAD16N        ( DistParam* pcDtParam );
    302319 
     320#if SAIT_VSO_EST_A0033
     321  static UInt xGetVSD           ( DistParam* pcDtParam );
     322  static UInt xGetVSD4          ( DistParam* pcDtParam );
     323  static UInt xGetVSD8          ( DistParam* pcDtParam );
     324  static UInt xGetVSD16         ( DistParam* pcDtParam );
     325  static UInt xGetVSD32         ( DistParam* pcDtParam );
     326  static UInt xGetVSD64         ( DistParam* pcDtParam );
     327  static UInt xGetVSD16N        ( DistParam* pcDtParam );
     328#endif
     329
    303330#if AMP_SAD
    304331  static UInt xGetSAD12         ( DistParam* pcDtParam );
     
    329356#endif
    330357 
     358#if SAIT_VSO_EST_A0033
     359  UInt   getDistPart( Pel* piCur, Int iCurStride,  Pel* piOrg, Int iOrgStride, Pel* piVirRec, Pel* piVirOrg, Int iVirStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc = DF_VSD );
     360  static UInt getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride,  Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y );
     361#endif
     362
    331363#if HHI_VSO
    332364private:
     
    340372  Bool                    m_bAllowNegDist;
    341373#endif
     374#if SAIT_VSO_EST_A0033
     375  TComPicYuv *            m_pcVideoRecPicYuv;
     376  TComPicYuv *            m_pcDepthPicYuv;
     377  Bool                    m_bUseEstimatedVSD;
     378#endif
    342379
    343380  Bool                    m_bUseVSO;
     
    357394  Void    setUseVSO ( Bool bIn )         { m_bUseVSO = bIn; };
    358395  Bool    getUseVSO ( )                  { return m_bUseVSO;};
     396#if SAIT_VSO_EST_A0033
     397  Bool    getUseEstimatedVSD( )           { return m_bUseEstimatedVSD; };
     398  Void    setUseEstimatedVSD( Bool bIn )  { m_bUseEstimatedVSD = bIn; };
     399
     400  TComPicYuv* getVideoRecPicYuv ()                               { return m_pcVideoRecPicYuv; };
     401  Void        setVideoRecPicYuv ( TComPicYuv* pcVideoRecPicYuv ) { m_pcVideoRecPicYuv = pcVideoRecPicYuv; };
     402  TComPicYuv* getDepthPicYuv    ()                               { return m_pcDepthPicYuv; };
     403  Void        setDepthPicYuv    ( TComPicYuv* pcDepthPicYuv )    { m_pcDepthPicYuv = pcDepthPicYuv; };
     404#endif
    359405
    360406  Bool    getUseRenModel ( )             { return (m_bUseVSO && m_uiVSOMode == 4); };
  • trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r77 r100  
    219219}
    220220
    221 
     221#if QC_MULTI_DIS_CAN
     222Bool
     223TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp
     224#if QC_SIMPLIFIEDIVRP_M24938
     225  , Bool bRecon
     226#endif
     227 )
     228#else
    222229Bool
    223230TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv
     
    226233#endif
    227234  )
     235#endif
    228236{
    229237  AOF(  pcCU );
     
    235243  iBlkHeight  = pcCU->getHeight ( 0 );
    236244  pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos );
     245#if QC_MULTI_DIS_CAN
     246  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp
     247#if QC_SIMPLIFIEDIVRP_M24938
     248    , bRecon
     249#endif
     250  );
     251#else
    237252  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv
    238253#if QC_SIMPLIFIEDIVRP_M24938
     
    240255#endif
    241256    );
     257#endif
    242258}
    243259 
     260#if QC_MULTI_DIS_CAN
     261Bool
     262TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
     263#if QC_SIMPLIFIEDIVRP_M24938
     264  , Bool bRecon
     265#endif
     266)
     267#else
    244268Bool
    245269TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
     
    248272#endif
    249273  )
     274#endif
    250275{
    251276  UInt  uiBaseViewId  = m_pcDepthMapGenerator->getBaseViewId( 0 );
     
    258283  UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
    259284#endif
     285#if QC_MULTI_DIS_CAN
     286  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp
     287#if QC_SIMPLIFIEDIVRP_M24938
     288    , &uiXPosInRefView , &uiYPosInRefView , bRecon
     289#endif 
     290  );
     291#else
    260292  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv
    261293#if QC_SIMPLIFIEDIVRP_M24938
     
    263295#endif
    264296    );
    265 
     297#endif
    266298#if QC_SIMPLIFIEDIVRP_M24938
    267299  return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight );
     
    423455    AOF( bOK );
    424456#if LG_RESTRICTEDRESPRED_M24766
    425         pcCU->getPUResiPredShift(iPUPredResiShift, 0);
    426         pcCUResidual->add(iPUPredResiShift, pcCU->getPartitionSize(0), m_ppcYuvTmp[0], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
     457    pcCU->getPUResiPredShift(iPUPredResiShift, 0);
     458    pcCUResidual->add(iPUPredResiShift, pcCU->getPartitionSize(0), m_ppcYuvTmp[0], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
    427459#else
    428460    pcCUResidual->add( m_ppcYuvTmp[0], pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
     
    485517
    486518
    487 
     519#if QC_MULTI_DIS_CAN
     520Void 
     521TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
     522#if QC_SIMPLIFIEDIVRP_M24938
     523  , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
     524#endif
     525)
     526#else
    488527Void 
    489528TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
     
    492531#endif
    493532  )
     533#endif
    494534{
    495535  //===== set and check some basic variables =====
     
    508548
    509549  //===== get disparity =====
     550#if QC_MULTI_DIS_CAN
     551  Int iDisparity = iDisp;
     552#else
    510553  Int           iMidPosX    = Int( uiXPos + ( ( uiBlkWidth  - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX();
    511554  Int           iMidPosY    = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpY();
    512555  Int           iDisparity  = m_pcDepthMapGenerator->getDisparity( pcPic, iMidPosX, iMidPosY, uiBaseViewId );
    513 
     556#endif
    514557  //===== compensate luma =====
    515558  Int           iYWidth     = Int( uiBlkWidth  );
  • trunk/source/Lib/TLibCommon/TComResidualGenerator.h

    r77 r100  
    6969  Void  setRecResidualPic     ( TComPic*      pcPic );
    7070
     71#if QC_MULTI_DIS_CAN
     72  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv, Int iDisp
     73#if QC_SIMPLIFIEDIVRP_M24938
     74    , Bool bRecon
     75#endif
     76);
     77  Bool  getResidualSamples    ( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv , Int iDisp
     78#if QC_SIMPLIFIEDIVRP_M24938
     79    , Bool bRecon
     80#endif 
     81  );
     82#else
    7183  Bool  getResidualSamples    ( TComDataCU*   pcCU,  UInt uiPUIdx, TComYuv* pcYuv
    7284#if QC_SIMPLIFIEDIVRP_M24938
     
    7991#endif
    8092    );
     93#endif
    8194
    8295private:
     
    87100  Void  xClearIntViewResidual ( TComDataCU*   pcCU,  TComYuv* pcCUResidual, UInt uiPartIdx    );
    88101  Void  xClearResidual        (                      TComYuv* pcCUResidual, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight );
    89 
     102#if QC_MULTI_DIS_CAN
     103  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
     104#if QC_SIMPLIFIEDIVRP_M24938
     105    , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
     106#endif
     107  );
     108#else
    90109  Void  xSetPredResidualBlock ( TComPic*      pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
    91110#if QC_SIMPLIFIEDIVRP_M24938
     
    93112#endif
    94113    );
     114#endif
    95115  Bool  xIsNonZero            ( TComYuv*      pcYuv, UInt uiBlkWidth, UInt uiBlkHeight );
    96116#if QC_SIMPLIFIEDIVRP_M24938
  • trunk/source/Lib/TLibCommon/TComRom.h

    r56 r100  
    206206#endif
    207207
     208#if LGE_EDGE_INTRA
     209__inline Void mapEdgeIntratoDC( UChar& curDir ) { curDir = (curDir >= EDGE_INTRA_IDX) ? DC_IDX : curDir; }
     210__inline Void mapEdgeIntratoDC(  UInt& curDir ) { curDir = (curDir >= EDGE_INTRA_IDX) ? DC_IDX : curDir; }
     211__inline Void mapEdgeIntratoDC(   Int& curDir ) { curDir = (curDir >= EDGE_INTRA_IDX) ? DC_IDX : curDir; }
     212#endif
     213
    208214// ==========================================
    209215// Mode-Dependent DST Matrices
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r77 r100  
    13351335TComVPS::~TComVPS()
    13361336{
    1337        
    1338        
     1337 
     1338 
    13391339}
    13401340
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r77 r100  
    151151private:
    152152  Int         m_VPSId;
    153         UInt                            m_uiMaxTLayers;
    154         UInt                            m_uiMaxLayers;
    155         Bool                            m_bTemporalIdNestingFlag;
    156 
    157         UInt        m_uiExtensionType;
     153  UInt        m_uiMaxTLayers;
     154  UInt        m_uiMaxLayers;
     155  Bool        m_bTemporalIdNestingFlag;
     156
     157  UInt        m_uiExtensionType;
    158158 
    159159  Bool        m_bDependentFlag[MAX_LAYER_NUM];
     
    170170  TComVPS();
    171171  virtual ~TComVPS();
    172        
     172 
    173173  Int     getVPSId       ()                   { return m_VPSId;          }
    174174  Void    setVPSId       (Int i)              { m_VPSId = i;             }
    175        
     175 
    176176  UInt    getMaxTLayers  ()                   { return m_uiMaxTLayers;   }
    177177  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
    178178   
    179179  UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
    180         Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
    181        
     180  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
     181 
    182182  Bool    getTemporalNestingFlag   ()         { return m_uiMaxLayers;   }
    183         Void    setTemporalNestingFlag   (UInt t)   { m_bTemporalIdNestingFlag = t; }
     183  Void    setTemporalNestingFlag   (UInt t)   { m_bTemporalIdNestingFlag = t; }
    184184 
    185185  Void    setExtensionType(UInt v)                     { m_uiExtensionType = v;    }
     
    219219private:
    220220#if VIDYO_VPS_INTEGRATION
    221         Int                                     m_VPSId;
     221  Int          m_VPSId;
    222222#endif
    223223  Int         m_SPSId;
     
    379379  virtual ~TComSPS();
    380380#if VIDYO_VPS_INTEGRATION
    381         Int  getVPSId       ()         { return m_VPSId;          }
     381  Int  getVPSId       ()         { return m_VPSId;          }
    382382  Void setVPSId       (Int i)    { m_VPSId = i;             }
    383383#endif
  • trunk/source/Lib/TLibCommon/TComYuv.cpp

    r77 r100  
    396396TComYuv::add(Int *iPUResiPredShift, PartSize uhPartitionSize,  TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract )
    397397{
    398         addLuma   (iPUResiPredShift, uhPartitionSize, pcYuvAdd, iWidth,    iHeight,    bSubtract );
    399         addChroma (iPUResiPredShift, uhPartitionSize, pcYuvAdd, iWidth>>1, iHeight>>1, bSubtract );
     398  addLuma   (iPUResiPredShift, uhPartitionSize, pcYuvAdd, iWidth,    iHeight,    bSubtract );
     399  addChroma (iPUResiPredShift, uhPartitionSize, pcYuvAdd, iWidth>>1, iHeight>>1, bSubtract );
    400400}
    401401#else
     
    412412TComYuv::getPUXYOffset(PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset)
    413413{
    414         switch(uhPartitionSize)
    415         {        
    416         case SIZE_2NxN:
    417                 iXOffset = iWidth;      iYOffset = iHeight >> 1;   break;
    418         case SIZE_2NxnU:
    419                 iXOffset = iWidth;      iYOffset = iHeight >> 2;   break;
    420         case SIZE_2NxnD:
    421                 iXOffset = iWidth;      iYOffset = (iHeight >> 1) + (iHeight >> 2);   break;
    422         case SIZE_Nx2N:
    423                 iXOffset = iWidth >> 1; iYOffset = iHeight; break;
    424         case SIZE_nLx2N:
    425                 iXOffset = iWidth >> 2; iYOffset = iHeight; break;
    426         case SIZE_nRx2N:
    427                 iXOffset = (iWidth >> 1) + (iWidth >> 2); iYOffset = iHeight; break;
    428         case SIZE_NxN:
    429                 iXOffset = iWidth >> 1; iYOffset = iHeight >> 1;  break;
    430         default:
    431                 assert(uhPartitionSize == SIZE_2Nx2N);
    432                 iXOffset = iWidth;        iYOffset = iHeight;     break;
    433         }
     414  switch(uhPartitionSize)
     415  {   
     416  case SIZE_2NxN:
     417    iXOffset = iWidth;      iYOffset = iHeight >> 1;   break;
     418  case SIZE_2NxnU:
     419    iXOffset = iWidth;      iYOffset = iHeight >> 2;   break;
     420  case SIZE_2NxnD:
     421    iXOffset = iWidth;      iYOffset = (iHeight >> 1) + (iHeight >> 2);   break;
     422  case SIZE_Nx2N:
     423    iXOffset = iWidth >> 1; iYOffset = iHeight; break;
     424  case SIZE_nLx2N:
     425    iXOffset = iWidth >> 2; iYOffset = iHeight; break;
     426  case SIZE_nRx2N:
     427    iXOffset = (iWidth >> 1) + (iWidth >> 2); iYOffset = iHeight; break;
     428  case SIZE_NxN:
     429    iXOffset = iWidth >> 1; iYOffset = iHeight >> 1;  break;
     430  default:
     431    assert(uhPartitionSize == SIZE_2Nx2N);
     432    iXOffset = iWidth;     iYOffset = iHeight;    break;
     433  }
    434434}
    435435#endif
     
    456456  for( Int iY = 0; iY < iYOffset; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride )
    457457  {
    458           if(iPUResiPredShift[0] >= 0)
    459           {
    460                   for( Int iX = 0; iX < iXOffset; iX++ )
    461                   {
    462                           pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[0]);
    463                   }
    464           }
    465 
    466           if(iPUResiPredShift[1] >= 0)
    467           {
    468                   for( Int iX = iXOffset; iX < iWidth; iX++ )
    469                   {
    470                           pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[1]);
    471                   }
    472           }
     458    if(iPUResiPredShift[0] >= 0)
     459    {
     460      for( Int iX = 0; iX < iXOffset; iX++ )
     461      {
     462        pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[0]);
     463      }
     464    }
     465
     466    if(iPUResiPredShift[1] >= 0)
     467    {
     468      for( Int iX = iXOffset; iX < iWidth; iX++ )
     469      {
     470        pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[1]);
     471      }
     472    }
    473473  }
    474474
    475475  for( Int iY = iYOffset; iY < iHeight; iY++, pDstSamples += iDstStride, pAddSamples += iAddStride )
    476476  {
    477           if(iPUResiPredShift[2] >= 0)
    478           {
    479                   for( Int iX = 0; iX < iXOffset; iX++ )
    480                   {
    481                           pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[2]);
    482                   }
    483           }
    484 
    485           if(iPUResiPredShift[3] >= 0)
    486           {
    487                   for( Int iX = iXOffset; iX < iWidth; iX++ )
    488                   {
    489                           pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[3]);
    490                   }
    491           }
     477    if(iPUResiPredShift[2] >= 0)
     478    {
     479      for( Int iX = 0; iX < iXOffset; iX++ )
     480      {
     481        pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[2]);
     482      }
     483    }
     484
     485    if(iPUResiPredShift[3] >= 0)
     486    {
     487      for( Int iX = iXOffset; iX < iWidth; iX++ )
     488      {
     489        pDstSamples[iX] += iScale * (pAddSamples[iX] >> iPUResiPredShift[3]);
     490      }
     491    }
    492492  }
    493493#else
     
    524524
    525525  for( Int iY = 0; iY < iYOffset; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride,
    526           pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride  )
    527   {
    528           if(iPUResiPredShift[0] >= 0)
    529           {
    530                   for( Int iX = 0; iX < iXOffset; iX++ )
    531                   {
    532                           pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[0]);
    533                           pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[0]);
    534                   }
    535           }
    536 
    537           if(iPUResiPredShift[1] >= 0)
    538           {
    539                   for( Int iX = iXOffset; iX < iWidth; iX++ )
    540                   {
    541                           pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[1]);
    542                           pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[1]);
    543                   }
    544           }
     526    pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride  )
     527  {
     528    if(iPUResiPredShift[0] >= 0)
     529    {
     530      for( Int iX = 0; iX < iXOffset; iX++ )
     531      {
     532        pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[0]);
     533        pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[0]);
     534      }
     535    }
     536
     537    if(iPUResiPredShift[1] >= 0)
     538    {
     539      for( Int iX = iXOffset; iX < iWidth; iX++ )
     540      {
     541        pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[1]);
     542        pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[1]);
     543      }
     544    }
    545545  }
    546546
    547547  for( Int iY = iYOffset; iY < iHeight; iY++, pDstSamplesCb += iDstStride, pAddSamplesCb += iAddStride,
    548           pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride  )
    549   {
    550           if(iPUResiPredShift[2] >= 0)
    551           {
    552                   for( Int iX = 0; iX < iXOffset; iX++ )
    553                   {
    554                           pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[2]);
    555                           pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[2]);
    556                   }
    557           }
    558 
    559           if(iPUResiPredShift[3] >= 0)
    560           {
    561                   for( Int iX = iXOffset; iX < iWidth; iX++ )
    562                   {
    563                           pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[3]);
    564                           pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[3]);
    565                   }
    566           }
     548    pDstSamplesCr += iDstStride, pAddSamplesCr += iAddStride  )
     549  {
     550    if(iPUResiPredShift[2] >= 0)
     551    {
     552      for( Int iX = 0; iX < iXOffset; iX++ )
     553      {
     554        pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[2]);
     555        pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[2]);
     556      }
     557    }
     558
     559    if(iPUResiPredShift[3] >= 0)
     560    {
     561      for( Int iX = iXOffset; iX < iWidth; iX++ )
     562      {
     563        pDstSamplesCb[iX] += iScale * (pAddSamplesCb[iX] >> iPUResiPredShift[3]);
     564        pDstSamplesCr[iX] += iScale * (pAddSamplesCr[iX] >> iPUResiPredShift[3]);
     565      }
     566    }
    567567  }
    568568#else
     
    679679Void TComYuv::subtract(Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize )
    680680{
    681         subtractLuma  (iPUResiPredShift, uhPartitionSize, pcYuvSrc0, pcYuvSrc1,  uiTrUnitIdx, uiPartSize    );
    682         subtractChroma(iPUResiPredShift, uhPartitionSize, pcYuvSrc0, pcYuvSrc1,  uiTrUnitIdx, uiPartSize>>1 );
     681  subtractLuma  (iPUResiPredShift, uhPartitionSize, pcYuvSrc0, pcYuvSrc1,  uiTrUnitIdx, uiPartSize    );
     682  subtractChroma(iPUResiPredShift, uhPartitionSize, pcYuvSrc0, pcYuvSrc1,  uiTrUnitIdx, uiPartSize>>1 );
    683683}
    684684#else
     
    713713  for ( y = uiPartSize-1; y >= iYOffset; y-- )
    714714  {
    715           if(iPUResiPredShift[3] >= 0)
    716           {
    717                   for ( x = uiPartSize-1; x >= iXOffset; x-- )
    718                   {
    719                           pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
    720                   }
    721           }
    722 
    723           if(iPUResiPredShift[2] >= 0)
    724           {
    725                   for ( x = iXOffset-1; x >= 0; x-- )
    726                   {
    727                           pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
    728                   }
    729           }
    730           pSrc0 += iSrc0Stride;
    731           pSrc1 += iSrc1Stride;
    732           pDst  += iDstStride;
     715    if(iPUResiPredShift[3] >= 0)
     716    {
     717      for ( x = uiPartSize-1; x >= iXOffset; x-- )
     718      {
     719        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
     720      }
     721    }
     722
     723    if(iPUResiPredShift[2] >= 0)
     724    {
     725      for ( x = iXOffset-1; x >= 0; x-- )
     726      {
     727        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
     728      }
     729    }
     730    pSrc0 += iSrc0Stride;
     731    pSrc1 += iSrc1Stride;
     732    pDst  += iDstStride;
    733733  }
    734734
    735735  for ( y = iYOffset-1; y >= 0; y-- )
    736736  {
    737           if(iPUResiPredShift[1] >= 0)
    738           {
    739                   for ( x = uiPartSize-1; x >= iXOffset; x-- )
    740                   {
    741                           pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
    742                   }
    743           }
    744 
    745           if(iPUResiPredShift[0] >= 0)
    746           {
    747                   for ( x = iXOffset-1; x >= 0; x-- )
    748                   {
    749                           pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
    750                   }
    751           }
    752           pSrc0 += iSrc0Stride;
    753           pSrc1 += iSrc1Stride;
    754           pDst  += iDstStride;
     737    if(iPUResiPredShift[1] >= 0)
     738    {
     739      for ( x = uiPartSize-1; x >= iXOffset; x-- )
     740      {
     741        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[3]);
     742      }
     743    }
     744
     745    if(iPUResiPredShift[0] >= 0)
     746    {
     747      for ( x = iXOffset-1; x >= 0; x-- )
     748      {
     749        pDst[x] = pSrc0[x] - (pSrc1[x] >> iPUResiPredShift[2]);
     750      }
     751    }
     752    pSrc0 += iSrc0Stride;
     753    pSrc1 += iSrc1Stride;
     754    pDst  += iDstStride;
    755755  }
    756756
     
    794794  for ( y = uiPartSize-1; y >= iYOffset; y-- )
    795795  {
    796           if(iPUResiPredShift[3] >= 0)
    797           {
    798                   for ( x = uiPartSize-1; x >= iXOffset; x-- )
    799                   {
    800                           pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
    801                           pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
    802                   }
    803           }
    804 
    805           if(iPUResiPredShift[2] >= 0)
    806           {
    807                   for ( x = iXOffset-1; x >= 0; x-- )
    808                   {
    809                           pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
    810                           pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
    811                   }
    812           }
    813           pSrcU0 += iSrc0Stride;
    814           pSrcU1 += iSrc1Stride;
    815           pSrcV0 += iSrc0Stride;
    816           pSrcV1 += iSrc1Stride;
    817           pDstU  += iDstStride;
    818           pDstV  += iDstStride;
     796    if(iPUResiPredShift[3] >= 0)
     797    {
     798      for ( x = uiPartSize-1; x >= iXOffset; x-- )
     799      {
     800        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[3]);
     801        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[3]);
     802      }
     803    }
     804
     805    if(iPUResiPredShift[2] >= 0)
     806    {
     807      for ( x = iXOffset-1; x >= 0; x-- )
     808      {
     809        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[2]);
     810        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[2]);
     811      }
     812    }
     813    pSrcU0 += iSrc0Stride;
     814    pSrcU1 += iSrc1Stride;
     815    pSrcV0 += iSrc0Stride;
     816    pSrcV1 += iSrc1Stride;
     817    pDstU  += iDstStride;
     818    pDstV  += iDstStride;
    819819  }
    820820
    821821  for ( y = iYOffset-1; y >= 0; y-- )
    822822  {
    823           if(iPUResiPredShift[1] >= 0)
    824           {
    825                   for ( x = uiPartSize-1; x >= iXOffset; x-- )
    826                   {
    827                           pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
    828                           pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
    829                   }
    830           }
    831 
    832           if(iPUResiPredShift[0] >= 0)
    833           {
    834                   for ( x = iXOffset-1; x >= 0; x-- )
    835                   {
    836                           pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
    837                           pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
    838                   }
    839           }
    840           pSrcU0 += iSrc0Stride;
    841           pSrcU1 += iSrc1Stride;
    842           pSrcV0 += iSrc0Stride;
    843           pSrcV1 += iSrc1Stride;
    844           pDstU  += iDstStride;
    845           pDstV  += iDstStride;
     823    if(iPUResiPredShift[1] >= 0)
     824    {
     825      for ( x = uiPartSize-1; x >= iXOffset; x-- )
     826      {
     827        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[1]);
     828        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[1]);
     829      }
     830    }
     831
     832    if(iPUResiPredShift[0] >= 0)
     833    {
     834      for ( x = iXOffset-1; x >= 0; x-- )
     835      {
     836        pDstU[x] = pSrcU0[x] - (pSrcU1[x]>>iPUResiPredShift[0]);
     837        pDstV[x] = pSrcV0[x] - (pSrcV1[x]>>iPUResiPredShift[0]);
     838      }
     839    }
     840    pSrcU0 += iSrc0Stride;
     841    pSrcU1 += iSrc1Stride;
     842    pSrcV0 += iSrc0Stride;
     843    pSrcV1 += iSrc1Stride;
     844    pDstU  += iDstStride;
     845    pDstV  += iDstStride;
    846846  }
    847847#else
  • trunk/source/Lib/TLibCommon/TComYuv.h

    r77 r100  
    167167  Void    removeHighFreq    ( TComYuv* pcYuvSrc, UInt uiPartIdx, UInt uiWidht, UInt uiHeight );
    168168#if LG_RESTRICTEDRESPRED_M24766
    169   void    getPUXYOffset     (PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset);
     169  Void    getPUXYOffset     (PartSize uhPartitionSize, Int iWidth, Int iHeight, Int &iXOffset, Int &iYOffset);
    170170  Void    add               (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract = false );
    171171  Void    addLuma           (Int *iPUResiPredShift, PartSize uhPartitionSize, TComYuv* pcYuvAdd, Int iWidth, Int iHeight, Bool bSubtract );
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r77 r100  
    4242//! \{
    4343
     44#define FIXES                           1
     45#define LGE_EDGE_INTRA                  1       //JCT2-A0070
     46#if LGE_EDGE_INTRA
     47#define LGE_EDGE_INTRA_MIN_SIZE         4
     48#define LGE_EDGE_INTRA_MAX_SIZE        32
     49#define LGE_EDGE_INTRA_THRESHOLD       20
     50#define LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 8
     51#define LGE_EDGE_INTRA_DELTA_DC         1
     52#define LGE_EDGE_INTRA_PIXEL_DIFFERENCE 1
     53#endif
     54
     55#define LG_ZEROINTRADEPTHRESI_M26039      1  //JCT2-A0087
     56
    4457#define SONY_COLPIC_AVAILABILITY          1
    4558
    4659#define HHI_INTER_VIEW_MOTION_PRED        1   // inter-view motion parameter prediction
    4760#define HHI_INTER_VIEW_RESIDUAL_PRED      1   // inter-view residual prediction
    48 #define HHI_FIX                           1   // inter-view prediction and other fixes
     61#define QC_MULTI_DIS_CAN                  1         // JCT2-A0097
     62#if QC_MULTI_DIS_CAN
     63    #define DIS_CANS                      1
     64#endif
     65
     66#define MTK_INTERVIEW_MERGE_A0049         1 //  JCT2-A0049 second part
     67
     68#define LGE_DVMCP                         1 //  JCT2-A0126     
     69#if LGE_DVMCP
     70#define DVFROM_LEFTBELOW                  1
     71#define DVFROM_LEFT                       2
     72#define DVFROM_ABOVERIGHT                 3
     73#define DVFROM_ABOVE                      4
     74#define DVFROM_ABOVELEFT                  5
     75#define DVFROM_COL                        6
     76#endif
     77
    4978
    5079#define HHI_VSO                           1
    51 #define HHI_VSO_LS_TABLE                  1
     80#define HHI_VSO_LS_TABLE                  1 // m23714
    5281#define HHI_VSO_DIST_INT                  1
    5382#define HHI_VSO_SYNTH_DIST_OUT            0
    5483#define HHI_VSO_COLOR_PLANES              1
     84#define HHI_VSO_SPEEDUP_A033              1 // JCT2-A0033 modification 1 (changes classes directly related the renderer model
     85                                            // to are not covered by this define, since nearly the entire class has been changed)
     86#define HHI_VSO_RM_ASSERTIONS             0 // output VSO assertions
     87#define HHI_VSO_SET_OPTIM                 1 // remove unnecessary updates (works only with HHI_VSO_FIX 1 properly)
     88#define SAIT_VSO_EST_A0033                1 // JCT2-A0033 modification 3
     89#define LGE_VSO_EARLY_SKIP_A0093          1 // JCT2-A0093 modification 4
     90
    5591
    5692#define HHI_INTERVIEW_SKIP                1
    5793#define HHI_INTERVIEW_SKIP_LAMBDA_SCALE   1
    5894
    59 #define HHI_DMM_WEDGE_INTRA 1   // depth model modes independent on texture (explicit and intra-predicted Wedgelet prediction)
    60 #define HHI_DMM_PRED_TEX    1   // depth model modes dependent on texture (inter-component Wedgelet and Contour prediction )
     95#define HHI_DMM_WEDGE_INTRA               1   // depth model modes independent on texture (explicit and intra-predicted Wedgelet prediction)
     96#define HHI_DMM_PRED_TEX                  1   // depth model modes dependent on texture (inter-component Wedgelet and Contour prediction )
    6197
    6298#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     
    224260#define LOG2_SCAN_SET_SIZE                4
    225261
     262#if LGE_EDGE_INTRA
     263#if LGE_EDGE_INTRA_DELTA_DC
     264#define FAST_UDI_MAX_RDMODE_NUM               37          ///< maximum number of RD comparison in fast-UDI estimation loop
     265#else
     266#define FAST_UDI_MAX_RDMODE_NUM               36          ///< maximum number of RD comparison in fast-UDI estimation loop
     267#endif
     268#else
    226269#define FAST_UDI_MAX_RDMODE_NUM               35          ///< maximum number of RD comparison in fast-UDI estimation loop
     270#endif
    227271
    228272#define ZERO_MVD_EST                          0           ///< Zero Mvd Estimation in normal mode
     
    263307#define NUM_DMM_MODE 4
    264308#endif
     309
     310#if LGE_EDGE_INTRA
     311#if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
     312#define EDGE_INTRA_IDX  (NUM_INTRA_MODE+NUM_DMM_MODE)
     313#endif // HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
     314#if LGE_EDGE_INTRA_DELTA_DC
     315#define EDGE_INTRA_DELTA_IDX          (EDGE_INTRA_IDX+1)
     316#endif
     317#endif // LGE_EDGE_INTRA
    265318
    266319#define IBDI_DISTORTION                0           ///< enable/disable SSE modification when IBDI is used (JCTVC-D152)
     
    647700};
    648701
     702#if HHI_VSO_SPEEDUP_A033
     703
     704enum BlenMod
     705{
     706    BLEND_NONE  = -1,
     707    BLEND_AVRG  = 0,
     708    BLEND_LEFT  = 1,
     709    BLEND_RIGHT = 2,
     710    BLEND_GEN   =  3
     711};
     712#endif
     713
    649714/// supported prediction type
    650715enum PredMode
     
    712777  DF_HADS16N  = 28,     ///< 16NxM HAD with step
    713778
     779#if SAIT_VSO_EST_A0033
     780  DF_VSD      = 29,      ///< general size VSD
     781  DF_VSD4     = 30,      ///<   4xM VSD
     782  DF_VSD8     = 31,      ///<   8xM VSD
     783  DF_VSD16    = 32,      ///<  16xM VSD
     784  DF_VSD32    = 33,      ///<  32xM VSD
     785  DF_VSD64    = 34,      ///<  64xM VSD
     786  DF_VSD16N   = 35,      ///< 16NxM VSD
     787#endif
     788
     789
    714790#if AMP_SAD
    715791  DF_SAD12    = 43,
Note: See TracChangeset for help on using the changeset viewer.