Ignore:
Timestamp:
18 Dec 2013, 09:00:24 (11 years ago)
Author:
zte
Message:

JCT3V-F0131, JCT3V-F0139

Location:
branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder
Files:
6 edited

Legend:

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

    r738 r748  
    256256  WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
    257257  WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");
     258
     259#if !DLT_DIFF_CODING_IN_PPS
    258260  WRITE_FLAG( 0, "pps_extension_flag" );
    259 }
     261#else
     262  WRITE_FLAG( 1, "pps_extension_flag" );
     263  codePPSExtension( pcPPS );
     264  WRITE_FLAG( 0, "pps_extension2_flag" );
     265#endif
     266}
     267
     268#if DLT_DIFF_CODING_IN_PPS
     269Void  TEncCavlc::codePPSExtension        ( TComPPS* pcPPS )
     270{
     271  // Assuming that all PPS indirectly refer to the same VPS via different SPS
     272  // There is no parsing dependency in decoding DLT in PPS.
     273  // The VPS information passed to decodePPS() is used to arrange the decoded DLT tables to their corresponding layers.
     274  // This is equivalent to the process of
     275  //   Step 1) decoding DLT tables based on the number of depth layers, and
     276  //   Step 2) mapping DLT tables to the depth layers
     277  // as descripted in the 3D-HEVC WD.
     278  TComVPS* pcVPS = pcPPS->getSPS()->getVPS();
     279
     280  TComDLT* pcDLT = pcPPS->getDLT();
     281
     282  WRITE_FLAG( pcDLT->getDltPresentFlag() ? 1 : 0, "dlt_present_flag" );
     283
     284  if ( pcDLT->getDltPresentFlag() )
     285  {
     286    WRITE_CODE(pcDLT->getNumDepthViews(), 6, "pps_depth_layers_minus1");
     287    WRITE_CODE((pcDLT->getDepthViewBitDepth() - 8), 4, "pps_bit_depth_for_depth_views_minus8");
     288
     289    for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ )
     290    {
     291      if ( i != 0 )
     292      {
     293        if ( pcVPS->getDepthId( i ) == 1 )
     294        {
     295          WRITE_FLAG( pcDLT->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" );
     296
     297          if ( pcDLT->getUseDLTFlag( i ) )
     298          {
     299            WRITE_FLAG( pcDLT->getInterViewDltPredEnableFlag( i ) ? 1 : 0, "inter_view_dlt_pred_enable_flag[ i ]");
     300
     301            // determine whether to use bit-map
     302            Bool bDltBitMapRepFlag       = false;
     303            UInt uiNumBitsNonBitMap      = 0;
     304            UInt uiNumBitsBitMap         = 0;
     305
     306            UInt uiMaxDiff               = 0;
     307            UInt uiMinDiff               = 0xffffffff;
     308            UInt uiLengthMinDiff         = 0;
     309            UInt uiLengthDltDiffMinusMin = 0;
     310
     311            UInt* puiDltDiffValues       = NULL;
     312
     313            if ( NULL == (puiDltDiffValues = (UInt *)calloc(pcDLT->getNumDepthValues(i), sizeof(UInt))) )
     314            {
     315              exit(-1);
     316            }
     317
     318            for (UInt d = 1; d < pcDLT->getNumDepthValues(i); d++)
     319            {
     320              puiDltDiffValues[d] = pcDLT->idx2DepthValue(i, d) - pcDLT->idx2DepthValue(i, (d-1));
     321
     322              if ( uiMaxDiff < puiDltDiffValues[d] )
     323              {
     324                uiMaxDiff = puiDltDiffValues[d];
     325              }
     326
     327              if ( uiMinDiff > puiDltDiffValues[d] )
     328              {
     329                uiMinDiff = puiDltDiffValues[d];
     330              }
     331            }
     332
     333            // counting bits
     334            // diff coding branch
     335            uiNumBitsNonBitMap += 8;                          // u(v) bits for num_depth_values_in_dlt[layerId] (i.e. num_entry[ layerId ])
     336
     337            if ( pcDLT->getNumDepthValues(i) > 1 )
     338            {
     339              uiNumBitsNonBitMap += 8;                        // u(v) bits for max_diff[ layerId ]
     340            }
     341
     342            if ( pcDLT->getNumDepthValues(i) > 2 )
     343            {
     344              uiLengthMinDiff    = (UInt) ceil(Log2(uiMaxDiff + 1));
     345              uiNumBitsNonBitMap += uiLengthMinDiff;          // u(v)  bits for min_diff[ layerId ]
     346            }
     347
     348            uiNumBitsNonBitMap += 8;                          // u(v) bits for dlt_depth_value0[ layerId ]
     349
     350            if (uiMaxDiff > uiMinDiff)
     351            {
     352              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 ]
     354            }
     355
     356            // bit map branch
     357            uiNumBitsBitMap = 256;   // uiNumBitsBitMap = 1 << pcDLT->getDepthViewBitDepth();
     358
     359            // determine bDltBitMapFlag
     360            bDltBitMapRepFlag = (uiNumBitsBitMap > uiNumBitsNonBitMap) ? false : true;
     361
     362            // Actual coding
     363            if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )
     364            {
     365              WRITE_FLAG( bDltBitMapRepFlag ? 1 : 0, "dlt_bit_map_rep_flag[ layerId ]" );
     366            }
     367            else
     368            {
     369              bDltBitMapRepFlag = false;
     370            }
     371
     372            // bit map coding
     373            if ( bDltBitMapRepFlag )
     374            {
     375              UInt uiDltArrayIndex = 0;
     376              for (UInt d=0; d < 256; d++)
     377              {
     378                if ( d == pcDLT->idx2DepthValue(i, uiDltArrayIndex) )
     379                {                 
     380                  WRITE_FLAG(1, "dlt_bit_map_flag[ layerId ][ j ]");
     381                  uiDltArrayIndex++;
     382                }
     383                else
     384                {
     385                  WRITE_FLAG(0, "dlt_bit_map_flag[ layerId ][ j ]");
     386                }
     387              }
     388            }
     389            // Diff Coding
     390            else
     391            {
     392              WRITE_CODE(pcDLT->getNumDepthValues(i), 8, "num_depth_values_in_dlt[layerId]");    // num_entry
     393
     394              if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false )   // Single-view DLT Diff Coding
     395              {
     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 )
     398                {
     399                  WRITE_CODE(uiMaxDiff, 8, "max_diff[ layerId ]");        // max_diff
     400                }
     401
     402                if ( pcDLT->getNumDepthValues(i) > 2 )
     403                {
     404                  WRITE_CODE((uiMinDiff - 1), uiLengthMinDiff, "min_diff_minus1[ layerId ]");     // min_diff_minus1
     405                }
     406
     407                WRITE_CODE(pcDLT->idx2DepthValue(i, 0), 8, "dlt_depth_value0[layerId]");          // entry0
     408
     409                if (uiMaxDiff > uiMinDiff)
     410                {
     411                  for (UInt d=1; d < pcDLT->getNumDepthValues(i); d++)
     412                  {
     413                    WRITE_CODE( (puiDltDiffValues[d] - uiMinDiff), uiLengthDltDiffMinusMin, "dlt_depth_value_diff_minus_min[ layerId ][ j ]");    // entry_value_diff_minus_min[ k ]
     414                  }
     415                }
     416              }
     417            }
     418
     419            free(puiDltDiffValues);
     420          }
     421        }
     422      }
     423    }
     424  }
     425}
     426#endif
    260427
    261428Void TEncCavlc::codeVUI( TComVUI *pcVUI, TComSPS* pcSPS )
     
    14631630        //WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     );
    14641631#if H_3D_DIM_DLT
     1632#if !DLT_DIFF_CODING_IN_PPS
    14651633        if( pcVPS->getVpsDepthModesFlag( i ) )
    14661634        {
     
    14751643            WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" );
    14761644          }
    1477         }       
     1645        }
     1646#endif
    14781647#endif
    14791648#if H_3D_INTER_SDC
  • branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCavlc.h

    r738 r748  
    116116#endif
    117117  Void  codePPS                 ( TComPPS* pcPPS );
     118
     119#if DLT_DIFF_CODING_IN_PPS
     120  Void  codePPSExtension        ( TComPPS* pcPPS );
     121#endif
     122
    118123  Void  codeSliceHeader         ( TComSlice* pcSlice );
    119124  Void  codePTL                 ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1);
  • branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncCfg.h

    r724 r748  
    330330  TComVPS                    m_cVPS;
    331331#endif
     332
     333#if DLT_DIFF_CODING_IN_PPS
     334  TComDLT*  m_cDLT;
     335#endif
     336
    332337  Bool      m_recalculateQPAccordingToLambda;                 ///< recalculate QP value according to the lambda value
    333338  Int       m_activeParameterSetsSEIEnabled;                  ///< enable active parameter set SEI message
     
    441446  , m_isDepth(false)
    442447  , m_bUseVSO(false)
     448#endif
     449#if DLT_DIFF_CODING_IN_PPS
     450  , m_cDLT(NULL)
    443451#endif
    444452#endif
     
    867875  TComVPS *getVPS() { return &m_cVPS; }
    868876#endif
     877
     878#if DLT_DIFF_CODING_IN_PPS
     879  Void      setDLT           ( TComDLT *p ) { m_cDLT = p; }
     880  TComDLT*  getDLT           ()             { return m_cDLT; }
     881#endif
     882
    869883  Void      setUseRecalculateQPAccordingToLambda ( Bool b ) { m_recalculateQPAccordingToLambda = b;    }
    870884  Bool      getUseRecalculateQPAccordingToLambda ()         { return m_recalculateQPAccordingToLambda; }
  • branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSbac.cpp

    r724 r748  
    632632
    633633#if H_3D_DIM_DLT
     634#if DLT_DIFF_CODING_IN_PPS
     635  UInt uiMaxResidualBits = pcCU->getSlice()->getPPS()->getDLT()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
     636#else
    634637  UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
     638#endif
    635639#else
    636640  UInt uiMaxResidualBits = g_bitDepthY;
     
    653657   
    654658#if H_3D_DIM_DLT
    655     UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
     659#if DLT_DIFF_CODING_IN_PPS
     660      UInt uiNumDepthValues = pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
     661#else
     662      UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
     663#endif
    656664#else
    657665    UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);
  • branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncSearch.cpp

    r735 r748  
    11271127      {
    11281128#if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
    1129           if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
     1129#if DLT_DIFF_CODING_IN_PPS
     1130        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
     1131#else
     1132        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
     1133#endif
    11301134          {
    1131               pResi[ uiX ] = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
     1135#if DLT_DIFF_CODING_IN_PPS
     1136            pResi[ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
     1137#else
     1138            pResi[ uiX ] = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pOrg[ uiX ] ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] );
     1139#endif
    11321140          }
    11331141          else
     
    12021210      {
    12031211#if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
    1204           if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
     1212#if DLT_DIFF_CODING_IN_PPS
     1213        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
     1214#else
     1215        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
     1216#endif
    12051217          {
    1206               pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
     1218#if DLT_DIFF_CODING_IN_PPS
     1219            pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
     1220#else
     1221            pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
     1222#endif
    12071223          }
    12081224          else
     
    19351951    // get residual (idx)
    19361952#if H_3D_DIM_DLT
     1953#if DLT_DIFF_CODING_IN_PPS
     1954    Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     1955#else
    19371956    Pel pResidualIdx = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     1957#endif
    19381958#else
    19391959    Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment];
     
    19491969  {
    19501970#if H_3D_DIM_DLT
     1971#if DLT_DIFF_CODING_IN_PPS
     1972    Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     1973    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     1974    Pel   pRecoValue  = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
     1975#else
    19511976    Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
    19521977    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
    19531978    Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
    1954    
     1979#endif
     1980
    19551981    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
    19561982#else
     
    73467372
    73477373#if H_3D_DIM_DLT
     7374#if DLT_DIFF_CODING_IN_PPS
     7375  rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
     7376  rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
     7377#else
    73487378  rDeltaDC1 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC1 + rDeltaDC1) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 );
    73497379  rDeltaDC2 = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipY(predDC2 + rDeltaDC2) ) - pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 );
     7380#endif
    73507381#endif
    73517382}
  • branches/HTM-9.1-dev0-ZTE/source/Lib/TLibEncoder/TEncTop.cpp

    r738 r748  
    299299{
    300300  // initialize SPS
     301#if DLT_DIFF_CODING_IN_PPS
     302  // Assuming that all PPS indirectly refer to the same VPS via different SPS
     303  m_cSPS.setVPS(m_cVPS);
     304#endif
    301305  xInitSPS();
    302306 
     
    870874  m_cPPS.setSPSId( getLayerIdInVps() );
    871875#endif
     876
     877#if DLT_DIFF_CODING_IN_PPS
     878  m_cPPS.setDLT( getDLT() );
     879#endif
     880
    872881  m_cPPS.setConstrainedIntraPred( m_bUseConstrainedIntraPred );
    873882  Bool bUseDQP = (getMaxCuDQPDepth() > 0)? true : false;
Note: See TracChangeset for help on using the changeset viewer.