@@ -87,7 +87,7 @@ class EstimateCovariance{
87
87
88
88
void iterateCombinations (Mat inputData,Mat outputData);
89
89
void computeOneCombination (int comb_id, Mat inputData , Mat outputData,
90
- Mat outputVector,int * finalMatPosR, int * finalMatPosC);
90
+ Mat outputVector,std::vector< int > finalMatPosR, std::vector< int > finalMatPosC);
91
91
92
92
inline void complexSubtract (std::complex<float >& src, std::complex<float >& dst){dst-=src;}
93
93
inline void complexAdd (std::complex<float >& src, std::complex<float >& dst){dst+=src;}
@@ -103,7 +103,8 @@ class EstimateCovariance{
103
103
int pc;
104
104
int threads;
105
105
106
- Combination* combinationsTable;
106
+ // Combination* combinationsTable;
107
+ std::vector<Combination> combinationsTable;
107
108
};
108
109
109
110
@@ -120,12 +121,12 @@ EstimateCovariance::EstimateCovariance(int pr_, int pc_){
120
121
}
121
122
122
123
EstimateCovariance::~EstimateCovariance (){
123
- delete[] combinationsTable;
124
+
124
125
}
125
126
126
127
void EstimateCovariance::initInternalDataStructures (){
127
128
int combCount = combinationCount ();
128
- combinationsTable = new Combination[ combCount] ;
129
+ combinationsTable. resize ( combCount) ;
129
130
buildCombinationsTable ();
130
131
}
131
132
@@ -203,26 +204,27 @@ void EstimateCovariance::iterateCombinations(Mat inputData,Mat outputData)
203
204
combs=combsPerCPU-1 ;
204
205
startComb=remainder*combsPerCPU+(thread_id-remainder)*(combsPerCPU-1 );
205
206
}
206
- // stopComb=startComb+combs;
207
+
207
208
Mat outputVector (pr*pc,1 , DataType<std::complex<float > >::type);
208
209
209
- int * finalMatPosR = new int [ pr*pc] ;
210
- int * finalMatPosC = new int [ pr*pc] ;
210
+ std::vector< int > finalMatPosR ( pr*pc, 0 ) ;
211
+ std::vector< int > finalMatPosC ( pr*pc, 0 ) ;
211
212
212
213
for (idx=0 ; idx<combs; idx++){
213
214
outputVector.setTo (Scalar (0 ,0 ));
214
- memset (finalMatPosR,0 ,pr*pc*sizeof (int ));
215
- memset (finalMatPosC,0 ,pr*pc*sizeof (int ));
215
+ for (unsigned x=0 ; x<finalMatPosR.size (); x++)
216
+ finalMatPosR[x]=0 ;
217
+ for (unsigned x=0 ; x<finalMatPosC.size (); x++)
218
+ finalMatPosC[x]=0 ;
216
219
computeOneCombination (startComb++, inputData, outputData,
217
220
outputVector,finalMatPosR, finalMatPosC);
218
221
}
219
- delete[] finalMatPosR;
220
- delete[] finalMatPosC;
222
+
221
223
}
222
224
}
223
225
224
226
void EstimateCovariance::computeOneCombination (int comb_id,Mat inputData, Mat outputData,
225
- Mat outputVector,int * finalMatPosR, int * finalMatPosC)
227
+ Mat outputVector,std::vector< int > finalMatPosR, std::vector< int > finalMatPosC)
226
228
{
227
229
Combination* comb = &combinationsTable[comb_id];
228
230
int type2 = comb->type2 ;
0 commit comments