Index: gmic-1.6.0.3/src/CImg.h =================================================================== --- gmic-1.6.0.3.orig/src/CImg.h +++ gmic-1.6.0.3/src/CImg.h @@ -230,8 +230,13 @@ // OpenMP directives may be used in a (very) few CImg functions to get // advantages of multi-core CPUs. #ifdef cimg_use_openmp #include +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +#define COLLAPSE(x) collapse(x) +#else +#define COLLAPSE(x) +#endif #endif // Configure OpenCV support. // (http://opencv.willowgarage.com/wiki/) @@ -10697,9 +10702,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator+=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=524288) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd + value); return *this; @@ -10728,9 +10733,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd + lmp(x,y,z,c)); ++ptrd; } } @@ -10788,9 +10793,9 @@ namespace cimg_library_suffixed { - Writing \c ++img is equivalent to \c img+=1. **/ CImg& operator++() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=524288) #endif cimg_rof(*this,ptrd,T) ++*ptrd; return *this; @@ -10857,9 +10862,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator-=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=524288) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd - value); return *this; @@ -10884,9 +10889,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd - lmp(x,y,z,c)); ++ptrd; } } @@ -10926,9 +10931,9 @@ namespace cimg_library_suffixed { Similar to operator++(), except that it performs a decrement instead of an increment. **/ CImg& operator--() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=524288) #endif cimg_rof(*this,ptrd,T) *ptrd = *ptrd-(T)1; return *this; @@ -10997,9 +11002,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator*=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=262144) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd * value); return *this; @@ -11024,9 +11029,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd * lmp(x,y,z,c)); ++ptrd; } } @@ -11097,10 +11102,10 @@ namespace cimg_library_suffixed { "matrix (%u,%u,%u,%u,%p)", cimg_instance, img._width,img._height,img._depth,img._spectrum,img._data); CImg<_cimg_Tt> res(img._width,_height); -#ifdef cimg_use_openmp -#pragma omp parallel for if (size()>1024 && img.size()>1024) collapse(2) +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) +#pragma omp parallel for if (size()>1024 && img.size()>1024) COLLAPSE(2) cimg_forXY(res,i,j) { _cimg_Ttdouble value = 0; cimg_forX(*this,k) value+=(*this)(k,j)*img(i,k); res(i,j) = (_cimg_Tt)value; } #else @@ -11118,9 +11123,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator/=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd / value); return *this; @@ -11140,14 +11145,14 @@ namespace cimg_library_suffixed { T *ptrd = *expression=='<'?end()-1:_data; if (*expression=='<') cimg_rofXYZC(*this,x,y,z,c) { *ptrd = (T)(*ptrd / mp(x,y,z,c)); --ptrd; } else if (*expression=='>') cimg_forXYZC(*this,x,y,z,c) { *ptrd = (T)(*ptrd / mp(x,y,z,c)); ++ptrd; } else { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd / lmp(x,y,z,c)); ++ptrd; } } @@ -11215,9 +11220,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator%=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=16384) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)cimg::mod(*ptrd,(T)value); return *this; @@ -11237,14 +11242,14 @@ namespace cimg_library_suffixed { T *ptrd = *expression=='<'?end()-1:_data; if (*expression=='<') cimg_rofXYZC(*this,x,y,z,c) { *ptrd = (T)cimg::mod(*ptrd,(T)mp(x,y,z,c)); --ptrd; } else if (*expression=='>') cimg_forXYZC(*this,x,y,z,c) { *ptrd = (T)cimg::mod(*ptrd,(T)mp(x,y,z,c)); ++ptrd; } else { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)cimg::mod(*ptrd,(T)lmp(x,y,z,c)); ++ptrd; } } @@ -11314,9 +11319,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator&=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)((unsigned long)*ptrd & (unsigned long)value); return *this; @@ -11338,14 +11343,14 @@ namespace cimg_library_suffixed { cimg_rofXYZC(*this,x,y,z,c) { *ptrd = (T)((unsigned long)*ptrd & (unsigned long)mp(x,y,z,c)); --ptrd; } else if (*expression=='>') cimg_forXYZC(*this,x,y,z,c) { *ptrd = (T)((unsigned long)*ptrd & (unsigned long)mp(x,y,z,c)); ++ptrd; } else { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)((unsigned long)*ptrd & (unsigned long)lmp(x,y,z,c)); ++ptrd; } } @@ -11415,9 +11420,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator|=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)((unsigned long)*ptrd | (unsigned long)value); return *this; @@ -11439,14 +11444,14 @@ namespace cimg_library_suffixed { cimg_rofXYZC(*this,x,y,z,c) { *ptrd = (T)((unsigned long)*ptrd | (unsigned long)mp(x,y,z,c)); --ptrd; } else if (*expression=='>') cimg_forXYZC(*this,x,y,z,c) { *ptrd = (T)((unsigned long)*ptrd | (unsigned long)mp(x,y,z,c)); ++ptrd; } else { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)((unsigned long)*ptrd | (unsigned long)lmp(x,y,z,c)); ++ptrd; } } @@ -11518,9 +11523,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator^=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)((unsigned long)*ptrd ^ (unsigned long)value); return *this; @@ -11544,14 +11549,14 @@ namespace cimg_library_suffixed { cimg_rofXYZC(*this,x,y,z,c) { *ptrd = (T)((unsigned long)*ptrd ^ (unsigned long)mp(x,y,z,c)); --ptrd; } else if (*expression=='>') cimg_forXYZC(*this,x,y,z,c) { *ptrd = (T)((unsigned long)*ptrd ^ (unsigned long)mp(x,y,z,c)); ++ptrd; } else { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)((unsigned long)*ptrd ^ (unsigned long)lmp(x,y,z,c)); ++ptrd; } } @@ -11623,9 +11628,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator<<=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=65536) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(((long)*ptrd) << (int)value); return *this; @@ -11645,14 +11650,14 @@ namespace cimg_library_suffixed { T *ptrd = *expression=='<'?end()-1:_data; if (*expression=='<') cimg_rofXYZC(*this,x,y,z,c) { *ptrd = (T)((long)*ptrd << (int)mp(x,y,z,c)); --ptrd; } else if (*expression=='>') cimg_forXYZC(*this,x,y,z,c) { *ptrd = (T)((long)*ptrd << (int)mp(x,y,z,c)); ++ptrd; } else { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)((long)*ptrd << (int)lmp(x,y,z,c)); ++ptrd; } } @@ -11723,9 +11728,9 @@ namespace cimg_library_suffixed { **/ template CImg& operator>>=(const t value) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=65536) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(((long)*ptrd) >> (int)value); return *this; @@ -11745,14 +11750,14 @@ namespace cimg_library_suffixed { T *ptrd = *expression=='<'?end()-1:_data; if (*expression=='<') cimg_rofXYZC(*this,x,y,z,c) { *ptrd = (T)((long)*ptrd >> (int)mp(x,y,z,c)); --ptrd; } else if (*expression=='>') cimg_forXYZC(*this,x,y,z,c) { *ptrd = (T)((long)*ptrd >> (int)mp(x,y,z,c)); ++ptrd; } else { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)((long)*ptrd >> (int)lmp(x,y,z,c)); ++ptrd; } } @@ -15108,9 +15113,9 @@ namespace cimg_library_suffixed { \image html ref_sqr.jpg **/ CImg& sqr() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=524288) #endif cimg_rof(*this,ptrd,T) { const T val = *ptrd; *ptrd = (T)(val*val); }; return *this; @@ -15135,9 +15140,9 @@ namespace cimg_library_suffixed { \image html ref_sqrt.jpg **/ CImg& sqrt() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=8192) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::sqrt((double)*ptrd); return *this; @@ -15156,9 +15161,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& exp() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=4096) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::exp((double)*ptrd); return *this; @@ -15178,9 +15183,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& log() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=262144) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::log((double)*ptrd); return *this; @@ -15200,9 +15205,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& log2() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=4096) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)cimg::log2((double)*ptrd); return *this; @@ -15222,9 +15227,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& log10() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=4096) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::log10((double)*ptrd); return *this; @@ -15243,9 +15248,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& abs() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=524288) #endif cimg_rof(*this,ptrd,T) *ptrd = cimg::abs(*ptrd); return *this; @@ -15269,9 +15274,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& sign() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) *ptrd = cimg::sign(*ptrd); return *this; @@ -15291,9 +15296,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& cos() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=8192) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::cos((double)*ptrd); return *this; @@ -15313,9 +15318,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& sin() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=8192) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::sin((double)*ptrd); return *this; @@ -15336,9 +15341,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& sinc() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=2048) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)cimg::sinc((double)*ptrd); return *this; @@ -15358,9 +15363,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& tan() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=2048) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::tan((double)*ptrd); return *this; @@ -15380,9 +15385,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& cosh() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=2048) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::cosh((double)*ptrd); return *this; @@ -15402,9 +15407,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& sinh() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=2048) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::sinh((double)*ptrd); return *this; @@ -15424,9 +15429,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& tanh() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=2048) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::tanh((double)*ptrd); return *this; @@ -15446,9 +15451,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& acos() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=8192) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::acos((double)*ptrd); return *this; @@ -15468,9 +15473,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& asin() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=8192) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::asin((double)*ptrd); return *this; @@ -15490,9 +15495,9 @@ namespace cimg_library_suffixed { - The \newinstance returns a \c CImg image, if the pixel type \c T is \e not float-valued. **/ CImg& atan() { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=8192) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::atan((double)*ptrd); return *this; @@ -15619,37 +15624,37 @@ namespace cimg_library_suffixed { **/ CImg& pow(const double p) { if (is_empty()) return *this; if (p==-4) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) { const T val = *ptrd; *ptrd = (T)(1.0/(val*val*val*val)); } return *this; } if (p==-3) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) { const T val = *ptrd; *ptrd = (T)(1.0/(val*val*val)); } return *this; } if (p==-2) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) { const T val = *ptrd; *ptrd = (T)(1.0/(val*val)); } return *this; } if (p==-1) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) { const T val = *ptrd; *ptrd = (T)(1.0/val); } return *this; } if (p==-0.5) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=8192) #endif cimg_rof(*this,ptrd,T) { const T val = *ptrd; *ptrd = (T)(1/std::sqrt((double)val)); } return *this; @@ -15658,22 +15663,22 @@ namespace cimg_library_suffixed { if (p==0.5) return sqrt(); if (p==1) return *this; if (p==2) return sqr(); if (p==3) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=262144) #endif cimg_rof(*this,ptrd,T) { const T val = *ptrd; *ptrd = val*val*val; } return *this; } if (p==4) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=131072) #endif cimg_rof(*this,ptrd,T) { const T val = *ptrd; *ptrd = val*val*val*val; } return *this; } -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=1024) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)std::pow((double)*ptrd,p); return *this; @@ -15704,9 +15709,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)std::pow((double)*ptrd,lmp(x,y,z,c)); ++ptrd; } } @@ -15763,9 +15768,9 @@ namespace cimg_library_suffixed { Similar to operator<<=(unsigned int), except that it performs a left rotation instead of a left shift. **/ CImg& rol(const unsigned int n=1) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)cimg::rol(*ptrd,n); return *this; @@ -15797,9 +15802,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)cimg::rol(*ptrd,(unsigned int)lmp(x,y,z,c)); ++ptrd; } } @@ -15856,9 +15861,9 @@ namespace cimg_library_suffixed { Similar to operator>>=(unsigned int), except that it performs a right rotation instead of a right shift. **/ CImg& ror(const unsigned int n=1) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)cimg::ror(*ptrd,n); return *this; @@ -15890,9 +15895,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)cimg::ror(*ptrd,(unsigned int)lmp(x,y,z,c)); ++ptrd; } } @@ -15951,9 +15956,9 @@ namespace cimg_library_suffixed { \f$\mathrm{min}(I_{(x,y,z,c)},\mathrm{val})\f$. **/ CImg& min(const T val) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=65536) #endif cimg_rof(*this,ptrd,T) *ptrd = cimg::min(*ptrd,val); return *this; @@ -16011,9 +16016,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)cimg::min(*ptrd,(T)lmp(x,y,z,c)); ++ptrd; } } @@ -16048,9 +16053,9 @@ namespace cimg_library_suffixed { \f$\mathrm{max}(I_{(x,y,z,c)},\mathrm{val})\f$. **/ CImg& max(const T val) { if (is_empty()) return *this; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=65536) #endif cimg_rof(*this,ptrd,T) *ptrd = cimg::max(*ptrd,val); return *this; @@ -16108,9 +16113,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)cimg::max(*ptrd,(T)lmp(x,y,z,c)); ++ptrd; } } @@ -18672,9 +18677,9 @@ namespace cimg_library_suffixed { if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) *ptrd++ = (T)lmp(x,y,z,c); } @@ -18985,9 +18990,9 @@ namespace cimg_library_suffixed { - \c 1: Forward. **/ CImg& round(const double y=1, const int rounding_type=0) { if (y>0) -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) #pragma omp parallel for if (size()>=8192) #endif cimg_rof(*this,ptrd,T) *ptrd = cimg::round(*ptrd,y,rounding_type); return *this; @@ -19096,9 +19101,9 @@ namespace cimg_library_suffixed { T m, M = max_min(m); const Tfloat fm = (Tfloat)m, fM = (Tfloat)M; if (m==M) return fill(min_value); if (m!=a || M!=b) -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=65536) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)((*ptrd-fm)/(fM-fm)*(b-a)+a); return *this; @@ -19120,9 +19125,9 @@ namespace cimg_library_suffixed { **/ CImg& normalize() { const unsigned long whd = (unsigned long)_width*_height*_depth; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=512 && _height*_depth>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=512 && _height*_depth>=16) #endif cimg_forYZ(*this,y,z) { T *ptrd = data(0,y,z,0); cimg_forX(*this,x) { @@ -19166,9 +19171,9 @@ namespace cimg_library_suffixed { CImg res(_width,_height,_depth); switch (norm_type) { case -1 : { // Linf norm #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=512 && _height*_depth>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=512 && _height*_depth>=16) #endif cimg_forYZ(*this,y,z) { const unsigned long off = offset(0,y,z); const T *ptrs = _data + off; @@ -19182,9 +19187,9 @@ namespace cimg_library_suffixed { } } break; case 1 : { // L1 norm #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=512 && _height*_depth>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=512 && _height*_depth>=16) #endif cimg_forYZ(*this,y,z) { const unsigned long off = offset(0,y,z); const T *ptrs = _data + off; @@ -19198,9 +19203,9 @@ namespace cimg_library_suffixed { } } break; default : { // L2 norm #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=512 && _height*_depth>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=512 && _height*_depth>=16) #endif cimg_forYZ(*this,y,z) { const unsigned long off = offset(0,y,z); const T *ptrs = _data + off; @@ -19230,9 +19235,9 @@ namespace cimg_library_suffixed { **/ CImg& cut(const T min_value, const T max_value) { if (is_empty()) return *this; const T a = min_value=32768) #endif cimg_rof(*this,ptrd,T) *ptrd = (*ptrdb)?b:*ptrd); return *this; @@ -19263,16 +19268,16 @@ namespace cimg_library_suffixed { if (is_empty()) return *this; Tfloat m, M = (Tfloat)max_min(m), range = M - m; if (range>0) { if (keep_range) -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) { const unsigned int val = (unsigned int)((*ptrd-m)*nb_levels/range); *ptrd = (T)(m + cimg::min(val,nb_levels-1)*range/nb_levels); } else -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) { const unsigned int val = (unsigned int)((*ptrd-m)*nb_levels/range); @@ -19302,27 +19307,27 @@ namespace cimg_library_suffixed { CImg& threshold(const T value, const bool soft_threshold=false, const bool strict_threshold=false) { if (is_empty()) return *this; if (strict_threshold) { if (soft_threshold) -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) { const T v = *ptrd; *ptrd = v>value?(T)(v-value):v<-(float)value?(T)(v+value):(T)0; } else -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=65536) #endif cimg_rof(*this,ptrd,T) *ptrd = *ptrd>value?(T)1:(T)0; } else { if (soft_threshold) -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=32768) #endif cimg_rof(*this,ptrd,T) { const T v = *ptrd; *ptrd = v>=value?(T)(v-value):v<=-(float)value?(T)(v+value):(T)0; } else -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=65536) #endif cimg_rof(*this,ptrd,T) *ptrd = *ptrd>=value?(T)1:(T)0; } @@ -19400,9 +19405,9 @@ namespace cimg_library_suffixed { CImg hist = get_histogram(nb_levels,vmin,vmax); unsigned long cumul = 0; cimg_forX(hist,pos) { cumul+=hist[pos]; hist[pos] = cumul; } if (!cumul) cumul = 1; -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=1048576) #endif cimg_rof(*this,ptrd,T) { const int pos = (int)((*ptrd-vmin)*(nb_levels-1)/(vmax-vmin)); @@ -19616,9 +19621,9 @@ namespace cimg_library_suffixed { } else { // Non-dithered versions switch (_spectrum) { case 1 : { // Optimized for scalars. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=64 && _height*_depth>=16 && pwhd>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=64 && _height*_depth>=16 && pwhd>=16) #endif cimg_forYZ(*this,y,z) { tuint *ptrd = res.data(0,y,z); for (const T *ptrs0 = data(0,y,z), *ptrs_end = ptrs0 + _width; ptrs0=64 && _height*_depth>=16 && pwhd>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=64 && _height*_depth>=16 && pwhd>=16) #endif cimg_forYZ(*this,y,z) { tuint *ptrd = res.data(0,y,z), *ptrd1 = ptrd + whd; for (const T *ptrs0 = data(0,y,z), *ptrs1 = ptrs0 + whd, *ptrs_end = ptrs0 + _width; ptrs0=64 && _height*_depth>=16 && pwhd>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=64 && _height*_depth>=16 && pwhd>=16) #endif cimg_forYZ(*this,y,z) { tuint *ptrd = res.data(0,y,z), *ptrd1 = ptrd + whd, *ptrd2 = ptrd1 + whd; for (const T *ptrs0 = data(0,y,z), *ptrs1 = ptrs0 + whd, *ptrs2 = ptrs1 + whd, @@ -19680,9 +19685,9 @@ namespace cimg_library_suffixed { } } break; default : // Generic version. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=64 && _height*_depth>=16 && pwhd>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=64 && _height*_depth>=16 && pwhd>=16) #endif cimg_forYZ(*this,y,z) { tuint *ptrd = res.data(0,y,z); for (const T *ptrs = data(0,y,z), *ptrs_end = ptrs + _width; ptrs=65536) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=65536) #endif for (int c = c0; c<(int)sc; c+=spectrum()) for (int z = z0; z<(int)sz; z+=depth()) for (int y = y0; y<(int)sy; y+=height()) @@ -21239,9 +21244,9 @@ namespace cimg_library_suffixed { curr+=fx; *(poff++) = (unsigned int)curr - (unsigned int)old; } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resx.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resx.size()>=65536) #endif cimg_forYZC(resx,y,z,c) { const T *ptrs = data(0,y,z,c), *const ptrsmax = ptrs + (_width-1); T *ptrd = resx.data(0,y,z,c); @@ -21274,9 +21279,9 @@ namespace cimg_library_suffixed { curr+=fy; *(poff++) = sx*((unsigned int)curr-(unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resy.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resy.size()>=65536) #endif cimg_forXZC(resy,x,z,c) { const T *ptrs = resx.data(x,0,z,c), *const ptrsmax = ptrs + (_height-1)*sx; T *ptrd = resy.data(x,0,z,c); @@ -21312,9 +21317,9 @@ namespace cimg_library_suffixed { curr+=fz; *(poff++) = sxy*((unsigned int)curr - (unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resz.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resz.size()>=65536) #endif cimg_forXYC(resz,x,y,c) { const T *ptrs = resy.data(x,y,0,c), *const ptrsmax = ptrs + (_depth-1)*sxy; T *ptrd = resz.data(x,y,0,c); @@ -21351,9 +21356,9 @@ namespace cimg_library_suffixed { curr+=fc; *(poff++) = sxyz*((unsigned int)curr - (unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resc.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resc.size()>=65536) #endif cimg_forXYZ(resc,x,y,z) { const T *ptrs = resz.data(x,y,z,0), *const ptrsmax = ptrs + (_spectrum-1)*sxyz; T *ptrd = resc.data(x,y,z,0); @@ -21464,9 +21469,9 @@ namespace cimg_library_suffixed { curr+=fx; *(poff++) = (unsigned int)curr - (unsigned int)old; } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resx.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resx.size()>=65536) #endif cimg_forYZC(resx,y,z,c) { const T *const ptrs0 = data(0,y,z,c), *ptrs = ptrs0, *const ptrsmax = ptrs + (_width-2); T *ptrd = resx.data(0,y,z,c); @@ -21505,9 +21510,9 @@ namespace cimg_library_suffixed { curr+=fy; *(poff++) = sx*((unsigned int)curr-(unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resy.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resy.size()>=65536) #endif cimg_forXZC(resy,x,z,c) { const T *const ptrs0 = resx.data(x,0,z,c), *ptrs = ptrs0, *const ptrsmax = ptrs + (_height-2)*sx; T *ptrd = resy.data(x,0,z,c); @@ -21549,9 +21554,9 @@ namespace cimg_library_suffixed { curr+=fz; *(poff++) = sxy*((unsigned int)curr - (unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resz.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resz.size()>=65536) #endif cimg_forXYC(resz,x,y,c) { const T *const ptrs0 = resy.data(x,y,0,c), *ptrs = ptrs0, *const ptrsmax = ptrs + (_depth-2)*sxy; T *ptrd = resz.data(x,y,0,c); @@ -21594,9 +21599,9 @@ namespace cimg_library_suffixed { curr+=fc; *(poff++) = sxyz*((unsigned int)curr - (unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resc.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resc.size()>=65536) #endif cimg_forXYZ(resc,x,y,z) { const T *const ptrs0 = resz.data(x,y,z,0), *ptrs = ptrs0, *const ptrsmax = ptrs + (_spectrum-2)*sxyz; T *ptrd = resc.data(x,y,z,0); @@ -21648,9 +21653,9 @@ namespace cimg_library_suffixed { curr+=fx; *(poff++) = (unsigned int)curr - (unsigned int)old; } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resx.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resx.size()>=65536) #endif cimg_forYZC(resx,y,z,c) { const T *const ptrs0 = data(0,y,z,c), *ptrs = ptrs0, *const ptrsmin = ptrs0 + 1, *const ptrsmax = ptrs0 + (_width-2); @@ -21696,9 +21701,9 @@ namespace cimg_library_suffixed { curr+=fy; *(poff++) = sx*((unsigned int)curr-(unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resy.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resy.size()>=65536) #endif cimg_forXZC(resy,x,z,c) { const T *const ptrs0 = resx.data(x,0,z,c), *ptrs = ptrs0, *const ptrsmin = ptrs0 + sx, *const ptrsmax = ptrs0 + (_height-2)*sx; @@ -21747,9 +21752,9 @@ namespace cimg_library_suffixed { curr+=fz; *(poff++) = sxy*((unsigned int)curr - (unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resz.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resz.size()>=65536) #endif cimg_forXYC(resz,x,y,c) { const T *const ptrs0 = resy.data(x,y,0,c), *ptrs = ptrs0, *const ptrsmin = ptrs0 + sxy, *const ptrsmax = ptrs0 + (_depth-2)*sxy; @@ -21799,9 +21804,9 @@ namespace cimg_library_suffixed { curr+=fc; *(poff++) = sxyz*((unsigned int)curr - (unsigned int)old); } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (resc.size()>=65536) +#pragma omp parallel for COLLAPSE(3) if (resc.size()>=65536) #endif cimg_forXYZ(resc,x,y,z) { const T *const ptrs0 = resz.data(x,y,z,0), *ptrs = ptrs0, *const ptrsmin = ptrs0 + sxyz, *const ptrsmax = ptrs + (_spectrum-2)*sxyz; @@ -22636,25 +22641,25 @@ namespace cimg_library_suffixed { case 0 : { // Dirichlet boundaries. switch (interpolation) { case 2 : { // Cubic interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) { const Tfloat val = cubic_atXY(w2 + (x-dw2)*ca + (y-dh2)*sa,h2 - (x-dw2)*sa + (y-dh2)*ca,z,c,0); res(x,y,z,c) = (T)(valvmax?vmax:val); } } break; case 1 : { // Linear interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = (T)linear_atXY(w2 + (x-dw2)*ca + (y-dh2)*sa,h2 - (x-dw2)*sa + (y-dh2)*ca,z,c,0); } break; default : { // Nearest-neighbor interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = atXY((int)(w2 + (x-dw2)*ca + (y-dh2)*sa),(int)(h2 - (x-dw2)*sa + (y-dh2)*ca),z,c,0); } @@ -22663,25 +22668,25 @@ namespace cimg_library_suffixed { case 1 : { // Neumann boundaries. switch (interpolation) { case 2 : { // Cubic interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) { const Tfloat val = _cubic_atXY(w2 + (x-dw2)*ca + (y-dh2)*sa,h2 - (x-dw2)*sa + (y-dh2)*ca,z,c); res(x,y,z,c) = (T)(valvmax?vmax:val); } } break; case 1 : { // Linear interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = (T)_linear_atXY(w2 + (x-dw2)*ca + (y-dh2)*sa,h2 - (x-dw2)*sa + (y-dh2)*ca,z,c); } break; default : { // Nearest-neighbor interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = _atXY((int)(w2 + (x-dw2)*ca + (y-dh2)*sa),(int)(h2 - (x-dw2)*sa + (y-dh2)*ca),z,c); } @@ -22690,9 +22695,9 @@ namespace cimg_library_suffixed { case 2 : { // Periodic boundaries. switch (interpolation) { case 2 : { // Cubic interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) { const Tfloat val = _cubic_atXY(cimg::mod(w2 + (x-dw2)*ca + (y-dh2)*sa,(float)width()), cimg::mod(h2 - (x-dw2)*sa + (y-dh2)*ca,(float)height()),z,c); @@ -22700,17 +22705,17 @@ namespace cimg_library_suffixed { } } break; case 1 : { // Linear interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = (T)_linear_atXY(cimg::mod(w2 + (x-dw2)*ca + (y-dh2)*sa,(float)width()), cimg::mod(h2 - (x-dw2)*sa + (y-dh2)*ca,(float)height()),z,c); } break; default : { // Nearest-neighbor interpolation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = (*this)(cimg::mod((int)(w2 + (x-dw2)*ca + (y-dh2)*sa),width()), cimg::mod((int)(h2 - (x-dw2)*sa + (y-dh2)*ca),height()),z,c); @@ -22762,25 +22767,25 @@ namespace cimg_library_suffixed { case 0 : { switch (interpolation) { case 2 : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) { const Tfloat val = cubic_atXY(cx + (x-cx)*ca + (y-cy)*sa,cy - (x-cx)*sa + (y-cy)*ca,z,c,0); res(x,y,z,c) = (T)(valvmax?vmax:val); } } break; case 1 : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = (T)linear_atXY(cx + (x-cx)*ca + (y-cy)*sa,cy - (x-cx)*sa + (y-cy)*ca,z,c,0); } break; default : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = atXY((int)(cx + (x-cx)*ca + (y-cy)*sa),(int)(cy - (x-cx)*sa + (y-cy)*ca),z,c,0); } @@ -22789,25 +22794,25 @@ namespace cimg_library_suffixed { case 1 : { switch (interpolation) { case 2 : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) { const Tfloat val = _cubic_atXY(cx + (x-cx)*ca + (y-cy)*sa,cy - (x-cx)*sa + (y-cy)*ca,z,c); res(x,y,z,c) = (T)(valvmax?vmax:val); } } break; case 1 : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = (T)_linear_atXY(cx + (x-cx)*ca + (y-cy)*sa,cy - (x-cx)*sa + (y-cy)*ca,z,c); } break; default : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = _atXY((int)(cx + (x-cx)*ca + (y-cy)*sa),(int)(cy - (x-cx)*sa + (y-cy)*ca),z,c); } @@ -22816,9 +22821,9 @@ namespace cimg_library_suffixed { case 2 : { switch (interpolation) { case 2 : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) { const Tfloat val = _cubic_atXY(cimg::mod(cx + (x-cx)*ca + (y-cy)*sa,(float)width()), cimg::mod(cy - (x-cx)*sa + (y-cy)*ca,(float)height()),z,c); @@ -22826,17 +22831,17 @@ namespace cimg_library_suffixed { } } break; case 1 : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = (T)_linear_atXY(cimg::mod(cx + (x-cx)*ca + (y-cy)*sa,(float)width()), cimg::mod(cy - (x-cx)*sa + (y-cy)*ca,(float)height()),z,c); } break; default : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=2048) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=2048) #endif cimg_forXYZC(res,x,y,z,c) res(x,y,z,c) = (*this)(cimg::mod((int)(cx + (x-cx)*ca + (y-cy)*sa),width()), cimg::mod((int)(cy - (x-cx)*sa + (y-cy)*ca),height()),z,c); @@ -22884,50 +22889,50 @@ namespace cimg_library_suffixed { if (is_relative) { // Relative warp. if (interpolation==2) { // Cubic interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atX(cimg::mod(x - (float)*(ptrs0++),(float)_width),y,z,c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atX(x - (float)*(ptrs0++),y,z,c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)cubic_atX(x - (float)*(ptrs0++),y,z,c,0); } } else if (interpolation==1) { // Linear interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atX(cimg::mod(x - (float)*(ptrs0++),(float)_width),y,z,c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atX(x - (float)*(ptrs0++),y,z,c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)linear_atX(x - (float)*(ptrs0++),y,z,c,0); @@ -22952,50 +22957,50 @@ namespace cimg_library_suffixed { } else { // Absolute warp. if (interpolation==2) { // Cubic interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atX(cimg::mod((float)*(ptrs0++),(float)_width),0,0,c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atX((float)*(ptrs0++),0,0,c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)cubic_atX((float)*(ptrs0++),0,0,c,0); } } else if (interpolation==1) { // Linear interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atX(cimg::mod((float)*(ptrs0++),(float)_width),0,0,c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atX((float)*(ptrs0++),0,0,c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)linear_atX((float)*(ptrs0++),0,0,c,0); @@ -23023,52 +23028,52 @@ namespace cimg_library_suffixed { if (is_relative) { // Relative warp. if (interpolation==2) { // Cubic interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atXY(cimg::mod(x - (float)*(ptrs0++),(float)_width), cimg::mod(y - (float)*(ptrs1++),(float)_height),z,c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atXY(x - (float)*(ptrs0++),y - (float)*(ptrs1++),z,c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)cubic_atXY(x - (float)*(ptrs0++),y - (float)*(ptrs1++),z,c,0); } } else if (interpolation==1) { // Linear interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atXY(cimg::mod(x - (float)*(ptrs0++),(float)_width), cimg::mod(y - (float)*(ptrs1++),(float)_height),z,c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atXY(x - (float)*(ptrs0++),y - (float)*(ptrs1++),z,c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)linear_atXY(x - (float)*(ptrs0++),y - (float)*(ptrs1++),z,c,0); @@ -23094,52 +23099,52 @@ namespace cimg_library_suffixed { } else { // Absolute warp. if (interpolation==2) { // Cubic interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atXY(cimg::mod((float)*(ptrs0++),(float)_width), cimg::mod((float)*(ptrs1++),(float)_height),0,c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atXY((float)*(ptrs0++),(float)*(ptrs1++),0,c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)cubic_atXY((float)*(ptrs0++),(float)*(ptrs1++),0,c,0); } } else if (interpolation==1) { // Linear interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atXY(cimg::mod((float)*(ptrs0++),(float)_width), cimg::mod((float)*(ptrs1++),(float)_height),0,c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atXY((float)*(ptrs0++),(float)*(ptrs1++),0,c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)linear_atXY((float)*(ptrs0++),(float)*(ptrs1++),0,c,0); @@ -23168,9 +23173,9 @@ namespace cimg_library_suffixed { if (is_relative) { // Relative warp. if (interpolation==2) { // Cubic interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23179,9 +23184,9 @@ namespace cimg_library_suffixed { cimg::mod(z - (float)*(ptrs2++),(float)_depth),c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23189,9 +23194,9 @@ namespace cimg_library_suffixed { *(ptrd++) = (T)_cubic_atXYZ(x - (float)*(ptrs0++),y - (float)*(ptrs1++),z - (float)*(ptrs2++),c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23200,9 +23205,9 @@ namespace cimg_library_suffixed { } } else if (interpolation==1) { // Linear interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23211,9 +23216,9 @@ namespace cimg_library_suffixed { cimg::mod(z - (float)*(ptrs2++),(float)_depth),c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23221,9 +23226,9 @@ namespace cimg_library_suffixed { *(ptrd++) = (T)_linear_atXYZ(x - (float)*(ptrs0++),y - (float)*(ptrs1++),z - (float)*(ptrs2++),c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23255,9 +23260,9 @@ namespace cimg_library_suffixed { } else { // Absolute warp. if (interpolation==2) { // Cubic interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23266,18 +23271,18 @@ namespace cimg_library_suffixed { cimg::mod((float)*(ptrs2++),(float)_depth),c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_cubic_atXYZ((float)*(ptrs0++),(float)*(ptrs1++),(float)*(ptrs2++),c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=4096) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=4096) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23285,9 +23290,9 @@ namespace cimg_library_suffixed { } } else if (interpolation==1) { // Linear interpolation. if (boundary_conditions==2) // Periodic boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -23296,18 +23301,18 @@ namespace cimg_library_suffixed { cimg::mod((float)*(ptrs2++),(float)_depth),c); } else if (boundary_conditions==1) // Neumann boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); cimg_forX(res,x) *(ptrd++) = (T)_linear_atXYZ((float)*(ptrs0++),(float)*(ptrs1++),(float)*(ptrs2++),c); } else // Dirichlet boundaries. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (res.size()>=1048576) +#pragma omp parallel for COLLAPSE(3) if (res.size()>=1048576) #endif cimg_forYZC(res,y,z,c) { const t *ptrs0 = warp.data(0,y,z,0), *ptrs1 = warp.data(0,y,z,1), *ptrs2 = warp.data(0,y,z,2); T *ptrd = res.data(0,y,z,c); @@ -24738,9 +24743,9 @@ namespace cimg_library_suffixed { const CImg _mask = mask.get_shared_channel(c%mask._spectrum); if (is_normalized) { // Normalized correlation. const Ttfloat _M = (Ttfloat)_mask.magnitude(2), M = _M*_M; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width*_height*_depth>=32768) +#pragma omp parallel for COLLAPSE(3) if (_width*_height*_depth>=32768) #endif for (int z = mz1; z=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Ttfloat val = 0, N = 0; @@ -24773,9 +24778,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = (Ttfloat)(N?val/std::sqrt(N):0); } else #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Ttfloat val = 0, N = 0; @@ -24790,9 +24795,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = (Ttfloat)(N?val/std::sqrt(N):0); } } else { // Classical correlation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width*_height*_depth>=32768) +#pragma omp parallel for COLLAPSE(3) if (_width*_height*_depth>=32768) #endif for (int z = mz1; z=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Ttfloat val = 0; @@ -24817,9 +24822,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = (Ttfloat)val; } else #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Ttfloat val = 0; @@ -24857,9 +24862,9 @@ namespace cimg_library_suffixed { CImg& cumulate(const char axis=0) { switch (cimg::uncase(axis)) { case 'x' : #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=512 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=512 && _height*_depth*_spectrum>=16) #endif cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); Tlong cumul = 0; @@ -24868,9 +24873,9 @@ namespace cimg_library_suffixed { break; case 'y' : { const unsigned long w = (unsigned long)_width; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_height>=512 && _width*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_height>=512 && _width*_depth*_spectrum>=16) #endif cimg_forXZC(*this,x,z,c) { T *ptrd = data(x,0,z,c); Tlong cumul = 0; @@ -24879,9 +24884,9 @@ namespace cimg_library_suffixed { } break; case 'z' : { const unsigned long wh = (unsigned long)_width*_height; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_depth>=512 && _width*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_depth>=512 && _width*_depth*_spectrum>=16) #endif cimg_forXYC(*this,x,y,c) { T *ptrd = data(x,y,0,c); Tlong cumul = 0; @@ -24890,9 +24895,9 @@ namespace cimg_library_suffixed { } break; case 'c' : { const unsigned long whd = (unsigned long)_width*_height*_depth; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_spectrum>=512 && _width*_height*_depth>=16) +#pragma omp parallel for COLLAPSE(3) if (_spectrum>=512 && _width*_height*_depth>=16) #endif cimg_forXYZ(*this,x,y,z) { T *ptrd = data(x,y,z,0); Tlong cumul = 0; @@ -24967,9 +24972,9 @@ namespace cimg_library_suffixed { const CImg _img = get_shared_channel(c%_spectrum); const CImg _mask = mask.get_shared_channel(c%mask._spectrum); if (is_normalized) { // Normalized erosion. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width*_height*_depth>=32768) +#pragma omp parallel for COLLAPSE(3) if (_width*_height*_depth>=32768) #endif for (int z = mz1; z=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Tt min_val = cimg::type::max(); @@ -25000,9 +25005,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = min_val; } else #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Tt min_val = cimg::type::max(); @@ -25017,9 +25022,9 @@ namespace cimg_library_suffixed { } } else { // Classical erosion. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width*_height*_depth>=32768) +#pragma omp parallel for COLLAPSE(3) if (_width*_height*_depth>=32768) #endif for (int z = mz1; z=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Tt min_val = cimg::type::max(); @@ -25048,9 +25053,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = min_val; } else #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Tt min_val = cimg::type::max(); @@ -25078,9 +25083,9 @@ namespace cimg_library_suffixed { if (sx>1 && _width>1) { // Along X-axis. const int L = width(), off = 1, s = (int)sx, _s1 = s/2, _s2 = s - _s1, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg buf(L); #ifdef cimg_use_opemp -#pragma omp parallel for collapse(3) firstprivate(buf) if (size()>524288) +#pragma omp parallel for COLLAPSE(3) firstprivate(buf) if (size()>524288) #endif cimg_forYZC(*this,y,z,c) { T *const ptrdb = buf._data, *ptrd = buf._data, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(0,y,z,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; @@ -25121,9 +25126,9 @@ namespace cimg_library_suffixed { const int L = height(), off = width(), s = (int)sy, _s1 = s/2, _s2 = s - _s1, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg buf(L); #ifdef cimg_use_opemp -#pragma omp parallel for collapse(3) firstprivate(buf) if (size()>524288) +#pragma omp parallel for COLLAPSE(3) firstprivate(buf) if (size()>524288) #endif cimg_forXZC(*this,x,z,c) { T *const ptrdb = buf._data, *ptrd = ptrdb, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(x,0,z,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; @@ -25165,9 +25170,9 @@ namespace cimg_library_suffixed { const int L = depth(), off = width()*height(), s = (int)sz, _s1 = s/2, _s2 = s - _s1, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg buf(L); #ifdef cimg_use_opemp -#pragma omp parallel for collapse(3) firstprivate(buf) if (size()>524288) +#pragma omp parallel for COLLAPSE(3) firstprivate(buf) if (size()>524288) #endif cimg_forXYC(*this,x,y,c) { T *const ptrdb = buf._data, *ptrd = ptrdb, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(x,y,0,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; @@ -25256,9 +25261,9 @@ namespace cimg_library_suffixed { const CImg _img = get_shared_channel(c%_spectrum); const CImg _mask = mask.get_shared_channel(c%mask._spectrum); if (is_normalized) { // Normalized dilation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width*_height*_depth>=32768) +#pragma omp parallel for COLLAPSE(3) if (_width*_height*_depth>=32768) #endif for (int z = mz1; z=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Tt max_val = cimg::type::min(); @@ -25289,9 +25294,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = max_val; } else #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(*this,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Tt max_val = cimg::type::min(); @@ -25305,9 +25310,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = max_val; } } else { // Classical dilation. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth>=128) #endif for (int z = mz1; z=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Tt max_val = cimg::type::min(); @@ -25336,9 +25341,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = max_val; } else #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=256 && _height*_depth>=128) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=128) #endif cimg_forYZ(res,y,z) for (int x = 0; x=mye || z=mze)?++x:((x=mxe)?++x:(x=mxe))) { Tt max_val = cimg::type::min(); @@ -25366,9 +25371,9 @@ namespace cimg_library_suffixed { if (sx>1 && _width>1) { // Along X-axis. const int L = width(), off = 1, s = (int)sx, _s2 = s/2 + 1, _s1 = s - _s2, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg buf(L); #ifdef cimg_use_opemp -#pragma omp parallel for collapse(3) firstprivate(buf) if (size()>524288) +#pragma omp parallel for COLLAPSE(3) firstprivate(buf) if (size()>524288) #endif cimg_forYZC(*this,y,z,c) { T *const ptrdb = buf._data, *ptrd = ptrdb, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(0,y,z,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; @@ -25410,9 +25415,9 @@ namespace cimg_library_suffixed { const int L = height(), off = width(), s = (int)sy, _s2 = s/2 + 1, _s1 = s - _s2, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg buf(L); #ifdef cimg_use_opemp -#pragma omp parallel for collapse(3) firstprivate(buf) if (size()>524288) +#pragma omp parallel for COLLAPSE(3) firstprivate(buf) if (size()>524288) #endif cimg_forXZC(*this,x,z,c) { T *const ptrdb = buf._data, *ptrd = ptrdb, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(x,0,z,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; @@ -25454,9 +25459,9 @@ namespace cimg_library_suffixed { const int L = depth(), off = width()*height(), s = (int)sz, _s2 = s/2 + 1, _s1 = s - _s2, s1 = _s1>L?L:_s1, s2 = _s2>L?L:_s2; CImg buf(L); #ifdef cimg_use_opemp -#pragma omp parallel for collapse(3) firstprivate(buf) if (size()>524288) +#pragma omp parallel for COLLAPSE(3) firstprivate(buf) if (size()>524288) #endif cimg_forXYC(*this,x,y,c) { T *const ptrdb = buf._data, *ptrd = ptrdb, *const ptrde = buf._data + L - 1; const T *const ptrsb = data(x,y,0,c), *ptrs = ptrsb, *const ptrse = ptrs + L*off - off; @@ -25775,33 +25780,33 @@ namespace cimg_library_suffixed { case 'x' : { const int N = _width; const unsigned long off = 1U; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth*_spectrum>=16) #endif cimg_forYZC(*this,y,z,c) { T *ptrX = data(0,y,z,c); _cimg_deriche_apply; } } break; case 'y' : { const int N = _height; const unsigned long off = (unsigned long)_width; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth*_spectrum>=16) #endif cimg_forXZC(*this,x,z,c) { T *ptrX = data(x,0,z,c); _cimg_deriche_apply; } } break; case 'z' : { const int N = _depth; const unsigned long off = (unsigned long)_width*_height; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth*_spectrum>=16) #endif cimg_forXYC(*this,x,y,c) { T *ptrX = data(x,y,0,c); _cimg_deriche_apply; } } break; default : { const int N = _spectrum; const unsigned long off = (unsigned long)_width*_height*_depth; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth*_spectrum>=16) #endif cimg_forXYZ(*this,x,y,z) { T *ptrX = data(x,y,z,0); _cimg_deriche_apply; } } } @@ -26002,31 +26007,31 @@ namespace cimg_library_suffixed { filter[0] = B; filter[1] = -b1; filter[2] = -b2; filter[3] = -b3; switch (naxis) { case 'x' : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth*_spectrum>=16) #endif cimg_forYZC(*this,y,z,c) _cimg_recursive_apply(data(0,y,z,c),filter,_width,1U,order,boundary_conditions); } break; case 'y' : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth*_spectrum>=16) #endif cimg_forXZC(*this,x,z,c) _cimg_recursive_apply(data(x,0,z,c),filter,_height,(unsigned long)_width,order,boundary_conditions); } break; case 'z' : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth*_spectrum>=16) #endif cimg_forXYC(*this,x,y,c) _cimg_recursive_apply(data(x,y,0,c),filter,_depth,(unsigned long)(_width*_height), order,boundary_conditions); } break; default : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=256 && _height*_depth*_spectrum>=16) +#pragma omp parallel for COLLAPSE(3) if (_width>=256 && _height*_depth*_spectrum>=16) #endif cimg_forXYZ(*this,x,y,z) _cimg_recursive_apply(data(x,y,z,0),filter,_spectrum,(unsigned long)(_width*_height*_depth), order,boundary_conditions); @@ -26189,9 +26194,9 @@ namespace cimg_library_suffixed { *(pd3++) = (Tfloat)n; } #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=256 && _height*_depth>=2) firstprivate(val) +#pragma omp parallel for COLLAPSE(2) if (_width>=256 && _height*_depth>=2) firstprivate(val) #endif cimg_forXYZ(*this,x,y,z) { val.fill(0); const float @@ -26731,9 +26736,9 @@ namespace cimg_library_suffixed { default : { const int psize2 = (int)patch_size/2, psize1 = (int)patch_size - psize2 - 1; if (is_fast_approx) #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (res._width>=32 && res._height*res._depth>=4) private(P,Q) +#pragma omp parallel for COLLAPSE(2) if (res._width>=32 && res._height*res._depth>=4) private(P,Q) #endif cimg_forXYZ(res,x,y,z) { // Fast P = img.get_crop(x - psize1,y - psize1,z - psize1,x + psize2,y + psize2,z + psize2,true); const int x0 = x - rsize1, y0 = y - rsize1, z0 = z - rsize1, @@ -26751,9 +26756,9 @@ namespace cimg_library_suffixed { if (sum_weights>0) cimg_forC(res,c) res(x,y,z,c)/=sum_weights; else cimg_forC(res,c) res(x,y,z,c) = (Tfloat)((*this)(x,y,z,c)); } else #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (res._width>=32 && res._height*res._depth>=4) firstprivate(P,Q) +#pragma omp parallel for COLLAPSE(2) if (res._width>=32 && res._height*res._depth>=4) firstprivate(P,Q) #endif cimg_forXYZ(res,x,y,z) { // Exact P = img.get_crop(x - psize1,y - psize1,z - psize1,x + psize2,y + psize2,z + psize2,true); const int x0 = x - rsize1, y0 = y - rsize1, z0 = z - rsize1, @@ -26850,9 +26855,9 @@ namespace cimg_library_suffixed { const int hl = n/2, hr = hl - 1 + n%2; if (res._depth!=1) { // 3d if (threshold>0) #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=16 && _height*_depth*_spectrum>=4) +#pragma omp parallel for COLLAPSE(3) if (_width>=16 && _height*_depth*_spectrum>=4) #endif cimg_forXYZC(*this,x,y,z,c) { // With threshold. const int x0 = x - hl, y0 = y - hl, z0 = z-hl, x1 = x + hr, y1 = y + hr, z1 = z+hr, @@ -26867,9 +26872,9 @@ namespace cimg_library_suffixed { res(x,y,z,c) = values.get_shared_points(0,nb_values-1).median(); } else #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width>=16 && _height*_depth*_spectrum>=4) +#pragma omp parallel for COLLAPSE(3) if (_width>=16 && _height*_depth*_spectrum>=4) #endif cimg_forXYZC(*this,x,y,z,c) { // Without threshold. const int x0 = x - hl, y0 = y - hl, z0 = z-hl, x1 = x + hr, y1 = y + hr, z1 = z+hr, @@ -26881,9 +26886,9 @@ namespace cimg_library_suffixed { #define _cimg_median_sort(a,b) if ((a)>(b)) cimg::swap(a,b) if (res._height!=1) { // 2d if (threshold>0) #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=16 && _height*_spectrum>=4) +#pragma omp parallel for COLLAPSE(2) if (_width>=16 && _height*_spectrum>=4) #endif cimg_forXYC(*this,x,y,c) { // With threshold. const int x0 = x - hl, y0 = y - hl, x1 = x + hr, y1 = y + hr, @@ -26965,9 +26970,9 @@ namespace cimg_library_suffixed { } } break; default : { #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=16 && _height*_spectrum>=4) +#pragma omp parallel for COLLAPSE(2) if (_width>=16 && _height*_spectrum>=4) #endif cimg_forXYC(*this,x,y,c) { const int x0 = x - hl, y0 = y - hl, x1 = x + hr, y1 = y + hr, @@ -27051,9 +27056,9 @@ namespace cimg_library_suffixed { if (sharpen_type) { // Shock filters. CImg G = (alpha>0?get_blur(alpha).get_structure_tensors():get_structure_tensors()); if (sigma>0) G.blur(sigma); #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=32 && _height*_depth>=16) +#pragma omp parallel for COLLAPSE(2) if (_width>=32 && _height*_depth>=16) #endif cimg_forYZ(G,y,z) { Tfloat *ptrG0 = G.data(0,y,z,0), *ptrG1 = G.data(0,y,z,1), *ptrG2 = G.data(0,y,z,2), *ptrG3 = G.data(0,y,z,3); @@ -27270,9 +27275,9 @@ namespace cimg_library_suffixed { } } else switch (scheme) { // 2d. case -1 : { // Backward finite differences. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { const unsigned long off = c*_width*_height*_depth + z*_width*_height; Tfloat *ptrd0 = grad[0]._data + off, *ptrd1 = grad[1]._data + off; @@ -27284,9 +27289,9 @@ namespace cimg_library_suffixed { } } break; case 1 : { // Forward finite differences. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { const unsigned long off = c*_width*_height*_depth + z*_width*_height; Tfloat *ptrd0 = grad[0]._data + off, *ptrd1 = grad[1]._data + off; @@ -27298,9 +27303,9 @@ namespace cimg_library_suffixed { } } break; case 2 : { // Sobel scheme. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { const unsigned long off = c*_width*_height*_depth + z*_width*_height; Tfloat *ptrd0 = grad[0]._data + off, *ptrd1 = grad[1]._data + off; @@ -27312,9 +27317,9 @@ namespace cimg_library_suffixed { } } break; case 3 : { // Rotation invariant mask. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { const unsigned long off = c*_width*_height*_depth + z*_width*_height; Tfloat *ptrd0 = grad[0]._data + off, *ptrd1 = grad[1]._data + off; @@ -27335,9 +27340,9 @@ namespace cimg_library_suffixed { grad[1] = get_vanvliet(0,1,'y'); } break; default : { // Central finite differences #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { const unsigned long off = c*_width*_height*_depth + z*_width*_height; Tfloat *ptrd0 = grad[0]._data + off, *ptrd1 = grad[1]._data + off; @@ -27400,9 +27405,9 @@ namespace cimg_library_suffixed { } } } else if (!cimg::strcasecmp(naxes,def_axes2d)) { // 2d #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { const unsigned long off = c*_width*_height*_depth + z*_width*_height; Tfloat *ptrd0 = res[0]._data + off, *ptrd1 = res[1]._data + off, *ptrd2 = res[2]._data + off; @@ -27420,9 +27425,9 @@ namespace cimg_library_suffixed { bool valid_axis = false; if (axis1=='x' && axis2=='x') { // Ixx valid_axis = true; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { Tfloat *ptrd = res[l2].data(0,0,z,c); CImg_3x3(I,Tfloat); @@ -27431,9 +27436,9 @@ namespace cimg_library_suffixed { } else if (axis1=='x' && axis2=='y') { // Ixy valid_axis = true; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { Tfloat *ptrd = res[l2].data(0,0,z,c); CImg_3x3(I,Tfloat); @@ -27453,9 +27458,9 @@ namespace cimg_library_suffixed { } else if (axis1=='y' && axis2=='y') { // Iyy valid_axis = true; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) +#pragma omp parallel for COLLAPSE(2) if (_width*_height>=1048576 && _depth*_spectrum>=2) #endif cimg_forZC(*this,z,c) { Tfloat *ptrd = res[l2].data(0,0,z,c); CImg_3x3(I,Tfloat); @@ -27696,9 +27701,9 @@ namespace cimg_library_suffixed { if (_depth>1) { // 3d get_structure_tensors().move_to(res).blur(sigma); #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if(_width>=256 && _height*_depth>=256) +#pragma omp parallel for COLLAPSE(2) if(_width>=256 && _height*_depth>=256) #endif cimg_forYZ(*this,y,z) { Tfloat *ptrd0 = res.data(0,y,z,0), *ptrd1 = res.data(0,y,z,1), *ptrd2 = res.data(0,y,z,2), @@ -27814,9 +27819,9 @@ namespace cimg_library_suffixed { float _energy = 0; if (is_3d) { // 3d version. if (smoothness>=0) // Isotropic regularization. #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_height*_depth>=8 && _width>=16) reduction(+:_energy) +#pragma omp parallel for COLLAPSE(2) if (_height*_depth>=8 && _width>=16) reduction(+:_energy) #endif cimg_forYZ(U,y,z) { const int _p1y = y?y-1:0, _n1y = y=8 && _width>=16) reduction(+:_energy) +#pragma omp parallel for COLLAPSE(2) if (_height*_depth>=8 && _width>=16) reduction(+:_energy) #endif cimg_forYZ(U,y,z) { const int _p1y = y?y-1:0, _n1y = y g(_width), dt(_width), s(_width), t(_width); CImg img = get_shared_channel(c); #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_width>=512 && _height*_depth>=16) firstprivate(g,dt,s,t) +#pragma omp parallel for COLLAPSE(2) if (_width>=512 && _height*_depth>=16) firstprivate(g,dt,s,t) #endif cimg_forYZ(*this,y,z) { // Over X-direction. cimg_forX(*this,x) g[x] = (long)img(x,y,z,0,wh); _distance_scan(_width,g,sep,f,s,t,dt); @@ -28056,9 +28061,9 @@ namespace cimg_library_suffixed { } if (_height>1) { g.assign(_height); dt.assign(_height); s.assign(_height); t.assign(_height); #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_height>=512 && _width*_depth>=16) firstprivate(g,dt,s,t) +#pragma omp parallel for COLLAPSE(2) if (_height>=512 && _width*_depth>=16) firstprivate(g,dt,s,t) #endif cimg_forXZ(*this,x,z) { // Over Y-direction. cimg_forY(*this,y) g[y] = (long)img(x,y,z,0,wh); _distance_scan(_height,g,sep,f,s,t,dt); @@ -28067,9 +28072,9 @@ namespace cimg_library_suffixed { } if (_depth>1) { g.assign(_depth); dt.assign(_depth); s.assign(_depth); t.assign(_depth); #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if (_depth>=512 && _width*_height>=16) firstprivate(g,dt,s,t) +#pragma omp parallel for COLLAPSE(2) if (_depth>=512 && _width*_height>=16) firstprivate(g,dt,s,t) #endif cimg_forXY(*this,x,y) { // Over Z-direction. cimg_forZ(*this,z) g[z] = (long)img(x,y,z,0,wh); _distance_scan(_depth,g,sep,f,s,t,dt); @@ -28098,9 +28103,9 @@ namespace cimg_library_suffixed { #endif cimg_forC(*this,c) { CImg img = get_shared_channel(c); #ifdef cimg_use_openmp -#pragma omp parallel for collapse(3) if (_width*_height*_depth>=1024) +#pragma omp parallel for COLLAPSE(3) if (_width*_height*_depth>=1024) #endif cimg_forXYZ(metric_mask,dx,dy,dz) { const t weight = metric_mask(dx,dy,dz); if (weight) { @@ -35812,9 +35817,9 @@ namespace cimg_library_suffixed { _y0 = y0<0?0:y0>=height()?height()-1:y0, _x1 = x1<0?1:x1>=width()?width()-1:x1, _y1 = y1<0?1:y1>=height()?height()-1:y1; #ifdef cimg_use_openmp -#pragma omp parallel for collapse(2) if ((1+_x1-_x0)*(1+_y1-_y0)>=2048) +#pragma omp parallel for COLLAPSE(2) if ((1+_x1-_x0)*(1+_y1-_y0)>=2048) #endif for (int q = _y0; q<=_y1; ++q) for (int p = _x0; p<=_x1; ++p) { unsigned int iteration = 0; Index: gmic-1.6.0.3/src/gmic.cpp =================================================================== --- gmic-1.6.0.3.orig/src/gmic.cpp +++ gmic-1.6.0.3/src/gmic.cpp @@ -41,8 +41,17 @@ # knowledge of the CeCILL license and that you accept its terms. # */ +#ifdef cimg_use_openmp +#include +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +#define _COLLAPSE(x) collapse(x) +#else +#define _COLLAPSE(x) +#endif +#endif + // Add G'MIC-specific methods to the CImg library. //------------------------------------------------ #ifdef cimg_plugin @@ -76,9 +85,9 @@ CImg get_gmic_invert_endianness(const } template CImg& operator_eq(const t val) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=131072) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd == (T)val); return *this; @@ -99,9 +108,9 @@ CImg& operator_eq(const char *const e if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for _COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd == (T)lmp(x,y,z,c)); ++ptrd; } } @@ -136,9 +145,9 @@ CImg& operator_eq(const CImg& img) } template CImg& operator_neq(const t val) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=131072) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd != (T)val); return *this; @@ -159,9 +168,9 @@ CImg& operator_neq(const char *const if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for _COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd != (T)lmp(x,y,z,c)); ++ptrd; } } @@ -196,9 +205,9 @@ CImg& operator_neq(const CImg& img } template CImg& operator_gt(const t val) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=131072) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd > (T)val); return *this; @@ -219,9 +228,9 @@ CImg& operator_gt(const char *const e if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for _COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd > (T)lmp(x,y,z,c)); ++ptrd; } } @@ -256,9 +265,9 @@ CImg& operator_gt(const CImg& img) } template CImg& operator_ge(const t val) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=131072) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd >= (T)val); return *this; @@ -279,9 +288,9 @@ CImg& operator_ge(const char *const e if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for _COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd >= (T)lmp(x,y,z,c)); ++ptrd; } } @@ -316,9 +325,9 @@ CImg& operator_ge(const CImg& img) } template CImg& operator_lt(const t val) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=131072) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd < (T)val); return *this; @@ -339,9 +348,9 @@ CImg& operator_lt(const char *const e if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for _COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd < (T)lmp(x,y,z,c)); ++ptrd; } } @@ -376,9 +385,9 @@ CImg& operator_lt(const CImg& img) } template CImg& operator_le(const t val) { -#ifdef cimg_use_openmp +#if defined(cimg_use_openmp) && !(defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) #pragma omp parallel for if (size()>=131072) #endif cimg_rof(*this,ptrd,T) *ptrd = (T)(*ptrd <= (T)val); return *this; @@ -399,9 +408,9 @@ CImg& operator_le(const char *const e if (_width>=512 && _height*_depth*_spectrum>=2 && std::strlen(expression)>=6) #pragma omp parallel { _cimg_math_parser _mp = omp_get_thread_num()?mp:_cimg_math_parser(), &lmp = omp_get_thread_num()?_mp:mp; -#pragma omp for collapse(3) +#pragma omp for _COLLAPSE(3) cimg_forYZC(*this,y,z,c) { T *ptrd = data(0,y,z,c); cimg_forX(*this,x) { *ptrd = (T)(*ptrd <= (T)lmp(x,y,z,c)); ++ptrd; } }