@@ -2302,29 +2302,26 @@ static double thresholdRectToPixMicroBench(GPUEnv *env,
2302
2302
ds_device_type type) {
2303
2303
double time ;
2304
2304
#if ON_WINDOWS
2305
- LARGE_INTEGER freq, time_funct_start, time_funct_end;
2306
- QueryPerformanceFrequency (&freq);
2305
+ LARGE_INTEGER freq, time_funct_start, time_funct_end;
2306
+ QueryPerformanceFrequency (&freq);
2307
2307
#elif ON_APPLE
2308
- mach_timebase_info_data_t info = {0 , 0 };
2309
- mach_timebase_info (&info);
2310
- long long start, stop;
2308
+ mach_timebase_info_data_t info = {0 , 0 };
2309
+ mach_timebase_info (&info);
2310
+ long long start, stop;
2311
2311
#else
2312
- timespec time_funct_start, time_funct_end;
2312
+ timespec time_funct_start, time_funct_end;
2313
2313
#endif
2314
2314
2315
2315
// input data
2316
2316
unsigned char pixelHi = (unsigned char )255 ;
2317
- int * thresholds = new int [4 ];
2318
- thresholds[0 ] = pixelHi/2 ;
2319
- thresholds[1 ] = pixelHi/2 ;
2320
- thresholds[2 ] = pixelHi/2 ;
2321
- thresholds[3 ] = pixelHi/2 ;
2322
- int *hi_values = new int [4 ];
2323
- thresholds[0 ] = pixelHi;
2324
- thresholds[1 ] = pixelHi;
2325
- thresholds[2 ] = pixelHi;
2326
- thresholds[3 ] = pixelHi;
2327
- // Pix* pix = pixCreate(width, height, 1);
2317
+ int thresholds[4 ] = {
2318
+ pixelHi,
2319
+ pixelHi,
2320
+ pixelHi,
2321
+ pixelHi
2322
+ };
2323
+
2324
+ // Pix* pix = pixCreate(width, height, 1);
2328
2325
int top = 0 ;
2329
2326
int left = 0 ;
2330
2327
int bytes_per_line = input.width *input.numChannels ;
@@ -2340,6 +2337,7 @@ static double thresholdRectToPixMicroBench(GPUEnv *env,
2340
2337
#endif
2341
2338
2342
2339
OpenclDevice::gpuEnv = *env;
2340
+ int hi_values[4 ];
2343
2341
int retVal = OpenclDevice::ThresholdRectToPixOCL (
2344
2342
input.imageData , input.numChannels , bytes_per_line, thresholds,
2345
2343
hi_values, &input.pix , input.height , input.width , top, left);
@@ -2372,6 +2370,7 @@ static double thresholdRectToPixMicroBench(GPUEnv *env,
2372
2370
#else
2373
2371
clock_gettime ( CLOCK_MONOTONIC, &time_funct_start );
2374
2372
#endif
2373
+ int hi_values[4 ] = {};
2375
2374
ThresholdRectToPix_Native ( input.imageData , input.numChannels , bytes_per_line,
2376
2375
thresholds, hi_values, &input.pix );
2377
2376
@@ -2387,9 +2386,6 @@ static double thresholdRectToPixMicroBench(GPUEnv *env,
2387
2386
#endif
2388
2387
}
2389
2388
2390
- // cleanup
2391
- delete[] thresholds;
2392
- delete[] hi_values;
2393
2389
return time ;
2394
2390
}
2395
2391
0 commit comments