Ticket #835: invalid_sps_bug.patch

File invalid_sps_bug.patch, 11.3 KB (added by bheng, 11 years ago)
  • source/App/TAppDecoder/TAppDecTop.cpp

     
    256256  while (iterPic != pcListPic->end())
    257257  {
    258258    TComPic* pcPic = *(iterPic);
    259     TComSPS *sps = pcPic->getSlice(0)->getSPS();
    260259   
    261     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getSlice(0)->getSPS()->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
     260    if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    262261    {
    263262      // write to file
    264263       not_displayed--;
    265264      if ( m_pchReconFile )
    266265      {
    267         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
     266        m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), pcPic->getPicCropLeftOffset(), pcPic->getPicCropRightOffset(), pcPic->getPicCropTopOffset(), pcPic->getPicCropBottomOffset() );
    268267      }
    269268     
    270269      // update POC of display order
     
    309308  while (iterPic != pcListPic->end())
    310309  {
    311310    TComPic* pcPic = *(iterPic);
    312     TComSPS *sps = pcPic->getSlice(0)->getSPS();
    313311
    314312    if ( pcPic->getOutputMark() )
    315313    {
    316314      // write to file
    317315      if ( m_pchReconFile )
    318316      {
    319         m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), sps->getPicCropLeftOffset(), sps->getPicCropRightOffset(), sps->getPicCropTopOffset(), sps->getPicCropBottomOffset() );
     317        m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(), pcPic->getPicCropLeftOffset(), pcPic->getPicCropRightOffset(), pcPic->getPicCropTopOffset(), pcPic->getPicCropBottomOffset() );
    320318      }
    321319     
    322320      // update POC of display order
  • source/Lib/TLibCommon/TComPic.cpp

     
    7373{
    7474}
    7575
    76 Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Bool bIsVirtual )
     76Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth,
     77                                          Bool picCroppingFlag, Int picCropLeftOffset, Int picCropRightOffset, Int picCropTopOffset, Int picCropBottomOffset,
     78                                          Int *numReorderPics, Bool bIsVirtual)
     79
    7780{
    7881  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
    7982  if (!bIsVirtual)
     
    8588  /* there are no SEI messages associated with this picture initially */
    8689  m_SEIs = NULL;
    8790  m_bUsedByCurr = false;
     91
     92  /* store cropping parameters with picture */
     93  m_picCroppingFlag = picCroppingFlag;
     94  m_picCropLeftOffset = picCropLeftOffset;
     95  m_picCropRightOffset = picCropRightOffset;
     96  m_picCropTopOffset = picCropTopOffset;
     97  m_picCropBottomOffset = picCropBottomOffset;
     98
     99  /* store number of reorder pics with picture */
     100  memcpy(m_numReorderPics, numReorderPics, MAX_TLAYER*sizeof(Int));
     101
    88102  return;
    89103}
    90104
  • source/Lib/TLibCommon/TComPic.h

     
    7777  Bool                  m_bIndependentTileBoundaryForNDBFilter;
    7878  TComPicYuv*           m_pNDBFilterYuvTmp;    //!< temporary picture buffer when non-cross slice/tile boundary in-loop filtering is enabled
    7979  Bool                  m_bCheckLTMSB;
     80 
     81  Int                   m_numReorderPics[MAX_TLAYER];
     82  Bool                  m_picCroppingFlag;
     83  Int                   m_picCropLeftOffset;
     84  Int                   m_picCropRightOffset;
     85  Int                   m_picCropTopOffset;
     86  Int                   m_picCropBottomOffset;
     87
    8088  std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink;
    8189
    8290  SEImessages* m_SEIs; ///< Any SEI messages that have been received.  If !NULL we own the object.
     
    8593  TComPic();
    8694  virtual ~TComPic();
    8795 
    88   Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Bool bIsVirtual = false );
     96  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth,
     97                                            Bool picCroppingFlag, Int picCropLeftOffset, Int picCropRightOffset, Int picCropTopOffset, Int picCropBottomOffset,
     98                                                Int *numReorderPics, Bool bIsVirtual = false );
     99                       
    89100  virtual Void  destroy();
    90101 
    91102  UInt          getTLayer()                { return m_uiTLayer;   }
     
    133144  Void          setOutputMark (Bool b) { m_bNeededForOutput = b;     }
    134145  Bool          getOutputMark ()       { return m_bNeededForOutput;  }
    135146 
     147  Void          setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i;    }
     148  Int           getNumReorderPics(UInt tlayer)        { return m_numReorderPics[tlayer]; }
     149  Bool          getPicCroppingFlag() const            { return m_picCroppingFlag; }
     150  Void          setPicCroppingFlag(Bool val)          { m_picCroppingFlag = val; }
     151  Int           getPicCropLeftOffset() const          { return m_picCropLeftOffset; }
     152  Void          setPicCropLeftOffset(Int val)         { m_picCropLeftOffset = val; }
     153  Int           getPicCropRightOffset() const         { return m_picCropRightOffset; }
     154  Void          setPicCropRightOffset(Int val)        { m_picCropRightOffset = val; }
     155  Int           getPicCropTopOffset() const           { return m_picCropTopOffset; }
     156  Void          setPicCropTopOffset(Int val)          { m_picCropTopOffset = val; }
     157  Int           getPicCropBottomOffset() const        { return m_picCropBottomOffset; }
     158  Void          setPicCropBottomOffset(Int val)       { m_picCropBottomOffset = val; }
     159
    136160  Void          compressMotion();
    137161  UInt          getCurrSliceIdx()            { return m_uiCurrSliceIdx;                }
    138162  Void          setCurrSliceIdx(UInt i)      { m_uiCurrSliceIdx = i;                   }
  • source/Lib/TLibDecoder/TDecTop.cpp

     
    130130
    131131Void TDecTop::xGetNewPicBuffer ( TComSlice* pcSlice, TComPic*& rpcPic )
    132132{
     133  Int  tlayer;
     134  Int  numReorderPics[MAX_TLAYER];
     135  Bool picCroppingFlag      = pcSlice->getSPS()->getPicCroppingFlag();
     136  Int  picCropLeftOffset    = pcSlice->getSPS()->getPicCropLeftOffset();
     137  Int  picCropRightOffset   = pcSlice->getSPS()->getPicCropRightOffset();
     138  Int  picCropTopOffset     = pcSlice->getSPS()->getPicCropTopOffset();
     139  Int  picCropBottomOffset  = pcSlice->getSPS()->getPicCropBottomOffset();
     140
     141  for(tlayer=0; tlayer<MAX_TLAYER; tlayer++) {
     142    numReorderPics[tlayer] = pcSlice->getSPS()->getNumReorderPics(tlayer);
     143  }
     144
    133145  xUpdateGopSize(pcSlice);
    134146 
    135147  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded
     
    137149  {
    138150    rpcPic = new TComPic();
    139151   
    140     rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
     152    rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     153                         picCroppingFlag, picCropLeftOffset, picCropRightOffset, picCropTopOffset, picCropBottomOffset, numReorderPics, true);
    141154    rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
    142155    m_cListPic.pushBack( rpcPic );
    143156   
     
    174187    m_cListPic.pushBack( rpcPic );
    175188  }
    176189  rpcPic->destroy();
    177   rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
     190  rpcPic->create ( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     191                       picCroppingFlag, picCropLeftOffset, picCropRightOffset, picCropTopOffset, picCropBottomOffset, numReorderPics, true);
    178192  rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
    179193}
    180194
  • source/Lib/TLibEncoder/TEncPic.cpp

     
    125125 * \param bIsVirtual
    126126 * \return Void
    127127 */
    128 Void TEncPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual )
     128Void TEncPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, 
     129                                          Bool picCroppingFlag, Int picCropLeftOffset, Int picCropRightOffset,
     130                                          Int picCropTopOffset, Int picCropBottomOffset, Int *numReorderPics, Bool bIsVirtual )
    129131{
    130   TComPic::create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, bIsVirtual );
     132  TComPic::create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, 
     133                                   picCroppingFlag, picCropLeftOffset, picCropRightOffset, picCropTopOffset, picCropBottomOffset,
     134                                   numReorderPics, bIsVirtual );
    131135  m_uiMaxAQDepth = uiMaxAQDepth;
    132136  if ( uiMaxAQDepth > 0 )
    133137  {
  • source/Lib/TLibEncoder/TEncPic.h

     
    102102  TEncPic();
    103103  virtual ~TEncPic();
    104104
    105   Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth, Bool bIsVirtual = false );
     105  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, UInt uiMaxAQDepth,   
     106                                          Bool picCroppingFlag, Int picCropLeftOffset, Int picCropRightOffset, Int picCropTopOffset, Int picCropBottomOffset,
     107                                          Int *numReorderPics, Bool bIsVirtual = false );
    106108  virtual Void  destroy();
    107109
    108110  TEncPicQPAdaptationLayer* getAQLayer( UInt uiDepth )  { return &m_acAQLayer[uiDepth]; }
  • source/Lib/TLibEncoder/TEncTop.cpp

     
    403403    if ( getUseAdaptiveQP() )
    404404    {
    405405      TEncPic* pcEPic = new TEncPic;
    406       pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 );
     406      pcEPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, m_cPPS.getMaxCuDQPDepth()+1 ,
     407                  (m_croppingMode>0), m_cropLeft, m_cropRight, m_cropTop, m_cropBottom, m_numReorderPics);
    407408      rpcPic = pcEPic;
    408409    }
    409410    else
    410411    {
    411412      rpcPic = new TComPic;
    412       rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
     413         
     414      rpcPic->create( m_iSourceWidth, m_iSourceHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth,
     415                  (m_croppingMode>0), m_cropLeft, m_cropRight, m_cropTop, m_cropBottom, m_numReorderPics);
    413416    }
    414417    if (getUseSAO())
    415418    {