PTL init in TAppEncTop.cpp
There's a potential bug in the following code from rev 941 in TAppEncTop.cpp :: line 205
#if MULTIPLE_PTL_SUPPORT
Populate PTL in VPS
TComVPS *pVPS = m_acTEncTop[0].getVPS();
ProfileTierLevel& profileTierLevel = *(pVPS->getPTL(0)->getGeneralPTL());
for (int ii = 0; ii < m_numPTLInfo; ii++)
{
profileTierLevel = *(pVPS->getPTL(ii)->getGeneralPTL());
profileTierLevel.setLevelIdc(m_levelList[ii]);
profileTierLevel.setTierFlag(m_levelTierList[ii]);
profileTierLevel.setProfileIdc(m_profileList[ii]);
profileTierLevel.setProfileCompatibilityFlag(m_profileCompatibility[ii], 1);
profileTierLevel.setProgressiveSourceFlag(m_progressiveSourceFlagList[ii]);
profileTierLevel.setInterlacedSourceFlag(m_interlacedSourceFlagList[ii]);
profileTierLevel.setNonPackedConstraintFlag(m_nonPackedConstraintFlagList[ii]);
profileTierLevel.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlagList[ii]);
}
pVPS->setNumProfileTierLevel(m_numPTLInfo);
ProfileTierLevel& profileTierLevel = *(pVPS->getPTL(0)->getGeneralPTL()); --- defines 'profileTierLevel' as a reference bound to *(pVPS->getPTL(0)->getGeneralPTL()).
Then later tries to use that reference to modify *(pVPS->getPTL(ii)->getGeneralPTL()).
If the loop needs to modify other PTL structures, it won't work.
Why not use a pointer?
ProfileTierLevel *profileTierLevel = pVPS->getPTL(0)->getGeneralPTL();
for (int ii = 0; ii < m_numPTLInfo; ii++)
{
profileTierLevel = pVPS->getPTL(ii)->getGeneralPTL();
profileTierLevel->setLevelIdc(m_levelList[ii]);
profileTierLevel->setTierFlag(m_levelTierList[ii]);
profileTierLevel->setProfileIdc(m_profileList[ii]);
profileTierLevel->setProfileCompatibilityFlag(m_profileCompatibility[ii], 1);
profileTierLevel->setProgressiveSourceFlag(m_progressiveSourceFlagList[ii]);
profileTierLevel->setInterlacedSourceFlag(m_interlacedSourceFlagList[ii]);
profileTierLevel->setNonPackedConstraintFlag(m_nonPackedConstraintFlagList[ii]);
profileTierLevel->setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlagList[ii]);
Change history (3)
-
Resolution
set to fixed
-
Status
changed from new to closed
|
Replying to jaypadia:
Right. The use of reference at that place is dangerous as the second PTL and so forth will not be recorded. Fix similar to the suggested solution has been committed into rev 976.
Instead of changing reference into pointer, it is better to remove that variable and access the GeneralPTL directly.