Changeset 655 in 3DVCSoftware for trunk/source/App/TAppDecoder


Ignore:
Timestamp:
23 Oct 2013, 23:01:30 (11 years ago)
Author:
tech
Message:

Merged 8.1-Cleanup@654

Location:
trunk/source/App/TAppDecoder
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r622 r655  
    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    }
     
    311293        TComPic* picLastCoded = m_ivPicLists.getPic( m_tDecTop[dI]->getLayerId(), pocLastPic );
    312294        assert( picLastCoded != NULL );       
    313 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    314295        picLastCoded->compressMotion(1);
    315 #else
    316         picLastCoded->compressMotion();         
    317 #endif
    318296      }
    319297    }
     
    325303      if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] )
    326304#else
    327       if ( m_pchReconFile && !recon_opened )
     305      if ( m_pchReconFile && !openedReconFile )
    328306#endif
    329307      {
     
    338316#else
    339317        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    340         recon_opened = true;
     318        openedReconFile = true;
    341319      }
    342320      if ( bNewPicture &&
     
    466444{
    467445  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    468   Int not_displayed = 0;
    469 
    470   while (iterPic != pcListPic->end())
    471   {
    472     TComPic* pcPic = *(iterPic);
    473 #if H_MV
    474     if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx])
    475 #else
    476     if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay)
    477 #endif
    478     {
    479        not_displayed++;
    480     }
    481     iterPic++;
    482   }
    483   iterPic   = pcListPic->begin();
     446  Int numPicsNotYetDisplayed = 0;
    484447 
    485448  while (iterPic != pcListPic->end())
    486449  {
    487450    TComPic* pcPic = *(iterPic);
    488    
    489 #if H_MV
    490     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx]))
    491 #else
    492     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    493 #endif
    494     {
    495       // write to file
    496        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;
    497489#if H_MV
    498490      if ( m_pchReconFiles[decIdx] )
    499491#else
    500       if ( m_pchReconFile )
    501 #endif
    502       {
    503         const Window &conf = pcPic->getConformanceWindow();
    504         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    505 #if H_MV
    506 #if H_MV5
     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
    507500        assert( conf   .getScaledFlag() );
    508501        assert( defDisp.getScaledFlag() );
    509 #endif
     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();
     578#if H_MV
     579        assert( conf   .getScaledFlag() );
     580        assert( defDisp.getScaledFlag() );
    510581        m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),
    511582#else
    512         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    513 #endif
    514                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    515                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    516                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    517                                        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);
    518615      }
    519616     
    520       // update POC of display order
    521 #if H_MV
    522       m_pocLastDisplay[decIdx] = pcPic->getPOC();
    523 #else
    524       m_iPOCLastDisplay = pcPic->getPOC();
    525 #endif
    526      
    527       // erase non-referenced picture in the reference picture list after display
    528       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    529       {
    530 #if !DYN_REF_FREE
    531         pcPic->setReconMark(false);
    532        
    533         // mark it should be extended later
    534         pcPic->getPicYuvRec()->setBorderExtension( false );
    535        
    536 #else
    537         pcPic->destroy();
    538         pcListPic->erase( iterPic );
    539         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    540         continue;
    541 #endif
    542       }
    543       pcPic->setOutputMark(false);
    544     }
    545    
    546     iterPic++;
    547   }
    548 }
    549 
     617      iterPic++;
     618    }
     619  }
     620}
    550621/** \param pcListPic list of pictures to be written to file
    551622    \todo            DYN_REF_FREE should be revised
     
    560631  {
    561632    return;
    562   } 
     633  }
    563634  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
    564 
     635 
    565636  iterPic   = pcListPic->begin();
     637  TComPic* pcPic = *(iterPic);
    566638 
    567   while (iterPic != pcListPic->end())
    568   {
    569     TComPic* pcPic = *(iterPic);
    570 
    571     if ( pcPic->getOutputMark() )
    572     {
    573       // 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
    574653#if H_MV
    575654      if ( m_pchReconFiles[decIdx] )
    576655#else
    577       if ( m_pchReconFile )
    578 #endif
    579       {
    580         const Window &conf = pcPic->getConformanceWindow();
    581         const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    582 #if H_MV
    583 #if H_MV5
     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
    584663        assert( conf   .getScaledFlag() );
    585664        assert( defDisp.getScaledFlag() );
    586 #endif
     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 H_MV
     742      if ( m_pchReconFiles[decIdx] )
     743#else
     744        if ( m_pchReconFile )
     745#endif
     746        {
     747          const Window &conf = pcPic->getConformanceWindow();
     748          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
     749#if H_MV
     750        assert( conf   .getScaledFlag() );
     751        assert( defDisp.getScaledFlag() );
    587752        m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),
    588753#else
    589         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    590 #endif
    591                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    592                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    593                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    594                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    595       }
    596      
    597       // update POC of display order
     754          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     755#endif
     756                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     757                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     758                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     759                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
     760        }
     761       
     762        // update POC of display order
    598763#if H_MV
    599764      m_pocLastDisplay[decIdx] = pcPic->getPOC();
    600765#else
    601       m_iPOCLastDisplay = pcPic->getPOC();
    602 #endif
    603      
    604       // erase non-referenced picture in the reference picture list after display
    605       if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
    606       {
     766        m_iPOCLastDisplay = pcPic->getPOC();
     767#endif
     768       
     769        // erase non-referenced picture in the reference picture list after display
     770        if ( !pcPic->getSlice(0)->isReferenced() && pcPic->getReconMark() == true )
     771        {
    607772#if !DYN_REF_FREE
    608         pcPic->setReconMark(false);
    609        
    610         // mark it should be extended later
    611         pcPic->getPicYuvRec()->setBorderExtension( false );
    612        
    613 #else
    614         pcPic->destroy();
    615         pcListPic->erase( iterPic );
    616         iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
    617         continue;
    618 #endif
    619       }
    620       pcPic->setOutputMark(false);
    621     }
     773          pcPic->setReconMark(false);
     774         
     775          // mark it should be extended later
     776          pcPic->getPicYuvRec()->setBorderExtension( false );
     777         
     778#else
     779          pcPic->destroy();
     780          pcListPic->erase( iterPic );
     781          iterPic = pcListPic->begin(); // to the beginning, non-efficient way, have to be revised!
     782          continue;
     783#endif
     784        }
     785        pcPic->setOutputMark(false);
     786      }
    622787#if !H_MV
    623788#if !DYN_REF_FREE
    624     if(pcPic)
    625     {
    626       pcPic->destroy();
    627       delete pcPic;
    628       pcPic = NULL;
    629     }
    630 #endif
    631 #endif
    632     iterPic++;
     789      if(pcPic)
     790      {
     791        pcPic->destroy();
     792        delete pcPic;
     793        pcPic = NULL;
     794      }
     795#endif   
     796#endif
     797      iterPic++;
     798    }
    633799  }
    634800#if H_MV
  • trunk/source/App/TAppDecoder/TAppDecTop.h

    r608 r655  
    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.