Ticket #287: num_reorder_frames_r2.patch

File num_reorder_frames_r2.patch, 13.2 KB (added by jonatan, 12 years ago)

Crash fix and default value change.

  • source/App/TAppDecoder/TAppDecTop.cpp

     
    272272   
    273273#if G1002_RPS
    274274#if G1002_IDR_POC_ZERO_BUGFIX
    275     if ( pcPic->getOutputMark() && (not_displayed >  m_cTDecTop.getSPS()->getMaxNumberOfReorderPictures() && pcPic->getPOC() > m_iPOCLastDisplay))
     275    if ( pcPic->getOutputMark() && (not_displayed >  m_cTDecTop.getSPS()->getNumReorderFrames() && pcPic->getPOC() > m_iPOCLastDisplay))
    276276#else
    277277    if ( pcPic->getReconMark() && not_displayed >  m_cTDecTop.getSPS()->getMaxNumberOfReorderPictures() && pcPic->getPOC() > m_iPOCLastDisplay)
    278278#endif
  • source/App/TAppEncoder/TAppEncCfg.cpp

     
    188188  ("DecodingRefreshType,-dr",m_iDecodingRefreshType, 0, "intra refresh, (0:none 1:CDR 2:IDR)")
    189189  ("GOPSize,g",      m_iGOPSize,      1, "GOP size of temporal structure")
    190190#if G1002_RPS
    191   ("MaxNumberOfReorderPictures",   m_uiMaxNumberOfReorderPictures,   4u, "Max number of reorder pictures")
    192   ("MaxNumberOfReferencePictures", m_uiMaxNumberOfReferencePictures, 6u, "Max number of reference pictures")
     191  ("MaxNumberOfReorderPictures",   m_numReorderFrames,               -1, "Max. number of reorder pictures: 0: encoder determines value, >0: set explicitly")
     192  ("MaxNumberOfReferencePictures", m_uiMaxNumberOfReferencePictures, 6u, "Max. number of reference pictures")
    193193#else
    194194  ("RateGOPSize,-rg",m_iRateGOPSize, -1, "GOP size of hierarchical QP assignment (-1: implies inherit GOPSize value)")
    195195  ("NumOfReference,r",       m_iNumOfReference,     1, "Number of reference (P)")
     
    654654    bIsOK[i]=false;
    655655  }
    656656  Int iNumOK=0;
    657   m_uiMaxNumberOfReorderPictures=0;
     657  Int numReorderFramesRequired=0;
    658658  m_uiMaxNumberOfReferencePictures=0;
    659659  Int iLastDisp = -1;
    660660  m_iExtraRPSs=0;
     
    840840        if(aRefList[i]>iLastDisp)
    841841          iNonDisplayed++;
    842842      }
    843       if(iNonDisplayed>m_uiMaxNumberOfReorderPictures)
    844         m_uiMaxNumberOfReorderPictures=iNonDisplayed;
     843      if(iNonDisplayed>numReorderFramesRequired)
     844      {
     845        numReorderFramesRequired=iNonDisplayed;
     846      }
    845847    }
    846848    iCheckGOP++;
    847849  }
     850  if (m_numReorderFrames == -1)
     851  {
     852    m_numReorderFrames = numReorderFramesRequired;
     853  }
    848854  xConfirmPara(bError_GOP,"Invalid GOP structure given");
    849855  for(Int i=0; i<m_iGOPSize; i++)
    850856  {
    851857    xConfirmPara(m_pcGOPList[i].m_iSliceType!='B'&&m_pcGOPList[i].m_iSliceType!='P', "Slice type must be equal to B or P");
    852858  }
    853   xConfirmPara( m_bUseLComb==false && m_uiMaxNumberOfReorderPictures!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" );  // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1.
     859  xConfirmPara( m_bUseLComb==false && m_numReorderFrames!=0, "ListCombination can only be 0 in low delay coding (more precisely when L0 and L1 are identical)" );  // Note however this is not the full necessary condition as ref_pic_list_combination_flag can only be 0 if L0 == L1.
     860  xConfirmPara( m_numReorderFrames < numReorderFramesRequired, "For the used GOP the encoder requires more pictures for reordering than specified in MaxNumberOfReorderPictures" );
    854861#else
    855862#if REF_SETTING_FOR_LD
    856863  xConfirmPara( m_bUseNewRefSetting && m_iGOPSize>1, "New reference frame setting was only designed for LD setting" );
  • source/App/TAppEncoder/TAppEncCfg.h

     
    7676#if G1002_RPS
    7777  Int       m_iExtraRPSs;
    7878  GOPEntry  m_pcGOPList[MAX_GOP];
    79   UInt      m_uiMaxNumberOfReorderPictures;                   ///< total number of reorder pictures
     79  Int       m_numReorderFrames;                               ///< total number of reorder pictures
    8080  UInt      m_uiMaxNumberOfReferencePictures;                 ///< total number of reference pictures needed for decoding
    8181#else
    8282  Int       m_iRateGOPSize;                                   ///< GOP size for QP variance
  • source/App/TAppEncoder/TAppEncTop.cpp

     
    8080#if G1002_RPS
    8181  m_cTEncTop.setGopList                      ( m_pcGOPList );
    8282  m_cTEncTop.setExtraRPSs                     ( m_iExtraRPSs );
    83   m_cTEncTop.setMaxNumberOfReorderPictures   ( m_uiMaxNumberOfReorderPictures );
     83  m_cTEncTop.setNumReorderFrames             ( m_numReorderFrames );
    8484  m_cTEncTop.setMaxNumberOfReferencePictures ( m_uiMaxNumberOfReferencePictures );
    8585#else
    8686  m_cTEncTop.setRateGOPSize                  ( m_iRateGOPSize );
  • source/Lib/TLibCommon/TComSlice.cpp

     
    15981598, m_uiMaxCUDepth              (  3)
    15991599, m_uiMinTrDepth              (  0)
    16001600, m_uiMaxTrDepth              (  1)
     1601#if G1002_RPS
     1602, m_numReorderFrames          (  0)
     1603#endif
    16011604, m_uiQuadtreeTULog2MaxSize   (  0)
    16021605, m_uiQuadtreeTULog2MinSize   (  0)
    16031606, m_uiQuadtreeTUMaxDepthInter (  0)
     
    16501653#endif
    16511654#if MAX_DPB_AND_LATENCY
    16521655, m_uiMaxDecFrameBuffering    (  0)
    1653 , m_uiNumReorderFrames        (  0)
    16541656, m_uiMaxLatencyIncrease      (  0)
    16551657#endif
    16561658{
  • source/Lib/TLibCommon/TComSlice.h

     
    8686  UInt        m_uiMaxTrDepth;
    8787#if G1002_RPS
    8888  UInt        m_uiMaxNumberOfReferencePictures;
    89   UInt        m_uiMaxNumberOfReorderPictures;
     89  Int         m_numReorderFrames;
    9090#endif
    9191 
    9292  // Tool list
     
    172172#endif
    173173#if MAX_DPB_AND_LATENCY // These could be used later when encoder wants to set their values
    174174  UInt        m_uiMaxDecFrameBuffering;
    175   UInt        m_uiNumReorderFrames;
    176175  UInt        m_uiMaxLatencyIncrease;
    177176#endif
    178177
     
    239238#if G1002_RPS
    240239  Void setMaxNumberOfReferencePictures( UInt u ) { m_uiMaxNumberOfReferencePictures = u;    }
    241240  UInt getMaxNumberOfReferencePictures()         { return m_uiMaxNumberOfReferencePictures; }
    242   Void setMaxNumberOfReorderPictures( UInt u )   { m_uiMaxNumberOfReorderPictures = u;    }
    243   UInt getMaxNumberOfReorderPictures()           { return m_uiMaxNumberOfReorderPictures; }
     241  Void setNumReorderFrames( Int i )              { m_numReorderFrames = i;    }
     242  Int  getNumReorderFrames()                     { return m_numReorderFrames; }
    244243#endif
    245244  Void setPadX        ( Int  u ) { m_aiPad[0] = u; }
    246245  Void setPadY        ( Int  u ) { m_aiPad[1] = u; }
     
    378377#if MAX_DPB_AND_LATENCY
    379378  UInt getMaxDecFrameBuffering  ()            { return m_uiMaxDecFrameBuffering; }
    380379  Void setMaxDecFrameBuffering  ( UInt ui )   { m_uiMaxDecFrameBuffering = ui;   }
    381   UInt getNumReorderFrames      ()            { return m_uiNumReorderFrames;     }
    382   Void setNumReorderFrames      ( UInt ui )   { m_uiNumReorderFrames = ui;       }
    383380  UInt getMaxLatencyIncrease    ()            { return m_uiMaxLatencyIncrease;   }
    384381  Void setMaxLatencyIncrease    ( UInt ui )   { m_uiMaxLatencyIncrease= ui;      }
    385382#endif
  • source/Lib/TLibDecoder/TDecCAVLC.cpp

     
    531531#if G1002_RPS
    532532  READ_UVLC( uiCode,    "log2_max_pic_order_cnt_lsb_minus4" );   pcSPS->setBitsForPOC( 4 + uiCode );
    533533  READ_UVLC( uiCode,    "max_num_ref_pics" );                    pcSPS->setMaxNumberOfReferencePictures(uiCode);
    534   READ_UVLC( uiCode,    "max_num_reorder_pics" );                pcSPS->setMaxNumberOfReorderPictures(uiCode);
     534  READ_UVLC( uiCode,    "num_reorder_frames" );                  pcSPS->setNumReorderFrames(uiCode);
    535535#endif
     536#if MAX_DPB_AND_LATENCY
     537  READ_UVLC ( uiCode, "max_dec_frame_buffering");
     538  pcSPS->setMaxDecFrameBuffering( uiCode );
     539  READ_UVLC ( uiCode, "max_latency_increase");
     540  pcSPS->setMaxLatencyIncrease( uiCode );
     541#endif
    536542#if !G507_COND_4X4_ENABLE_FLAG
    537543#if DISABLE_4x4_INTER
    538544  xReadFlag( uiCode ); pcSPS->setDisInter4x4( uiCode ? true : false );
     
    691697
    692698#endif
    693699
    694 #if MAX_DPB_AND_LATENCY
    695   READ_UVLC ( uiCode, "max_dec_frame_buffering");
    696   pcSPS->setMaxDecFrameBuffering( uiCode );
    697   READ_UVLC ( uiCode, "num_reorder_frames");
    698   pcSPS->setNumReorderFrames( uiCode );
    699   READ_UVLC ( uiCode, "max_latency_increase");
    700   pcSPS->setMaxLatencyIncrease( uiCode );
    701 #endif
    702 
    703700  // Software-only flags
    704701#if NSQT
    705702  READ_FLAG( uiCode, "enable_nsqt" );
  • source/Lib/TLibDecoder/TDecTop.cpp

     
    175175  xUpdateGopSize(pcSlice);
    176176 
    177177#if G1002_RPS
    178   m_iMaxRefPicNum = pcSlice->getSPS()->getMaxNumberOfReferencePictures()+pcSlice->getSPS()->getMaxNumberOfReorderPictures() + 1; // +1 to have space for the picture currently being decoded
     178  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxNumberOfReferencePictures()+pcSlice->getSPS()->getNumReorderFrames() + 1; // +1 to have space for the picture currently being decoded
    179179#else
    180180  m_iMaxRefPicNum = max(m_iMaxRefPicNum, max(max(2, pcSlice->getNumRefIdx(REF_PIC_LIST_0)+1), m_iGopSize/2 + 2 + pcSlice->getNumRefIdx(REF_PIC_LIST_0)));
    181181 
  • source/Lib/TLibEncoder/TEncCavlc.cpp

     
    487487#if G1002_RPS
    488488  WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
    489489  WRITE_UVLC( pcSPS->getMaxNumberOfReferencePictures(), "max_num_ref_pics" );
    490   WRITE_UVLC( pcSPS->getMaxNumberOfReorderPictures(),   "max_num_reorder_pics" );
     490  WRITE_UVLC( pcSPS->getNumReorderFrames(),             "num_reorder_frames" );
    491491#endif
     492#if MAX_DPB_AND_LATENCY
     493  WRITE_UVLC(pcSPS->getMaxDecFrameBuffering(),          "max_dec_frame_buffering" );
     494  WRITE_UVLC(pcSPS->getMaxLatencyIncrease(),            "max_latency_increase"    );
     495#endif
    492496#if !G507_COND_4X4_ENABLE_FLAG
    493497#if DISABLE_4x4_INTER
    494498  xWriteFlag  ( (pcSPS->getDisInter4x4()) ? 1 : 0 );
     
    629633
    630634#endif
    631635
    632 #if MAX_DPB_AND_LATENCY
    633   WRITE_UVLC(pcSPS->getMaxDecFrameBuffering(),          "max_dec_frame_buffering" );
    634   WRITE_UVLC(pcSPS->getNumReorderFrames(),              "max_reorder_frames"      );
    635   WRITE_UVLC(pcSPS->getMaxLatencyIncrease(),            "max_latency_increase"    );
    636 #endif
    637  
    638636  // Software-only flags
    639637#if NSQT
    640638  WRITE_FLAG( pcSPS->getUseNSQT(), "enable_nsqt" );
  • source/Lib/TLibEncoder/TEncCfg.h

     
    117117  GOPEntry  m_pcGOPList[MAX_GOP];
    118118  Int       m_iExtraRPSs;
    119119  UInt      m_uiMaxNumberOfReferencePictures;
    120   UInt      m_uiMaxNumberOfReorderPictures;
     120  Int       m_numReorderFrames;
    121121#else
    122122  Int       m_iRateGOPSize;
    123123  Int       m_iNumOfReference;
     
    342342  Void      setExtraRPSs                    ( Int   i )      { m_iExtraRPSs = i; }
    343343  GOPEntry  getGOPEntry                     ( Int   i )      { return m_pcGOPList[i]; }
    344344  Void      setMaxNumberOfReferencePictures ( UInt u )       { m_uiMaxNumberOfReferencePictures = u;    }
    345   Void      setMaxNumberOfReorderPictures   ( UInt u )       { m_uiMaxNumberOfReorderPictures = u;    }
     345  Void      setNumReorderFrames             ( Int  i )       { m_numReorderFrames = i;    }
    346346#else
    347347  Void      setRateGOPSize                  ( Int   i )      { m_iRateGOPSize = i; }
    348348  Void      setNumOfReference               ( Int   i )      { m_iNumOfReference = i; }
     
    433433 
    434434#else
    435435  UInt      getMaxNumberOfReferencePictures ()      { return m_uiMaxNumberOfReferencePictures; }
    436   UInt      getMaxNumberOfReorderPictures   ()      { return m_uiMaxNumberOfReorderPictures; }
     436  Int       geNumReorderFrames              ()      { return m_numReorderFrames; }
    437437#endif
    438438  Int       getQP                           ()      { return  m_iQP; }
    439439 
  • source/Lib/TLibEncoder/TEncTop.cpp

     
    576576 
    577577#if G1002_RPS
    578578  m_cSPS.setMaxNumberOfReferencePictures(m_uiMaxNumberOfReferencePictures);
    579   m_cSPS.setMaxNumberOfReorderPictures(m_uiMaxNumberOfReorderPictures);
     579  m_cSPS.setNumReorderFrames(m_numReorderFrames);
    580580#endif
    581581  m_cSPS.setPCMLog2MinSize (m_uiPCMLog2MinSize);
    582582#if MAX_PCM_SIZE