Changeset 1219 in 3DVCSoftware for branches/HTM-14.1-update-dev1-RWTH/source/Lib


Ignore:
Timestamp:
20 May 2015, 20:08:27 (10 years ago)
Author:
rwth
Message:
  • updated Xcode project
  • migrated transmission of DLT (including minor fixes)
Location:
branches/HTM-14.1-update-dev1-RWTH/source/Lib
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComPrediction.cpp

    r1209 r1219  
    557557  Pel deltaDC1 = pcCU->getDmmDeltaDC( dmmType, 0, uiAbsPartIdx );
    558558  Pel deltaDC2 = pcCU->getDmmDeltaDC( dmmType, 1, uiAbsPartIdx );
    559 #if H_3D_DIM_DLT
     559#if NH_3D_DLT
    560560  segDC1 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ) + deltaDC1 );
    561561  segDC2 = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ) + deltaDC2 );
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComRom.h

    r1209 r1219  
    111111__inline Void mapDmmToIntraDir( UInt& intraMode ) { if( isDmmMode( intraMode ) ) intraMode = DC_IDX; }
    112112__inline Void mapDmmToIntraDir(  Int& intraMode ) { if( isDmmMode( intraMode ) ) intraMode = DC_IDX; }
    113 #endif
    114 #if H_3D_DIM_SDC || H_3D_DIM_DLT
    115 __inline UInt numBitsForValue( UInt value ) { UInt bits = 0; while (value != 0) { value >>= 1; bits++; } return bits; };
    116113#endif
    117114// ====================================================================================================================
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComSlice.cpp

    r1200 r1219  
    28272827, m_ppsScalingListRefLayerId         (0)
    28282828, m_pocResetInfoPresentFlag          (false)
    2829 #if H_3D
    2830 , m_pcDLT(NULL)
    2831 #endif
    28322829#endif
    28332830
     
    28462843}
    28472844
    2848 #if H_3D
     2845#if NH_3D_DLT
    28492846TComDLT::TComDLT()
    28502847: m_bDltPresentFlag(false)
     
    28522849, m_uiDepthViewBitDepth(8)
    28532850{
    2854   m_uiDepthViewBitDepth = g_bitDepthY;
    2855 
    28562851  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
    28572852  {
     
    28612856    // allocate some memory and initialize with default mapping
    28622857    m_iNumDepthmapValues[i] = ((1 << m_uiDepthViewBitDepth)-1)+1;
    2863     m_iDepthValue2Idx[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
    2864     m_iIdx2DepthValue[i]    = (Int*) xMalloc(Int, m_iNumDepthmapValues[i]);
     2858    m_iDepthValue2Idx[i]    = std::vector<Int>(m_iNumDepthmapValues[i]);
     2859    m_iIdx2DepthValue[i]    = std::vector<Int>(m_iNumDepthmapValues[i]);
    28652860
    28662861    //default mapping
     
    28752870TComDLT::~TComDLT()
    28762871{
    2877   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
    2878   {
    2879     if ( m_iDepthValue2Idx[i] != NULL )
    2880     {
    2881       xFree( m_iDepthValue2Idx[i] );
    2882       m_iDepthValue2Idx[i] = NULL;
    2883     }
    2884 
    2885     if ( m_iIdx2DepthValue[i] != NULL )
    2886     {
    2887       xFree( m_iIdx2DepthValue[i] );
    2888       m_iIdx2DepthValue[i] = NULL;
    2889     }
    2890   }
    2891 }
    2892 
    2893 Void TComDLT::setDepthLUTs(Int layerIdInVps, Int* idxToDepthValueTable, Int iNumDepthValues)
    2894 {
    2895   if( idxToDepthValueTable == NULL || iNumDepthValues == 0 ) // default mapping only
     2872 
     2873}
     2874
     2875Void TComDLT::setDepthLUTs(Int layerIdInVps, std::vector<Int> idxToDepthValueTable, Int iNumDepthValues)
     2876{
     2877  if( iNumDepthValues == 0 ) // default mapping only
    28962878    return;
    28972879
    28982880  // copy idx2DepthValue to internal array
    2899   memcpy(m_iIdx2DepthValue[layerIdInVps], idxToDepthValueTable, iNumDepthValues*sizeof(UInt));
    2900 
    2901   UInt uiMaxDepthValue = ((1 << g_bitDepthY)-1);
     2881  m_iIdx2DepthValue[layerIdInVps] = idxToDepthValueTable;
     2882
     2883  UInt uiMaxDepthValue = ((1 << m_uiDepthViewBitDepth)-1);
    29022884  for(Int p=0; p<=uiMaxDepthValue; p++)
    29032885  {
     
    29362918}
    29372919
    2938 Void TComDLT::getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum )
     2920Void TComDLT::getDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int>& riDeltaDLTOut, UInt&ruiDeltaDLTOutNum ) const
    29392921{
    29402922  Bool abBM0[ 256 ];
     
    29552937  }
    29562938 
    2957   *puiDeltaDLTOutNum = 0;
     2939  ruiDeltaDLTOutNum = 0;
    29582940  for( Int i = 0; i < 256; i++ )
    29592941  {
    29602942    if( abBM0[ i ] ^ abBM1[ i ] )
    29612943    {
    2962       piDeltaDLTOut[ *puiDeltaDLTOutNum ] = i;
    2963       *puiDeltaDLTOutNum = *puiDeltaDLTOutNum + 1;
    2964     }
    2965   }
    2966 }
    2967 
    2968 Void TComDLT::setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum )
     2944      riDeltaDLTOut[ ruiDeltaDLTOutNum++ ] = i;
     2945    }
     2946  }
     2947}
     2948
     2949Void TComDLT::setDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int> piDeltaDLTIn, UInt uiDeltaDLTInNum )
    29692950{
    29702951  Bool abBM0[ 256 ];
     
    29852966  }
    29862967 
    2987   Int aiIdx2DepthValue[256];
     2968  std::vector<Int> aiIdx2DepthValue(256, 0);
    29882969  UInt uiNumDepthValues = 0;
    2989   memset( aiIdx2DepthValue, 0, sizeof( aiIdx2DepthValue ));
     2970  std::fill(aiIdx2DepthValue.begin(), aiIdx2DepthValue.end(), 0);
    29902971 
    29912972  for( Int i = 0; i < 256; i++ )
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TComSlice.h

    r1209 r1219  
    13571357};
    13581358
    1359 #if H_3D
     1359#if NH_3D_DLT
    13601360class TComDLT
    13611361{
    13621362private:
    1363   Bool        m_bDltPresentFlag;
    1364   Bool        m_bUseDLTFlag              [ MAX_NUM_LAYERS ];
    1365   Bool        m_bInterViewDltPredEnableFlag[ MAX_NUM_LAYERS ];
    1366 
    1367   Int         m_iNumDepthmapValues       [ MAX_NUM_LAYERS ];
    1368   Int*        m_iDepthValue2Idx          [ MAX_NUM_LAYERS ];
    1369   Int*        m_iIdx2DepthValue          [ MAX_NUM_LAYERS ];
    1370 
    1371   Int         m_iNumDepthViews;
    1372   UInt        m_uiDepthViewBitDepth;
     1363  Bool              m_bDltPresentFlag;
     1364  Bool              m_bUseDLTFlag                 [ MAX_NUM_LAYERS ];
     1365  Bool              m_bInterViewDltPredEnableFlag [ MAX_NUM_LAYERS ];
     1366  Bool              m_bDltBitMapRepFlag           [ MAX_NUM_LAYERS ];
     1367
     1368  Int               m_iNumDepthmapValues          [ MAX_NUM_LAYERS ];
     1369  std::vector<Int>  m_iDepthValue2Idx [ MAX_NUM_LAYERS ];
     1370  std::vector<Int>  m_iIdx2DepthValue [ MAX_NUM_LAYERS ];
     1371
     1372  Int               m_iNumDepthViews;
     1373  UInt              m_uiDepthViewBitDepth;
     1374 
     1375  // mapping
     1376  Int     m_iDepthIdxToLayerId          [ MAX_NUM_LAYERS ];
     1377 
     1378  // these are only needed at the encoder to decide on coding
    13731379
    13741380public:
    13751381  TComDLT();
    1376   ~TComDLT();
    1377 
    1378   Bool    getDltPresentFlag  ()                           { return m_bDltPresentFlag; }
     1382  ~TComDLT();
     1383 
     1384  Int     getDepthIdxToLayerId(Int depthIdx) const        { return m_iDepthIdxToLayerId[depthIdx]; }
     1385  Void    setDepthIdxToLayerId(Int depthIdx, Int layerId) { m_iDepthIdxToLayerId[depthIdx] = layerId; }
     1386
     1387  Bool    getDltPresentFlag  ()                           const   { return m_bDltPresentFlag; }
    13791388  Void    setDltPresentFlag  ( Bool b )                   { m_bDltPresentFlag = b;    }
    13801389
    1381   Bool    getUseDLTFlag      ( Int layerIdInVps )         { return m_bUseDLTFlag[ layerIdInVps ]; }
     1390  Bool    getUseDLTFlag      ( Int layerIdInVps )         const   { return m_bUseDLTFlag[ layerIdInVps ]; }
    13821391  Void    setUseDLTFlag      ( Int layerIdInVps, Bool b ) { m_bUseDLTFlag[ layerIdInVps ]  = b;   }
    13831392 
    1384   Bool    getInterViewDltPredEnableFlag( Int layerIdInVps )         { return m_bInterViewDltPredEnableFlag[ layerIdInVps ]; }
     1393  Bool    getInterViewDltPredEnableFlag( Int layerIdInVps )         const   { return m_bInterViewDltPredEnableFlag[ layerIdInVps ]; }
    13851394  Void    setInterViewDltPredEnableFlag( Int layerIdInVps, Bool b ) { m_bInterViewDltPredEnableFlag[ layerIdInVps ] = b;    }
     1395 
     1396  Bool    getUseBitmapRep      ( Int layerIdInVps )         const   { return m_bDltBitMapRepFlag[ layerIdInVps ]; }
     1397  Void    setUseBitmapRep      ( Int layerIdInVps, Bool b ) { m_bDltBitMapRepFlag[ layerIdInVps ]  = b;   }
    13861398
    13871399  Void    setNumDepthViews   ( Int n )                    { m_iNumDepthViews = n; }
    1388   Int     getNumDepthViews   ()                           { return m_iNumDepthViews; }
     1400  Int     getNumDepthViews   ()                           const   { return m_iNumDepthViews; }
    13891401
    13901402  Void    setDepthViewBitDepth( UInt n )                  { m_uiDepthViewBitDepth = n; }
    1391   UInt    getDepthViewBitDepth()                          { return m_uiDepthViewBitDepth; }
    1392 
    1393   Int     getNumDepthValues( Int layerIdInVps )           { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:((1 << g_bitDepthY)-1); }
    1394   Int     depthValue2idx( Int layerIdInVps, Pel value )   { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }
    1395   Pel     idx2DepthValue( Int layerIdInVps, UInt uiIdx )  { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][ClipY(uiIdx)]:uiIdx; }
    1396   Void    setDepthLUTs( Int layerIdInVps, Int* idx2DepthValue = NULL, Int iNumDepthValues = 0 );
    1397   Int*    idx2DepthValue( Int layerIdInVps )  { return m_iIdx2DepthValue[layerIdInVps]; }
    1398   Void    getDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTOut, UInt *puiDeltaDLTOutNum );
    1399   Void    setDeltaDLT( Int layerIdInVps, Int* piDLTInRef, UInt uiDLTInRefNum, Int* piDeltaDLTIn, UInt uiDeltaDLTInNum );
     1403  UInt    getDepthViewBitDepth()                          const   { return m_uiDepthViewBitDepth; }
     1404
     1405  Int     getNumDepthValues( Int layerIdInVps )           const   { return getUseDLTFlag(layerIdInVps)?m_iNumDepthmapValues[layerIdInVps]:(1 << m_uiDepthViewBitDepth); }
     1406  Int     depthValue2idx( Int layerIdInVps, Pel value )   const   { return getUseDLTFlag(layerIdInVps)?m_iDepthValue2Idx[layerIdInVps][value]:value; }
     1407  Pel     idx2DepthValue( Int layerIdInVps, UInt uiIdx )  const   { return getUseDLTFlag(layerIdInVps)?m_iIdx2DepthValue[layerIdInVps][ClipBD(uiIdx,m_uiDepthViewBitDepth)]:uiIdx; }
     1408  Void    setDepthLUTs( Int layerIdInVps, std::vector<Int> idx2DepthValue, Int iNumDepthValues = 0 );
     1409  std::vector<Int>    idx2DepthValue( Int layerIdInVps )  const   { return m_iIdx2DepthValue[layerIdInVps]; }
     1410  Void    getDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int>& riDeltaDLTOut, UInt& ruiDeltaDLTOutNum ) const;
     1411  Void    setDeltaDLT( Int layerIdInVps, std::vector<Int> piDLTInRef, UInt uiDLTInRefNum, std::vector<Int> piDeltaDLTIn, UInt uiDeltaDLTInNum );
    14001412};
    14011413#endif
     
    22562268#endif
    22572269
    2258 #if H_3D
    2259   TComDLT*         m_pcDLT;
     2270#if NH_3D_DLT
     2271  TComDLT                m_cDLT;
    22602272#endif
    22612273
     
    22812293  UInt                   getMaxCuDQPDepth() const                                         { return m_uiMaxCuDQPDepth;                     }
    22822294
    2283 #if H_3D
    2284   Void                   setDLT( TComDLT* pcDLT )                                         { m_pcDLT = pcDLT;                             }
    2285   TComDLT*               getDLT()                                                         { return m_pcDLT;                              }
     2295#if NH_3D_DLT
     2296  Void                   setDLT( TComDLT cDLT )                                           { m_cDLT = cDLT;                                }
     2297  const TComDLT*         getDLT() const                                                   { return &m_cDLT;                               }
     2298  TComDLT*               getDLT()                                                         { return &m_cDLT;                               }
    22862299#endif
    22872300
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibCommon/TypeDef.h

    r1209 r1219  
    7171#define NH_3D_DMM                         1   // Depth modeling modes
    7272#define NH_3D_SDC                         1   // Segment-wise DC coding for intra and inter
     73#define NH_3D_DLT                         1   // Depth Lookup Table
    7374#define NH_3D_ENC_DEPTH                   1   // Encoder optimizations for depth, incl.
    7475                                              // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1209 r1219  
    496496Void TDecCavlc::parsePps3dExtension( TComPPS* pcPPS )
    497497{
    498 #if H_3D
     498#if NH_3D_DLT
    499499  UInt uiCode = 0;
    500500  //
    501   TComDLT* pcDLT = new TComDLT;
     501  TComDLT* pcDLT = pcPPS->getDLT();
    502502  //Ed.(GT): PPSs are copied in HM16.4. This would cause that the only the DLT pointer is copied. Therefore, a deep copy of the DLT needs to be implemented. Another option would be to use a vectors for the DLT arrays in TComDLT.
    503503
     
    508508  {
    509509    READ_CODE(6, uiCode, "pps_depth_layers_minus1");
    510     pcDLT->setNumDepthViews( uiCode );
    511 
     510    pcDLT->setNumDepthViews( uiCode+1 );
     511   
    512512    READ_CODE(4, uiCode, "pps_bit_depth_for_depth_views_minus8");
    513513    pcDLT->setDepthViewBitDepth( (uiCode+8) );
    514 
    515     //Ed.(GT): Please remove parsing dependency from VPS here !
    516     for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
    517     {
    518       if ( i != 0 )
    519       {
    520         if( pcVPS->getDepthId( i ) == 1 )
    521         {
    522           READ_FLAG(uiCode, "dlt_flag[i]");
    523           pcDLT->setUseDLTFlag(i, (uiCode == 1) ? true : false);
    524 
    525           if ( pcDLT->getUseDLTFlag( i ) )
     514   
     515    for( Int i = 0; i <= pcDLT->getNumDepthViews(); i++ )
     516    {
     517      Int layerId = pcDLT->getDepthIdxToLayerId(i);
     518     
     519      READ_FLAG(uiCode, "dlt_flag[i]");
     520      pcDLT->setUseDLTFlag(layerId, (uiCode == 1) ? true : false);
     521     
     522      if ( pcDLT->getUseDLTFlag( layerId ) )
     523      {
     524        Bool bDltBitMapRepFlag    = false;
     525        UInt uiMaxDiff            = INT_MAX;
     526        UInt uiMinDiff            = 0;
     527        UInt uiCodeLength         = 0;
     528       
     529        READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]");
     530       
     531        if( uiCode )
     532        {
     533          assert( pcDLT->getUseDLTFlag( 1 ));
     534        }
     535        pcDLT->setInterViewDltPredEnableFlag( layerId, (uiCode == 1) ? true : false );
     536       
     537        if ( pcDLT->getInterViewDltPredEnableFlag( layerId ) == false )
     538        {
     539          READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]");
     540          bDltBitMapRepFlag = (uiCode == 1) ? true : false;
     541        }
     542        else
     543        {
     544          bDltBitMapRepFlag = false;
     545        }
     546       
     547        UInt uiNumDepthValues = 0;
     548        std::vector<Int> aiIdx2DepthValue(256);
     549       
     550        // Bit map
     551        if ( bDltBitMapRepFlag )
     552        {
     553          for (UInt d=0; d<256; d++)
    526554          {
    527             Bool bDltBitMapRepFlag    = false;
    528             UInt uiMaxDiff            = 0xffffffff;
    529             UInt uiMinDiff            = 0;
    530             UInt uiCodeLength         = 0;
    531 
    532             READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]");
    533 
    534             if( uiCode )
     555            READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]");
     556            if (uiCode == 1)
    535557            {
    536                 assert( pcDLT->getUseDLTFlag( 1 ));
     558              aiIdx2DepthValue[uiNumDepthValues] = d;
     559              uiNumDepthValues++;
    537560            }
    538             pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false );
    539 
    540             if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )
     561          }
     562        }
     563        // Diff Coding
     564        else
     565        {
     566          READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]");   // num_entry
     567         
     568          {
     569            // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.
     570           
     571            if (uiNumDepthValues > 1)
    541572            {
    542               READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]");
    543               bDltBitMapRepFlag = (uiCode == 1) ? true : false;
     573              READ_CODE(8, uiCode, "max_diff[ layerId ]");
     574              uiMaxDiff = uiCode;
    544575            }
    545576            else
    546577            {
    547               bDltBitMapRepFlag = false;
     578              uiMaxDiff = 0;           // when there is only one value in DLT
    548579            }
    549580           
    550             UInt uiNumDepthValues = 0;
    551             Int  aiIdx2DepthValue[256];
    552 
    553             // Bit map
    554             if ( bDltBitMapRepFlag )
     581            if (uiNumDepthValues > 2)
    555582            {
    556               for (UInt d=0; d<256; d++)
     583              uiCodeLength = (UInt) gCeilLog2(uiMaxDiff + 1);
     584              READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]");
     585              uiMinDiff = uiCode + 1;
     586            }
     587            else
     588            {
     589              uiMinDiff = uiMaxDiff;   // when there are only one or two values in DLT
     590            }
     591           
     592            READ_CODE(8, uiCode, "dlt_depth_value0[layerId]");   // entry0
     593            aiIdx2DepthValue[0] = uiCode;
     594           
     595            if (uiMaxDiff == uiMinDiff)
     596            {
     597              for (UInt d=1; d<uiNumDepthValues; d++)
    557598              {
    558                 READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]");
    559                 if (uiCode == 1)
    560                 {
    561                   aiIdx2DepthValue[uiNumDepthValues] = d;
    562                   uiNumDepthValues++;
    563                 }
     599                aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0;
    564600              }
    565601            }
    566             // Diff Coding
    567602            else
    568603            {
    569               READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]");   // num_entry
    570 
     604              uiCodeLength = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);
     605              for (UInt d=1; d<uiNumDepthValues; d++)
    571606              {
    572                 // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.
    573 
    574                 if (uiNumDepthValues > 1)
    575                 {
    576                   READ_CODE(8, uiCode, "max_diff[ layerId ]");
    577                   uiMaxDiff = uiCode;
    578                 }
    579                 else
    580                 {
    581                   uiMaxDiff = 0;           // when there is only one value in DLT
    582                 }
    583 
    584                 if (uiNumDepthValues > 2)
    585                 {
    586                   uiCodeLength = (UInt) ceil(Log2(uiMaxDiff + 1));
    587                   READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]");
    588                   uiMinDiff = uiCode + 1;
    589                 }
    590                 else
    591                 {
    592                   uiMinDiff = uiMaxDiff;   // when there are only one or two values in DLT
    593                 }
    594 
    595                 READ_CODE(8, uiCode, "dlt_depth_value0[layerId]");   // entry0
    596                 aiIdx2DepthValue[0] = uiCode;
    597 
    598                 if (uiMaxDiff == uiMinDiff)
    599                 {
    600                   for (UInt d=1; d<uiNumDepthValues; d++)
    601                   {
    602                     aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0;
    603                   }
    604                 }
    605                 else
    606                 {
    607                   uiCodeLength = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1));
    608                   for (UInt d=1; d<uiNumDepthValues; d++)
    609                   {
    610                     READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");
    611                     aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode;
    612                   }
    613                 }
    614 
     607                READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");
     608                aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode;
    615609              }
    616610            }
    617611           
    618             if( pcDLT->getInterViewDltPredEnableFlag( i ) )
    619             {
    620               // interpret decoded values as delta DLT
    621               AOF( pcVPS->getDepthId( 1 ) == 1 );
    622               AOF( i > 1 );
    623               // assumes ref layer id to be 1
    624               Int* piRefDLT = pcDLT->idx2DepthValue( 1 );
    625               UInt uiRefNum = pcDLT->getNumDepthValues( 1 );
    626               pcDLT->setDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues);
    627             }
    628             else
    629             {
    630               // store final DLT
    631               pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
    632             }
    633 
    634612          }
    635613        }
    636       }
    637     }
    638   }
    639 
    640   pcPPS->setDLT( pcDLT );
     614       
     615        if( pcDLT->getInterViewDltPredEnableFlag( layerId ) )
     616        {
     617          // interpret decoded values as delta DLT
     618          AOF( layerId > 1 );
     619          // assumes ref layer id to be 1
     620          std::vector<Int> viRefDLT = pcDLT->idx2DepthValue( 1 );
     621          UInt uiRefNum = pcDLT->getNumDepthValues( 1 );
     622          pcDLT->setDeltaDLT(layerId, viRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues);
     623        }
     624        else
     625        {
     626          // store final DLT
     627          pcDLT->setDepthLUTs(layerId, aiIdx2DepthValue, uiNumDepthValues);
     628        }
     629       
     630#ifdef DEBUG
     631        printf("---------------------------------------------\n");
     632        printf("LayerId: %d\n", layerId);
     633        printf("getUseDLTFlag: %d\n", pcDLT->getUseDLTFlag(layerId));
     634        printf("getInterViewDltPredEnableFlag: %d\n", pcDLT->getInterViewDltPredEnableFlag(layerId));
     635        printf("getUseBitmapRep: %d\n", pcDLT->getUseBitmapRep(layerId));
     636        printf("getNumDepthValues: %d\n", pcDLT->getNumDepthValues(layerId));
     637        for(Int i=0; i<pcDLT->getNumDepthValues(layerId); i++)
     638          printf("depthValue[%d] = %d\n", i, pcDLT->idx2DepthValue(layerId, i));
     639#endif
     640      }
     641    }
     642  }
    641643#endif
    642644}
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecCu.cpp

    r1209 r1219  
    14611461  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
    14621462  {
    1463 #if H_3D_DIM_DLT
     1463#if NH_3D_DLT
    14641464    Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
    14651465    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibDecoder/TDecTop.cpp

    r1200 r1219  
    13231323  // GT: Please don't add parsing dependency of SPS from VPS here again!!!
    13241324#endif
     1325#if NH_3D_DLT
     1326  // create mapping from depth layer indexes to layer ids
     1327  Int j=0;
     1328  for( Int i=0; i<=m_parameterSetManager.getFirstVPS()->getMaxLayersMinus1(); i++ )
     1329  {
     1330    Int layerId = m_parameterSetManager.getFirstVPS()->getLayerIdInNuh(i);
     1331    if( m_parameterSetManager.getFirstVPS()->getDepthId(layerId) )
     1332      pps->getDLT()->setDepthIdxToLayerId(j++, i);
     1333  }
     1334#endif
    13251335  m_cEntropyDecoder.decodePPS( pps );
    13261336
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1209 r1219  
    384384  // GT: Please add a function e.g. xSetDLT in e.g. TEncSlice to find the best DLT syntax representation and do ONLY the coding of the DLT here !!
    385385
    386 #if H_3D
    387   WRITE_FLAG( pcDLT->getDltPresentFlag() ? 1 : 0, "dlt_present_flag" );
    388 
    389   if ( pcDLT->getDltPresentFlag() )
    390   {
    391     WRITE_CODE(pcDLT->getNumDepthViews(), 6, "pps_depth_layers_minus1");
    392     WRITE_CODE((pcDLT->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_views_minus8");
    393 
    394     for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
    395     {
    396       if ( i != 0 )
    397       {
    398         if ( pcVPS->getDepthId( i ) == 1 )
    399         {
    400           WRITE_FLAG( pcDLT->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" );
    401 
    402           if ( pcDLT->getUseDLTFlag( i ) )
     386#if NH_3D_DLT
     387  WRITE_FLAG( pcPPS->getDLT()->getDltPresentFlag() ? 1 : 0, "dlt_present_flag" );
     388
     389  if ( pcPPS->getDLT()->getDltPresentFlag() )
     390  {
     391    WRITE_CODE(pcPPS->getDLT()->getNumDepthViews() - 1, 6, "pps_depth_layers_minus1");
     392    WRITE_CODE((pcPPS->getDLT()->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_views_minus8");
     393   
     394    for( Int i = 0; i <= pcPPS->getDLT()->getNumDepthViews(); i++ )
     395    {
     396      Int layerId = pcPPS->getDLT()->getDepthIdxToLayerId(i);
     397     
     398      WRITE_FLAG( pcPPS->getDLT()->getUseDLTFlag( layerId ) ? 1 : 0, "dlt_flag[layerId]" );
     399     
     400      if ( pcPPS->getDLT()->getUseDLTFlag( layerId ) )
     401      {
     402        std::vector<Int> aiIdx2DepthValue_coded(256, 0);
     403        UInt uiNumDepthValues_coded = pcPPS->getDLT()->getNumDepthValues(layerId);
     404       
     405        // ----------------------------- Actual coding -----------------------------
     406        WRITE_FLAG( pcPPS->getDLT()->getInterViewDltPredEnableFlag( layerId ) ? 1 : 0, "inter_view_dlt_pred_enable_flag[ layerId ]");
     407        if ( pcPPS->getDLT()->getInterViewDltPredEnableFlag( layerId ) == false )
     408        {
     409          WRITE_FLAG( pcPPS->getDLT()->getUseBitmapRep( layerId ) ? 1 : 0, "dlt_bit_map_rep_flag[ layerId ]" );
     410         
     411          for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )
    403412          {
    404             WRITE_FLAG( pcDLT->getInterViewDltPredEnableFlag( i ) ? 1 : 0, "inter_view_dlt_pred_enable_flag[ i ]");
    405 
    406             // ----------------------------- determine whether to use bit-map -----------------------------
    407             Bool bDltBitMapRepFlag       = false;
    408             UInt uiNumBitsNonBitMap      = 0;
    409             UInt uiNumBitsBitMap         = 0;
    410 
    411             UInt uiMaxDiff               = 0;
    412             UInt uiMinDiff               = 0xffffffff;
    413             UInt uiLengthMinDiff         = 0;
    414             UInt uiLengthDltDiffMinusMin = 0;
    415 
    416             UInt* puiDltDiffValues       = NULL;
    417            
    418             Int aiIdx2DepthValue_coded[256];
    419             UInt uiNumDepthValues_coded = 0;
    420            
    421             uiNumDepthValues_coded = pcDLT->getNumDepthValues(i);
    422             for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )
     413            aiIdx2DepthValue_coded[ui] = pcPPS->getDLT()->idx2DepthValue(layerId, ui);
     414          }
     415        }
     416        else
     417        {
     418          AOF( layerId > 1 );
     419          // assumes ref layer id to be 1
     420          std::vector<Int> viRefDLT = pcPPS->getDLT()->idx2DepthValue( 1 );
     421          UInt uiRefNum = pcPPS->getDLT()->getNumDepthValues( 1 );
     422          pcPPS->getDLT()->getDeltaDLT(layerId, viRefDLT, uiRefNum, aiIdx2DepthValue_coded, uiNumDepthValues_coded);
     423        }
     424       
     425        // bit map coding
     426        if ( pcPPS->getDLT()->getUseBitmapRep( layerId ) )
     427        {
     428          UInt uiDltArrayIndex = 0;
     429          for (UInt d=0; d < 256; d++)
     430          {
     431            if ( d == aiIdx2DepthValue_coded[uiDltArrayIndex] )
    423432            {
    424               aiIdx2DepthValue_coded[ui] = pcDLT->idx2DepthValue(i, ui);
    425             }
    426            
    427             if( pcDLT->getInterViewDltPredEnableFlag( i ) )
    428             {
    429               AOF( pcVPS->getDepthId( 1 ) == 1 );
    430               AOF( i > 1 );
    431               // assumes ref layer id to be 1
    432               Int* piRefDLT = pcDLT->idx2DepthValue( 1 );
    433               UInt uiRefNum = pcDLT->getNumDepthValues( 1 );
    434               pcDLT->getDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, &uiNumDepthValues_coded);
    435             }
    436 
    437             if ( NULL == (puiDltDiffValues = (UInt *)calloc(uiNumDepthValues_coded, sizeof(UInt))) )
    438             {
    439               // This should be changed to an assertion.
    440               exit(-1);
    441             }
    442 
    443             for (UInt d = 1; d < uiNumDepthValues_coded; d++)
    444             {
    445               puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];
    446 
    447               if ( uiMaxDiff < puiDltDiffValues[d] )
    448               {
    449                 uiMaxDiff = puiDltDiffValues[d];
    450               }
    451 
    452               if ( uiMinDiff > puiDltDiffValues[d] )
    453               {
    454                 uiMinDiff = puiDltDiffValues[d];
    455               }
    456             }
    457 
    458             // counting bits
    459             // diff coding branch
    460             uiNumBitsNonBitMap += 8;                          // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])
    461 
    462             if ( uiNumDepthValues_coded > 1 )
    463             {
    464               uiNumBitsNonBitMap += 8;                        // u(v) bits for max_diff[ layerId ]
    465             }
    466 
    467             if ( uiNumDepthValues_coded > 2 )
    468             {
    469               uiLengthMinDiff    = (UInt) ceil(Log2(uiMaxDiff + 1));
    470               uiNumBitsNonBitMap += uiLengthMinDiff;          // u(v)  bits for min_diff[ layerId ]
    471             }
    472 
    473             uiNumBitsNonBitMap += 8;                          // u(v) bits for dlt_depth_value0[ layerId ]
    474 
    475             if (uiMaxDiff > uiMinDiff)
    476             {
    477               uiLengthDltDiffMinusMin = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1));
    478               uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1);  // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]
    479             }
    480 
    481             // bit map branch
    482             uiNumBitsBitMap = 256;   // uiNumBitsBitMap = 1 << pcDLT->getDepthViewBitDepth();
    483 
    484             // determine bDltBitMapFlag
    485             bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;
    486 
    487             // ----------------------------- Actual coding -----------------------------
    488             if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )
    489             {
    490               WRITE_FLAG( bDltBitMapRepFlag ? 1 : 0, "dlt_bit_map_rep_flag[ layerId ]" );
     433              WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]");
     434              uiDltArrayIndex++;
    491435            }
    492436            else
    493437            {
    494               bDltBitMapRepFlag = false;
     438              WRITE_FLAG(0, "dlt_bit_map_flag[ layerId ][ j ]");
    495439            }
    496 
    497             // bit map coding
    498             if ( bDltBitMapRepFlag )
     440          }
     441        }
     442        // Diff Coding
     443        else
     444        {
     445          UInt uiMaxDiff               = 0;
     446          UInt uiMinDiff               = INT_MAX;
     447          UInt uiLengthMinDiff         = 0;
     448          UInt uiLengthDltDiffMinusMin = 0;
     449         
     450          std::vector<UInt> puiDltDiffValues(uiNumDepthValues_coded, 0);
     451         
     452          for (UInt d = 1; d < uiNumDepthValues_coded; d++)
     453          {
     454            puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];
     455           
     456            if ( uiMaxDiff < puiDltDiffValues[d] )
    499457            {
    500               UInt uiDltArrayIndex = 0;
    501               for (UInt d=0; d < 256; d++)
     458              uiMaxDiff = puiDltDiffValues[d];
     459            }
     460           
     461            if ( uiMinDiff > puiDltDiffValues[d] )
     462            {
     463              uiMinDiff = puiDltDiffValues[d];
     464            }
     465          }
     466         
     467          if ( uiNumDepthValues_coded > 2 )
     468          {
     469            uiLengthMinDiff    = (UInt) gCeilLog2(uiMaxDiff + 1);
     470          }
     471          if (uiMaxDiff > uiMinDiff)
     472          {
     473            uiLengthDltDiffMinusMin = (UInt) gCeilLog2(uiMaxDiff - uiMinDiff + 1);
     474          }
     475         
     476          WRITE_CODE(uiNumDepthValues_coded, 8, "num_depth_values_in_dlt[layerId]");    // num_entry
     477          {
     478            // The condition if( uiNumDepthValues_coded > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.
     479            if ( uiNumDepthValues_coded > 1 )
     480            {
     481              WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]");        // max_diff
     482            }
     483           
     484            if ( uiNumDepthValues_coded > 2 )
     485            {
     486              WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]");     // min_diff_minus1
     487            }
     488           
     489            WRITE_CODE(aiIdx2DepthValue_coded[0], 8, "dlt_depth_value0[layerId]");          // entry0
     490           
     491            if (uiMaxDiff > uiMinDiff)
     492            {
     493              for (UInt d=1; d < uiNumDepthValues_coded; d++)
    502494              {
    503                 if ( d == aiIdx2DepthValue_coded[uiDltArrayIndex] )
    504                 {                 
    505                   WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]");
    506                   uiDltArrayIndex++;
    507                 }
    508                 else
    509                 {
    510                   WRITE_FLAG(0, "dlt_bit_map_flag[ layerId ][ j ]");
    511                 }
     495                WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");    // entry_value_diff_minus_min[ k ]
    512496              }
    513497            }
    514             // Diff Coding
    515             else
    516             {
    517               WRITE_CODE(uiNumDepthValues_coded, 8, "num_depth_values_in_dlt[i]");    // num_entry
    518               {
    519                 // The condition if( uiNumDepthValues_coded > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component.
    520                 if ( uiNumDepthValues_coded > 1 )
    521                 {
    522                   WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]");        // max_diff
    523                 }
    524 
    525                 if ( uiNumDepthValues_coded > 2 )
    526                 {
    527                   WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]");     // min_diff_minus1
    528                 }
    529 
    530                 WRITE_CODE(aiIdx2DepthValue_coded[0], 8, "dlt_depth_value0[layerId]");          // entry0
    531 
    532                 if (uiMaxDiff > uiMinDiff)
    533                 {
    534                   for (UInt d=1; d < uiNumDepthValues_coded; d++)
    535                   {
    536                     WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");    // entry_value_diff_minus_min[ k ]
    537                   }
    538                 }
    539               }
    540             }
    541 
    542             free(puiDltDiffValues);
    543498          }
     499         
    544500        }
    545501      }
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncCfg.h

    r1200 r1219  
    383383#endif
    384384
    385 #if H_3D
    386   TComDLT*  m_cDLT;
     385#if NH_3D_DLT
     386  TComDLT   m_cDLT;
    387387#endif
    388388  Bool      m_recalculateQPAccordingToLambda;                 ///< recalculate QP value according to the lambda value
     
    10111011#endif
    10121012
    1013 #if H_3D
    1014   Void         setDLT( TComDLT *p )                                  s{ m_cDLT = p; }
    1015   TComDLT*     getDLT()                                              s{ return m_cDLT; }
     1013#if NH_3D_DLT
     1014  Void         setDLT( TComDLT p )                                   { m_cDLT = p; }
     1015  TComDLT*     getDLT()                                              { return &m_cDLT; }
    10161016#endif
    10171017  Void         setUseRecalculateQPAccordingToLambda (Bool b)         { m_recalculateQPAccordingToLambda = b;    }
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncSearch.cpp

    r1209 r1219  
    22662266    Pel pDCRec = ( !bZeroResidual ) ? apDCOrigValues[uiSegment] : apDCPredValues[uiSegment];
    22672267    // get residual (idx)
    2268 #if H_3D_DIM_DLT
     2268#if NH_3D_DLT
    22692269    Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
    22702270#else
     
    22882288  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
    22892289  {
    2290 #if H_3D_DIM_DLT
     2290#if NH_3D_DLT
    22912291    Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
    22922292    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     
    76617661#endif
    76627662
    7663 #if H_3D_DIM_DLT
    7664   rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC1 + rDeltaDC1), bitDepthY ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
    7665   rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC2 + rDeltaDC2), bitDepthY ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
     7663#if NH_3D_DLT
     7664  rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC1 + rDeltaDC1, bitDepthY )) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
     7665  rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC2 + rDeltaDC2, bitDepthY )) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
    76667666#endif
    76677667}
  • branches/HTM-14.1-update-dev1-RWTH/source/Lib/TLibEncoder/TEncTop.cpp

    r1200 r1219  
    987987#endif
    988988
    989 #if H_3D
    990   m_cPPS.setDLT( getDLT() );
     989#if NH_3D_DLT
     990  // create mapping from depth layer indexes to layer ids
     991  Int j=0;
     992  for( Int i=0; i<=getVPS()->getMaxLayersMinus1(); i++ )
     993  {
     994    Int layerId = getVPS()->getLayerIdInNuh(i);
     995    if( getVPS()->getDepthId(layerId) )
     996      m_cDLT.setDepthIdxToLayerId(j++, i);
     997  }
     998  m_cPPS.setDLT( m_cDLT );
    991999#endif
    9921000
Note: See TracChangeset for help on using the changeset viewer.