﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
770	Decoder cannot parse generated bistream when FastMrg is set to 0 and MMVD is set to 0.	tsukuba.takeshi		"At xChecRDCostMerge2Nx2N() in latest VTM(b62fc0cd), MMVD candidates to be tested are always inserted into RdModeList regardless of the value of tempCS->sps->getUseMMVD() as below:

{{{
  static_vector<ModeInfo, MRG_MAX_NUM_CANDS + MMVD_ADD_NUM>  RdModeList;
  bool                                        mrgTempBufSet = false;

  for (int i = 0; i < MRG_MAX_NUM_CANDS + MMVD_ADD_NUM; i++)
  {
    if (i < mergeCtx.numValidMergeCand)
    {
      RdModeList.push_back(ModeInfo(i, true, false, false));
    }
    else
    {
      RdModeList.push_back(ModeInfo(std::min(MMVD_ADD_NUM, i - mergeCtx.numValidMergeCand), false, true, false));
    }
  }

}}}
 
When FastMrg is set to 0 and MMVD is set to 0, decoder cannot parse generated bitstream.

{{{
./EncoderApp -c encoder_randomaccess_vtm.cfg -q 37 -i RaceHorses_416x240_30.yuv -b str.qp37.rap00.bin -o rec.qp37.rap00.yuv --InputBitDepth=8 --InputChromaFormat=420 -fr 30 -wdt 416 -hgt 240 --Level=2.1 -f 2 -fs 0 -ip 32 --FastMrg=0 --MMVD=0 --SEIDecodedPictureHash=1 --PrintHexPSNR=1 

./DecoderApp -b str.qp37.rap00.bin -o dec.qp37.rap00.yuv 
...
ERROR: In function ""DecSlice::decompressSlice"" in VVCSoftware_VTM.git\source\Lib\DecoderLib\DecSlice.cpp:284: Expecting a terminating bit
}}}

Same behavior is observed in VTM-7.1.

Suggested fix is as blow:
{{{
  static_vector<ModeInfo, MRG_MAX_NUM_CANDS + MMVD_ADD_NUM>  RdModeList;
  bool                                        mrgTempBufSet = false;

  for (int i = 0; i < MRG_MAX_NUM_CANDS + MMVD_ADD_NUM; i++)
  {
    if (i < mergeCtx.numValidMergeCand)
    {
      RdModeList.push_back(ModeInfo(i, true, false, false));
    }
    else
    {
      if(!tempCS->sps->getUseMMVD()) break;
      RdModeList.push_back(ModeInfo(std::min(MMVD_ADD_NUM, i - mergeCtx.numValidMergeCand), false, true, false));
    }
  }
}}}

"	defect	closed	minor	VTM-7.2	VTM	VTM-7.0	fixed		ksuehring XiangLi fbossen jvet@…
