Code cleanup for min/max functions. Committed on behalf of lebedev.ri (thanks!).

This commit is contained in:
Emil Martinec
2012-04-09 15:42:59 -05:00
parent 30681df133
commit 033755b6df
61 changed files with 767 additions and 620 deletions

View File

@@ -31,7 +31,7 @@
#include <omp.h>
#endif
#define SQR(x) ((x)*(x))
#include "rt_math.h"
#define CLIPTO(a,b,c) ((a)>(b)?((a)<(c)?(a):(c)):(b))
#define CLIPC(a) ((a)>-32000?((a)<32000?(a):32000):-32000)
#define CLIP(a) (CLIPTO(a,0,65535))
@@ -182,8 +182,8 @@ namespace rtengine {
float val=0;
float norm=0;
for(int inbr=MAX(0,i-scalewin); inbr<=MIN(height-1,i+scalewin); inbr+=scale) {
for (int jnbr=MAX(0,j-scalewin); jnbr<=MIN(width-1,j+scalewin); jnbr+=scale) {
for(int inbr=max(0,i-scalewin); inbr<=min(height-1,i+scalewin); inbr+=scale) {
for (int jnbr=max(0,j-scalewin); jnbr<=min(width-1,j+scalewin); jnbr+=scale) {
float dirwt = DIRWT(inbr, jnbr, i, j);
val += dirwt*data_fine[inbr][jnbr];
norm += dirwt;
@@ -202,7 +202,7 @@ namespace rtengine {
void ImProcFunctions::idirpyr_eq_channel(float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, const double * mult )
{
float noisehi = 1.33*noise*mult[4]/pow(3,level), noiselo = 0.66*noise*mult[4]/pow(3,level);
float noisehi = 1.33*noise*mult[4]/expf(level*log(3.0)), noiselo = 0.66*noise*mult[4]/expf(level*log(3.0));
LUTf irangefn (0x20000);
for (int i=0; i<0x20000; i++) {