From 98a4daf9aff1b54c0ca76d79524707a1da9e70f3 Mon Sep 17 00:00:00 2001 From: Emil Martinec Date: Sun, 12 Dec 2010 07:47:41 -0600 Subject: [PATCH] Fix for smoother zoomed out preview images. Instead of point sampling every 'skip' number of pixels, pixels are binned in 'skip*skip' size blocks. --- rtengine/rawimagesource.cc | 30 +++++++++++++++++++++++------- rtengine/stdimagesource.cc | 20 +++++++++++++++----- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index dc31e81ea..c587962de 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -241,19 +241,35 @@ void RawImageSource::getImage (ColorTemp ctemp, int tran, Image16* image, Previe 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; ixisBayer()) { for (int j=0,jx=sx1; jred[i][jx]); - grn[j] = CLIP(gm*this->green[i][jx]); - blue[j] = CLIP(bm*this->blue[i][jx]); + rtot=gtot=btot=0; + for (int m=0; mred[i+m][jx+n]; + gtot += this->green[i+m][jx+n]; + btot += this->blue[i+m][jx+n]; + } + 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; jr[i][jx]; - grn[j] = img->g[i][jx]; - blue[j] = img->b[i][jx]; - } + for (int j=0,jx=sx1; jr[i+m][jx+n]; + gtot += img->g[i+m][jx+n]; + btot += img->b[i+m][jx+n]; + } + + red[j] = round(rtot/boxarea); + grn[j] = round(gtot/boxarea); + blue[j] = round(btot/boxarea); + } // if (hrp.enabled) // hlRecovery (red, grn, blue, i, sx1, sx2, pp.skip);