Ignore:
Timestamp:
23 May 2013, 15:40:36 (12 years ago)
Author:
tech
Message:

Integrated 3D encoder control, camera parameters, renderer and MV fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.2-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r401 r438  
    4242ParameterSetManagerDecoder TDecTop::m_parameterSetManagerDecoder;
    4343#endif
     44
    4445//! \ingroup TLibDecoder
    4546//! \{
     
    5051  m_iMaxRefPicNum = 0;
    5152#if ENC_DEC_TRACE
    52 #if H_MV
    53   if ( g_hTrace == NULL )
    54   {
    55 #endif
    5653  g_hTrace = fopen( "TraceDec.txt", "wb" );
    5754  g_bJustDoIt = g_bEncDecTraceDisable;
    5855  g_nSymbolCounter = 0;
    59 #if H_MV
    60   }
    61 #endif
    6256#endif
    6357  m_pocCRA = 0;
     
    10094}
    10195
     96
    10297Void TDecTop::init()
    10398{
     
    106101  initROM();
    107102#endif
     103
    108104  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
    109105  m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder );
     
    153149  }
    154150
    155 #if L0323_DPB
    156   m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
    157 #else
    158151  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded
    159 #endif
    160152  if (m_cListPic.size() < (UInt)m_iMaxRefPicNum)
    161153  {
     
    227219  rpcListPic          = &m_cListPic; 
    228220  m_cCuDecoder.destroy();       
     221
    229222#if H_MV
    230223  TComSlice::markIvRefPicsAsShortTerm( m_refPicSetInterLayer ); 
    231224  TComSlice::markIvRefPicsAsUnused   ( m_ivPicLists, targetDecLayerIdSet, m_parameterSetManagerDecoder.getActiveVPS(), m_layerId, poc );
    232225#endif
     226
    233227  m_bFirstSliceInPicture  = true;
    234228
     
    296290  assert (sps != 0);
    297291
    298   if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
     292  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->getIdrPicFlag()))
    299293  {
    300294    printf ("Parameter set activation failed!");
     
    302296  }
    303297
    304   if( pps->getDependentSliceSegmentsEnabledFlag() )
    305   {
    306     Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;
    307 
    308     if (m_cSliceDecoder.getCtxMemSize() != NumCtx)
    309     {
    310       m_cSliceDecoder.initCtxMem(NumCtx);
    311       for ( UInt st = 0; st < NumCtx; st++ )
    312       {
    313         TDecSbac* ctx = NULL;
    314         ctx = new TDecSbac;
    315         ctx->init( &m_cBinCABAC );
    316         m_cSliceDecoder.setCtxMem( ctx, st );
    317       }
    318     }
    319   }
    320 
    321298  m_apcSlicePilot->setPPS(pps);
    322299  m_apcSlicePilot->setSPS(sps);
     300
    323301#if H_MV
    324302  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getActiveVPS() );
    325303#endif
     304
    326305  pps->setSPS(sps);
    327306  pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1);
    328307  pps->setMinCuDQPSize( sps->getMaxCUWidth() >> ( pps->getMaxCuDQPDepth()) );
    329308
    330   g_bitDepthY     = sps->getBitDepthY();
    331   g_bitDepthC     = sps->getBitDepthC();
    332   g_uiMaxCUWidth  = sps->getMaxCUWidth();
    333   g_uiMaxCUHeight = sps->getMaxCUHeight();
    334   g_uiMaxCUDepth  = sps->getMaxCUDepth();
    335   g_uiAddCUDepth  = max (0, sps->getLog2MinCodingBlockSize() - (Int)sps->getQuadtreeTULog2MinSize() );
    336 
    337   for (Int i = 0; i < sps->getLog2DiffMaxMinCodingBlockSize(); i++)
     309  for (Int i = 0; i < sps->getMaxCUDepth() - g_uiAddCUDepth; i++)
    338310  {
    339311    sps->setAMPAcc( i, sps->getUseAMP() );
    340312  }
    341313
    342   for (Int i = sps->getLog2DiffMaxMinCodingBlockSize(); i < sps->getMaxCUDepth(); i++)
     314  for (Int i = sps->getMaxCUDepth() - g_uiAddCUDepth; i < sps->getMaxCUDepth(); i++)
    343315  {
    344316    sps->setAMPAcc( i, 0 );
     
    346318
    347319  m_cSAO.destroy();
    348   m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
    349   m_cLoopFilter.create( sps->getMaxCUDepth() );
     320  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight );
     321  m_cLoopFilter.        create( g_uiMaxCUDepth );
    350322}
    351323
     
    373345
    374346  m_apcSlicePilot->setNalUnitType(nalu.m_nalUnitType);
    375   Bool nonReferenceFlag = (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N ||
    376                            m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N   ||
    377                            m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N  ||
    378                            m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N  ||
    379                            m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N);
    380   m_apcSlicePilot->setTemporalLayerNonReferenceFlag(nonReferenceFlag);
    381  
     347  if((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TRAIL_N) ||
     348     (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N) ||
     349     (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_STSA_N))
     350  {
     351    m_apcSlicePilot->setTemporalLayerNonReferenceFlag(true);
     352  }
    382353  m_apcSlicePilot->setReferenced(true); // Putting this as true ensures that picture is referenced the first time it is in an RPS
    383354  m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);
     
    386357  m_apcSlicePilot->setLayerId( nalu.m_layerId );
    387358#endif
     359
    388360  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder);
    389361
     
    399371#endif
    400372#endif
     373
     374  if (m_apcSlicePilot->isNextSlice())
     375  {
    401376    // Skip pictures due to random access
    402377    if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    409384      return false;
    410385    }
    411 
    412   //we should only get a different poc for a new picture (with CTU address==0)
    413   if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence && (!m_apcSlicePilot->getSliceCurStartCUAddr()==0))
    414   {
    415     printf ("Warning, the first slice of a picture might have been lost!\n");
    416   }
     386  }
     387
    417388  // exit when a new picture is found
    418   if (m_apcSlicePilot->isNextSlice() && (m_apcSlicePilot->getSliceCurStartCUAddr() == 0 && !m_bFirstSliceInPicture) && !m_bFirstSliceInSequence )
     389  if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence)
    419390  {
    420391    if (m_prevPOC >= m_pocRandomAccess)
     
    425396    m_prevPOC = m_apcSlicePilot->getPOC();
    426397  }
     398
    427399#if H_MV
    428400  if ( newLayerFlag )
     
    431403  }
    432404#endif
     405
     406
    433407  // actual decoding starts here
    434408  xActivateParameterSets();
     
    445419    xCreateLostPicture(lostPoc-1);
    446420  }
     421
    447422  if (m_bFirstSliceInPicture)
    448423  {
     
    450425    m_cPrediction.initTempBuff();
    451426    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
     427   
    452428#if H_MV
    453429    m_apcSlicePilot->createAndApplyIvReferencePictureSet( m_ivPicLists, m_refPicSetInterLayer );
    454430#endif
     431
     432
    455433    //  Get a new picture buffer
    456434    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     
    591569#endif
    592570#endif
     571
    593572  if (bNextSlice)
    594573  {
    595     pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic );
     574    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA );
    596575    // Set reference list
     576
    597577#if H_MV   
    598     pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer, true );   
    599 #else
    600 #if FIX1071
    601     pcSlice->setRefPicList( m_cListPic, true );
     578    pcSlice->setRefPicList( m_cListPic, m_refPicSetInterLayer );   
    602579#else
    603580    pcSlice->setRefPicList( m_cListPic );
    604581#endif
    605582
    606 #endif
    607583    // For generalized B
    608584    // note: maybe not existed case (always L0 is copied to L1 if L1 is empty)
     
    646622    //---------------
    647623    pcSlice->setRefPOCList();
    648 #if !L0034_COMBINED_LIST_CLEANUP
    649624    pcSlice->setNoBackPredFlag( false );
    650625    if ( pcSlice->getSliceType() == B_SLICE )
     
    663638      }
    664639    }
    665 #endif
    666640  }
    667641
     
    717691  m_cEntropyDecoder.decodePPS( pps );
    718692  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
     693
     694  if( pps->getDependentSliceSegmentsEnabledFlag() )
     695  {
     696    Int NumCtx = pps->getEntropyCodingSyncEnabledFlag()?2:1;
     697    m_cSliceDecoder.initCtxMem(NumCtx);
     698    for ( UInt st = 0; st < NumCtx; st++ )
     699    {
     700      TDecSbac* ctx = NULL;
     701      ctx = new TDecSbac;
     702      ctx->init( &m_cBinCABAC );
     703      m_cSliceDecoder.setCtxMem( ctx, st );
     704    }
     705  }
    719706}
    720707
    721708Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType )
    722709{
    723   if(nalUnitType == NAL_UNIT_SUFFIX_SEI)
     710  if(nalUnitType == NAL_UNIT_SEI_SUFFIX)
    724711  {
    725712    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
     
    766753      return false;
    767754     
    768     case NAL_UNIT_PREFIX_SEI:
    769     case NAL_UNIT_SUFFIX_SEI:
     755    case NAL_UNIT_SEI:
     756    case NAL_UNIT_SEI_SUFFIX:
    770757      xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType );
    771758      return false;
     
    773760    case NAL_UNIT_CODED_SLICE_TRAIL_R:
    774761    case NAL_UNIT_CODED_SLICE_TRAIL_N:
    775     case NAL_UNIT_CODED_SLICE_TLA_R:
     762    case NAL_UNIT_CODED_SLICE_TLA:
    776763    case NAL_UNIT_CODED_SLICE_TSA_N:
    777764    case NAL_UNIT_CODED_SLICE_STSA_R:
    778765    case NAL_UNIT_CODED_SLICE_STSA_N:
    779     case NAL_UNIT_CODED_SLICE_BLA_W_LP:
    780     case NAL_UNIT_CODED_SLICE_BLA_W_RADL:
     766    case NAL_UNIT_CODED_SLICE_BLA:
     767    case NAL_UNIT_CODED_SLICE_BLANT:
    781768    case NAL_UNIT_CODED_SLICE_BLA_N_LP:
    782     case NAL_UNIT_CODED_SLICE_IDR_W_RADL:
     769    case NAL_UNIT_CODED_SLICE_IDR:
    783770    case NAL_UNIT_CODED_SLICE_IDR_N_LP:
    784771    case NAL_UNIT_CODED_SLICE_CRA:
    785772    case NAL_UNIT_CODED_SLICE_RADL_N:
    786     case NAL_UNIT_CODED_SLICE_RADL_R:
     773    case NAL_UNIT_CODED_SLICE_DLP:
    787774    case NAL_UNIT_CODED_SLICE_RASL_N:
    788     case NAL_UNIT_CODED_SLICE_RASL_R:
     775    case NAL_UNIT_CODED_SLICE_TFD:
    789776#if H_MV
    790777      return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay, newLayerFlag);
     
    808795Bool TDecTop::isSkipPictureForBLA(Int& iPOCLastDisplay)
    809796{
    810   if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     797  if (m_prevRAPisBLA && m_apcSlicePilot->getPOC() < m_pocCRA && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TFD || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    811798  {
    812799    iPOCLastDisplay++;
     
    839826  {
    840827    if (   m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA
    841         || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     828        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA
    842829        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
    843         || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL )
     830        || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLANT )
    844831    {
    845832      // set the POC random access since we need to skip the reordered pictures in the case of CRA/CRANT/BLA/BLANT.
    846833      m_pocRandomAccess = m_apcSlicePilot->getPOC();
    847834    }
    848     else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
     835    else if ( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP )
    849836    {
    850837      m_pocRandomAccess = -MAX_INT; // no need to skip the reordered pictures in IDR, they are decodable.
     
    862849  }
    863850  // skip the reordered pictures, if necessary
    864   else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_R || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
     851  else if (m_apcSlicePilot->getPOC() < m_pocRandomAccess && (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TFD || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL_N))
    865852  {
    866853    iPOCLastDisplay++;
     
    894881
    895882#endif
     883
    896884//! \}
Note: See TracChangeset for help on using the changeset viewer.