Changeset 411 in SHVCSoftware


Ignore:
Timestamp:
8 Oct 2013, 08:00:50 (11 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
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.cpp

    r409 r411  
    7171, m_iDepth                        ( 0 )
    7272, m_bRefenced                     ( false )
     73#if POC_RESET_FLAG
     74, m_bPocResetFlag                 ( false )
     75#endif
    7376#if SH_DISCARDABLE_FLAG
    7477, m_bDiscardableFlag              ( false )
     
    269272    pcPic = *(iterPic);
    270273  }
     274#if POC_RESET_FLAG
     275    assert( pcPic->getSlice(0)->isReferenced() );
     276#endif
    271277  return  pcPic;
    272278}
     
    27682774    return;
    27692775  }       
     2776#if POC_RESET_FLAG
     2777  if( this->getPocResetFlag() )
     2778  {
     2779    setBaseColPic(refLayerIdc, xGetRefPic(rcListPic, 0));
     2780  }
     2781  else
     2782  {
     2783    setBaseColPic(refLayerIdc, xGetRefPic(rcListPic, getPOC()));
     2784  }
     2785#else
    27702786  setBaseColPic(refLayerIdc, xGetRefPic(rcListPic, getPOC()));
     2787#endif
    27712788}
    27722789#endif
     
    27822799    //set reference picture POC of each ILP reference
    27832800    Int thePoc = ilpPic[refLayerIdc]->getPOC();
    2784     assert(thePoc >= 0); 
     2801    assert(thePoc >= 0);
    27852802    assert(thePoc == pcRefPicBL->getPOC());
    27862803
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TComSlice.h

    r409 r411  
    15681568  Bool        m_bRefenced;
    15691569 
     1570#if POC_RESET_FLAG
     1571  Bool        m_bPocResetFlag;
     1572  Int         m_pocValueBeforeReset;
     1573#endif 
    15701574#if SH_DISCARDABLE_FLAG
    15711575  Bool        m_bDiscardableFlag;
    15721576#endif
    1573 
    15741577  // access channel
    15751578  TComVPS*    m_pcVPS;
     
    17301733#endif
    17311734
     1735#if POC_RESET_FLAG
     1736  Bool      getPocResetFlag  ()                              { return m_bPocResetFlag; }
     1737  Void      setPocResetFlag  (Bool b)                        { m_bPocResetFlag = b; }
     1738  Int       getPocValueBeforeReset ()                        { return m_pocValueBeforeReset; }
     1739  Void      setPocValueBeforeReset (Int x)                   { m_pocValueBeforeReset = x ; }
     1740#endif
    17321741#if SH_DISCARDABLE_FLAG
    17331742  Bool      getDiscardableFlag  ()                              { return m_bDiscardableFlag; }
  • branches/SHM-3.1-dev/source/Lib/TLibCommon/TypeDef.h

    r410 r411  
    4949#define VPS_NUH_LAYER_ID                 1      ///< N0085: Assert that the nuh_layer_id of VPS NAL unit should be 0
    5050#if SVC_EXTENSION
     51#define POC_RESET_FLAG                1         ///< N0244: POC reset flag for  layer pictures.
    5152#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
    5253#define REPN_FORMAT_IN_VPS               1      ///< N0092: Signal represenation format (spatial resolution, bit depth, colour format) in the VPS
  • branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r409 r411  
    14391439  if(!rpcSlice->getDependentSliceSegmentFlag())
    14401440  {
    1441 
     1441#if POC_RESET_FLAG
     1442    Int i = 0;
     1443    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > i)
     1444    {
     1445      READ_FLAG(uiCode, "poc_reset_flag");      rpcSlice->setPocResetFlag( uiCode ? true : false );
     1446      i++;
     1447    }
     1448    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > i)
     1449    {
     1450      READ_FLAG(uiCode, "discardable_flag"); // ignored
     1451      i++;
     1452    }
     1453    for (; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++)
     1454    {
     1455      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
     1456    }
     1457#else
    14421458#if SH_DISCARDABLE_FLAG
    14431459    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits()>0)
     
    14541470      READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
    14551471    }
     1472#endif
    14561473#endif
    14571474
  • branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r410 r411  
    647647
    648648#if SVC_EXTENSION
     649#if POC_RESET_FLAG
     650Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC )
     651#else
    649652Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC )
     653#endif
    650654#else
    651655Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay )
     
    780784  }
    781785  m_bFirstSliceInSequence = false;
     786#if POC_RESET_FLAG
     787  // This operation would do the following:
     788  // 1. Update the other picture in the DPB. This should be done only for the first slice of the picture.
     789  // 2. Update the value of m_pocCRA.
     790  // 3. Reset the POC values at the decoder for the current picture to be zero.
     791  // 4. update value of POCLastDisplay
     792  if( m_apcSlicePilot->getPocResetFlag() )
     793  {
     794    if( m_apcSlicePilot->getSliceIdx() == 0 )
     795    {
     796      Int pocAdjustValue = m_apcSlicePilot->getPOC();
     797
     798      // If poc reset flag is set to 1, reset all POC for DPB -> basically do it for each slice in the picutre
     799      TComList<TComPic*>::iterator  iterPic = m_cListPic.begin(); 
     800
     801      // Iterate through all picture in DPB
     802      while( iterPic != m_cListPic.end() )
     803      {
     804        TComPic *dpbPic = *iterPic;
     805        // Check if the picture pointed to by iterPic is either used for reference or
     806        // needed for output, are in the same layer, and not the current picture.
     807        if( /*  ( ( dpbPic->getSlice(0)->isReferenced() ) || ( dpbPic->getOutputMark() ) )
     808            &&*/ ( dpbPic->getLayerId() == m_apcSlicePilot->getLayerId() )
     809              && ( dpbPic->getReconMark() )
     810          )
     811        {
     812          for(Int i = dpbPic->getNumAllocatedSlice()-1; i >= 0; i--)
     813          {
     814
     815            TComSlice *slice = dpbPic->getSlice(i);
     816            TComReferencePictureSet *rps = slice->getRPS();
     817            slice->setPOC( slice->getPOC() - pocAdjustValue );
     818
     819            // Also adjust the POC value stored in the RPS of each such slice
     820            for(Int j = rps->getNumberOfPictures(); j >= 0; j--)
     821            {
     822              rps->setPOC( j, rps->getPOC(j) - pocAdjustValue );
     823            }
     824            // Also adjust the value of refPOC
     825            for(Int k = 0; k < 2; k++)  // For List 0 and List 1
     826            {
     827              RefPicList list = (k == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     828              for(Int j = 0; j < slice->getNumRefIdx(list); j++)
     829              {
     830                slice->setRefPOC( slice->getRefPOC(list, j) - pocAdjustValue, list, j);
     831              }
     832            }
     833          }
     834        }
     835        iterPic++;
     836      }
     837      // Update the value of pocCRA
     838      m_pocCRA -= pocAdjustValue;
     839      // Update value of POCLastDisplay
     840      iPOCLastDisplay -= pocAdjustValue;
     841    }
     842    // Reset current poc for current slice and RPS
     843    m_apcSlicePilot->setPOC( 0 );
     844  }
     845#endif
    782846  //detect lost reference picture and insert copy of earlier frame.
    783847  Int lostPoc;
  • branches/SHM-3.1-dev/source/Lib/TLibDecoder/TDecTop.h

    r389 r411  
    229229  Void      xActivateParameterSets();
    230230#if SVC_EXTENSION
     231#if POC_RESET_FLAG
     232  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int &iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
     233#else
    231234  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay, UInt& curLayerId, Bool& bNewPOC);
     235#endif
    232236#else
    233237  Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
  • 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.