Skip to content

Bug fix for no initialization of subPic info in SPS

Xiang Li requested to merge XiangLi/VVCSoftware_VTM:fix_subpic into master

Encoding crash in VS debug version was observed for the current master with following settings -c ..\cfg\encoder_randomaccess_vtm.cfg -c .\foreman.cfg -v 6 -dph 1 -f 2 --LFNST=0 --MTS=0 --MIP=0 --ISP=0 The reason is that in function void PPS::initSubPic(const SPS &sps), subPic info is copied from SPS to PPS as follows

  for (int i=0; i< getNumSubPics(); i++)
  {
    m_subPics[i].setSubPicIdx(i);
    m_subPics[i].setSubPicCtuTopLeftX(sps.getSubPicCtuTopLeftX(i));
    m_subPics[i].setSubPicCtuTopLeftY(sps.getSubPicCtuTopLeftY(i));
    m_subPics[i].setSubPicWidthInCTUs(sps.getSubPicWidth(i));
    m_subPics[i].setSubPicHeightInCTUs(sps.getSubPicHeight(i));

However, subPic info in SPS is not initialized. Consequently, very big MV may be generated with the following code in function clipMv.

  if (curSubPic.getTreatedAsPicFlag()) 
  {
    iHorMax = (curSubPic.getSubPicWidthInLumaSample() + iOffset - (int)pos.x - 1 ) << iMvShift;
    iHorMin = (-(int)sps.getMaxCUWidth() -  iOffset - ((int)pos.x - curSubPic.getSubPicLeft()) + 1) << iMvShift;

    iVerMax = (curSubPic.getSubPicHeightInLumaSample()+ iOffset - (int)pos.y - 1) << iMvShift;
    iVerMin = (-(int)sps.getMaxCUHeight() - iOffset - ((int)pos.y - curSubPic.getSubPicTop()) + 1) << iMvShift;
  }
#endif

Merge request reports