Changeset 1428 in SHVCSoftware


Ignore:
Timestamp:
5 Aug 2015, 20:23:53 (9 years ago)
Author:
seregin
Message:

fix memory allocation

Location:
branches/SHM-dev/source/Lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp

    r1420 r1428  
    239239Void TComPic::createMvScalingFactor(UInt numOfILRPs)
    240240{
    241   assert(m_mvScalingFactor[0] == NULL);
     241  // picture object might be reused and hence m_mvScalingFactor[0] can be already allocated
     242  if(m_mvScalingFactor[0])
     243  {
     244    delete m_mvScalingFactor[0];
     245  }
    242246  m_mvScalingFactor[0] = new Int[numOfILRPs];
    243247
    244   assert(m_mvScalingFactor[1] == NULL);
     248  // picture object might be reused and hence m_mvScalingFactor[1] can be already allocated
     249  if(m_mvScalingFactor[1])
     250  {
     251    delete m_mvScalingFactor[1];
     252  }
    245253  m_mvScalingFactor[1] = new Int[numOfILRPs];
    246254}
     
    248256Void TComPic::createPosScalingFactor(UInt numOfILRPs)
    249257{
    250   assert(m_posScalingFactor[0] == NULL);
     258  // picture object might be reused and hence m_posScalingFactor[0] can be already allocated
     259  if(m_posScalingFactor[0])
     260  {
     261    delete m_posScalingFactor[0];
     262  }
    251263  m_posScalingFactor[0] = new Int[numOfILRPs];
    252264
    253   assert(m_posScalingFactor[1] == NULL);
     265  // picture object might be reused and hence m_posScalingFactor[1] can be already allocated
     266  if(m_posScalingFactor[1])
     267  {
     268    delete m_posScalingFactor[1];
     269  }
    254270  m_posScalingFactor[1] = new Int[numOfILRPs];
    255271}
  • branches/SHM-dev/source/Lib/TLibCommon/TComPicYuv.h

    r1427 r1428  
    186186 
    187187#if SVC_EXTENSION
    188   Void          setHeight   ( Int picHeight )                    { m_picHeight = picHeight;                 }
     188  Void          setHeight( Int picHeight )                       { m_picHeight = picHeight;                 }
    189189  Window&       getConformanceWindow()                           { return  m_conformanceWindow;             }
    190190  Void          setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; }
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r1426 r1428  
    15991599    {
    16001600      // create buffers for scaling factors
    1601       m_pcPic->createMvScalingFactor(pcSlice->getNumILRRefIdx());
    1602       m_pcPic->createPosScalingFactor(pcSlice->getNumILRRefIdx());
     1601      if( pcSlice->getNumILRRefIdx() )
     1602      {
     1603        m_pcPic->createMvScalingFactor(pcSlice->getNumILRRefIdx());
     1604        m_pcPic->createPosScalingFactor(pcSlice->getNumILRRefIdx());
     1605      }
    16031606
    16041607      for( Int i = 0; i < pcSlice->getNumILRRefIdx(); i++ )
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1427 r1428  
    17351735      {
    17361736        // create buffers for scaling factors
    1737         pcSlice->getPic()->createMvScalingFactor(pcSlice->getNumILRRefIdx());
    1738         pcSlice->getPic()->createPosScalingFactor(pcSlice->getNumILRRefIdx());
     1737        if( pcSlice->getNumILRRefIdx() )
     1738        {
     1739          pcSlice->getPic()->createMvScalingFactor(pcSlice->getNumILRRefIdx());
     1740          pcSlice->getPic()->createPosScalingFactor(pcSlice->getNumILRRefIdx());
     1741        }
    17391742      }
    17401743
Note: See TracChangeset for help on using the changeset viewer.