Skip to content

Commit

Permalink
move new&delete histogramAllChannels inside the #ifdef USE_OPENCL; fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Mar 4, 2016
1 parent 4d4bfb5 commit 8bfaf84
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ccstruct/otsuthr.cpp
Expand Up @@ -48,11 +48,12 @@ int OtsuThreshold(Pix* src_pix, int left, int top, int width, int height,
double best_hi_dist = 0.0;
*thresholds = new int[num_channels];
*hi_values = new int[num_channels];
// all of channel 0 then all of channel 1...
int *histogramAllChannels = new int[kHistogramSize * num_channels];

// only use opencl if compiled w/ OpenCL and selected device is opencl
#ifdef USE_OPENCL
// all of channel 0 then all of channel 1...
int *histogramAllChannels = new int[kHistogramSize * num_channels];

// Calculate Histogram on GPU
OpenclDevice od;
if (od.selectedDeviceIsOpenCL() &&
Expand Down Expand Up @@ -139,8 +140,9 @@ int OtsuThreshold(Pix* src_pix, int left, int top, int width, int height,
}
#ifdef USE_OPENCL
}
#endif // USE_OPENCL
delete[] histogramAllChannels;
#endif // USE_OPENCL


if (!any_good_hivalue) {
// Use the best of the ones that were not good enough.
Expand Down

0 comments on commit 8bfaf84

Please sign in to comment.