Changeset 827 in 3DVCSoftware


Ignore:
Timestamp:
5 Feb 2014, 20:06:56 (11 years ago)
Author:
tech
Message:

Merged 9.3-dev3-Fix@824

Location:
branches/HTM-9.3-dev0/source/Lib
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.3-dev0/source/Lib/TLibCommon/ContextTables.h

    r826 r827  
    115115
    116116#if H_3D_DIM
     117#if QC_GENERIC_SDC_G0122
     118#define NUM_DEPTH_INTRA_MODE_CTX      1       ///< number of context models for depth intra modes
     119#else
    117120#define NUM_DEPTH_INTRA_MODE_CTX      8       ///< number of context models for depth intra modes
     121#endif
    118122#define NUM_DDC_FLAG_CTX              2       ///< number of context models for deltaDC flag (DMM or RBC)
    119123#define NUM_DDC_DATA_CTX              1       ///< number of context models for deltaDC data (DMM or RBC)
     
    121125#define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
    122126#endif
     127#if QC_GENERIC_SDC_G0122
     128#define NUM_ANGLE_FLAG_CTX            3
     129#if !QC_SDC_UNIFY_G0130
     130#define NUM_INTRASDC_FLAG_CTX         3
     131#endif
     132#endif
    123133#endif
    124134
     
    128138#endif
    129139
    130 #if H_3D_INTER_SDC
     140#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    131141#define NUM_INTER_SDC_FLAG_CTX        1      ///< number of context models for inter SDC flag
    132142#define NUM_INTER_SDC_SIGN_FLAG_CTX   1      ///< number of context models for sign of inter SDC residual
     
    134144#endif
    135145
     146#if QC_SDC_UNIFY_G0130
     147#define NUM_SDC_FLAG_CTX              1      ///< number of context
     148#endif
    136149#if H_3D_DBBP
    137150#define DBBP_NUM_FLAG_CTX                 1
     
    414427#endif
    415428#if H_3D_DIM
     429#if QC_GENERIC_SDC_G0122
     430static const UChar
     431INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
     432{
     433  { 154, },
     434  { 154, },
     435  { 154, }
     436};
     437#else
    416438static const UChar
    417439INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
     
    421443    {64, 0, CNU, CNU, 168, 109,   0, 0}
    422444};
     445#endif
     446
     447#if QC_GENERIC_SDC_G0122
     448static const UChar
     449INIT_ANGLE_FLAG[3][NUM_ANGLE_FLAG_CTX] =
     450{
     451  { 154, 155, 156 },
     452  { 141, 185, 214 },
     453  { 155, 170, 157 },
     454};
     455#if !QC_SDC_UNIFY_G0130
     456static const UChar
     457INIT_INTRASDC_FLAG[3][NUM_INTRASDC_FLAG_CTX] =
     458{
     459  { 214, 229, 230 },
     460  { 215, 202, 174 },
     461  { 213, 201, 246 },
     462};
     463#endif
     464#endif
    423465
    424466static const UChar
     
    463505#endif
    464506
    465 #if H_3D_INTER_SDC
     507#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    466508static const UChar
    467509INIT_INTER_SDC_FLAG[3][NUM_INTER_SDC_FLAG_CTX] =
     
    489531#endif
    490532//! \}
     533#if QC_SDC_UNIFY_G0130
     534static const UChar
     535INIT_SDC_FLAG[3][NUM_SDC_FLAG_CTX] =
     536{
     537  { 154 }, 
     538  { 154 },
     539  { 154 },
     540};
     541#endif
    491542
    492543#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibCommon/TComDataCU.cpp

    r826 r827  
    123123#if H_3D_DIM_SDC
    124124  m_pbSDCFlag             = NULL;
     125#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     126  for( Int i = 0; i < 4; i++ )
     127  {
     128    m_apSegmentDCOffset[i]  = NULL;
     129  }
     130#else
    125131  m_apSegmentDCOffset[0]  = NULL;
    126132  m_apSegmentDCOffset[1]  = NULL;
     133#endif
    127134#endif
    128135#endif
     
    146153#endif
    147154#if H_3D_INTER_SDC
     155#if !QC_SDC_UNIFY_G0130
    148156  m_pbInterSDCFlag       = NULL;
    149157  for( Int i = 0; i < 4; i++ )
     
    151159    m_apSegmentInterDCOffset[i] = NULL;
    152160  }
     161#endif
     162#if !SEC_INTER_SDC_G0101
    153163  m_pucInterSDCMask       = NULL;
     164#endif
    154165#endif
    155166#if H_3D_DBBP
     
    280291#if H_3D_DIM_SDC
    281292    m_pbSDCFlag             = (Bool*)xMalloc(Bool, uiNumPartition);
     293#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     294    for( Int i = 0; i < 4; i++ )
     295    {
     296      m_apSegmentDCOffset[i]  = (Pel*)xMalloc(Pel, uiNumPartition);
     297    }
     298#else
    282299    m_apSegmentDCOffset[0]  = (Pel*)xMalloc(Pel, uiNumPartition);
    283300    m_apSegmentDCOffset[1]  = (Pel*)xMalloc(Pel, uiNumPartition);
    284301#endif
    285302#endif
    286 #if H_3D_INTER_SDC
     303#endif
     304#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    287305    m_pbInterSDCFlag     = (Bool*  )xMalloc(Bool,   uiNumPartition);
    288306    for( Int i = 0; i < 4; i++ )
     
    300318    m_acCUMvField[1].setNumPartition(uiNumPartition );
    301319  }
     320#if !SEC_INTER_SDC_G0101
    302321#if H_3D_INTER_SDC
    303322  m_pucInterSDCMask     = (UChar*  )xMalloc(UChar,    g_uiMaxCUHeight*g_uiMaxCUWidth);
     323#endif
    304324#endif
    305325  m_sliceStartCU        = (UInt*  )xMalloc(UInt, uiNumPartition);
     
    421441#if H_3D_DIM_SDC
    422442    if ( m_pbSDCFlag            ) { xFree(m_pbSDCFlag);             m_pbSDCFlag             = NULL; }
     443#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     444    for( Int i = 0; i < 4; i++ )
     445    {
     446      if ( m_apSegmentDCOffset[i] ) { xFree(m_apSegmentDCOffset[i]);  m_apSegmentDCOffset[i]  = NULL; }
     447    }
     448#else
    423449    if ( m_apSegmentDCOffset[0] ) { xFree(m_apSegmentDCOffset[0]);  m_apSegmentDCOffset[0]  = NULL; }
    424450    if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]);  m_apSegmentDCOffset[1]  = NULL; }
    425451#endif
    426452#endif   
    427 #if H_3D_INTER_SDC
     453#endif   
     454#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    428455    if ( m_pbInterSDCFlag     ) { xFree(m_pbInterSDCFlag);      m_pbInterSDCFlag    = NULL; }
    429456    for(Int i = 0; i < 4; i++ )
     
    436463#endif
    437464  }
     465#if !SEC_INTER_SDC_G0101
    438466#if H_3D_INTER_SDC
    439467  if ( m_pucInterSDCMask     ) { xFree(m_pucInterSDCMask);      m_pucInterSDCMask    = NULL; }
     468#endif
    440469#endif
    441470  m_pcCUAboveLeft       = NULL;
     
    584613    m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui];
    585614#endif
    586 #if H_3D_INTER_SDC
     615#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    587616    m_pbInterSDCFlag[ui] = pcFrom->m_pbInterSDCFlag[ui];
    588617#endif
     
    655684#if H_3D_DIM_SDC
    656685    memset( m_pbSDCFlag             + firstElement,     0,                numElements * sizeof( *m_pbSDCFlag            ) );
     686#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     687    for( Int i = 0; i < 4; i++ )
     688    {
     689      memset( m_apSegmentDCOffset[i]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[i] ) );
     690    }
     691#else
    657692    memset( m_apSegmentDCOffset[0]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[0] ) );
    658693    memset( m_apSegmentDCOffset[1]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[1] ) );
    659694#endif
    660695#endif
    661 #if H_3D_INTER_SDC
     696#endif
     697#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    662698    memset( m_pbInterSDCFlag   + firstElement,     0,                    numElements * sizeof( *m_pbInterSDCFlag ) );
    663699    for( Int i = 0; i < 4; i++ )
     
    836872#if H_3D_DIM_SDC
    837873      m_pbSDCFlag           [ui] = false;
     874#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     875      for( Int i = 0; i < 4; i++ )
     876      {
     877        m_apSegmentDCOffset[i][ui] = 0;
     878      }
     879#else
    838880      m_apSegmentDCOffset[0][ui] = 0;
    839881      m_apSegmentDCOffset[1][ui] = 0;
    840882#endif
    841883#endif
    842 #if H_3D_INTER_SDC
     884#endif
     885#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    843886      m_pbInterSDCFlag[ui] = false;
    844887      for( Int i = 0; i < 4; i++ )
     
    9581001#if H_3D_DIM_SDC
    9591002  memset( m_pbSDCFlag,            0, sizeof(Bool) * m_uiNumPartition  );
     1003#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     1004  for( Int i = 0; i < 4; i++ )
     1005  {
     1006    memset( m_apSegmentDCOffset[i], 0, sizeof(Pel) * m_uiNumPartition   );
     1007  }
     1008#else
    9601009  memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition   );
    9611010  memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition   );
    9621011#endif
    9631012#endif
    964 #if H_3D_INTER_SDC
     1013#endif
     1014#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    9651015  memset( m_pbInterSDCFlag,           0, sizeof( Bool ) * m_uiNumPartition );
    9661016  for( Int i = 0; i < 4; i++ )
     
    10441094#if H_3D_DIM_SDC
    10451095      m_pbSDCFlag           [ui] = pcCU->m_pbSDCFlag            [ uiPartOffset + ui ];
     1096#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     1097      for( Int i = 0; i < 4; i++ )
     1098      {
     1099        m_apSegmentDCOffset[i][ui] = pcCU->m_apSegmentDCOffset[i] [ uiPartOffset + ui ];
     1100      }
     1101#else
    10461102      m_apSegmentDCOffset[0][ui] = pcCU->m_apSegmentDCOffset[0] [ uiPartOffset + ui ];
    10471103      m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1] [ uiPartOffset + ui ];
    10481104#endif
    10491105#endif
    1050 #if H_3D_INTER_SDC
     1106#endif
     1107#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    10511108      m_pbInterSDCFlag      [ui] = pcCU->m_pbInterSDCFlag    [ uiPartOffset + ui ];
    10521109      for( Int i = 0; i < 4; i++ )
     
    12081265#if H_3D_DIM_SDC
    12091266  m_pbSDCFlag               = pcCU->getSDCFlag()              + uiPart;
     1267#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     1268  for( Int i = 0; i < 4; i++ )
     1269  {
     1270    m_apSegmentDCOffset[i]    = pcCU->getSDCSegmentDCOffset(i)  + uiPart;
     1271  }
     1272#else
    12101273  m_apSegmentDCOffset[0]    = pcCU->getSDCSegmentDCOffset(0)  + uiPart;
    12111274  m_apSegmentDCOffset[1]    = pcCU->getSDCSegmentDCOffset(1)  + uiPart;
    12121275#endif
    12131276#endif 
    1214 #if H_3D_INTER_SDC
     1277#endif 
     1278#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    12151279  m_pbInterSDCFlag          = pcCU->getInterSDCFlag()       + uiPart;
    12161280  for( Int i = 0; i < 4; i++ )
     
    14201484#if H_3D_DIM_SDC
    14211485  memcpy( m_pbSDCFlag             + uiOffset, pcCU->getSDCFlag(),             iSizeInBool  );
     1486#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     1487  for( Int i = 0; i < 4; i++ )
     1488  {
     1489    memcpy( m_apSegmentDCOffset[i]  + uiOffset, pcCU->getSDCSegmentDCOffset(i), sizeof( Pel ) * uiNumPartition);
     1490  }
     1491#else
    14221492  memcpy( m_apSegmentDCOffset[0]  + uiOffset, pcCU->getSDCSegmentDCOffset(0), sizeof( Pel ) * uiNumPartition);
    14231493  memcpy( m_apSegmentDCOffset[1]  + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition);
    14241494#endif
    14251495#endif
    1426 #if H_3D_INTER_SDC
     1496#endif
     1497#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    14271498  memcpy( m_pbInterSDCFlag  + uiOffset, pcCU->getInterSDCFlag(),      iSizeInBool  );
    14281499  for( Int i = 0; i < 4; i++ )
     
    15501621#if H_3D_DIM_SDC
    15511622  memcpy( rpcCU->getSDCFlag()             + m_uiAbsIdxInLCU, m_pbSDCFlag,      iSizeInBool  );
     1623#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     1624  for( Int i = 0; i < 4; i++ )
     1625  {
     1626    memcpy( rpcCU->getSDCSegmentDCOffset(i) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[i], sizeof( Pel ) * m_uiNumPartition);
     1627  }
     1628#else
    15521629  memcpy( rpcCU->getSDCSegmentDCOffset(0) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[0], sizeof( Pel ) * m_uiNumPartition);
    15531630  memcpy( rpcCU->getSDCSegmentDCOffset(1) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition);
    15541631#endif
    15551632#endif
    1556 #if H_3D_INTER_SDC
     1633#endif
     1634#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    15571635  memcpy( rpcCU->getInterSDCFlag() + m_uiAbsIdxInLCU, m_pbInterSDCFlag,      iSizeInBool  );
    15581636  for( Int i = 0;i < 4; i++ )
     
    16671745#if H_3D_DIM_SDC
    16681746  memcpy( rpcCU->getSDCFlag()             + uiPartOffset, m_pbSDCFlag,      iSizeInBool  );
     1747#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     1748  for( Int i = 0; i < 4; i++ )
     1749  {
     1750    memcpy( rpcCU->getSDCSegmentDCOffset(i) + uiPartOffset, m_apSegmentDCOffset[i], sizeof( Pel ) * uiQNumPart);
     1751  }
     1752#else
    16691753  memcpy( rpcCU->getSDCSegmentDCOffset(0) + uiPartOffset, m_apSegmentDCOffset[0], sizeof( Pel ) * uiQNumPart);
    16701754  memcpy( rpcCU->getSDCSegmentDCOffset(1) + uiPartOffset, m_apSegmentDCOffset[1], sizeof( Pel ) * uiQNumPart);
    16711755#endif
    16721756#endif
    1673 #if H_3D_INTER_SDC
     1757#endif
     1758#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    16741759  memcpy( rpcCU->getInterSDCFlag() + uiPartOffset, m_pbInterSDCFlag,      iSizeInBool  );
    16751760  for( Int i = 0; i < 4; i++ )
     
    25042589
    25052590#if H_3D_INTER_SDC
     2591#if !QC_SDC_UNIFY_G0130
    25062592Void TComDataCU::setInterSDCFlagSubParts ( Bool bInterSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    25072593{
     
    25132599  return 0;
    25142600}
    2515 
     2601#endif
     2602
     2603#if !SEC_INTER_SDC_G0101
    25162604Void TComDataCU::xSetInterSDCCUMask( TComDataCU *pcCU, UChar *pMask )
    25172605{
     
    26112699}
    26122700#endif
     2701#endif
     2702
     2703#if QC_GENERIC_SDC_G0122
     2704UInt TComDataCU::getCtxSDCFlag( UInt uiAbsPartIdx )
     2705{
     2706#if QC_SDC_UNIFY_G0130
     2707  return 0;
     2708#else
     2709  TComDataCU* pcTempCU;
     2710  UInt        uiTempPartIdx;
     2711  UInt        uiCtx = 0;
     2712
     2713  // Get BCBP of left PU
     2714  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     2715  uiCtx    = ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? pcTempCU->getSDCFlag( uiTempPartIdx ) : 0;
     2716
     2717  // Get BCBP of above PU
     2718  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     2719  uiCtx   += ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? pcTempCU->getSDCFlag( uiTempPartIdx ) : 0;
     2720
     2721  return uiCtx;
     2722#endif
     2723}
     2724
     2725UInt TComDataCU::getCtxAngleFlag( UInt uiAbsPartIdx )
     2726{
     2727  TComDataCU* pcTempCU;
     2728  UInt        uiTempPartIdx;
     2729  UInt        uiCtx = 0;
     2730
     2731  // Get BCBP of left PU
     2732  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     2733  uiCtx    = ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? ( pcTempCU->getLumaIntraDir( uiTempPartIdx ) < NUM_INTRA_MODE ? 1 : 0 ) : 0;
     2734
     2735  // Get BCBP of above PU
     2736  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     2737  uiCtx   += ( pcTempCU && pcTempCU->isIntra( uiTempPartIdx ) ) ? ( pcTempCU->getLumaIntraDir( uiTempPartIdx ) < NUM_INTRA_MODE ? 1 : 0 ) : 0;
     2738
     2739  return uiCtx;
     2740}
     2741#endif
    26132742
    26142743UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx )
     
    28382967  if( !getSlice()->getIsDepth() || !isIntra(uiAbsPartIdx) || getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N )
    28392968    return false;
    2840  
     2969#if QC_GENERIC_SDC_G0122
     2970  if( isDimMode( getLumaIntraDir( uiAbsPartIdx ) ) && !isDimDeltaDC( getLumaIntraDir( uiAbsPartIdx ) ) )
     2971  {
     2972    return true;
     2973  }
     2974 
     2975  if( getLumaIntraDir( uiAbsPartIdx ) < NUM_INTRA_MODE )
     2976  {
     2977    return true;
     2978  }
     2979
     2980  return false;
     2981#endif
    28412982  // check prediction mode
    28422983  UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx ); 
  • branches/HTM-9.3-dev0/source/Lib/TLibCommon/TComDataCU.h

    r826 r827  
    232232#if H_3D_DIM_SDC
    233233  Bool*         m_pbSDCFlag;
     234#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     235  Pel*          m_apSegmentDCOffset[4];
     236#else
    234237  Pel*          m_apSegmentDCOffset[2];
    235238#endif
    236239#endif
     240#endif
    237241#if H_3D_INTER_SDC
     242#if !QC_SDC_UNIFY_G0130
    238243  Bool*         m_pbInterSDCFlag;
    239244  Int*          m_apSegmentInterDCOffset[4];
     245#endif
     246#if !SEC_INTER_SDC_G0101
    240247  UChar*        m_pucInterSDCMask;
     248#endif
    241249#endif
    242250#if H_3D_DBBP
     
    619627  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
    620628  Void          setSDCSegmentDCOffset( Pel pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentDCOffset[uiSeg][uiPartIdx] = pOffset; }
     629#if QC_GENERIC_SDC_G0122
     630  UInt          getCtxSDCFlag          ( UInt   uiAbsPartIdx );
     631  UInt          getCtxAngleFlag        ( UInt   uiAbsPartIdx );
     632#endif
    621633#endif
    622634#endif
    623635#if H_3D_INTER_SDC
     636#if !QC_SDC_UNIFY_G0130
    624637  Bool*         getInterSDCFlag     ()                        { return m_pbInterSDCFlag;               }
    625638  Bool          getInterSDCFlag     ( UInt uiIdx )            { return m_pbInterSDCFlag[uiIdx];        }
     
    630643  Void          setInterSDCSegmentDCOffset( Int pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentInterDCOffset[uiSeg][uiPartIdx] = pOffset; }
    631644
     645#endif
     646#if !SEC_INTER_SDC_G0101
    632647  Void          xSetInterSDCCUMask( TComDataCU *pcCU, UChar *pMask );
    633648
    634649  UChar*        getInterSDCMask     ()                        { return m_pucInterSDCMask;              }
     650#endif
    635651#endif
    636652 
  • branches/HTM-9.3-dev0/source/Lib/TLibCommon/TComPrediction.cpp

    r821 r827  
    416416
    417417#if H_3D_DIM
    418 Void TComPrediction::predIntraLumaDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc )
     418Void TComPrediction::predIntraLumaDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc
     419#if QC_GENERIC_SDC_G0122
     420  , TComWedgelet* dmm4Segmentation
     421#endif
     422  )
    419423{
    420424  assert( iWidth == iHeight  );
     
    442446    case( DMM4_IDX ):
    443447      {
     448#if QC_GENERIC_SDC_G0122
     449        if( dmm4Segmentation == NULL )
     450        {
     451          dmmSegmentation = new TComWedgelet( iWidth, iHeight );
     452          xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmmSegmentation );
     453        }
     454        else
     455        {
     456          xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmm4Segmentation );
     457          dmmSegmentation = dmm4Segmentation;
     458        }
     459#else
    444460        dmmSegmentation = new TComWedgelet( iWidth, iHeight );
    445461        xPredContourFromTex( pcCU, uiAbsPartIdx, iWidth, iHeight, dmmSegmentation );
     462#endif
    446463      } break;
    447464    default: assert(0);
     
    494511
    495512#if H_3D_DIM_DMM
     513#if QC_GENERIC_SDC_G0122
     514  if( dimType == DMM4_IDX && dmm4Segmentation == NULL ) { dmmSegmentation->destroy(); delete dmmSegmentation; }
     515#else
    496516  if( dimType == DMM4_IDX ) { dmmSegmentation->destroy(); delete dmmSegmentation; }
     517#endif
    497518#endif
    498519}
     
    24642485  if( bL == bT )
    24652486  {
     2487#if SCU_HS_DEPTH_DC_PRED_G0143
     2488    const Int  iTRR = ( patternStride * 2 - 1  ) - srcStride;
     2489    const Int  iLBB = ( patternStride * 2 - 1  ) * srcStride - 1;
     2490    refDC1 = bL ? ( ptrSrc[iTR] + ptrSrc[iLB] )>>1 : (abs(ptrSrc[iTRR] - ptrSrc[-(Int)srcStride]) > abs(ptrSrc[iLBB] - ptrSrc[ -1]) ? ptrSrc[iTRR] : ptrSrc[iLBB]);
     2491#else
    24662492    refDC1 = bL ? ( ptrSrc[iTR] + ptrSrc[iLB] )>>1 : 1<<( g_bitDepthY - 1 );
     2493#endif
    24672494    refDC2 =      ( ptrSrc[ -1] + ptrSrc[-(Int)srcStride] )>>1;
    24682495  }
     
    25662593  Int iSumPix[2];
    25672594  memset(iSumPix, 0, sizeof(Int)*2);
    2568  
     2595#if QC_GENERIC_SDC_G0122
     2596  for( Int i = 0; i < uiNumSegments; i++ )
     2597  {
     2598    rpSegMeans[i] = 0;
     2599  }
     2600#endif
    25692601  if (orgDC == false)
    25702602  {
     
    25812613      rpSegMeans[ucSegmentRB] = pOrig[uiStride * (uiSize-1) + (uiSize-1) ];
    25822614    }
     2615#if QC_GENERIC_SDC_G0122
     2616    else if( getDimType( uiIntraMode ) == DMM4_IDX )
     2617    {
     2618      Pel *ptmpOrig = pOrig;
     2619      Bool *ptmpMask = pMask, bBreak = false;
     2620      UChar ucSegment = ptmpMask? (UChar) ptmpMask[0] : 0;
     2621      UChar bFirstSeg = ucSegment;
     2622
     2623      rpSegMeans[ucSegment] = ptmpOrig[0];
     2624      for ( Int y = 0; y < uiSize; y++ )
     2625      {
     2626        for ( Int x = 0; x < uiSize; x++ )
     2627        {
     2628          ucSegment = ptmpMask[x];
     2629          assert( ucSegment < uiNumSegments );
     2630
     2631          if( bFirstSeg != ucSegment )
     2632          {
     2633            rpSegMeans[ucSegment] = ptmpOrig[x];
     2634            bBreak = true;
     2635            break;
     2636          }
     2637        }
     2638
     2639        if( bBreak )
     2640        {
     2641          break;
     2642        }
     2643
     2644        ptmpOrig  += uiStride;
     2645        ptmpMask  += uiMaskStride;
     2646      }
     2647    }
     2648    else
     2649#else
    25832650    else if (uiIntraMode == PLANAR_IDX)
     2651#endif
    25842652    {
    25852653      Pel* pLeftTop = pOrig;
  • branches/HTM-9.3-dev0/source/Lib/TLibCommon/TComPrediction.h

    r816 r827  
    171171#if H_3D_DIM
    172172  // Depth intra
    173   Void predIntraLumaDepth         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false );
     173  Void predIntraLumaDepth         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiIntraMode, Pel* piPred, UInt uiStride, Int iWidth, Int iHeight, Bool bFastEnc = false
     174#if QC_GENERIC_SDC_G0122
     175    , TComWedgelet* dmm4Segmentation = NULL
     176#endif
     177    );
    174178#if H_3D_DIM_SDC
    175179  Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
  • branches/HTM-9.3-dev0/source/Lib/TLibCommon/TComRdCost.cpp

    r823 r827  
    637637  cDtParam.uiComp       = 255;    // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed.
    638638
     639#if SCU_HS_VSD_BUGFIX_IMPROV_G0163
     640  cDtParam.bitDepth   = g_bitDepthY;
     641#endif
    639642  Dist dist = cDtParam.DistFunc( &cDtParam );
    640643
     
    30213024  dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff;
    30223025
     3026#if SCU_HS_VSD_BUGFIX_IMPROV_G0163
     3027  Double dDepthWeight = ( pOrg[x] >=  ( (1<<(g_bitDepthY - 3)) + (1<<(g_bitDepthY - 2)) ) ? 4 : pOrg[x] > ((1<<g_bitDepthY) >> 4) ? (Float)(pOrg[x] - ((1<<g_bitDepthY) >> 4))/(Float)((1<<g_bitDepthY) >> 3) + 1 : 1.0 );
     3028  Double dTemp = ( 0.5 * fabs(dD) * dDepthWeight * ( abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x-1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x+1+y*iVirStride ] ) ) );
     3029#else
    30233030  Double dTemp = ( 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 ] ) ) );
     3031#endif 
    30243032  iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));
    30253033
  • branches/HTM-9.3-dev0/source/Lib/TLibCommon/TypeDef.h

    r826 r827  
    227227#endif
    228228
     229#define SCU_HS_VSD_BUGFIX_IMPROV_G0163    1
    229230////   ****** NEIGHBOURING BLOCK-BASED DISPARITY VECTOR  *********
    230231#if H_3D_NBDV
     
    253254#define H_3D_DIM_DLT                      1   // Depth Lookup Table
    254255
     256#define SCU_HS_DEPTH_DC_PRED_G0143        1
    255257#if H_3D_DIM_DLT
    256258#define H_3D_DELTA_DLT                    1
    257259#endif
    258 
     260#define QC_GENERIC_SDC_G0122              1  // Generalize SDC to all depth intra modes
     261#if H_3D_DIM_SDC && H_3D_INTER_SDC
     262#define QC_SDC_UNIFY_G0130                1  // Unify intra SDC and inter SDC
     263#define QC_SDC_UNIFY_G0130_FIX            1  // Fix bug of G0130
     264#endif
     265#define SEC_INTER_SDC_G0101               1  // Improved inter SDC with multiple DC candidates
    259266#define H_3D_DIM_ENC                      1   // Depth Intra encoder optimizations, includes:
    260267                                              // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
    261268                                              // LG_ZEROINTRADEPTHRESI_A0087
     269#endif
     270#define QC_PKU_SDC_SPLIT_G0123            1   // Intra SDC Split
     271#if QC_PKU_SDC_SPLIT_G0123
     272#define HS_TSINGHUA_SDC_SPLIT_G0111       1
    262273#endif
    263274///// ***** VIEW SYNTHESIS PREDICTION *********
  • branches/HTM-9.3-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r816 r827  
    27872787#endif
    27882788#if H_3D_INTER_SDC
     2789#if QC_SDC_UNIFY_G0130
     2790Void TDecCavlc::parseDeltaDC( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
     2791{
     2792  assert(0);
     2793}
     2794
     2795Void TDecCavlc::parseSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2796{
     2797  assert(0);
     2798}
     2799#else
    27892800Void TDecCavlc::parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    27902801{
     
    27962807  assert(0);
    27972808}
     2809#endif
    27982810#endif
    27992811#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibDecoder/TDecCAVLC.h

    r816 r827  
    124124#endif
    125125#if H_3D_INTER_SDC
     126#if QC_SDC_UNIFY_G0130
     127  Void  parseDeltaDC        ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
     128  Void  parseSDCFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     129#else
    126130  Void  parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    127131  Void  parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
     132#endif
    128133#endif
    129134#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibDecoder/TDecCu.cpp

    r826 r827  
    551551  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    552552
     553#if QC_SDC_UNIFY_G0130
     554  m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     555#endif
    553556  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
    554557  {
     
    570573  // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
    571574  m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
    572 #if H_3D_INTER_SDC
     575#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    573576  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
    574577#endif
     
    649652#endif
    650653#if H_3D_INTER_SDC
     654#if QC_SDC_UNIFY_G0130
     655      if( m_ppcCU[uiDepth]->getSDCFlag( 0 ) )
     656#else
    651657      if( m_ppcCU[uiDepth]->getInterSDCFlag( 0 ) )
     658#endif
    652659      {
    653660        xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     
    712719  UInt  uiWidth      = pcCU->getWidth ( 0 );
    713720  UInt  uiHeight     = pcCU->getHeight( 0 );
     721#if !SEC_INTER_SDC_G0101
    714722  UChar* pMask       = pcCU->getInterSDCMask();
    715723
    716724  memset( pMask, 0, uiWidth*uiHeight );
    717725  pcCU->xSetInterSDCCUMask( pcCU, pMask );
     726#endif
    718727
    719728  Pel  *pResi;
     
    726735    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
    727736    {
     737#if SEC_INTER_SDC_G0101
     738      pResi[ uiPelX ] = pcCU->getSDCSegmentDCOffset( 0, 0 );
     739#else
    728740      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
    729 
    730       pResi[ uiPelX ] = pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 );;
     741#if QC_SDC_UNIFY_G0130
     742      pResi[ uiPelX ] = pcCU->getSDCSegmentDCOffset( uiSeg, 0 );
     743#else
     744      pResi[ uiPelX ] = pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 );
     745#endif
     746#endif
    731747    }
    732748    pResi += uiResiStride;
     
    10721088  UInt uiWidth        = pcCU->getWidth  ( 0 );
    10731089  UInt uiHeight       = pcCU->getHeight ( 0 );
    1074  
     1090#if QC_PKU_SDC_SPLIT_G0123
     1091#if HS_TSINGHUA_SDC_SPLIT_G0111
     1092#if QC_GENERIC_SDC_G0122
     1093  TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight );
     1094#endif
     1095#else
     1096#if QC_GENERIC_SDC_G0122
     1097  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     1098#endif
     1099#endif
     1100#endif
     1101#if QC_PKU_SDC_SPLIT_G0123
     1102  UInt numParts = 1;
     1103  UInt i = 0;
     1104  UInt sdcDepth    = 0;
     1105  TComYuv* pcRecoYuv  = m_ppcYuvReco[uiDepth];
     1106  TComYuv* pcPredYuv  = m_ppcYuvReco[uiDepth];
     1107  TComYuv* pcResiYuv  = m_ppcYuvResi[uiDepth];
     1108
     1109  UInt    uiStride = 0;
     1110  Pel*    piReco;
     1111  Pel*    piPred;
     1112  Pel*    piResi;
     1113
     1114  UInt    uiZOrder;       
     1115  Pel*    piRecIPred;     
     1116  UInt    uiRecIPredStride;
     1117
     1118  UInt    uiLumaPredMode = 0; 
     1119
     1120#if HS_TSINGHUA_SDC_SPLIT_G0111
     1121  if ((uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize()) > 1)
     1122  {
     1123    numParts = uiWidth * uiWidth >> (2 * pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize());
     1124    sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();
     1125    uiWidth = uiHeight = (1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize());
     1126  }
     1127#else
     1128  if (uiWidth == 64)
     1129  {
     1130    numParts = 4;
     1131    sdcDepth = 1;
     1132    uiWidth = uiHeight = 32;
     1133  }
     1134#endif
     1135
     1136  for ( i = 0; i < numParts; i++ )
     1137  {
     1138    uiStride    = pcRecoYuv->getStride  ();
     1139    piReco      = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
     1140    piPred      = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1141    piResi      = pcResiYuv->getLumaAddr( uiAbsPartIdx );
     1142 
     1143    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     1144    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     1145    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     1146
     1147    uiLumaPredMode    = pcCU->getLumaIntraDir     ( uiAbsPartIdx );
     1148
     1149    AOF( uiWidth == uiHeight );
     1150#else
    10751151  TComYuv* pcRecoYuv  = m_ppcYuvReco[uiDepth];
    10761152  TComYuv* pcPredYuv  = m_ppcYuvReco[uiDepth];
     
    10921168  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
    10931169  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
     1170#endif
    10941171 
    10951172  //===== init availability pattern =====
    10961173  Bool  bAboveAvail = false;
    10971174  Bool  bLeftAvail  = false;
     1175#if QC_PKU_SDC_SPLIT_G0123
     1176  pcCU->getPattern()->initPattern   ( pcCU, sdcDepth, uiAbsPartIdx );
     1177  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail );
     1178#else
    10981179  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
    10991180  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail );
    1100  
     1181#endif
     1182#if !QC_PKU_SDC_SPLIT_G0123
     1183#if QC_GENERIC_SDC_G0122
     1184  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     1185#endif
     1186#endif
     1187#if HS_TSINGHUA_SDC_SPLIT_G0111
     1188  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     1189#endif
    11011190  //===== get prediction signal =====
    11021191#if H_3D_DIM
    11031192  if( isDimMode( uiLumaPredMode ) )
    11041193  {
    1105     m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
     1194    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight
     1195#if QC_GENERIC_SDC_G0122
     1196      , false, dmm4Segmentation
     1197#endif
     1198      );
     1199#if HS_TSINGHUA_SDC_SPLIT_G0111
     1200    Bool* dmm4PatternSplit = dmm4Segmentation->getPattern();
     1201    Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern();
     1202    for( UInt k = 0; k < (uiWidth*uiHeight); k++ )
     1203    {
     1204      dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k];
     1205    }
     1206#endif
    11061207  }
    11071208  else
     
    11121213  }
    11131214#endif
    1114  
     1215#if QC_PKU_SDC_SPLIT_G0123
     1216    if ( numParts > 1 )
     1217    {
     1218      for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     1219      {
     1220        for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1221        {
     1222          piReco        [ uiX ] = ClipY( piPred[ uiX ] );
     1223          piRecIPred    [ uiX ] = piReco[ uiX ];
     1224        }
     1225        piPred     += uiStride;
     1226        piReco     += uiStride;
     1227        piRecIPred += uiRecIPredStride;
     1228      }
     1229    }
     1230    uiAbsPartIdx += ( (uiWidth * uiWidth) >> 4 );
     1231#if HS_TSINGHUA_SDC_SPLIT_G0111
     1232    dmm4Segmentation->destroy(); delete dmm4Segmentation;
     1233#endif
     1234  }
     1235  uiAbsPartIdx = 0;
     1236 
     1237  if ( numParts > 1 )
     1238  {
     1239    uiWidth = pcCU->getWidth( 0 );
     1240    uiHeight = pcCU->getHeight( 0 );
     1241  }
     1242  piReco      = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
     1243  piPred      = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1244  piResi      = pcResiYuv->getLumaAddr( uiAbsPartIdx );
     1245  uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     1246  piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     1247  uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     1248#endif
    11151249  // number of segments depends on prediction mode
    11161250  UInt uiNumSegments = 1;
     
    11291263    uiMaskStride = pcWedgelet->getStride();
    11301264  }
    1131  
     1265#if QC_GENERIC_SDC_G0122
     1266  if( getDimType( uiLumaPredMode ) == DMM4_IDX )
     1267  {
     1268    uiNumSegments = 2;
     1269#if HS_TSINGHUA_SDC_SPLIT_G0111
     1270    pbMask  = dmm4SegmentationOrg->getPattern();
     1271    uiMaskStride = dmm4SegmentationOrg->getStride();
     1272#else
     1273    pbMask  = dmm4Segmentation->getPattern();
     1274    uiMaskStride = dmm4Segmentation->getStride();
     1275#endif
     1276  }
     1277#endif
    11321278  // get DC prediction for each segment
    11331279  Pel apDCPredValues[2];
     
    11911337    pRecCr += uiStrideC;
    11921338  }
     1339#if QC_GENERIC_SDC_G0122
     1340#if HS_TSINGHUA_SDC_SPLIT_G0111
     1341  dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg;
     1342#else
     1343  dmm4Segmentation->destroy(); delete dmm4Segmentation;
     1344#endif
     1345#endif
    11931346}
    11941347#endif
  • branches/HTM-9.3-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp

    r826 r827  
    797797  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    798798  UInt uiChromaOffset = uiLumaOffset>>2;
    799  
     799#if QC_SDC_UNIFY_G0130
    800800#if H_3D_DIM_SDC
    801   if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     801  if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) )
    802802  {
    803803    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     
    806806    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
    807807    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
     808  }
     809#endif
     810
     811#if H_3D_INTER_SDC
     812  if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) )
     813  {
     814    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
     815    assert( !pcCU->isIntra( uiAbsPartIdx) );
     816    assert( pcCU->getSlice()->getIsDepth() );
     817  }
     818#endif
     819#if QC_SDC_UNIFY_G0130_FIX
     820  if( pcCU->getSlice()->getIsDepth() && ( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) ) )
     821#else
     822  if( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) )
     823#endif
     824  {
     825    Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;
     826    UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;
     827 
     828    if( !pcCU->getSDCFlag( uiAbsPartIdx ) )
     829    {
     830      for( Int iPart = 0; iPart < iPartNum; iPart++ )
     831      {
     832        if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE )
     833        {
     834          m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart, uiDepth + ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) );
     835        }
     836      }
     837    }
     838    else
     839    {
     840      m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx, uiDepth );
     841      return;
     842    }
     843  }
     844#else
     845#if H_3D_DIM_SDC
     846  if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     847  {
     848    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     849    assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );
     850    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );
     851    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
     852    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
    808853    return;
    809854  }
     
    821866  }
    822867#endif
     868#endif
    823869
    824870  if( pcCU->isIntra(uiAbsPartIdx) )
     
    844890
    845891#if H_3D_INTER_SDC
     892#if QC_SDC_UNIFY_G0130
     893Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     894{
     895  pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );
     896
     897  if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) ||
     898    ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )
     899  {
     900    return;
     901  }
     902
     903#if SEC_INTER_SDC_G0101
     904  if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )
     905#else
     906  if( !pcCU->getSlice()->getIsDepth() || ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N ) || pcCU->isSkipped( uiAbsPartIdx ) )
     907#endif
     908  {
     909    return;
     910  }
     911
     912#if SEC_INTER_SDC_G0101
     913  assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );
     914#else
     915  assert( ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );
     916#endif
     917
     918  m_pcEntropyDecoderIf->parseSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     919}
     920
     921#else
    846922Void TDecEntropy::decodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    847923{
     
    882958}
    883959#endif
    884 
     960#endif
    885961#if H_3D_DBBP
    886962Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
  • branches/HTM-9.3-dev0/source/Lib/TLibDecoder/TDecEntropy.h

    r816 r827  
    9696#endif
    9797#if H_3D_INTER_SDC
     98#if QC_SDC_UNIFY_G0130
     99  virtual Void parseDeltaDC       ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) = 0;
     100  virtual Void parseSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     101#else
    98102  virtual Void parseInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    99103  virtual Void parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) = 0;
     104#endif
    100105#endif
    101106#if H_3D_DBBP
     
    182187#endif
    183188#if H_3D_INTER_SDC
     189#if QC_SDC_UNIFY_G0130
     190  Void decodeSDCFlag           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     191#else
    184192  Void decodeInterSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    185193  Void decodeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    186194#endif
     195#endif
    187196#if H_3D_DBBP
    188197  Void decodeDBBPFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
  • branches/HTM-9.3-dev0/source/Lib/TLibDecoder/TDecSbac.cpp

    r826 r827  
    8787, m_cDdcFlagSCModel           ( 1,             1,               NUM_DDC_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    8888, m_cDdcDataSCModel           ( 1,             1,               NUM_DDC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     89#if QC_GENERIC_SDC_G0122
     90, m_cAngleFlagSCModel         ( 1,             1,               NUM_ANGLE_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
     91#if !QC_SDC_UNIFY_G0130
     92, m_cIntraSdcFlagSCModel      ( 1,             1,               NUM_INTRASDC_FLAG_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
     93#endif
     94#endif
    8995#if H_3D_DIM_DMM
    9096, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     
    95101#endif
    96102#endif
    97 #if H_3D_INTER_SDC
     103#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    98104, m_cInterSDCFlagSCModel             ( 1,             1,  NUM_INTER_SDC_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
    99105, m_cInterSDCResidualSCModel         ( 1,             1,  NUM_INTER_SDC_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
    100106, m_cInterSDCResidualSignFlagSCModel ( 1,             1,  NUM_INTER_SDC_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     107#endif
     108#if QC_SDC_UNIFY_G0130
     109, m_cSDCFlagSCModel                  ( 1,             1,  NUM_SDC_FLAG_CTX                 , m_contextModels + m_numContextModels, m_numContextModels)
    101110#endif
    102111#if H_3D_DBBP
     
    173182  m_cDdcFlagSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DDC_FLAG );
    174183  m_cDdcDataSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DDC_DATA );
     184#if QC_GENERIC_SDC_G0122
     185  m_cAngleFlagSCModel.initBuffer         ( sliceType, qp, (UChar*)INIT_ANGLE_FLAG );
     186#if !QC_SDC_UNIFY_G0130
     187  m_cIntraSdcFlagSCModel.initBuffer      ( sliceType, qp, (UChar*)INIT_INTRASDC_FLAG );
     188#endif
     189#endif
    175190#if H_3D_DIM_DMM
    176191  m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
     
    181196#endif
    182197#endif
    183 #if H_3D_INTER_SDC
     198#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    184199  m_cInterSDCFlagSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
    185200  m_cInterSDCResidualSCModel.initBuffer   ( sliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    186201  m_cInterSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     202#endif
     203#if QC_SDC_UNIFY_G0130
     204  m_cSDCFlagSCModel.initBuffer            ( sliceType, qp, (UChar*)INIT_SDC_FLAG );
    187205#endif
    188206#if H_3D_DBBP
     
    245263  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    246264  m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
     265#if QC_GENERIC_SDC_G0122
     266  m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
     267#if !QC_SDC_UNIFY_G0130
     268  m_cIntraSdcFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_INTRASDC_FLAG );
     269#endif
     270#endif
    247271#if H_3D_DIM_DMM
    248272  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    253277#endif
    254278#endif
    255 #if H_3D_INTER_SDC
     279#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    256280  m_cInterSDCFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    257281  m_cInterSDCResidualSCModel.initBuffer   ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    258282  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     283#endif
     284#if QC_SDC_UNIFY_G0130
     285  m_cSDCFlagSCModel.initBuffer            ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
    259286#endif
    260287#if H_3D_DBBP
     
    10181045    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    10191046#if H_3D_DIM_SDC
     1047#if QC_GENERIC_SDC_G0122
     1048      if( 1 ) // This should be cleaned up.
     1049#else
    10201050      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1051#endif
    10211052#endif
    10221053    {
     
    10361067    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    10371068#if H_3D_DIM_SDC
     1069#if QC_GENERIC_SDC_G0122
     1070      if( 1 )  // This should be cleaned up.
     1071#else
    10381072      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1073#endif
    10391074#endif
    10401075    {
     
    11391174  }
    11401175
     1176#if !QC_SDC_UNIFY_G0130
    11411177  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
    11421178  {
    11431179    UInt symbol;
     1180#if QC_GENERIC_SDC_G0122
     1181    UInt uiNumSegments = isDimMode( dir ) ? 2 : 1;
     1182#else
    11441183    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1184#endif
    11451185
    11461186    if( pcCU->getSDCFlag( absPartIdx ) )
     
    11781218    }
    11791219  }
    1180 
     1220#endif
    11811221  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
    11821222}
    11831223
     1224#if QC_GENERIC_SDC_G0122
     1225Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
     1226{
     1227  UInt uiSymbol, uiIsDimMode;
     1228
     1229  if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed
     1230  {
     1231    m_pcTDecBinIf->decodeBin( uiSymbol, m_cAngleFlagSCModel.get( 0, 0, pcCU->getCtxAngleFlag( absPartIdx ) ) );
     1232  }
     1233  else
     1234  {
     1235    uiSymbol = 1;
     1236  }
     1237  uiIsDimMode = uiSymbol ? 0 : 1;
     1238  pcCU->setLumaIntraDirSubParts( 0, absPartIdx, depth );
     1239#if !QC_SDC_UNIFY_G0130
     1240  if( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N ) //SDC is allowed only in this case
     1241  {
     1242    m_pcTDecBinIf->decodeBin( uiSymbol, m_cIntraSdcFlagSCModel.get( 0, 0, pcCU->getCtxSDCFlag( absPartIdx ) ) );
     1243  }
     1244  else
     1245  {
     1246    uiSymbol = 0;
     1247  }
     1248
     1249  pcCU->setSDCFlagSubParts( uiSymbol, absPartIdx, depth );
     1250#endif
     1251  //decode DMM index
     1252  if( uiIsDimMode )
     1253  {
     1254    m_pcTDecBinIf->decodeBin( uiSymbol, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
     1255    if( !uiSymbol )
     1256    {
     1257      pcCU->setLumaIntraDirSubParts( ( 2 * DMM1_IDX + DIM_OFFSET ), absPartIdx, depth );
     1258    }
     1259    else
     1260    {
     1261      pcCU->setLumaIntraDirSubParts( ( 2 * DMM4_IDX + DIM_OFFSET ), absPartIdx, depth );
     1262    }
     1263  }
     1264}
     1265#else
    11841266Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
    11851267{
     
    12441326#endif
    12451327}
     1328#endif
    12461329#endif
    12471330
     
    21982281
    21992282#if H_3D_INTER_SDC
     2283#if QC_SDC_UNIFY_G0130
     2284Void TDecSbac::parseDeltaDC( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
     2285{
     2286  if( ! ( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) )
     2287  {
     2288    assert( 0 );
     2289  }
     2290
     2291  UInt symbol = 0;
     2292  UInt uiNumSegments = 0;
     2293
     2294  if( pcCU->isIntra( absPartIdx ) )
     2295  {
     2296    UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     2297    uiNumSegments = isDimMode( dir ) ? 2 : 1;
     2298
     2299    m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get( 0, 0, uiNumSegments-1 ) );
     2300
     2301    if( pcCU->getSDCFlag( absPartIdx ) )
     2302    {
     2303      assert( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N );
     2304      pcCU->setTrIdxSubParts( 0, absPartIdx, depth );
     2305      pcCU->setCbfSubParts( 1, 1, 1, absPartIdx, depth );
     2306    }
     2307    else
     2308    {
     2309      pcCU->setLumaIntraDirSubParts( dir + symbol, absPartIdx, depth );
     2310    }
     2311  }
     2312  else
     2313  {
     2314#if SEC_INTER_SDC_G0101
     2315    uiNumSegments = 1;
     2316#else
     2317    PartSize cPartSize = pcCU->getPartitionSize( absPartIdx );
     2318    uiNumSegments = ( cPartSize == SIZE_2Nx2N ) ? 1 : ( cPartSize == SIZE_NxN ? 4 : 2 );
     2319#endif
     2320    symbol = 1;
     2321  }
     2322
     2323
     2324  for( UInt segment = 0; segment < uiNumSegments; segment++ )
     2325  {
     2326    Pel valDeltaDC = 0;
     2327    if( symbol )
     2328    {
     2329      xParseDimDeltaDC( valDeltaDC, uiNumSegments );
     2330    }
     2331
     2332    if( pcCU->isIntra( absPartIdx ) )
     2333    {
     2334      UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     2335
     2336      if( pcCU->getSDCFlag( absPartIdx ) )
     2337      {
     2338        pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
     2339      }
     2340      else
     2341      {
     2342        pcCU->setDimDeltaDC( getDimType( dir ), segment, absPartIdx, valDeltaDC );
     2343      }
     2344    }
     2345    else
     2346    {
     2347      pcCU->setSDCSegmentDCOffset( valDeltaDC, segment, absPartIdx );
     2348    }
     2349  }
     2350}
     2351
     2352Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2353{
     2354  UInt uiSymbol = 0;
     2355  UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx );
     2356
     2357  m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) );
     2358
     2359  if( uiSymbol )
     2360  {
     2361    pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, uiDepth );
     2362    pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth );
     2363    pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth );
     2364  }
     2365  else
     2366  {
     2367    pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );
     2368  }
     2369}
     2370#else
    22002371Void TDecSbac::parseInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    22012372{
     
    22312402  pcCU->setInterSDCSegmentDCOffset( iIdx, uiSegment, uiAbsPartIdx );
    22322403}
     2404#endif
    22332405#endif
    22342406
  • branches/HTM-9.3-dev0/source/Lib/TLibDecoder/TDecSbac.h

    r816 r827  
    112112#endif
    113113#if H_3D_INTER_SDC
     114#if QC_SDC_UNIFY_G0130
     115  Void  parseDeltaDC         ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
     116  Void  parseSDCFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     117#else
    114118  Void  parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    115119  Void  parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
     120#endif
    116121#endif
    117122#if H_3D_DBBP
     
    214219  ContextModel3DBuffer m_cDdcFlagSCModel;
    215220  ContextModel3DBuffer m_cDdcDataSCModel;
     221#if QC_GENERIC_SDC_G0122
     222  ContextModel3DBuffer m_cAngleFlagSCModel;
     223#if !QC_SDC_UNIFY_G0130
     224  ContextModel3DBuffer m_cIntraSdcFlagSCModel;
     225#endif
     226#endif
    216227#if H_3D_DIM_DMM
    217228  ContextModel3DBuffer m_cDmm1DataSCModel;
     
    222233#endif
    223234#endif
    224 #if H_3D_INTER_SDC
     235#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    225236  ContextModel3DBuffer m_cInterSDCFlagSCModel;
    226237  ContextModel3DBuffer m_cInterSDCResidualSCModel;
    227238  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
    228239#endif
     240#if QC_SDC_UNIFY_G0130
     241  ContextModel3DBuffer m_cSDCFlagSCModel;
     242#endif
    229243#if H_3D_DBBP
    230244  ContextModel3DBuffer m_cDBBPFlagSCModel;
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp

    r816 r827  
    25272527
    25282528#if H_3D_INTER_SDC
     2529#if QC_SDC_UNIFY_G0130
     2530Void TEncCavlc::codeDeltaDC( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2531{
     2532  assert(0);
     2533}
     2534
     2535Void TEncCavlc::codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2536{
     2537  assert(0);
     2538}
     2539#else
    25292540Void TEncCavlc::codeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )
    25302541{
     
    25362547  assert(0);
    25372548}
     2549#endif
    25382550#endif
    25392551   
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncCavlc.h

    r816 r827  
    138138#endif
    139139#if H_3D_INTER_SDC
     140#if QC_SDC_UNIFY_G0130
     141  Void codeDeltaDC       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     142  Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     143#else
    140144  Void codeInterSDCFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    141145  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
     146#endif
    142147#endif
    143148#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncCu.cpp

    r826 r827  
    16401640  m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    16411641 
     1642#if QC_SDC_UNIFY_G0130
     1643  m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
     1644#endif
    16421645  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
    16431646  {
     
    16671670#endif
    16681671#endif
    1669 #if H_3D_INTER_SDC
     1672#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    16701673  m_pcEntropyCoder->encodeInterSDCFlag( pcCU, uiAbsPartIdx, false );
    16711674#endif
     
    20492052            rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    20502053            rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     2054#if H_3D_SPIVMP
    20512055          }
     2056#endif
    20522057       // do MC
    20532058       m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     
    20942099          if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
    20952100          {
     2101#if SEC_INTER_SDC_G0101
     2102            for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
     2103            {
     2104              if( rpcTempCU != rpcTempCUPre )
     2105              {
     2106                rpcTempCU->initEstData( uhDepth, orgQP );
     2107                rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2108              }
     2109              rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2110              rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2111              rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2112#if H_3D_VSO //M2
     2113              if( m_pcRdCost->getUseRenModel() )
     2114              { //Reset
     2115                UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
     2116                UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
     2117                Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
     2118                UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
     2119                m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2120              }
     2121#endif
     2122              m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2123                m_ppcOrigYuv[uhDepth],
     2124                ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2125                m_ppcResiYuvTemp[uhDepth],
     2126                m_ppcRecoYuvTemp[uhDepth],
     2127                uiOffest,
     2128                uhDepth );
     2129
     2130              xCheckDQP( rpcTempCU );
     2131              xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     2132            }
     2133#else
    20962134            if( rpcTempCU != rpcTempCUPre )
    20972135            {
     
    21212159            xCheckDQP( rpcTempCU );
    21222160            xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     2161#endif
    21232162          }
    21242163#endif
     
    23312370  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    23322371#if H_3D_INTER_SDC
     2372#if SEC_INTER_SDC_G0101 // ONLY_2NX2N_SDC
     2373  if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && ePartSize == SIZE_2Nx2N)
     2374#else
    23332375  if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() )
    2334   {
     2376#endif
     2377  {
     2378#if SEC_INTER_SDC_G0101
     2379    for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
     2380    {
     2381      if( rpcTempCU != rpcTempCUPre )
     2382      {
     2383        Int orgQP = rpcBestCU->getQP( 0 );
     2384        rpcTempCU->initEstData( uhDepth, orgQP );
     2385        rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2386      }
     2387      rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2388      rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2389      rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2390#if H_3D_VSO // M3
     2391      if( m_pcRdCost->getUseRenModel() )
     2392      {
     2393        UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     2394        UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     2395        Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     2396        UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     2397        m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2398      }
     2399#endif
     2400
     2401      m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2402        m_ppcOrigYuv[uhDepth],
     2403        ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2404        m_ppcResiYuvTemp[uhDepth],
     2405        m_ppcRecoYuvTemp[uhDepth],
     2406        uiOffest,
     2407        uhDepth );
     2408
     2409      xCheckDQP( rpcTempCU );
     2410      xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2411    }
     2412#else
    23352413    if( rpcTempCU != rpcTempCUPre )
    23362414    {
     
    23622440  xCheckDQP( rpcTempCU );
    23632441  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2442#endif
    23642443  }
    23652444#endif
     
    26052684  m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
    26062685  m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
     2686#if QC_SDC_UNIFY_G0130
     2687  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2688#endif
    26072689  m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0,          true );
    26082690  m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
     
    26942776  m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0,          true );
    26952777  m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true );
     2778#if QC_SDC_UNIFY_G0130
     2779  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2780#endif
    26962781  m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true );
    26972782
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp

    r826 r827  
    679679  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    680680  UInt uiChromaOffset = uiLumaOffset>>2;
    681    
     681#if QC_SDC_UNIFY_G0130
    682682#if H_3D_DIM_SDC
    683   if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     683  if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx ) )
    684684  {
    685685    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     
    688688    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
    689689    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
    690     return;
    691690  }
    692691#endif
    693692
    694693#if H_3D_INTER_SDC
    695   if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     694  if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx ) )
    696695  {
    697696    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
    698697    assert( !pcCU->isIntra( uiAbsPartIdx) );
    699698    assert( pcCU->getSlice()->getIsDepth() );
     699  }
     700#endif
     701#if QC_SDC_UNIFY_G0130_FIX
     702  if( pcCU->getSlice()->getIsDepth() && ( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) ) )
     703#else
     704  if( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) )
     705#endif
     706  {
     707    Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;
     708    UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;
     709   
     710    if( !pcCU->getSDCFlag( uiAbsPartIdx ) )
     711    {
     712      for( Int iPart = 0; iPart < iPartNum; iPart++ )
     713      {
     714        if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE )
     715        {
     716          m_pcEntropyCoderIf->codeDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart );
     717        }
     718      }
     719    }
     720    else
     721    {
     722      m_pcEntropyCoderIf->codeDeltaDC( pcCU, uiAbsPartIdx );
     723      return;
     724    }
     725  }
     726#else
     727#if H_3D_DIM_SDC
     728  if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     729  {
     730    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     731    assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );
     732    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );
     733    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
     734    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
     735    return;
     736  }
     737#endif
     738
     739#if H_3D_INTER_SDC
     740  if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     741  {
     742    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
     743    assert( !pcCU->isIntra( uiAbsPartIdx) );
     744    assert( pcCU->getSlice()->getIsDepth() );
    700745
    701746    encodeInterSDCResidualData( pcCU, uiAbsPartIdx, false );
    702747    return;
    703748  }
     749#endif
    704750#endif
    705751
     
    855901
    856902#if H_3D_INTER_SDC
     903#if QC_SDC_UNIFY_G0130
     904Void TEncEntropy::encodeDeltaDC  ( TComDataCU* pcCU, UInt absPartIdx )
     905{
     906  m_pcEntropyCoderIf->codeDeltaDC( pcCU, absPartIdx );
     907}
     908
     909Void TEncEntropy::encodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     910{
     911  if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) ||
     912    ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )
     913  {
     914    return;
     915  }
     916
     917#if SEC_INTER_SDC_G0101
     918  if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )
     919#else
     920  if( !pcCU->getSlice()->getIsDepth() || ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N ) || pcCU->isSkipped( uiAbsPartIdx ) )
     921#endif
     922  {
     923    return;
     924  }
     925
     926#if SEC_INTER_SDC_G0101
     927  assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );
     928#else
     929  assert( ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );
     930#endif
     931
     932  if( bRD )
     933  {
     934    uiAbsPartIdx = 0;
     935  }
     936
     937  m_pcEntropyCoderIf->codeSDCFlag( pcCU, uiAbsPartIdx );
     938}
     939#else
    857940Void TEncEntropy::encodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    858941{
     
    902985}
    903986#endif
    904 
     987#endif
    905988#if H_3D_DBBP
    906989Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncEntropy.h

    r816 r827  
    9595#endif
    9696#if H_3D_INTER_SDC
     97#if QC_SDC_UNIFY_G0130
     98  virtual Void codeDeltaDC       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     99  virtual Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     100#else
    97101  virtual Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    98102  virtual Void codeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) = 0;
     103#endif
    99104#endif
    100105#if H_3D_DBBP
     
    189194#endif
    190195#if H_3D_INTER_SDC
     196#if QC_SDC_UNIFY_G0130
     197  Void encodeDeltaDC      ( TComDataCU* pcCU, UInt absPartIdx );
     198  Void encodeSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     199#else
    191200  Void encodeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    192201  Void encodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD );
     202#endif
    193203#endif
    194204#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncSbac.cpp

    r826 r827  
    9393, m_cDdcFlagSCModel           ( 1,             1,               NUM_DDC_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    9494, m_cDdcDataSCModel           ( 1,             1,               NUM_DDC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     95#if QC_GENERIC_SDC_G0122
     96, m_cAngleFlagSCModel         ( 1,             1,               NUM_ANGLE_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
     97#if !QC_SDC_UNIFY_G0130
     98, m_cIntraSdcFlagSCModel      ( 1,             1,               NUM_INTRASDC_FLAG_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
     99#endif
     100#endif
    95101#if H_3D_DIM_DMM
    96102, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     
    101107#endif
    102108#endif
    103 #if H_3D_INTER_SDC
     109#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    104110, m_cInterSDCFlagSCModel             ( 1,             1,  NUM_INTER_SDC_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
    105111, m_cInterSDCResidualSCModel         ( 1,             1,  NUM_INTER_SDC_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
    106112, m_cInterSDCResidualSignFlagSCModel ( 1,             1,  NUM_INTER_SDC_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     113#endif
     114#if QC_SDC_UNIFY_G0130
     115, m_cSDCFlagSCModel                  ( 1,             1,  NUM_SDC_FLAG_CTX                 , m_contextModels + m_numContextModels, m_numContextModels)
    107116#endif
    108117#if H_3D_DBBP
     
    171180  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    172181  m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
     182#if QC_GENERIC_SDC_G0122
     183  m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
     184#if !QC_SDC_UNIFY_G0130
     185  m_cIntraSdcFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_INTRASDC_FLAG );
     186#endif
     187#endif
    173188#if H_3D_DIM_DMM
    174189  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    179194#endif
    180195#endif
    181 #if H_3D_INTER_SDC
     196#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    182197  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    183198  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    184199  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     200#endif
     201#if QC_SDC_UNIFY_G0130
     202  m_cSDCFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
    185203#endif
    186204#if H_3D_DBBP
     
    224242      curCost += m_cCUICFlagSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_IC_FLAG );
    225243#endif
    226 #if H_3D_INTER_SDC
     244#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    227245      curCost += m_cInterSDCFlagSCModel.calcCost      ( curSliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
    228246      curCost += m_cInterSDCResidualSCModel.calcCost  ( curSliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    229247      curCost += m_cInterSDCResidualSignFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     248#endif
     249#if QC_SDC_UNIFY_G0130
     250      curCost += m_cSDCFlagSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_SDC_FLAG );
    230251#endif
    231252#if H_3D_DBBP
     
    261282      curCost += m_cDdcFlagSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_FLAG );
    262283      curCost += m_cDdcDataSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_DATA );
     284#if QC_GENERIC_SDC_G0122
     285      curCost += m_cAngleFlagSCModel.calcCost         ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG ); 
     286#if !QC_SDC_UNIFY_G0130
     287      curCost += m_cIntraSdcFlagSCModel.calcCost      ( curSliceType, qp, (UChar*)INIT_INTRASDC_FLAG ); 
     288#endif
     289#endif
    263290#if H_3D_DIM_DMM
    264291      curCost += m_cDmm1DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM1_DATA );
     
    326353  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    327354  m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
     355#if QC_GENERIC_SDC_G0122
     356  m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
     357#if !QC_SDC_UNIFY_G0130
     358  m_cIntraSdcFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_INTRASDC_FLAG );
     359#endif
     360#endif
    328361#if H_3D_DIM_DMM
    329362  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    334367#endif
    335368#endif
    336 #if H_3D_INTER_SDC
     369#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    337370  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    338371  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    339372  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     373#endif
     374#if QC_SDC_UNIFY_G0130
     375  m_cSDCFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
    340376#endif
    341377#if H_3D_DBBP
     
    641677  this->m_cDepthIntraModeSCModel .copyFrom( &pSrc->m_cDepthIntraModeSCModel );
    642678  this->m_cDdcFlagSCModel        .copyFrom( &pSrc->m_cDdcFlagSCModel );
     679#if QC_GENERIC_SDC_G0122
     680  this->m_cAngleFlagSCModel      .copyFrom( &pSrc->m_cAngleFlagSCModel );
     681#if !QC_SDC_UNIFY_G0130
     682  this->m_cIntraSdcFlagSCModel   .copyFrom( &pSrc->m_cIntraSdcFlagSCModel );
     683#endif
     684#endif
    643685}
    644686#endif
     
    11311173    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    11321174#if H_3D_DIM_SDC
     1175#if QC_GENERIC_SDC_G0122
     1176      if( 1 )
     1177#else
    11331178      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1179#endif
    11341180#endif
    11351181    {
     
    11571203    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    11581204#if H_3D_DIM_SDC
     1205#if QC_GENERIC_SDC_G0122
     1206      if( 1 )
     1207#else
    11591208      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1209#endif
    11601210#endif
    11611211    {
     
    12561306  default: break;
    12571307  }
    1258 
     1308#if !QC_SDC_UNIFY_G0130
    12591309  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
    12601310  {
    12611311    UInt dimDeltaDC;
    12621312    Pel  deltaDC;
     1313#if QC_GENERIC_SDC_G0122
     1314    UInt uiNumSegments = isDimMode( dir ) ? 2 : 1;
     1315#else
    12631316    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1317#endif
    12641318    if( pcCU->getSDCFlag( absPartIdx ) )
    12651319    {
     
    12891343    }
    12901344  }
    1291 }
    1292 
     1345#endif
     1346}
     1347
     1348#if QC_GENERIC_SDC_G0122
     1349Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
     1350{
     1351  UInt dir = pcCU->getLumaIntraDir( absPartIdx );
     1352
     1353  if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed
     1354  {
     1355    m_pcBinIf->encodeBin( isDimMode( dir ) ? 0 : 1, m_cAngleFlagSCModel.get( 0, 0, pcCU->getCtxAngleFlag( absPartIdx ) ) );
     1356  }
     1357#if !QC_SDC_UNIFY_G0130
     1358  if( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N ) //SDC is allowed only in this case
     1359  {
     1360    m_pcBinIf->encodeBin( pcCU->getSDCFlag( absPartIdx ) ? 1 : 0, m_cIntraSdcFlagSCModel.get( 0, 0, pcCU->getCtxSDCFlag( absPartIdx ) ) );
     1361}
     1362#endif
     1363  if( isDimMode( dir ) )
     1364  {
     1365    UInt uiCodeIdx = 0;
     1366
     1367    switch( getDimType( dir ) )
     1368    {
     1369    case DMM1_IDX: uiCodeIdx = 0; break;
     1370    case DMM4_IDX: uiCodeIdx = 1; break;
     1371    default:                      break;
     1372    }
     1373    //mode coding
     1374    m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
     1375  }
     1376}
     1377#else
    12931378Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
    12941379{
     
    13311416  }
    13321417}
     1418#endif
    13331419#endif
    13341420
     
    22522338
    22532339#if H_3D_INTER_SDC
     2340#if QC_SDC_UNIFY_G0130
     2341Void TEncSbac::codeDeltaDC( TComDataCU* pcCU, UInt absPartIdx )
     2342{
     2343  if( !( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) )
     2344  {
     2345    assert( 0 );
     2346  }
     2347
     2348  UInt uiNumSegments = 0;
     2349  UInt dimDeltaDC = 0;
     2350
     2351  if( pcCU->isIntra( absPartIdx ) )
     2352  {
     2353    UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     2354    uiNumSegments = isDimMode( dir ) ? 2 : 1;
     2355
     2356    if( pcCU->getSDCFlag( absPartIdx ) )
     2357    {
     2358      if( uiNumSegments == 1 )
     2359      {
     2360        dimDeltaDC = pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) ? 1 : 0;
     2361      }
     2362      else
     2363      {
     2364        dimDeltaDC = ( pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) || pcCU->getSDCSegmentDCOffset( 1, absPartIdx ) ) ? 1 : 0;
     2365      }
     2366    }
     2367    else
     2368    {
     2369      dimDeltaDC = isDimDeltaDC( dir );
     2370    }
     2371
     2372    m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get( 0, 0, uiNumSegments-1 ) );
     2373  }
     2374  else //all-zero inter SDC is not allowed
     2375  {
     2376#if SEC_INTER_SDC_G0101
     2377    uiNumSegments = 1;
     2378#else
     2379    PartSize cPartSize = pcCU->getPartitionSize( absPartIdx );
     2380    uiNumSegments = ( cPartSize == SIZE_2Nx2N ) ? 1 : ( cPartSize == SIZE_NxN ? 4 : 2 );
     2381#endif
     2382    dimDeltaDC = 1;
     2383  }
     2384
     2385  if( dimDeltaDC )
     2386  {
     2387    for( UInt segment = 0; segment < uiNumSegments; segment++ )
     2388    {
     2389      Pel deltaDC = 0;
     2390
     2391      if( pcCU->isIntra( absPartIdx ) )
     2392      {
     2393        UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     2394        deltaDC = pcCU->getSDCFlag( absPartIdx ) ? pcCU->getSDCSegmentDCOffset( segment, absPartIdx ) : pcCU->getDimDeltaDC( getDimType( dir ), segment, absPartIdx );
     2395      }
     2396      else
     2397      {
     2398        deltaDC = pcCU->getSDCSegmentDCOffset( segment, absPartIdx );
     2399      }
     2400
     2401      xCodeDimDeltaDC( deltaDC, uiNumSegments );
     2402    }
     2403  }
     2404}
     2405
     2406Void TEncSbac::codeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2407{
     2408  UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0;
     2409  UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx );
     2410
     2411  m_pcBinIf->encodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) );
     2412}
     2413#else
    22542414Void TEncSbac::codeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
    22552415{
     
    22732433}
    22742434#endif
     2435#endif
    22752436
    22762437#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncSbac.h

    r816 r827  
    154154#endif
    155155#if H_3D_INTER_SDC
     156#if QC_SDC_UNIFY_G0130
     157  Void codeDeltaDC       ( TComDataCU* pcCU, UInt absPartIdx );
     158  Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     159#else
    156160  Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    157161  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
     162#endif
    158163#endif
    159164#if H_3D_DBBP
     
    250255  ContextModel3DBuffer m_cDdcFlagSCModel;
    251256  ContextModel3DBuffer m_cDdcDataSCModel;
     257#if QC_GENERIC_SDC_G0122
     258  ContextModel3DBuffer m_cAngleFlagSCModel;
     259#if !QC_SDC_UNIFY_G0130
     260  ContextModel3DBuffer m_cIntraSdcFlagSCModel;
     261#endif
     262#endif
    252263#if H_3D_DIM_DMM
    253264  ContextModel3DBuffer m_cDmm1DataSCModel;
     
    258269#endif
    259270#endif
    260 #if H_3D_INTER_SDC
     271#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    261272  ContextModel3DBuffer m_cInterSDCFlagSCModel;
    262273  ContextModel3DBuffer m_cInterSDCResidualSCModel;
    263274  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
    264275#endif
     276#if QC_SDC_UNIFY_G0130
     277  ContextModel3DBuffer m_cSDCFlagSCModel;
     278#endif
    265279#if H_3D_DBBP
    266280  ContextModel3DBuffer m_cDBBPFlagSCModel;
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncSearch.cpp

    r826 r827  
    922922      m_pcEntropyCoder  ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
    923923
     924#if QC_SDC_UNIFY_G0130
     925      m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     926#endif
    924927      if (pcCU->isIntra(0) && pcCU->getPartitionSize(0) == SIZE_2Nx2N )
    925928      {
     
    938941      {
    939942        m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 );
     943#if QC_SDC_UNIFY_G0130_FIX
     944        if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( 0 ) ) && getDimType( pcCU->getLumaIntraDir( 0 ) ) < DIM_NUM_TYPE )
     945        {
     946          m_pcEntropyCoder->encodeDeltaDC( pcCU, 0 );
     947        }
     948#endif
    940949      }
    941950    }
     
    949958        {
    950959          m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts );
     960#if QC_SDC_UNIFY_G0130_FIX
     961          if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiPart * uiQNumParts ) ) && getDimType( pcCU->getLumaIntraDir( uiPart * uiQNumParts ) ) < DIM_NUM_TYPE )
     962          {
     963            m_pcEntropyCoder->encodeDeltaDC( pcCU, uiPart * uiQNumParts );
     964          }
     965#endif
    951966        }
    952967      }
     
    954969      {
    955970        m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx );
    956       }
    957     }
     971#if QC_SDC_UNIFY_G0130_FIX
     972        if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiAbsPartIdx ) ) && getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) < DIM_NUM_TYPE )
     973        {
     974          m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx );
     975      }
     976#endif
     977    }
     978  }
     979#if QC_SDC_UNIFY_G0130 && !QC_SDC_UNIFY_G0130_FIX
     980    Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;
     981    UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;
     982
     983    if( !pcCU->getSDCFlag( uiAbsPartIdx ) )
     984    {
     985      for( Int iPart = 0; iPart < iPartNum; iPart++ )
     986      {
     987        if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE )
     988        {
     989          m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart );
     990        }
     991      }
     992    }
     993#endif
    958994  }
    959995  if( bChroma )
     
    18621898
    18631899#if H_3D_DIM_SDC
    1864 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual )
     1900Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost,
     1901#if QC_GENERIC_SDC_G0122
     1902  Bool bZeroResidual, Int iSDCDeltaResi
     1903#else
     1904  Bool bResidual
     1905#endif
     1906  )
    18651907{
    18661908  UInt    uiLumaPredMode    = pcCU     ->getLumaIntraDir( uiAbsPartIdx );
    18671909  UInt    uiWidth           = pcCU     ->getWidth   ( 0 );
    18681910  UInt    uiHeight          = pcCU     ->getHeight  ( 0 );
     1911#if QC_PKU_SDC_SPLIT_G0123
     1912#if HS_TSINGHUA_SDC_SPLIT_G0111
     1913#if QC_GENERIC_SDC_G0122
     1914  TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight );
     1915#endif
     1916#else
     1917#if QC_GENERIC_SDC_G0122
     1918  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     1919#endif
     1920#endif
     1921#endif
     1922#if QC_PKU_SDC_SPLIT_G0123
     1923  UInt numParts = 1;
     1924  UInt i = 0;
     1925  UInt sdcDepth = 0;
     1926  UInt uiStride;         
     1927  Pel* piOrg;         
     1928  Pel* piPred;         
     1929  Pel* piReco;       
     1930
     1931  UInt uiZOrder;         
     1932  Pel* piRecIPred;       
     1933  UInt uiRecIPredStride;
     1934
     1935#if HS_TSINGHUA_SDC_SPLIT_G0111
     1936  if ( ( uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) > 1 )
     1937  {
     1938    numParts = uiWidth * uiWidth >> ( 2 * pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() );
     1939    sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();
     1940    uiWidth = uiHeight = ( 1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() );
     1941  }
     1942#else
     1943  if (uiWidth == 64)
     1944  {
     1945    numParts = 4;
     1946    sdcDepth = 1;
     1947    uiWidth = uiHeight = 32;
     1948  }
     1949#endif
     1950
     1951  for ( i = 0; i < numParts; i++ )
     1952  {
     1953    uiStride          = pcOrgYuv ->getStride  ();
     1954    piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     1955    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1956    piReco            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1957
     1958    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     1959    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     1960    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     1961
     1962    AOF( uiWidth == uiHeight );
     1963#else
    18691964  UInt    uiStride          = pcOrgYuv ->getStride  ();
    18701965  Pel*    piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     
    18801975  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
    18811976  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
     1977#endif
     1978#if !QC_GENERIC_SDC_G0122
    18821979  AOF( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) );
    18831980  AOF( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || uiWidth < 64  );
     1981#endif
    18841982 
    18851983  //===== init availability pattern =====
    18861984  Bool  bAboveAvail = false;
    18871985  Bool  bLeftAvail  = false;
     1986#if QC_PKU_SDC_SPLIT_G0123
     1987  pcCU->getPattern()->initPattern   ( pcCU, sdcDepth, uiAbsPartIdx );
     1988  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
     1989#else
    18881990  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
    18891991  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
    18901992 
     1993#endif
     1994#if !QC_PKU_SDC_SPLIT_G0123
     1995#if QC_GENERIC_SDC_G0122
     1996  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     1997#endif
     1998#endif
     1999#if HS_TSINGHUA_SDC_SPLIT_G0111
     2000#if QC_GENERIC_SDC_G0122
     2001  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     2002#endif
     2003#endif
    18912004  //===== get prediction signal =====
    18922005#if H_3D_DIM
    18932006  if( isDimMode( uiLumaPredMode ) )
    18942007  {
    1895     predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true );
     2008#if HS_TSINGHUA_SDC_SPLIT_G0111 
     2009    UInt dimType   = getDimType  ( uiLumaPredMode );
     2010    UInt patternID = pcCU->getDmmWedgeTabIdx(dimType, uiAbsPartIdx);
     2011    if ( patternID >= g_dmmWedgeLists[g_aucConvertToBit[uiWidth]].size() && dimType == DMM1_IDX )
     2012    {
     2013      if (g_aucConvertToBit[uiWidth] == 2)  // Encoder method. Avoid DMM1 pattern list index exceeds the maximum DMM1 pattern number when SDC split is used.
     2014        patternID = 1349;  // Split 32x32 to 16x16. 1349: Maximum DMM1 pattern number when block size is 16x16
     2015      else
     2016        patternID = patternID >> 1;  // Other cases
     2017      pcCU->setDmmWedgeTabIdx(dimType, uiAbsPartIdx, patternID);
     2018    }
     2019#endif
     2020    predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true
     2021#if QC_GENERIC_SDC_G0122
     2022      , dmm4Segmentation
     2023#endif
     2024      );
     2025#if HS_TSINGHUA_SDC_SPLIT_G0111
     2026    Bool* dmm4PatternSplit = dmm4Segmentation->getPattern();
     2027    Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern();
     2028    for( UInt k = 0; k < (uiWidth*uiHeight); k++ )
     2029    {
     2030      dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k];
     2031    }
     2032#endif
    18962033  }
    18972034  else
     
    19022039  }
    19032040#endif
    1904  
     2041#if QC_PKU_SDC_SPLIT_G0123
     2042    if ( numParts > 1 )
     2043    {
     2044      for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     2045      {
     2046        for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     2047        {
     2048          piPred        [ uiX ] = ClipY( piPred[ uiX ] );
     2049          piRecIPred    [ uiX ] = piPred[ uiX ];
     2050        }
     2051        piPred     += uiStride;
     2052        piRecIPred += uiRecIPredStride;
     2053      }
     2054    }
     2055    uiAbsPartIdx += ( ( uiWidth * uiWidth ) >> 4 );
     2056#if HS_TSINGHUA_SDC_SPLIT_G0111
     2057    dmm4Segmentation->destroy(); delete dmm4Segmentation;
     2058#endif
     2059  }
     2060  uiAbsPartIdx = 0;
     2061  uiStride          = pcOrgYuv ->getStride  ();
     2062  piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     2063  piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     2064  piReco            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     2065 
     2066  uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     2067  piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     2068  uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     2069
     2070  if (numParts > 1)
     2071  {
     2072    uiWidth = pcCU->getWidth( 0 );
     2073    uiHeight = pcCU->getHeight( 0 );
     2074  }
     2075#endif
    19052076  // number of segments depends on prediction mode
    19062077  UInt uiNumSegments = 1;
     
    19192090    uiMaskStride = pcWedgelet->getStride();
    19202091  }
     2092#if QC_GENERIC_SDC_G0122
     2093  if( getDimType( uiLumaPredMode ) == DMM4_IDX )
     2094  {
     2095    uiNumSegments = 2;
     2096#if HS_TSINGHUA_SDC_SPLIT_G0111
     2097    pbMask  = dmm4SegmentationOrg->getPattern();
     2098    uiMaskStride = dmm4SegmentationOrg->getStride();
     2099#else
     2100    pbMask  = dmm4Segmentation->getPattern();
     2101    uiMaskStride = dmm4Segmentation->getStride();
     2102#endif
     2103  }
     2104#endif
    19212105 
    19222106  // get DC prediction for each segment
     
    19312115  {
    19322116    // remap reconstructed value to valid depth values
     2117#if QC_GENERIC_SDC_G0122
     2118    Pel pDCRec = ( !bZeroResidual ) ? apDCOrigValues[uiSegment] : apDCPredValues[uiSegment];
     2119#else
    19332120    Pel pDCRec = bResidual?apDCOrigValues[uiSegment]:apDCPredValues[uiSegment];
    1934    
     2121#endif
    19352122    // get residual (idx)
    19362123#if H_3D_DIM_DLT
     
    19392126    Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment];
    19402127#endif
    1941    
     2128#if QC_GENERIC_SDC_G0122
     2129    if( !bZeroResidual )
     2130    {
     2131      Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     2132      Int   pTestIdx    = pPredIdx + pResidualIdx + iSDCDeltaResi;
     2133      if( pTestIdx >= 0 && pTestIdx < pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) )
     2134      {
     2135        pResidualIdx += iSDCDeltaResi;
     2136      }
     2137    }
     2138#endif
    19422139    // save SDC DC offset
    19432140    pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx);
     
    20122209 
    20132210  // encode reduced intra header
     2211#if QC_SDC_UNIFY_G0130
     2212  if( !pcCU->getSlice()->isIntra() )
     2213  {
     2214    if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     2215    {
     2216      m_pcEntropyCoder->encodeCUTransquantBypassFlag( pcCU, 0, true );
     2217    }
     2218    m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
     2219    m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     2220  }
     2221
     2222  m_pcEntropyCoder->encodePartSize( pcCU, 0, true );
     2223  m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     2224#else
    20142225  m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     2226#endif
    20152227 
    20162228  // encode pred direction + DC residual data
    20172229  m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
     2230#if QC_SDC_UNIFY_G0130
     2231  Bool bDummy = false;
     2232  m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), uiWidth, uiHeight, bDummy );
     2233#endif
    20182234  UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
    20192235 
     
    20242240#endif
    20252241    dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );
     2242#if QC_GENERIC_SDC_G0122
     2243#if HS_TSINGHUA_SDC_SPLIT_G0111
     2244  dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg;
     2245#else
     2246  dmm4Segmentation->destroy(); delete dmm4Segmentation;
     2247#endif
     2248#endif
    20262249}
    20272250#endif
     
    29013124          case( DMM4_IDX ):
    29023125            {
     3126#if !QC_GENERIC_SDC_G0122
    29033127              if( uiWidth > 4 )
     3128#endif
    29043129              {
    29053130                biSegmentation = new TComWedgelet( uiWidth, uiHeight );
     
    29573182      {
    29583183        pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth );
     3184#if QC_GENERIC_SDC_G0122
     3185        for( Int iSDCDeltaResi = -2; iSDCDeltaResi <= 2; iSDCDeltaResi++ )
     3186        {
     3187          if( ( uiSDC == 0 ) && iSDCDeltaResi != 0 )
     3188          {
     3189            continue;
     3190          }
     3191#endif
    29593192#endif
    29603193     
     
    29663199#if H_3D_DIM_SDC
    29673200      bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);
     3201#endif
     3202#if QC_GENERIC_SDC_G0122
     3203      if( uiSDC != 0 && iSDCDeltaResi != 0 )
     3204      {
     3205        bTestZeroResi = false;
     3206      }
    29683207#endif
    29693208#endif
     
    30003239             
    30013240              // start encoding with SDC
     3241#if QC_GENERIC_SDC_G0122
     3242              xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
     3243#else
    30023244              xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, (testZeroResi!=0));
     3245#endif
    30033246            }
    30043247            else
     
    30733316#if H_3D_DIM_ENC || H_3D_DIM_SDC
    30743317      }
     3318#endif
     3319#if QC_GENERIC_SDC_G0122
     3320        } // SDC residual loop
    30753321#endif
    30763322#if H_3D_DIM_SDC
     
    57465992
    57475993#if H_3D_INTER_SDC
     5994#if SEC_INTER_SDC_G0101
     5995Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, Int uiOffest, const UInt uiDepth )
     5996#else
    57485997Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, const UInt uiDepth )
     5998#endif
    57495999{
    57506000  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( 0 ) )
     
    57526002    return;
    57536003  }
    5754 
     6004#if QC_SDC_UNIFY_G0130
     6005  pcCU->setSDCFlagSubParts( true, 0, uiDepth );
     6006#else
    57556007  pcCU->setInterSDCFlagSubParts( true, 0, 0, uiDepth );
     6008#endif
    57566009
    57576010  UInt  uiWidth      = pcCU->getWidth ( 0 );
    57586011  UInt  uiHeight     = pcCU->getHeight( 0 );
     6012#if SEC_INTER_SDC_G0101
     6013  UInt uiSegSize = 0;
     6014#else
    57596015  UChar* pMask       = pcCU->getInterSDCMask();
    57606016  memset( pMask, 0, uiWidth*uiHeight );
     
    57636019
    57646020  UInt uiSegSize[4] = { 0, 0, 0, 0 };
     6021#endif
    57656022  Pel *pPred, *pOrg;
    57666023  UInt uiPredStride = pcPred->getStride();
    57676024  UInt uiOrgStride  = pcOrg->getStride();
    57686025  UInt uiPelX, uiPelY;
     6026#if !SEC_INTER_SDC_G0101
    57696027  UInt uiPartitionSize = pcCU->getPartitionSize( 0 );
    57706028  UInt uiSegmentNum = ( uiPartitionSize == SIZE_2Nx2N ) ? 1 : ( uiPartitionSize == SIZE_NxN ? 4 : 2 );
     6029#endif
    57716030
    57726031  pPred = pcPred->getLumaAddr( 0 );
    57736032  pOrg  = pcOrg->getLumaAddr( 0 );
     6033#if SEC_INTER_SDC_G0101
     6034  Int pResDC = 0;
     6035#else
    57746036  Int pResDC[4] = { 0, 0, 0, 0};
     6037#endif
    57756038
    57766039  //calculate dc value for prediction and original signal, and calculate residual and reconstruction
     
    57796042    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
    57806043    {
     6044#if SEC_INTER_SDC_G0101
     6045      pResDC += (Int)( pOrg [uiPelX] - pPred[uiPelX] );
     6046      uiSegSize++;
     6047#else
    57816048      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
    57826049      pResDC[uiSeg] += (Int)( pOrg [uiPelX] - pPred[uiPelX] );
    57836050      uiSegSize[uiSeg]++;
     6051#endif
    57846052    }
    57856053    pOrg  += uiOrgStride;
     
    57876055  }
    57886056
     6057#if SEC_INTER_SDC_G0101
     6058  Int iResiOffset = ( pResDC  > 0 ? ( uiSegSize >> 1 ) : -1*( uiSegSize >> 1 ) );
     6059  pResDC          = ( pResDC + iResiOffset ) / (Int) uiSegSize;
     6060
     6061  pcCU->setSDCSegmentDCOffset( pResDC + uiOffest, 0, 0 );
     6062#else
    57896063  for( UInt uiSeg = 0; uiSeg < uiSegmentNum; uiSeg++ )
    57906064  {
    57916065    Int iResiOffset = ( pResDC [uiSeg] > 0 ? ( uiSegSize[uiSeg] >> 1 ) : -1*( uiSegSize[uiSeg] >> 1 ) );
    57926066    pResDC [uiSeg]  = ( pResDC [uiSeg] + iResiOffset ) / (Int) uiSegSize[uiSeg];
    5793 
     6067#if QC_SDC_UNIFY_G0130
     6068    pcCU->setSDCSegmentDCOffset( pResDC[uiSeg], uiSeg, 0 );
     6069#else
    57946070    pcCU->setInterSDCSegmentDCOffset( pResDC[uiSeg], uiSeg, 0 );
    5795   }
     6071#endif
     6072  }
     6073#endif
    57966074
    57976075  Pel *pRec;
     
    58046082    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
    58056083    {
     6084#if SEC_INTER_SDC_G0101
     6085      pRec[ uiPelX ] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, pPred[uiPelX] + pcCU->getSDCSegmentDCOffset(0, 0) );
     6086#else
    58066087      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
    58076088      assert( uiSeg < uiSegmentNum );
    58086089
    58096090      pRec[ uiPelX ] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, pPred[uiPelX] + pResDC[uiSeg] );
     6091#endif
    58106092    }
    58116093    pPred     += uiPredStride;
     
    58476129#endif
    58486130
     6131#if QC_SDC_UNIFY_G0130
     6132  Bool bNonSkip = false;
     6133#else
    58496134  Bool bNonSkip = true;
     6135#endif
     6136#if SEC_INTER_SDC_G0101
     6137  bNonSkip |= ( pcCU->getSDCSegmentDCOffset( 0, 0 ) != 0 ) ? 1 : 0;
     6138#else
    58506139  for( UInt uiSeg = 0; uiSeg < uiSegmentNum; uiSeg++ )
    58516140  {
     6141#if QC_SDC_UNIFY_G0130
     6142    bNonSkip |= ( pcCU->getSDCSegmentDCOffset( uiSeg, 0 ) != 0 ) ? 1 : 0;
     6143#else
    58526144    bNonSkip &= ( pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 ) != 0 ) ? 1 : 0;
    5853   }
     6145#endif
     6146  }
     6147#endif
    58546148
    58556149  if( !bNonSkip )
     
    70687362    m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
    70697363    m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
     7364#if QC_SDC_UNIFY_G0130
     7365    m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     7366#endif
    70707367    m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
    70717368#if !SEC_IC_ARP_SIG_G0072
     
    70827379#endif
    70837380#endif
    7084 #if H_3D_INTER_SDC
     7381#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    70857382    m_pcEntropyCoder->encodeInterSDCFlag( pcCU, 0, true );
    70867383#endif
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncSearch.h

    r773 r827  
    219219    TComYuv* pcResi,
    220220    TComYuv* pcRec,
     221#if SEC_INTER_SDC_G0101
     222    Int      uiOffset,
     223#endif
    221224    const UInt uiDepth );
    222225#endif
     
    353356#endif
    354357#if H_3D_DIM_SDC
    355   Void xIntraCodingSDC            ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual );
     358  Void xIntraCodingSDC            ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost,
     359#if QC_GENERIC_SDC_G0122
     360    Bool bZeroResidual, Int iSDCDeltaResi
     361#else
     362    Bool bResidual
     363#endif
     364    );
    356365#endif
    357366#endif
Note: See TracChangeset for help on using the changeset viewer.