Opened 10 years ago

Closed 10 years ago

#47 closed defect (fixed)

PTL init in TAppEncTop.cpp

Reported by: jaypadia Owned by: Vadim
Priority: minor Milestone: SHM-8.0
Component: SHM software Version: SHM-6.1
Keywords: Profile Tier Cc: Vadim, jct-vc@…

Description

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)

comment:1 Changed 10 years ago by DefaultCC Plugin

  • Cc Vadim jct-vc@… added

comment:2 in reply to: ↑ description Changed 10 years ago by fhendry

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.

comment:3 Changed 10 years ago by Vadim

  • Resolution set to fixed
  • Status changed from new to closed

fixed with rev 976

Note: See TracTickets for help on using tickets.

This list contains all users that will be notified about changes made to this ticket.

These roles will be notified: Reporter, Owner, Subscriber, Participant

  • Gerhard Tech(Always)
  • Hendry(Participant)
  • Jay Padia(Reporter)
  • jct-vc@…(Subscriber)
  • Karsten Suehring(Always)
  • Vadim Seregin(Owner, Subscriber, Participant)