diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index c587962de..dc369c5e8 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -235,36 +235,52 @@ void RawImageSource::getImage (ColorTemp ctemp, int tran, Image16* image, Previe imwidth = maximwidth; if (!fuji && imheight>maximheight) imheight = maximheight; - +#ifdef _OPENMP +#pragma omp parallel + { +#endif // render the requested image part unsigned short* red = new unsigned short[imwidth]; unsigned short* grn = new unsigned short[imwidth]; unsigned short* blue = new unsigned short[imwidth]; - float rtot,gtot,btot; - int boxarea=SQR(pp.skip); - for (int i=sy1,ix=0; ixW,maxy=this->H; +#ifdef _OPENMP +#pragma omp for +#endif + for (int ix=0; ixisBayer()) { for (int j=0,jx=sx1; jred[i+m][jx+n]; gtot += this->green[i+m][jx+n]; btot += this->blue[i+m][jx+n]; + boxarea++; } + if (boxarea<1) boxarea=1; red[j] = CLIP(rm*rtot/boxarea); grn[j] = CLIP(gm*gtot/boxarea); blue[j] = CLIP(bm*btot/boxarea); } } else { for (int j=0,jx=sx1; jwidth%2==0) || ((tran & TR_ROT) == TR_R180 && image->height%2+image->width%2==1) || ((tran & TR_ROT) == TR_R270 && image->height%2==0); // first row diff --git a/rtengine/stdimagesource.cc b/rtengine/stdimagesource.cc index e29462d39..5fdcfbbeb 100644 --- a/rtengine/stdimagesource.cc +++ b/rtengine/stdimagesource.cc @@ -178,22 +178,33 @@ void StdImageSource::getImage_ (ColorTemp ctemp, int tran, Image16* image, Previ int mtran = tran; int skip = pp.skip; +#ifdef _OPENMP +#pragma omp parallel + { +#endif unsigned short* red = new unsigned short[imwidth]; unsigned short* grn = new unsigned short[imwidth]; unsigned short* blue = new unsigned short[imwidth]; - float rtot,gtot,btot; - int boxarea=SQR(pp.skip); - for (int i=istart; iwidth,maxy=img->height; + int b_ix=ix; +#ifdef _OPENMP +#pragma omp for +#endif + for (int i=istart; ir[i+m][jx+n]; gtot += img->g[i+m][jx+n]; btot += img->b[i+m][jx+n]; - } - + boxarea++; + } + if (boxarea<1) boxarea=1; red[j] = round(rtot/boxarea); grn[j] = round(gtot/boxarea); blue[j] = round(btot/boxarea); @@ -231,8 +242,12 @@ void StdImageSource::getImage_ (ColorTemp ctemp, int tran, Image16* image, Previ delete [] red; delete [] grn; delete [] blue; +#ifdef _OPENMP + } +#endif } + void StdImageSource::getImage (ColorTemp ctemp, int tran, Image16* image, PreviewProps pp, HRecParams hrp, ColorManagementParams cmp, RAWParams raw) { MyTime t1,t2;