Changeset 833 in 3DVCSoftware for trunk/source/Lib


Ignore:
Timestamp:
7 Feb 2014, 20:31:12 (11 years ago)
Author:
tech
Message:

Merged 9.3-dev0@831.

Location:
trunk/source/Lib
Files:
32 edited

Legend:

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

    r773 r833  
    9797
    9898#if H_3D_ARP
     99#if MTK_ARP_FLAG_CABAC_SIMP_G0061
     100#define NUM_ARPW_CTX                  3       ///< number of context models for weighting factor index used by advanced residual prediction
     101#else
    99102#define NUM_ARPW_CTX                  4       ///< number of context models for weighting factor index used by advanced residual prediction
    100103#endif
     104#endif
    101105
    102106#if H_3D_IC
     107#if MTK_IC_FLAG_CABAC_SIMP_G0061
     108#define NUM_IC_FLAG_CTX               1       ///< number of context models for illumination compensation flag
     109#else
    103110#define NUM_IC_FLAG_CTX               3       ///< number of context models for illumination compensation flag
    104111#endif
     112#endif
    105113
    106114#define CNU                          154      ///< dummy initialization value for unused context models 'Context model Not Used'
    107115
    108116#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
    109120#define NUM_DEPTH_INTRA_MODE_CTX      8       ///< number of context models for depth intra modes
     121#endif
    110122#define NUM_DDC_FLAG_CTX              2       ///< number of context models for deltaDC flag (DMM or RBC)
    111123#define NUM_DDC_DATA_CTX              1       ///< number of context models for deltaDC data (DMM or RBC)
     
    113125#define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
    114126#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
    115133#endif
    116134
     
    120138#endif
    121139
    122 #if H_3D_INTER_SDC
     140#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    123141#define NUM_INTER_SDC_FLAG_CTX        1      ///< number of context models for inter SDC flag
    124142#define NUM_INTER_SDC_SIGN_FLAG_CTX   1      ///< number of context models for sign of inter SDC residual
    125143#define NUM_INTER_SDC_RESIDUAL_CTX    1      ///< number of context models for abs of inter SDC residual
     144#endif
     145
     146#if QC_SDC_UNIFY_G0130
     147#define NUM_SDC_FLAG_CTX              1      ///< number of context
     148#endif
     149#if H_3D_DBBP
     150#define DBBP_NUM_FLAG_CTX                 1
    126151#endif
    127152// ====================================================================================================================
     
    364389
    365390#if H_3D_ARP
     391#if MTK_ARP_FLAG_CABAC_SIMP_G0061
     392static const UChar
     393INIT_ARPW[3][NUM_ARPW_CTX] =
     394{
     395    { 162, 153, 162 },
     396    { 162, 153, 162 },
     397    { 162, 153, 162 },
     398};
     399#else
    366400static const UChar
    367401INIT_ARPW[3][NUM_ARPW_CTX] =
     
    372406};
    373407#endif
    374 
     408#endif
    375409#if H_3D_IC
     410#if MTK_IC_FLAG_CABAC_SIMP_G0061
     411static const UChar
     412INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 
     413{
     414    { 154 },
     415    { 154 },
     416    { 154 },
     417};
     418#else
    376419static const UChar
    377420INIT_IC_FLAG[3][NUM_IC_FLAG_CTX] = 
     
    382425};
    383426#endif
     427#endif
    384428#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
    385438static const UChar
    386439INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
     
    390443    {64, 0, CNU, CNU, 168, 109,   0, 0}
    391444};
     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
    392465
    393466static const UChar
     
    432505#endif
    433506
    434 #if H_3D_INTER_SDC
     507#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    435508static const UChar
    436509INIT_INTER_SDC_FLAG[3][NUM_INTER_SDC_FLAG_CTX] =
     
    458531#endif
    459532//! \}
    460 
    461 
    462 #endif
     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
     542
     543#if H_3D_DBBP
     544static const UChar INIT_DBBP_FLAG[3][DBBP_NUM_FLAG_CTX] =
     545{
     546  { CNU },
     547  { CNU },
     548  { CNU },
     549};
     550#endif
     551
     552#endif
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r773 r833  
    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
     165#endif
     166#if H_3D_DBBP
     167  m_pbDBBPFlag         = NULL;
     168#endif
     169
     170#if MTK_DDD_G0063
     171  m_pucDisparityDerivedDepth = NULL;
     172  m_pbUseDDD = NULL;
    154173#endif
    155174}
     
    272291#if H_3D_DIM_SDC
    273292    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
    274299    m_apSegmentDCOffset[0]  = (Pel*)xMalloc(Pel, uiNumPartition);
    275300    m_apSegmentDCOffset[1]  = (Pel*)xMalloc(Pel, uiNumPartition);
    276301#endif
    277302#endif
    278 #if H_3D_INTER_SDC
     303#endif
     304#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    279305    m_pbInterSDCFlag     = (Bool*  )xMalloc(Bool,   uiNumPartition);
    280306    for( Int i = 0; i < 4; i++ )
     
    283309    }
    284310#endif
     311#if H_3D_DBBP
     312    m_pbDBBPFlag         = (Bool*  )xMalloc(Bool,   uiNumPartition);
     313#endif
    285314  }
    286315  else
     
    289318    m_acCUMvField[1].setNumPartition(uiNumPartition );
    290319  }
     320#if !SEC_INTER_SDC_G0101
    291321#if H_3D_INTER_SDC
    292322  m_pucInterSDCMask     = (UChar*  )xMalloc(UChar,    g_uiMaxCUHeight*g_uiMaxCUWidth);
    293323#endif
     324#endif
    294325  m_sliceStartCU        = (UInt*  )xMalloc(UInt, uiNumPartition);
    295326  m_sliceSegmentStartCU = (UInt*  )xMalloc(UInt, uiNumPartition);
     
    298329  m_pcPattern            = (TComPattern*)xMalloc(TComPattern, 1);
    299330 
     331#if MTK_DDD_G0063
     332  m_pucDisparityDerivedDepth         = (UChar*  )xMalloc( UChar,  uiNumPartition);
     333  m_pbUseDDD                         = (Bool*  ) xMalloc( Bool,   uiNumPartition);
     334#endif
     335
    300336  // create motion vector fields
    301337 
     
    377413#endif
    378414
     415#if MTK_DDD_G0063
     416    if ( m_pucDisparityDerivedDepth ) { xFree(m_pucDisparityDerivedDepth);          m_pucDisparityDerivedDepth        = NULL; }
     417    if ( m_pbUseDDD                 ) { xFree(m_pbUseDDD);                          m_pbUseDDD                        = NULL; }
     418#endif
     419
    379420#if H_3D_ARP
    380421    if ( m_puhARPW            ) { delete[] m_puhARPW;           m_puhARPW           = NULL; }
     
    400441#if H_3D_DIM_SDC
    401442    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
    402449    if ( m_apSegmentDCOffset[0] ) { xFree(m_apSegmentDCOffset[0]);  m_apSegmentDCOffset[0]  = NULL; }
    403450    if ( m_apSegmentDCOffset[1] ) { xFree(m_apSegmentDCOffset[1]);  m_apSegmentDCOffset[1]  = NULL; }
    404451#endif
    405452#endif   
    406 #if H_3D_INTER_SDC
     453#endif   
     454#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    407455    if ( m_pbInterSDCFlag     ) { xFree(m_pbInterSDCFlag);      m_pbInterSDCFlag    = NULL; }
    408456    for(Int i = 0; i < 4; i++ )
     
    411459  }
    412460#endif
    413   }
     461#if H_3D_DBBP
     462    if ( m_pbDBBPFlag         ) { xFree(m_pbDBBPFlag);          m_pbDBBPFlag        = NULL; }
     463#endif
     464  }
     465#if !SEC_INTER_SDC_G0101
    414466#if H_3D_INTER_SDC
    415467  if ( m_pucInterSDCMask     ) { xFree(m_pucInterSDCMask);      m_pucInterSDCMask    = NULL; }
     468#endif
    416469#endif
    417470  m_pcCUAboveLeft       = NULL;
     
    525578    m_pbICFlag[ui]   =  pcFrom->m_pbICFlag[ui];
    526579#endif
     580
     581#if MTK_DDD_G0063
     582    m_pucDisparityDerivedDepth[ui] = pcFrom->m_pucDisparityDerivedDepth[ui];
     583    m_pbUseDDD[ui] = pcFrom->m_pbUseDDD[ui];
     584#endif
     585
    527586    m_puhWidth  [ui] = pcFrom->getWidth(ui);
    528587    m_puhHeight [ui] = pcFrom->getHeight(ui);
     
    554613    m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui];
    555614#endif
    556 #if H_3D_INTER_SDC
     615#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    557616    m_pbInterSDCFlag[ui] = pcFrom->m_pbInterSDCFlag[ui];
     617#endif
     618#if H_3D_DBBP
     619    m_pbDBBPFlag[ui] = pcFrom->m_pbDBBPFlag[ui];
    558620#endif
    559621  }
     
    602664    memset( m_pbICFlag          + firstElement, false,                    numElements * sizeof( *m_pbICFlag )   );
    603665#endif
     666
     667#if MTK_DDD_G0063
     668    memset( m_pucDisparityDerivedDepth        + firstElement, 0,           numElements * sizeof( *m_pucDisparityDerivedDepth ) );
     669    memset( m_pbUseDDD                        + firstElement, 0,           numElements * sizeof( *m_pbUseDDD ) );
     670#endif
     671
    604672#if H_3D_DIM
    605673    for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    616684#if H_3D_DIM_SDC
    617685    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
    618692    memset( m_apSegmentDCOffset[0]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[0] ) );
    619693    memset( m_apSegmentDCOffset[1]  + firstElement,     0,                numElements * sizeof( *m_apSegmentDCOffset[1] ) );
    620694#endif
    621695#endif
    622 #if H_3D_INTER_SDC
     696#endif
     697#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    623698    memset( m_pbInterSDCFlag   + firstElement,     0,                    numElements * sizeof( *m_pbInterSDCFlag ) );
    624699    for( Int i = 0; i < 4; i++ )
     
    626701      memset( m_apSegmentInterDCOffset[i] + firstElement,     0,         numElements * sizeof( *m_apSegmentInterDCOffset[i] ) );
    627702    }
     703#endif
     704#if H_3D_DBBP
     705    memset( m_pbDBBPFlag        + firstElement, false,                    numElements * sizeof( *m_pbDBBPFlag ) );
    628706#endif
    629707  }
     
    774852      m_pbICFlag[ui]  = false;
    775853#endif
     854
     855#if MTK_DDD_G0063
     856      m_pucDisparityDerivedDepth[ui] = 0;
     857      m_pbUseDDD[ui] = 0;
     858#endif
     859
    776860#if H_3D_DIM
    777861      for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    788872#if H_3D_DIM_SDC
    789873      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
    790880      m_apSegmentDCOffset[0][ui] = 0;
    791881      m_apSegmentDCOffset[1][ui] = 0;
    792882#endif
    793883#endif
    794 #if H_3D_INTER_SDC
     884#endif
     885#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    795886      m_pbInterSDCFlag[ui] = false;
    796887      for( Int i = 0; i < 4; i++ )
     
    798889        m_apSegmentInterDCOffset[i][ui] = 0;
    799890      }
     891#endif
     892#if H_3D_DBBP
     893      m_pbDBBPFlag[ui] = false;
    800894#endif
    801895    }
     
    879973  memset( m_puhARPW,            0, iSizeInUchar  );
    880974#endif
     975
     976#if MTK_DDD_G0063
     977  memset( m_pucDisparityDerivedDepth,         0, iSizeInUchar );
     978  memset( m_pbUseDDD,                         0, iSizeInBool );
     979#endif
     980
    881981  UChar uhWidth  = g_uiMaxCUWidth  >> uiDepth;
    882982  UChar uhHeight = g_uiMaxCUHeight >> uiDepth;
     
    9011001#if H_3D_DIM_SDC
    9021002  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
    9031009  memset( m_apSegmentDCOffset[0], 0, sizeof(Pel) * m_uiNumPartition   );
    9041010  memset( m_apSegmentDCOffset[1], 0, sizeof(Pel) * m_uiNumPartition   );
    9051011#endif
    9061012#endif
    907 #if H_3D_INTER_SDC
     1013#endif
     1014#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    9081015  memset( m_pbInterSDCFlag,           0, sizeof( Bool ) * m_uiNumPartition );
    9091016  for( Int i = 0; i < 4; i++ )
     
    9111018    memset( m_apSegmentInterDCOffset[i], 0, sizeof( Int ) * m_uiNumPartition );
    9121019  }
     1020#endif
     1021#if H_3D_DBBP
     1022  memset( m_pbDBBPFlag,         0, iSizeInBool  );
    9131023#endif
    9141024
     
    9641074      m_pbICFlag          [ui] = pcCU->m_pbICFlag[uiPartOffset+ui];
    9651075#endif
     1076
     1077#if MTK_DDD_G0063
     1078      m_pucDisparityDerivedDepth[ui] = pcCU->m_pucDisparityDerivedDepth[uiPartOffset+ui];
     1079      m_pbUseDDD[ui]                 = pcCU->m_pbUseDDD[uiPartOffset+ui];
     1080#endif
     1081
    9661082#if H_3D_DIM
    9671083      for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    9781094#if H_3D_DIM_SDC
    9791095      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
    9801102      m_apSegmentDCOffset[0][ui] = pcCU->m_apSegmentDCOffset[0] [ uiPartOffset + ui ];
    9811103      m_apSegmentDCOffset[1][ui] = pcCU->m_apSegmentDCOffset[1] [ uiPartOffset + ui ];
    9821104#endif
    9831105#endif
    984 #if H_3D_INTER_SDC
     1106#endif
     1107#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    9851108      m_pbInterSDCFlag      [ui] = pcCU->m_pbInterSDCFlag    [ uiPartOffset + ui ];
    9861109      for( Int i = 0; i < 4; i++ )
     
    9881111        m_apSegmentInterDCOffset[i][ui] = pcCU->m_apSegmentInterDCOffset[i][ uiPartOffset + ui ];
    9891112      }
     1113#endif
     1114#if H_3D_DBBP
     1115      m_pbDBBPFlag[ui]=pcCU->m_pbDBBPFlag[uiPartOffset+ui];
    9901116#endif
    9911117    }
     
    11091235#endif
    11101236
     1237#if MTK_DDD_G0063
     1238  m_pucDisparityDerivedDepth          = pcCU->getDDDepth()        + uiPart;
     1239  m_pbUseDDD                          = pcCU->getUseDDD()         + uiPart;
     1240#endif
     1241
    11111242  m_puhLumaIntraDir     = pcCU->getLumaIntraDir()     + uiPart;
    11121243  m_puhChromaIntraDir   = pcCU->getChromaIntraDir()   + uiPart;
     
    11341265#if H_3D_DIM_SDC
    11351266  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
    11361273  m_apSegmentDCOffset[0]    = pcCU->getSDCSegmentDCOffset(0)  + uiPart;
    11371274  m_apSegmentDCOffset[1]    = pcCU->getSDCSegmentDCOffset(1)  + uiPart;
    11381275#endif
    11391276#endif 
    1140 #if H_3D_INTER_SDC
     1277#endif 
     1278#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    11411279  m_pbInterSDCFlag          = pcCU->getInterSDCFlag()       + uiPart;
    11421280  for( Int i = 0; i < 4; i++ )
     
    11441282    m_apSegmentInterDCOffset[i] = pcCU->getInterSDCSegmentDCOffset( i ) + uiPart;
    11451283  }
     1284#endif
     1285#if H_3D_DBBP
     1286  m_pbDBBPFlag              = pcCU->getDBBPFlag()         + uiPart;
    11461287#endif
    11471288  m_puhDepth=pcCU->getDepth()                     + uiPart;
     
    12561397#if H_3D_ARP
    12571398  m_puhARPW            = pcCU->getARPW()                  + uiAbsPartIdx;
     1399#endif
     1400
     1401#if MTK_DDD_G0063
     1402  m_pucDisparityDerivedDepth         = pcCU->getDDDepth()              + uiAbsPartIdx;
     1403  m_pbUseDDD                         = pcCU->getUseDDD()              + uiAbsPartIdx;
     1404#endif
     1405   
     1406#if H_3D_DBBP
     1407  m_pbDBBPFlag       = pcCU->getDBBPFlag()              + uiAbsPartIdx;
    12581408#endif
    12591409
     
    13141464  memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar );
    13151465 
     1466#if MTK_DDD_G0063
     1467  memcpy( m_pucDisparityDerivedDepth          + uiOffset, pcCU->getDDDepth(),         iSizeInUchar );
     1468  memcpy( m_pbUseDDD                          + uiOffset, pcCU->getUseDDD(),          iSizeInBool );
     1469#endif
     1470
     1471
    13161472#if H_3D_DIM
    13171473  for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    13281484#if H_3D_DIM_SDC
    13291485  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
    13301492  memcpy( m_apSegmentDCOffset[0]  + uiOffset, pcCU->getSDCSegmentDCOffset(0), sizeof( Pel ) * uiNumPartition);
    13311493  memcpy( m_apSegmentDCOffset[1]  + uiOffset, pcCU->getSDCSegmentDCOffset(1), sizeof( Pel ) * uiNumPartition);
    13321494#endif
    13331495#endif
    1334 #if H_3D_INTER_SDC
     1496#endif
     1497#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    13351498  memcpy( m_pbInterSDCFlag  + uiOffset, pcCU->getInterSDCFlag(),      iSizeInBool  );
    13361499  for( Int i = 0; i < 4; i++ )
     
    13381501    memcpy( m_apSegmentInterDCOffset[i] + uiOffset, pcCU->getInterSDCSegmentDCOffset( i ), sizeof( Int ) * uiNumPartition);
    13391502  }
     1503#endif
     1504#if H_3D_DBBP
     1505  memcpy( m_pbDBBPFlag          + uiOffset, pcCU->getDBBPFlag(),          iSizeInBool  );
    13401506#endif
    13411507
     
    14101576#if H_3D_NBDV
    14111577  memcpy( rpcCU->getDvInfo()         + m_uiAbsIdxInLCU, m_pDvInfo,    sizeof(* m_pDvInfo)     * m_uiNumPartition );
     1578#endif
     1579
     1580#if MTK_DDD_G0063
     1581  memcpy( rpcCU->getDDDepth()          + m_uiAbsIdxInLCU, m_pucDisparityDerivedDepth,         iSizeInUchar  );
     1582  memcpy( rpcCU->getUseDDD()           + m_uiAbsIdxInLCU, m_pbUseDDD,                         iSizeInBool  );
    14121583#endif
    14131584
     
    14501621#if H_3D_DIM_SDC
    14511622  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
    14521629  memcpy( rpcCU->getSDCSegmentDCOffset(0) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[0], sizeof( Pel ) * m_uiNumPartition);
    14531630  memcpy( rpcCU->getSDCSegmentDCOffset(1) + m_uiAbsIdxInLCU, m_apSegmentDCOffset[1], sizeof( Pel ) * m_uiNumPartition);
    14541631#endif
    14551632#endif
    1456 #if H_3D_INTER_SDC
     1633#endif
     1634#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    14571635  memcpy( rpcCU->getInterSDCFlag() + m_uiAbsIdxInLCU, m_pbInterSDCFlag,      iSizeInBool  );
    14581636  for( Int i = 0;i < 4; i++ )
     
    14611639  }
    14621640#endif
     1641#if H_3D_DBBP
     1642  memcpy( rpcCU->getDBBPFlag()          + m_uiAbsIdxInLCU, m_pbDBBPFlag,          iSizeInBool  );
     1643#endif
     1644 
    14631645  memcpy( rpcCU->getDepth()  + m_uiAbsIdxInLCU, m_puhDepth,  iSizeInUchar );
    14641646  memcpy( rpcCU->getWidth()  + m_uiAbsIdxInLCU, m_puhWidth,  iSizeInUchar );
     
    15441726  memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar );
    15451727 
     1728#if MTK_DDD_G0063
     1729  memcpy( rpcCU->getDDDepth()          + uiPartOffset, m_pucDisparityDerivedDepth,         iSizeInUchar );
     1730  memcpy( rpcCU->getUseDDD()           + uiPartOffset, m_pbUseDDD,                         iSizeInBool );
     1731#endif
     1732
    15461733#if H_3D_DIM
    15471734  for( Int i = 0; i < DMM_NUM_TYPE; i++ )
     
    15581745#if H_3D_DIM_SDC
    15591746  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
    15601753  memcpy( rpcCU->getSDCSegmentDCOffset(0) + uiPartOffset, m_apSegmentDCOffset[0], sizeof( Pel ) * uiQNumPart);
    15611754  memcpy( rpcCU->getSDCSegmentDCOffset(1) + uiPartOffset, m_apSegmentDCOffset[1], sizeof( Pel ) * uiQNumPart);
    15621755#endif
    15631756#endif
    1564 #if H_3D_INTER_SDC
     1757#endif
     1758#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    15651759  memcpy( rpcCU->getInterSDCFlag() + uiPartOffset, m_pbInterSDCFlag,      iSizeInBool  );
    15661760  for( Int i = 0; i < 4; i++ )
     
    15691763  }
    15701764#endif
     1765#if H_3D_DBBP
     1766  memcpy( rpcCU->getDBBPFlag()          + uiPartOffset, m_pbDBBPFlag,          iSizeInBool  );
     1767#endif
     1768 
    15711769  memcpy( rpcCU->getDepth()  + uiPartOffset, m_puhDepth,  iSizeInUchar );
    15721770  memcpy( rpcCU->getWidth()  + uiPartOffset, m_puhWidth,  iSizeInUchar );
     
    16111809#endif
    16121810}
     1811
     1812#if MTK_DDD_G0063
     1813Void TComDataCU::setDDDepthSubParts ( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     1814{
     1815    setSubPart<UChar>( ucDDD, m_pucDisparityDerivedDepth, uiAbsPartIdx, uiDepth, uiPartIdx );
     1816}
     1817
     1818Void TComDataCU::setUseDDD        ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     1819{
     1820    setSubPart<Bool>( bUseDDD, m_pbUseDDD, uiAbsPartIdx, uiDepth, uiPartIdx );
     1821}
     1822
     1823Void TComDataCU::setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth )
     1824{
     1825    memset( m_pbUseDDD + uiAbsPartIdx, bUseDDD, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) );
     1826}
     1827
     1828#endif
    16131829
    16141830// --------------------------------------------------------------------------------------------------------------------
     
    22672483  uiCtx    = ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1) : 0;
    22682484 
     2485#if !MTK_ARP_FLAG_CABAC_SIMP_G0061       
    22692486  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
    22702487  uiCtx   += ( pcTempCU ) ? ((pcTempCU->getARPW( uiTempPartIdx )==0)?0:1): 0;
    2271  
     2488#endif
    22722489  return uiCtx;
    22732490}
    22742491#endif
    2275 
     2492#if !MTK_IC_FLAG_CABAC_SIMP_G0061
    22762493#if H_3D_IC
    22772494UInt TComDataCU::getCtxICFlag( UInt uiAbsPartIdx )
     
    22912508}
    22922509#endif
     2510#endif
     2511#if H_3D_DBBP
     2512Pel* TComDataCU::getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride)
     2513{
     2514  // get coded and reconstructed depth view
     2515  TComPicYuv* depthPicYuv = NULL;
     2516  Pel* pDepthPels = NULL;
     2517 
     2518  // DBBP is a texture coding tool
     2519  if( getSlice()->getIsDepth() )
     2520  {
     2521    return NULL;
     2522  }
     2523 
     2524#if H_3D_FCO
     2525  TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     2526 
     2527  if( depthPic && depthPic->getPicYuvRec() != NULL && depthPic->getIsDepth() )  // depth first
     2528  {
     2529    depthPicYuv = depthPic->getPicYuvRec();
     2530    depthPicYuv->extendPicBorder();
     2531   
     2532    // get collocated depth block for current CU
     2533    uiDepthStride = depthPicYuv->getStride();
     2534    pDepthPels    = depthPicYuv->getLumaAddr( getAddr(), uiAbsPartIdx );
     2535  }
     2536  else  // texture first
     2537#else
     2538  {
     2539    DisInfo DvInfo = getDvInfo(uiAbsPartIdx);
     2540   
     2541    TComPic* baseDepthPic = getSlice()->getIvPic (true, DvInfo.m_aVIdxCan);
     2542   
     2543    if( baseDepthPic == NULL || baseDepthPic->getPicYuvRec() == NULL )
     2544    {
     2545      return NULL;
     2546    }
     2547   
     2548    depthPicYuv   = baseDepthPic->getPicYuvRec();
     2549    depthPicYuv->extendPicBorder();
     2550    uiDepthStride = depthPicYuv->getStride();
     2551   
     2552    Int iBlkX = ( getAddr() % baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ];
     2553    Int iBlkY = ( getAddr() / baseDepthPic->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ getZorderIdxInCU()+uiAbsPartIdx ] ];
     2554   
     2555    Int iPictureWidth  = depthPicYuv->getWidth();
     2556    Int iPictureHeight = depthPicYuv->getHeight();
     2557   
     2558    Int iWidth  = uiWidth;
     2559    Int iHeight = uiHeight;
     2560   
     2561    Bool depthRefineFlag = false;
     2562#if H_3D_NBDV_REF
     2563    depthRefineFlag = m_pcSlice->getVPS()->getDepthRefinementFlag( m_pcSlice->getLayerIdInVps() );
     2564#endif // H_3D_NBDV_REF
     2565   
     2566    TComMv cDv = depthRefineFlag ? DvInfo.m_acDoNBDV : DvInfo.m_acNBDV;
     2567   
     2568    Int depthPosX = Clip3(0,   iPictureWidth - iWidth,  iBlkX + ((cDv.getHor()+2)>>2));
     2569    Int depthPosY = Clip3(0,   iPictureHeight- iHeight, iBlkY + ((cDv.getVer()+2)>>2));
     2570   
     2571    pDepthPels = depthPicYuv->getLumaAddr() + depthPosX + depthPosY * uiDepthStride;
     2572  }
     2573#endif
     2574 
     2575  AOF( depthPicYuv != NULL );
     2576  AOF( pDepthPels != NULL );
     2577  AOF( uiDepthStride != 0 );
     2578 
     2579  return pDepthPels;
     2580}
     2581#endif
     2582
     2583#if H_3D_DBBP
     2584Void TComDataCU::setDBBPFlagSubParts ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2585{
     2586  setSubPart( bDBBPFlag, m_pbDBBPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
     2587}
     2588#endif
    22932589
    22942590#if H_3D_INTER_SDC
     2591#if !QC_SDC_UNIFY_G0130
    22952592Void TComDataCU::setInterSDCFlagSubParts ( Bool bInterSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    22962593{
     
    23022599  return 0;
    23032600}
    2304 
     2601#endif
     2602
     2603#if !SEC_INTER_SDC_G0101
    23052604Void TComDataCU::xSetInterSDCCUMask( TComDataCU *pcCU, UChar *pMask )
    23062605{
     
    24002699}
    24012700#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
    24022742
    24032743UInt TComDataCU::getCtxInterDir( UInt uiAbsPartIdx )
     
    26272967  if( !getSlice()->getIsDepth() || !isIntra(uiAbsPartIdx) || getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N )
    26282968    return false;
    2629  
     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
    26302982  // check prediction mode
    26312983  UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx ); 
     
    32503602  Bool* abCandIsInter, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* vspFlag, Int& iCount3DV, InheritedVSPDisInfo*  inheritedVSPDisInfo  )
    32513603  {
     3604#if MTK_NBDV_IVREF_FIX_G0067
     3605  if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() || pDInfo->m_aVIdxCan == -1)
     3606#else
    32523607  if ( m_pcSlice->getViewIndex() == 0 || !m_pcSlice->getVPS()->getViewSynthesisPredFlag( m_pcSlice->getLayerIdInVps() ) || m_pcSlice->getIsDepth() )
     3608#endif
    32533609  {
    32543610    return false;
     
    32673623 
    32683624  Bool  refViewAvailFlag = false;
    3269   UChar predFlag[2]      = {0, 0}; 
     3625  UChar predFlag[2]      = {0, 0};
     3626#if !MTK_RBIP_VSP_G0069
    32703627  Int   refListIdY       = 0;   
    32713628  Int   viewIdInRefListX = -1;
     3629#endif
    32723630 
    32733631  for( Int iRefListIdX = 0; iRefListIdX < 2 && !refViewAvailFlag; iRefListIdX++ )
     
    32813639        refViewAvailFlag      = true;
    32823640        predFlag[iRefListIdX] = 1;
     3641#if !MTK_RBIP_VSP_G0069
    32833642        viewIdInRefListX      = m_pcSlice->getRefPic(eRefPicListX, i)->getViewId();
    32843643        refListIdY            = 1 - iRefListIdX;
     3644#endif
    32853645        pcMvFieldNeighbours[(iCount<<1)+iRefListIdX].setMvField( pDInfo->m_acNBDV, i );
    32863646#if H_3D_NBDV
     
    32913651  }
    32923652
     3653#if !MTK_RBIP_VSP_G0069
    32933654  if (m_pcSlice->isInterB() && refViewAvailFlag)
    32943655  {
     
    33303691    }
    33313692  }
     3693#endif
    33323694
    33333695  // Set values to be returned
     
    34483810  for ( Int currListPos = (ivCandDir[0] ? 1 : 0); currListPos < iCount; currListPos++ )
    34493811  {
     3812#if NTT_STORE_SPDV_VSP_G0148
     3813    if ( ( currListPos == posIvDC ) || ( vspFlag[ currListPos ] != 0 ) )
     3814#else
    34503815    if ( ( currListPos == posIvDC ) || ( vspFlag[ currListPos ] == 1 ) )
     3816#endif
    34513817    {
    34523818      continue;
     
    38804246  UChar tmpDir;
    38814247
     4248#if MTK_DDD_G0063
     4249  m_iUseDDDCandIdx = -1;
     4250#endif
     4251
    38824252  //////////////////////////////////
    38834253  //////// GET DISPARITIES  ////////
     
    39324302  Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
    39334303#endif
     4304#if H_3D_DBBP
     4305  Bool bDBBPFlag = getDBBPFlag(uiAbsPartIdx);
     4306#endif
    39344307
    39354308#if H_3D
     
    39574330    iPosLeftAbove[0] = numA1B1B0;
    39584331#if H_3D_VSP
     4332#if NTT_STORE_SPDV_VSP_G0148
     4333    if (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
     4334#else
    39594335    if (pcCULeft->getVSPFlag(uiLeftPartIdx) == 1
     4336#endif
    39604337#if H_3D_IC
    39614338      && !bICFlag
     
    39804357    iPosLeftAbove[1] = numA1B1B0;
    39814358#if H_3D_VSP
     4359#if NTT_STORE_SPDV_VSP_G0148
     4360    if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) != 0)
     4361#else
    39824362    if ( ( ( getAddr() - pcCUAbove->getAddr() ) == 0) && (pcCUAbove->getVSPFlag(uiAbovePartIdx) == 1)
     4363#endif
    39834364#if H_3D_IC
    39844365      && !bICFlag
     
    40034384  {
    40044385#if H_3D_VSP
     4386#if NTT_STORE_SPDV_VSP_G0148
     4387    if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) != 0)
     4388#else
    40054389    if ( ( ( getAddr() - pcCUAboveRight->getAddr() ) == 0) && (pcCUAboveRight->getVSPFlag(uiAboveRightPartIdx) == 1)
     4390#endif
    40064391#if H_3D_IC
    40074392      && !bICFlag
     
    40244409  {
    40254410#if H_3D_VSP
     4411#if NTT_STORE_SPDV_VSP_G0148
     4412    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) != 0
     4413#else
    40264414    if (pcCULeftBottom->getVSPFlag(uiLeftBottomPartIdx) == 1
     4415#endif
    40274416#if H_3D_IC
    40284417      && !bICFlag
     
    40474436  {
    40484437#if H_3D_VSP
     4438#if NTT_STORE_SPDV_VSP_G0148
     4439    if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) != 0)
     4440#else
    40494441    if ( ( ( getAddr() - pcCUAboveLeft->getAddr() ) == 0) && (pcCUAboveLeft->getVSPFlag(uiAboveLeftPartIdx) == 1)
     4442#endif
    40504443#if H_3D_IC
    40514444      && !bICFlag
     
    40754468  if( bMPIFlag)
    40764469  {
     4470#if QC_SPIVMP_MPI_G0119
     4471    tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     4472    tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     4473    tmpDir        =  0;
     4474
     4475    TComPic * pcTexPic = m_pcSlice->getTexturePic();
     4476#if H_3D_FCO
     4477    if (pcTexturePic->getReconMark())
     4478    {
     4479#endif   
     4480      TComPicYuv*   pcTexRec = pcTexPic->getPicYuvRec  ();
     4481      UInt          uiPartAddr;
     4482      Int           iWidth, iHeight;
     4483      Int           iCurrPosX, iCurrPosY;
     4484
     4485      this->getPartIndexAndSize( uiPUIdx, uiPartAddr, iWidth, iHeight );
     4486      pcTexRec->getTopLeftSamplePos( this->getAddr(), this->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
     4487
     4488      Int iPUWidth, iPUHeight, iNumPart, iNumPartLine;
     4489      this->getSPPara(iWidth, iHeight, iNumPart, iNumPartLine, iPUWidth, iPUHeight);
     4490
     4491      for (Int i=0; i<iNumPart; i++)
     4492      {
     4493        puhInterDirSP[i] = 0;
     4494        pcMvFieldSP[2*i].getMv().set(0, 0);
     4495        pcMvFieldSP[2*i+1].getMv().set(0, 0);
     4496        pcMvFieldSP[2*i].setRefIdx(-1);
     4497        pcMvFieldSP[2*i+1].setRefIdx(-1);
     4498      }
     4499
     4500      Int         iTexCUAddr;
     4501      Int         iTexAbsPartIdx;
     4502      TComDataCU* pcTexCU;
     4503      Int iPartition = 0;
     4504      Int iInterDirSaved = 0;
     4505      TComMvField cMvFieldSaved[2];
     4506
     4507      Int iOffsetX = iPUWidth/2;;
     4508      Int iOffsetY = iPUHeight/2;
     4509
     4510      Int         iTexPosX, iTexPosY;
     4511      const TComMv cMvRounding( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
     4512      for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iPUHeight)
     4513      {
     4514        for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iPUWidth)
     4515        {
     4516          iTexPosX     = j + iOffsetX;
     4517          iTexPosY     = i + iOffsetY;
     4518          pcTexRec->getCUAddrAndPartIdx( iTexPosX, iTexPosY, iTexCUAddr, iTexAbsPartIdx );
     4519          pcTexCU  = pcTexPic->getCU( iTexCUAddr );
     4520
     4521          if( pcTexCU && !pcTexCU->isIntra(iTexAbsPartIdx) )
     4522          {
     4523            for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )
     4524            {
     4525              RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
     4526              TComMvField cTexMvField;
     4527              pcTexCU->getMvField( pcTexCU, iTexAbsPartIdx, eCurrRefPicList, cTexMvField );
     4528              Int iValidDepRef = getPic()->isTextRefValid( eCurrRefPicList, cTexMvField.getRefIdx() );
     4529              if( (cTexMvField.getRefIdx()>=0) && ( iValidDepRef >= 0 ) )
     4530              {
     4531                TComMv cMv = cTexMvField.getMv() + cMvRounding;
     4532                cMv >>=2;
     4533                this->clipMv( cMv );
     4534                pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iValidDepRef);
     4535              }
     4536            }
     4537          }
     4538          puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0);
     4539          if (puhInterDirSP[iPartition] == 0)
     4540          {
     4541            if (iInterDirSaved != 0)
     4542            {
     4543              puhInterDirSP[iPartition] = iInterDirSaved;
     4544              pcMvFieldSP[2*iPartition] = cMvFieldSaved[0];
     4545              pcMvFieldSP[2*iPartition + 1] = cMvFieldSaved[1];
     4546            }
     4547          }
     4548          else
     4549          {
     4550            if (iInterDirSaved ==0)
     4551            {
     4552              pbSPIVMPFlag[iCount] = true;
     4553              tmpDir = puhInterDirSP[iPartition];
     4554              tmpMV[0] = pcMvFieldSP[2*iPartition];
     4555              tmpMV[1] = pcMvFieldSP[2*iPartition+1];
     4556
     4557              if (iPartition != 0)
     4558              {
     4559                for (Int iPart = iPartition-1; iPart >= 0; iPart--)
     4560                {
     4561                  puhInterDirSP[iPart] = puhInterDirSP[iPartition];
     4562                  pcMvFieldSP[2*iPart] = pcMvFieldSP[2*iPartition];
     4563                  pcMvFieldSP[2*iPart + 1] = pcMvFieldSP[2*iPartition + 1];
     4564                }
     4565              }
     4566            }
     4567            iInterDirSaved = puhInterDirSP[iPartition];
     4568            cMvFieldSaved[0] = pcMvFieldSP[2*iPartition];
     4569            cMvFieldSaved[1] = pcMvFieldSP[2*iPartition + 1];
     4570          }
     4571          iPartition ++;
     4572        }
     4573      }
     4574#if H_3D_FCO
     4575    }
     4576#endif
     4577#else
    40774578    UInt uiPartIdxCenter;
    40784579    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );   
     
    41314632        tmpDir += ((tmpMV[1].getRefIdx()>=0)?2:0);
    41324633      }
    4133 
     4634#endif
    41344635      if( tmpDir != 0 )
    41354636      {
     
    41904691          }
    41914692        }
    4192 
     4693#if QC_SPIVMP_MPI_G0119
     4694        pcMvFieldNeighbours[iCount<<1].setMvField(tmpMV[0].getMv(), tmpMV[0].getRefIdx());
     4695        pcMvFieldNeighbours[(iCount<<1)+1].setMvField(tmpMV[1].getMv(), tmpMV[1].getRefIdx());
     4696#else
    41934697        if( (tmpMV[0].getRefIdx()>=0) && ( tRef[0] >= 0 ) )
    41944698        {
     
    42024706          }
    42034707        }
     4708#endif
    42044709        puhInterDirNeighbours[iCount] = tmpDir;
    42054710
     
    42104715        iCount ++;
    42114716      }
    4212     }
    4213   }
    4214 
     4717#if !QC_SPIVMP_MPI_G0119
     4718    }
     4719#endif
     4720  }
     4721#if MTK_DDD_G0063
     4722  if( m_pcSlice->getIsDepth() && m_pcSlice->getViewIndex() != 0  && bMPIFlag )
     4723  {
     4724      UInt uiPartIdx;
     4725      TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
     4726      TComSlice *pcTextureSlice = pcTextureCU->getSlice(); 
     4727
     4728
     4729      tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     4730      tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     4731      tmpDir = 0;
     4732
     4733      xDeriveCenterIdx( uiPUIdx, uiPartIdx);
     4734
     4735      if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdx ) )
     4736      {
     4737
     4738          TComMvField cMVField;
     4739          UChar ucInterDir = pcTextureCU->getInterDir( uiPartIdx );
     4740
     4741          Int iDV = 0;
     4742          Int iViewIdx = 0;
     4743          if( ucInterDir & 1 )
     4744          {
     4745              pcTextureCU->getMvField( pcTextureCU, uiPartIdx, REF_PIC_LIST_0, cMVField );
     4746              if( pcTextureSlice->getRefPOC( REF_PIC_LIST_0, cMVField.getRefIdx()) == pcTextureSlice->getPOC() )
     4747              {
     4748                  iViewIdx = pcTextureSlice->getRefPic( REF_PIC_LIST_0, cMVField.getRefIdx())->getViewIndex();
     4749                  iDV = cMVField.getHor();
     4750
     4751
     4752                  Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, cMVField.getRefIdx() );
     4753
     4754                  if( iValidDepRef >= 0 )
     4755                  {
     4756                      const TComMv cAdd( 2, 2 );
     4757                      cMVField.getMv() += cAdd;
     4758                      cMVField.getMv() >>= 2;
     4759                      clipMv( cMVField.getMv() );
     4760                      tmpMV[ 0 ].setMvField( cMVField.getMv(), iValidDepRef );
     4761                      tmpDir = 1;
     4762                  }
     4763              }
     4764          }
     4765          if( !tmpDir && ( ucInterDir & 2 ))
     4766          {
     4767              pcTextureCU->getMvField( pcTextureCU, uiPartIdx, REF_PIC_LIST_1, cMVField );
     4768              if( pcTextureSlice->getRefPOC( REF_PIC_LIST_1, cMVField.getRefIdx()) == pcTextureSlice->getPOC() )
     4769              {
     4770                  iViewIdx = pcTextureSlice->getRefPic( REF_PIC_LIST_1, cMVField.getRefIdx())->getViewIndex();
     4771                  iDV = cMVField.getHor();
     4772
     4773                  Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, cMVField.getRefIdx() );
     4774
     4775                  if( iValidDepRef >= 0 )
     4776                  {
     4777                      const TComMv cAdd( 2, 2 );
     4778                      cMVField.getMv() += cAdd;
     4779                      cMVField.getMv() >>= 2;
     4780                      clipMv( cMVField.getMv() );
     4781                      tmpMV[ 1 ].setMvField( cMVField.getMv(), iValidDepRef );
     4782                      tmpDir = 2;
     4783                  }
     4784              }
     4785          }
     4786          if( tmpDir != 0 )
     4787          {
     4788              rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, 5-iCount, iCount3DV);
     4789              m_ucDDTmpDepth = m_pcSlice->getDepthFromDV( iDV,  iViewIdx );
     4790              m_iUseDDDCandIdx = iCount;
     4791
     4792              if( tmpDir == 1 )
     4793              {
     4794                  pcMvFieldNeighbours[ iCount << 1 ] = tmpMV[ 0 ];
     4795              }
     4796              else if( tmpDir == 2  )
     4797              {
     4798                  pcMvFieldNeighbours[( iCount << 1 ) + 1 ] = tmpMV[ 1 ];
     4799              }
     4800
     4801              abCandIsInter        [ iCount ] = true;
     4802              puhInterDirNeighbours[ iCount ] = tmpDir;
     4803
     4804              if ( mrgCandIdx == iCount )
     4805              {
     4806                  return;
     4807              }
     4808              iCount ++;
     4809
     4810              Int iLeftAboveAvail = 0;
     4811              if( iPosLeftAbove[ 0 ] != -1 )
     4812              {
     4813                  iPosLeftAbove[ 0 ] = iCount;
     4814                  iLeftAboveAvail = 1;
     4815              }
     4816              if( iPosLeftAbove[ 1 ] != -1 )
     4817              {
     4818                  iPosLeftAbove[ 1 ] = iCount + iLeftAboveAvail;
     4819              }
     4820
     4821          }
     4822      }     
     4823
     4824  }
     4825#endif
    42154826  /////////////////////////////////////////////////////////////////
    42164827  //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC  Candidates /////
     
    42294840  Bool ivMvPredFlag   = getSlice()->getVPS()->getIvMvPredFlag( getSlice()->getLayerIdInVps() );
    42304841
     4842#if MTK_NBDV_IVREF_FIX_G0067
     4843  if ( ivMvPredFlag && cDisInfo.m_aVIdxCan!=-1)
     4844#else
    42314845  if ( ivMvPredFlag )
     4846#endif
    42324847  {
    42334848    getInterViewMergeCands(uiPUIdx, ivCandRefIdx, ivCandMv, &cDisInfo, ivCandDir , bIsDepth, pcMvFieldSP, puhInterDirSP );
     
    42374852  //////// INTER VIEW MOTION COMP(IvMC) /////////
    42384853  ///////////////////////////////////////////////
    4239 
     4854#if QC_DEPTH_MERGE_SIMP_G0127
     4855  if( getSlice()->getIsDepth() )
     4856  {
     4857    ivCandDir[1] = ivCandDir[2] = ivCandDir[3] = 0;
     4858  }
     4859#endif
    42404860  if( ivCandDir[0] )
    42414861  {
     
    42774897      for(; iCnloop >= 0; iCnloop --)
    42784898      {
     4899#if MTK_DDD_G0063
     4900          if( iCnloop == m_iUseDDDCandIdx )
     4901          {
     4902              continue;
     4903          }
     4904#endif
    42794905        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1])  // F0125 compatible with F0093
    42804906        {
     
    43394965    if (bIvMC)
    43404966    {
     4967#if QC_SPIVMP_MPI_G0119
     4968      if(!m_pcSlice->getIsDepth())
     4969#endif
     4970#if SEC_SPIVMP_MCP_SIZE_G0077
     4971        if(getPartitionSize(0) == SIZE_2Nx2N)
     4972          pbSPIVMPFlag[iCount] = true;
     4973#else
    43414974      pbSPIVMPFlag[iCount] = true;
     4975#endif
     4976#if H_3D_DBBP
     4977      pbSPIVMPFlag[iCount] &= !bDBBPFlag;
     4978#endif
    43424979      if( ( ivCandDir[0] & 1 ) == 1 )
    43434980      {
     
    44665103#endif
    44675104
     5105#if MTK_DDD_G0063
     5106  // early termination
     5107  if ( iCount >= getSlice()->getMaxNumMergeCand())
     5108  {
     5109      return;
     5110  }
     5111#endif
    44685112
    44695113#if H_3D_IV_MERGE
     
    44715115  //////// INTER VIEW DISP COMP (IvDC) ////////
    44725116  /////////////////////////////////////////////
    4473 
     5117#if QC_DEPTH_MERGE_SIMP_G0127
     5118  if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
     5119#else
    44745120  if( ivCandDir[1] && iCount < getSlice()->getMaxNumMergeCand())
     5121#endif
    44755122  {
    44765123    assert(iCount < getSlice()->getMaxNumMergeCand());
     
    46335280  //////// SHIFTED IV (IvMCShift + IvDCShift) ////////
    46345281  ////////////////////////////////////////////////////
     5282#if QC_DEPTH_MERGE_SIMP_G0127
     5283  if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() && !getSlice()->getIsDepth() )
     5284#else
    46355285  if(  ivMvPredFlag && iCount < getSlice()->getMaxNumMergeCand() )
     5286#endif
    46365287  {
    46375288    if(xAddIvMRGCand( mrgCandIdx,  iCount, abCandIsInter, pcMvFieldNeighbours, puhInterDirNeighbours, ivCandDir, ivCandMv, ivCandRefIdx, posIvDC, vspFlag, iCount3DV, inheritedVSPDisInfo ) )
     
    54396090  Int height = 0;
    54406091  UInt partAddr;
     6092 
     6093#if H_3D_DBBP
     6094  if( getDBBPFlag(0) )
     6095  {
     6096    return true;
     6097  }
     6098#endif
    54416099
    54426100  getPartIndexAndSize( puIdx, partAddr, width, height );
     
    63627020#endif
    63637021#if H_3D_IV_MERGE
     7022#if SEC_DEPTH_DV_DERIVAITON_G0074
     7023Bool TComDataCU::getDispforDepth (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
     7024#else
    63647025Bool TComDataCU::getDispNeighBlocks (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
    6365 {
     7026#endif
     7027{
     7028#if SEC_DEPTH_DV_DERIVAITON_G0074
     7029  assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N);
     7030
     7031  TComMv cMv;
     7032  Int iDisp     = getSlice()->getDepthToDisparityB( 0 )[ 128 ];
     7033  cMv.setHor(iDisp);
     7034  cMv.setVer(0);
     7035  pDisp->m_acNBDV = cMv;
     7036  pDisp->m_aVIdxCan = 0;
     7037
     7038  return true;
     7039#else
    63667040  Pel pDepPos[3] = {0, 0, 0};
    63677041  assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N);
     
    64097083    return false;
    64107084  }
     7085#endif
    64117086}
    64127087#endif
     
    64257100  // Init disparity struct for results
    64267101  pDInfo->bDV = false;   
     7102#if MTK_NBDV_IVREF_FIX_G0067
     7103  pDInfo->m_aVIdxCan = -1;
     7104#endif
    64277105  // Init struct for disparities from MCP neighboring blocks
    64287106  IDVInfo cIDVInfo;
     
    69457623{
    69467624  Int iSubPUSize = 1<<getSlice()->getVPS()->getSubPULog2Size(getSlice()->getLayerId());
     7625#if QC_SPIVMP_MPI_G0119
     7626  if( getSlice()->getIsDepth() )
     7627  {
     7628    iSubPUSize = 1 << getSlice()->getVPS()->getSubPUMPILog2Size();
     7629  }
     7630#endif
    69477631  iNumSPInOneLine = iPUWidth/iSubPUSize;
    69487632  iNumSPInOneLine = iNumSPInOneLine < 1 ? 1: iNumSPInOneLine;
     
    70387722  //////////sub-PU IvMC///////////
    70397723  ////////////////////////////////
    7040  
     7724#if QC_SPIVMP_MPI_G0119
     7725  if(!m_pcSlice->getIsDepth())
     7726  {
     7727#endif 
     7728#if SEC_SPIVMP_MCP_SIZE_G0077
     7729  if( getPartitionSize(0) == SIZE_2Nx2N )
     7730  {
     7731#endif
    70417732  Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
    70427733  getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     
    70557746  TComDataCU* pcBaseCU;
    70567747  Int iPartition = 0;
     7748#if !KHU_SIMP_SPIVMP_G0147
    70577749  Int iInterDirLast = 0;
    70587750  TComMvField cMvFieldLast[2];
     7751#endif
    70597752
    70607753  Int iDelX = iSPWidth/2;
    70617754  Int iDelY = iSPHeight/2;
    70627755
     7756#if KHU_SIMP_SPIVMP_G0147
     7757  Int         iCenterPosX = iCurrPosX + ( ( iWidth /  iSPWidth ) >> 1 )  * iSPWidth + ( iSPWidth >> 1 );
     7758  Int         iCenterPosY = iCurrPosY + ( ( iHeight /  iSPHeight ) >> 1 )  * iSPHeight + (iSPHeight >> 1);
     7759  Int         iRefCenterCUAddr, iRefCenterAbsPartIdx;
     7760
     7761  if(iWidth == iSPWidth && iHeight == iSPHeight)
     7762  {
     7763    iCenterPosX = iCurrPosX + (iWidth >> 1);
     7764    iCenterPosY = iCurrPosY + (iHeight >> 1);
     7765  }
     7766
     7767  Int iRefCenterPosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCenterPosX + ( (cDv.getHor() + 2 ) >> 2 ) );
     7768  Int iRefCenterPosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCenterPosY + ( (cDv.getVer() + 2 ) >> 2 ) );
     7769
     7770  pcBaseRec->getCUAddrAndPartIdx( iRefCenterPosX , iRefCenterPosY , iRefCenterCUAddr, iRefCenterAbsPartIdx );
     7771  TComDataCU* pcDefaultCU    = pcBasePic->getCU( iRefCenterCUAddr );
     7772  if(!( pcDefaultCU->getPredictionMode( iRefCenterAbsPartIdx ) == MODE_INTRA ))
     7773  {
     7774    for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )       
     7775    {
     7776      RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
     7777      Bool stopLoop = false;
     7778      for(Int iLoop = 0; iLoop < 2 && !stopLoop; ++iLoop)
     7779      {
     7780        RefPicList eDefaultRefPicList = (iLoop ==1)? RefPicList( 1 -  uiCurrRefListId ) : RefPicList( uiCurrRefListId );
     7781        TComMvField cDefaultMvField;
     7782        pcDefaultCU->getMvField( pcDefaultCU, iRefCenterAbsPartIdx, eDefaultRefPicList, cDefaultMvField );
     7783        Int         iDefaultRefIdx     = cDefaultMvField.getRefIdx();
     7784        if (iDefaultRefIdx >= 0)
     7785        {
     7786          Int iDefaultRefPOC = pcDefaultCU->getSlice()->getRefPOC(eDefaultRefPicList, iDefaultRefIdx);
     7787          if (iDefaultRefPOC != pcSlice->getPOC())   
     7788          {
     7789            for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++)
     7790            {
     7791              if (iDefaultRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx))
     7792              {
     7793                abPdmAvailable[ uiCurrRefListId ] = true;
     7794                TComMv cMv(cDefaultMvField.getHor(), cDefaultMvField.getVer());
     7795#if H_3D_NBDV
     7796#if H_3D_IV_MERGE
     7797                if( !bIsDepth )
     7798                {
     7799#endif
     7800                  cMv.setIDVFlag   (true);
     7801                  cMv.setIDVHor    (cDv.getHor());                 
     7802                  cMv.setIDVVer    (cDv.getVer()); 
     7803                  cMv.setIDVVId    (iViewIndex);
     7804#if H_3D_IV_MERGE
     7805                }
     7806#endif
     7807#endif
     7808                clipMv( cMv );
     7809                paiPdmRefIdx  [ uiCurrRefListId ] = iPdmRefIdx;
     7810                pacPdmMv      [ uiCurrRefListId ] = cMv;
     7811                stopLoop = true;
     7812                break;
     7813              }
     7814            }
     7815          }
     7816        }
     7817      }
     7818    }
     7819  }
     7820  availableMcDc[0] = ( abPdmAvailable[0]? 1 : 0) + (abPdmAvailable[1]? 2 : 0);
     7821
     7822  if(availableMcDc[0])
     7823  {
     7824#endif
    70637825  Int         iBasePosX, iBasePosY;
    70647826  for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iSPHeight)
     
    71197881      if (puhInterDirSP[iPartition] == 0)
    71207882      {
     7883#if KHU_SIMP_SPIVMP_G0147
     7884        puhInterDirSP[iPartition] = availableMcDc[0];
     7885        pcMvFieldSP[2*iPartition].setMvField(pacPdmMv[0], paiPdmRefIdx[0]);
     7886        pcMvFieldSP[2*iPartition + 1].setMvField(pacPdmMv[1], paiPdmRefIdx[1]);
     7887#else
    71217888        if (iInterDirLast != 0)
    71227889        {
     
    71257892          pcMvFieldSP[2*iPartition + 1] = cMvFieldLast[1];
    71267893        }
    7127       }
     7894#endif
     7895      }
     7896#if !KHU_SIMP_SPIVMP_G0147
    71287897      else
    71297898      {
     
    71507919        cMvFieldLast[1] = pcMvFieldSP[2*iPartition + 1];
    71517920      }
    7152 
     7921#endif
    71537922      iPartition ++;
    71547923
    71557924    }
    7156   } 
     7925  }
     7926#if KHU_SIMP_SPIVMP_G0147
     7927  }
     7928#endif
     7929#if SEC_SPIVMP_MCP_SIZE_G0077
     7930  }
     7931#endif
    71577932
    71587933  iCurrPosX  += ( iWidth  >> 1 );
    71597934  iCurrPosY  += ( iHeight >> 1 );
     7935#if QC_SPIVMP_MPI_G0119
     7936 }
     7937#endif
    71607938#endif
    71617939
     
    71657943
    71667944#if H_3D_SPIVMP
     7945#if QC_SPIVMP_MPI_G0119
     7946 if(m_pcSlice->getIsDepth())
     7947 {
     7948   iCurrPosX  += ( iWidth  >> 1 );
     7949   iCurrPosY  += ( iHeight >> 1 );
     7950 }
     7951#if QC_DEPTH_MERGE_SIMP_G0127
     7952#if SEC_SPIVMP_MCP_SIZE_G0077
     7953  for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getPartitionSize(uiPartAddr) != SIZE_2Nx2N) ? 0 : 1 ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++)
     7954#else
     7955 for(Int iLoopCan = ( 1 - m_pcSlice->getIsDepth() ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++)
     7956#endif
     7957#else
     7958#if SEC_SPIVMP_MCP_SIZE_G0077
     7959 for(Int iLoopCan = ( (m_pcSlice->getIsDepth() || getPartitionSize(uiPartAddr) != SIZE_2Nx2N) ? 0 : 1 ); iLoopCan < 2; iLoopCan ++)
     7960#else
     7961 for(Int iLoopCan = ( 1 - m_pcSlice->getIsDepth() ); iLoopCan < 2; iLoopCan ++)
     7962#endif
     7963#endif
     7964#else
     7965#if SEC_SPIVMP_MCP_SIZE_G0077
     7966 for(Int iLoopCan = (getPartitionSize(uiPartAddr) == SIZE_2Nx2N ? 1 : 0); iLoopCan < 2; iLoopCan ++)
     7967#else
    71677968  for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++)
     7969#endif
     7970#endif
    71687971#else
    71697972  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
     
    71737976    // iLoopCan == 1 --> IvMCShift
    71747977
    7175 #if !H_3D_SPIVMP
     7978#if !H_3D_SPIVMP || QC_SPIVMP_MPI_G0119
    71767979    Int         iBaseCUAddr;
    71777980    Int         iBaseAbsPartIdx;
     
    71817984    Int offsetH = (iLoopCan == 0) ? 0 : ( ((iHeight/2)*4) + 4 );
    71827985
    7183 #if H_3D_SPIVMP
     7986#if H_3D_SPIVMP && !QC_SPIVMP_MPI_G0119
    71847987    iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, iCurrPosX + ( (cDv.getHor() + offsetW + 2 ) >> 2 ) );
    71857988    iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, iCurrPosY + ( (cDv.getVer() + offsetH + 2 ) >> 2 ) );
     
    71907993    pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY , iBaseCUAddr, iBaseAbsPartIdx );
    71917994
    7192 #if H_3D_SPIVMP
     7995#if H_3D_SPIVMP && !QC_SPIVMP_MPI_G0119
    71937996    pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
    71947997#else
     
    72488051  }
    72498052#if H_3D_SPIVMP
     8053#if QC_SPIVMP_MPI_G0119
     8054#if QC_DEPTH_MERGE_SIMP_G0127
     8055  for(Int iLoopCan = ( 1 - m_pcSlice->getIsDepth() ); iLoopCan < ( 2 - m_pcSlice->getIsDepth() ); iLoopCan ++)
     8056#else
     8057  for(Int iLoopCan = ( 1 - m_pcSlice->getIsDepth() ); iLoopCan < 2; iLoopCan ++)
     8058#endif
     8059#else
    72508060  for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++)
     8061#endif
    72518062#else
    72528063  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
     
    72608071  /////// IvDC + IvDCShift ///////
    72618072  ////////////////////////////////
    7262  
     8073#if QC_DEPTH_MERGE_SIMP_G0127
     8074  if( !getSlice()->getIsDepth() )
     8075  {
     8076#endif
    72638077  for( Int iRefListId = 0; iRefListId < 2 ; iRefListId++ )
    72648078  {
     
    72948108    availableMcDc[1 + (iLoopCan << 1)] = ( abPdmAvailable[2 + (iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[3 + (iLoopCan<<2)] ? 2 : 0 );
    72958109  }
     8110#if QC_DEPTH_MERGE_SIMP_G0127
     8111  }
     8112#endif
    72968113  return false;
    72978114}
     
    73678184#endif
    73688185
     8186#if NTT_STORE_SPDV_VSP_G0148
     8187Void TComDataCU::setMvFieldPUForVSP( TComDataCU* pcCU, UInt partAddr, Int width, Int height, RefPicList eRefPicList, Int iRefIdx, Int &vspSize )
     8188{
     8189  // Get depth reference
     8190  Int depthRefViewIdx = pcCU->getDvInfo(partAddr).m_aVIdxCan;
     8191 
     8192#if H_3D_FCO_VSP_DONBDV_E0163
     8193  TComPic* pRefPicBaseDepth = 0;
     8194  Bool     bIsCurrDepthCoded = false;
     8195  pRefPicBaseDepth  = pcCU->getSlice()->getIvPic( true, pcCU->getSlice()->getViewIndex() );
     8196  if ( pRefPicBaseDepth->getPicYuvRec() != NULL  )
     8197  {
     8198    bIsCurrDepthCoded = true;
     8199  }
     8200  else
     8201  {
     8202    pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx );
     8203  }
     8204#else
     8205  TComPic* pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx );
     8206#endif
     8207  assert(pRefPicBaseDepth != NULL);
     8208  TComPicYuv* pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
     8209  assert(pcBaseViewDepthPicYuv != NULL);
     8210  pcBaseViewDepthPicYuv->extendPicBorder();
     8211
     8212  // Get texture reference
     8213  assert(iRefIdx >= 0);
     8214  TComPic* pRefPicBaseTxt = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx );
     8215  TComPicYuv* pcBaseViewTxtPicYuv = pRefPicBaseTxt->getPicYuvRec();
     8216  assert(pcBaseViewTxtPicYuv != NULL);
     8217
     8218  // Initialize LUT according to the reference viewIdx
     8219  Int txtRefViewIdx = pRefPicBaseTxt->getViewIndex();
     8220  Int* pShiftLUT    = pcCU->getSlice()->getDepthToDisparityB( txtRefViewIdx );
     8221  assert( txtRefViewIdx < pcCU->getSlice()->getViewIndex() );
     8222
     8223  // prepare Dv to access depth map or reference view
     8224  TComMv cDv  = pcCU->getDvInfo(partAddr).m_acNBDV;
     8225  pcCU->clipMv(cDv);
     8226
     8227#if H_3D_FCO_VSP_DONBDV_E0163
     8228  if ( bIsCurrDepthCoded )
     8229  {
     8230      cDv.setZero();
     8231  }
     8232#endif
     8233
     8234  // fetch virtual depth map & convert depth to motion vector, which are stored in the motion memory
     8235  xSetMvFieldForVSP( pcCU, pcBaseViewDepthPicYuv, &cDv, partAddr, width, height, pShiftLUT, eRefPicList, iRefIdx, pcCU->getSlice()->getIsDepth(), vspSize );
     8236}
     8237
     8238Void TComDataCU::xSetMvFieldForVSP( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize )
     8239{
     8240  TComCUMvField *cuMvField = cu->getCUMvField( refPicList );
     8241  Int partAddrRasterSubPULine  = g_auiZscanToRaster[ partAddr ];
     8242  Int numPartsLine    = cu->getPic()->getNumPartInWidth();
     8243
     8244  Int nTxtPerMvInfoX = 4; // cu->getPic()->getMinCUWidth();
     8245  Int nTxtPerMvInfoY = 4; // cu->getPic()->getMinCUHeight();
     8246
     8247  Int refDepStride = picRefDepth->getStride();
     8248
     8249  TComMv tmpMv(0, 0);
     8250  tmpMv.setIDVFlag(false);
     8251
     8252  Int refDepOffset  = ( (dv->getHor()+2) >> 2 ) + ( (dv->getVer()+2) >> 2 ) * refDepStride;
     8253  Pel *refDepth     = picRefDepth->getLumaAddr( cu->getAddr(), cu->getZorderIdxInCU() + partAddr ) + refDepOffset;
     8254
     8255  if ((height % 8))
     8256  {
     8257    vspSize = 1; // 8x4
     8258  }
     8259  else if ((width % 8))
     8260  {
     8261    vspSize = 0; // 4x8
     8262  }
     8263  else
     8264  {
     8265    Bool ULvsBR, URvsBL;
     8266    ULvsBR = refDepth[0]       < refDepth[refDepStride * (height-1) + width-1];
     8267    URvsBL = refDepth[width-1] < refDepth[refDepStride * (height-1)];
     8268    vspSize = ( ULvsBR ^ URvsBL ) ? 0 : 1;
     8269  }
     8270 
     8271  Int subBlockW, subBlockH;
     8272  if (vspSize)
     8273  {
     8274    subBlockW = 8;
     8275    subBlockH = 4;
     8276  }
     8277  else
     8278  {
     8279    subBlockW = 4;
     8280    subBlockH = 8;
     8281  }
     8282 
     8283  Int numPartsInSubPUW = subBlockW / nTxtPerMvInfoX;
     8284  Int numPartsInSubPUH = subBlockH / nTxtPerMvInfoY * numPartsLine;
     8285
     8286  for( Int y=0; y<height; y+=subBlockH, partAddrRasterSubPULine+=numPartsInSubPUH )
     8287  {
     8288    Pel *refDepthTmp[4];
     8289    refDepthTmp[0] = refDepth + refDepStride * y;
     8290    refDepthTmp[1] = refDepthTmp[0] + subBlockW - 1;
     8291    refDepthTmp[2] = refDepthTmp[0] + refDepStride * (subBlockH - 1);
     8292    refDepthTmp[3] = refDepthTmp[2] + subBlockW - 1;
     8293
     8294    Int partAddrRasterSubPU = partAddrRasterSubPULine;
     8295    for( Int x=0; x<width; x+=subBlockW, partAddrRasterSubPU+=numPartsInSubPUW )
     8296    {
     8297      Pel  maxDepthVal;
     8298      maxDepthVal = refDepthTmp[0][x];
     8299      maxDepthVal = std::max( maxDepthVal, refDepthTmp[1][x]);
     8300      maxDepthVal = std::max( maxDepthVal, refDepthTmp[2][x]);
     8301      maxDepthVal = std::max( maxDepthVal, refDepthTmp[3][x]);
     8302      tmpMv.setHor( (Short) shiftLUT[ maxDepthVal ] );
     8303
     8304      Int partAddrRasterPartLine = partAddrRasterSubPU;
     8305      for( Int sY=0; sY<numPartsInSubPUH; sY+=numPartsLine, partAddrRasterPartLine += numPartsLine )
     8306      {
     8307        Int partAddrRasterPart = partAddrRasterPartLine;
     8308        for( Int sX=0; sX<numPartsInSubPUW; sX+=1, partAddrRasterPart++ )
     8309        {
     8310          cuMvField->setMv    ( g_auiRasterToZscan[ partAddrRasterPart ], tmpMv );
     8311          cuMvField->setRefIdx( g_auiRasterToZscan[ partAddrRasterPart ], refIdx );
     8312        }
     8313      }
     8314    }
     8315  }
     8316
     8317  vspSize = (vspSize<<2)+1;
     8318
     8319}
     8320#endif // NTT_STORE_SPDV_VSP_G0148
    73698321
    73708322//! \}
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r773 r833  
    9797};
    9898
     99#if H_3D_DBBP
     100typedef struct _DBBPTmpData
     101{
     102  TComMv      acMvd[2][2];          // for two segments and two lists
     103  TComMvField acMvField[2][2];      // for two segments and two lists
     104  Int         aiMvpNum[2][2];       // for two segments and two lists
     105  Int         aiMvpIdx[2][2];       // for two segments and two lists
     106  UChar       auhInterDir[2];       // for two segments
     107  Bool        abMergeFlag[2];       // for two segments
     108  UChar       auhMergeIndex[2];     // for two segments
     109  Char        ahVSPFlag[2];         // for two segments
     110  DisInfo     acDvInfo[2];          // for two segments
     111 
     112  PartSize    eVirtualPartSize;
     113  UInt        uiVirtualPartIndex;
     114} DBBPTmpData;
     115#endif
    99116
    100117// ====================================================================================================================
     
    215232#if H_3D_DIM_SDC
    216233  Bool*         m_pbSDCFlag;
     234#if QC_SDC_UNIFY_G0130 && !SEC_INTER_SDC_G0101
     235  Pel*          m_apSegmentDCOffset[4];
     236#else
    217237  Pel*          m_apSegmentDCOffset[2];
    218238#endif
    219239#endif
     240#endif
    220241#if H_3D_INTER_SDC
     242#if !QC_SDC_UNIFY_G0130
    221243  Bool*         m_pbInterSDCFlag;
    222244  Int*          m_apSegmentInterDCOffset[4];
     245#endif
     246#if !SEC_INTER_SDC_G0101
    223247  UChar*        m_pucInterSDCMask;
     248#endif
     249#endif
     250#if H_3D_DBBP
     251  Bool*         m_pbDBBPFlag;        ///< array of DBBP flags
     252  DBBPTmpData   m_sDBBPTmpData;
    224253#endif
    225254#if H_3D
     
    250279#endif
    251280
     281#if MTK_DDD_G0063
     282  UChar*        m_pucDisparityDerivedDepth;
     283  Bool*         m_pbUseDDD;
     284  Int           m_iUseDDDCandIdx;
     285  UChar         m_ucDDTmpDepth;
     286#endif
     287
    252288protected:
    253289 
     
    283319
    284320  Void xDeriveCenterIdx( UInt uiPartIdx, UInt& ruiPartIdxCenter );
     321
     322#if NTT_STORE_SPDV_VSP_G0148
     323  Void xSetMvFieldForVSP  ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, Int *shiftLUT, RefPicList refPicList, Int refIdx, Bool isDepth, Int &vspSize );
     324#endif
    285325
    286326public:
     
    351391  Void          setCUTransquantBypassSubParts( Bool flag, UInt uiAbsPartIdx, UInt uiDepth );
    352392 
     393#if H_3D_DBBP
     394  Pel*          getVirtualDepthBlock(UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt& uiDepthStride);
     395#endif
     396 
    353397  Bool*        getSkipFlag            ()                        { return m_skipFlag;          }
    354398  Bool         getSkipFlag            (UInt idx)                { return m_skipFlag[idx];     }
     
    362406  Void          setPredictionMode     ( UInt uiIdx, PredMode uh){ m_pePredMode[uiIdx] = uh;   }
    363407  Void          setPredModeSubParts   ( PredMode eMode, UInt uiAbsPartIdx, UInt uiDepth );
     408 
     409#if H_3D_DBBP
     410  Bool*         getDBBPFlag           ()                        { return m_pbDBBPFlag;               }
     411  Bool          getDBBPFlag           ( UInt uiIdx )            { return m_pbDBBPFlag[uiIdx];        }
     412  Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
     413  Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     414  DBBPTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
     415#endif
    364416 
    365417  UChar*        getWidth              ()                        { return m_puhWidth;          }
     
    501553#if H_3D
    502554  Void          rightShiftMergeCandList( TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int* iVSPIndexTrue, InheritedVSPDisInfo*  inheritedVSPDisInfo, UInt start, UInt num, Int &iCount3DV);
     555#if SEC_DEPTH_DV_DERIVAITON_G0074
     556  Bool          getDispforDepth  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
     557#else
    503558  Bool          getDispNeighBlocks  ( UInt uiPartIdx, UInt uiPartAddr, DisInfo* cDisp);
     559#endif
    504560  Bool          getDispMvPredCan(UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, Int* paiPdmRefIdx, TComMv* pacPdmMv, DisInfo* pDis, Int* iPdm );
    505561#endif
     
    571627  Pel           getSDCSegmentDCOffset( UInt uiSeg, UInt uiPartIdx ) { return m_apSegmentDCOffset[uiSeg][uiPartIdx]; }
    572628  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
    573633#endif
    574634#endif
    575635#if H_3D_INTER_SDC
     636#if !QC_SDC_UNIFY_G0130
    576637  Bool*         getInterSDCFlag     ()                        { return m_pbInterSDCFlag;               }
    577638  Bool          getInterSDCFlag     ( UInt uiIdx )            { return m_pbInterSDCFlag[uiIdx];        }
     
    582643  Void          setInterSDCSegmentDCOffset( Int pOffset, UInt uiSeg, UInt uiPartIdx) { m_apSegmentInterDCOffset[uiSeg][uiPartIdx] = pOffset; }
    583644
     645#endif
     646#if !SEC_INTER_SDC_G0101
    584647  Void          xSetInterSDCCUMask( TComDataCU *pcCU, UChar *pMask );
    585648
    586649  UChar*        getInterSDCMask     ()                        { return m_pucInterSDCMask;              }
     650#endif
    587651#endif
    588652 
     
    691755  Void          setVSPFlag        ( UInt uiIdx, Int n )     { m_piVSPFlag[uiIdx] = n;      }
    692756  Void          setVSPFlagSubParts( Char iVSPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     757#if NTT_STORE_SPDV_VSP_G0148
     758  Void          setMvFieldPUForVSP    ( TComDataCU* cu, UInt partAddr, Int width, Int height, RefPicList refPicList, Int refIdx, Int &vspSize );
     759#endif
    693760#endif
    694761  Void          deriveLeftRightTopIdxGeneral  ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
     
    730797  UInt          getCTXARPWFlag                  ( UInt   uiAbsPartIdx                                 );
    731798#endif 
     799#if !MTK_IC_FLAG_CABAC_SIMP_G0061
    732800#if H_3D_IC
    733801  UInt          getCtxICFlag                    ( UInt   uiAbsPartIdx                                 );
     802#endif
    734803#endif
    735804  UInt          getSliceStartCU         ( UInt pos )                  { return m_sliceStartCU[pos-m_uiAbsIdxInLCU];                                                                                          }
     
    751820  UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
    752821
     822#if MTK_DDD_G0063
     823  UChar*       getDDDepth        ()                        { return m_pucDisparityDerivedDepth;        }
     824  UChar        getDDDepth        ( UInt uiIdx )            { return m_pucDisparityDerivedDepth[uiIdx]; }
     825  Void         setDDDepth        ( UInt uiIdx, UChar n )   { m_pucDisparityDerivedDepth[uiIdx] = n;    }
     826  Void         setDDDepthSubParts( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     827
     828  Bool*        getUseDDD        ()                        { return m_pbUseDDD;        }
     829  Bool         getUseDDD        ( UInt uiIdx )            { return m_pbUseDDD[uiIdx]; }
     830  Void         setUseDDD        ( UInt uiIdx, Bool n )     { m_pbUseDDD[uiIdx] = n;    }
     831  Void         setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth );
     832
     833  Void         setUseDDD        ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     834
     835  UChar        getDDTmpDepth(){ return m_ucDDTmpDepth; }
     836  Int          getUseDDDCandIdx(){ return m_iUseDDDCandIdx;}
     837
     838#endif
    753839};
    754840
  • trunk/source/Lib/TLibCommon/TComMotionInfo.h

    r773 r833  
    176176  Void    setMvFieldSP ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComMvField cMvField, Int iWidth, Int iHeight  );
    177177#endif
     178#if NTT_STORE_SPDV_VSP_G0148
     179  Void    setMv         ( Int iIdx, TComMv const & rcMv ) { m_pcMv[iIdx] = rcMv; }
     180  Void    setRefIdx     ( Int iIdx, Int iRefIdx )         { m_piRefIdx[iIdx] = iRefIdx; }
     181#endif
    178182
    179183  Void setNumPartition( Int iNumPart )
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r773 r833  
    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}
     
    598619  }
    599620  return true;
     621}
     622#endif
     623
     624#if H_3D_DBBP
     625PartSize TComPrediction::getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize)
     626{
     627  // find virtual partitioning for this CU based on depth block
     628  // segmentation of texture block --> mask IDs
     629  Pel*  pDepthBlockStart      = pDepthPels;
     630 
     631  // first compute average of depth block for thresholding
     632  Int iSumDepth = 0;
     633  Int iSubSample = 4;
     634  for (Int y=0; y<uiSize; y+=iSubSample)
     635  {
     636    for (Int x=0; x<uiSize; x+=iSubSample)
     637    {
     638      Int depthPel = pDepthPels[x];
     639     
     640      iSumDepth += depthPel;
     641    }
     642   
     643    // next row
     644    pDepthPels += uiDepthStride*iSubSample;
     645  }
     646 
     647  Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample];  // respect sub-sampling factor
     648  Int iMean = iSumDepth >> iSizeInBits*2;       // iMean /= (uiSize*uiSize);
     649 
     650  // start again for segmentation
     651  pDepthPels = pDepthBlockStart;
     652 
     653  // start mapping process
     654  Bool bAMPAvail = uiSize > 8;
     655  Int matchedPartSum[6][2] = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; // counter for each part size and boolean option
     656  PartSize virtualPartSizes[6] = { SIZE_Nx2N, SIZE_2NxN, SIZE_2NxnU, SIZE_2NxnD, SIZE_nLx2N, SIZE_nRx2N };
     657 
     658  UInt uiHalfSize = uiSize>>1;
     659  UInt uiQuarterSize = uiSize>>2;
     660 
     661  for (Int y=0; y<uiSize; y+=iSubSample)
     662  {
     663    for (Int x=0; x<uiSize; x+=iSubSample)
     664    {
     665      Int depthPel = pDepthPels[x];
     666     
     667      // decide which segment this pixel belongs to
     668      Int ucSegment = (Int)(depthPel>iMean);
     669     
     670      // Matched Filter to find optimal (conventional) partitioning
     671     
     672      // SIZE_Nx2N
     673      if(x<uiHalfSize)  // left
     674      {
     675        matchedPartSum[0][ucSegment]++;
     676      }
     677      else  // right
     678      {
     679        matchedPartSum[0][1-ucSegment]++;
     680      }
     681     
     682      // SIZE_2NxN
     683      if(y<uiHalfSize)  // top
     684      {
     685        matchedPartSum[1][ucSegment]++;
     686      }
     687      else  // bottom
     688      {
     689        matchedPartSum[1][1-ucSegment]++;
     690      }
     691     
     692      if( bAMPAvail )
     693      {
     694        // SIZE_2NxnU
     695        if(y<uiQuarterSize)  // top (1/4)
     696        {
     697          matchedPartSum[2][ucSegment]++;
     698        }
     699        else  // bottom (3/4)
     700        {
     701          matchedPartSum[2][1-ucSegment]++;
     702        }
     703       
     704        // SIZE_2NxnD
     705        if(y<(uiQuarterSize*3))  // top (3/4)
     706        {
     707          matchedPartSum[3][ucSegment]++;
     708        }
     709        else  // bottom (1/4)
     710        {
     711          matchedPartSum[3][1-ucSegment]++;
     712        }
     713       
     714        // SIZE_nLx2N
     715        if(x<uiQuarterSize)  // left (1/4)
     716        {
     717          matchedPartSum[4][ucSegment]++;
     718        }
     719        else  // right (3/4)
     720        {
     721          matchedPartSum[4][1-ucSegment]++;
     722        }
     723       
     724        // SIZE_nRx2N
     725        if(x<(uiQuarterSize*3))  // left (3/4)
     726        {
     727          matchedPartSum[5][ucSegment]++;
     728        }
     729        else  // right (1/4)
     730        {
     731          matchedPartSum[5][1-ucSegment]++;
     732        }
     733      }
     734    }
     735   
     736    // next row
     737    pDepthPels += uiDepthStride*iSubSample;
     738  }
     739 
     740  PartSize matchedPartSize = SIZE_NONE;
     741 
     742  Int iMaxMatchSum = 0;
     743  for(Int p=0; p<6; p++)  // loop over partition sizes
     744  {
     745    for( Int b=0; b<=1; b++ ) // loop over boolean options
     746    {
     747      if(matchedPartSum[p][b] > iMaxMatchSum)
     748      {
     749        iMaxMatchSum = matchedPartSum[p][b];
     750        matchedPartSize = virtualPartSizes[p];
     751      }
     752    }
     753  }
     754 
     755  AOF( matchedPartSize != SIZE_NONE );
     756 
     757  return matchedPartSize;
     758}
     759
     760Bool TComPrediction::getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask )
     761{
     762  // segmentation of texture block --> mask IDs
     763  Pel*  pDepthBlockStart      = pDepthPels;
     764 
     765  // first compute average of depth block for thresholding
     766  Int iSumDepth = 0;
     767  Int uiMinDepth = MAX_INT;
     768  Int uiMaxDepth = 0;
     769  for (Int y=0; y<uiHeight; y++)
     770  {
     771    for (Int x=0; x<uiWidth; x++)
     772    {
     773      Int depthPel = pDepthPels[x];
     774      iSumDepth += depthPel;
     775     
     776      if( depthPel > uiMaxDepth )
     777      {
     778        uiMaxDepth = depthPel;
     779      }
     780      if( depthPel < uiMinDepth )
     781      {
     782        uiMinDepth = depthPel;
     783      }
     784    }
     785   
     786    // next row
     787    pDepthPels += uiDepthStride;
     788  }
     789 
     790  // don't generate mask for blocks with small depth range (encoder decision)
     791  if( uiMaxDepth - uiMinDepth < 10 )
     792  {
     793    return false;
     794  }
     795 
     796  AOF(uiWidth==uiHeight);
     797  Int iSizeInBits = g_aucConvertToBit[uiWidth]+2;
     798  Int iMean = iSumDepth >> iSizeInBits*2;       // iMean /= (uiWidth*uiHeight);
     799 
     800  // start again for segmentation
     801  pDepthPels = pDepthBlockStart;
     802 
     803  Bool bInvertMask = pDepthPels[0]>iMean; // top-left segment needs to be mapped to partIdx 0
     804 
     805  // generate mask
     806  UInt uiSumPix[2] = {0,0};
     807  for (Int y=0; y<uiHeight; y++)
     808  {
     809    for (Int x=0; x<uiHeight; x++)
     810    {
     811      Int depthPel = pDepthPels[x];
     812     
     813      // decide which segment this pixel belongs to
     814      Int ucSegment = (Int)(depthPel>iMean);
     815     
     816      if( bInvertMask )
     817      {
     818        ucSegment = 1-ucSegment;
     819      }
     820     
     821      // count pixels for each segment
     822      uiSumPix[ucSegment]++;
     823     
     824      // set mask value
     825      pMask[x] = (Bool)ucSegment;
     826    }
     827   
     828    // next row
     829    pDepthPels += uiDepthStride;
     830    pMask += MAX_CU_SIZE;
     831  }
     832 
     833  // don't generate valid mask for tiny segments (encoder decision)
     834  // each segment needs to cover at least 1/8th of block
     835  UInt uiMinPixPerSegment = (uiWidth*uiHeight) >> 3;
     836  if( !( uiSumPix[0] > uiMinPixPerSegment && uiSumPix[1] > uiMinPixPerSegment ) )
     837  {
     838    return false;
     839  }
     840 
     841  // all good
     842  return true;
     843}
     844
     845Void TComPrediction::combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr )
     846{
     847  Pel*  piSrc[2]    = {pInYuv[0]->getLumaAddr(uiPartAddr), pInYuv[1]->getLumaAddr(uiPartAddr)};
     848  UInt  uiSrcStride = pInYuv[0]->getStride();
     849  Pel*  piDst       = pOutYuv->getLumaAddr(uiPartAddr);
     850  UInt  uiDstStride = pOutYuv->getStride();
     851 
     852  UInt  uiMaskStride= MAX_CU_SIZE;
     853 
     854  // backup pointer
     855  Bool* pMaskStart = pMask;
     856 
     857  // combine luma first
     858  for (Int y=0; y<uiHeight; y++)
     859  {
     860    for (Int x=0; x<uiWidth; x++)
     861    {
     862      UChar ucSegment = (UChar)pMask[x];
     863      AOF( ucSegment < 2 );
     864     
     865      // filtering
     866      Bool t = (y==0)?pMaskStart[(y+1)*uiMaskStride+x]:pMaskStart[(y-1)*uiMaskStride+x];
     867      Bool l = (x==0)?pMaskStart[y*uiMaskStride+x+1]:pMaskStart[y*uiMaskStride+x-1];
     868      Bool b = (y==uiHeight-1)?pMaskStart[(y-1)*uiMaskStride+x]:pMaskStart[(y+1)*uiMaskStride+x];
     869      Bool r = (x==uiWidth-1)?pMaskStart[y*uiMaskStride+x-1]:pMaskStart[y*uiMaskStride+x+1];
     870     
     871      Bool bBlend = !((t&&l&&b&&r) || (!t&&!l&&!b&&!r));
     872      piDst[x] = bBlend?((piSrc[0][x]+piSrc[1][x]+1)>>1):piSrc[ucSegment][x];
     873    }
     874   
     875    piSrc[0]  += uiSrcStride;
     876    piSrc[1]  += uiSrcStride;
     877    piDst     += uiDstStride;
     878    pMask     += uiMaskStride;
     879  }
     880 
     881  // now combine chroma
     882  Pel*  piSrcU[2]       = { pInYuv[0]->getCbAddr(uiPartAddr), pInYuv[1]->getCbAddr(uiPartAddr) };
     883  Pel*  piSrcV[2]       = { pInYuv[0]->getCrAddr(uiPartAddr), pInYuv[1]->getCrAddr(uiPartAddr) };
     884  UInt  uiSrcStrideC    = pInYuv[0]->getCStride();
     885  Pel*  piDstU          = pOutYuv->getCbAddr(uiPartAddr);
     886  Pel*  piDstV          = pOutYuv->getCrAddr(uiPartAddr);
     887  UInt  uiDstStrideC    = pOutYuv->getCStride();
     888  UInt  uiWidthC        = uiWidth >> 1;
     889  UInt  uiHeightC       = uiHeight >> 1;
     890  pMask = pMaskStart;
     891 
     892  for (Int y=0; y<uiHeightC; y++)
     893  {
     894    for (Int x=0; x<uiWidthC; x++)
     895    {
     896      UChar ucSegment = (UChar)pMask[x*2];
     897      AOF( ucSegment < 2 );
     898     
     899      // filtering
     900      Bool t = (y==0)?pMaskStart[(y+1)*2*uiMaskStride+x*2]:pMaskStart[(y-1)*2*uiMaskStride+x*2];
     901      Bool l = (x==0)?pMaskStart[y*2*uiMaskStride+(x+1)*2]:pMaskStart[y*2*uiMaskStride+(x-1)*2];
     902      Bool b = (y==uiHeightC-1)?pMaskStart[(y-1)*2*uiMaskStride+x*2]:pMaskStart[(y+1)*2*uiMaskStride+x*2];
     903      Bool r = (x==uiWidthC-1)?pMaskStart[y*2*uiMaskStride+(x-1)*2]:pMaskStart[y*2*uiMaskStride+(x+1)*2];
     904     
     905      Bool bBlend = !((t&&l&&b&&r) || (!t&&!l&&!b&&!r));
     906     
     907      piDstU[x] = bBlend?((piSrcU[0][x]+piSrcU[1][x]+1)>>1):piSrcU[ucSegment][x];
     908      piDstV[x] = bBlend?((piSrcV[0][x]+piSrcV[1][x]+1)>>1):piSrcV[ucSegment][x];
     909    }
     910   
     911    piSrcU[0]   += uiSrcStrideC;
     912    piSrcU[1]   += uiSrcStrideC;
     913    piSrcV[0]   += uiSrcStrideC;
     914    piSrcV[1]   += uiSrcStrideC;
     915    piDstU      += uiDstStrideC;
     916    piDstV      += uiDstStrideC;
     917    pMask       += 2*uiMaskStride;
     918  }
    600919}
    601920#endif
     
    7831102  TComMv      cMv         = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
    7841103  pcCU->clipMv(cMv);
     1104
     1105#if MTK_DDD_G0063
     1106  if( pcCU->getUseDDD( uiPartAddr ) )
     1107  {
     1108      assert( pcCU->getSPIVMPFlag( uiPartAddr ) == 0 );
     1109      assert( pcCU->getSlice()->getViewIndex() != 0 );
     1110
     1111      Int dstStride = rpcYuvPred->getStride();
     1112      Int dstStrideC = rpcYuvPred->getCStride();
     1113      Pel *dst      = rpcYuvPred->getLumaAddr( uiPartAddr );
     1114      Pel *dstU     = rpcYuvPred->getCbAddr( uiPartAddr );
     1115      Pel *dstV     = rpcYuvPred->getCrAddr( uiPartAddr );
     1116
     1117      Int iWidthC  = iWidth >> 1;
     1118      Int iHeightC = iHeight >> 1;
     1119      Int DefaultC = 1 << ( g_bitDepthY - 1);
     1120      for ( Int i = 0; i < iHeight; i++)
     1121      {
     1122          for ( Int j = 0; j < iWidth ; j++)
     1123          {
     1124              dst[j] = pcCU->getDDDepth( uiPartAddr );
     1125          }
     1126          dst += dstStride;
     1127      }
     1128      for ( Int i = 0; i < iHeightC; i++)
     1129      {
     1130          for ( Int j = 0; j < iWidthC; j++)
     1131          {
     1132              dstU[j] = dstV[j] = DefaultC;
     1133          }
     1134          dstU += dstStrideC;
     1135          dstV += dstStrideC;
     1136      }
     1137
     1138      //return;
     1139  } else
     1140#endif
    7851141#if H_3D_ARP
    7861142  if(pcCU->getARPW( uiPartAddr ) > 0  && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC())
     
    8261182Void TComPrediction::xPredInterUniVSP( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi )
    8271183{
     1184#if NTT_STORE_SPDV_VSP_G0148
     1185  Int vspSize = pcCU->getVSPFlag( uiPartAddr ) >> 1;
     1186
     1187  Int widthSubPU, heightSubPU;
     1188  if (vspSize)
     1189  {
     1190    widthSubPU  = 8;
     1191    heightSubPU = 4;
     1192  }
     1193  else
     1194  {
     1195    widthSubPU  = 4;
     1196    heightSubPU = 8;
     1197  }
     1198  xPredInterUniSubPU( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, rpcYuvPred, bi, widthSubPU, heightSubPU );
     1199
     1200#else // NTT_STORE_SPDV_VSP_G0148
    8281201  // Get depth reference
    8291202  Int       depthRefViewIdx = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan;
     
    8771250  xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize);
    8781251  xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize);
    879 }
     1252#endif // NTT_STORE_SPDV_VSP_G0148
     1253}
     1254
     1255#if NTT_STORE_SPDV_VSP_G0148
     1256Void TComPrediction::xPredInterUniSubPU( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU, Int heightSubPU )
     1257{
     1258  UInt numPartsInLine       = pcCU->getPic()->getNumPartInWidth();
     1259  UInt horiNumPartsInSubPU  = widthSubPU >> 2;
     1260  UInt vertNumPartsInSubPU  = (heightSubPU >> 2) * numPartsInLine;
     1261
     1262  UInt partAddrRasterLine = g_auiZscanToRaster[ uiPartAddr ];
     1263
     1264  for( Int posY=0; posY<iHeight; posY+=heightSubPU, partAddrRasterLine+=vertNumPartsInSubPU )
     1265  {
     1266    UInt partAddrRasterSubPU = partAddrRasterLine;
     1267    for( Int posX=0; posX<iWidth; posX+=widthSubPU, partAddrRasterSubPU+=horiNumPartsInSubPU )
     1268    {
     1269      UInt    partAddrSubPU = g_auiRasterToZscan[ partAddrRasterSubPU ];
     1270      Int     refIdx        = pcCU->getCUMvField( eRefPicList )->getRefIdx( partAddrSubPU );           assert (refIdx >= 0);
     1271      TComMv  cMv           = pcCU->getCUMvField( eRefPicList )->getMv( partAddrSubPU );
     1272      pcCU->clipMv(cMv);
     1273
     1274      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi );
     1275      xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, refIdx )->getPicYuvRec(), partAddrSubPU, &cMv, widthSubPU, heightSubPU, rpcYuvPred, bi );
     1276
     1277    }
     1278  }
     1279}
     1280#endif // NTT_STORE_SPDV_VSP_G0148
     1281
    8801282#endif
    8811283
     
    17322134
    17332135#if H_3D_VSP
     2136#if !(NTT_STORE_SPDV_VSP_G0148)
    17342137// not fully support iRatioTxtPerDepth* != 1
    17352138Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
     
    20442447  }
    20452448}
    2046 
     2449#endif
    20472450
    20482451#if H_3D_VSP_CONSTRAINED
     
    20822485  if( bL == bT )
    20832486  {
     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
    20842492    refDC1 = bL ? ( ptrSrc[iTR] + ptrSrc[iLB] )>>1 : 1<<( g_bitDepthY - 1 );
     2493#endif
    20852494    refDC2 =      ( ptrSrc[ -1] + ptrSrc[-(Int)srcStride] )>>1;
    20862495  }
     
    21842593  Int iSumPix[2];
    21852594  memset(iSumPix, 0, sizeof(Int)*2);
    2186  
     2595#if QC_GENERIC_SDC_G0122
     2596  for( Int i = 0; i < uiNumSegments; i++ )
     2597  {
     2598    rpSegMeans[i] = 0;
     2599  }
     2600#endif
    21872601  if (orgDC == false)
    21882602  {
     
    21992613      rpSegMeans[ucSegmentRB] = pOrig[uiStride * (uiSize-1) + (uiSize-1) ];
    22002614    }
     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
    22012650    else if (uiIntraMode == PLANAR_IDX)
     2651#endif
    22022652    {
    22032653      Pel* pLeftTop = pOrig;
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r773 r833  
    121121
    122122#if H_3D_VSP
     123#if NTT_STORE_SPDV_VSP_G0148
     124  Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
     125#else
    123126  Void xGetVirtualDepth           ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int txtPerDepthX=1, Int txtPerDepthY=1 );
    124127  Void xPredInterLumaBlkFromDM    ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi, Int vspSize);
    125128  Void xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi, Int vspSize);
     129#endif
    126130#endif
    127131
     
    167171#if H_3D_DIM
    168172  // Depth intra
    169   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    );
    170178#if H_3D_DIM_SDC
    171179  Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
     
    175183#endif
    176184#endif
     185 
     186#if H_3D_DBBP
     187  PartSize      getPartitionSizeFromDepth(Pel* pDepthPels, UInt uiDepthStride, UInt uiSize);
     188  Bool          getSegmentMaskFromDepth( Pel* pDepthPels, UInt uiDepthStride, UInt uiWidth, UInt uiHeight, Bool* pMask );
     189  Void          combineSegmentsWithMask( TComYuv* pInYuv[2], TComYuv* pOutYuv, Bool* pMask, UInt uiWidth, UInt uiHeight, UInt uiPartAddr = 0 );
     190#endif
    177191
    178192  Pel  predIntraGetPredValDC      ( Int* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight, Bool bAbove, Bool bLeft );
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r655 r833  
    266266  m_bUseEstimatedVSD        = false;
    267267#endif
     268#if H_3D_DBBP
     269  m_bUseMask                = false;
     270#endif
    268271}
    269272
     
    326329  rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    327330 
     331#if H_3D_DBBP
     332  if( m_bUseMask )
     333  {
     334    if( eDFunc >= DF_SSE && eDFunc <= DF_SSE16N )
     335    {
     336      rcDistParam.DistFunc = TComRdCost::xGetMaskedSSE;
     337    }
     338    else if( eDFunc >= DF_SAD && eDFunc <= DF_SADS16N )
     339    {
     340      rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
     341    }
     342    else if( eDFunc >= DF_HADS && eDFunc <= DF_HADS16N )
     343    {
     344      rcDistParam.DistFunc = TComRdCost::xGetMaskedHADs;
     345    }
     346    else if( eDFunc >= DF_VSD && eDFunc <= DF_VSD16N )
     347    {
     348      rcDistParam.DistFunc = TComRdCost::xGetMaskedVSD;
     349    }
     350    else if( eDFunc >= DF_SAD12 && eDFunc <= DF_SADS48 )
     351    {
     352      rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
     353    }
     354  }
     355#endif
     356 
    328357  // initialize
    329358  rcDistParam.iSubShift  = 0;
     
    357386  {
    358387    rcDistParam.DistFunc = m_afpDistortFunc[45 ];
     388  }
     389#endif
     390 
     391#if H_3D_DBBP
     392  if( m_bUseMask )
     393  {
     394    rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
    359395  }
    360396#endif
     
    411447    rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ];
    412448  }
     449 
     450#if H_3D_DBBP
     451  if( m_bUseMask )
     452  {
     453    rcDistParam.DistFunc = (bHADME)?TComRdCost::xGetMaskedHADs:TComRdCost::xGetMaskedSAD;
     454  }
     455#endif
    413456 
    414457  // initialize
     
    433476  rcDP.bitDepth   = bitDepth;
    434477  rcDP.DistFunc   = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ];
     478 
     479#if H_3D_DBBP
     480  if( m_bUseMask )
     481  {
     482    rcDP.DistFunc = (bHadamard)?TComRdCost::xGetMaskedHADs:TComRdCost::xGetMaskedSAD;
     483  }
     484#endif
     485 
    435486#if NS_HAD
    436487  rcDP.bUseNSHAD  = bUseNSHAD;
     
    586637  cDtParam.uiComp       = 255;    // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed.
    587638
     639#if SCU_HS_VSD_BUGFIX_IMPROV_G0163
     640  cDtParam.bitDepth   = g_bitDepthY;
     641#endif
    588642  Dist dist = cDtParam.DistFunc( &cDtParam );
    589643
     
    631685// Distortion functions
    632686// ====================================================================================================================
     687
     688#if H_3D_DBBP
     689// --------------------------------------------------------------------------------------------------------------------
     690// Masked distortion functions
     691// --------------------------------------------------------------------------------------------------------------------
     692
     693UInt TComRdCost::xGetMaskedSSE( DistParam* pcDtParam )
     694{
     695  Pel* piOrg   = pcDtParam->pOrg;
     696  Pel* piCur   = pcDtParam->pCur;
     697  Int  iRows   = pcDtParam->iRows;
     698  Int  iCols   = pcDtParam->iCols;
     699  Int  iStrideOrg = pcDtParam->iStrideOrg;
     700  Int  iStrideCur = pcDtParam->iStrideCur;
     701 
     702  UInt uiSum = 0;
     703 
     704  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);
     705 
     706  Int iTemp;
     707 
     708  for( ; iRows != 0; iRows-- )
     709  {
     710    for (Int n = 0; n < iCols; n++ )
     711    {
     712      if( piOrg[n] != DBBP_INVALID_SHORT )
     713      {
     714        iTemp = piOrg[n  ] - piCur[n  ];
     715        uiSum += ( iTemp * iTemp ) >> uiShift;
     716      }
     717    }
     718    piOrg += iStrideOrg;
     719    piCur += iStrideCur;
     720  }
     721 
     722  return ( uiSum );
     723}
     724
     725UInt TComRdCost::xGetMaskedSAD( DistParam* pcDtParam )
     726{
     727 
     728  AOF(!pcDtParam->bApplyWeight);
     729#if H_3D_IC
     730  AOF(!pcDtParam->bUseIC);
     731#endif
     732 
     733  Pel* piOrg   = pcDtParam->pOrg;
     734  Pel* piCur   = pcDtParam->pCur;
     735  Int  iRows   = pcDtParam->iRows;
     736  Int  iCols   = pcDtParam->iCols;
     737  Int  iStrideCur = pcDtParam->iStrideCur;
     738  Int  iStrideOrg = pcDtParam->iStrideOrg;
     739 
     740  UInt uiSum = 0;
     741 
     742  for( ; iRows != 0; iRows-- )
     743  {
     744    for (Int n = 0; n < iCols; n++ )
     745    {
     746      if( piOrg[n] != DBBP_INVALID_SHORT )
     747      {
     748        uiSum += abs( piOrg[n] - piCur[n] );
     749      }
     750    }
     751    piOrg += iStrideOrg;
     752    piCur += iStrideCur;
     753  }
     754 
     755  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     756}
     757
     758UInt TComRdCost::xGetMaskedHADs( DistParam* pcDtParam )
     759{
     760  AOF(!pcDtParam->bApplyWeight);
     761#if H_3D_IC
     762  AOF(!pcDtParam->bUseIC);
     763#endif
     764  Pel* piOrg   = pcDtParam->pOrg;
     765  Pel* piCur   = pcDtParam->pCur;
     766  Int  iRows   = pcDtParam->iRows;
     767  Int  iCols   = pcDtParam->iCols;
     768  Int  iStrideCur = pcDtParam->iStrideCur;
     769  Int  iStrideOrg = pcDtParam->iStrideOrg;
     770  Int  iStep  = pcDtParam->iStep;
     771 
     772  Int  x, y;
     773 
     774  UInt uiSum = 0;
     775 
     776#if NS_HAD
     777  if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) )
     778#else
     779    if( ( iRows % 8 == 0) && (iCols % 8 == 0) )
     780#endif
     781    {
     782      Int  iOffsetOrg = iStrideOrg<<3;
     783      Int  iOffsetCur = iStrideCur<<3;
     784      for ( y=0; y<iRows; y+= 8 )
     785      {
     786        for ( x=0; x<iCols; x+= 8 )
     787        {
     788          if( piOrg[x] != DBBP_INVALID_SHORT )
     789          {
     790            uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     791          }
     792        }
     793        piOrg += iOffsetOrg;
     794        piCur += iOffsetCur;
     795      }
     796    }
     797#if NS_HAD
     798    else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD )
     799    {
     800      Int  iOffsetOrg = iStrideOrg<<2;
     801      Int  iOffsetCur = iStrideCur<<2;
     802      for ( y=0; y<iRows; y+= 4 )
     803      {
     804        for ( x=0; x<iCols; x+= 16 )
     805        {
     806          if( piOrg[x] != DBBP_INVALID_SHORT )
     807          {
     808            uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     809          }
     810        }
     811        piOrg += iOffsetOrg;
     812        piCur += iOffsetCur;
     813      }
     814    }
     815    else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD )
     816    {
     817      Int  iOffsetOrg = iStrideOrg<<4;
     818      Int  iOffsetCur = iStrideCur<<4;
     819      for ( y=0; y<iRows; y+= 16 )
     820      {
     821        for ( x=0; x<iCols; x+= 4 )
     822        {
     823          if( piOrg[x] != DBBP_INVALID_SHORT )
     824          {
     825            uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     826          }
     827        }
     828        piOrg += iOffsetOrg;
     829        piCur += iOffsetCur;
     830      }
     831    }
     832#endif
     833    else if( ( iRows % 4 == 0) && (iCols % 4 == 0) )
     834    {
     835      Int  iOffsetOrg = iStrideOrg<<2;
     836      Int  iOffsetCur = iStrideCur<<2;
     837     
     838      for ( y=0; y<iRows; y+= 4 )
     839      {
     840        for ( x=0; x<iCols; x+= 4 )
     841        {
     842          if( piOrg[x] != DBBP_INVALID_SHORT )
     843          {
     844            uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     845          }
     846        }
     847        piOrg += iOffsetOrg;
     848        piCur += iOffsetCur;
     849      }
     850    }
     851    else if( ( iRows % 2 == 0) && (iCols % 2 == 0) )
     852    {
     853      Int  iOffsetOrg = iStrideOrg<<1;
     854      Int  iOffsetCur = iStrideCur<<1;
     855      for ( y=0; y<iRows; y+=2 )
     856      {
     857        for ( x=0; x<iCols; x+=2 )
     858        {
     859          if( piOrg[x] != DBBP_INVALID_SHORT )
     860          {
     861            uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );
     862          }
     863        }
     864        piOrg += iOffsetOrg;
     865        piCur += iOffsetCur;
     866      }
     867    }
     868    else
     869    {
     870      assert(false);
     871    }
     872 
     873  return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
     874}
     875
     876UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam )
     877{
     878  Pel* piOrg    = pcDtParam->pOrg;
     879  Pel* piCur    = pcDtParam->pCur;
     880  Pel* piVirRec = pcDtParam->pVirRec;
     881  Pel* piVirOrg = pcDtParam->pVirOrg;
     882  Int  iRows    = pcDtParam->iRows;
     883  Int  iCols    = pcDtParam->iCols;
     884  Int  iStrideOrg = pcDtParam->iStrideOrg;
     885  Int  iStrideCur = pcDtParam->iStrideCur;
     886  Int  iStrideVir = pcDtParam->iStrideVir;
     887 
     888  UInt uiSum = 0;
     889  UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8)<<1;
     890 
     891  Int dDM;
     892 
     893  for ( Int y = 0 ; y < iRows ; y++ )
     894  {
     895    for (Int x = 0; x < iCols; x++ )
     896    {
     897      if( piOrg[x] != DBBP_INVALID_SHORT )
     898      {
     899        dDM = (Int) ( piOrg[x  ] - piCur[x  ] );
     900        uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift;
     901      }
     902    }
     903    piOrg += iStrideOrg;
     904    piCur += iStrideCur;
     905  }
     906 
     907  return ( uiSum );
     908}
     909#endif
    633910
    634911// --------------------------------------------------------------------------------------------------------------------
     
    27473024  dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff;
    27483025
     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
    27493030  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 
    27503032  iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));
    27513033
  • trunk/source/Lib/TLibCommon/TComRdCost.h

    r655 r833  
    184184#endif
    185185 
     186#if H_3D_DBBP
     187  Bool                    m_bUseMask;
     188#endif
     189 
    186190public:
    187191  TComRdCost();
     
    229233  Void    setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME=false );
    230234  Void    setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard = false );
     235#endif
     236 
     237#if H_3D_DBBP
     238  Void    setUseMask(Bool b) { m_bUseMask = b; }
    231239#endif
    232240 
     
    334342#endif
    335343 
     344#if H_3D_DBBP
     345  static UInt xGetMaskedSSE     ( DistParam* pcDtParam );
     346  static UInt xGetMaskedSAD     ( DistParam* pcDtParam );
     347  static UInt xGetMaskedHADs    ( DistParam* pcDtParam );
     348  static UInt xGetMaskedVSD     ( DistParam* pcDtParam );
     349#endif
     350 
    336351public:
    337352#if WEIGHTED_CHROMA_DISTORTION
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r773 r833  
    18271827#if H_3D_INTER_SDC
    18281828    m_bInterSDCFlag        [ i ] = false;
     1829#endif
     1830#if H_3D_DBBP
     1831    m_dbbpFlag             [ i ] = false;
    18291832#endif
    18301833#if H_3D_IV_MERGE
     
    31293132    for ( Int refListIdx = 0; refListIdx < ((m_eSliceType==B_SLICE) ? 2 : 1); refListIdx++ )
    31303133    {
     3134#if MTK_ARP_REF_SELECTION_G0053
     3135      Int diffPOC=MAX_INT;
     3136      Int idx=-1;
     3137#endif
    31313138      for(Int i = 0; i < getNumRefIdx(RefPicList(refListIdx)); i++ )
    31323139      {
    31333140        if ( getRefPic(RefPicList(refListIdx), i)->getPOC() != getPOC() )
    31343141        {
     3142#if MTK_ARP_REF_SELECTION_G0053
     3143          if( abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC()) < diffPOC)
     3144          {
     3145            diffPOC=abs(getRefPic(RefPicList(refListIdx), i)->getPOC() - getPOC());
     3146            idx=i;
     3147          }
     3148#else
    31353149          setFirstTRefIdx (RefPicList(refListIdx), i);
    31363150          break;
     3151#endif
    31373152        }
     3153#if MTK_ARP_REF_SELECTION_G0053
     3154        if(idx>=0)
     3155        {
     3156          setFirstTRefIdx (RefPicList(refListIdx), idx);
     3157        }
     3158#endif
    31383159      }
    31393160    }
     
    32723293#endif
    32733294
     3295#if MTK_DDD_G0063
     3296  if( getIsDepth() && getViewIndex() > 0 )
     3297  {
     3298      TComSlice *pcTextSlice = getTexturePic()->getSlice( 0 );
     3299      memcpy( m_aiDDDInvScale, pcTextSlice->m_aiDDDInvScale, sizeof( Int ) * getViewIndex() );
     3300      memcpy( m_aiDDDInvOffset, pcTextSlice->m_aiDDDInvOffset, sizeof( Int ) * getViewIndex() );
     3301      memcpy( m_aiDDDShift, pcTextSlice->m_aiDDDShift, sizeof( Int ) * getViewIndex() );             
     3302  } 
     3303#endif
     3304
    32743305  if( !setupLUT )
    32753306    return;
     
    33193350      m_depthToDisparityF[ i ][ d ] = ( invCodScale[ i ] * d + invOffset ) >> log2Div;
    33203351    }
    3321   }
    3322 }
    3323 #endif
    3324 #endif
     3352
     3353#if MTK_DDD_G0063
     3354    InitializeDDDPara( vps->getCamParPrecision(), codScale[ i ], codOffset[ i ], i );
     3355#endif
     3356  }
     3357}
     3358#endif
     3359#endif
     3360
     3361#if MTK_DDD_G0063
     3362Void TComSlice::InitializeDDDPara( UInt uiCamParsCodedPrecision, Int  iCodedScale,Int  iCodedOffset, Int iBaseViewIdx )
     3363{
     3364    UInt uiViewId     = getViewIndex();
     3365
     3366    if( uiViewId == 0 )
     3367    {
     3368        m_aiDDDInvScale[ iBaseViewIdx ] = m_aiDDDInvOffset[ iBaseViewIdx ] = m_aiDDDShift[ iBaseViewIdx ] = 0;
     3369        return;
     3370    }
     3371
     3372
     3373    Int iSign = iCodedScale >= 0 ? 1 : -1;
     3374    iCodedScale = abs( iCodedScale );
     3375
     3376    Int iBitWidth = 0;
     3377
     3378    const Int iInvPres = 9;
     3379
     3380    while( ((( 1 << iBitWidth ) << 1 ) <= iCodedScale ) )
     3381    {
     3382        iBitWidth ++;
     3383    }
     3384    iBitWidth += iInvPres;
     3385    Int iTargetValue =  1 << iBitWidth;
     3386
     3387    Int iMinError = MAX_INT;
     3388    Int iBestD = 1 << ( iInvPres - 1 );
     3389    for( Int d = 1 << ( iInvPres - 1 ); d < ( 1 << iInvPres ); d++ )
     3390    {
     3391        Int iError = abs( iCodedScale * d - iTargetValue );
     3392        if( iError < iMinError )
     3393        {
     3394            iMinError = iError;
     3395            iBestD = d;
     3396        }
     3397        if( iMinError == 0 )
     3398        {
     3399            break;
     3400        }
     3401    }
     3402    Int iRoundingDir = 0;
     3403    if( iCodedScale * iBestD > iTargetValue )
     3404    {
     3405        iRoundingDir = -1;
     3406    }
     3407    else if( iCodedScale * iBestD < iTargetValue )
     3408    {
     3409        iRoundingDir = 1;
     3410    }
     3411    Int iCamPres = uiCamParsCodedPrecision - 1;
     3412    m_aiDDDInvScale [ iBaseViewIdx ] = ( iBestD << ( iCamPres + g_bitDepthY )) * iSign;
     3413    m_aiDDDInvOffset[ iBaseViewIdx ] = -iSign * iBestD * ( iCodedOffset << g_bitDepthY );
     3414    m_aiDDDShift    [ iBaseViewIdx ] = iBitWidth;
     3415    m_aiDDDInvOffset[ iBaseViewIdx ] += 1 << ( m_aiDDDShift[ iBaseViewIdx ] - 1 );
     3416    m_aiDDDInvOffset[ iBaseViewIdx ] += ( 1 << ( m_aiDDDShift[ iBaseViewIdx ] - 4 ) ) * iRoundingDir;
     3417
     3418    return;
     3419}
     3420#endif
     3421
    33253422/** get scaling matrix from RefMatrixID
    33263423 * \param sizeId size index
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r773 r833  
    783783#endif
    784784#endif
     785#if QC_SPIVMP_MPI_G0119
     786  Int         m_iSubPUMPILog2Size;
     787#endif
    785788#if H_3D_VSP
    786789  Bool        m_viewSynthesisPredFlag    [ MAX_NUM_LAYERS ];
     
    801804#if H_3D_INTER_SDC
    802805  Bool        m_bInterSDCFlag[MAX_NUM_LAYERS   ];
     806#endif
     807#if H_3D_DBBP
     808  Bool        m_dbbpFlag[MAX_NUM_LAYERS];
    803809#endif
    804810#if H_3D_IV_MERGE
     
    952958  Bool    inferOutputLayerFlag( Int layerSetIdx, Int i )                   { return ( getDefaultOneTargetOutputLayerIdc( ) == 0 || ( ( getDefaultOneTargetOutputLayerIdc( ) == 1 ) && ( i == m_layerSetLayerIdList[layerSetIdx].size() - 1  ) ));  }
    953959
    954   Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx  = val ]; }
     960  Void    setProfileLevelTierIdx( Int outLayerSetIdx, Int val )            { m_profileLevelTierIdx[ outLayerSetIdx ] = val; }
    955961  Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; }
    956962  Void    setAltOutputLayerFlag( Bool flag )                               { m_altOutputLayerFlag = flag; }
     
    10581064#endif
    10591065#endif
     1066#if QC_SPIVMP_MPI_G0119
     1067  Int     getSubPUMPILog2Size( )           { return m_iSubPUMPILog2Size; }
     1068  Void    setSubPUMPILog2Size( Int u )     { m_iSubPUMPILog2Size = u;    }
     1069#endif
    10601070#if H_3D_VSP
    10611071  Void    setViewSynthesisPredFlag  ( Int layerIdInVps, Bool val )  { m_viewSynthesisPredFlag[ layerIdInVps ] = val; }
     
    10741084  Bool    getInterSDCFlag      ( Int layerIdInVps )           { return m_bInterSDCFlag[layerIdInVps]; }
    10751085  Void    setInterSDCFlag      ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; }
     1086#endif
     1087#if H_3D_DBBP
     1088  Bool getUseDBBP              ( Int layerIdInVps )         { return m_dbbpFlag[layerIdInVps]; }
     1089  Void setUseDBBP              ( Int layerIdInVps, Bool bval ){ m_dbbpFlag[layerIdInVps] = bval; }
    10761090#endif
    10771091#if H_3D_IV_MERGE
     
    20552069#endif
    20562070#endif
     2071
     2072#if MTK_DDD_G0063
     2073  Int          m_aiDDDInvScale [MAX_NUM_LAYERS];
     2074  Int          m_aiDDDInvOffset[MAX_NUM_LAYERS];
     2075  UInt         m_aiDDDShift    [MAX_NUM_LAYERS];
     2076#endif
     2077
    20572078public:
    20582079  TComSlice();
     
    24012422  TComPic* getPicFromRefPicSetInterLayer( Int setIdc, Int layerId );
    24022423#endif
     2424
     2425#if MTK_DDD_G0063
     2426  Void InitializeDDDPara( UInt uiCamParsCodedPrecision, Int  iCodedScale,Int  iCodedOffset, Int iBaseViewIdx );
     2427  Int  getDepthFromDV( Int iDV, Int iBaseViewIdx )
     2428  {
     2429      return ClipY(( iDV * m_aiDDDInvScale[ iBaseViewIdx ] + m_aiDDDInvOffset[ iBaseViewIdx ] ) >> m_aiDDDShift[ iBaseViewIdx ]);
     2430  }
     2431#endif
     2432
    24032433protected:
    24042434  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r773 r833  
    235235#define H_3D_DELTA_DLT                    1
    236236#endif
    237 
    238237#define H_3D_DIM_ENC                      1   // Depth Intra encoder optimizations, includes:
    239238                                              // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
     
    250249#endif
    251250
     251
    252252///// ***** ILLUMATION COMPENSATION *********
    253253#if H_3D_IC
     
    257257#endif
    258258
     259
    259260///// ***** FCO *********
    260261#if H_3D_FCO
     
    272273///////////////////////////////////   HTM-10.0 Integrations //////////////////////////////
    273274/////////////////////////////////////////////////////////////////////////////////////////
    274 
    275 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    276 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    277 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    278 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    279 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    280 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    281 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    282 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    283 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    284 // !!! PLEASE PUT MACROS RELATED TO HTM-10.0 INTEGRATIONS HERE !!!
    285 
     275#if H_3D
     276#if  H_3D_QTLPC
     277#define MTK_TEX_DEP_PAR_G0055             1   // Texture-partition-dependent depth partition. JCT3V-G0055
     278#endif
     279
     280#define MTK_DDD_G0063                     1   // Disparity derived depth coding
     281
     282#if H_3D_VSP
     283#define MTK_RBIP_VSP_G0069                1   // Restricted bi-prediction for VSP
     284#define NTT_STORE_SPDV_VSP_G0148          1   // Storing Sub-PU based DV for VSP
     285#endif
     286
     287#define H_3D_DBBP                         1   // DBBP: Depth-based Block Partitioning and Merging
     288
     289#if H_3D_DBBP
     290#define DBBP_INVALID_SHORT                (-4)
     291#define RWTH_DBBP_PACK_MODE               SIZE_2NxN
     292#endif
     293
     294#if H_3D_DIM
     295#define QC_PKU_SDC_SPLIT_G0123            1   // Intra SDC Split
     296#if QC_PKU_SDC_SPLIT_G0123
     297#define HS_TSINGHUA_SDC_SPLIT_G0111       1
     298#endif
     299#define SCU_HS_DEPTH_DC_PRED_G0143        1
     300#define QC_GENERIC_SDC_G0122              1  // Generalize SDC to all depth intra modes
     301#if H_3D_DIM_SDC && H_3D_INTER_SDC
     302#define QC_SDC_UNIFY_G0130                1  // Unify intra SDC and inter SDC
     303#define QC_SDC_UNIFY_G0130_FIX            1  // Fix bug of G0130
     304#define QC_SDC_UNIFY_G0130_FIX2           1  // Fix bug of G0130
     305#endif
     306#define SEC_INTER_SDC_G0101               1  // Improved inter SDC with multiple DC candidates
     307#endif
     308
     309#define KHU_SIMP_SPIVMP_G0147             1  // Simplification on Sub-PU level temporal interview motion prediction
     310
     311#if H_3D_SPIVMP
     312#define QC_SPIVMP_MPI_G0119               1 // Sub-PU level MPI merge candidate
     313#endif
     314
     315#define QC_DEPTH_MERGE_SIMP_G0127         1 // Remove DV candidate and shifting candidate for depth coding
     316#define SEC_IC_ARP_SIG_G0072              1   // Disabling IC when ARP is enabled, option 1 in JCT3V-G0072, part 2 in JCT3V-G0121
     317#define SCU_HS_VSD_BUGFIX_IMPROV_G0163    1
     318#define SEC_SPIVMP_MCP_SIZE_G0077         1  // Apply SPIVMP only to 2Nx2N partition, JCT3V-G0077
     319#define SEC_DEPTH_DV_DERIVAITON_G0074     1  // Simplification of DV derivation for depth, JCT3V-G0074
     320#define MTK_ARP_REF_SELECTION_G0053       1   // ARP Reference picture selection in JCT3V-G0053
     321#define MTK_ARP_FLAG_CABAC_SIMP_G0061     1   // Use 2 context for ARP flag referring to only left neighbor block in JCT3V-G0061
     322#define MTK_IC_FLAG_CABAC_SIMP_G0061      1   // Use only 1 context for IC flag in JCT3V-G0061
     323#define MTK_NBDV_IVREF_FIX_G0067          1   // Disable IvMC, VSP when IVREF is not available, JCT3V-G0067
     324#endif
    286325/////////////////////////////////////////////////////////////////////////////////////////
    287326///////////////////////////////////   HM RELATED DEFINES ////////////////////////////////
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r773 r833  
    16971697        READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
    16981698#if H_3D_SPIVMP
     1699#if SEC_SPIVMP_MCP_SIZE_G0077
     1700        READ_UVLC (uiCode, "log2_sub_PU_size_minus3");     pcVPS->setSubPULog2Size(i, uiCode+3);
     1701#else
    16991702        READ_UVLC (uiCode, "log2_sub_PU_size_minus2");     pcVPS->setSubPULog2Size(i, uiCode+2);
     1703#endif
    17001704#endif
    17011705#endif
     
    17101714        READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false );
    17111715#endif
     1716#if H_3D_DBBP
     1717          READ_FLAG( uiCode, "use_dbbp_flag[i]" ); pcVPS->setUseDBBP( i, uiCode == 1 ? true : false );
     1718#endif
    17121719      }
    17131720      else
     
    17221729        if (i!=1)
    17231730        {
     1731#if SEC_SPIVMP_MCP_SIZE_G0077
     1732          READ_UVLC (uiCode, "log2_sub_PU_size_minus3[i]");     pcVPS->setSubPULog2Size(i, uiCode+3);
     1733#else
    17241734          READ_UVLC (uiCode, "log2_sub_PU_size_minus2[i]");     pcVPS->setSubPULog2Size(i, uiCode+2);
     1735#endif
    17251736        }
    17261737#endif
     
    17621773    }
    17631774  }
    1764 
     1775#if QC_SPIVMP_MPI_G0119
     1776  READ_UVLC (uiCode, "log2_sub_PU_MPI_size_minus3");              pcVPS->setSubPUMPILog2Size( uiCode + 3 );
     1777#endif
    17651778  READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false );
    17661779}
     
    27742787#endif
    27752788#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
    27762800Void TDecCavlc::parseInterSDCFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    27772801{
     
    27832807  assert(0);
    27842808}
     2809#endif
     2810#endif
     2811#if H_3D_DBBP
     2812  Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2813  {
     2814    assert(0);
     2815  }
    27852816#endif
    27862817// ====================================================================================================================
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r773 r833  
    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
     133#endif
     134#if H_3D_DBBP
     135  Void  parseDBBPFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    128136#endif
    129137  Void parseSplitFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r773 r833  
    5050  m_ppcYuvReco = NULL;
    5151  m_ppcCU      = NULL;
     52#if H_3D_DBBP
     53  m_ppcYuvRecoDBBP = NULL;
     54#endif
    5255}
    5356
     
    7578  m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1];
    7679  m_ppcCU      = new TComDataCU*[m_uiMaxDepth-1];
     80#if H_3D_DBBP
     81  m_ppcYuvRecoDBBP = new TComYuv*[m_uiMaxDepth-1];
     82#endif
    7783 
    7884  UInt uiNumPartitions;
     
    8692    m_ppcYuvReco[ui] = new TComYuv;    m_ppcYuvReco[ui]->create( uiWidth, uiHeight );
    8793    m_ppcCU     [ui] = new TComDataCU; m_ppcCU     [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) );
     94#if H_3D_DBBP
     95    m_ppcYuvRecoDBBP[ui] = new TComYuv;    m_ppcYuvRecoDBBP[ui]->create( uiWidth, uiHeight );
     96#endif
    8897  }
    8998 
     
    106115    m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL;
    107116    m_ppcCU     [ui]->destroy(); delete m_ppcCU     [ui]; m_ppcCU     [ui] = NULL;
     117#if H_3D_DBBP
     118    m_ppcYuvRecoDBBP[ui]->destroy(); delete m_ppcYuvRecoDBBP[ui]; m_ppcYuvRecoDBBP[ui] = NULL;
     119#endif
    108120  }
    109121 
     
    111123  delete [] m_ppcYuvReco; m_ppcYuvReco = NULL;
    112124  delete [] m_ppcCU     ; m_ppcCU      = NULL;
     125#if H_3D_DBBP
     126  delete [] m_ppcYuvRecoDBBP; m_ppcYuvRecoDBBP = NULL;
     127#endif
    113128}
    114129
     
    213228  DTRACE_CU("cqtDepth"  , uiDepth)
    214229#endif
     230
    215231  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
    216232  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
     
    276292#endif
    277293
     294
     295#if MTK_DDD_G0063
     296      pcCU->setUseDDD( false, uiAbsPartIdx, uiDepth );
     297#endif
     298
    278299  if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
    279300  {
     
    318339      if( pcCU->getSlice()->getIsDepth())
    319340      {
     341#if SEC_DEPTH_DV_DERIVAITON_G0074
     342        DvInfo.bDV = m_ppcCU[uiDepth]->getDispforDepth(0, 0, &DvInfo);
     343#else
    320344        DvInfo.bDV = m_ppcCU[uiDepth]->getDispNeighBlocks(0, 0, &DvInfo);
     345#endif
    321346      }
    322347      else
     
    390415    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
    391416
     417#if !SEC_IC_ARP_SIG_G0072
    392418#if H_3D_IC
    393419    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    394420#endif
     421#endif
    395422#if H_3D_ARP
    396423    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
     424#endif
     425#if SEC_IC_ARP_SIG_G0072
     426#if H_3D_IC
     427    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     428#endif
    397429#endif
    398430
     
    434466    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    435467
     468#if MTK_DDD_G0063
     469    if( uiMergeIndex == m_ppcCU[uiDepth]->getUseDDDCandIdx() )
     470    {
     471        assert( pcCU->getSlice()->getViewIndex() != 0 );
     472        pcCU->setUseDDD( true, uiAbsPartIdx, 0, uiDepth );
     473        pcCU->setDDDepthSubParts( m_ppcCU[uiDepth]->getDDTmpDepth(),uiAbsPartIdx, 0, uiDepth );
     474    }
     475#endif
     476
    436477    TComMv cTmpMv( 0, 0 );
    437478    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     
    443484        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
    444485        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
     486#if NTT_STORE_SPDV_VSP_G0148
     487        if( pcCU->getVSPFlag( uiAbsPartIdx ) != 0 )
     488        {
     489          if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
     490          {
     491            UInt dummy;
     492            Int vspSize;
     493            Int width, height;
     494            m_ppcCU[uiDepth]->getPartIndexAndSize( uiAbsPartIdx, dummy, width, height );
     495            m_ppcCU[uiDepth]->setMvFieldPUForVSP( pcCU, uiAbsPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );
     496            pcCU->setVSPFlag( uiAbsPartIdx, vspSize );
     497          }
     498        }
     499#endif
    445500#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC   
    446501        if ( g_decTraceMvFromMerge )
     
    496551  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    497552
     553#if QC_SDC_UNIFY_G0130
     554  m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     555#endif
    498556  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
    499557  {
     
    515573  // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
    516574  m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
    517 #if H_3D_INTER_SDC
     575#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    518576  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
    519577#endif
     
    585643  {
    586644    case MODE_INTER:
     645#if H_3D_DBBP
     646      if( m_ppcCU[uiDepth]->getDBBPFlag(0) )
     647      {
     648        xReconInterDBBP( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     649      }
     650      else
     651      {
     652#endif
    587653#if H_3D_INTER_SDC
     654#if QC_SDC_UNIFY_G0130
     655      if( m_ppcCU[uiDepth]->getSDCFlag( 0 ) )
     656#else
    588657      if( m_ppcCU[uiDepth]->getInterSDCFlag( 0 ) )
     658#endif
    589659      {
    590660        xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     
    595665      xReconInter( m_ppcCU[uiDepth], uiDepth );
    596666#if H_3D_INTER_SDC
     667      }
     668#endif
     669#if H_3D_DBBP
    597670      }
    598671#endif
     
    646719  UInt  uiWidth      = pcCU->getWidth ( 0 );
    647720  UInt  uiHeight     = pcCU->getHeight( 0 );
     721#if !SEC_INTER_SDC_G0101
    648722  UChar* pMask       = pcCU->getInterSDCMask();
    649723
    650724  memset( pMask, 0, uiWidth*uiHeight );
    651725  pcCU->xSetInterSDCCUMask( pcCU, pMask );
     726#endif
    652727
    653728  Pel  *pResi;
     
    660735    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
    661736    {
     737#if SEC_INTER_SDC_G0101
     738      pResi[ uiPelX ] = pcCU->getSDCSegmentDCOffset( 0, 0 );
     739#else
    662740      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
    663 
    664       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
    665747    }
    666748    pResi += uiResiStride;
     
    684766    pRecCb += uiStrideC;
    685767    pRecCr += uiStrideC;
     768  }
     769}
     770#endif
     771
     772#if H_3D_DBBP
     773Void TDecCu::xReconInterDBBP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     774{
     775  AOF(!pcCU->getSlice()->getIsDepth());
     776  AOF(!pcCU->getSlice()->isIntra());
     777  PartSize ePartSize = pcCU->getPartitionSize( 0 );
     778 
     779  // get collocated depth block
     780  UInt uiDepthStride = 0;
     781  Pel* pDepthPels = pcCU->getVirtualDepthBlock(0, pcCU->getWidth(0), pcCU->getHeight(0), uiDepthStride);
     782  AOF( pDepthPels != NULL );
     783  AOF( uiDepthStride != 0 );
     784 
     785  // compute mask by segmenting depth block
     786  Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE];
     787  Bool bValidMask = m_pcPrediction->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(0), pcCU->getHeight(0), pMask);
     788  AOF(bValidMask);
     789 
     790  DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     791  TComYuv* apSegPredYuv[2] = { m_ppcYuvReco[uiDepth], m_ppcYuvRecoDBBP[uiDepth] };
     792 
     793  // first, extract the two sets of motion parameters
     794  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
     795  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     796  {
     797    UInt uiPartAddr = uiSegment*uiPUOffset;
     798   
     799    pDBBPTmpData->auhInterDir[uiSegment] = pcCU->getInterDir(uiPartAddr);
     800   
     801    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     802    {
     803      RefPicList eRefList = (RefPicList)uiRefListIdx;
     804      pcCU->getMvField(pcCU, uiPartAddr, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]);
     805    }
     806   
     807    pDBBPTmpData->ahVSPFlag[uiSegment] = pcCU->getVSPFlag( uiPartAddr );
     808    pDBBPTmpData->acDvInfo[uiSegment] = pcCU->getDvInfo( uiPartAddr );
     809  }
     810 
     811  // do motion compensation for each segment as 2Nx2N
     812  pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
     813  pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth );
     814  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     815  {
     816    pcCU->setInterDirSubParts( pDBBPTmpData->auhInterDir[uiSegment], 0, 0, uiDepth );
     817   
     818    pcCU->setVSPFlagSubParts( pDBBPTmpData->ahVSPFlag[uiSegment], 0, 0, uiDepth );
     819    pcCU->setDvInfoSubParts( pDBBPTmpData->acDvInfo[uiSegment], 0, 0, uiDepth );
     820   
     821    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     822    {
     823      RefPicList eRefList = (RefPicList)uiRefListIdx;
     824
     825      pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], SIZE_2Nx2N, 0, 0 );
     826    }
     827   
     828    // inter prediction
     829    m_pcPrediction->motionCompensation( pcCU, apSegPredYuv[uiSegment] );
     830  }
     831 
     832  // restore motion information in both segments again
     833  pcCU->setPartSizeSubParts( ePartSize,  0, uiDepth );
     834  pcCU->setPredModeSubParts( MODE_INTER, 0, uiDepth );
     835  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     836  {
     837    UInt uiPartAddr = uiSegment*uiPUOffset;
     838   
     839    pcCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uiDepth);
     840   
     841    pcCU->setVSPFlagSubParts( pDBBPTmpData->ahVSPFlag[uiSegment], uiPartAddr, uiSegment, uiDepth );
     842    pcCU->setDvInfoSubParts( pDBBPTmpData->acDvInfo[uiSegment], uiPartAddr, uiSegment, uiDepth );
     843   
     844    pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uiDepth); // interprets depth relative to LCU level
     845   
     846    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     847    {
     848      RefPicList eRefList = (RefPicList)uiRefListIdx;
     849
     850      pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], ePartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level
     851    }
     852  }
     853 
     854  // reconstruct final prediction signal by combining both segments
     855  m_pcPrediction->combineSegmentsWithMask(apSegPredYuv, m_ppcYuvReco[uiDepth], pMask, pcCU->getWidth(0), pcCU->getHeight(0));
     856 
     857  // inter recon
     858  xDecodeInterTexture( pcCU, 0, uiDepth );
     859 
     860  // clip for only non-zero cbp case
     861  if  ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) )
     862  {
     863    m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
     864  }
     865  else
     866  {
     867    m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 ));
    686868  }
    687869}
     
    9061088  UInt uiWidth        = pcCU->getWidth  ( 0 );
    9071089  UInt uiHeight       = pcCU->getHeight ( 0 );
    908  
     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
    9091151  TComYuv* pcRecoYuv  = m_ppcYuvReco[uiDepth];
    9101152  TComYuv* pcPredYuv  = m_ppcYuvReco[uiDepth];
     
    9261168  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
    9271169  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
     1170#endif
    9281171 
    9291172  //===== init availability pattern =====
    9301173  Bool  bAboveAvail = false;
    9311174  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
    9321179  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
    9331180  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail );
    934  
     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
    9351190  //===== get prediction signal =====
    9361191#if H_3D_DIM
    9371192  if( isDimMode( uiLumaPredMode ) )
    9381193  {
    939     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
    9401207  }
    9411208  else
     
    9461213  }
    9471214#endif
    948  
     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
    9491249  // number of segments depends on prediction mode
    9501250  UInt uiNumSegments = 1;
     
    9631263    uiMaskStride = pcWedgelet->getStride();
    9641264  }
    965  
     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
    9661278  // get DC prediction for each segment
    9671279  Pel apDCPredValues[2];
     
    10251337    pRecCr += uiStrideC;
    10261338  }
     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
    10271346}
    10281347#endif
  • trunk/source/Lib/TLibDecoder/TDecCu.h

    r655 r833  
    6363  TComDataCU**        m_ppcCU;            ///< CU data array
    6464 
     65#if H_3D_DBBP
     66  TComYuv**           m_ppcYuvRecoDBBP;
     67#endif
     68 
    6569  // access channel
    6670  TComTrQuant*        m_pcTrQuant;
     
    98102  Void xReconInter              ( TComDataCU* pcCU, UInt uiDepth );
    99103 
     104#if H_3D_DBBP
     105  Void xReconInterDBBP          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     106#endif
     107 
    100108  Void  xReconIntraQT           ( TComDataCU* pcCU, UInt uiDepth );
    101109  Void  xIntraRecLumaBlk        ( TComDataCU* pcCU, UInt uiTrDepth, UInt uiAbsPartIdx, TComYuv* pcRecoYuv, TComYuv* pcPredYuv, TComYuv* pcResiYuv );
  • trunk/source/Lib/TLibDecoder/TDecEntropy.cpp

    r773 r833  
    111111  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
    112112
     113#if SEC_IC_ARP_SIG_G0072
     114  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 )
     115#else
    113116  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
     117#endif
    114118  {
    115119    return;
     
    137141{
    138142  m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth );
     143 
     144#if H_3D_DBBP
     145  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE )
     146  {
     147    decodeDBBPFlag(pcCU, uiAbsPartIdx, uiDepth);
     148   
     149    if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     150    {
     151      AOF( pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE );
     152     
     153      // get collocated depth block
     154      UInt uiDepthStride = 0;
     155      Pel* pDepthPels = NULL;
     156      pDepthPels = pcCU->getVirtualDepthBlock(uiAbsPartIdx, pcCU->getWidth(uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), uiDepthStride);
     157     
     158      AOF( pDepthPels != NULL );
     159      AOF( uiDepthStride != 0 );
     160     
     161      // derive true partitioning for this CU based on depth
     162      // (needs to be done in parsing process as motion vector predictors are also derived during parsing)
     163      PartSize eVirtualPartSize = m_pcPrediction->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(uiAbsPartIdx));
     164      AOF( eVirtualPartSize != SIZE_NONE );
     165     
     166      pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);
     167    }
     168  }
     169#endif
    139170}
    140171
     
    241272      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
    242273      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     274#if !SEC_IC_ARP_SIG_G0072
    243275#if H_3D_IC
    244276      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    245277#endif
     278#endif
    246279#if H_3D_ARP
    247280      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    248281#endif
     282#if SEC_IC_ARP_SIG_G0072
     283#if H_3D_IC
     284      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     285#endif
     286#endif
     287#if H_3D_DBBP
     288      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )
     289#else
    249290      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
     291#endif
    250292      {
    251293        pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
     
    320362      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
    321363
     364#if MTK_DDD_G0063
     365      if( uiMergeIndex == pcSubCU->getUseDDDCandIdx() )
     366      {
     367          assert( pcCU->getSlice()->getViewIndex() != 0 );
     368          pcCU->setUseDDD( true, uiSubPartIdx, uiPartIdx, uiDepth );
     369          pcCU->setDDDepthSubParts( pcSubCU->getDDTmpDepth(),uiSubPartIdx, uiPartIdx, uiDepth );
     370      }
     371      else
     372      {
     373          pcCU->setUseDDD( false, uiSubPartIdx, uiPartIdx, uiDepth );
     374      }
     375#endif
     376
    322377      TComMv cTmpMv( 0, 0 );
    323378      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     
    329384          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
    330385          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
     386#if NTT_STORE_SPDV_VSP_G0148
     387#if H_3D_DBBP
     388          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )
     389#else
     390          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
     391#endif
     392          {
     393            if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
     394            {
     395              UInt dummy;
     396              Int vspSize;
     397              Int width, height;
     398              pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );
     399              pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );
     400              pcCU->setVSPFlag( uiSubPartIdx, vspSize );
     401            }
     402          }
     403#endif
    331404        }
    332405      }
     
    367440        }
    368441      }
     442#if !SEC_IC_ARP_SIG_G0072
    369443#if H_3D_IC
    370444      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    371445#endif
     446#endif
    372447#if H_3D_ARP
    373448      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    374449#endif
     450#if SEC_IC_ARP_SIG_G0072
     451#if H_3D_IC
     452      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
     453#endif
     454#endif
    375455    }
    376456#if H_3D_VSP
     457#if NTT_STORE_SPDV_VSP_G0148
     458    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == 0))
     459#else
    377460    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == false))
     461#endif
    378462#else
    379463    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) )
     
    713797  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    714798  UInt uiChromaOffset = uiLumaOffset>>2;
    715  
     799#if QC_SDC_UNIFY_G0130
    716800#if H_3D_DIM_SDC
    717   if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     801  if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) )
    718802  {
    719803    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     
    722806    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
    723807    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 );
    724853    return;
    725854  }
     
    737866  }
    738867#endif
     868#endif
    739869
    740870  if( pcCU->isIntra(uiAbsPartIdx) )
     
    760890
    761891#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
    762922Void TDecEntropy::decodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    763923{
     
    798958}
    799959#endif
     960#endif
     961#if H_3D_DBBP
     962Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     963{
     964  m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );
     965}
     966#endif
    800967
    801968//! \}
  • trunk/source/Lib/TLibDecoder/TDecEntropy.h

    r773 r833  
    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
     105#endif
     106#if H_3D_DBBP
     107  virtual Void parseDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    100108#endif
    101109  virtual Void parsePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     
    179187#endif
    180188#if H_3D_INTER_SDC
     189#if QC_SDC_UNIFY_G0130
     190  Void decodeSDCFlag           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     191#else
    181192  Void decodeInterSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    182193  Void decodeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    183194#endif
     195#endif
     196#if H_3D_DBBP
     197  Void decodeDBBPFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     198#endif
    184199  Void decodeIPCMInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    185200
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r773 r833  
    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)
     110#endif
     111#if H_3D_DBBP
     112, m_cDBBPFlagSCModel             ( 1,             1,                 DBBP_NUM_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
    101113#endif
    102114{
     
    170182  m_cDdcFlagSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DDC_FLAG );
    171183  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
    172190#if H_3D_DIM_DMM
    173191  m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
     
    178196#endif
    179197#endif
    180 #if H_3D_INTER_SDC
     198#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    181199  m_cInterSDCFlagSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
    182200  m_cInterSDCResidualSCModel.initBuffer   ( sliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    183201  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 );
     205#endif
     206#if H_3D_DBBP
     207  m_cDBBPFlagSCModel.initBuffer              ( sliceType, qp, (UChar*)INIT_DBBP_FLAG );
    184208#endif
    185209  m_uiLastDQpNonZero  = 0;
     
    239263  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    240264  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
    241271#if H_3D_DIM_DMM
    242272  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    247277#endif
    248278#endif
    249 #if H_3D_INTER_SDC
     279#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    250280  m_cInterSDCFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    251281  m_cInterSDCResidualSCModel.initBuffer   ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    252282  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 );
     286#endif
     287#if H_3D_DBBP
     288  m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
    253289#endif
    254290  m_pcTDecBinIf->start();
     
    784820  Bool rapPic     = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
    785821
     822#if MTK_TEX_DEP_PAR_G0055
     823  Bool depthDependent = false;
     824  UInt uiTexturePart = uiMode;
     825#endif
    786826  if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC())
    787827  {
    788828    TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr());
    789829    assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth);
     830#if !MTK_TEX_DEP_PAR_G0055
    790831    if (pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth && pcTextureCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN)
     832#else
     833    if(pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth )
     834    {
     835      depthDependent = true;
     836      uiTexturePart = pcTextureCU->getPartitionSize( uiAbsPartIdx );
     837    }
     838    if (pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth && pcTextureCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N)
     839#endif
    791840    {
    792841      bParsePartSize = false;
     
    833882    if(bParsePartSize)
    834883    {
     884#endif
     885#if MTK_TEX_DEP_PAR_G0055
     886      if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N)
     887      {
    835888#endif
    836889      UInt uiMaxNumBits = 2;
     
    870923        }
    871924      }
     925#if MTK_TEX_DEP_PAR_G0055
     926      }
     927      else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)
     928      {
     929        UInt uiMaxNumBits = 1;
     930        if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     931        {
     932          uiMaxNumBits ++;
     933        }
     934        for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
     935        {
     936          m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) );
     937          if ( uiSymbol )
     938          {
     939            break;
     940          }
     941          uiMode++;
     942        }
     943        eMode = (PartSize) uiMode;
     944        if(uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==1 )
     945        {
     946          eMode = SIZE_2NxN;
     947        }
     948        else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth )==0  && uiSymbol==0)
     949        {
     950          eMode = SIZE_2NxN;
     951        }
     952        else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==0)
     953        {
     954          m_pcTDecBinIf->decodeBinEP(uiSymbol);
     955          eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);
     956        }
     957      }
     958      else if(uiTexturePart == SIZE_Nx2N|| uiTexturePart==SIZE_nLx2N || uiTexturePart==SIZE_nRx2N)
     959      {
     960        UInt uiMaxNumBits = 1;
     961        if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     962        {
     963          uiMaxNumBits ++;
     964        }
     965        for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
     966        {
     967          m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) );
     968          if ( uiSymbol )
     969          {
     970            break;
     971          }
     972          uiMode++;
     973        }
     974        eMode = (PartSize) uiMode;
     975        if(uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==1 )
     976        {
     977          eMode = SIZE_Nx2N;
     978        }
     979        else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth )==0  && uiSymbol==0)
     980        {
     981          eMode = SIZE_Nx2N;
     982        }
     983        else if (uiMode && pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) && uiSymbol==0)
     984        {
     985          m_pcTDecBinIf->decodeBinEP(uiSymbol);
     986          eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);
     987        }
     988      }
     989      else
     990        assert(0);
     991#endif
    872992#if H_MV_ENC_DEC_TRAC         
    873993      DTRACE_CU("part_mode", eMode )
     
    9251045    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    9261046#if H_3D_DIM_SDC
     1047#if QC_GENERIC_SDC_G0122
     1048      if( 1 ) // This should be cleaned up.
     1049#else
    9271050      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1051#endif
    9281052#endif
    9291053    {
     
    9431067    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    9441068#if H_3D_DIM_SDC
     1069#if QC_GENERIC_SDC_G0122
     1070      if( 1 )  // This should be cleaned up.
     1071#else
    9451072      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1073#endif
    9461074#endif
    9471075    {
     
    10461174  }
    10471175
     1176#if !QC_SDC_UNIFY_G0130
    10481177  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
    10491178  {
    10501179    UInt symbol;
     1180#if QC_GENERIC_SDC_G0122
     1181    UInt uiNumSegments = isDimMode( dir ) ? 2 : 1;
     1182#else
    10511183    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1184#endif
    10521185
    10531186    if( pcCU->getSDCFlag( absPartIdx ) )
     
    10851218    }
    10861219  }
    1087 
     1220#endif
    10881221  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
    10891222}
    10901223
     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
    10911266Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
    10921267{
     
    11511326#endif
    11521327}
     1328#endif
    11531329#endif
    11541330
     
    20582234  if( 1 == uiW )   
    20592235  {
     2236#if MTK_ARP_FLAG_CABAC_SIMP_G0061
     2237    m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 2 ) );
     2238#else
    20602239    m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 3 ) );
     2240#endif
    20612241    uiW += ( 1 == uiCode ? 1 : 0 );
    20622242  }
     
    20782258{
    20792259  UInt uiSymbol = 0;
     2260#if MTK_IC_FLAG_CABAC_SIMP_G0061
     2261  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) );
     2262#else
    20802263  UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx );
    20812264  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) );
     2265#endif
    20822266#if !H_MV_ENC_DEC_TRAC
    20832267  DTRACE_CABAC_VL( g_nSymbolCounter++ );
     
    20972281
    20982282#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
    20992371Void TDecSbac::parseInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    21002372{
     
    21312403}
    21322404#endif
     2405#endif
     2406
     2407#if H_3D_DBBP
     2408Void TDecSbac::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     2409{
     2410  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
     2411  AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
     2412  AOF( !pcCU->getSlice()->getIsDepth() );
     2413  AOF( ePartSize == RWTH_DBBP_PACK_MODE );
     2414 
     2415  UInt uiSymbol = 0;
     2416 
     2417  m_pcTDecBinIf->decodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
     2418 
     2419  if( uiSymbol )
     2420  {
     2421    pcCU->setDBBPFlagSubParts(true, uiAbsPartIdx, 0, uiDepth);
     2422  }
     2423}
     2424#endif
    21332425
    21342426//! \}
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r773 r833  
    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
     121#endif
     122#if H_3D_DBBP
     123  Void parseDBBPFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    116124#endif
    117125private:
     
    211219  ContextModel3DBuffer m_cDdcFlagSCModel;
    212220  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
    213227#if H_3D_DIM_DMM
    214228  ContextModel3DBuffer m_cDmm1DataSCModel;
     
    219233#endif
    220234#endif
    221 #if H_3D_INTER_SDC
     235#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    222236  ContextModel3DBuffer m_cInterSDCFlagSCModel;
    223237  ContextModel3DBuffer m_cInterSDCResidualSCModel;
    224238  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
    225239#endif
     240#if QC_SDC_UNIFY_G0130
     241  ContextModel3DBuffer m_cSDCFlagSCModel;
     242#endif
     243#if H_3D_DBBP
     244  ContextModel3DBuffer m_cDBBPFlagSCModel;
     245#endif
    226246};
    227247
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r773 r833  
    8282#endif
    8383
     84#if MTK_DDD_G0063
     85  Int getCodedScale( Int iBaseView, Int iCureView){ return m_aaiCodedScale[ iBaseView ][ iCureView ];}
     86  Int getCodedOffset( Int iBaseView, Int iCureView){ return m_aaiCodedOffset[ iBaseView ][ iCureView ];}
     87  UInt getCamParsCodedPrecision(){ return m_uiCamParsCodedPrecision; }
     88#endif
     89
    8490private:
    8591  Bool  xIsComplete ();
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r773 r833  
    15001500        WRITE_FLAG( pcVPS->getIvMvPredFlag         ( i ) ? 1 : 0 , "iv_mv_pred_flag[i]");
    15011501#if H_3D_SPIVMP
     1502#if SEC_SPIVMP_MCP_SIZE_G0077
     1503        WRITE_UVLC( pcVPS->getSubPULog2Size(i)-3, "log2_sub_PU_size_minus3[i]");
     1504#else
    15021505        WRITE_UVLC( pcVPS->getSubPULog2Size(i)-2, "log2_sub_PU_size_minus2[i]");
     1506#endif
    15031507#endif
    15041508#endif
     
    15121516        WRITE_FLAG( pcVPS->getViewSynthesisPredFlag( i ) ? 1 : 0 , "view_synthesis_pred_flag[i]");
    15131517#endif
     1518#if H_3D_DBBP
     1519        WRITE_FLAG( pcVPS->getUseDBBP( i ) ? 1 : 0, "use_dbbp_flag[i]" );
     1520#endif
    15141521      }         
    15151522      else
     
    15221529        if (i!=1)
    15231530        {
     1531#if SEC_SPIVMP_MCP_SIZE_G0077
     1532          WRITE_UVLC( pcVPS->getSubPULog2Size(i)-3, "log2_sub_PU_size_minus3[i]");
     1533#else
    15241534          WRITE_UVLC( pcVPS->getSubPULog2Size(i)-2, "log2_sub_PU_size_minus2[i]");
     1535#endif
    15251536        }
    15261537#endif
     
    15551566    }
    15561567  }
     1568#if QC_SPIVMP_MPI_G0119
     1569  WRITE_UVLC( pcVPS->getSubPUMPILog2Size( ) - 3, "log2_sub_PU_MPI_size_minus3");
     1570#endif
    15571571#if H_3D_TMVP
    15581572  WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
     
    25132527
    25142528#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
    25152540Void TEncCavlc::codeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )
    25162541{
     
    25232548}
    25242549#endif
     2550#endif
     2551   
     2552#if H_3D_DBBP
     2553Void TEncCavlc::codeDBBPFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2554{
     2555  assert(0);
     2556}
     2557#endif
    25252558//! \}
  • trunk/source/Lib/TLibEncoder/TEncCavlc.h

    r773 r833  
    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
     147#endif
     148#if H_3D_DBBP
     149  Void codeDBBPFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    142150#endif
    143151
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r773 r833  
    411411  Int      m_iSubPULog2Size;
    412412#endif
     413#if QC_SPIVMP_MPI_G0119
     414  Int      m_iSubPUMPILog2Size;
     415#endif
    413416#if H_3D_IC
    414417  Bool      m_bUseIC;
     
    416419#if H_3D_INTER_SDC
    417420  bool      m_bInterSDC;
     421#endif
     422#if H_3D_DBBP
     423  Bool      m_bUseDBBP;
    418424#endif
    419425  //====== Depth Intra Modes ======
     
    515521  Void       setSubPULog2Size                   (Int u)              { m_iSubPULog2Size = u; }     
    516522#endif
    517 
     523#if QC_SPIVMP_MPI_G0119
     524  Int        getSubPUMPILog2Size            ()               { return m_iSubPUMPILog2Size;}
     525  Void       setSubPUMPILog2Size            (Int u)          { m_iSubPUMPILog2Size = u;   }     
     526#endif
    518527#if H_3D_IC
    519528  Void       setUseIC                       ( Bool bVal )    { m_bUseIC = bVal; }
     
    523532  Void       setInterSDCEnable              ( Bool bVal )    { m_bInterSDC = bVal; }
    524533  Bool       getInterSDCEnable              ()               { return m_bInterSDC; }
     534#endif
     535#if H_3D_DBBP
     536  Void       setUseDBBP                     ( Bool  b )      { m_bUseDBBP   = b; }
     537  Bool       getUseDBBP()                                    { return m_bUseDBBP;     }
    525538#endif
    526539  //======== Transform =============
  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r773 r833  
    7676  m_ppcRecoYuvTemp = new TComYuv*[m_uhTotalDepth-1];
    7777  m_ppcOrigYuv     = new TComYuv*[m_uhTotalDepth-1];
     78#if H_3D_DBBP
     79  m_ppcOrigYuvDBBP = new TComYuv*[m_uhTotalDepth-1];
     80#endif
    7881 
    7982  UInt uiNumPartitions;
     
    100103   
    101104    m_ppcOrigYuv    [i] = new TComYuv; m_ppcOrigYuv    [i]->create(uiWidth, uiHeight);
     105#if H_3D_DBBP
     106    m_ppcOrigYuvDBBP[i] = new TComYuv; m_ppcOrigYuvDBBP[i]->create(uiWidth, uiHeight);
     107#endif
    102108  }
    103109 
     
    180186      m_ppcOrigYuv[i]->destroy();     delete m_ppcOrigYuv[i];     m_ppcOrigYuv[i] = NULL;
    181187    }
     188#if H_3D_DBBP
     189    if(m_ppcOrigYuvDBBP[i])
     190    {
     191      m_ppcOrigYuvDBBP[i]->destroy(); delete m_ppcOrigYuvDBBP[i]; m_ppcOrigYuvDBBP[i] = NULL;
     192    }
     193#endif
    182194  }
    183195  if(m_ppcBestCU)
     
    234246    m_ppcOrigYuv = NULL;
    235247  }
     248#if H_3D_DBBP
     249  if(m_ppcOrigYuvDBBP)
     250  {
     251    delete [] m_ppcOrigYuvDBBP;
     252    m_ppcOrigYuvDBBP = NULL;
     253  }
     254#endif
    236255}
    237256
     
    544563          bTryNx2N  = false;
    545564          bTry2NxN  = false;
     565#if MTK_TEX_DEP_PAR_G0055
     566          if( pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize(uiCUIdx) != SIZE_2Nx2N)
     567          {
     568            if(pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxN || pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnU|| pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnD)
     569              bTry2NxN  = true;
     570            else
     571              bTryNx2N  = true;
     572          }
     573#endif
    546574        }
    547575      }
     
    570598          if (rpcTempCU->getSlice()->getIsDepth() )
    571599          {
     600#if SEC_DEPTH_DV_DERIVAITON_G0074
     601            DvInfo.bDV = rpcTempCU->getDispforDepth(0, 0, &DvInfo);
     602#else
    572603            DvInfo.bDV = rpcTempCU->getDispNeighBlocks(0, 0, &DvInfo);
     604#endif
    573605          }
    574606          else
     
    650682            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    651683#endif
     684         
     685#if H_3D_DBBP
     686          if( m_pcEncCfg->getUseDBBP() )
     687          {
     688            xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );
     689            rpcTempCU->initEstData( uiDepth, iQP );
     690#if H_3D_VSP
     691            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     692#endif
     693          }
     694#endif
     695         
    652696            if(m_pcEncCfg->getUseCbfFastMode())
    653697            {
     
    15761620#endif
    15771621    m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx );
     1622#if !SEC_IC_ARP_SIG_G0072
    15781623#if H_3D_IC
    15791624    m_pcEntropyCoder->encodeICFlag  ( pcCU, uiAbsPartIdx );
    15801625#endif
     1626#endif
    15811627#if H_3D_ARP
    15821628    m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
    15831629#endif
     1630#if SEC_IC_ARP_SIG_G0072
     1631#if H_3D_IC
     1632    m_pcEntropyCoder->encodeICFlag  ( pcCU, uiAbsPartIdx );
     1633#endif
     1634#endif
    15841635    finishCU(pcCU,uiAbsPartIdx,uiDepth);
    15851636    return;
     
    15891640  m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    15901641 
     1642#if QC_SDC_UNIFY_G0130
     1643  m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
     1644#endif
    15911645  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
    15921646  {
     
    16031657  // prediction Info ( Intra : direction mode, Inter : Mv, reference idx )
    16041658  m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx );
     1659#if !SEC_IC_ARP_SIG_G0072
    16051660#if H_3D_IC
    16061661  m_pcEntropyCoder->encodeICFlag  ( pcCU, uiAbsPartIdx );
    16071662#endif
     1663#endif
    16081664#if H_3D_ARP
    16091665  m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
    16101666#endif
    1611 #if H_3D_INTER_SDC
     1667#if SEC_IC_ARP_SIG_G0072
     1668#if H_3D_IC
     1669  m_pcEntropyCoder->encodeICFlag  ( pcCU, uiAbsPartIdx );
     1670#endif
     1671#endif
     1672#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    16121673  m_pcEntropyCoder->encodeInterSDCFlag( pcCU, uiAbsPartIdx, false );
    16131674#endif
     
    18371898#if H_3D_ARP
    18381899  Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;
     1900#if SEC_IC_ARP_SIG_G0072
     1901  if( nARPWMax < 0 || !rpcTempCU->getDvInfo(0).bDV || bICFlag )
     1902#else
    18391903  if( nARPWMax < 0 || !rpcTempCU->getDvInfo(0).bDV )
     1904#endif
    18401905  {
    18411906    nARPWMax = 0;
     
    18771942
    18781943#endif
     1944
     1945#if MTK_DDD_G0063
     1946    Int iDDDCand = rpcTempCU->getUseDDDCandIdx();
     1947    UChar ucDDDepth = rpcTempCU->getDDTmpDepth();
     1948    rpcTempCU->setUseDDD( false, 0, uhDepth );
     1949#endif
     1950
    18791951  for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual )
    18801952  {
     
    19101982          rpcTempCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, 0, 0, uhDepth );
    19111983#endif
     1984
     1985#if MTK_DDD_G0063
     1986          if( rpcTempCU->getSlice()->getIsDepth() && rpcTempCU->getSlice()->getViewIndex() != 0 && iDDDCand == uiMergeCand )
     1987          {
     1988              rpcTempCU->setUseDDD( true, 0, 0, uhDepth );
     1989              rpcTempCU->setDDDepthSubParts( ucDDDepth, 0, 0, uhDepth );
     1990          }
     1991          else
     1992          {
     1993              rpcTempCU->setUseDDD( false, 0, 0, uhDepth );
     1994          }
     1995#endif
     1996
    19121997#if H_3D_SPIVMP
    19131998          rpcTempCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeCand], 0, 0, uhDepth);
     
    19312016          }
    19322017          else
     2018#endif
     2019#if NTT_STORE_SPDV_VSP_G0148
     2020          if ( vspFlag[uiMergeCand] )
    19332021          {
    1934 #endif
     2022            UInt partAddr;
     2023            Int vspSize;
     2024            Int width, height;
     2025            rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );
     2026
     2027            if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )
     2028            {
     2029              rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );
     2030              rpcTempCU->setVSPFlag( partAddr, vspSize );
     2031            }
     2032            else
     2033            {
     2034              rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     2035            }
     2036            if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )
     2037            {
     2038              rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );
     2039              rpcTempCU->setVSPFlag( partAddr, vspSize );
     2040            }
     2041            else
     2042            {
     2043              rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     2044            }
     2045
     2046            rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
     2047          }
     2048          else
     2049#endif
     2050          {
    19352051            rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    19362052            rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    19372053            rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1938 #if H_3D_SPIVMP
    19392054          }
    1940 #endif
    19412055       // do MC
    19422056       m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     
    19682082
    19692083          rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
     2084#if NTT_STORE_SPDV_VSP_G0148 // possible bug fix
     2085          if( rpcTempCU->getSkipFlag(0) )
     2086          {
     2087            rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
     2088          }
     2089#endif
    19702090#if H_3D_INTER_SDC
    19712091          TComDataCU *rpcTempCUPre = rpcTempCU;
     
    19772097          if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
    19782098          {
     2099#if SEC_INTER_SDC_G0101
     2100            for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
     2101            {
     2102              if( rpcTempCU != rpcTempCUPre )
     2103              {
     2104                rpcTempCU->initEstData( uhDepth, orgQP );
     2105                rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2106              }
     2107              rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2108              rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2109              rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2110#if H_3D_VSO //M2
     2111              if( m_pcRdCost->getUseRenModel() )
     2112              { //Reset
     2113                UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
     2114                UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
     2115                Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
     2116                UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
     2117                m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2118              }
     2119#endif
     2120              m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2121                m_ppcOrigYuv[uhDepth],
     2122                ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2123                m_ppcResiYuvTemp[uhDepth],
     2124                m_ppcRecoYuvTemp[uhDepth],
     2125                uiOffest,
     2126                uhDepth );
     2127
     2128              xCheckDQP( rpcTempCU );
     2129              xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     2130            }
     2131#else
    19792132            if( rpcTempCU != rpcTempCUPre )
    19802133            {
     
    20042157            xCheckDQP( rpcTempCU );
    20052158            xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     2159#endif
    20062160          }
    20072161#endif
     
    20872241  Int nARPWMax    = rpcTempCU->getSlice()->getARPStepNum() - 1;
    20882242
     2243#if SEC_IC_ARP_SIG_G0072
     2244  if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || !rpcTempCU->getDvInfo(0).bDV || rpcTempCU->getICFlag(0) )
     2245#else
    20892246  if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || !rpcTempCU->getDvInfo(0).bDV  )
     2247#endif
    20902248  {
    20912249    nARPWMax = 0;
     
    21182276  rpcTempCU->setCUTransquantBypassSubParts  ( m_pcEncCfg->getCUTransquantBypassFlagValue(),      0, uhDepth );
    21192277 
     2278#if MTK_DDD_G0063
     2279  rpcTempCU->setUseDDD( false, 0, uhDepth );
     2280#endif
     2281
    21202282#if H_3D_ARP
    21212283  rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
     
    21862348
    21872349  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
    2188 
     2350 
     2351#if NTT_STORE_SPDV_VSP_G0148 // possible bug fix
     2352  if( rpcTempCU->getQtRootCbf(0)==0 )
     2353  {
     2354    rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
     2355  }
     2356#endif
    21892357
    21902358#if H_3D_VSO // M4
     
    22002368  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    22012369#if H_3D_INTER_SDC
     2370#if SEC_INTER_SDC_G0101 // ONLY_2NX2N_SDC
     2371  if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && ePartSize == SIZE_2Nx2N)
     2372#else
    22022373  if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() )
    2203   {
     2374#endif
     2375  {
     2376#if SEC_INTER_SDC_G0101
     2377    for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
     2378    {
     2379      if( rpcTempCU != rpcTempCUPre )
     2380      {
     2381        Int orgQP = rpcBestCU->getQP( 0 );
     2382        rpcTempCU->initEstData( uhDepth, orgQP );
     2383        rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2384      }
     2385      rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2386      rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2387      rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2388#if H_3D_VSO // M3
     2389      if( m_pcRdCost->getUseRenModel() )
     2390      {
     2391        UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     2392        UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     2393        Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     2394        UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     2395        m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2396      }
     2397#endif
     2398
     2399      m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2400        m_ppcOrigYuv[uhDepth],
     2401        ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2402        m_ppcResiYuvTemp[uhDepth],
     2403        m_ppcRecoYuvTemp[uhDepth],
     2404        uiOffest,
     2405        uhDepth );
     2406
     2407      xCheckDQP( rpcTempCU );
     2408      xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2409    }
     2410#else
    22042411    if( rpcTempCU != rpcTempCUPre )
    22052412    {
     
    22312438  xCheckDQP( rpcTempCU );
    22322439  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2440#endif
    22332441  }
    22342442#endif
     
    22402448#endif
    22412449}
     2450
     2451#if H_3D_DBBP
     2452Void TEncCu::xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment )
     2453{
     2454  UInt  uiWidth     = pOrigYuv->getWidth ( );
     2455  UInt  uiHeight    = pOrigYuv->getHeight( );
     2456  Pel*  piSrc       = pOrigYuv->getLumaAddr( );
     2457  UInt  uiSrcStride = pOrigYuv->getStride();
     2458  Pel*  piDst       = pOrigYuvTemp->getLumaAddr( );
     2459  UInt  uiDstStride = pOrigYuvTemp->getStride();
     2460 
     2461  UInt  uiMaskStride= MAX_CU_SIZE;
     2462 
     2463  AOF( uiWidth == uiHeight );
     2464 
     2465  // backup pointer
     2466  Bool* pMaskStart = pMask;
     2467 
     2468  for (Int y=0; y<uiHeight; y++)
     2469  {
     2470    for (Int x=0; x<uiWidth; x++)
     2471    {
     2472      UChar ucSegment = (UChar)pMask[x];
     2473      AOF( ucSegment < 2 );
     2474     
     2475      piDst[x] = (ucSegment==uiValidSegment)?piSrc[x]:DBBP_INVALID_SHORT;
     2476    }
     2477   
     2478    piSrc  += uiSrcStride;
     2479    piDst  += uiDstStride;
     2480    pMask  += uiMaskStride;
     2481  }
     2482 
     2483  // now invalidate chroma
     2484  Pel*  piSrcU       = pOrigYuv->getCbAddr();
     2485  Pel*  piSrcV       = pOrigYuv->getCrAddr();
     2486  UInt  uiSrcStrideC = pOrigYuv->getCStride();
     2487  Pel*  piDstU       = pOrigYuvTemp->getCbAddr( );
     2488  Pel*  piDstV       = pOrigYuvTemp->getCrAddr( );
     2489  UInt  uiDstStrideC = pOrigYuvTemp->getCStride();
     2490  pMask = pMaskStart;
     2491 
     2492  for (Int y=0; y<uiHeight/2; y++)
     2493  {
     2494    for (Int x=0; x<uiWidth/2; x++)
     2495    {
     2496      UChar ucSegment = (UChar)pMask[x*2];
     2497      AOF( ucSegment < 2 );
     2498     
     2499      piDstU[x] = (ucSegment==uiValidSegment)?piSrcU[x]:DBBP_INVALID_SHORT;
     2500      piDstV[x] = (ucSegment==uiValidSegment)?piSrcV[x]:DBBP_INVALID_SHORT;
     2501    }
     2502   
     2503    piSrcU  += uiSrcStrideC;
     2504    piSrcV  += uiSrcStrideC;
     2505    piDstU  += uiDstStrideC;
     2506    piDstV  += uiDstStrideC;
     2507    pMask   += 2*uiMaskStride;
     2508  }
     2509}
     2510
     2511Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )
     2512{
     2513  AOF( !rpcTempCU->getSlice()->getIsDepth() );
     2514 
     2515  UChar uhDepth = rpcTempCU->getDepth( 0 );
     2516 
     2517#if H_3D_VSO
     2518  if( m_pcRdCost->getUseRenModel() )
     2519  {
     2520    UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     2521    UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     2522    Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     2523    UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     2524    m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2525  }
     2526#endif
     2527 
     2528  UInt uiWidth  = rpcTempCU->getWidth(0);
     2529  UInt uiHeight = rpcTempCU->getHeight(0);
     2530  AOF( uiWidth == uiHeight );
     2531 
     2532  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N,  0, uhDepth );
     2533 
     2534  // fetch virtual depth block
     2535  UInt uiDepthStride = 0;
     2536  Pel* pDepthPels = rpcTempCU->getVirtualDepthBlock(0, uiWidth, uiHeight, uiDepthStride);
     2537  AOF( pDepthPels != NULL );
     2538  AOF( uiDepthStride != 0 );
     2539 
     2540  // derive partitioning from depth
     2541  PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth);
     2542 
     2543  // derive segmentation mask from depth
     2544  Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE];
     2545  Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask);
     2546 
     2547  if( !bValidMask )
     2548  {
     2549    return;
     2550  }
     2551 
     2552  // find optimal motion/disparity vector for each segment
     2553  DisInfo originalDvInfo = rpcTempCU->getDvInfo(0);
     2554  DBBPTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData();
     2555  TComYuv* apPredYuv[2] = { m_ppcRecoYuvTemp[uhDepth], m_ppcPredYuvTemp[uhDepth] };
     2556 
     2557  // find optimal motion vector fields for both segments (as 2Nx2N)
     2558  rpcTempCU->setDepthSubParts( uhDepth, 0 );
     2559  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N,  0, uhDepth );
     2560  rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth );
     2561  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     2562  {
     2563    rpcTempCU->setDBBPFlagSubParts(true, 0, 0, uhDepth);
     2564    rpcTempCU->setDvInfoSubParts(originalDvInfo, 0, uhDepth);
     2565   
     2566    // invalidate all other segments in original YUV
     2567    xInvalidateOriginalSegments(m_ppcOrigYuv[uhDepth], m_ppcOrigYuvDBBP[uhDepth], pMask, uiSegment);
     2568   
     2569    // do motion estimation for this segment
     2570    m_pcRdCost->setUseMask(true);
     2571    rpcTempCU->getDBBPTmpData()->eVirtualPartSize = eVirtualPartSize;
     2572    rpcTempCU->getDBBPTmpData()->uiVirtualPartIndex = uiSegment;
     2573    m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], false, false, bUseMRG );
     2574    m_pcRdCost->setUseMask(false);
     2575   
     2576    // extract motion parameters of full block for this segment
     2577    pDBBPTmpData->auhInterDir[uiSegment] = rpcTempCU->getInterDir(0);
     2578   
     2579    pDBBPTmpData->abMergeFlag[uiSegment] = rpcTempCU->getMergeFlag(0);
     2580    pDBBPTmpData->auhMergeIndex[uiSegment] = rpcTempCU->getMergeIndex(0);
     2581   
     2582    pDBBPTmpData->ahVSPFlag[uiSegment] = rpcTempCU->getVSPFlag(0);
     2583    pDBBPTmpData->acDvInfo[uiSegment] = rpcTempCU->getDvInfo(0);
     2584   
     2585    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     2586    {
     2587      RefPicList eRefList = (RefPicList)uiRefListIdx;
     2588     
     2589      pDBBPTmpData->acMvd[uiSegment][eRefList] = rpcTempCU->getCUMvField(eRefList)->getMvd(0);
     2590      pDBBPTmpData->aiMvpNum[uiSegment][eRefList] = rpcTempCU->getMVPNum(eRefList, 0);
     2591      pDBBPTmpData->aiMvpIdx[uiSegment][eRefList] = rpcTempCU->getMVPIdx(eRefList, 0);
     2592     
     2593      rpcTempCU->getMvField(rpcTempCU, 0, eRefList, pDBBPTmpData->acMvField[uiSegment][eRefList]);
     2594    }
     2595  }
     2596 
     2597  // store final motion/disparity information in each PU using derived partitioning
     2598  rpcTempCU->setDepthSubParts( uhDepth, 0 );
     2599  rpcTempCU->setPartSizeSubParts  ( eVirtualPartSize,  0, uhDepth );
     2600  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
     2601 
     2602  UInt uiPUOffset = ( g_auiPUOffset[UInt( eVirtualPartSize )] << ( ( rpcTempCU->getSlice()->getSPS()->getMaxCUDepth() - uhDepth ) << 1 ) ) >> 4;
     2603  for( UInt uiSegment = 0; uiSegment < 2; uiSegment++ )
     2604  {
     2605    UInt uiPartAddr = uiSegment*uiPUOffset;
     2606   
     2607    rpcTempCU->setDBBPFlagSubParts(true, uiPartAddr, uiSegment, uhDepth);
     2608   
     2609    // now set stored information from 2Nx2N motion search to each partition
     2610    rpcTempCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[uiSegment], uiPartAddr, uiSegment, uhDepth); // interprets depth relative to LCU level
     2611   
     2612    rpcTempCU->setMergeFlagSubParts(pDBBPTmpData->abMergeFlag[uiSegment], uiPartAddr, uiSegment, uhDepth);
     2613    rpcTempCU->setMergeIndexSubParts(pDBBPTmpData->auhMergeIndex[uiSegment], uiPartAddr, uiSegment, uhDepth);
     2614   
     2615    rpcTempCU->setVSPFlagSubParts(pDBBPTmpData->ahVSPFlag[uiSegment], uiPartAddr, uiSegment, uhDepth);
     2616    rpcTempCU->setDvInfoSubParts(pDBBPTmpData->acDvInfo[uiSegment], uiPartAddr, uiSegment, uhDepth);
     2617   
     2618    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     2619    {
     2620      RefPicList eRefList = (RefPicList)uiRefListIdx;
     2621     
     2622      rpcTempCU->getCUMvField( eRefList )->setAllMvd(pDBBPTmpData->acMvd[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment);
     2623      rpcTempCU->setMVPNum(eRefList, uiPartAddr, pDBBPTmpData->aiMvpNum[uiSegment][eRefList]);
     2624      rpcTempCU->setMVPIdx(eRefList, uiPartAddr, pDBBPTmpData->aiMvpIdx[uiSegment][eRefList]);
     2625     
     2626      rpcTempCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[uiSegment][eRefList], eVirtualPartSize, uiPartAddr, 0, uiSegment ); // interprets depth relative to rpcTempCU level
     2627    }
     2628  }
     2629 
     2630  // reconstruct final prediction signal by combining both segments
     2631  m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight);
     2632 
     2633  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
     2634 
     2635  xCheckDQP( rpcTempCU );
     2636  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2637}
     2638#endif
    22422639
    22432640Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
     
    22852682  m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
    22862683  m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
     2684#if QC_SDC_UNIFY_G0130
     2685  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2686#endif
    22872687  m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0,          true );
    22882688  m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
     
    23742774  m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0,          true );
    23752775  m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true );
     2776#if QC_SDC_UNIFY_G0130
     2777  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2778#endif
    23762779  m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true );
    23772780
  • trunk/source/Lib/TLibEncoder/TEncCu.h

    r655 r833  
    8282  TComYuv**               m_ppcOrigYuv;     ///< Original Yuv for each depth
    8383 
     84#if H_3D_DBBP
     85  TComYuv**               m_ppcOrigYuvDBBP;
     86#endif
     87 
    8488  //  Data : encoder control
    8589  Bool                    m_bEncodeDQP;
     
    168172  Void  xCheckRDCostInter   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
    169173#endif
     174#if H_3D_DBBP
     175  Void  xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment );
     176  Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );
     177#endif
    170178  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
    171179  Void  xCheckDQP           ( TComDataCU*  pcCU );
  • trunk/source/Lib/TLibEncoder/TEncEntropy.cpp

    r773 r833  
    160160Void TEncEntropy::encodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    161161{
     162#if SEC_IC_ARP_SIG_G0072
     163  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 )
     164#else
    162165  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
     166#endif
    163167  {
    164168    return;
     
    240244    uiAbsPartIdx = 0;
    241245  }
     246 
     247#if H_3D_DBBP
     248  PartSize eVirtualPartSize = pcCU->getPartitionSize(uiAbsPartIdx);
     249  if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     250  {
     251    AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
     252   
     253    // temporarily change partition size for DBBP blocks
     254    pcCU->setPartSizeSubParts(RWTH_DBBP_PACK_MODE, uiAbsPartIdx, uiDepth);
     255  }
     256#endif
     257 
    242258  m_pcEntropyCoderIf->codePartSize( pcCU, uiAbsPartIdx, uiDepth );
     259 
     260#if H_3D_DBBP
     261  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE )
     262  {
     263    encodeDBBPFlag(pcCU, uiAbsPartIdx, bRD);
     264   
     265    if( pcCU->getDBBPFlag(uiAbsPartIdx) )
     266    {
     267      AOF( pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE );
     268      // restore virtual partition size for DBBP blocks
     269      pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);
     270    }
     271  }
     272#endif
    243273}
    244274
     
    649679  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    650680  UInt uiChromaOffset = uiLumaOffset>>2;
    651    
     681#if QC_SDC_UNIFY_G0130
    652682#if H_3D_DIM_SDC
    653   if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     683  if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx ) )
    654684  {
    655685    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     
    658688    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
    659689    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
    660     return;
    661690  }
    662691#endif
    663692
    664693#if H_3D_INTER_SDC
    665   if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     694  if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx ) )
    666695  {
    667696    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
    668697    assert( !pcCU->isIntra( uiAbsPartIdx) );
    669698    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() );
    670745
    671746    encodeInterSDCResidualData( pcCU, uiAbsPartIdx, false );
    672747    return;
    673748  }
     749#endif
    674750#endif
    675751
     
    825901
    826902#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
    827940Void TEncEntropy::encodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    828941{
     
    872985}
    873986#endif
     987#endif
     988#if H_3D_DBBP
     989Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     990{
     991  if( bRD )
     992  {
     993    uiAbsPartIdx = 0;
     994  }
     995  m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );
     996}
     997#endif
    874998
    875999//! \}
  • trunk/source/Lib/TLibEncoder/TEncEntropy.h

    r655 r833  
    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
     104#endif
     105#if H_3D_DBBP
     106  virtual Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    99107#endif
    100108  virtual Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     
    186194#endif
    187195#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
    188200  Void encodeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    189201  Void encodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD );
     202#endif
     203#endif
     204#if H_3D_DBBP
     205  Void encodeDBBPFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    190206#endif
    191207  Void encodePredMode          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
  • trunk/source/Lib/TLibEncoder/TEncSbac.cpp

    r773 r833  
    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)
     116#endif
     117#if H_3D_DBBP
     118, m_cDBBPFlagSCModel             ( 1,             1,                 DBBP_NUM_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
    107119#endif
    108120{
     
    168180  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    169181  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
    170188#if H_3D_DIM_DMM
    171189  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    176194#endif
    177195#endif
    178 #if H_3D_INTER_SDC
     196#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    179197  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    180198  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    181199  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 );
     203#endif
     204#if H_3D_DBBP
     205  m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
    182206#endif
    183207  // new structure
     
    218242      curCost += m_cCUICFlagSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_IC_FLAG );
    219243#endif
    220 #if H_3D_INTER_SDC
     244#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    221245      curCost += m_cInterSDCFlagSCModel.calcCost      ( curSliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
    222246      curCost += m_cInterSDCResidualSCModel.calcCost  ( curSliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    223247      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 );
     251#endif
     252#if H_3D_DBBP
     253      curCost += m_cDBBPFlagSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DBBP_FLAG );
    224254#endif
    225255      curCost += m_cCUPartSizeSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_PART_SIZE );
     
    252282      curCost += m_cDdcFlagSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_FLAG );
    253283      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
    254290#if H_3D_DIM_DMM
    255291      curCost += m_cDmm1DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM1_DATA );
     
    317353  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    318354  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
    319361#if H_3D_DIM_DMM
    320362  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    325367#endif
    326368#endif
    327 #if H_3D_INTER_SDC
     369#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    328370  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    329371  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    330372  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 );
     376#endif
     377#if H_3D_DBBP
     378  m_cDBBPFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DBBP_FLAG );
    331379#endif
    332380  m_pcBinIf->start();
     
    629677  this->m_cDepthIntraModeSCModel .copyFrom( &pSrc->m_cDepthIntraModeSCModel );
    630678  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
    631685}
    632686#endif
     
    679733  Bool rapPic     = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
    680734
     735#if MTK_TEX_DEP_PAR_G0055
     736  Bool depthDependent = false;
     737  UInt uiTexturePart = eSize;
     738#endif
    681739  if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && pcCU->getPic()->getReduceBitsFlag() && sps->getUseQTL() && sps->getUsePC() )
    682740  {
     
    684742    UInt uiCUIdx            = (pcCU->getZorderIdxInCU() == 0) ? uiAbsPartIdx : pcCU->getZorderIdxInCU();
    685743    assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth);
     744#if !MTK_TEX_DEP_PAR_G0055
    686745    if (pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize( uiCUIdx ) != SIZE_NxN)
     746#else
     747    if(pcTextureCU->getDepth(uiCUIdx) == uiDepth )
     748    {
     749      depthDependent = true;
     750      uiTexturePart = pcTextureCU->getPartitionSize( uiCUIdx );
     751    }
     752    if (pcTextureCU->getDepth(uiCUIdx) == uiDepth && pcTextureCU->getPartitionSize( uiCUIdx ) == SIZE_2Nx2N)
     753#endif
    687754    {
    688755      assert( eSize == SIZE_2Nx2N );
     
    706773  DTRACE_CU("part_mode", eSize )
    707774#endif       
     775#if MTK_TEX_DEP_PAR_G0055
     776    if (depthDependent==false || uiTexturePart == SIZE_NxN|| uiTexturePart == SIZE_2Nx2N)
     777    {
     778#endif
    708779  switch(eSize)
    709780  {
     
    772843    }
    773844  }
     845#if MTK_TEX_DEP_PAR_G0055
     846    }
     847    else if(uiTexturePart == SIZE_2NxN || uiTexturePart == SIZE_2NxnU || uiTexturePart == SIZE_2NxnD)
     848    {
     849      //assert(eSize!=SIZE_NxN);
     850      //assert(eSize!=SIZE_Nx2N);
     851      //assert(eSize==SIZE_2Nx2N || eSize==SIZE_2NxN || eSize==SIZE_2NxnU || eSize==SIZE_2NxnD);
     852      switch(eSize)
     853      {
     854      case SIZE_2Nx2N:
     855        {
     856          m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     857          break;
     858        }
     859      case SIZE_2NxN:
     860        {
     861          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     862          if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     863          {     
     864            m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     865          }
     866          break;
     867        }
     868      case SIZE_2NxnU:
     869      case SIZE_2NxnD:
     870        {
     871          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     872          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     873          m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1));
     874          break;
     875        }
     876      default:
     877        {
     878          assert(0);
     879        }
     880      }
     881    }
     882    else if(uiTexturePart == SIZE_Nx2N|| uiTexturePart==SIZE_nLx2N || uiTexturePart==SIZE_nRx2N)
     883    {
     884      //assert(eSize!=SIZE_NxN);
     885      //assert(eSize!=SIZE_2NxN);
     886      //assert(eSize==SIZE_2Nx2N ||eSize==SIZE_Nx2N || eSize==SIZE_nLx2N || eSize==SIZE_nRx2N);
     887      switch(eSize)
     888      {
     889      case SIZE_2Nx2N:
     890        {
     891          m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     892          break;
     893        }
     894      case SIZE_Nx2N:
     895        {
     896          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     897          if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     898          {     
     899            m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     900          }
     901          break;
     902        }
     903      case SIZE_nLx2N:
     904      case SIZE_nRx2N:
     905        {
     906          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     907          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     908          m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1));
     909          break;
     910        }
     911      default:
     912        {
     913          assert(0);
     914        }
     915      }
     916    }
     917    else
     918    {
     919      printf("uiTexturePart=%d",uiTexturePart);
     920      assert(0);
     921    }
     922#endif
    774923}
    775924
     
    9061055  if( nBinNum > 1 )
    9071056  {
     1057#if MTK_ARP_FLAG_CABAC_SIMP_G0061
     1058     m_pcBinIf->encodeBin( ( iW == iMaxW ) ? 1 : 0, m_cCUPUARPWSCModel.get( 0, 0, 2 ) );
     1059#else
    9081060     m_pcBinIf->encodeBin( ( iW == iMaxW ) ? 1 : 0, m_cCUPUARPWSCModel.get( 0, 0, 3 ) );
     1061#endif
    9091062  }
    9101063#if H_MV_ENC_DEC_TRAC
     
    9241077  // get context function is here
    9251078  UInt uiSymbol = pcCU->getICFlag( uiAbsPartIdx ) ? 1 : 0;
     1079#if MTK_IC_FLAG_CABAC_SIMP_G0061
     1080  m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, 0 ) );
     1081#else
    9261082  UInt uiCtxIC  = pcCU->getCtxICFlag( uiAbsPartIdx ) ;
    9271083  m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) );
     1084#endif
    9281085#if !H_MV_ENC_DEC_TRAC
    9291086  DTRACE_CABAC_VL( g_nSymbolCounter++ );
     
    10161173    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    10171174#if H_3D_DIM_SDC
     1175#if QC_GENERIC_SDC_G0122
     1176      if( 1 )
     1177#else
    10181178      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1179#endif
    10191180#endif
    10201181    {
     
    10421203    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    10431204#if H_3D_DIM_SDC
     1205#if QC_GENERIC_SDC_G0122
     1206      if( 1 )
     1207#else
    10441208      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1209#endif
    10451210#endif
    10461211    {
     
    11411306  default: break;
    11421307  }
    1143 
     1308#if !QC_SDC_UNIFY_G0130
    11441309  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
    11451310  {
    11461311    UInt dimDeltaDC;
    11471312    Pel  deltaDC;
     1313#if QC_GENERIC_SDC_G0122
     1314    UInt uiNumSegments = isDimMode( dir ) ? 2 : 1;
     1315#else
    11481316    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1317#endif
    11491318    if( pcCU->getSDCFlag( absPartIdx ) )
    11501319    {
     
    11741343    }
    11751344  }
    1176 }
    1177 
     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
    11781378Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
    11791379{
     
    12161416  }
    12171417}
     1418#endif
    12181419#endif
    12191420
     
    21372338
    21382339#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
    21392414Void TEncSbac::codeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
    21402415{
     
    21582433}
    21592434#endif
     2435#endif
     2436
     2437#if H_3D_DBBP
     2438Void TEncSbac::codeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2439{
     2440  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
     2441  AOF( ePartSize == RWTH_DBBP_PACK_MODE );
     2442  AOF( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) );
     2443  AOF( !pcCU->getSlice()->getIsDepth() );
     2444 
     2445  UInt uiSymbol = pcCU->getDBBPFlag( uiAbsPartIdx ) ? 1 : 0;
     2446  m_pcBinIf->encodeBin( uiSymbol, m_cDBBPFlagSCModel.get( 0, 0, 0 ) );
     2447}
     2448#endif
     2449
    21602450//! \}
  • trunk/source/Lib/TLibEncoder/TEncSbac.h

    r773 r833  
    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
     163#endif
     164#if H_3D_DBBP
     165  Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    158166#endif
    159167  Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     
    247255  ContextModel3DBuffer m_cDdcFlagSCModel;
    248256  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
    249263#if H_3D_DIM_DMM
    250264  ContextModel3DBuffer m_cDmm1DataSCModel;
     
    255269#endif
    256270#endif
    257 #if H_3D_INTER_SDC
     271#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    258272  ContextModel3DBuffer m_cInterSDCFlagSCModel;
    259273  ContextModel3DBuffer m_cInterSDCResidualSCModel;
    260274  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
    261275#endif
     276#if QC_SDC_UNIFY_G0130
     277  ContextModel3DBuffer m_cSDCFlagSCModel;
     278#endif
     279#if H_3D_DBBP
     280  ContextModel3DBuffer m_cDBBPFlagSCModel;
     281#endif
    262282};
    263283
  • trunk/source/Lib/TLibEncoder/TEncSearch.cpp

    r773 r833  
    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#if QC_SDC_UNIFY_G0130_FIX2
     2223  m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth( 0 ), true );
     2224#else
     2225  m_pcEntropyCoder->encodePartSize( pcCU, 0, true );
     2226#endif
     2227  m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     2228#else
    20142229  m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     2230#endif
    20152231 
    20162232  // encode pred direction + DC residual data
    20172233  m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
     2234#if QC_SDC_UNIFY_G0130
     2235  Bool bDummy = false;
     2236  m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), uiWidth, uiHeight, bDummy );
     2237#endif
    20182238  UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
    20192239 
     
    20242244#endif
    20252245    dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );
     2246#if QC_GENERIC_SDC_G0122
     2247#if HS_TSINGHUA_SDC_SPLIT_G0111
     2248  dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg;
     2249#else
     2250  dmm4Segmentation->destroy(); delete dmm4Segmentation;
     2251#endif
     2252#endif
    20262253}
    20272254#endif
     
    29013128          case( DMM4_IDX ):
    29023129            {
     3130#if !QC_GENERIC_SDC_G0122
    29033131              if( uiWidth > 4 )
     3132#endif
    29043133              {
    29053134                biSegmentation = new TComWedgelet( uiWidth, uiHeight );
     
    29573186      {
    29583187        pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth );
     3188#if QC_GENERIC_SDC_G0122
     3189        for( Int iSDCDeltaResi = -2; iSDCDeltaResi <= 2; iSDCDeltaResi++ )
     3190        {
     3191          if( ( uiSDC == 0 ) && iSDCDeltaResi != 0 )
     3192          {
     3193            continue;
     3194          }
     3195#endif
    29593196#endif
    29603197     
     
    29663203#if H_3D_DIM_SDC
    29673204      bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);
     3205#endif
     3206#if QC_GENERIC_SDC_G0122
     3207      if( uiSDC != 0 && iSDCDeltaResi != 0 )
     3208      {
     3209        bTestZeroResi = false;
     3210      }
    29683211#endif
    29693212#endif
     
    30003243             
    30013244              // start encoding with SDC
     3245#if QC_GENERIC_SDC_G0122
     3246              xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
     3247#else
    30023248              xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, (testZeroResi!=0));
     3249#endif
    30033250            }
    30043251            else
     
    30733320#if H_3D_DIM_ENC || H_3D_DIM_SDC
    30743321      }
     3322#endif
     3323#if QC_GENERIC_SDC_G0122
     3324        } // SDC residual loop
    30753325#endif
    30763326#if H_3D_DIM_SDC
     
    35833833  pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );
    35843834  UInt uiDepth = pcCU->getDepth( uiAbsPartIdx );
     3835 
     3836#if H_3D_DBBP
     3837  DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     3838  if( pcCU->getDBBPFlag(0) )
     3839  {
     3840    AOF( uiAbsPartIdx == 0 );
     3841    AOF( iPUIdx == 0 );
     3842    AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );
     3843    AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );
     3844   
     3845    // temporary change of partition size for candidate derivation
     3846    pcCU->setPartSizeSubParts( pDBBPTmpData->eVirtualPartSize, 0, pcCU->getDepth(0));
     3847    iPUIdx = pcCU->getDBBPTmpData()->uiVirtualPartIndex;
     3848   
     3849    // if this is handling the second segment, make sure that motion info of first segment is available
     3850    if( iPUIdx == 1 )
     3851    {
     3852      pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level
     3853     
     3854      pcCU->setVSPFlagSubParts(pDBBPTmpData->ahVSPFlag[0], 0, 0, pcCU->getDepth(0));
     3855      pcCU->setDvInfoSubParts(pDBBPTmpData->acDvInfo[0], 0, 0, pcCU->getDepth(0));
     3856     
     3857      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     3858      {
     3859        RefPicList eRefList = (RefPicList)uiRefListIdx;
     3860       
     3861        pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[0][eRefList], pDBBPTmpData->eVirtualPartSize, 0, 0, 0 ); // interprets depth relative to rpcTempCU level
     3862      }
     3863    }
     3864   
     3865    // update these values to virtual partition size
     3866    pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );
     3867  }
     3868#endif
     3869 
    35853870  PartSize partSize = pcCU->getPartitionSize( 0 );
     3871#if H_3D_DBBP
     3872  if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(0) == false )
     3873#else
    35863874  if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 )
     3875#endif
    35873876  {
    35883877    pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
     
    36343923#endif
    36353924
     3925#if H_3D_DBBP
     3926  if( pcCU->getDBBPFlag(0) )
     3927  {
     3928    // reset to 2Nx2N for actual motion search
     3929    iPUIdx = 0;
     3930    AOF( pcCU->getPartitionSize(0) == pDBBPTmpData->eVirtualPartSize );
     3931    pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, pcCU->getDepth(0));
     3932   
     3933    // restore values for 2Nx2N partition size
     3934    pcCU->getPartIndexAndSize( iPUIdx, uiAbsPartIdx, iWidth, iHeight );
     3935   
     3936    AOF( uiAbsPartIdx == 0 );
     3937    AOF( iWidth == iHeight );
     3938  }
     3939#endif
    36363940
    36373941  ruiCost = MAX_UINT;
     
    36433947     
    36443948      PartSize ePartSize = pcCU->getPartitionSize( 0 );
     3949     
     3950#if H_3D_VSP && NTT_STORE_SPDV_VSP_G0148
     3951      pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
     3952      pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
     3953#endif
    36453954
    36463955#if H_3D_SPIVMP
     
    36623971      }
    36633972      else
    3664       {
    3665 #endif
     3973#endif
     3974#if NTT_STORE_SPDV_VSP_G0148
     3975#if H_3D_DBBP
     3976      if ( vspFlag[uiMergeCand] && !pcCU->getDBBPFlag(0) )
     3977#else
     3978      if ( vspFlag[uiMergeCand] )
     3979#endif
     3980      {
     3981        UInt partAddr;
     3982        Int vspSize;
     3983        Int width, height;
     3984        pcCU->getPartIndexAndSize( iPUIdx, partAddr, width, height );
     3985
     3986        if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )
     3987        {
     3988          pcCU->setMvFieldPUForVSP( pcCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );
     3989          pcCU->setVSPFlag( partAddr, vspSize );
     3990        }
     3991        else
     3992        {
     3993          pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
     3994        }
     3995        if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )
     3996        {
     3997          pcCU->setMvFieldPUForVSP( pcCU, partAddr, width, height, REF_PIC_LIST_1, cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );
     3998          pcCU->setVSPFlag( partAddr, vspSize );
     3999        }
     4000        else
     4001        {
     4002          pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
     4003        }
     4004      }
     4005      else
     4006#endif
     4007      {
    36664008        pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
    36674009        pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
    3668 #if H_3D_SPIVMP
    3669       }
    3670 #endif
    3671 
    3672 #if H_3D_VSP
     4010      }
     4011
     4012#if H_3D_VSP && !NTT_STORE_SPDV_VSP_G0148
    36734013      pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
    36744014      pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeCand].m_acDvInfo, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
     4015#endif
     4016
     4017#if MTK_DDD_G0063
     4018      if( uiMergeCand == pcCU->getUseDDDCandIdx() )
     4019      {
     4020          pcCU->setUseDDD( true, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
     4021          pcCU->setDDDepthSubParts( pcCU->getDDTmpDepth(), uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
     4022      }
     4023      else
     4024      {
     4025          pcCU->setUseDDD( false, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
     4026      }
    36754027#endif
    36764028
     
    43024654#endif
    43034655
     4656#if H_3D_DBBP
     4657    // test merge mode for DBBP (2Nx2N)
     4658    if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N || pcCU->getDBBPFlag(0) )
     4659#else
    43044660    if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N )
     4661#endif
    43054662    {
    43064663      UInt uiMRGInterDir = 0;     
     
    43724729        pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMRGIndex].m_acDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    43734730#endif
     4731
     4732#if MTK_DDD_G0063
     4733        if( uiMRGIndex == pcCU->getUseDDDCandIdx() )
     4734        {
     4735            assert( vspFlag[uiMRGIndex]     == 0 );
     4736            assert( bSPIVMPFlag[uiMRGIndex] == 0 );
     4737            pcCU->setUseDDD( true, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4738            pcCU->setDDDepthSubParts( pcCU->getDDTmpDepth(), uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4739        }
     4740        else
     4741        {
     4742            pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4743        }
     4744#endif
     4745
    43744746#if H_3D_SPIVMP
    43754747        pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 
     
    43994771        }
    44004772        else
    4401         {
    4402 #endif
     4773#endif
     4774#if NTT_STORE_SPDV_VSP_G0148
     4775#if H_3D_DBBP
     4776        if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) )
     4777#else
     4778        if ( vspFlag[uiMRGIndex] )
     4779#endif
     4780        {
     4781          UInt partAddrTemp;
     4782          Int vspSize;
     4783          Int width, height;
     4784          pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==256
     4785
     4786          if( uiMRGInterDir & 0x01 )
     4787          {
     4788            pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize );
     4789            pcCU->setVSPFlag( partAddrTemp, vspSize );
     4790          }
     4791          else
     4792          {
     4793            pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );
     4794          }
     4795          if( uiMRGInterDir & 0x02 )
     4796          {
     4797            pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize );
     4798            pcCU->setVSPFlag( partAddrTemp, vspSize );
     4799          }
     4800          else
     4801          {
     4802            pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );
     4803          }
     4804          pcCU->setInterDirSubParts  ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4805        }
     4806        else
     4807#endif
     4808        {
    44034809          pcCU->setInterDirSubParts  ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    44044810          {
     
    44064812            pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx );
    44074813          }
    4408 #if H_3D_SPIVMP
    4409         }
    4410 #endif
     4814        }
    44114815
    44124816        pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd    ( cMvZero,            ePartSize, uiPartAddr, 0, iPartIdx );
     
    44224826#if H_3D_SPIVMP       
    44234827        pcCU->setSPIVMPFlagSubParts(0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     4828#endif
     4829
     4830#if MTK_DDD_G0063
     4831        pcCU->setUseDDD( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    44244832#endif
    44254833        // set ME result
     
    44734881  if (!bFilled)
    44744882  {
     4883#if H_3D_DBBP
     4884    DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     4885    if( pcCU->getDBBPFlag(0) )
     4886    {
     4887      AOF( uiPartAddr == 0 );
     4888      AOF( uiPartIdx == 0 );
     4889      AOF( pcCU->getPartitionSize(0) == SIZE_2Nx2N );
     4890      AOF( pDBBPTmpData->eVirtualPartSize != SIZE_NONE );
     4891      AOF( iRoiWidth == iRoiHeight );
     4892     
     4893      // temporary change of partition size for candidate derivation
     4894      pcCU->setPartSizeSubParts( pDBBPTmpData->eVirtualPartSize, 0, pcCU->getDepth(0));
     4895      uiPartIdx = pcCU->getDBBPTmpData()->uiVirtualPartIndex;
     4896     
     4897      // if this is handling the second segment, make sure that motion info of first segment is set to first segment
     4898      if( uiPartIdx == 1 )
     4899      {
     4900        pcCU->setInterDirSubParts(pDBBPTmpData->auhInterDir[0], 0, 0, pcCU->getDepth(0)); // interprets depth relative to LCU level
     4901       
     4902        for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     4903        {
     4904          RefPicList eRefList = (RefPicList)uiRefListIdx;
     4905          pcCU->getCUMvField( eRefList )->setAllMvField( pDBBPTmpData->acMvField[0][eRefList], pDBBPTmpData->eVirtualPartSize, 0, 0, 0 ); // interprets depth relative to rpcTempCU level
     4906        }
     4907      }
     4908     
     4909      // update values to virtual partition size
     4910      pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
     4911    }
     4912#endif
     4913   
    44754914    pcCU->fillMvpCand( uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pcAMVPInfo );
     4915   
     4916#if H_3D_DBBP
     4917    if( pcCU->getDBBPFlag(0) )
     4918    {
     4919      // restore 2Nx2N partitioning for motion estimation
     4920      uiPartIdx = 0;
     4921      AOF( pcCU->getPartitionSize(0) == pDBBPTmpData->eVirtualPartSize );
     4922      pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, pcCU->getDepth(0));
     4923     
     4924      // restore values for 2Nx2N partition size
     4925      pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
     4926      AOF(uiPartAddr==0);
     4927    }
     4928#endif
    44764929  }
    44774930 
     
    52535706    m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
    52545707    m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, true );
     5708#if !SEC_IC_ARP_SIG_G0072
    52555709#if H_3D_IC
    52565710    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
    52575711#endif
     5712#endif
    52585713#if H_3D_ARP
    52595714    m_pcEntropyCoder->encodeARPW( pcCU, 0 );
     5715#endif
     5716#if SEC_IC_ARP_SIG_G0072
     5717#if H_3D_IC
     5718    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
     5719#endif
    52605720#endif
    52615721    uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
     
    55365996
    55375997#if H_3D_INTER_SDC
     5998#if SEC_INTER_SDC_G0101
     5999Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, Int uiOffest, const UInt uiDepth )
     6000#else
    55386001Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, const UInt uiDepth )
     6002#endif
    55396003{
    55406004  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( 0 ) )
     
    55426006    return;
    55436007  }
    5544 
     6008#if QC_SDC_UNIFY_G0130
     6009  pcCU->setSDCFlagSubParts( true, 0, uiDepth );
     6010#else
    55456011  pcCU->setInterSDCFlagSubParts( true, 0, 0, uiDepth );
     6012#endif
    55466013
    55476014  UInt  uiWidth      = pcCU->getWidth ( 0 );
    55486015  UInt  uiHeight     = pcCU->getHeight( 0 );
     6016#if SEC_INTER_SDC_G0101
     6017  UInt uiSegSize = 0;
     6018#else
    55496019  UChar* pMask       = pcCU->getInterSDCMask();
    55506020  memset( pMask, 0, uiWidth*uiHeight );
     
    55536023
    55546024  UInt uiSegSize[4] = { 0, 0, 0, 0 };
     6025#endif
    55556026  Pel *pPred, *pOrg;
    55566027  UInt uiPredStride = pcPred->getStride();
    55576028  UInt uiOrgStride  = pcOrg->getStride();
    55586029  UInt uiPelX, uiPelY;
     6030#if !SEC_INTER_SDC_G0101
    55596031  UInt uiPartitionSize = pcCU->getPartitionSize( 0 );
    55606032  UInt uiSegmentNum = ( uiPartitionSize == SIZE_2Nx2N ) ? 1 : ( uiPartitionSize == SIZE_NxN ? 4 : 2 );
     6033#endif
    55616034
    55626035  pPred = pcPred->getLumaAddr( 0 );
    55636036  pOrg  = pcOrg->getLumaAddr( 0 );
     6037#if SEC_INTER_SDC_G0101
     6038  Int pResDC = 0;
     6039#else
    55646040  Int pResDC[4] = { 0, 0, 0, 0};
     6041#endif
    55656042
    55666043  //calculate dc value for prediction and original signal, and calculate residual and reconstruction
     
    55696046    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
    55706047    {
     6048#if SEC_INTER_SDC_G0101
     6049      pResDC += (Int)( pOrg [uiPelX] - pPred[uiPelX] );
     6050      uiSegSize++;
     6051#else
    55716052      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
    55726053      pResDC[uiSeg] += (Int)( pOrg [uiPelX] - pPred[uiPelX] );
    55736054      uiSegSize[uiSeg]++;
     6055#endif
    55746056    }
    55756057    pOrg  += uiOrgStride;
     
    55776059  }
    55786060
     6061#if SEC_INTER_SDC_G0101
     6062  Int iResiOffset = ( pResDC  > 0 ? ( uiSegSize >> 1 ) : -1*( uiSegSize >> 1 ) );
     6063  pResDC          = ( pResDC + iResiOffset ) / (Int) uiSegSize;
     6064
     6065  pcCU->setSDCSegmentDCOffset( pResDC + uiOffest, 0, 0 );
     6066#else
    55796067  for( UInt uiSeg = 0; uiSeg < uiSegmentNum; uiSeg++ )
    55806068  {
    55816069    Int iResiOffset = ( pResDC [uiSeg] > 0 ? ( uiSegSize[uiSeg] >> 1 ) : -1*( uiSegSize[uiSeg] >> 1 ) );
    55826070    pResDC [uiSeg]  = ( pResDC [uiSeg] + iResiOffset ) / (Int) uiSegSize[uiSeg];
    5583 
     6071#if QC_SDC_UNIFY_G0130
     6072    pcCU->setSDCSegmentDCOffset( pResDC[uiSeg], uiSeg, 0 );
     6073#else
    55846074    pcCU->setInterSDCSegmentDCOffset( pResDC[uiSeg], uiSeg, 0 );
    5585   }
     6075#endif
     6076  }
     6077#endif
    55866078
    55876079  Pel *pRec;
     
    55946086    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
    55956087    {
     6088#if SEC_INTER_SDC_G0101
     6089      pRec[ uiPelX ] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, pPred[uiPelX] + pcCU->getSDCSegmentDCOffset(0, 0) );
     6090#else
    55966091      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
    55976092      assert( uiSeg < uiSegmentNum );
    55986093
    55996094      pRec[ uiPelX ] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, pPred[uiPelX] + pResDC[uiSeg] );
     6095#endif
    56006096    }
    56016097    pPred     += uiPredStride;
     
    56376133#endif
    56386134
     6135#if QC_SDC_UNIFY_G0130
     6136  Bool bNonSkip = false;
     6137#else
    56396138  Bool bNonSkip = true;
     6139#endif
     6140#if SEC_INTER_SDC_G0101
     6141  bNonSkip |= ( pcCU->getSDCSegmentDCOffset( 0, 0 ) != 0 ) ? 1 : 0;
     6142#else
    56406143  for( UInt uiSeg = 0; uiSeg < uiSegmentNum; uiSeg++ )
    56416144  {
     6145#if QC_SDC_UNIFY_G0130
     6146    bNonSkip |= ( pcCU->getSDCSegmentDCOffset( uiSeg, 0 ) != 0 ) ? 1 : 0;
     6147#else
    56426148    bNonSkip &= ( pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 ) != 0 ) ? 1 : 0;
    5643   }
     6149#endif
     6150  }
     6151#endif
    56446152
    56456153  if( !bNonSkip )
     
    68337341    m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
    68347342    m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, true);
     7343#if !SEC_IC_ARP_SIG_G0072
    68357344#if H_3D_IC
    68367345    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
    68377346#endif
     7347#endif
    68387348#if H_3D_ARP
    68397349    m_pcEntropyCoder->encodeARPW( pcCU, 0 );
     7350#endif
     7351#if SEC_IC_ARP_SIG_G0072
     7352#if H_3D_IC
     7353    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
     7354#endif
    68407355#endif
    68417356    ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
     
    68517366    m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
    68527367    m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
     7368#if QC_SDC_UNIFY_G0130
     7369    m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     7370#endif
    68537371    m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
     7372#if !SEC_IC_ARP_SIG_G0072
    68547373#if H_3D_IC
    68557374    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
    68567375#endif
     7376#endif
    68577377#if H_3D_ARP
    68587378    m_pcEntropyCoder->encodeARPW( pcCU , 0 );
    68597379#endif
    6860 #if H_3D_INTER_SDC
     7380#if SEC_IC_ARP_SIG_G0072
     7381#if H_3D_IC
     7382    m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
     7383#endif
     7384#endif
     7385#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    68617386    m_pcEntropyCoder->encodeInterSDCFlag( pcCU, 0, true );
    68627387#endif
  • trunk/source/Lib/TLibEncoder/TEncSearch.h

    r773 r833  
    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
  • trunk/source/Lib/TLibEncoder/TEncSlice.h

    r655 r833  
    107107  UInt                    m_uiSliceIdx;
    108108  std::vector<TEncSbac*> CTXMem;
     109
     110#if MTK_DDD_G0063
     111  Int          m_iDDDScale;
     112  Int          m_iDDDOffset;
     113  UInt         m_uiDDDPrecision;
     114#endif
    109115public:
    110116  TEncSlice();
     
    147153  Void      setCtxMem( TEncSbac* sb, Int b )   { CTXMem[b] = sb; }
    148154
     155#if MTK_DDD_G0063
     156  Void setDDDPar( Int iScale, Int iOffset, UInt uiPrecision ){ m_iDDDScale = iScale; m_iDDDOffset = iOffset; m_uiDDDPrecision = uiPrecision; }
     157#endif
     158
    149159private:
    150160  Double  xGetQPValueAccordingToLambda ( Double lambda );
Note: See TracChangeset for help on using the changeset viewer.