Changeset 121 in 3DVCSoftware for trunk/source/Lib


Ignore:
Timestamp:
6 Sep 2012, 18:12:56 (12 years ago)
Author:
tech
Message:

Fixed several memory leaks.

Location:
trunk/source/Lib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r116 r121  
    9090  m_pcTrCoeffCr        = NULL;
    9191#if ADAPTIVE_QP_SELECTION 
     92#if FIX_MEM_LEAKS
     93  m_ArlCoeffIsAliasedAllocation = false;
    9294  m_pcArlCoeffY        = NULL;
    9395  m_pcArlCoeffCb       = NULL;
    9496  m_pcArlCoeffCr       = NULL;
     97#endif
    9598#endif
    9699 
     
    247250      m_pcArlCoeffCb       = m_pcGlbArlCoeffCb;
    248251      m_pcArlCoeffCr       = m_pcGlbArlCoeffCr;
     252#if FIX_MEM_LEAKS
     253      m_ArlCoeffIsAliasedAllocation = true;
     254#endif
    249255    }
    250256    else
     
    362368    if ( m_pcTrCoeffCr        ) { xFree(m_pcTrCoeffCr);         m_pcTrCoeffCr       = NULL; }
    363369#if ADAPTIVE_QP_SELECTION
     370#if FIX_MEM_LEAKS
     371    if (!m_ArlCoeffIsAliasedAllocation)
     372    {
     373      xFree(m_pcArlCoeffY); m_pcArlCoeffY = 0;
     374      xFree(m_pcArlCoeffCb); m_pcArlCoeffCb = 0;
     375      xFree(m_pcArlCoeffCr); m_pcArlCoeffCr = 0;
     376    }
     377#endif
    364378    if ( m_pcGlbArlCoeffY     ) { xFree(m_pcGlbArlCoeffY);      m_pcGlbArlCoeffY    = NULL; }
    365379    if ( m_pcGlbArlCoeffCb    ) { xFree(m_pcGlbArlCoeffCb);     m_pcGlbArlCoeffCb   = NULL; }
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r118 r121  
    159159  Int*          m_pcArlCoeffCb;       ///< ARL coefficient buffer (Cb)
    160160  Int*          m_pcArlCoeffCr;       ///< ARL coefficient buffer (Cr)
     161#if FIX_MEM_LEAKS
     162  Bool          m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
     163#endif
    161164
    162165  static Int*   m_pcGlbArlCoeffY;     ///< ARL coefficient buffer (Y)
    163166  static Int*   m_pcGlbArlCoeffCb;    ///< ARL coefficient buffer (Cb)
    164167  static Int*   m_pcGlbArlCoeffCr;    ///< ARL coefficient buffer (Cr)
     168
    165169#endif
    166170 
  • trunk/source/Lib/TLibCommon/TComPicSym.cpp

    r56 r121  
    122122  m_apcTComDataCU = NULL;
    123123
     124
     125#if FIX_MEM_LEAKS
     126  for( i=0; i<(m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ )
     127  {
     128    if ( m_apcTComTile[i] )  delete m_apcTComTile[i];
     129  }
     130#endif
     131
    124132  delete [] m_apcTComTile;
    125133  m_apcTComTile = NULL;
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r118 r121  
    4747#define FIX_INIT_ROM                      1
    4848#define FIX_VIRT_DESTRUCTOR               1
     49#define FIX_MEM_LEAKS                     1
    4950
    5051#define FIX_LG_RESTRICTEDRESPRED_M24766   1
     52#define FIX_REMOVE_TILE_DEPENDENCE        1
    5153
    5254
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r120 r121  
    272272  Int       m_iColumnRowInfoPresent;
    273273  Int       m_iUniformSpacingIdr;
     274#if FIX_REMOVE_TILE_DEPENDENCE
     275#else
    274276  Int       m_iTileBoundaryIndependenceIdr;
     277#endif
    275278  Int       m_iNumColumnsMinus1;
    276279  UInt*     m_puiColumnWidth;
     
    287290  Int       m_iWaveFrontSubstreams;
    288291
    289   bool m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling
     292  Bool      m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling
    290293
    291294  //====== Weighted Prediction ========
  • trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r116 r121  
    11021102
    11031103    // # substreams is "per tile" when tiles are independent.
     1104#if FIX_REMOVE_TILE_DEPENDENCE
     1105    if ( m_iWaveFrontSynchro )
     1106#else
    11041107    if (m_iTileBoundaryIndependenceIdr && m_iWaveFrontSynchro)
     1108#endif
    11051109    {
    11061110      m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams * (m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1));
  • trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp

    r100 r121  
    9999  if ( m_pcInputSamples [0] ) delete[] m_pcInputSamples [0];
    100100  if ( m_pcInputSamples [1] ) delete[] m_pcInputSamples [1];
     101
     102#if FIX_MEM_LEAKS
     103  if ( m_pcOutputSamples    ) delete[] m_pcOutputSamples   ;
     104#else
    101105  if ( m_pcOutputSamples    ) delete   m_pcOutputSamples   ;
     106#endif
     107
     108#if FIX_MEM_LEAKS
     109  if ( m_piInvZLUTLeft  ) delete[] m_piInvZLUTLeft ;
     110  if ( m_piInvZLUTRight ) delete[] m_piInvZLUTRight;
     111
     112  if ( m_aapiRefVideoPel[0] ) delete[] ( m_aapiRefVideoPel[0] - ( m_aiRefVideoStrides[0] * m_iPad + m_iPad ) );
     113  if ( m_aapiRefVideoPel[1] ) delete[] ( m_aapiRefVideoPel[1] - ( m_aiRefVideoStrides[1] * m_iPad + m_iPad ) );
     114  if ( m_aapiRefVideoPel[2] ) delete[] ( m_aapiRefVideoPel[2] - ( m_aiRefVideoStrides[2] * m_iPad + m_iPad ) );
     115#endif
    102116}
    103117
Note: See TracChangeset for help on using the changeset viewer.