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/TLibEncoder
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • 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.