Optimizations and cleanups

(missing float conversion, defines, 1.0 vs 1.f etc.)
This commit is contained in:
Oliver Duis
2011-07-01 14:49:15 +02:00
parent 3856927098
commit a4281a9d87
25 changed files with 143 additions and 243 deletions

View File

@@ -55,6 +55,8 @@
#ifndef ARRAY2D_H_
#define ARRAY2D_H_
#include <csignal> // for raise()
#include <assert.h>
// flags for use
#define ARRAY2D_LOCK_DATA 1
#define ARRAY2D_CLEAR_DATA 2
@@ -154,6 +156,7 @@ public:
// use with indices
T * operator[](size_t index) {
assert(index>=0 && index<y);
return ptr[index];
}

View File

@@ -1198,8 +1198,8 @@ void RawImageSource::dcb_hid(float (*image)[4],float (*bufferH)[3], float (*buff
for (int row = rowMin; row < rowMax; row++) {
for (int col = colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin)&1),indx=row*CACHESIZE+col,c=FC(y0-TILEBORDER+row,x0-TILEBORDER+col); col < colMax; col+=2, indx+=2) {
assert(indx>=0 && indx<u*u);
bufferH[indx][1] = (image[indx-1][1] + image[indx+1][1]) * 0.5;
bufferV[indx][1] = (image[indx+u][1] + image[indx-u][1]) * 0.5;
bufferH[indx][1] = (image[indx-1][1] + image[indx+1][1]) * 0.5f;
bufferV[indx][1] = (image[indx+u][1] + image[indx-u][1]) * 0.5f;
}
}
// red in blue pixel, blue in red pixel
@@ -1207,22 +1207,22 @@ void RawImageSource::dcb_hid(float (*image)[4],float (*bufferH)[3], float (*buff
for (int col=colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin) & 1), indx=row*CACHESIZE+col, c=2-FC(y0-TILEBORDER+row,x0-TILEBORDER+col); col < colMax; col+=2, indx+=2) {
assert(indx>=0 && indx<u*u && c>=0 && c<3);
bufferH[indx][c] = ( 4*bufferH[indx][1]
bufferH[indx][c] = ( 4.f * bufferH[indx][1]
- bufferH[indx+u+1][1] - bufferH[indx+u-1][1] - bufferH[indx-u+1][1] - bufferH[indx-u-1][1]
+ image[indx+u+1][c] + image[indx+u-1][c] + image[indx-u+1][c] + image[indx-u-1][c] ) * 0.25;
bufferV[indx][c] = ( 4*bufferV[indx][1]
+ image[indx+u+1][c] + image[indx+u-1][c] + image[indx-u+1][c] + image[indx-u-1][c] ) * 0.25f;
bufferV[indx][c] = ( 4.f * bufferV[indx][1]
- bufferV[indx+u+1][1] - bufferV[indx+u-1][1] - bufferV[indx-u+1][1] - bufferV[indx-u-1][1]
+ image[indx+u+1][c] + image[indx+u-1][c] + image[indx-u+1][c] + image[indx-u-1][c] ) * 0.25;
+ image[indx+u+1][c] + image[indx+u-1][c] + image[indx-u+1][c] + image[indx-u-1][c] ) * 0.25f;
}
// red or blue in green pixels
for (int row=rowMin; row<rowMax; row++)
for (int col=colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin+1)&1), indx=row*CACHESIZE+col,c=FC(y0-TILEBORDER+row,x0-TILEBORDER+col+1),d=2-c; col<colMax; col+=2, indx+=2) {
assert(indx>=0 && indx<u*u && c>=0 && c<3 && d>=0 && d<3);
bufferH[indx][c] = ( image[indx+1][c] + image[indx-1][c]) * 0.5;
bufferH[indx][d] = (2*bufferH[indx][1] - bufferH[indx+u][1] - bufferH[indx-u][1] + image[indx+u][d] + image[indx-u][d]) * 0.5;
bufferV[indx][c] = (2*bufferV[indx][1] - bufferV[indx+1][1] - bufferV[indx-1][1] + image[indx+1][c] + image[indx-1][c]) * 0.5;
bufferV[indx][d] = (image[indx+u][d] + image[indx-u][d]) * 0.5;
bufferH[indx][c] = (image[indx+1][c] + image[indx-1][c]) * 0.5f;
bufferH[indx][d] = (2.f * bufferH[indx][1] - bufferH[indx+u][1] - bufferH[indx-u][1] + image[indx+u][d] + image[indx-u][d]) * 0.5f;
bufferV[indx][c] = (2.f * bufferV[indx][1] - bufferV[indx+1][1] - bufferV[indx-1][1] + image[indx+1][c] + image[indx-1][c]) * 0.5f;
bufferV[indx][d] = (image[indx+u][d] + image[indx-u][d]) * 0.5f;
}
// Decide green pixels
@@ -1262,17 +1262,17 @@ void RawImageSource::dcb_color(float (*image)[4], int x0, int y0)
for (int row=rowMin; row < rowMax; row++)
for (int col=colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin) & 1), indx=row*CACHESIZE+col, c=2-FC(y0-TILEBORDER+row,x0-TILEBORDER+col); col < colMax; col+=2, indx+=2) {
assert(indx>=0 && indx<u*u && c>=0 && c<4);
image[indx][c] = ( 4.0 * image[indx][1]
image[indx][c] = ( 4.f * image[indx][1]
- image[indx+u+1][1] - image[indx+u-1][1] - image[indx-u+1][1] - image[indx-u-1][1]
+ image[indx+u+1][c] + image[indx+u-1][c] + image[indx-u+1][c] + image[indx-u-1][c] ) * 0.25;
+ image[indx+u+1][c] + image[indx+u-1][c] + image[indx-u+1][c] + image[indx-u-1][c] ) * 0.25f;
}
// red or blue in green pixels
for (int row=rowMin; row<rowMax; row++)
for (int col=colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin+1)&1), indx=row*CACHESIZE+col,c=FC(y0-TILEBORDER+row,x0-TILEBORDER+col+1),d=2-c; col<colMax; col+=2, indx+=2) {
assert(indx>=0 && indx<u*u && c>=0 && c<4);
image[indx][c] = (2.0 * image[indx][1] - image[indx+1][1] - image[indx-1][1] + image[indx+1][c] + image[indx-1][c]) * 0.5;
image[indx][d] = (2.0 * image[indx][1] - image[indx+u][1] - image[indx-u][1] + image[indx+u][d] + image[indx-u][d]) * 0.5;
image[indx][c] = (2.f * image[indx][1] - image[indx+1][1] - image[indx-1][1] + image[indx+1][c] + image[indx-1][c]) * 0.5f;
image[indx][d] = (2.f * image[indx][1] - image[indx+u][1] - image[indx-u][1] + image[indx+u][d] + image[indx-u][d]) * 0.5f;
}
}
@@ -1286,8 +1286,8 @@ void RawImageSource::dcb_hid2(float (*image)[4], int x0, int y0)
for (int row=rowMin; row < rowMax; row++) {
for (int col = colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin)&1),indx=row*CACHESIZE+col,c=FC(y0-TILEBORDER+row,x0-TILEBORDER+col); col < colMax; col+=2, indx+=2) {
assert(indx>=0 && indx<u*u);
image[indx][1] = (image[indx+v][1] + image[indx-v][1] + image[indx-2][1] + image[indx+2][1]) * 0.25 +
image[indx][c] - ( image[indx+v][c] + image[indx-v][c] + image[indx-2][c] + image[indx+2][c]) * 0.25;
image[indx][1] = (image[indx+v][1] + image[indx-v][1] + image[indx-2][1] + image[indx+2][1]) * 0.25f +
image[indx][c] - ( image[indx+v][c] + image[indx-v][c] + image[indx-2][c] + image[indx+2][c]) * 0.25f;
}
}
}
@@ -1325,12 +1325,12 @@ void RawImageSource::dcb_correction(float (*image)[4], int x0, int y0)
for (int row=rowMin; row < rowMax; row++) {
for (int col = colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin)&1),indx=row*CACHESIZE+col,c=FC(y0-TILEBORDER+row,x0-TILEBORDER+col); col < colMax; col+=2, indx+=2) {
register float current = 4.0 * image[indx][3] +
2.0 * (image[indx+u][3] + image[indx-u][3] + image[indx+1][3] + image[indx-1][3]) +
register float current = 4.f * image[indx][3] +
2.f * (image[indx+u][3] + image[indx-u][3] + image[indx+1][3] + image[indx-1][3]) +
image[indx+v][3] + image[indx-v][3] + image[indx+2][3] + image[indx-2][3];
assert(indx>=0 && indx<u*u);
image[indx][1] = ((16.0-current)*(image[indx-1][1] + image[indx+1][1]) * 0.5 + current*(image[indx-u][1] + image[indx+u][1]) * 0.5 ) * 0.0625;
image[indx][1] = ((16.f-current)*(image[indx-1][1] + image[indx+1][1]) * 0.5f + current*(image[indx-u][1] + image[indx+u][1]) * 0.5f ) * 0.0625f;
}
}
}
@@ -1379,9 +1379,9 @@ void RawImageSource::dcb_pp(float (*image)[4], int x0, int y0)
r1 += (*pix)[0];
g1 += (*pix)[1];
b1 += (*pix)[2];
r1 *=0.125;
g1 *=0.125;
b1 *=0.125;
r1 *=0.125f;
g1 *=0.125f;
b1 *=0.125f;
r1 = r1 + ( image[indx][1] - g1 );
b1 = b1 + ( image[indx][1] - g1 );
@@ -1401,14 +1401,14 @@ void RawImageSource::dcb_correction2(float (*image)[4], int x0, int y0)
for (int row=rowMin; row < rowMax; row++) {
for (int col = colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin)&1),indx=row*CACHESIZE+col,c=FC(y0-TILEBORDER+row,x0-TILEBORDER+col); col < colMax; col+=2, indx+=2) {
register float current = 4.0 * image[indx][3] +
2.0 * (image[indx+u][3] + image[indx-u][3] + image[indx+1][3] + image[indx-1][3]) +
register float current = 4.f * image[indx][3] +
2.f * (image[indx+u][3] + image[indx-u][3] + image[indx+1][3] + image[indx-1][3]) +
image[indx+v][3] + image[indx-v][3] + image[indx+2][3] + image[indx-2][3];
assert(indx>=0 && indx<u*u);
image[indx][1] = ((16.0-current)*((image[indx-1][1] + image[indx+1][1]) * 0.5
+ image[indx][c] - (image[indx+2][c] + image[indx-2][c]) * 0.5)
+ current*((image[indx-u][1] + image[indx+u][1]) * 0.5 + image[indx][c] - (image[indx+v][c] + image[indx-v][c]) * 0.5)) * 0.0625;
image[indx][1] = ((16.f-current)*((image[indx-1][1] + image[indx+1][1]) * 0.5f
+ image[indx][c] - (image[indx+2][c] + image[indx-2][c]) * 0.5f)
+ current*((image[indx-u][1] + image[indx+u][1]) * 0.5f + image[indx][c] - (image[indx+v][c] + image[indx-v][c]) * 0.5f)) * 0.0625f;
}
}
}
@@ -1424,28 +1424,28 @@ void RawImageSource::dcb_refinement(float (*image)[4], int x0, int y0)
for (int row=rowMin; row < rowMax; row++)
for (int col=colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin)&1),indx=row*CACHESIZE+col,c=FC(y0-TILEBORDER+row,x0-TILEBORDER+col); col < colMax; col+=2,indx+=2){
float current = 4*image[indx][3] +
2*(image[indx+u][3] + image[indx-u][3] + image[indx+1][3] + image[indx-1][3])
float current = 4.f * image[indx][3] +
2.f * (image[indx+u][3] + image[indx-u][3] + image[indx+1][3] + image[indx-1][3])
+image[indx+v][3] + image[indx-v][3] + image[indx-2][3] + image[indx+2][3];
f[0] = (float)(image[indx-u][1] + image[indx+u][1])/(2 + 2*image[indx][c]);
f[1] = 2.0 * image[indx-u][1]/(2 + image[indx-v][c] + image[indx][c]);
f[2] = (float)(image[indx-u][1] + image[indx-w][1])/(2 + 2*image[indx-v][c]);
f[3] = 2.0 * image[indx+u][1]/(2 + image[indx+v][c] + image[indx][c]);
f[4] = (float)(image[indx+u][1] + image[indx+w][1])/(2 + 2.0 * image[indx+v][c]);
f[0] = (float)(image[indx-u][1] + image[indx+u][1])/(2.f + 2.f * image[indx][c]);
f[1] = 2.f * image[indx-u][1]/(2 + image[indx-v][c] + image[indx][c]);
f[2] = (float)(image[indx-u][1] + image[indx-w][1])/(2.f + 2.f * image[indx-v][c]);
f[3] = 2.f * image[indx+u][1]/(2 + image[indx+v][c] + image[indx][c]);
f[4] = (float)(image[indx+u][1] + image[indx+w][1])/(2.f + 2.f * image[indx+v][c]);
g1 = (f[0] + f[1] + f[2] + f[3] + f[4] - MAX(f[1], MAX(f[2], MAX(f[3], f[4]))) - MIN(f[1], MIN(f[2], MIN(f[3], f[4]))))/3.0;
g1 = (f[0] + f[1] + f[2] + f[3] + f[4] - MAX(f[1], MAX(f[2], MAX(f[3], f[4]))) - MIN(f[1], MIN(f[2], MIN(f[3], f[4])))) / 3.f;
f[0] = (float)(image[indx-1][1] + image[indx+1][1])/(2 + 2*image[indx][c]);
f[1] = 2.0 * image[indx-1][1]/(2 + image[indx-2][c] + image[indx][c]);
f[2] = (float)(image[indx-1][1] + image[indx-3][1])/(2 + 2*image[indx-2][c]);
f[3] = 2.0 * image[indx+1][1]/(2 + image[indx+2][c] + image[indx][c]);
f[4] = (float)(image[indx+1][1] + image[indx+3][1])/(2 + 2*image[indx+2][c]);
f[0] = (float)(image[indx-1][1] + image[indx+1][1])/(2.f + 2.f * image[indx][c]);
f[1] = 2.f * image[indx-1][1]/(2 + image[indx-2][c] + image[indx][c]);
f[2] = (float)(image[indx-1][1] + image[indx-3][1])/(2.f + 2.f * image[indx-2][c]);
f[3] = 2.f * image[indx+1][1]/(2 + image[indx+2][c] + image[indx][c]);
f[4] = (float)(image[indx+1][1] + image[indx+3][1])/(2.f + 2.f * image[indx+2][c]);
g2 = (f[0] + f[1] + f[2] + f[3] + f[4] - MAX(f[1], MAX(f[2], MAX(f[3], f[4]))) - MIN(f[1], MIN(f[2], MIN(f[3], f[4]))))/3.0;
g2 = (f[0] + f[1] + f[2] + f[3] + f[4] - MAX(f[1], MAX(f[2], MAX(f[3], f[4]))) - MIN(f[1], MIN(f[2], MIN(f[3], f[4])))) / 3.f;
assert(indx>=0 && indx<u*u);
image[indx][1] = (2.0+image[indx][c]) * (current*g1 + (16.0-current)*g2) * 0.0625;
image[indx][1] = (2.f+image[indx][c]) * (current*g1 + (16.f-current)*g2) * 0.0625f;
// get rid of the overshooted pixels
float min = MIN(image[indx+1+u][1], MIN(image[indx+1-u][1], MIN(image[indx-1+u][1], MIN(image[indx-1-u][1], MIN(image[indx-1][1], MIN(image[indx+1][1], MIN(image[indx-u][1], image[indx+u][1])))))));
@@ -1473,14 +1473,14 @@ void RawImageSource::dcb_color_full(float (*image)[4], int x0, int y0, float (*c
for (int row=rowMin; row<rowMax; row++)
for (int col=colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin)&1),indx=row*CACHESIZE+col,c=1-FC(y0-TILEBORDER+row,x0-TILEBORDER+col)/2,d=1-c; col<colMax; col+=2,indx+=2) {
f[0]=1.0/(float)(1.0+fabs(chroma[indx-u-1][c]-chroma[indx+u+1][c])+fabs(chroma[indx-u-1][c]-chroma[indx-w-3][c])+fabs(chroma[indx+u+1][c]-chroma[indx-w-3][c]));
f[1]=1.0/(float)(1.0+fabs(chroma[indx-u+1][c]-chroma[indx+u-1][c])+fabs(chroma[indx-u+1][c]-chroma[indx-w+3][c])+fabs(chroma[indx+u-1][c]-chroma[indx-w+3][c]));
f[2]=1.0/(float)(1.0+fabs(chroma[indx+u-1][c]-chroma[indx-u+1][c])+fabs(chroma[indx+u-1][c]-chroma[indx+w+3][c])+fabs(chroma[indx-u+1][c]-chroma[indx+w-3][c]));
f[3]=1.0/(float)(1.0+fabs(chroma[indx+u+1][c]-chroma[indx-u-1][c])+fabs(chroma[indx+u+1][c]-chroma[indx+w-3][c])+fabs(chroma[indx-u-1][c]-chroma[indx+w+3][c]));
g[0]=1.325*chroma[indx-u-1][c]-0.175*chroma[indx-w-3][c]-0.075*chroma[indx-w-1][c]-0.075*chroma[indx-u-3][c];
g[1]=1.325*chroma[indx-u+1][c]-0.175*chroma[indx-w+3][c]-0.075*chroma[indx-w+1][c]-0.075*chroma[indx-u+3][c];
g[2]=1.325*chroma[indx+u-1][c]-0.175*chroma[indx+w-3][c]-0.075*chroma[indx+w-1][c]-0.075*chroma[indx+u-3][c];
g[3]=1.325*chroma[indx+u+1][c]-0.175*chroma[indx+w+3][c]-0.075*chroma[indx+w+1][c]-0.075*chroma[indx+u+3][c];
f[0]=1.f/(float)(1.f+fabs(chroma[indx-u-1][c]-chroma[indx+u+1][c])+fabs(chroma[indx-u-1][c]-chroma[indx-w-3][c])+fabs(chroma[indx+u+1][c]-chroma[indx-w-3][c]));
f[1]=1.f/(float)(1.f+fabs(chroma[indx-u+1][c]-chroma[indx+u-1][c])+fabs(chroma[indx-u+1][c]-chroma[indx-w+3][c])+fabs(chroma[indx+u-1][c]-chroma[indx-w+3][c]));
f[2]=1.f/(float)(1.f+fabs(chroma[indx+u-1][c]-chroma[indx-u+1][c])+fabs(chroma[indx+u-1][c]-chroma[indx+w+3][c])+fabs(chroma[indx-u+1][c]-chroma[indx+w-3][c]));
f[3]=1.f/(float)(1.f+fabs(chroma[indx+u+1][c]-chroma[indx-u-1][c])+fabs(chroma[indx+u+1][c]-chroma[indx+w-3][c])+fabs(chroma[indx-u-1][c]-chroma[indx+w+3][c]));
g[0]=1.325f * chroma[indx-u-1][c] - 0.175f*chroma[indx-w-3][c] - 0.075f*chroma[indx-w-1][c] - 0.075f*chroma[indx-u-3][c];
g[1]=1.325f * chroma[indx-u+1][c] - 0.175f*chroma[indx-w+3][c] - 0.075f*chroma[indx-w+1][c] - 0.075f*chroma[indx-u+3][c];
g[2]=1.325f * chroma[indx+u-1][c] - 0.175f*chroma[indx+w-3][c] - 0.075f*chroma[indx+w-1][c] - 0.075f*chroma[indx+u-3][c];
g[3]=1.325f * chroma[indx+u+1][c] - 0.175f*chroma[indx+w+3][c] - 0.075f*chroma[indx+w+1][c] - 0.075f*chroma[indx+u+3][c];
assert(indx>=0 && indx<u*u && c>=0 && c<2);
chroma[indx][c]=(f[0]*g[0]+f[1]*g[1]+f[2]*g[2]+f[3]*g[3])/(f[0]+f[1]+f[2]+f[3]);
@@ -1488,15 +1488,15 @@ void RawImageSource::dcb_color_full(float (*image)[4], int x0, int y0, float (*c
for (int row=rowMin; row<rowMax; row++)
for (int col=colMin+(FC(y0-TILEBORDER+row,x0-TILEBORDER+colMin+1)&1),indx=row*CACHESIZE+col,c=FC(y0-TILEBORDER+row,x0-TILEBORDER+col+1)/2; col<colMax; col+=2,indx+=2)
for(int d=0;d<=1;c=1-c,d++){
f[0]=1.0/(float)(1.0+fabs(chroma[indx-u][c]-chroma[indx+u][c])+fabs(chroma[indx-u][c]-chroma[indx-w][c])+fabs(chroma[indx+u][c]-chroma[indx-w][c]));
f[1]=1.0/(float)(1.0+fabs(chroma[indx+1][c]-chroma[indx-1][c])+fabs(chroma[indx+1][c]-chroma[indx+3][c])+fabs(chroma[indx-1][c]-chroma[indx+3][c]));
f[2]=1.0/(float)(1.0+fabs(chroma[indx-1][c]-chroma[indx+1][c])+fabs(chroma[indx-1][c]-chroma[indx-3][c])+fabs(chroma[indx+1][c]-chroma[indx-3][c]));
f[3]=1.0/(float)(1.0+fabs(chroma[indx+u][c]-chroma[indx-u][c])+fabs(chroma[indx+u][c]-chroma[indx+w][c])+fabs(chroma[indx-u][c]-chroma[indx+w][c]));
f[0]= 1.f/(float)(1.f + fabs(chroma[indx-u][c]-chroma[indx+u][c])+fabs(chroma[indx-u][c]-chroma[indx-w][c])+fabs(chroma[indx+u][c]-chroma[indx-w][c]));
f[1]= 1.f/(float)(1.f + fabs(chroma[indx+1][c]-chroma[indx-1][c])+fabs(chroma[indx+1][c]-chroma[indx+3][c])+fabs(chroma[indx-1][c]-chroma[indx+3][c]));
f[2]= 1.f/(float)(1.f + fabs(chroma[indx-1][c]-chroma[indx+1][c])+fabs(chroma[indx-1][c]-chroma[indx-3][c])+fabs(chroma[indx+1][c]-chroma[indx-3][c]));
f[3]= 1.f/(float)(1.f + fabs(chroma[indx+u][c]-chroma[indx-u][c])+fabs(chroma[indx+u][c]-chroma[indx+w][c])+fabs(chroma[indx-u][c]-chroma[indx+w][c]));
g[0]=0.875*chroma[indx-u][c]+0.125*chroma[indx-w][c];
g[1]=0.875*chroma[indx+1][c]+0.125*chroma[indx+3][c];
g[2]=0.875*chroma[indx-1][c]+0.125*chroma[indx-3][c];
g[3]=0.875*chroma[indx+u][c]+0.125*chroma[indx+w][c];
g[0]= 0.875f * chroma[indx-u][c] + 0.125f * chroma[indx-w][c];
g[1]= 0.875f * chroma[indx+1][c] + 0.125f * chroma[indx+3][c];
g[2]= 0.875f * chroma[indx-1][c] + 0.125f * chroma[indx-3][c];
g[3]= 0.875f * chroma[indx+u][c] + 0.125f * chroma[indx+w][c];
assert(indx>=0 && indx<u*u && c>=0 && c<2);
chroma[indx][c]=(f[0]*g[0]+f[1]*g[1]+f[2]*g[2]+f[3]*g[3])/(f[0]+f[1]+f[2]+f[3]);

View File

@@ -206,6 +206,7 @@ namespace rtengine {
for (int i=0; i<dst->H; i++)
for (int j=0; j<dst->W; j++) {
// TODO: Is integer cast necessary here?
dst->L[i][j] = CLIP((int)( buffer[0][i][j] ));
dst->a[i][j] = CLIPC((int)( buffer[1][i][j] ));
dst->b[i][j] = CLIPC((int)( buffer[2][i][j] ));

View File

@@ -142,7 +142,7 @@ namespace rtengine {
for (int i=0; i<srcheight; i++)
for (int j=0; j<srcwidth; j++) {
dst[i][j] = CLIP((int)( buffer[i][j] ));
dst[i][j] = CLIP((int)( buffer[i][j] )); // TODO: Really a clip necessary?
}
@@ -210,9 +210,9 @@ namespace rtengine {
irangefn[i] = mult[level] ;
} else {
if (abs(i-0x10000)<noiselo) {
irangefn[i] = 1.0 ;
irangefn[i] = 1.f ;
} else {
irangefn[i] = 1.0 + (mult[level]-1) * (noisehi-abs(i-0x10000))/(noisehi-noiselo+0.01) ;
irangefn[i] = 1.f + (mult[level]-1) * (noisehi-abs(i-0x10000))/(noisehi-noiselo+0.01) ;
}
}
}
@@ -223,7 +223,7 @@ namespace rtengine {
#endif
for(int i = 0; i < height; i++) {
for(int j = 0; j < width; j++) {
int hipass = (data_fine[i][j]-data_coarse[i][j]);
register float hipass = (data_fine[i][j]-data_coarse[i][j]);
buffer[i][j] += irangefn[hipass+0x10000] * hipass ;
}
}

View File

@@ -67,7 +67,7 @@ void RawImageSource::processRawWhitepoint(float expos, float preser) {
for(int row=0;row<height;row++)
for(int col=0;col<width;col++)
luminosity[row*width+col] =
0.299*(float)red[row][col] + 0.587*(float)green[row][col] + 0.114*(float)blue[row][col];
0.299f * (float)red[row][col] + 0.587f * (float)green[row][col] + 0.114f * (float)blue[row][col];
}
// restore image destroyed by demosaic

View File

@@ -61,8 +61,10 @@ void RawImageSource::fast_demosaic(int winx, int winy, int winw, int winh) {
#pragma omp for
//first, interpolate borders using bilinear
for (int i=0; i<H; i++) {
float sum[6];
for (int j=0; j<bord; j++) {//first few columns
unsigned int sum[6];
for (int c=0; c<6; c++) sum[c]=0;
for (int i1=i-1; i1<i+2; i1++)
for (int j1=j-1; j1<j+2; j1++) {
@@ -90,7 +92,6 @@ void RawImageSource::fast_demosaic(int winx, int winy, int winw, int winh) {
}//j
for (int j=W-bord; j<W; j++) {//last few columns
unsigned int sum[6];
for (int c=0; c<6; c++) sum[c]=0;
for (int i1=i-1; i1<i+2; i1++)
for (int j1=j-1; j1<j+2; j1++) {
@@ -121,8 +122,9 @@ void RawImageSource::fast_demosaic(int winx, int winy, int winw, int winh) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#pragma omp for
for (int j=bord; j<W-bord; j++) {
float sum[6];
for (int i=0; i<bord; i++) {//first few rows
unsigned int sum[6];
for (int c=0; c<6; c++) sum[c]=0;
for (int i1=i-1; i1<i+2; i1++)
for (int j1=j-1; j1<j+2; j1++) {
@@ -150,7 +152,6 @@ void RawImageSource::fast_demosaic(int winx, int winy, int winw, int winh) {
}//i
for (int i=H-bord; i<H; i++) {//last few rows
unsigned int sum[6];
for (int c=0; c<6; c++) sum[c]=0;
for (int i1=i-1; i1<i+2; i1++)
for (int j1=j-1; j1<j+2; j1++) {
@@ -203,7 +204,7 @@ void RawImageSource::fast_demosaic(int winx, int winy, int winw, int winh) {
wtr=invGrad[(abs(rawData[i][j-1]-rawData[i][j+1])+abs(rawData[i][j]-rawData[i][j+2])+abs(rawData[i][j+1]-rawData[i][j+3])) >>2];
//store in rgb array the interpolated G value at R/B grid points using directional weighted average
green[i][j]=(int)((wtu*rawData[i-1][j]+wtd*rawData[i+1][j]+wtl*rawData[i][j-1]+wtr*rawData[i][j+1])/(wtu+wtd+wtl+wtr));
green[i][j]=(wtu*rawData[i-1][j]+wtd*rawData[i+1][j]+wtl*rawData[i][j-1]+wtr*rawData[i][j+1]) / (wtu+wtd+wtl+wtr);
//red[i][j] = green[i][j];
//blue[i][j] = green[i][j];
@@ -224,10 +225,10 @@ void RawImageSource::fast_demosaic(int winx, int winy, int winw, int winh) {
if (c==0) {//R site
red[i][j] = rawData[i][j];
blue[i][j] = green[i][j] - 0.25*((green[i-1][j-1]+green[i-1][j+1]+green[i+1][j+1]+green[i+1][j-1]) - \
blue[i][j] = green[i][j] - 0.25f*((green[i-1][j-1]+green[i-1][j+1]+green[i+1][j+1]+green[i+1][j-1]) - \
MIN(clip_pt,rawData[i-1][j-1]+rawData[i-1][j+1]+rawData[i+1][j+1]+rawData[i+1][j-1]));
} else {//B site
red[i][j] = green[i][j] - 0.25*((green[i-1][j-1]+green[i-1][j+1]+green[i+1][j+1]+green[i+1][j-1]) - \
red[i][j] = green[i][j] - 0.25f*((green[i-1][j-1]+green[i-1][j+1]+green[i+1][j+1]+green[i+1][j-1]) - \
MIN(clip_pt,rawData[i-1][j-1]+rawData[i-1][j+1]+rawData[i+1][j+1]+rawData[i+1][j-1]));
blue[i][j] = rawData[i][j];
}
@@ -246,9 +247,9 @@ void RawImageSource::fast_demosaic(int winx, int winy, int winw, int winh) {
for (int j=bord+1-(FC(i,2)&1); j < W-bord; j+=2) {
//interpolate R and B colors at G sites
red[i][j] = green[i][j] - 0.25*((green[i-1][j]-red[i-1][j])+(green[i+1][j]-red[i+1][j])+ \
red[i][j] = green[i][j] - 0.25f*((green[i-1][j]-red[i-1][j])+(green[i+1][j]-red[i+1][j])+ \
(green[i][j-1]-red[i][j-1])+(green[i][j+1]-red[i][j+1]));
blue[i][j] = green[i][j] - 0.25*((green[i-1][j]-blue[i-1][j])+(green[i+1][j]-blue[i+1][j])+ \
blue[i][j] = green[i][j] - 0.25f*((green[i-1][j]-blue[i-1][j])+(green[i+1][j]-blue[i+1][j])+ \
(green[i][j-1]-blue[i][j-1])+(green[i][j+1]-blue[i][j+1]));
}
progress+=(double)0.33/(H);

View File

@@ -102,8 +102,8 @@ void RawImageSource::green_equilibrate(float thresh)
o2_3=cfa[(rr)][cc-2];
o2_4=cfa[(rr)][cc+2];
d1=(o1_1+o1_2+o1_3+o1_4)/4.0;
d2=(o2_1+o2_2+o2_3+o2_4)/4.0;
d1=(o1_1+o1_2+o1_3+o1_4)*0.25f;
d2=(o2_1+o2_2+o2_3+o2_4)*0.25f;
c1=(fabs(o1_1-o1_2)+fabs(o1_1-o1_3)+fabs(o1_1-o1_4)+fabs(o1_2-o1_3)+fabs(o1_3-o1_4)+fabs(o1_2-o1_4))/6.0;
c2=(fabs(o2_1-o2_2)+fabs(o2_1-o2_3)+fabs(o2_1-o2_4)+fabs(o2_2-o2_3)+fabs(o2_3-o2_4)+fabs(o2_2-o2_4))/6.0;
@@ -131,7 +131,7 @@ void RawImageSource::green_equilibrate(float thresh)
ginterp=(gse*wtse+gnw*wtnw+gne*wtne+gsw*wtsw)/(wtse+wtnw+wtne+wtsw);
if ( ((ginterp-gin) < thresh*(ginterp+gin)) ) {
rawData[rr][cc]=0.5*(ginterp+gin);
rawData[rr][cc]=0.5f*(ginterp+gin);
counter++;
}

View File

@@ -229,10 +229,12 @@ unsigned short** RawImage::compress_image()
// copy pixel raw data: the compressed format earns space
if (filters != 0) {
#pragma omp parallel for
for (int row = 0; row < height; row++)
for (int col = 0; col < width; col++)
this->data[row][col] = image[row * width + col][FC(row, col)];
} else {
#pragma omp parallel for
for (int row = 0; row < height; row++)
for (int col = 0; col < width; col++) {
this->data[row][3 * col + 0] = image[row * width + col][0];

View File

@@ -704,20 +704,20 @@ void RawImageSource::transLine (float* red, float* green, float* blue, int i, Im
if (i==1 || i==2) { // linear interpolation
for (int j=0; j<imwidth; j++) {
int row = imwidth-1-j;
image->r[row][2*i-1] = (red[j] + image->r[row][2*i-2]) /2;
image->g[row][2*i-1] = (green[j] + image->g[row][2*i-2]) /2;
image->b[row][2*i-1] = (blue[j] + image->b[row][2*i-2]) /2;
image->r[row][2*i-1] = (red[j] + image->r[row][2*i-2]) * 0.5f;
image->g[row][2*i-1] = (green[j] + image->g[row][2*i-2]) * 0.5f;
image->b[row][2*i-1] = (blue[j] + image->b[row][2*i-2]) * 0.5f;
}
}
else if (i==imheight-1) {
for (int j=0; j<imwidth; j++) {
int row = imwidth-1-j;
image->r[row][2*i-1] = (red[j] + image->r[row][2*i-2]) /2;
image->g[row][2*i-1] = (green[j] + image->g[row][2*i-2]) /2;
image->b[row][2*i-1] = (blue[j] + image->b[row][2*i-2]) /2;
image->r[row][2*i-3] = (image->r[row][2*i-2] + image->r[row][2*i-4]) /2;
image->g[row][2*i-3] = (image->g[row][2*i-2] + image->g[row][2*i-4]) /2;
image->b[row][2*i-3] = (image->b[row][2*i-2] + image->b[row][2*i-4]) /2;
image->r[row][2*i-1] = (red[j] + image->r[row][2*i-2]) * 0.5f;
image->g[row][2*i-1] = (green[j] + image->g[row][2*i-2]) * 0.5f;
image->b[row][2*i-1] = (blue[j] + image->b[row][2*i-2]) * 0.5f;
image->r[row][2*i-3] = (image->r[row][2*i-2] + image->r[row][2*i-4]) * 0.5f;
image->g[row][2*i-3] = (image->g[row][2*i-2] + image->g[row][2*i-4]) * 0.5f;
image->b[row][2*i-3] = (image->b[row][2*i-2] + image->b[row][2*i-4]) * 0.5f;
}
}
else if (i>0 && i<imheight-1) { // vertical bicubic interpolationi
@@ -759,7 +759,7 @@ void RawImageSource::transLine (float* red, float* green, float* blue, int i, Im
}
}
}
}
} // if nikon dx1
// other (conventional) CCD coarse rotation
else {
rotateLine (red, image->r, tran, i, imwidth, imheight);

View File

@@ -118,7 +118,6 @@ class RawImageSource : public ImageSource {
void transformRect (PreviewProps pp, int tran, int &sx1, int &sy1, int &width, int &height, int &fw);
void transformPosition (int x, int y, int tran, int& tx, int& ty);
void updateHLRecoveryMap (std::string method, double rm, double gm, double bm);
void updateHLRecoveryMap_ColorPropagation ();
void HLRecovery_ColorPropagation (float* red, float* green, float* blue, int i, int sx1, int width, int skip);
unsigned FC(int row, int col){ return ri->FC(row,col); }

View File

@@ -139,7 +139,7 @@ void safe_build_subdir_list (Glib::RefPtr<Gio::File> &dir, std::vector<Glib::ust
Glib::ustring safe_filename_to_utf8 (const std::string& src)
{
Glib::ustring utf8_str;
#ifdef _WIN32
#ifdef WIN32
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try {
utf8_str = Glib::locale_to_utf8(src);

View File

@@ -225,9 +225,6 @@ void StdImageSource::getImage_ (ColorTemp ctemp, int tran, Imagefloat* image, Pr
// covert back to gamma and clip
#define GCLIP( x ) CurveFactory::gamma_srgb(CLIP(x))
// if (hrp.enabled)
// hlRecovery (red, grn, blue, i, sx1, sx2, pp.skip);
if ((mtran & TR_ROT) == TR_R180)
for (int j=0; j<imwidth; j++) {
image->r[imheight-1-ix][imwidth-1-j] = GCLIP(rm*line_red[j])/65535.0;
@@ -272,8 +269,6 @@ void StdImageSource::getImage (ColorTemp ctemp, int tran, Imagefloat* image, Pre
t1.set ();
// if (hrp.enabled==true && hrmap[0]==NULL)
// updateHLRecoveryMap ();
// the code will use OpenMP as of now.
//Image16* tmpim = new Image16 (image->width,image->height);
@@ -283,9 +278,9 @@ void StdImageSource::getImage (ColorTemp ctemp, int tran, Imagefloat* image, Pre
for ( int h = 0; h < image->height; ++h )
for ( int w = 0; w < image->width; ++w ) {
image->r[h][w] *= 65535.0 ;
image->g[h][w] *= 65535.0 ;
image->b[h][w] *= 65535.0 ;
image->r[h][w] *= 65535.0f;
image->g[h][w] *= 65535.0f;
image->b[h][w] *= 65535.0f;
//if (h==100 && w==100) printf("stdimsrc after R= %f G= %f B= %f \n",image->r[h][w],image->g[h][w],image->b[h][w]);
}
@@ -417,7 +412,7 @@ void StdImageSource::vflip (Imagefloat* image) {
int width = image->width;
int height = image->height;
register unsigned short tmp;
register float tmp;
for (int i=0; i<height/2; i++)
for (int j=0; j<width; j++) {
tmp = image->r[i][j];
@@ -431,106 +426,7 @@ void StdImageSource::vflip (Imagefloat* image) {
image->b[height-1-i][j] = tmp;
}
}
/*
void hlRecovery (unsigned short* red, unsigned short* green, unsigned short* blue, int H, int W, int i, int sx1, int sx2, int skip, char** needhr, float** hrmap[3]);
void hlmultipliers (int** rec[3], int max[3], int dh, int dw);
void StdImageSource::updateHLRecoveryMap () {
// detect maximal pixel values
int maxr = 0, maxg = 0, maxb = 0;
for (int i=32; i<img->height-32; i++)
for (int j=32; j<img->width-32; j++) {
if (img->r[i][j] > maxr) maxr = img->r[i][j];
if (img->g[i][j] > maxg) maxg = img->g[i][j];
if (img->b[i][j] > maxb) maxb = img->b[i][j];
}
maxr = maxr * 19 / 20;
maxg = maxg * 19 / 20;
maxb = maxb * 19 / 20;
max[0] = maxr;
max[1] = maxg;
max[2] = maxb;
// downscale image
int dw = img->width/HR_SCALE;
int dh = img->height/HR_SCALE;
Image16* ds = new Image16 (dw, dh);
// overburnt areas
int** rec[3];
for (int i=0; i<3; i++)
rec[i] = allocArray<int> (dw, dh);
if (needhr)
freeArray<char>(needhr, img->height);
needhr = allocArray<char> (img->width, img->height);
for (int i=0; i<img->height; i++)
for (int j=0; j<img->width; j++)
if (img->r[i][j]>=max[0] || img->g[i][j]>=max[1] || img->b[i][j]>=max[2])
needhr[i][j] = 1;
else
needhr[i][j] = 0;
for (int i=0; i<ds->height; i++)
for (int j=0; j<ds->width; j++) {
int sumr = 0; int cr = 0;
int sumg = 0; int cg = 0;
int sumb = 0; int cb = 0;
for (int x=0; x<HR_SCALE; x++)
for (int y=0; y<HR_SCALE; y++) {
int ix = HR_SCALE*i+x;
int jy = HR_SCALE*j+y;
sumr += img->r[ix][jy];
if (img->r[ix][jy] < maxr) cr++;
sumg += img->g[ix][jy];
if (img->g[ix][jy] < maxg) cg++;
sumb += img->b[ix][jy];
if (img->b[ix][jy] < maxb) cb++;
}
if (cr<HR_SCALE*HR_SCALE) rec[0][i][j] = INT_MAX; else rec[0][i][j] = sumr / HR_SCALE/HR_SCALE;
if (cg<HR_SCALE*HR_SCALE) rec[1][i][j] = INT_MAX; else rec[1][i][j] = sumg / HR_SCALE/HR_SCALE;
if (cb<HR_SCALE*HR_SCALE) rec[2][i][j] = INT_MAX; else rec[2][i][j] = sumb / HR_SCALE/HR_SCALE;
ds->r[i][j] = sumr / HR_SCALE/HR_SCALE;
ds->g[i][j] = sumg / HR_SCALE/HR_SCALE;
ds->b[i][j] = sumb / HR_SCALE/HR_SCALE;
}
hlmultipliers (rec, max, dh, dw);
if (hrmap[0]!=NULL) {
freeArray<float> (hrmap[0], dh);
freeArray<float> (hrmap[1], dh);
freeArray<float> (hrmap[2], dh);
}
hrmap[0] = allocArray<float> (dw, dh);
hrmap[1] = allocArray<float> (dw, dh);
hrmap[2] = allocArray<float> (dw, dh);
for (int i=0; i<dh; i++)
for (int j=0; j<dw; j++) {
hrmap[0][i][j] = ds->r[i][j]>0 ? (double)rec[0][i][j] / ds->r[i][j] : 1.0;
hrmap[1][i][j] = ds->g[i][j]>0 ? (double)rec[1][i][j] / ds->g[i][j] : 1.0;
hrmap[2][i][j] = ds->b[i][j]>0 ? (double)rec[2][i][j] / ds->b[i][j] : 1.0;
}
delete ds;
freeArray<int> (rec[0], dh);
freeArray<int> (rec[1], dh);
freeArray<int> (rec[2], dh);
}
void StdImageSource::hlRecovery (unsigned short* red, unsigned short* green, unsigned short* blue, int i, int sx1, int sx2, int skip) {
rtengine::hlRecovery (red, green, blue, img->height, img->width, i, sx1, sx2, skip, needhr, hrmap);
}
*/
void StdImageSource::getAutoExpHistogram (LUTu & histogram, int& histcompr) {
histcompr = 3;

View File

@@ -34,8 +34,6 @@ class StdImageSource : public ImageSource {
char** needhr;
int max[3];
void updateHLRecoveryMap ();
void hlRecovery (unsigned short* red, unsigned short* green, unsigned short* blue, int i, int sx1, int sx2, int skip);
void transform (PreviewProps pp, int tran, int &sx1, int &sy1, int &sx2, int &sy2);
void transformPixel (int x, int y, int tran, int& tx, int& ty);

View File

@@ -186,18 +186,18 @@ void hsv2rgb (float h, float s, float v, int &r, int &g, int &b) {
float r1,g1,b1;
if (i==0) {r1 = v; g1 = t; b1 = p;}
if (i==1) {r1 = q; g1 = v; b1 = p;}
if (i==2) {r1 = p; g1 = v; b1 = t;}
if (i==3) {r1 = p; g1 = q; b1 = v;}
if (i==4) {r1 = t; g1 = p; b1 = v;}
if (i==5) {r1 = v; g1 = p; b1 = q;}
else if (i==1) {r1 = q; g1 = v; b1 = p;}
else if (i==2) {r1 = p; g1 = v; b1 = t;}
else if (i==3) {r1 = p; g1 = q; b1 = v;}
else if (i==4) {r1 = t; g1 = p; b1 = v;}
else if (i==5) {r1 = v; g1 = p; b1 = q;}
r = (int)((r1)*65535);
g = (int)((g1)*65535);
b = (int)((b1)*65535);
r = (int)( r1 * 65535);
g = (int)( g1 * 65535);
b = (int)( b1 * 65535);
}
// The same function but set float values intead if int
// The same function but set float values instead if int
// Function copied for speed concerns
void hsv2rgb (float h, float s, float v, float &r, float &g, float &b) {
@@ -210,11 +210,11 @@ void hsv2rgb (float h, float s, float v, float &r, float &g, float &b) {
float t = v * ( 1 - s * ( 1 - f ) );
if (i==0) {r = v; g = t; b = p;}
if (i==1) {r = q; g = v; b = p;}
if (i==2) {r = p; g = v; b = t;}
if (i==3) {r = p; g = q; b = v;}
if (i==4) {r = t; g = p; b = v;}
if (i==5) {r = v; g = p; b = q;}
else if (i==1) {r = q; g = v; b = p;}
else if (i==2) {r = p; g = v; b = t;}
else if (i==3) {r = p; g = q; b = v;}
else if (i==4) {r = t; g = p; b = v;}
else if (i==5) {r = v; g = p; b = q;}
}
}

View File

@@ -220,7 +220,7 @@ void DirBrowser::row_expanded (const Gtk::TreeModel::iterator& iter, const Gtk::
dirTreeModel->erase (iter->children().begin());
expandSuccess = true;
}
#ifdef _WIN32
#ifdef WIN32
Glib::RefPtr<WinDirMonitor> monitor = Glib::RefPtr<WinDirMonitor>(new WinDirMonitor (iter->get_value (dtColumns.dirname), this));
iter->set_value (dtColumns.monitor, monitor);
#elif defined __APPLE__
@@ -293,7 +293,7 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) {
int count = 0;
expandSuccess = true;
#ifndef _WIN32
#ifndef WIN32
Gtk::TreeModel::iterator j = dirTreeModel->get_iter (path);
path.up ();
path.append_index (0);
@@ -303,7 +303,7 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) {
while (dir) {
Glib::ustring dirstr = dir;
#ifdef _WIN32
#ifdef WIN32
if (count==0)
dirstr = dirstr + "\\";
#endif
@@ -312,7 +312,7 @@ Gtk::TreePath DirBrowser::expandToDir (const Glib::ustring& absDirPath) {
while (i && expandSuccess) {
Gtk::TreeModel::Row crow = *i;
Glib::ustring str =crow[dtColumns.filename];
#ifdef _WIN32
#ifdef WIN32
if (str.casefold()==dirstr.casefold()) {
#else
if (str==dirstr) {

View File

@@ -21,14 +21,14 @@
#include <gtkmm.h>
#include <giomm.h>
#ifdef _WIN32
#ifdef WIN32
#include <windirmonitor.h>
#endif
#include <dirselectionlistener.h>
#include <dirbrowserremoteinterface.h>
class DirBrowser : public Gtk::VBox, public DirBrowserRemoteInterface
#ifdef _WIN32
#ifdef WIN32
, public WinDirChangeListener
#endif
{
@@ -43,7 +43,7 @@ class DirBrowser : public Gtk::VBox, public DirBrowserRemoteInterface
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon1;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon2;
Gtk::TreeModelColumn<Glib::ustring> dirname;
#ifdef _WIN32
#ifdef WIN32
Gtk::TreeModelColumn<Glib::RefPtr<WinDirMonitor> > monitor;
#else
Gtk::TreeModelColumn<Glib::RefPtr<Gio::FileMonitor> > monitor;

View File

@@ -1138,7 +1138,7 @@ bool EditorPanel::idle_sentToGimp(ProgressConnector<int> *pc,rtengine::IImage16*
Glib::ustring executable;
// start gimp
if (options.editorToSendTo==1) {
#ifdef _WIN32
#ifdef WIN32
executable = Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), "gimp-win-remote");
cmdLine = Glib::ustring("\"") + executable + Glib::ustring("\" gimp-2.4.exe ") + Glib::ustring("\"") + filename + Glib::ustring("\"");
if ( safe_file_test(executable, (Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) ) {
@@ -1149,7 +1149,7 @@ bool EditorPanel::idle_sentToGimp(ProgressConnector<int> *pc,rtengine::IImage16*
success = safe_spawn_command_line_async (cmdLine);
#endif
if (!success){
#ifdef _WIN32
#ifdef WIN32
int ver = 12;
while (!success && ver) {
executable = Glib::build_filename (Glib::build_filename(options.gimpDir,"bin"), Glib::ustring::compose(Glib::ustring("gimp-2.%1.exe"),ver));
@@ -1169,7 +1169,7 @@ bool EditorPanel::idle_sentToGimp(ProgressConnector<int> *pc,rtengine::IImage16*
}
}
else if (options.editorToSendTo==2) {
#ifdef _WIN32
#ifdef WIN32
executable = Glib::build_filename(options.psDir,"Photoshop.exe");
if ( safe_file_test(executable, (Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) ) {
cmdLine = Glib::ustring("\"") + executable + Glib::ustring("\" \"") + filename + Glib::ustring("\"");
@@ -1185,7 +1185,7 @@ bool EditorPanel::idle_sentToGimp(ProgressConnector<int> *pc,rtengine::IImage16*
#endif
}
else if (options.editorToSendTo==3) {
#ifdef _WIN32
#ifdef WIN32
if ( safe_file_test(options.customEditorProg, (Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) ) {
cmdLine = Glib::ustring("\"") + options.customEditorProg + Glib::ustring("\" \"") + filename + Glib::ustring("\"");
success = safe_spawn_command_line_async (cmdLine);

View File

@@ -371,7 +371,7 @@ FileCatalog::FileCatalog (CoarsePanel* cp, ToolBar* tb, FilePanel* filepanel) :
}
selectedDirectory = "";
#ifdef _WIN32
#ifdef WIN32
wdMonitor = NULL;
#endif
}
@@ -431,7 +431,7 @@ void FileCatalog::closeDir () {
if (filterPanel)
filterPanel->set_sensitive (false);
#ifndef _WIN32
#ifndef WIN32
if (dirMonitor)
dirMonitor->cancel ();
#else
@@ -497,7 +497,7 @@ void FileCatalog::dirSelected (const Glib::ustring& dirname, const Glib::ustring
_refreshProgressBar ();
filepanel->loadingThumbs(M("PROGRESSBAR_LOADINGTHUMBS"),0);
#ifdef _WIN32
#ifdef WIN32
wdMonitor = new WinDirMonitor (selectedDirectory, this);
#elif defined __APPLE__
printf("TODO fix dir->monitor_directory () for OSX\n");
@@ -1274,7 +1274,7 @@ int FileCatalog::reparseDirectory () {
return 1;
}
#ifdef _WIN32
#ifdef WIN32
int winDirChangedUITread (void* cat) {
gdk_threads_enter ();
((FileCatalog*)cat)->reparseDirectory ();

View File

@@ -19,7 +19,7 @@
#ifndef _FILECATALOG_
#define _FILECATALOG_
#ifdef _WIN32
#ifdef WIN32
#include <windirmonitor.h>
#endif
#include <dirbrowserremoteinterface.h>
@@ -54,7 +54,7 @@ class FileCatalog : public Gtk::VBox,
public PreviewLoaderListener,
public FilterPanelListener,
public FileBrowserListener
#ifdef _WIN32
#ifdef WIN32
, public WinDirChangeListener
#endif
{
@@ -133,7 +133,7 @@ class FileCatalog : public Gtk::VBox,
int previewsLoaded;
#ifdef _WIN32
#ifdef WIN32
WinDirMonitor* wdMonitor;
public:
void winDirChanged ();

View File

@@ -124,7 +124,7 @@ void ImageAreaPanel::scrollChanged () {
imageArea->setScrollPosition ((int)(hscroll->get_value()), (int)(vscroll->get_value()));
imageArea->queue_draw ();
#ifdef _WIN32
#ifdef WIN32
gdk_window_process_updates (get_window()->gobj(), true);
#endif
if (before && this==after)

View File

@@ -103,7 +103,7 @@ int main(int argc, char **argv)
return ret;
}
#ifndef _WIN32
#ifndef WIN32
// Move the old path to the new one if the new does not exist
if (safe_file_test(Glib::build_filename(options.rtdir,"cache"), Glib::FILE_TEST_IS_DIR) && !safe_file_test(options.cacheBaseDir, Glib::FILE_TEST_IS_DIR))
safe_g_rename(Glib::build_filename(options.rtdir,"cache"), options.cacheBaseDir);
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
}
Gtk::Main m(&argc, &argv);
#ifndef _WIN32
#ifndef WIN32
// For an unknown reason, gtkmm 2.22 don't know the gtk-button-images property, while it exists in the documentation...
// Anyway, the problem was Linux only
static Glib::RefPtr<Gtk::Settings> settings = Gtk::Settings::get_default();

View File

@@ -568,7 +568,7 @@ void Options::load () {
// Find the application data path
#ifdef _WIN32
#ifdef WIN32
/*
* If LOCALAPPDATA exists, RT run on a WinVista/7 system, so we use LOCALAPPDATA as is
* otherwise RT run on a Win2000/XP system, so we rebuild the path like this: %USERPROFILE%\Local Settings\Application Data
@@ -621,7 +621,7 @@ void Options::load () {
options.saveToFile (rtdir + "/options");
}
// Modify the path of the cache folder to the user's personal folder
#ifdef _WIN32
#ifdef WIN32
cacheBaseDir = rtdir + "/cache";
#else
cacheBaseDir = Glib::ustring(g_get_user_cache_dir()) + Glib::ustring("/") + Glib::ustring(CACHEFOLDERNAME);

View File

@@ -595,7 +595,7 @@ Gtk::Widget* Preferences::getGeneralPanel () {
hb7b->pack_start (*psDir);
dgvb->pack_start (*hb7b, Gtk::PACK_SHRINK, 4);
edPS->set_group (ge);
#elif defined _WIN32
#elif defined WIN32
Gtk::HBox* hb7 = Gtk::manage( new Gtk::HBox () );
edGimp = Gtk::manage( new Gtk::RadioButton (M("PREFERENCES_GIMPPATH")+":") );
hb7->pack_start (*edGimp, Gtk::PACK_SHRINK,4);
@@ -930,7 +930,7 @@ void Preferences::storePreferences () {
moptions.cutOverlayBrush[3]=butCropCol->get_alpha()/65535.0;
moptions.font = fontbutton->get_font_name();
#ifdef _WIN32
#ifdef WIN32
moptions.gimpDir = gimpDir->get_filename ();
moptions.psDir = psDir->get_filename ();
#elif defined __APPLE__
@@ -939,7 +939,7 @@ void Preferences::storePreferences () {
moptions.customEditorProg = editorToSendTo->get_text ();
if (edGimp->get_active ())
moptions.editorToSendTo = 1;
#ifdef _WIN32
#ifdef WIN32
else if (edPS->get_active ())
moptions.editorToSendTo = 2;
#elif defined __APPLE__
@@ -1060,7 +1060,7 @@ void Preferences::fillPreferences () {
edGimp->set_active (moptions.editorToSendTo==1);
edOther->set_active (moptions.editorToSendTo==3);
#ifdef _WIN32
#ifdef WIN32
edPS->set_active (moptions.editorToSendTo==2);
if (safe_file_test (moptions.gimpDir, Glib::FILE_TEST_IS_DIR))
gimpDir->set_filename (moptions.gimpDir);
@@ -1263,7 +1263,7 @@ void Preferences::switchThemeTo(Glib::ustring newTheme, bool slimInterface) {
files.push_back (argv0+"/themes/slim");
Gtk::RC::set_default_files (files);
#ifndef _WIN32
#ifndef WIN32
// For an unknown reason, gtkmm 2.22 don't know the gtk-button-images property, while it exists in the documentation...
// Anyway, the problem was Linux only
static Glib::RefPtr<Gtk::Settings> settings = Gtk::Settings::get_default();

View File

@@ -86,7 +86,7 @@ Splash::Splash () {
splashImage->show ();
// Tab 2: the informations about the current version
#if defined _WIN32 || defined __APPLE__
#if defined WIN32 || defined __APPLE__
std::string buildFileName = Glib::build_filename (argv0, "AboutThisBuild.txt");
#else
std::string buildFileName = Glib::build_filename (CREDITS_SEARCH_PATH, "AboutThisBuild.txt");
@@ -113,7 +113,7 @@ Splash::Splash () {
}
// Tab 3: the credits
#if defined _WIN32 || defined __APPLE__
#if defined WIN32 || defined __APPLE__
std::string creditsFileName = Glib::build_filename (argv0, "AUTHORS.txt");
#else
std::string creditsFileName = Glib::build_filename (CREDITS_SEARCH_PATH, "AUTHORS.txt");
@@ -140,7 +140,7 @@ Splash::Splash () {
}
// Tab 4: the license
#if defined _WIN32 || defined __APPLE__
#if defined WIN32 || defined __APPLE__
std::string licenseFileName = Glib::build_filename (argv0, "LICENSE.txt");
#else
std::string licenseFileName = Glib::build_filename (LICENCE_SEARCH_PATH, "LICENSE.txt");

View File

@@ -525,7 +525,7 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) {
}
redraw ();
#ifdef _WIN32
#ifdef WIN32
gdk_window_process_updates (get_window()->gobj(), true);
#endif
}