Ticket #67: MemLeak_SIFO.patch
File MemLeak_SIFO.patch, 3.3 KB (added by anonymous, 13 years ago) |
---|
-
TEncSIFO.cpp
62 62 SequenceAccErrorP = NULL; // [Filter][Sppos] 63 63 SequenceAccErrorB = NULL; // [FilterF][FilterB][SpposF][SpposB] 64 64 SIFO_FILTER = NULL; // [num_SIFO][16 subpels][SQR_FILTER] 65 #ifdef FIX_TICKET67 66 m_pcPredSearch = NULL; 67 #if USE_DIAGONAL_FILT==1 68 SIFO_FILTER_DIAG = NULL; 69 #endif 70 #endif 65 71 } 66 72 TEncSIFO::~TEncSIFO() 67 73 { 68 74 } 75 76 #ifdef FIX_TICKET67 77 Void TEncSIFO::destropy() 78 { 79 if( m_pcPredSearch != NULL ) 80 { 81 UInt num_SIFO = m_pcPredSearch->getNum_SIFOFilters(); 82 xFree_mem2Ddouble(AccErrorP); 83 xFree_mem2Ddouble(SequenceAccErrorP); 84 xFree_mem4Ddouble(SequenceAccErrorB, num_SIFO, num_SIFO); 85 xFree_mem3Ddouble(SIFO_FILTER, num_SIFO); 86 #if USE_DIAGONAL_FILT==1 87 xFree_mem2Ddouble(SIFO_FILTER_DIAG); 88 #endif 89 } 90 } 91 #endif 92 69 93 // ==================================================================================================================== 70 94 // Public member functions 71 95 // ==================================================================================================================== … … 601 625 return idx*frames*rows*columns*sizeof(Double); 602 626 } 603 627 628 #ifdef FIX_TICKET67 629 Void TEncSIFO::xFree_mem2Ddouble(Double **array2D) 630 { 631 if(array2D) 632 { 633 if(array2D[0]) 634 free (array2D[0]); 635 else 636 { 637 printf("xFree_mem2Ddouble: trying to free unused memory"); 638 exit(100); 639 } 640 free (array2D); 641 } 642 } 643 644 Void TEncSIFO::xFree_mem3Ddouble(Double ***array3D, Int frames) 645 { 646 int i; 647 648 if(array3D) 649 { 650 for(i=0;i<frames;i++) 651 { 652 xFree_mem2Ddouble(array3D[i]); 653 } 654 free(array3D); 655 } 656 } 657 658 Void TEncSIFO::xFree_mem4Ddouble(Double ****array4D, Int idx, Int frames) 659 { 660 int j; 661 662 if(array4D) 663 { 664 for(j=0;j<idx;j++) 665 xFree_mem3Ddouble( array4D[j], frames) ; 666 free(array4D); 667 } 668 } 669 #endif 670 604 671 Void TEncSIFO::xResetSequenceFilters() 605 672 { 606 673 Int i; -
TEncSIFO.h
45 45 class TEncTop; 46 46 class TEncGOP; 47 47 48 #define FIX_TICKET67 49 48 50 // ==================================================================================================================== 49 51 // Class definition 50 52 // ==================================================================================================================== … … 69 71 Int xGet_mem2Ddouble(Double ***array2D, Int rows, Int columns); 70 72 Int xGet_mem3Ddouble(Double ****array3D, Int frames, Int rows, Int columns); 71 73 Int xGet_mem4Ddouble(Double *****array4D, Int idx, Int frames, Int rows, Int columns ); 74 #ifdef FIX_TICKET67 75 Void xFree_mem2Ddouble(Double **array2D); 76 Void xFree_mem3Ddouble(Double ***array3D, Int frames); 77 Void xFree_mem4Ddouble(Double ****array4D, Int idx, Int frames); 78 #endif 72 79 Double xComputeImgSum ( Pel* img, Int width, Int height, Int stride ); ///< compute sum of pixel values 73 80 Void xResetAll(TComSlice* pcSlice); 74 81 Void xResetSequenceFilters(); … … 96 103 public: 97 104 TEncSIFO(); 98 105 virtual ~TEncSIFO(); 106 #ifdef FIX_TICKET67 107 Void destropy(); 108 #endif 99 109 100 110 Void init ( TEncTop* pcEncTop, Int Tap); 101 111 Void initEncSIFO ( TComSlice*& rpcSlice );