Ignore:
Timestamp:
21 Oct 2013, 17:52:23 (11 years ago)
Author:
tech
Message:

Update to HM 12.0.

Location:
branches/HTM-8.2-dev0-Cleanup/source/App/TAppDecoder
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-8.2-dev0-Cleanup/source/App/TAppDecoder/TAppDecTop.cpp

    r648 r651  
    6060#endif
    6161{
    62   ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));
    6362#if H_MV
    6463  for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) m_layerIdToDecIdx[i] = -1;
     
    148147
    149148  // main decoder loop
    150   Bool recon_opened = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
     149  Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
    151150#else
    152151#if H_3D
     
    176175#endif
    177176    AnnexBStats stats = AnnexBStats();
    178 #if !H_MV
    179     Bool bPreviousPictureDecoded = false;
    180 #endif
    181 
    182177    vector<uint8_t> nalUnit;
    183178    InputNALUnit nalu;
     
    246241#endif
    247242        }
    248 
    249        
    250243#else
    251244      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu)  )
    252245      {
    253         if(bPreviousPictureDecoded)
    254         {
    255           bNewPicture = true;
    256           bPreviousPictureDecoded = false;
    257         }
    258         else
    259         {
    260           bNewPicture = false;
    261         }
     246        bNewPicture = false;
    262247      }
    263248      else
     
    290275#endif
    291276        }
    292 #if !H_MV
    293         bPreviousPictureDecoded = true;
    294 #endif
    295277      }
    296278    }
     
    321303      if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] )
    322304#else
    323       if ( m_pchReconFile && !recon_opened )
     305      if ( m_pchReconFile && !openedReconFile )
    324306#endif
    325307      {
     
    334316#else
    335317        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    336         recon_opened = true;
     318        openedReconFile = true;
    337319      }
    338320      if ( bNewPicture &&
     
    462444{
    463445  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    464   Int not_displayed = 0;
    465 
    466   while (iterPic != pcListPic->end())
    467   {
    468     TComPic* pcPic = *(iterPic);
    469 #if H_MV
    470     if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx])
    471 #else
    472     if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay)
    473 #endif
    474     {
    475        not_displayed++;
    476     }
    477     iterPic++;
    478   }
    479   iterPic   = pcListPic->begin();
     446  Int numPicsNotYetDisplayed = 0;
    480447 
    481448  while (iterPic != pcListPic->end())
    482449  {
    483450    TComPic* pcPic = *(iterPic);
    484    
    485 #if H_MV
    486     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx]))
    487 #else
    488     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    489 #endif
    490     {
    491       // write to file
    492        not_displayed--;
     451#if H_MV
     452    if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx])
     453#else
     454    if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay)
     455#endif
     456    {
     457      numPicsNotYetDisplayed++;
     458    }
     459    iterPic++;
     460  }
     461  iterPic   = pcListPic->begin();
     462  if (numPicsNotYetDisplayed>2)
     463  {
     464    iterPic++;
     465  }
     466 
     467  TComPic* pcPic = *(iterPic);
     468  if (numPicsNotYetDisplayed>2 && pcPic->isField()) //Field Decoding
     469  {
     470    TComList<TComPic*>::iterator endPic   = pcListPic->end();
     471    endPic--;
     472    iterPic   = pcListPic->begin();
     473    while (iterPic != endPic)
     474    {
     475      TComPic* pcPicTop = *(iterPic);
     476      iterPic++;
     477      TComPic* pcPicBottom = *(iterPic);
     478     
     479#if H_MV
     480      if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
     481          && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_pocLastDisplay[decIdx]+1 || m_pocLastDisplay[decIdx]<0)))
     482#else
     483      if ( pcPicTop->getOutputMark() && (numPicsNotYetDisplayed >  pcPicTop->getNumReorderPics(tId) && !(pcPicTop->getPOC()%2) && pcPicBottom->getPOC() == pcPicTop->getPOC()+1)
     484          && pcPicBottom->getOutputMark() && (numPicsNotYetDisplayed >  pcPicBottom->getNumReorderPics(tId) && (pcPicTop->getPOC() == m_iPOCLastDisplay+1 || m_iPOCLastDisplay<0)))
     485#endif
     486      {
     487        // write to file
     488        numPicsNotYetDisplayed = numPicsNotYetDisplayed-2;
    493489#if H_MV
    494490      if ( m_pchReconFiles[decIdx] )
    495491#else
    496       if ( m_pchReconFile )
    497 #endif
    498       {
    499         const Window &conf = pcPic->getConformanceWindow();
    500         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     492        if ( m_pchReconFile )
     493#endif
     494        {
     495          const Window &conf = pcPicTop->getConformanceWindow();
     496          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     497
     498          const Bool isTff = pcPicTop->isTopField();
     499#if H_MV
     500        assert( conf   .getScaledFlag() );
     501        assert( defDisp.getScaledFlag() );
     502        m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     503#else
     504          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     505#endif
     506                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     507                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     508                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     509                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     510        }
     511       
     512        // update POC of display order
     513#if H_MV
     514        m_pocLastDisplay[decIdx] = pcPic->getPOC();
     515#else
     516        m_iPOCLastDisplay = pcPicBottom->getPOC();
     517#endif
     518       
     519        // erase non-referenced picture in the reference picture list after display
     520        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
     521        {
     522#if !DYN_REF_FREE
     523          pcPicTop->setReconMark(false);
     524         
     525          // mark it should be extended later
     526          pcPicTop->getPicYuvRec()->setBorderExtension( false );
     527         
     528#else
     529          pcPicTop->destroy();
     530          pcListPic->erase( iterPic );
     531          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     532          continue;
     533#endif
     534        }
     535        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
     536        {
     537#if !DYN_REF_FREE
     538          pcPicBottom->setReconMark(false);
     539         
     540          // mark it should be extended later
     541          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
     542         
     543#else
     544          pcPicBottom->destroy();
     545          pcListPic->erase( iterPic );
     546          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     547          continue;
     548#endif
     549        }
     550        pcPicTop->setOutputMark(false);
     551        pcPicBottom->setOutputMark(false);
     552      }
     553    }
     554  }
     555  else if (!pcPic->isField()) //Frame Decoding
     556  {
     557    iterPic = pcListPic->begin();
     558    while (iterPic != pcListPic->end())
     559    {
     560      pcPic = *(iterPic);
     561
     562#if H_MV
     563      if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx]))
     564#else     
     565      if ( pcPic->getOutputMark() && (numPicsNotYetDisplayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
     566#endif
     567      {
     568        // write to file
     569        numPicsNotYetDisplayed--;
     570#if H_MV
     571      if ( m_pchReconFiles[decIdx] )
     572#else
     573        if ( m_pchReconFile )
     574#endif
     575        {
     576          const Window &conf = pcPic->getConformanceWindow();
     577          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    501578#if H_MV
    502579        assert( conf   .getScaledFlag() );
     
    504581        m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),
    505582#else
    506         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    507 #endif
    508                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    509                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    510                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    511                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     583          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     584#endif
     585                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     586                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     587                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     588                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     589        }
     590       
     591        // update POC of display order
     592#if H_MV
     593        m_pocLastDisplay[decIdx] = pcPic->getPOC();
     594#else
     595        m_iPOCLastDisplay = pcPic->getPOC();
     596#endif
     597       
     598        // erase non-referenced picture in the reference picture list after display
     599        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     600        {
     601#if !DYN_REF_FREE
     602          pcPic->setReconMark(false);
     603         
     604          // mark it should be extended later
     605          pcPic->getPicYuvRec()->setBorderExtension( false );
     606         
     607#else
     608          pcPic->destroy();
     609          pcListPic->erase( iterPic );
     610          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     611          continue;
     612#endif
     613        }
     614        pcPic->setOutputMark(false);
    512615      }
    513616     
    514       // update POC of display order
    515 #if H_MV
    516       m_pocLastDisplay[decIdx] = pcPic->getPOC();
    517 #else
    518       m_iPOCLastDisplay = pcPic->getPOC();
    519 #endif
    520      
    521       // erase non-referenced picture in the reference picture list after display
    522       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    523       {
    524 #if !DYN_REF_FREE
    525         pcPic->setReconMark(false);
    526        
    527         // mark it should be extended later
    528         pcPic->getPicYuvRec()->setBorderExtension( false );
    529        
    530 #else
    531         pcPic->destroy();
    532         pcListPic->erase( iterPic );
    533         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    534         continue;
    535 #endif
    536       }
    537       pcPic->setOutputMark(false);
    538     }
    539    
    540     iterPic++;
    541   }
    542 }
    543 
     617      iterPic++;
     618    }
     619  }
     620}
    544621/** \param pcListPic list of pictures to be written to file
    545622    \todo            DYN_REF_FREE should be revised
     
    554631  {
    555632    return;
    556   } 
     633  }
    557634  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    558 
     635 
    559636  iterPic   = pcListPic->begin();
     637  TComPic* pcPic = *(iterPic);
    560638 
    561   while (iterPic != pcListPic->end())
    562   {
    563     TComPic* pcPic = *(iterPic);
    564 
    565     if ( pcPic->getOutputMark() )
    566     {
    567       // write to file
     639  if (pcPic->isField()) //Field Decoding
     640  {
     641    TComList<TComPic*>::iterator endPic   = pcListPic->end();
     642    endPic--;
     643    TComPic *pcPicTop, *pcPicBottom = NULL;
     644    while (iterPic != endPic)
     645    {
     646      pcPicTop = *(iterPic);
     647      iterPic++;
     648      pcPicBottom = *(iterPic);
     649     
     650      if ( pcPicTop->getOutputMark() && pcPicBottom->getOutputMark() && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) )
     651      {
     652        // write to file
    568653#if H_MV
    569654      if ( m_pchReconFiles[decIdx] )
    570655#else
    571       if ( m_pchReconFile )
    572 #endif
    573       {
    574         const Window &conf = pcPic->getConformanceWindow();
    575         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     656        if ( m_pchReconFile )
     657#endif
     658        {
     659          const Window &conf = pcPicTop->getConformanceWindow();
     660          const Window &defDisp = m_respectDefDispWindow ? pcPicTop->getDefDisplayWindow() : Window();
     661          const Bool isTff = pcPicTop->isTopField();
     662#if H_MV
     663        assert( conf   .getScaledFlag() );
     664        assert( defDisp.getScaledFlag() );
     665        m_tVideoIOYuvReconFile[decIdx]->write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     666#else
     667          m_cTVideoIOYuvReconFile.write( pcPicTop->getPicYuvRec(), pcPicBottom->getPicYuvRec(),
     668#endif
     669                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     670                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     671                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     672                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset(), isTff );
     673        }
     674       
     675        // update POC of display order
     676#if H_MV
     677      m_pocLastDisplay[decIdx] = pcPic->getPOC();
     678#else
     679      m_iPOCLastDisplay = pcPicBottom->getPOC();
     680#endif       
     681        // erase non-referenced picture in the reference picture list after display
     682        if ( !pcPicTop->getSlice(0)->isReferenced() && pcPicTop->getReconMark() == true )
     683        {
     684#if !DYN_REF_FREE
     685          pcPicTop->setReconMark(false);
     686         
     687          // mark it should be extended later
     688          pcPicTop->getPicYuvRec()->setBorderExtension( false );
     689         
     690#else
     691          pcPicTop->destroy();
     692          pcListPic->erase( iterPic );
     693          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     694          continue;
     695#endif
     696        }
     697        if ( !pcPicBottom->getSlice(0)->isReferenced() && pcPicBottom->getReconMark() == true )
     698        {
     699#if !DYN_REF_FREE
     700          pcPicBottom->setReconMark(false);
     701         
     702          // mark it should be extended later
     703          pcPicBottom->getPicYuvRec()->setBorderExtension( false );
     704         
     705#else
     706          pcPicBottom->destroy();
     707          pcListPic->erase( iterPic );
     708          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     709          continue;
     710#endif
     711        }
     712        pcPicTop->setOutputMark(false);
     713        pcPicBottom->setOutputMark(false);
     714       
     715#if !DYN_REF_FREE
     716        if(pcPicTop)
     717        {
     718          pcPicTop->destroy();
     719          delete pcPicTop;
     720          pcPicTop = NULL;
     721        }
     722#endif
     723      }
     724    }
     725    if(pcPicBottom)
     726    {
     727      pcPicBottom->destroy();
     728      delete pcPicBottom;
     729      pcPicBottom = NULL;
     730    }
     731  }
     732  else //Frame decoding
     733  {
     734    while (iterPic != pcListPic->end())
     735    {
     736      pcPic = *(iterPic);
     737     
     738      if ( pcPic->getOutputMark() )
     739      {
     740        // write to file
     741        if ( m_pchReconFile )
     742        {
     743          const Window &conf = pcPic->getConformanceWindow();
     744          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    576745#if H_MV
    577746        assert( conf   .getScaledFlag() );
     
    579748        m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),
    580749#else
    581         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    582 #endif
    583                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    584                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    585                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    586                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    587       }
    588      
    589       // update POC of display order
     750          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     751#endif
     752                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     753                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     754                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     755                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     756        }
     757       
     758        // update POC of display order
    590759#if H_MV
    591760      m_pocLastDisplay[decIdx] = pcPic->getPOC();
    592761#else
    593       m_iPOCLastDisplay = pcPic->getPOC();
    594 #endif
    595      
    596       // erase non-referenced picture in the reference picture list after display
    597       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    598       {
     762        m_iPOCLastDisplay = pcPic->getPOC();
     763#endif
     764       
     765        // erase non-referenced picture in the reference picture list after display
     766        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     767        {
    599768#if !DYN_REF_FREE
    600         pcPic->setReconMark(false);
    601        
    602         // mark it should be extended later
    603         pcPic->getPicYuvRec()->setBorderExtension( false );
    604        
    605 #else
    606         pcPic->destroy();
    607         pcListPic->erase( iterPic );
    608         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    609         continue;
    610 #endif
    611       }
    612       pcPic->setOutputMark(false);
    613     }
     769          pcPic->setReconMark(false);
     770         
     771          // mark it should be extended later
     772          pcPic->getPicYuvRec()->setBorderExtension( false );
     773         
     774#else
     775          pcPic->destroy();
     776          pcListPic->erase( iterPic );
     777          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     778          continue;
     779#endif
     780        }
     781        pcPic->setOutputMark(false);
     782      }
    614783#if !H_MV
    615784#if !DYN_REF_FREE
    616     if(pcPic)
    617     {
    618       pcPic->destroy();
    619       delete pcPic;
    620       pcPic = NULL;
    621     }
    622 #endif
    623 #endif
    624     iterPic++;
     785      if(pcPic)
     786      {
     787        pcPic->destroy();
     788        delete pcPic;
     789        pcPic = NULL;
     790      }
     791#endif   
     792#endif
     793      iterPic++;
     794    }
    625795  }
    626796#if H_MV
  • branches/HTM-8.2-dev0-Cleanup/source/App/TAppDecoder/TAppDecTop.h

    r608 r651  
    7272#endif
    7373    // for output control
    74   Bool                            m_abDecFlag[ MAX_GOP ];         ///< decoded flag in one GOP
    7574#if H_MV
    7675  Int                             m_pocLastDisplay      [ MAX_NUM_LAYERS ]; ///< last POC in display order
Note: See TracChangeset for help on using the changeset viewer.