Changeset 411 in SHVCSoftware for branches/SHM-3.1-dev/source/Lib/TLibEncoder


Ignore:
Timestamp:
8 Oct 2013, 08:00:50 (12 years ago)
Author:
qualcomm
Message:

JCTVC-N0244: Signaling of poc_reset_flag in the slice header (MACRO: POC_RESET_FLAG)

Signal poc_reset_flag in slice header, which will reset POC value of the current picture and decrement the POC of pictures in the DPB.

From: Adarsh K. Ramasubramonian <aramasub@…>

Location:
branches/SHM-3.1-dev/source/Lib/TLibEncoder
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r409 r411  
    11051105  {
    11061106
     1107#if POC_RESET_FLAG
     1108    Int i = 0;
     1109    if( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > i )
     1110    {
     1111      WRITE_FLAG( pcSlice->getPocResetFlag(), "poc_reset_flag" );
     1112      i++;
     1113    }
     1114    if( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > i )
     1115    {
     1116      assert(!!"discardable_flag");
     1117      WRITE_FLAG(pcSlice->getDiscardableFlag(), "discardable_flag");
     1118      i++;
     1119    }
     1120    for ( ; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
     1121    {
     1122      assert(!!"slice_reserved_undetermined_flag[]");
     1123      WRITE_FLAG(0, "slice_reserved_undetermined_flag[]");
     1124    }
     1125#else
    11071126#if SH_DISCARDABLE_FLAG
    11081127    if (pcSlice->getPPS()->getNumExtraSliceHeaderBits()>0)
     
    11221141      WRITE_FLAG(0, "slice_reserved_undetermined_flag[]");
    11231142    }
     1143#endif
    11241144#endif
    11251145
     
    11431163    if( !pcSlice->getIdrPicFlag() )
    11441164    {
     1165#if POC_RESET_FLAG
     1166      Int picOrderCntLSB;
     1167      if( !pcSlice->getPocResetFlag() )
     1168      {
     1169        picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC());
     1170      }
     1171      else
     1172      {
     1173        picOrderCntLSB = (pcSlice->getPocValueBeforeReset()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC());
     1174      }
     1175#else
    11451176      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC());
     1177#endif
    11461178      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
    11471179      TComReferencePictureSet* rps = pcSlice->getRPS();
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r410 r411  
    503503    m_pcSliceEncoder->initEncSlice ( pcPic, iPOCLast, pocCurr, iNumPicRcvd, iGOPid, pcSlice, m_pcEncTop->getSPS(), m_pcEncTop->getPPS() );
    504504#endif
    505 
     505#if POC_RESET_FLAG
     506    if( !pcSlice->getPocResetFlag() ) // For picture that are not reset, we should adjust the value of POC calculated from the configuration files.
     507    {
     508      // Subtract POC adjustment value until now.
     509      pcSlice->setPOC( pcSlice->getPOC() - m_pcEncTop->getPocAdjustmentValue() );
     510    }
     511    else
     512    {
     513      // Check if this is the first slice in the picture
     514      // In the encoder, the POC values are copied along with copySliceInfo, so we only need
     515      // to do this for the first slice.
     516      Int pocAdjustValue = pcSlice->getPOC() - m_pcEncTop->getPocAdjustmentValue();
     517      if( pcSlice->getSliceIdx() == 0 )
     518      {
     519        TComList<TComPic*>::iterator  iterPic = rcListPic.begin(); 
     520
     521        // Iterate through all picture in DPB
     522        while( iterPic != rcListPic.end() )
     523        {             
     524          TComPic *dpbPic = *iterPic;
     525          if( dpbPic->getPOC() == pocCurr )
     526          {
     527            if( dpbPic->getReconMark() )
     528            {
     529              assert( !( dpbPic->getSlice(0)->isReferenced() ) && !( dpbPic->getOutputMark() ) );
     530            }
     531          }
     532          // Check if the picture pointed to by iterPic is either used for reference or
     533          // needed for output, are in the same layer, and not the current picture.
     534          if( /* ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) )
     535              && */ ( dpbPic->getLayerId() == pcSlice->getLayerId() )
     536              && ( dpbPic->getReconMark() )
     537            )
     538          {
     539            for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--)
     540            {
     541              TComSlice *slice = dpbPic->getSlice(i);
     542              TComReferencePictureSet *rps = slice->getRPS();
     543              slice->setPOC( dpbPic->getSlice(i)->getPOC() - pocAdjustValue );
     544
     545              // Also adjust the POC value stored in the RPS of each such slice
     546              for(Int j = rps->getNumberOfPictures(); j >= 0; j--)
     547              {
     548                rps->setPOC( j, rps->getPOC(j) - pocAdjustValue );
     549              }
     550              // Also adjust the value of refPOC
     551              for(Int k = 0; k < 2; k++)  // For List 0 and List 1
     552              {
     553                RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     554                for(Int j = 0; j < slice->getNumRefIdx(list); j++)
     555                {
     556                  slice->setRefPOC( slice->getRefPOC(list, j) - pocAdjustValue, list, j);
     557                }
     558              }
     559            }
     560          }
     561          iterPic++;
     562        }
     563        m_pcEncTop->setPocAdjustmentValue( m_pcEncTop->getPocAdjustmentValue() + pocAdjustValue );
     564      }
     565      pcSlice->setPocValueBeforeReset( pcSlice->getPOC() - m_pcEncTop->getPocAdjustmentValue() + pocAdjustValue );
     566      pcSlice->setPOC( 0 );
     567    }
     568#endif
    506569#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    507570    if (m_pcEncTop->getAdaptiveResolutionChange() > 0 && m_layerId == 1 && pocCurr > m_pcEncTop->getAdaptiveResolutionChange())
     
    810873    {
    811874#if RESTR_CHK
     875#if POC_RESET_FLAG
     876      if ( pocCurr > 0          && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
     877#else
    812878      if (pcSlice->getPOC()>0  && pcSlice->isRADL() && pcPic->getSlice(0)->getBaseColPic(pcPic->getSlice(0)->getInterLayerPredLayerIdc(0))->getSlice(0)->isRASL())
     879#endif
    813880      {
    814881#if JCTVC_M0458_INTERLAYER_RPS_SIG
     
    10651132
    10661133      Int sliceQP = m_pcCfg->getInitialQP();
     1134#if POC_RESET_FLAG
     1135      if ( ( pocCurr == 0 && m_pcCfg->getInitialQP() > 0 ) || ( frameLevel == 0 && m_pcCfg->getForceIntraQP() ) ) // QP is specified
     1136#else
    10671137      if ( ( pcSlice->getPOC() == 0 && m_pcCfg->getInitialQP() > 0 ) || ( frameLevel == 0 && m_pcCfg->getForceIntraQP() ) ) // QP is specified
     1138#endif
    10681139      {
    10691140        Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
     
    15101581      }
    15111582      pictureTimingSEI.m_auCpbRemovalDelay = std::max<Int>(1, m_totalCoded - m_lastBPSEI); // Syntax element signalled as minus, hence the .
     1583#if POC_RESET_FLAG
     1584      pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pocCurr - m_totalCoded;
     1585#else
    15121586      pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded;
     1587#endif
    15131588      Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2;
    15141589      pictureTimingSEI.m_picDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay;
     
    16151690      SEIRecoveryPoint sei_recovery_point;
    16161691      sei_recovery_point.m_recoveryPocCnt    = 0;
     1692#if POC_RESET_FLAG
     1693      sei_recovery_point.m_exactMatchingFlag = ( pocCurr == 0 ) ? (true) : (false);
     1694#else
    16171695      sei_recovery_point.m_exactMatchingFlag = ( pcSlice->getPOC() == 0 ) ? (true) : (false);
     1696#endif
    16181697      sei_recovery_point.m_brokenLinkFlag    = false;
    16191698
     
    17511830          tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits();
    17521831#endif
     1832
    17531833          m_pcEntropyCoder->encodeSliceHeader(pcSlice);
     1834
    17541835#if RATE_CONTROL_LAMBDA_DOMAIN
    17551836          actualHeadBits += ( m_pcEntropyCoder->getNumberOfWrittenBits() - tmpBitsBeforeWriting );
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r405 r411  
    9292#endif
    9393#endif
     94#if POC_RESET_FLAG
     95  m_pocAdjustmentValue     = 0;
     96#endif
    9497}
    9598
     
    898901  m_cPPS.setSPSId         ( m_iSPSIdCnt         );
    899902#endif
     903#if POC_RESET_FLAG
     904  m_cPPS.setNumExtraSliceHeaderBits( 2 );
     905#endif
    900906}
    901907
  • branches/SHM-3.1-dev/source/Lib/TLibEncoder/TEncTop.h

    r377 r411  
    144144#endif
    145145#endif
     146#if POC_RESET_FLAG
     147  Int                     m_pocAdjustmentValue;
     148#endif
    146149protected:
    147150  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
     
    243246
    244247  void printSummary() { m_cGOPEncoder.printOutSummary (m_uiNumAllPicCoded); }
     248#if POC_RESET_FLAG
     249  Int  getPocAdjustmentValue()      { return m_pocAdjustmentValue;}
     250  Void setPocAdjustmentValue(Int x) { m_pocAdjustmentValue = x;   }
     251#endif
    245252};
    246253
Note: See TracChangeset for help on using the changeset viewer.