void CBitmap::Blur(int iterations, float weight) { if (type == BitmapTypeDDS) { return; } CBitmap* src = this; CBitmap* dst = new CBitmap(); dst->channels = src->channels; dst->Alloc(xsize,ysize); for (int i=0; i < iterations; ++i){ { int j,y,x; // Threading::OMPCheck(); // This is currently used too early, OMP is not initialized here // #pragma omp parallel for private(j,x,y) for (y=0; y < ysize; y++) { for (x=0; x < xsize; x++) { for (j=0; j < channels; j++) { kernelBlur(dst, src->mem, x, y, j, weight); } } } } std::swap(src, dst); } if (dst == this) { // make sure we don't delete `this` std::swap(src, dst); } delete dst; }
void CBitmap::Blur(int iterations, float weight) { if (type == BitmapTypeDDS) { return; } CBitmap* src = this; CBitmap* dst = new CBitmap(); dst->channels = src->channels; dst->Alloc(xsize,ysize); for (int i=0; i < iterations; ++i){ { for_mt(0, ysize, [&](const int y) { for (int x=0; x < xsize; x++) { for (int j=0; j < channels; j++) { kernelBlur(dst, src->mem, x, y, j, weight); } } }); } std::swap(src, dst); } if (dst == this) { // make sure we don't delete `this` std::swap(src, dst); } delete dst; }
void CBitmap::Blur(int iterations, float weight) { if (type == BitmapTypeDDS) { return; } CBitmap* src = this; CBitmap* dst = new CBitmap(); dst->channels = src->channels; dst->Alloc(xsize,ysize); for (int i=0; i < iterations; ++i){ #pragma omp parallel private(y,x,i) { #pragma omp for for (int y=0; y < ysize; ++y) { for (int x=0; x < xsize; ++x) { for (int i=0; i < channels; ++i) { kernelBlur(dst, src->mem, x, y, i, weight); } } } } CBitmap* buf = dst; dst = src; src = buf; } if (dst == this) { CBitmap* buf = dst; dst = src; src = buf; } delete dst; }
void CBitmap::Blur(int iterations, float weight) { if (type == BitmapTypeDDS) { return; } CBitmap* src = this; CBitmap* dst = new CBitmap(); dst->channels = src->channels; dst->Alloc(xsize,ysize); for (int i=0; i < iterations; ++i){ { int j,y,x; #pragma omp parallel for private(j,x,y) for (y=0; y < ysize; y++) { for (x=0; x < xsize; x++) { for (j=0; j < channels; j++) { kernelBlur(dst, src->mem, x, y, j, weight); } } } } CBitmap* buf = dst; dst = src; src = buf; } if (dst == this) { CBitmap* buf = dst; dst = src; src = buf; } delete dst; }