Ignore:
Timestamp:
22 Dec 2013, 20:21:39 (10 years ago)
Author:
rwth
Message:
  • finalize H_3D_DELTA_DLT implementation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.1-dev0-RWTH/source/Lib/TLibEncoder/TEncCavlc.cpp

    r748 r753  
    299299            WRITE_FLAG( pcDLT->getInterViewDltPredEnableFlag( i ) ? 1 : 0, "inter_view_dlt_pred_enable_flag[ i ]");
    300300
    301             // determine whether to use bit-map
     301            // ----------------------------- determine whether to use bit-map -----------------------------
    302302            Bool bDltBitMapRepFlag       = false;
    303303            UInt uiNumBitsNonBitMap      = 0;
     
    310310
    311311            UInt* puiDltDiffValues       = NULL;
    312 
    313             if ( NULL == (puiDltDiffValues = (UInt *)calloc(pcDLT->getNumDepthValues(i), sizeof(UInt))) )
     312           
     313            Int aiIdx2DepthValue_coded[256];
     314            UInt uiNumDepthValues_coded = 0;
     315           
     316            uiNumDepthValues_coded = pcDLT->getNumDepthValues(i);
     317            for( UInt ui = 0; ui<uiNumDepthValues_coded; ui++ )
     318            {
     319              aiIdx2DepthValue_coded[ui] = pcDLT->idx2DepthValue(i, ui);
     320            }
     321           
     322#if H_3D_DELTA_DLT
     323            if( pcDLT->getInterViewDltPredEnableFlag( i ) )
     324            {
     325              AOF( pcVPS->getDepthId( 1 ) == 1 );
     326              AOF( i > 1 );
     327              // assumes ref layer id to be 1
     328              Int* piRefDLT = pcDLT->idx2DepthValue( 1 );
     329              UInt uiRefNum = pcDLT->getNumDepthValues( 1 );
     330              pcDLT->getDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue_coded, &uiNumDepthValues_coded);
     331            }
     332#endif
     333
     334            if ( NULL == (puiDltDiffValues = (UInt *)calloc(uiNumDepthValues_coded, sizeof(UInt))) )
    314335            {
    315336              exit(-1);
    316337            }
    317338
    318             for (UInt d = 1; d < pcDLT->getNumDepthValues(i); d++)
     339            for (UInt d = 1; d < uiNumDepthValues_coded; d++)
    319340            {
    320               puiDltDiffValues[d] = pcDLT->idx2DepthValue(i, d) - pcDLT->idx2DepthValue(i, (d-1));
     341              puiDltDiffValues[d] = aiIdx2DepthValue_coded[d] - aiIdx2DepthValue_coded[d-1];
    321342
    322343              if ( uiMaxDiff < puiDltDiffValues[d] )
     
    335356            uiNumBitsNonBitMap += 8;                          // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])
    336357
    337             if ( pcDLT->getNumDepthValues(i) > 1 )
     358            if ( uiNumDepthValues_coded > 1 )
    338359            {
    339360              uiNumBitsNonBitMap += 8;                        // u(v) bits for max_diff[ layerId ]
    340361            }
    341362
    342             if ( pcDLT->getNumDepthValues(i) > 2 )
     363            if ( uiNumDepthValues_coded > 2 )
    343364            {
    344365              uiLengthMinDiff    = (UInt) ceil(Log2(uiMaxDiff + 1));
     
    351372            {
    352373              uiLengthDltDiffMinusMin = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1));
    353               uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (pcDLT->getNumDepthValues(i) - 1);  // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]
     374              uiNumBitsNonBitMap += uiLengthDltDiffMinusMin * (uiNumDepthValues_coded - 1);  // u(v) bits for dlt_depth_value_diff_minus_min[ layerId ][ j ]
    354375            }
    355376
     
    360381            bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;
    361382
    362             // Actual coding
     383            // ----------------------------- Actual coding -----------------------------
    363384            if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )
    364385            {
     
    376397              for (UInt d=0; d < 256; d++)
    377398              {
    378                 if ( d == pcDLT->idx2DepthValue(i, uiDltArrayIndex) )
     399                if ( d == aiIdx2DepthValue_coded[uiDltArrayIndex] )
    379400                {                 
    380401                  WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]");
     
    390411            else
    391412            {
    392               WRITE_CODE(pcDLT->getNumDepthValues(i), 8, "num_depth_values_in_dlt[layerId]");    // num_entry
    393 
     413              WRITE_CODE(uiNumDepthValues_coded, 8, "num_depth_values_in_dlt[layerId]");    // num_entry
     414
     415#if !H_3D_DELTA_DLT
    394416              if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )   // Single-view DLT Diff Coding
     417#endif
    395418              {
    396                 // 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.
    397                 if ( pcDLT->getNumDepthValues(i) > 1 )
     419                // 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.
     420                if ( uiNumDepthValues_coded > 1 )
    398421                {
    399422                  WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]");        // max_diff
    400423                }
    401424
    402                 if ( pcDLT->getNumDepthValues(i) > 2 )
     425                if ( uiNumDepthValues_coded > 2 )
    403426                {
    404427                  WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]");     // min_diff_minus1
    405428                }
    406429
    407                 WRITE_CODE(pcDLT->idx2DepthValue(i, 0), 8, "dlt_depth_value0[layerId]");          // entry0
     430                WRITE_CODE(aiIdx2DepthValue_coded[0], 8, "dlt_depth_value0[layerId]");          // entry0
    408431
    409432                if (uiMaxDiff > uiMinDiff)
    410433                {
    411                   for (UInt d=1; d < pcDLT->getNumDepthValues(i); d++)
     434                  for (UInt d=1; d < uiNumDepthValues_coded; d++)
    412435                  {
    413436                    WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");    // entry_value_diff_minus_min[ k ]
Note: See TracChangeset for help on using the changeset viewer.