Changeset 571 in 3DVCSoftware for branches/HTM-DEV-2.0-dev2-LG


Ignore:
Timestamp:
14 Aug 2013, 10:39:58 (11 years ago)
Author:
lg
Message:
  • integration of JCT3V-E0156
Location:
branches/HTM-DEV-2.0-dev2-LG
Files:
8 added
33 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-2.0-dev2-LG/cfg/3D-HEVC/baseCfg_2view+depth.cfg

    r539 r571  
    209209QTL                                : 1
    210210PC                                 : 1
     211InterSDC                           : 1                             # use of inter sdc
    211212
    212213#========== view synthesis optimization (VSO) ==========
  • branches/HTM-DEV-2.0-dev2-LG/cfg/3D-HEVC/baseCfg_3view+depth.cfg

    r539 r571  
    241241QTL                                : 1
    242242PC                                 : 1
     243InterSDC                           : 1                             # use of inter sdc
    243244
    244245#========== view synthesis optimization (VSO) ==========
  • branches/HTM-DEV-2.0-dev2-LG/cfg/3D-HEVC/fullCfg.cfg

    r539 r571  
    245245QTL                                : 1
    246246PC                                 : 1
     247InterSDC                           : 1                             # use of inter sdc
    247248
    248249#========== view synthesis optimization (VSO) ==========
  • branches/HTM-DEV-2.0-dev2-LG/source/App/TAppEncoder/TAppEncCfg.cpp

    r542 r571  
    505505#if H_3D_IC
    506506  ("IlluCompEnable",           m_abUseIC, std::vector<Bool>(2, true), "Enable illumination compensation")
     507#endif
     508#if LGE_INTER_SDC_E0156
     509  ("InterSDC",                 m_bDepthInterSDCFlag,        true, "Enable depth inter SDC")
    507510#endif
    508511  // Coding tools
     
    22892292  printf("DLT:%d ", m_useDLT );
    22902293#endif
     2294#if LGE_INTER_SDC_E0156
     2295  printf( "interSDC: %d ", m_bDepthInterSDCFlag ? 1 : 0 );
     2296#endif
    22912297  printf("\n\n"); 
    22922298
  • branches/HTM-DEV-2.0-dev2-LG/source/App/TAppEncoder/TAppEncCfg.h

    r539 r571  
    432432  Bool      m_bUsePC;                                         ///< flag for using Predictive Coding with QTL
    433433#endif
     434#if LGE_INTER_SDC_E0156
     435  Bool m_bDepthInterSDCFlag;                                ///< flag for inter SDC of depth map coding
     436#endif
    434437#endif
    435438  // internal member functions
  • branches/HTM-DEV-2.0-dev2-LG/source/App/TAppEncoder/TAppEncTop.cpp

    r542 r571  
    187187    m_cTEncTop.setUseQTL                       ( isDepth ? m_bUseQTL               : false );
    188188    m_cTEncTop.setUsePC                        ( isDepth ? m_bUsePC                : false );
     189#endif
     190    //====== Depth Inter SDC =========
     191#if LGE_INTER_SDC_E0156
     192    m_cTEncTop.setInterSDCEnable               ( isDepth ? m_bDepthInterSDCFlag    : false );
    189193#endif
    190194#endif // H_3D
     
    12241228#if H_3D_VSP
    12251229    vps.setViewSynthesisPredFlag( layer, !isLayerZero && !isDepth && m_viewSynthesisPredFlag );         
    1226 #endif     
     1230#endif   
     1231#if LGE_INTER_SDC_E0156
     1232    vps.setInterSDCFlag( layer, !isLayerZero && isDepth && m_bDepthInterSDCFlag );
     1233#endif
    12271234  } 
    12281235#if H_3D_TMVP
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/ContextTables.h

    r531 r571  
    124124#define SDC_NUM_RESIDUAL_CTX             1
    125125#endif
     126
     127#if LGE_INTER_SDC_E0156
     128#define NUM_INTER_SDC_FLAG_CTX        1      ///< number of context models for inter SDC flag
     129#define NUM_INTER_SDC_SIGN_FLAG_CTX   1      ///< number of context models for sign of inter SDC residual
     130#define NUM_INTER_SDC_RESIDUAL_CTX    1      ///< number of context models for abs of inter SDC residual
     131#endif
    126132// ====================================================================================================================
    127133// Tables
     
    453459#endif
    454460
     461#if LGE_INTER_SDC_E0156
     462static const UChar
     463INIT_INTER_SDC_FLAG[3][NUM_INTER_SDC_FLAG_CTX] =
     464{
     465  { CNU }, 
     466  { 154 },
     467  { 154 },
     468};
     469
     470static const UChar
     471INIT_INTER_SDC_SIGN_FLAG[3][NUM_INTER_SDC_SIGN_FLAG_CTX] =
     472{
     473  { CNU }, 
     474  { 154 },
     475  { 154 },
     476};
     477
     478static const UChar
     479INIT_INTER_SDC_RESIDUAL[3][NUM_INTER_SDC_RESIDUAL_CTX] =
     480{
     481  { CNU }, 
     482  { 154 },
     483  { 154 },
     484};
     485#endif
    455486//! \}
    456487
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/TComDataCU.cpp

    r564 r571  
    151151  m_pbICFlag             = NULL;
    152152#endif
     153#if LGE_INTER_SDC_E0156
     154  m_pbInterSDCFlag       = NULL;
     155  for( Int i = 0; i < 4; i++ )
     156  {
     157    m_apSegmentInterDCOffset[i] = NULL;
     158  }
     159  m_pucInterSDCMask       = NULL;
     160#endif
    153161}
    154162
     
    280288#endif
    281289#endif
     290#if LGE_INTER_SDC_E0156
     291    m_pbInterSDCFlag     = (Bool*  )xMalloc(Bool,   uiNumPartition);
     292    for( Int i = 0; i < 4; i++ )
     293      m_apSegmentInterDCOffset[i] = (Int*)xMalloc(Int, uiNumPartition);
     294#endif
    282295  }
    283296  else
     
    286299    m_acCUMvField[1].setNumPartition(uiNumPartition );
    287300  }
    288  
     301#if LGE_INTER_SDC_E0156
     302  m_pucInterSDCMask     = (UChar*  )xMalloc(UChar,    g_uiMaxCUHeight*g_uiMaxCUWidth);
     303#endif
    289304  m_sliceStartCU        = (UInt*  )xMalloc(UInt, uiNumPartition);
    290305  m_sliceSegmentStartCU = (UInt*  )xMalloc(UInt, uiNumPartition);
     
    405420#endif
    406421#endif   
    407   }
    408  
     422#if LGE_INTER_SDC_E0156
     423    if ( m_pbInterSDCFlag     ) { xFree(m_pbInterSDCFlag);      m_pbInterSDCFlag    = NULL; }
     424    for(Int i = 0; i < 4; i++ )
     425    {
     426      if ( m_apSegmentInterDCOffset[i] ) { xFree( m_apSegmentInterDCOffset[i] ); m_apSegmentInterDCOffset[i] = NULL; }
     427    }
     428#endif
     429  }
     430#if LGE_INTER_SDC_E0156
     431  if ( m_pucInterSDCMask     ) { xFree(m_pucInterSDCMask);      m_pucInterSDCMask    = NULL; }
     432#endif
    409433  m_pcCUAboveLeft       = NULL;
    410434  m_pcCUAboveRight      = NULL;
     
    542566#if H_3D_DIM_SDC
    543567    m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui];
     568#endif
     569#if LGE_INTER_SDC_E0156
     570    m_pbInterSDCFlag[ui] = pcFrom->m_pbInterSDCFlag[ui];
    544571#endif
    545572  }
     
    611638    memset( m_apSegmentDCOffset[1]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[1] ) );
    612639#endif
     640#endif
     641#if LGE_INTER_SDC_E0156
     642    memset( m_pbInterSDCFlag   + firstElement,     0,                    numElements * sizeof( *m_pbInterSDCFlag ) );
     643    for( Int i = 0; i < 4; i++ )
     644    {
     645      memset( m_apSegmentInterDCOffset[i] + firstElement,     0,         numElements * sizeof( *m_apSegmentInterDCOffset[i] ) );
     646    }
    613647#endif
    614648  }
     
    776810#endif
    777811#endif
     812#if LGE_INTER_SDC_E0156
     813      m_pbInterSDCFlag[ui] = false;
     814      for( Int i = 0; i < 4; i++ )
     815      {
     816        m_apSegmentInterDCOffset[i][ui] = 0;
     817      }
     818#endif
    778819    }
    779820  }
     
    887928  memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition   );
    888929#endif
     930#endif
     931#if LGE_INTER_SDC_E0156
     932  memset( m_pbInterSDCFlag,           0, sizeof( Bool ) * m_uiNumPartition );
     933  for( Int i = 0; i < 4; i++ )
     934  {
     935    memset( m_apSegmentInterDCOffset[i], 0, sizeof( Int ) * m_uiNumPartition );
     936  }
    889937#endif
    890938
     
    9561004#endif
    9571005#endif
     1006#if LGE_INTER_SDC_E0156
     1007      m_pbInterSDCFlag      [ui] = pcCU->m_pbInterSDCFlag    [ uiPartOffset + ui ];
     1008      for( Int i = 0; i < 4; i++ )
     1009      {
     1010        m_apSegmentInterDCOffset[i][ui] = pcCU->m_apSegmentInterDCOffset[i][ uiPartOffset + ui ];
     1011      }
     1012#endif
    9581013    }
    9591014  }
     
    11111166#endif
    11121167#endif 
     1168#if LGE_INTER_SDC_E0156
     1169  m_pbInterSDCFlag          = pcCU->getInterSDCFlag()       + uiPart;
     1170  for( Int i = 0; i < 4; i++ )
     1171  {
     1172    m_apSegmentInterDCOffset[i] = pcCU->getInterSDCSegmentDCOffset( i ) + uiPart;
     1173  }
     1174#endif
    11131175  m_puhDepth=pcCU->getDepth()                     + uiPart;
    11141176  m_puhWidth=pcCU->getWidth()                     + uiPart;
     
    12981360#endif
    12991361#endif
     1362#if LGE_INTER_SDC_E0156
     1363  memcpy( m_pbInterSDCFlag  + uiOffset, pcCU->getInterSDCFlag(),      iSizeInBool  );
     1364  for( Int i = 0; i < 4; i++ )
     1365  {
     1366    memcpy( m_apSegmentInterDCOffset[i] + uiOffset, pcCU->getInterSDCSegmentDCOffset( i ), sizeof( Int ) * uiNumPartition);
     1367  }
     1368#endif
    13001369
    13011370  memcpy( m_puhDepth  + uiOffset, pcCU->getDepth(),  iSizeInUchar );
     
    14171486  memcpy( rpcCU->getSDCSegmentDCOffset(1) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition);
    14181487#endif
     1488#endif
     1489#if LGE_INTER_SDC_E0156
     1490  memcpy( rpcCU->getInterSDCFlag() + m_uiAbsIdxInLCU, m_pbInterSDCFlag,      iSizeInBool  );
     1491  for( Int i = 0;i < 4; i++ )
     1492  {
     1493    memcpy( rpcCU->getInterSDCSegmentDCOffset( i ) + m_uiAbsIdxInLCU, m_apSegmentInterDCOffset[i], sizeof( Int ) * m_uiNumPartition);
     1494  }
    14191495#endif
    14201496  memcpy( rpcCU->getDepth()  + m_uiAbsIdxInLCU, m_puhDepth,  iSizeInUchar );
     
    15251601#endif
    15261602#endif
     1603#if LGE_INTER_SDC_E0156
     1604  memcpy( rpcCU->getInterSDCFlag() + uiPartOffset, m_pbInterSDCFlag,      iSizeInBool  );
     1605  for( Int i = 0; i < 4; i++ )
     1606  {
     1607    memcpy( rpcCU->getInterSDCSegmentDCOffset( i ) + uiPartOffset, m_apSegmentInterDCOffset[i], sizeof( Int ) * uiQNumPart);
     1608  }
     1609#endif
    15271610  memcpy( rpcCU->getDepth()  + uiPartOffset, m_puhDepth,  iSizeInUchar );
    15281611  memcpy( rpcCU->getWidth()  + uiPartOffset, m_puhWidth,  iSizeInUchar );
     
    22382321}
    22392322#endif
     2323
     2324#if LGE_INTER_SDC_E0156
     2325Void TComDataCU::setInterSDCFlagSubParts ( Bool bInterSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2326{
     2327  setSubPart( bInterSDCFlag, m_pbInterSDCFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
     2328}
     2329
     2330UInt TComDataCU::getCtxInterSDCFlag( UInt uiAbsPartIdx )
     2331{
     2332  return 0;
     2333}
     2334
     2335Void TComDataCU::xSetInterSDCCUMask( TComDataCU *pcCU, UChar *pMask )
     2336{
     2337  UInt  uiWidth      = pcCU->getWidth ( 0 );
     2338  UInt  uiHeight     = pcCU->getHeight( 0 );
     2339  UInt  uiPartitionSize = pcCU->getPartitionSize( 0 );
     2340  UInt  uiXOffset = 0, uiYOffset = 0;
     2341
     2342  switch( uiPartitionSize )
     2343  {
     2344  case SIZE_2NxN:
     2345    uiXOffset = uiWidth;      uiYOffset = uiHeight >> 1;   break;
     2346  case SIZE_2NxnU:
     2347    uiXOffset = uiWidth;      uiYOffset = uiHeight >> 2;   break;
     2348  case SIZE_2NxnD:
     2349    uiXOffset = uiWidth;      uiYOffset = ( uiHeight >> 1 ) + ( uiHeight >> 2 );   break;
     2350  case SIZE_Nx2N:
     2351    uiXOffset = uiWidth >> 1; uiYOffset = uiHeight; break;
     2352  case SIZE_nLx2N:
     2353    uiXOffset = uiWidth >> 2; uiYOffset = uiHeight; break;
     2354  case SIZE_nRx2N:
     2355    uiXOffset = ( uiWidth >> 1 ) + ( uiWidth >> 2 ); uiYOffset = uiHeight; break;
     2356  case SIZE_NxN:
     2357    uiXOffset = uiWidth >> 1; uiYOffset = uiHeight >> 1;  break;
     2358  default:
     2359    assert( uiPartitionSize == SIZE_2Nx2N );
     2360    uiXOffset = uiWidth;     uiYOffset = uiHeight;    break;
     2361  }
     2362
     2363  UInt uiPelX, uiPelY;
     2364
     2365  memset( pMask, 0, uiWidth*uiHeight );
     2366
     2367  //mask
     2368  if( uiPartitionSize == SIZE_2NxN || uiPartitionSize == SIZE_2NxnD || uiPartitionSize == SIZE_2NxnU )
     2369  {
     2370    for( uiPelY = 0; uiPelY < uiYOffset; uiPelY++ )
     2371    {
     2372      for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
     2373      {
     2374        pMask[uiPelX + uiPelY*uiWidth] = 0;
     2375      }
     2376    }
     2377
     2378    for( ; uiPelY < uiHeight; uiPelY++ )
     2379    {
     2380      for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
     2381      {
     2382        pMask[uiPelX + uiPelY*uiWidth] = 1;
     2383      }
     2384    }
     2385  }
     2386  else if( uiPartitionSize == SIZE_Nx2N || uiPartitionSize == SIZE_nLx2N || uiPartitionSize == SIZE_nRx2N )
     2387  {
     2388    for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ )
     2389    {
     2390      for( uiPelX = 0; uiPelX < uiXOffset; uiPelX++ )
     2391      {
     2392        pMask[uiPelX + uiPelY*uiWidth] = 0;
     2393      }
     2394
     2395      for( ; uiPelX < uiWidth; uiPelX++ )
     2396      {
     2397        pMask[uiPelX + uiPelY*uiWidth] = 1;
     2398      }
     2399    }
     2400  }
     2401  else if( uiPartitionSize == SIZE_NxN )
     2402  {
     2403    for( uiPelY = 0; uiPelY < uiYOffset; uiPelY++ )
     2404    {
     2405      for( uiPelX = 0; uiPelX < uiXOffset; uiPelX++ )
     2406      {
     2407        pMask[uiPelX + uiPelY*uiWidth] = 0;
     2408      }
     2409
     2410      for( ; uiPelX < uiWidth; uiPelX++ )
     2411      {
     2412        pMask[uiPelX + uiPelY*uiWidth] = 1;
     2413      }
     2414    }
     2415
     2416    for( ; uiPelY < uiHeight; uiPelY++ )
     2417    {
     2418      for( uiPelX = 0; uiPelX < uiXOffset; uiPelX++ )
     2419      {
     2420        pMask[uiPelX + uiPelY*uiWidth] = 2;
     2421      }
     2422
     2423      for( ; uiPelX < uiWidth; uiPelX++ )
     2424      {
     2425        pMask[uiPelX + uiPelY*uiWidth] = 3;
     2426      }
     2427    }
     2428  }
     2429
     2430}
     2431#endif
     2432
    22402433UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx )
    22412434{
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/TComDataCU.h

    r564 r571  
    223223#endif
    224224#endif
     225#if LGE_INTER_SDC_E0156
     226  Bool*         m_pbInterSDCFlag;
     227  Int*          m_apSegmentInterDCOffset[4];
     228  UChar*        m_pucInterSDCMask;
     229#endif
    225230
    226231  // -------------------------------------------------------------------------------------------------------------------
     
    565570  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
    566571#endif
     572#endif
     573#if LGE_INTER_SDC_E0156
     574  Bool*         getInterSDCFlag     ()                        { return m_pbInterSDCFlag;               }
     575  Bool          getInterSDCFlag     ( UInt uiIdx )            { return m_pbInterSDCFlag[uiIdx];        }
     576  Void          setInterSDCFlagSubParts ( Bool bInterSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     577  UInt          getCtxInterSDCFlag  ( UInt uiAbsPartIdx );
     578  Int*          getInterSDCSegmentDCOffset( UInt uiSeg ) { return m_apSegmentInterDCOffset[uiSeg]; }
     579  Int           getInterSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentInterDCOffset[uiSeg][uiPartIdx]; }
     580  Void          setInterSDCSegmentDCOffset( Int pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentInterDCOffset[uiSeg][uiPartIdx] = pOffset; }
     581
     582  Void          xSetInterSDCCUMask( TComDataCU *pcCU, UChar *pMask );
     583
     584  UChar*        getInterSDCMask     ()                        { return m_pucInterSDCMask;              }
    567585#endif
    568586 
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/TComPattern.h

    r504 r571  
    102102  Bool              m_bICFlag;
    103103#endif
     104#if LGE_INTER_SDC_E0156
     105  Bool              m_bSDCMRSADFlag;
     106#endif
    104107  static const UChar m_aucIntraFilter[5];
    105108 
     
    115118  Bool  getICFlag()               { return m_bICFlag; }
    116119  Void  setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; }
     120#endif
     121#if LGE_INTER_SDC_E0156
     122  Bool  getSDCMRSADFlag()         { return m_bSDCMRSADFlag; }
     123  Void  setSDCMRSADFlag( Bool bSDCMRSADFlag )    { m_bSDCMRSADFlag = bSDCMRSADFlag; }
    117124#endif
    118125
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/TComRdCost.cpp

    r537 r571  
    505505  cDtParam.bUseIC       = false;
    506506#endif
     507#if LGE_INTER_SDC_E0156
     508  cDtParam.bUseSDCMRSAD = false;
     509#endif
    507510#if WEIGHTED_CHROMA_DISTORTION
    508511  if (eText == TEXT_CHROMA_U)
     
    608611  }
    609612#endif
     613#if LGE_INTER_SDC_E0156
     614  if( pcDtParam->bUseSDCMRSAD )
     615  {
     616    return xGetSADic( pcDtParam );
     617  }
     618#endif
    610619  Pel* piOrg   = pcDtParam->pOrg;
    611620  Pel* piCur   = pcDtParam->pCur;
     
    638647#if H_3D_IC
    639648  if( pcDtParam->bUseIC )
     649  {
     650    return xGetSAD4ic( pcDtParam );
     651  }
     652#endif
     653#if LGE_INTER_SDC_E0156
     654  if( pcDtParam->bUseSDCMRSAD )
    640655  {
    641656    return xGetSAD4ic( pcDtParam );
     
    675690#if H_3D_IC
    676691  if( pcDtParam->bUseIC )
     692  {
     693    return xGetSAD8ic( pcDtParam );
     694  }
     695#endif
     696#if LGE_INTER_SDC_E0156
     697  if( pcDtParam->bUseSDCMRSAD )
    677698  {
    678699    return xGetSAD8ic( pcDtParam );
     
    716737#if H_3D_IC
    717738  if( pcDtParam->bUseIC )
     739  {
     740    return xGetSAD16ic( pcDtParam );
     741  }
     742#endif
     743#if LGE_INTER_SDC_E0156
     744  if( pcDtParam->bUseSDCMRSAD )
    718745  {
    719746    return xGetSAD16ic( pcDtParam );
     
    770797  }
    771798#endif
     799#if LGE_INTER_SDC_E0156
     800  if( pcDtParam->bUseSDCMRSAD )
     801  {
     802    return xGetSAD12ic( pcDtParam );
     803  }
     804#endif
    772805  Pel* piOrg   = pcDtParam->pOrg;
    773806  Pel* piCur   = pcDtParam->pCur;
     
    808841#if H_3D_IC
    809842  if( pcDtParam->bUseIC )
     843  {
     844    return xGetSAD16Nic( pcDtParam );
     845  }
     846#endif
     847#if LGE_INTER_SDC_E0156
     848  if( pcDtParam->bUseSDCMRSAD )
    810849  {
    811850    return xGetSAD16Nic( pcDtParam );
     
    860899#if H_3D_IC
    861900  if( pcDtParam->bUseIC )
     901  {
     902    return xGetSAD32ic( pcDtParam );
     903  }
     904#endif
     905#if LGE_INTER_SDC_E0156
     906  if( pcDtParam->bUseSDCMRSAD )
    862907  {
    863908    return xGetSAD32ic( pcDtParam );
     
    930975  }
    931976#endif
     977#if LGE_INTER_SDC_E0156
     978  if( pcDtParam->bUseSDCMRSAD )
     979  {
     980    return xGetSAD24ic( pcDtParam );
     981  }
     982#endif
    932983  Pel* piOrg   = pcDtParam->pOrg;
    933984  Pel* piCur   = pcDtParam->pCur;
     
    9851036#if H_3D_IC
    9861037  if( pcDtParam->bUseIC )
     1038  {
     1039    return xGetSAD64ic( pcDtParam );
     1040  }
     1041#endif
     1042#if LGE_INTER_SDC_E0156
     1043  if( pcDtParam->bUseSDCMRSAD )
    9871044  {
    9881045    return xGetSAD64ic( pcDtParam );
     
    10871144  }
    10881145#endif
     1146#if LGE_INTER_SDC_E0156
     1147  if( pcDtParam->bUseSDCMRSAD )
     1148  {
     1149    return xGetSAD48ic( pcDtParam );
     1150  }
     1151#endif
    10891152  Pel* piOrg   = pcDtParam->pOrg;
    10901153  Pel* piCur   = pcDtParam->pCur;
     
    34093472  }
    34103473#endif
     3474#if LGE_INTER_SDC_E0156
     3475  if( pcDtParam->bUseSDCMRSAD )
     3476  {
     3477    return xGetHADsic( pcDtParam );
     3478  }
     3479#endif
    34113480  Pel* piOrg   = pcDtParam->pOrg;
    34123481  Pel* piCur   = pcDtParam->pCur;
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/TComRdCost.h

    r537 r571  
    9494  Bool  bUseIC;
    9595#endif
     96#if LGE_INTER_SDC_E0156
     97  Bool  bUseSDCMRSAD;
     98#endif
    9699  Int   iRows;
    97100  Int   iCols;
     
    132135    pVirOrg = NULL;
    133136    iStrideVir = 0;
     137#endif
     138#if LGE_INTER_SDC_E0156
     139    bUseSDCMRSAD = false;
    134140#endif
    135141  }
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/TComSlice.cpp

    r542 r571  
    15401540#if H_3D_NBDV_REF
    15411541    m_depthRefinementFlag  [ i ] = false;
     1542#endif
     1543#if LGE_INTER_SDC_E0156
     1544    m_bInterSDCFlag        [ i ] = false;
    15421545#endif
    15431546  } 
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/TComSlice.h

    r542 r571  
    507507  Bool        m_ivMvScalingFlag;
    508508#endif
     509#if LGE_INTER_SDC_E0156
     510  Bool        m_bInterSDCFlag[MAX_NUM_LAYERS   ];
     511#endif
    509512
    510513#endif
     
    716719  Bool    getIvMvScalingFlag   (  )                       { return m_ivMvScalingFlag; }
    717720  Void    setIvMvScalingFlag   ( Bool b )                 { m_ivMvScalingFlag = b;    } 
     721#endif
     722#if LGE_INTER_SDC_E0156
     723  Bool    getInterSDCFlag      ( Int layerIdInVps )           { return m_bInterSDCFlag[layerIdInVps]; }
     724  Void    setInterSDCFlag      ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; }
    718725#endif
    719726
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibCommon/TypeDef.h

    r564 r571  
    100100#define MTK_CLIPPING_ALIGN_IC_E0168       1   // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168
    101101#define MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170            1   // Progressive MV Compression, JCT3V-E0170
     102#define LGE_INTER_SDC_E0156               1   // Enable inter SDC for depth coding
    102103
    103104#if H_3D_NBDV
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r541 r571  
    10731073            }
    10741074#endif
     1075#if LGE_INTER_SDC_E0156
     1076            READ_FLAG( uiCode, "depth_inter_SDC_flag" );              pcVPS->setInterSDCFlag( i, uiCode ? true : false );
     1077#endif
    10751078          }
    10761079        }
     
    20332036}
    20342037#endif
     2038#if LGE_INTER_SDC_E0156
     2039Void TDecCavlc::parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2040{
     2041  assert(0);
     2042}
     2043
     2044Void TDecCavlc::parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart )
     2045{
     2046  assert(0);
     2047}
     2048#endif
    20352049// ====================================================================================================================
    20362050// Protected member functions
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibDecoder/TDecCAVLC.h

    r537 r571  
    102102  Void  parseICFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    103103#endif
     104#if LGE_INTER_SDC_E0156
     105  Void  parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     106  Void  parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
     107#endif
    104108  Void parseSplitFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    105109  Void parsePartSize        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibDecoder/TDecCu.cpp

    r531 r571  
    421421  m_pcEntropyDecoder->decodeARPW    ( pcCU , uiAbsPartIdx , uiDepth ); 
    422422#endif 
     423#if LGE_INTER_SDC_E0156
     424  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     425#endif
    423426  // Coefficient decoding
    424427  Bool bCodeDQP = getdQPFlag();
     
    485488  {
    486489    case MODE_INTER:
     490#if LGE_INTER_SDC_E0156
     491      if( m_ppcCU[uiDepth]->getInterSDCFlag( 0 ) )
     492        xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     493      else
     494#endif
    487495      xReconInter( m_ppcCU[uiDepth], uiDepth );
    488496      break;
     
    526534  }
    527535}
     536
     537#if LGE_INTER_SDC_E0156
     538Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     539{
     540  // inter prediction
     541  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
     542
     543  UInt  uiWidth      = pcCU->getWidth ( 0 );
     544  UInt  uiHeight     = pcCU->getHeight( 0 );
     545  UChar* pMask       = pcCU->getInterSDCMask();
     546
     547  memset( pMask, 0, uiWidth*uiHeight );
     548  pcCU->xSetInterSDCCUMask( pcCU, pMask );
     549
     550  Pel  *pResi;
     551  UInt uiPelX, uiPelY;
     552  UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride();
     553
     554  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr( 0 );
     555  for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ )
     556  {
     557    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
     558    {
     559      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
     560
     561      pResi[ uiPelX ] = pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 );;
     562    }
     563    pResi += uiResiStride;
     564  }
     565
     566  m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
     567
     568  // clear UV
     569  UInt  uiStrideC     = m_ppcYuvReco[uiDepth]->getCStride();
     570  Pel   *pRecCb       = m_ppcYuvReco[uiDepth]->getCbAddr();
     571  Pel   *pRecCr       = m_ppcYuvReco[uiDepth]->getCrAddr();
     572
     573  for (Int y = 0; y < uiHeight/2; y++)
     574  {
     575    for (Int x = 0; x < uiWidth/2; x++)
     576    {
     577      pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );
     578      pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );
     579    }
     580
     581    pRecCb += uiStrideC;
     582    pRecCr += uiStrideC;
     583  }
     584}
     585#endif
    528586
    529587Void
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibDecoder/TDecCu.h

    r531 r571  
    118118  Void xReconIntraSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    119119#endif
     120#if LGE_INTER_SDC_E0156
     121  Void xReconInterSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     122#endif
    120123};
    121124
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibDecoder/TDecEntropy.cpp

    r531 r571  
    635635#endif
    636636 
     637#if LGE_INTER_SDC_E0156
     638  if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     639  {
     640    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
     641    assert( !pcCU->isIntra( uiAbsPartIdx) );
     642    assert( pcCU->getSlice()->getIsDepth() );
     643
     644    decodeInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth );
     645    return;
     646  }
     647#endif
     648
    637649  if( pcCU->isIntra(uiAbsPartIdx) )
    638650  {
     
    656668}
    657669
     670#if LGE_INTER_SDC_E0156
     671Void TDecEntropy::decodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     672{
     673  pcCU->setInterSDCFlagSubParts( false, uiAbsPartIdx, 0, uiDepth);
     674
     675  if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
     676    return;
     677
     678  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || pcCU->isSkipped( uiAbsPartIdx ) )
     679    return;
     680
     681  m_pcEntropyDecoderIf->parseInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     682}
     683
     684Void TDecEntropy::decodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     685{
     686  if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
     687    return;
     688
     689  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || !pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     690    return;
     691
     692  UInt uiNumSegments = ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ? 1 : ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 );
     693
     694  // decode residual data for each segment
     695  for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ )
     696    m_pcEntropyDecoderIf->parseInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth, uiSeg );
     697}
     698#endif
     699
    658700//! \}
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibDecoder/TDecEntropy.h

    r504 r571  
    9191  virtual Void parseICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    9292#endif
     93#if LGE_INTER_SDC_E0156
     94  virtual Void parseInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     95  virtual Void parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) = 0;
     96#endif
    9397  virtual Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    9498  virtual Void parsePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     
    166170  Void decodeICFlag            ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    167171#endif
    168 
     172#if LGE_INTER_SDC_E0156
     173  Void decodeInterSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     174  Void decodeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     175#endif
    169176  Void decodeIPCMInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    170177
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibDecoder/TDecSbac.cpp

    r541 r571  
    100100#endif
    101101#endif
     102#if LGE_INTER_SDC_E0156
     103, m_cInterSDCFlagSCModel             ( 1,             1,  NUM_INTER_SDC_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
     104, m_cInterSDCResidualSCModel         ( 1,             1,  NUM_INTER_SDC_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
     105, m_cInterSDCResidualSignFlagSCModel ( 1,             1,  NUM_INTER_SDC_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     106#endif
    102107{
    103108  assert( m_numContextModels <= MAX_NUM_CTX_MOD );
     
    182187  m_cSDCResidualSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL );
    183188#endif
     189#endif
     190#if LGE_INTER_SDC_E0156
     191  m_cInterSDCFlagSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
     192  m_cInterSDCResidualSCModel.initBuffer   ( sliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     193  m_cInterSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
    184194#endif
    185195  m_uiLastDQpNonZero  = 0;
     
    251261  m_cSDCResidualSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );
    252262#endif
     263#endif
     264#if LGE_INTER_SDC_E0156
     265  m_cInterSDCFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
     266  m_cInterSDCResidualSCModel.initBuffer   ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     267  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
    253268#endif
    254269  m_pcTDecBinIf->start();
     
    22372252#endif
    22382253
     2254#if LGE_INTER_SDC_E0156
     2255Void TDecSbac::parseInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2256{
     2257  UInt uiSymbol = 0;
     2258  UInt uiCtxInterSDCFlag = pcCU->getCtxInterSDCFlag( uiAbsPartIdx );
     2259
     2260  m_pcTDecBinIf->decodeBin( uiSymbol, m_cInterSDCFlagSCModel.get( 0, 0, uiCtxInterSDCFlag ) );
     2261
     2262  if( uiSymbol )
     2263  {
     2264    pcCU->setInterSDCFlagSubParts( true, uiAbsPartIdx, 0, uiDepth );
     2265    pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth );
     2266    pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth );
     2267  }
     2268  else
     2269    pcCU->setInterSDCFlagSubParts( false, uiAbsPartIdx, 0, uiDepth);
     2270}
     2271
     2272Void TDecSbac::parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment )
     2273{
     2274  UInt uiAbsIdx   = 0;
     2275  UInt uiSign     = 0;
     2276  Int  iIdx       = 0;
     2277
     2278  xReadExGolombLevel( uiAbsIdx, m_cInterSDCResidualSCModel.get( 0, 0, 0 ) );
     2279
     2280  uiAbsIdx++;
     2281  m_pcTDecBinIf->decodeBin( uiSign, m_cInterSDCResidualSignFlagSCModel.get( 0, 0, 0 ) );
     2282  iIdx = (Int)( uiSign ? -1 : 1 ) * uiAbsIdx;
     2283
     2284  pcCU->setInterSDCSegmentDCOffset( iIdx, uiSegment, uiAbsPartIdx );
     2285}
     2286#endif
     2287
    22392288//! \}
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibDecoder/TDecSbac.h

    r531 r571  
    112112#endif
    113113#endif
     114#if LGE_INTER_SDC_E0156
     115  Void  parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     116  Void  parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
     117#endif
    114118private:
    115119  TComInputBitstream* m_pcBitstream;
     
    221225#endif
    222226#endif
     227#if LGE_INTER_SDC_E0156
     228  ContextModel3DBuffer m_cInterSDCFlagSCModel;
     229  ContextModel3DBuffer m_cInterSDCResidualSCModel;
     230  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
     231#endif
    223232};
    224233
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncCavlc.cpp

    r542 r571  
    842842        }       
    843843#endif
     844#if LGE_INTER_SDC_E0156
     845        WRITE_FLAG( pcVPS->getInterSDCFlag( i ) ? 1 : 0, "depth_inter_SDC_flag" );
     846#endif
    844847      }
    845848    } 
     
    17761779  return true;
    17771780}
     1781
     1782#if LGE_INTER_SDC_E0156
     1783Void TEncCavlc::codeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )
     1784{
     1785  assert(0);
     1786}
     1787
     1788Void TEncCavlc::codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment )
     1789{
     1790  assert(0);
     1791}
     1792#endif
    17781793//! \}
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncCavlc.h

    r537 r571  
    117117  Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    118118#endif
     119#if LGE_INTER_SDC_E0156
     120  Void codeInterSDCFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     121  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
     122#endif
    119123
    120124  Void codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode );
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncCfg.h

    r541 r571  
    394394  Bool      m_bUseIC;
    395395#endif
     396#if LGE_INTER_SDC_E0156
     397  bool      m_bInterSDC;
     398#endif
    396399  //====== Depth Intra Modes ======
    397400#if H_3D_DIM
     
    490493  Void       setUseIC                       ( Bool bVal )    { m_bUseIC = bVal; }
    491494  Bool       getUseIC                       ()               { return m_bUseIC; }
     495#endif
     496#if LGE_INTER_SDC_E0156
     497  Void       setInterSDCEnable              ( Bool bVal )    { m_bInterSDC = bVal; }
     498  Bool       getInterSDCEnable              ()               { return m_bInterSDC; }
    492499#endif
    493500  //======== Transform =============
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncCu.cpp

    r559 r571  
    15271527  m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
    15281528#endif
     1529#if LGE_INTER_SDC_E0156
     1530  m_pcEntropyCoder->encodeInterSDCFlag( pcCU, uiAbsPartIdx, false );
     1531#endif
    15291532
    15301533  // Encode Coefficients
     
    18171820
    18181821          rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
     1822#if LGE_INTER_SDC_E0156
     1823          TComDataCU *rpcTempCUPre = rpcTempCU;
     1824#endif
    18191825          Int orgQP = rpcTempCU->getQP( 0 );
    18201826          xCheckDQP( rpcTempCU );
    18211827          xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     1828#if LGE_INTER_SDC_E0156
     1829          if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
     1830          {
     1831            if( rpcTempCU != rpcTempCUPre )
     1832            {
     1833              rpcTempCU->initEstData( uhDepth, orgQP );
     1834              rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     1835            }
     1836            rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     1837            rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     1838            rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     1839#if H_3D_VSO //M2
     1840            if( m_pcRdCost->getUseRenModel() )
     1841            { //Reset
     1842              UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
     1843              UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
     1844              Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
     1845              UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
     1846              m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     1847            }
     1848#endif
     1849            m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     1850              m_ppcOrigYuv[uhDepth],
     1851              ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     1852              m_ppcResiYuvTemp[uhDepth],
     1853              m_ppcRecoYuvTemp[uhDepth],
     1854              uhDepth );
     1855
     1856            xCheckDQP( rpcTempCU );
     1857            xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     1858          }
     1859#endif
    18221860          rpcTempCU->initEstData( uhDepth, orgQP );
    18231861
    18241862      if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
    18251863      {
     1864#if LGE_INTER_SDC_E0156
     1865        if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) )
     1866          bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );
     1867        else
     1868#endif
    18261869        bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;
    18271870      }
     
    20172060#endif
    20182061  rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    2019 
     2062#if LGE_INTER_SDC_E0156
     2063  TComDataCU *rpcTempCUPre = rpcTempCU;
     2064#endif
    20202065  xCheckDQP( rpcTempCU );
    20212066  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2067#if LGE_INTER_SDC_E0156
     2068  if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() )
     2069  {
     2070    if( rpcTempCU != rpcTempCUPre )
     2071    {
     2072      Int orgQP = rpcBestCU->getQP( 0 );
     2073      rpcTempCU->initEstData( uhDepth, orgQP );
     2074      rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2075    }
     2076    rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2077    rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2078    rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2079#if H_3D_VSO // M3
     2080    if( m_pcRdCost->getUseRenModel() )
     2081    {
     2082      UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     2083      UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     2084      Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     2085      UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     2086      m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2087    }
     2088#endif
     2089
     2090    m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2091      m_ppcOrigYuv[uhDepth],
     2092      ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2093      m_ppcResiYuvTemp[uhDepth],
     2094      m_ppcRecoYuvTemp[uhDepth],
     2095      uhDepth );
     2096
     2097    xCheckDQP( rpcTempCU );
     2098    xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     2099  }
     2100#endif
    20222101#if H_3D_ARP
    20232102  }
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncEntropy.cpp

    r531 r571  
    662662#endif
    663663
     664#if LGE_INTER_SDC_E0156
     665  if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     666  {
     667    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
     668    assert( !pcCU->isIntra( uiAbsPartIdx) );
     669    assert( pcCU->getSlice()->getIsDepth() );
     670
     671    encodeInterSDCResidualData( pcCU, uiAbsPartIdx, false );
     672    return;
     673  }
     674#endif
     675
    664676  if( pcCU->isIntra(uiAbsPartIdx) )
    665677  {
     
    812824}
    813825
     826#if LGE_INTER_SDC_E0156
     827Void TEncEntropy::encodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     828{
     829  if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
     830    return;
     831
     832  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || pcCU->isSkipped( uiAbsPartIdx ) )
     833    return;
     834
     835  if( bRD )
     836    uiAbsPartIdx = 0;
     837
     838  m_pcEntropyCoderIf->codeInterSDCFlag( pcCU, uiAbsPartIdx );
     839}
     840
     841Void TEncEntropy::encodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     842{
     843  if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
     844    return;
     845
     846  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || !pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     847    return;
     848
     849  if( bRD )
     850    uiAbsPartIdx = 0;
     851
     852  // number of segments depends on prediction mode for INTRA
     853  UInt uiNumSegments = ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ? 1 : ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 );
     854
     855  // encode residual data for each segment
     856  for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ )
     857    m_pcEntropyCoderIf->codeInterSDCResidualData( pcCU, uiAbsPartIdx, uiSeg );
     858}
     859#endif
     860
    814861//! \}
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncEntropy.h

    r504 r571  
    9393#if H_3D_IC
    9494  virtual Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     95#endif
     96#if LGE_INTER_SDC_E0156
     97  virtual Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     98  virtual Void codeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) = 0;
    9599#endif
    96100  virtual Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     
    181185  Void encodeICFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    182186#endif
     187#if LGE_INTER_SDC_E0156
     188  Void encodeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     189  Void encodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD );
     190#endif
    183191  Void encodePredMode          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    184192  Void encodePartSize          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncSbac.cpp

    r541 r571  
    106106#endif
    107107#endif
     108#if LGE_INTER_SDC_E0156
     109, m_cInterSDCFlagSCModel             ( 1,             1,  NUM_INTER_SDC_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
     110, m_cInterSDCResidualSCModel         ( 1,             1,  NUM_INTER_SDC_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
     111, m_cInterSDCResidualSignFlagSCModel ( 1,             1,  NUM_INTER_SDC_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     112#endif
    108113{
    109114  assert( m_numContextModels <= MAX_NUM_CTX_MOD );
     
    181186#endif
    182187#endif
     188#if LGE_INTER_SDC_E0156
     189  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
     190  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     191  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     192#endif
    183193  // new structure
    184194  m_uiLastQp = iQp;
     
    217227#if H_3D_IC
    218228      curCost += m_cCUICFlagSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_IC_FLAG );
     229#endif
     230#if LGE_INTER_SDC_E0156
     231      curCost += m_cInterSDCFlagSCModel.calcCost      ( curSliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
     232      curCost += m_cInterSDCResidualSCModel.calcCost  ( curSliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     233      curCost += m_cInterSDCResidualSignFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
    219234#endif
    220235      curCost += m_cCUPartSizeSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_PART_SIZE );
     
    330345#endif
    331346#endif
     347#if LGE_INTER_SDC_E0156
     348  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
     349  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
     350  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     351#endif
    332352  m_pcBinIf->start();
    333353}
     
    22092229  this->xCopyContextsFrom(pScr);
    22102230}
     2231
     2232#if LGE_INTER_SDC_E0156
     2233Void TEncSbac::codeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2234{
     2235  UInt uiSymbol = pcCU->getInterSDCFlag( uiAbsPartIdx ) ? 1 : 0;
     2236  UInt uiCtxInterSDCFlag = pcCU->getCtxInterSDCFlag( uiAbsPartIdx );
     2237
     2238  m_pcBinIf->encodeBin( uiSymbol, m_cInterSDCFlagSCModel.get( 0, 0, uiCtxInterSDCFlag ) );
     2239}
     2240
     2241Void TEncSbac::codeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment )
     2242{
     2243  Pel segmentDCOffset = pcCU->getInterSDCSegmentDCOffset( uiSegment, uiAbsPartIdx );
     2244
     2245  UInt uiSign     = segmentDCOffset < 0 ? 1 : 0;
     2246  UInt uiAbsIdx   = abs( segmentDCOffset );
     2247
     2248  assert( uiAbsIdx > 0 );
     2249  uiAbsIdx--;
     2250  xWriteExGolombLevel( uiAbsIdx, m_cInterSDCResidualSCModel.get( 0, 0, 0 ) );
     2251  m_pcBinIf->encodeBin( uiSign, m_cInterSDCResidualSignFlagSCModel.get( 0, 0, 0 ) );
     2252}
     2253#endif
    22112254//! \}
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncSbac.h

    r531 r571  
    158158  Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    159159#endif
     160#if LGE_INTER_SDC_E0156
     161  Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     162  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
     163#endif
    160164  Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    161165  Void codeMVPIdx        ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
     
    261265#endif
    262266#endif
     267#if LGE_INTER_SDC_E0156
     268  ContextModel3DBuffer m_cInterSDCFlagSCModel;
     269  ContextModel3DBuffer m_cInterSDCResidualSCModel;
     270  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
     271#endif
    263272};
    264273
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncSearch.cpp

    r559 r571  
    4141#include "TEncSearch.h"
    4242#include <math.h>
     43#if LGE_INTER_SDC_E0156
     44#include <memory.h>
     45#endif
    4346
    4447//! \ingroup TLibEncoder
     
    319322#if H_3D_IC
    320323  m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     324#endif
     325#if LGE_INTER_SDC_E0156
     326  m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();
    321327#endif
    322328  //-- jclee for using the SAD function pointer
     
    748754#if H_3D_IC
    749755    m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     756#endif
     757#if LGE_INTER_SDC_E0156
     758    m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();
    750759#endif
    751760    m_cDistParam.pCur = piRefPos;
     
    35313540  cDistParam.bUseIC = false;
    35323541#endif
     3542#if LGE_INTER_SDC_E0156
     3543  cDistParam.bUseSDCMRSAD = false;
     3544#endif
    35333545  ruiErr = cDistParam.DistFunc( &cDistParam );
    35343546}
     
    46274639  pcPatternKey->setICFlag( bICFlag );
    46284640#endif
     4641#if LGE_INTER_SDC_E0156
     4642  if ( pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
     4643  {
     4644    pcPatternKey->setSDCMRSADFlag( true );
     4645  }
     4646  else
     4647  {
     4648    pcPatternKey->setSDCMRSADFlag( false );
     4649  }
     4650#endif
    46294651
    46304652  if ( bBi )
     
    47724794#if H_3D_IC
    47734795      m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     4796#endif
     4797#if LGE_INTER_SDC_E0156
     4798      m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag();
    47744799#endif
    47754800      m_cDistParam.bitDepth = g_bitDepthY;
     
    53785403#endif
    53795404}
     5405
     5406#if LGE_INTER_SDC_E0156
     5407Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, const UInt uiDepth )
     5408{
     5409  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( 0 ) )
     5410  {
     5411    return;
     5412  }
     5413
     5414  pcCU->setInterSDCFlagSubParts( true, 0, 0, uiDepth );
     5415
     5416  UInt  uiWidth      = pcCU->getWidth ( 0 );
     5417  UInt  uiHeight     = pcCU->getHeight( 0 );
     5418  UChar* pMask       = pcCU->getInterSDCMask();
     5419  memset( pMask, 0, uiWidth*uiHeight );
     5420
     5421  pcCU->xSetInterSDCCUMask( pcCU, pMask );
     5422
     5423  UInt uiSegSize[4] = { 0, 0, 0, 0 };
     5424  Pel *pPred, *pOrg;
     5425  UInt uiPredStride = pcPred->getStride();
     5426  UInt uiOrgStride  = pcOrg->getStride();
     5427  UInt uiPelX, uiPelY;
     5428  UInt uiPartitionSize = pcCU->getPartitionSize( 0 );
     5429  UInt uiSegmentNum = ( uiPartitionSize == SIZE_2Nx2N ) ? 1 : ( uiPartitionSize == SIZE_NxN ? 4 : 2 );
     5430
     5431  pPred = pcPred->getLumaAddr( 0 );
     5432  pOrg  = pcOrg->getLumaAddr( 0 );
     5433  Int pResDC[4] = { 0, 0, 0, 0};
     5434
     5435  //calculate dc value for prediction and original signal, and calculate residual and reconstruction
     5436  for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ )
     5437  {
     5438    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
     5439    {
     5440      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
     5441      pResDC[uiSeg] += (Int)( pOrg [uiPelX] - pPred[uiPelX] );
     5442      uiSegSize[uiSeg]++;
     5443    }
     5444    pOrg  += uiOrgStride;
     5445    pPred += uiPredStride;
     5446  }
     5447
     5448  for( UInt uiSeg = 0; uiSeg < uiSegmentNum; uiSeg++ )
     5449  {
     5450    Int iResiOffset = ( pResDC [uiSeg] > 0 ? ( uiSegSize[uiSeg] >> 1 ) : -1*( uiSegSize[uiSeg] >> 1 ) );
     5451    pResDC [uiSeg]  = ( pResDC [uiSeg] + iResiOffset ) / (Int) uiSegSize[uiSeg];
     5452
     5453    pcCU->setInterSDCSegmentDCOffset( pResDC[uiSeg], uiSeg, 0 );
     5454  }
     5455
     5456  Pel *pRec;
     5457  UInt uiRecStride  = pcRec->getStride();
     5458  pPred = pcPred->getLumaAddr( 0 );
     5459  pRec  = pcRec->getLumaAddr( 0 );
     5460
     5461  for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ )
     5462  {
     5463    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
     5464    {
     5465      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
     5466      assert( uiSeg < uiSegmentNum );
     5467
     5468      pRec[ uiPelX ] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, pPred[uiPelX] + pResDC[uiSeg] );
     5469    }
     5470    pPred     += uiPredStride;
     5471    pRec      += uiRecStride;
     5472  }
     5473
     5474  // clear UV
     5475  UInt  uiStrideC     = pcRec->getCStride();
     5476  Pel   *pRecCb       = pcRec->getCbAddr();
     5477  Pel   *pRecCr       = pcRec->getCrAddr();
     5478
     5479  for (Int y=0; y < uiHeight/2; y++)
     5480  {
     5481    for (Int x=0; x < uiWidth/2; x++)
     5482    {
     5483      pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );
     5484      pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );
     5485    }
     5486
     5487    pRecCb += uiStrideC;
     5488    pRecCr += uiStrideC;
     5489  }
     5490
     5491  Dist ruiDist;
     5492  Double rdCost;
     5493#if H_3D_VSO // M13
     5494  if ( m_pcRdCost->getUseVSO() )
     5495  {
     5496    ruiDist = m_pcRdCost->getDistPartVSO( pcCU, 0, pcRec->getLumaAddr(), pcRec->getStride(),  pcOrg->getLumaAddr(), pcOrg->getStride(),  uiWidth,      uiHeight     , false );
     5497  }
     5498  else   
     5499  {
     5500#endif
     5501    {
     5502      ruiDist = m_pcRdCost->getDistPart( g_bitDepthY, pcRec->getLumaAddr( 0 ), uiRecStride, pcOrg->getLumaAddr( 0 ), uiOrgStride, uiWidth, uiHeight );
     5503    }
     5504#if H_3D_VSO
     5505  }
     5506#endif
     5507
     5508  Bool bNonSkip = true;
     5509  for( UInt uiSeg = 0; uiSeg < uiSegmentNum; uiSeg++ )
     5510  {
     5511    bNonSkip &= ( pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 ) != 0 ) ? 1 : 0;
     5512  }
     5513
     5514  if( !bNonSkip )
     5515  {
     5516    pcCU->getTotalBits()       = MAX_INT;
     5517    pcCU->getTotalDistortion() = MAX_INT;
     5518    pcCU->getTotalCost()       = MAX_DOUBLE;
     5519  }
     5520  else
     5521  {
     5522    //----- determine rate and r-d cost -----
     5523    UInt uiBits = 0;
     5524    TComYuv *pDummy = NULL;
     5525    if( m_bUseSBACRD )
     5526    {
     5527      m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[pcCU->getDepth(0)][CI_CURR_BEST] );
     5528    }
     5529
     5530    xAddSymbolBitsInter( pcCU, 0, 0, uiBits, pDummy, NULL, pDummy );
     5531
     5532#if H_3D_VSO //M 14
     5533    if ( m_pcRdCost->getUseLambdaScaleVSO() )   
     5534      rdCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );   
     5535    else
     5536#endif
     5537    {
     5538      rdCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );
     5539    }
     5540
     5541    pcCU->getTotalBits()       = m_pcEntropyCoder->getNumberOfWrittenBits();
     5542    pcCU->getTotalDistortion() = ruiDist;
     5543    pcCU->getTotalCost()       = rdCost;
     5544
     5545    if( m_bUseSBACRD )
     5546    {
     5547      m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] );
     5548    }
     5549  }
     5550
     5551#if H_3D_VSO // necessary? // M15
     5552  // set Model
     5553  if( !m_pcRdCost->getUseEstimatedVSD() && m_pcRdCost->getUseRenModel() )
     5554  {
     5555    Pel*  piSrc       = pcRec->getLumaAddr();
     5556    UInt  uiSrcStride = pcRec->getStride();
     5557    m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     5558  }
     5559#endif
     5560}
     5561#endif
    53805562
    53815563#if H_3D_VSO // M25
     
    65436725    m_pcEntropyCoder->encodeARPW( pcCU , 0 );
    65446726#endif
     6727#if LGE_INTER_SDC_E0156
     6728    m_pcEntropyCoder->encodeInterSDCFlag( pcCU, 0, true );
     6729#endif
    65456730    Bool bDummy = false;
    65466731    m_pcEntropyCoder->encodeCoeff   ( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0), bDummy );
  • branches/HTM-DEV-2.0-dev2-LG/source/Lib/TLibEncoder/TEncSearch.h

    r559 r571  
    213213                                  TComYuv*&   rpcYuvRec,
    214214                                  Bool        bSkipRes );
    215  
     215#if LGE_INTER_SDC_E0156
     216  Void encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU,
     217    TComYuv* pcOrg,
     218    TComYuv* pcPred,
     219    TComYuv* pcResi,
     220    TComYuv* pcRec,
     221    const UInt uiDepth );
     222#endif
    216223  /// set ME search range
    217224  Void setAdaptiveSearchRange   ( Int iDir, Int iRefIdx, Int iSearchRange) { m_aaiAdaptSR[iDir][iRefIdx] = iSearchRange; }
Note: See TracChangeset for help on using the changeset viewer.