Merge with e190c52ab7861c68762aaa552f3dc0f59fe2e225 from default

This revision compiles and runs on Win7x64- but further evaluation is necessary.
There may be an issue with cmake step -After cmake I had to copy rtgui/version.h & config.h into out of source build /rtgui folder.
Additional notes:
- ImProcFunctions::hsv2rgb01   -> this likely need to be added to color.h & color.cc
- Use of array2D should be verified in NR code
- compilation warning for rtengine::RawImageSource::isWBProviderReady()
This commit is contained in:
michael
2012-07-03 23:15:07 -04:00
parent 78d4f80875
commit 3a4100e710
374 changed files with 47381 additions and 39387 deletions

View File

@@ -17,14 +17,14 @@
* 2010 Emil Martinec <ejmartin@uchicago.edu>
*
*/
#define SQR(x) ((x)*(x))
#include <cstddef>
#include <algorithm>
#include "rt_math.h"
#include "rt_math.h"
#include "labimage.h"
#include "improcfun.h"
using namespace std;
namespace rtengine {
@@ -37,15 +37,17 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) {
int width = lab->W;
int height = lab->H;
float hpfabs, hfnbrave;
// buffer for the lowpass image
float ** lpf = new float *[height];
// buffer for the highpass image
char ** impish = new char *[height];
float ** impish = new float *[height];
for (int i=0; i<height; i++) {
lpf[i] = new float [width];
//memset (lpf[i], 0, width*sizeof(float));
impish[i] = new char [width];
impish[i] = new float [width];
//memset (impish[i], 0, width*sizeof(unsigned short));
}
@@ -61,7 +63,7 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) {
//rangeblur<unsigned short, unsigned int> (lab->L, lpf, impish /*used as buffer here*/, width, height, thresh, false);
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(width,height));
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (max(width,height));
gaussHorizontal<float> (lab->L, lpf, buffer, width, height, MAX(2.0,thresh-1.0), false /*multiThread*/);
gaussVertical<float> (lpf, lpf, buffer, width, height, MAX(2.0,thresh-1.0), false);
@@ -71,15 +73,15 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float impthr = MAX(1.0,5.5-thresh);
float impthr = max(1.0,5.5-thresh);
for (int i=0; i < height; i++)
for (int j=0; j < width; j++) {
float hfnbrave = 0;
float hpfabs = fabs(lab->L[i][j]-lpf[i][j]);
hpfabs = fabs(lab->L[i][j]-lpf[i][j]);
//block average of high pass data
for (i1=MAX(0,i-2); i1<=MIN(i+2,height-1); i1++ )
for (j1=MAX(0,j-2); j1<=MIN(j+2,width-1); j1++ ) {
for (i1=max(0,i-2), hfnbrave=0; i1<=min(i+2,height-1); i1++ )
for (j1=max(0,j-2); j1<=min(j+2,width-1); j1++ ) {
hfnbrave += fabs(lab->L[i1][j1]-lpf[i1][j1]);
}
hfnbrave = (hfnbrave-hpfabs)/24;
@@ -92,8 +94,8 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) {
if (!impish[i][j]) continue;
norm=0.0;
wtdsum[0]=wtdsum[1]=wtdsum[2]=0.0;
for (i1=MAX(0,i-2); i1<=MIN(i+2,height-1); i1++ )
for (j1=MAX(0,j-2); j1<=MIN(j+2,width-1); j1++ ) {
for (i1=max(0,i-2), hfnbrave=0; i1<=min(i+2,height-1); i1++ )
for (j1=max(0,j-2); j1<=min(j+2,width-1); j1++ ) {
if (i1==i && j1==j) continue;
if (impish[i1][j1]) continue;
dirwt = 1/(SQR(lab->L[i1][j1]-lab->L[i][j])+eps);//use more sophisticated rangefn???