1--- Inpaint/inpaint.h 2018-01-10 10:16:57.000000000 +0100 2+++ Inpaint/inpaint-abortable.h 2018-01-10 10:19:14.000000000 +0100 3@@ -103,6 +103,7 @@ 4 // Find (dilated by 2) bounding box for the inpainting mask. 5 unsigned int xm0 = _width, ym0 = _height, xm1 = 0, ym1 = 0; 6 bool is_mask_found = false; 7+ cimg_pragma_openmp(parallel for collapse(2) cimg_openmp_if(mask.width()>=256 && mask.height()>=16)) 8 cimg_forXY(mask,x,y) if (mask(x,y)) { 9 is_mask_found = true; 10 if (x<(int)xm0) xm0 = (unsigned int)x; 11@@ -139,7 +140,10 @@ 12 weights.draw_gaussian((float)p1,(float)p1,patch_size/15.0f,&one)/=patch_size2; 13 unsigned int target_index = 0; 14 15+ _cimg_abort_init_omp; 16+ cimg_abort_init; 17 while (true) { 18+ cimg_abort_test; 19 20 // Extract mask border points and compute priorities to find target point. 21 unsigned int nb_border_points = 0; 22@@ -416,6 +420,7 @@ 23 // Generate blending scales. 24 CImg<T> result = _inpaint_patch_crop(ox,oy,ox + dx - 1,oy + dy - 1,0); 25 for (unsigned int blend_iter = 1; blend_iter<=blend_scales; ++blend_iter) { 26+ cimg_abort_test; 27 const unsigned int 28 _blend_width = blend_iter*blend_size/blend_scales, 29 blend_width = _blend_width?_blend_width + 1 - (_blend_width%2):0; 30@@ -454,19 +459,25 @@ 31 } 32 33 if (is_blend_outer) { 34+ cimg_pragma_openmp(parallel for collapse(2) cimg_openmp_if(blended.width()>=256 && blended.height()>=16)) 35 cimg_forXY(blended,x,y) if (blend_map(x,y)==blend_iter) { 36 const float cum = cumul(x,y); 37 if (cum>0) cimg_forC(*this,c) result(x,y,c) = (T)(blended(x,y,c)/cum); 38 } 39- } else { cimg_forXY(blended,x,y) if (mask(x + ox,y + oy) && blend_map(x,y)==blend_iter) { 40+ } else { 41+ cimg_pragma_openmp(parallel for collapse(2) cimg_openmp_if(blended.width()>=256 && blended.height()>=16)) 42+ cimg_forXY(blended,x,y) if (mask(x + ox,y + oy) && blend_map(x,y)==blend_iter) { 43 const float cum = cumul(x,y); 44 if (cum>0) cimg_forC(*this,c) result(x,y,c) = (T)(blended(x,y,c)/cum); 45 } 46 } 47 } 48 if (is_blend_outer) draw_image(ox,oy,result); 49- else cimg_forXY(result,x,y) if (mask(x + ox,y + oy)) 50+ else { 51+ cimg_pragma_openmp(parallel for collapse(2) cimg_openmp_if(result.width()>=256 && result.height()>=16)) 52+ cimg_forXY(result,x,y) if (mask(x + ox,y + oy)) 53 cimg_forC(*this,c) (*this)(x + ox,y + oy,c) = (T)result(x,y,c); 54+ } 55 } 56 return *this; 57 } 58