Ticket #1430: TComPicYuv.cpp.patch

File TComPicYuv.cpp.patch, 1.5 KB (added by kolya, 9 years ago)

TComPicYuv patch

  • source/Lib/TLibCommon/TComPicYuv.cpp

    diff --git a/source/Lib/TLibCommon/TComPicYuv.cpp b/source/Lib/TLibCommon/TComPicYuv.cpp
    old mode 100755
    new mode 100644
    index a6e6d78..87c7168
    a b  
    9696  for(UInt comp=0; comp<getNumberValidComponents(); comp++)
    9797  {
    9898    const ComponentID ch=ComponentID(comp);
    99     m_apiPicBuf[comp] = (Pel*)xMalloc( Pel, getStride(ch) * getTotalHeight(ch));
    100     m_piPicOrg[comp]  = m_apiPicBuf[comp] + (m_marginY >> getComponentScaleY(ch)) * getStride(ch) + (m_marginX >> getComponentScaleX(ch));
     99    if ( m_apiPicBuf[comp] == NULL )
     100    {
     101      m_apiPicBuf[comp] = (Pel*)xMalloc( Pel, getStride(ch) * getTotalHeight(ch));
     102      m_piPicOrg[comp]  = m_apiPicBuf[comp] + (m_marginY >> getComponentScaleY(ch)) * getStride(ch) + (m_marginX >> getComponentScaleX(ch));
     103    }
    101104  }
    102105  // initialize pointers for unused components to NULL
    103106  for(UInt comp=getNumberValidComponents();comp<MAX_NUM_COMPONENT; comp++)
     
    106109    m_piPicOrg[comp]  = NULL;
    107110  }
    108111
    109   for(Int chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++)
     112  for(UInt chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++)
    110113  {
    111     m_ctuOffsetInBuffer[chan]   = NULL;
    112     m_subCuOffsetInBuffer[chan] = NULL;
     114    if (m_ctuOffsetInBuffer[chan])
     115    {
     116      delete[] m_ctuOffsetInBuffer[chan];
     117      m_ctuOffsetInBuffer[chan] = NULL;
     118    }
     119    if (m_subCuOffsetInBuffer[chan])
     120    {
     121      delete[] m_subCuOffsetInBuffer[chan];
     122      m_subCuOffsetInBuffer[chan] = NULL;
     123    }
    113124  }
    114125}
    115126