Ignore:
Timestamp:
3 May 2013, 17:16:12 (12 years ago)
Author:
tech
Message:

Fixed erroneously removed parts.

Location:
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/NALread.cpp

    r367 r368  
    103103  assert(forbidden_zero_bit == 0);
    104104  nalu.m_nalUnitType = (NalUnitType) bs.read(6);  // nal_unit_type
     105#if H_MV
     106  nalu.m_layerId = bs.read(6);                 // layerId
     107#else
    105108  nalu.m_reservedZero6Bits = bs.read(6);       // nuh_reserved_zero_6bits
    106109  assert(nalu.m_reservedZero6Bits == 0);
     110#endif
    107111  nalu.m_temporalId = bs.read(3) - 1;             // nuh_temporal_id_plus1
    108112
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r367 r368  
    680680  if (uiCode)
    681681  {
     682#if H_MV
     683    READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" );    pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false);
     684#else
    682685    while ( xMoreRbspData() )
    683686    {
    684687      READ_FLAG( uiCode, "sps_extension_data_flag");
    685688    }
     689#endif
    686690  }
    687691}
     
    693697  READ_CODE( 4,  uiCode,  "vps_video_parameter_set_id" );         pcVPS->setVPSId( uiCode );
    694698  READ_CODE( 2,  uiCode,  "vps_reserved_three_2bits" );           assert(uiCode == 3);
     699#if H_MV
     700  READ_CODE( 6,  uiCode,  "vps_max_layers_minus1" );              pcVPS->setMaxLayers( uiCode + 1 );
     701#else
    695702  READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
     703#endif
    696704  READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 );
    697705  READ_FLAG(     uiCode,  "vps_temporal_id_nesting_flag" );       pcVPS->setTemporalNestingFlag( uiCode ? true:false );
    698706  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
     707#if H_MV
     708  READ_CODE( 16, uiCode,  "vps_extension_offset" );               
     709#else
    699710  READ_CODE( 16, uiCode,  "vps_reserved_ffff_16bits" );           assert(uiCode == 0xffff);
     711#endif
    700712  parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1);
    701713#if SIGNAL_BITRATE_PICRATE_IN_VPS
     
    727739
    728740  assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 );
     741#if H_MV
     742  assert( pcVPS->getMaxNuhLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 );
     743  READ_CODE( 6, uiCode, "vps_max_nuh_layer_id" );   pcVPS->setMaxNuhLayerId( uiCode );
     744#else
    729745  assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 );
    730746  READ_CODE( 6, uiCode, "vps_max_nuh_reserved_zero_layer_id" );   pcVPS->setMaxNuhReservedZeroLayerId( uiCode );
     747#endif
    731748  READ_UVLC(    uiCode, "vps_max_op_sets_minus1" );               pcVPS->setMaxOpSets( uiCode + 1 );
    732749  for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ )
    733750  {
    734751    // Operation point set
     752#if H_MV
     753    for( UInt i = 0; i <= pcVPS->getMaxNuhLayerId(); i ++ )
     754#else
    735755    for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ )
     756#endif
    736757    {
    737758      READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" );     pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i );
     
    772793  if (uiCode)
    773794  {
     795#if H_MV
     796    m_pcBitstream->readOutTrailingBits();
     797
     798    READ_FLAG( uiCode, "avc_base_layer_flag" );                     pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false );
     799    READ_FLAG( uiCode, "splitting_flag" );                          pcVPS->setSplittingFlag( uiCode == 1 ? true : false );
     800
     801    // Parse scalability_mask[i]   
     802    for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ )
     803    {
     804      READ_FLAG( uiCode,  "scalability_mask[i]" );                  pcVPS->setScalabilityMask( sIdx, uiCode == 1 ? true : false );     
     805    }
     806
     807    Int numScalabilityTypes = pcVPS->getNumScalabilityTypes();
     808
     809    // Parse dimension_id_len_minus1[j]   
     810    for( Int sIdx = 0; sIdx < numScalabilityTypes; sIdx++ )
     811    {
     812        READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" );       pcVPS->setDimensionIdLen( sIdx, uiCode + 1 );
     813    }
     814
     815    // vps_nuh_layer_id_present_flag
     816    READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" );           pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false );
     817
     818    // parse layer_id_in_nuh[i] and derive LayerIdInVps
     819    pcVPS->setLayerIdInNuh( 0, 0 ); pcVPS->setLayerIdInVps( 0, 0 );
     820   
     821    for( Int layer = 1; layer <= pcVPS->getMaxLayers() - 1; layer++ )
     822    {
     823      UInt layerIdInNuh;
     824      if ( pcVPS->getVpsNuhLayerIdPresentFlag() )
     825      {
     826        READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" );                layerIdInNuh = uiCode;
     827      }
     828      else
     829      {
     830        layerIdInNuh = layer;
     831      }     
     832
     833      pcVPS->setLayerIdInNuh( layer, layerIdInNuh );
     834      pcVPS->setLayerIdInVps( layerIdInNuh, layer );
     835
     836      // parse dimension_id[i][j]
     837      for( Int sIdx = 0; sIdx < numScalabilityTypes; sIdx++ )
     838      {
     839          READ_CODE( pcVPS->getDimensionIdLen( sIdx ), uiCode, "dimension_id[i][j]" );  pcVPS->setDimensionId( layer, sIdx, uiCode );
     840      }
     841    }
     842
     843    for( Int layerSet = 1; layerSet <= pcVPS->getMaxOpSets() - 1; layerSet++ )
     844    {
     845      READ_FLAG(  uiCode, "vps_profile_present_flag[lsIdx]" );    pcVPS->setVpsProfilePresentFlag( layerSet, uiCode == 1 ? true : false );
     846      if( pcVPS->getVpsProfilePresentFlag( layerSet ) == false )
     847      {
     848        READ_UVLC( uiCode, "profile_layer_set_ref_minus1[lsIdx]" ); pcVPS->setProfileLayerSetRefMinus1( layerSet, uiCode );
     849      }
     850
     851      parsePTL ( pcVPS->getPTL( layerSet ), pcVPS->getVpsProfilePresentFlag( layerSet ), pcVPS->getMaxTLayers()-1);
     852      if( pcVPS->getVpsProfilePresentFlag( layerSet ) == false )
     853      {
     854        TComPTL temp = *pcVPS->getPTL( layerSet );
     855        *pcVPS->getPTL( layerSet ) = *pcVPS->getPTL( pcVPS->getProfileLayerSetRefMinus1( layerSet ) + 1 );
     856        pcVPS->getPTL( layerSet )->copyLevelFrom( &temp );
     857      }
     858    }
     859
     860    READ_UVLC( uiCode, "num_output_layer_sets" );                  pcVPS->setNumOutputLayerSets( uiCode );
     861   
     862    for( Int layerSet = 0; layerSet < pcVPS->getNumOutputLayerSets(); layerSet++ )
     863    {
     864      READ_UVLC( uiCode, "output_layer_set_idx[i]" );              pcVPS->setOutputLayerSetIdx( layerSet, uiCode );
     865      for( Int layer = 0; layer <= pcVPS->getMaxNuhLayerId(); layer++ )
     866      {
     867        if( pcVPS->getLayerIdIncludedFlag( pcVPS->getOutputLayerSetIdx( layerSet ), layer ) == true )
     868        {
     869          READ_FLAG( uiCode, "output_layer_flag" );                 pcVPS->setOutputLayerFlag( layerSet, layer, uiCode == 1 ? true : false );
     870        }
     871      }
     872    }
     873
     874    for( Int i = 1; i <= pcVPS->getMaxLayers() - 1; i++ )
     875    {
     876      for( Int j = 0; j < i; j++ )
     877      {
     878        READ_FLAG( uiCode, "direct_dependency_flag[i][j]" );             pcVPS->setDirectDependencyFlag( i, j, uiCode );
     879      }
     880    }
     881   
     882    READ_FLAG( uiCode,  "vps_extension2_flag" );
     883    if (uiCode)
     884    {
     885      while ( xMoreRbspData() )
     886      {
     887        READ_FLAG( uiCode, "vps_extension2_data_flag");
     888      }
     889    }
     890
     891    pcVPS->checkVPSExtensionSyntax();
     892
     893    pcVPS->calcIvRefLayers();
     894
     895#else
    774896    while ( xMoreRbspData() )
    775897    {
    776898      READ_FLAG( uiCode, "vps_extension_data_flag");
    777899    }
     900#endif   
    778901  }
    779902 
     
    791914  TComPPS* pps = NULL;
    792915  TComSPS* sps = NULL;
     916#if H_MV
     917  TComVPS* vps = NULL;
     918#endif
    793919
    794920  UInt firstSliceSegmentInPic;
     
    805931  //!KS: need to add error handling code here, if SPS is not available
    806932  assert(sps!=0);
     933#if H_MV
     934  vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId());
     935  assert(vps!=0);
     936  rpcSlice->setVPS(vps);
     937#endif
    807938  rpcSlice->setSPS(sps);
    808939  rpcSlice->setPPS(pps);
     
    13921523  for (Int i = 0; i < maxNumSubLayersMinus1; i++)
    13931524  {
     1525#if !H_MV
    13941526    if(profilePresentFlag)
    13951527    {
     1528#endif
    13961529      READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode);
    1397     }
     1530#if H_MV
     1531    rpcPTL->setSubLayerProfilePresentFlag( i, profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) );
     1532#else
     1533    }
     1534#endif
    13981535    READ_FLAG( uiCode, "sub_layer_level_present_flag[i]"   ); rpcPTL->setSubLayerLevelPresentFlag  (i, uiCode);
    13991536  }
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecGop.cpp

    r367 r368  
    205205  }
    206206
     207#if !H_3D
    207208  rpcPic->compressMotion();
     209#endif
    208210  Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
    209211  if (!pcSlice->isReferenced()) c += 32;
    210212
    211213  //-- For time output for each slice
     214#if H_MV
     215  printf("\nLayer %2d   POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getLayerId(),
     216                                                              pcSlice->getPOC(),
     217                                                              pcSlice->getTLayer(),
     218                                                              c,
     219                                                              pcSlice->getSliceQp() );
     220#else
    212221  printf("\nPOC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(),
    213222                                                    pcSlice->getTLayer(),
    214223                                                    c,
    215224                                                    pcSlice->getSliceQp() );
     225#endif
    216226
    217227  m_dDecTime += (Double)(clock()-iBeforeTime) / CLOCKS_PER_SEC;
     
    224234    for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++)
    225235    {
     236#if H_MV
     237      if( pcSlice->getLayerId() != pcSlice->getRefLayerId( RefPicList(iRefList), iRefIndex ) )
     238      {
     239        printf( "V%d ", pcSlice->getRefLayerId( RefPicList(iRefList), iRefIndex ) );
     240      }
     241      else
     242      {
     243#endif
    226244      printf ("%d ", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex));
     245#if H_MV
     246      }
     247#endif
    227248    }
    228249    printf ("] ");
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r367 r368  
    3939#include "TDecTop.h"
    4040
     41#if H_MV
     42ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder;
     43#endif
    4144//! \ingroup TLibDecoder
    4245//! \{
     
    5760  m_bFirstSliceInPicture    = true;
    5861  m_bFirstSliceInSequence   = true;
     62#if H_MV
     63  m_layerId = 0;
     64  m_viewId = 0;
     65#if H_3D
     66  m_isDepth = false;
     67#endif
     68#endif
    5969}
    6070
     
    8696{
    8797  // initialize ROM
     98#if !H_MV
    8899  initROM();
     100#endif
    89101  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
    90102  m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder );
     
    100112  {
    101113    TComPic* pcPic = *(iterPic++);
     114#if H_MV
     115    if( pcPic )
     116    {
     117#endif
    102118    pcPic->destroy();
    103119   
    104120    delete pcPic;
    105121    pcPic = NULL;
     122#if H_MV
     123    }
     124#endif
    106125  }
    107126 
     
    110129  m_cLoopFilter.        destroy();
    111130 
     131#if !H_MV
    112132  // destroy ROM
    113133  destroyROM();
     134#endif
    114135}
    115136
     
    177198}
    178199
     200#if H_MV
     201Void TDecTop::endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic, std::vector<Int>& targetDecLayerIdSet )
     202#else
    179203Void TDecTop::executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic)
     204#endif
    180205{
    181206  if (!m_pcPic)
     
    195220  rpcListPic          = &m_cListPic; 
    196221  m_cCuDecoder.destroy();       
     222#if H_MV
     223  TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 
     224  TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc );
     225#endif
    197226  m_bFirstSliceInPicture  = true;
    198227
     
    311340}
    312341
     342#if H_MV
     343Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag )
     344{
     345  assert( nalu.m_layerId == m_layerId );
     346
     347#else
    313348Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay )
    314349{
     350#endif
    315351  TComPic*&   pcPic         = m_pcPic;
    316352  m_apcSlicePilot->initSlice();
     
    337373  m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);
    338374
     375#if H_MV
     376  m_apcSlicePilot->setLayerId( nalu.m_layerId );
     377#endif
    339378  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder);
    340379
     380#if H_MV 
     381  TComVPS* vps     = m_apcSlicePilot->getVPS();
     382  Int layerIdInVps = vps->getLayerIdInVps( nalu.m_layerId );
     383 
     384  setViewId(  vps->getViewId( layerIdInVps  ) );
     385  m_apcSlicePilot->setViewId( getViewId() );
     386#if H_3D
     387  setIsDepth( vps->getDepthId( layerIdInVps ) == 1 );
     388  m_apcSlicePilot->setIsDepth( getIsDepth() );
     389#endif
     390#endif
    341391    // Skip pictures due to random access
    342392    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    365415    m_prevPOC = m_apcSlicePilot->getPOC();
    366416  }
     417#if H_MV
     418  if ( newLayerFlag )
     419  {
     420    return false;
     421  }
     422#endif
    367423  // actual decoding starts here
    368424  xActivateParameterSets();
     
    384440    m_cPrediction.initTempBuff();
    385441    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
     442#if H_MV
     443    m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer );
     444#endif
    386445    //  Get a new picture buffer
    387446    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     
    515574  pcPic->setTLayer(nalu.m_temporalId);
    516575
     576#if H_MV
     577  pcPic->setLayerId( nalu.m_layerId );
     578  pcPic->setViewId ( getViewId() );
     579#if H_3D
     580  pcPic->setIsDepth( getIsDepth() );
     581#endif
     582#endif
    517583  if (bNextSlice)
    518584  {
    519585    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic );
    520586    // Set reference list
     587#if H_MV   
     588    pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true );   
     589#else
    521590#if FIX1071
    522591    pcSlice->setRefPicList( m_cListPic, true );
     
    525594#endif
    526595
     596#endif
    527597    // For generalized B
    528598    // note: maybe not existed case (always L0 is copied to L1 if L1 is empty)
     
    662732}
    663733
     734#if H_MV
     735Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayerFlag)
     736#else
    664737Bool TDecTop::decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay)
     738#endif
    665739{
    666740  // Initialize entropy decoder
     
    703777    case NAL_UNIT_CODED_SLICE_RASL_N:
    704778    case NAL_UNIT_CODED_SLICE_RASL_R:
     779#if H_MV
     780      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag);
     781#else
    705782      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
     783#endif
    706784      break;
    707785    default:
     
    783861}
    784862
     863#if H_MV
     864TComPic* TDecTop::getPic( Int poc )
     865{
     866  xGetPic( m_layerId, poc );
     867  TComList<TComPic*>* listPic = getListPic();
     868  TComPic* pcPic = NULL;
     869  for(TComList<TComPic*>::iterator it=listPic->begin(); it!=listPic->end(); it++)
     870  {
     871    if( (*it)->getPOC() == poc )
     872    {
     873      pcPic = *it ;
     874      break ;
     875    }
     876  }
     877  return pcPic;
     878}
     879
     880TComPic* TDecTop::xGetPic( Int layerId, Int poc )
     881{
     882  return m_ivPicLists->getPic( layerId, poc ) ;
     883}
     884
     885#endif
    785886//! \}
  • branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecTop.h

    r367 r368  
    6161// ====================================================================================================================
    6262
     63#if H_MV
     64class TAppDecTop;
     65#endif
    6366/// decoder class
    6467class TDecTop
     
    7275
    7376  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
     77#if H_MV
     78  static ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
     79#else
    7480  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
     81#endif
    7582  TComSlice*              m_apcSlicePilot;
    7683 
     
    98105  Bool                    m_bFirstSliceInPicture;
    99106  Bool                    m_bFirstSliceInSequence;
     107#if H_MV
     108  // For H_MV m_bFirstSliceInSequence indicates first slice in sequence of the particular layer 
     109  Int                     m_layerId;
     110  Int                     m_viewId;
     111  TComPicLists*           m_ivPicLists;
     112  std::vector<TComPic*>   m_refPicSetInterLayer;
     113#if H_3D
     114  Bool                    m_isDepth;
     115#endif
     116#endif
    100117
    101118public:
     
    109126
    110127  Void  init();
     128#if H_MV 
     129  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay, Bool newLayer );
     130#else 
    111131  Bool  decode(InputNALUnit& nalu, Int& iSkipFrame, Int& iPOCLastDisplay);
     132#endif
    112133 
    113134  Void  deletePicBuffer();
    114135
     136#if H_MV
     137  Void endPicDecoding(Int& poc, TComList<TComPic*>*& rpcListPic,  std::vector<Int>& targetDecLayerIdSet); 
     138#else
    115139  Void executeLoopFilters(Int& poc, TComList<TComPic*>*& rpcListPic);
     140#endif
    116141 
     142#if H_MV   
     143  TComPic*                getPic                ( Int poc );
     144  TComList<TComPic*>*     getListPic            ()               { return &m_cListPic;  } 
     145  Void                    setIvPicLists         ( TComPicLists* picLists) { m_ivPicLists = picLists; }
     146 
     147  Int                     getCurrPoc            ()               { return m_apcSlicePilot->getPOC(); }
     148  Void                    setLayerId            ( Int layer)     { m_layerId = layer;   }
     149  Int                     getLayerId            ()               { return m_layerId;    }
     150  Void                    setViewId             ( Int viewId  )  { m_viewId  = viewId;  }
     151  Int                     getViewId             ()               { return m_viewId;     } 
     152#if H_3D   
     153  Void                    setIsDepth            ( Bool isDepth ) { m_isDepth = isDepth; }
     154  Bool                    getIsDepth            ()               { return m_isDepth;    }
     155#endif
     156#endif
    117157protected:
    118158  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
     
    120160
    121161  Void      xActivateParameterSets();
     162#if H_MV 
     163  TComPic*  xGetPic( Int layerId, Int poc );
     164  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, Bool newLayerFlag ); 
     165#else
    122166  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
     167#endif
    123168  Void      xDecodeVPS();
    124169  Void      xDecodeSPS();
Note: See TracChangeset for help on using the changeset viewer.