f.repair.cc (fotoxx-22.30) | : | f.repair.cc (fotoxx-22.35) | ||
---|---|---|---|---|
skipping to change at line 3251 | skipping to change at line 3251 | |||
// image noise reduction | // image noise reduction | |||
namespace denoise_names | namespace denoise_names | |||
{ | { | |||
enum dn_method { voodoo, chroma, anneal, flatten, median, SNN } | enum dn_method { voodoo, chroma, anneal, flatten, median, SNN } | |||
dn_method; | dn_method; | |||
int noise_histogram[3][256]; | int noise_histogram[3][256]; | |||
int dn_radius, dn_thresh; | int dn_radius, dn_thresh; | |||
float dn_darkareas; | float dn_darkareas; | |||
int Tradius, Tthresh; | ||||
zdialog *zd_denoise_measure; | zdialog *zd_denoise_measure; | |||
cchar *mformat = " mean RGB: %5.0f %5.0f %5.0f "; | cchar *mformat = " mean RGB: %5.0f %5.0f %5.0f "; | |||
cchar *nformat = " mean noise: %5.2f %5.2f %5.2f "; | cchar *nformat = " mean noise: %5.2f %5.2f %5.2f "; | |||
int Eww, Ehh; // image dimensions | int Eww, Ehh; // image dimensions | |||
editfunc EFdenoise; | editfunc EFdenoise; | |||
char edit_hist[100]; | char edit_hist[100]; | |||
GtkWidget *denoise_measure_drawwin; | GtkWidget *denoise_measure_drawwin; | |||
} | } | |||
skipping to change at line 3570 | skipping to change at line 3571 | |||
{ | { | |||
using namespace denoise_names; | using namespace denoise_names; | |||
void * denoise_chroma_wthread1(void *arg); | void * denoise_chroma_wthread1(void *arg); | |||
void * denoise_chroma_wthread2(void *arg); | void * denoise_chroma_wthread2(void *arg); | |||
void * denoise_anneal_wthread(void *arg); | void * denoise_anneal_wthread(void *arg); | |||
void * denoise_flatten_wthread(void *arg); | void * denoise_flatten_wthread(void *arg); | |||
void * denoise_median_wthread(void *arg); | void * denoise_median_wthread(void *arg); | |||
void * denoise_SNN_wthread(void *arg); // 22.18 | void * denoise_SNN_wthread(void *arg); // 22.18 | |||
int ii, px, py, Fend, thresh2; | int px, py, Fend; | |||
float *pix1, *pix3, blend; | float *pix1, *pix3, blend; | |||
int nc = E3pxm->nc, pcc = nc * sizeof(float); | int nc = E3pxm->nc, pcc = nc * sizeof(float); | |||
if (dn_method == voodoo) | if (dn_method == voodoo) // redone 22.31 | |||
{ | { | |||
if (sa_stat == 3) progress_reset(sa_Npixel * 4); | if (sa_stat == 3) progress_reset(sa_Npixel * 3); | |||
// progress counter | // initz. progress counter | |||
else progress_reset(Eww * Ehh * 4); | else progress_reset(Eww * Ehh * 3); | |||
thresh2 = dn_thresh; | Tradius = 1; | |||
dn_thresh = 255; | // get rid of salt & pepper noise | |||
// salt and pepper elimination | Tthresh = 200; | |||
dn_radius = 1; | get_edit_pixels_init(NWT,Tradius); | |||
get_edit_pixels_init(NWT,dn_radius); | // initz. pixel loop | |||
// initz. pixel loop | ||||
do_wthreads(denoise_median_wthread,NWT); // median denoise | do_wthreads(denoise_median_wthread,NWT); // median denoise | |||
PXM_copy(E3pxm,E1pxm); // E3 (output) --> E1 (input for next) | ||||
dn_thresh = thresh2; | Tradius = 2; | |||
Tthresh = 0.7 * dn_thresh; | ||||
get_edit_pixels_init(NWT,Tradius); | ||||
do_wthreads(denoise_anneal_wthread,NWT); | ||||
// anneal 2x | ||||
PXM_copy(E3pxm,E1pxm); | ||||
get_edit_pixels_init(NWT,Tradius); | ||||
do_wthreads(denoise_anneal_wthread,NWT); | ||||
for (ii = 0; ii < 3; ii++) { | PXM_copy(E0pxm,E1pxm); | |||
// anneal loop | // restore normal E1 | |||
copy_edit_pixels(E3pxm,E1pxm); | ||||
// prior output >> input image | ||||
dn_radius = 2 + 2 * ii; | ||||
// 2 4 6 | ||||
if (ii > 0) dn_thresh *= 0.8; | ||||
// dn_thresh *= (1.0, 0.8, 0.64) | ||||
get_edit_pixels_init(NWT,dn_radius); | ||||
// initz. pixel loop | ||||
do_wthreads(denoise_anneal_wthread,NWT); | ||||
// anneal denoise | ||||
} | ||||
dn_thresh = thresh2; | snprintf(edit_hist,100,"voodoo thresh:%d",dn_thresh); | |||
copy_edit_pixels(E0pxm,E1pxm); | // exif edit hist | |||
// restore normal E1 | ||||
snprintf(edit_hist,100,"voodoo"); | ||||
// exif edit hist | ||||
} | } | |||
Tradius = dn_radius; | ||||
// keep dialog parameters constant 22.31 | ||||
Tthresh = dn_thresh; | ||||
// during thread execution (bugfix) | ||||
if (dn_method == chroma) | if (dn_method == chroma) | |||
{ | { | |||
if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | |||
else progress_reset(Eww * Ehh); | else progress_reset(Eww * Ehh); | |||
if (! E8pxm) E8pxm = PXM_make(Eww,Ehh,3); | if (! E8pxm) E8pxm = PXM_make(Eww,Ehh,3); | |||
if (! E8pxm) quitxx(); | if (! E8pxm) quitxx(); | |||
get_edit_pixels_init(NWT,0); | get_edit_pixels_init(NWT,0); | |||
do_wthreads(denoise_chroma_wthread1,NWT); | do_wthreads(denoise_chroma_wthread1,NWT); | |||
get_edit_pixels_init(NWT,dn_radius); // initz. pixel loop | get_edit_pixels_init(NWT,Tradius); // initz. pixel loop | |||
do_wthreads(denoise_chroma_wthread2,NWT); // chroma denoise | do_wthreads(denoise_chroma_wthread2,NWT); // chroma denoise | |||
snprintf(edit_hist,100,"chroma rad:%d thresh:%d",dn_radius,dn_thresh); // edit params > edit hist | snprintf(edit_hist,100,"chroma rad:%d thresh:%d",Tradius,Tthresh); // edit params > edit hist | |||
} | } | |||
if (dn_method == anneal) | if (dn_method == anneal) | |||
{ | { | |||
if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | |||
else progress_reset(Eww * Ehh); | else progress_reset(Eww * Ehh); | |||
get_edit_pixels_init(NWT,dn_radius); // initz. pixel loop | get_edit_pixels_init(NWT,Tradius); // initz. pixel loop | |||
do_wthreads(denoise_anneal_wthread,NWT); // anneal denoise | do_wthreads(denoise_anneal_wthread,NWT); // anneal denoise | |||
snprintf(edit_hist,100,"anneal rad:%d thresh:%d",dn_radius,dn_thresh); // edit params > edit hist | snprintf(edit_hist,100,"anneal rad:%d thresh:%d",Tradius,Tthresh); // edit params > edit hist | |||
} | } | |||
if (dn_method == flatten) | if (dn_method == flatten) | |||
{ | { | |||
if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | |||
else progress_reset(Eww * Ehh); | else progress_reset(Eww * Ehh); | |||
get_edit_pixels_init(NWT,dn_radius); // initz. pixel loop | get_edit_pixels_init(NWT,Tradius); // initz. pixel loop | |||
do_wthreads(denoise_flatten_wthread,NWT); // flatten denoise | do_wthreads(denoise_flatten_wthread,NWT); // flatten denoise | |||
snprintf(edit_hist,100,"flatten rad:%d thresh:%d",dn_radius,dn_thresh); // exif edit params > edit hist | snprintf(edit_hist,100,"flatten rad:%d thresh:%d",Tradius,Tthresh); // exif edit params > edit hist | |||
} | } | |||
if (dn_method == median) | if (dn_method == median) | |||
{ | { | |||
if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | |||
else progress_reset(Eww * Ehh); | else progress_reset(Eww * Ehh); | |||
get_edit_pixels_init(NWT,dn_radius); // initz. pixel loop | get_edit_pixels_init(NWT,Tradius); // initz. pixel loop | |||
do_wthreads(denoise_median_wthread,NWT); // median denoise | do_wthreads(denoise_median_wthread,NWT); // median denoise | |||
snprintf(edit_hist,100,"median rad:%d thresh:%d",dn_radius,dn_thresh); // exif edit params > edit hist | snprintf(edit_hist,100,"median rad:%d thresh:%d",Tradius,Tthresh); // exif edit params > edit hist | |||
} | } | |||
if (dn_method == SNN) // 22.18 | if (dn_method == SNN) // 22.18 | |||
{ | { | |||
if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | if (sa_stat == 3) progress_reset(sa_Npixel); // initz. progress counter | |||
else progress_reset(Eww * Ehh); | else progress_reset(Eww * Ehh); | |||
get_edit_pixels_init(NWT,dn_radius); // initz. pixel loop | get_edit_pixels_init(NWT,Tradius); // initz. pixel loop | |||
do_wthreads(denoise_SNN_wthread,NWT); // SNN denoise | do_wthreads(denoise_SNN_wthread,NWT); // SNN denoise | |||
snprintf(edit_hist,100,"SNN rad:%d",dn_radius); // exif edit params > edit hist | snprintf(edit_hist,100,"SNN rad:%d",Tradius); // exif edit params > edit hist | |||
} | } | |||
progress_reset(0); | progress_reset(0); | |||
if (dn_darkareas < 256) // revert brighter areas | if (dn_darkareas < 256) // revert brighter areas | |||
{ | { | |||
get_edit_pixels_init(1,dn_radius); // initz. pixel loop | get_edit_pixels_init(1,Tradius); // initz. pixel loop | |||
while (true) | while (true) | |||
{ | { | |||
Fend = get_edit_pixels(0,px,py,blend); | Fend = get_edit_pixels(0,px,py,blend); | |||
if (Fend) break; | if (Fend) break; | |||
if (blend == 0) continue; | if (blend == 0) continue; | |||
pix1 = PXMpix(E1pxm,px,py); // source pixel | pix1 = PXMpix(E1pxm,px,py); // source pixel | |||
pix3 = PXMpix(E3pxm,px,py); // target pixel | pix3 = PXMpix(E3pxm,px,py); // target pixel | |||
skipping to change at line 3737 | skipping to change at line 3739 | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int rad, thresh, Fend; | int rad, thresh, Fend; | |||
int px, py, dx, dy, rgb; | int px, py, dx, dy, rgb; | |||
float *pix1, *pix3; | float *pix1, *pix3; | |||
float *pix8, *pix8N, pixM[3]; | float *pix8, *pix8N, pixM[3]; | |||
float R1, G1, B1, R3, G3, B3, R9, G9, B9; | float R1, G1, B1, R3, G3, B3, R9, G9, B9; | |||
float Frad, f1, f2; | float Frad, f1, f2; | |||
float blend, match, reqmatch; | float blend, match, reqmatch; | |||
rad = dn_radius; | rad = Tradius; | |||
thresh = dn_thresh; | thresh = Tthresh; | |||
reqmatch = 1.0 - 0.01 * thresh; // 20 >> 0.8 | reqmatch = 1.0 - 0.01 * thresh; // 20 >> 0.8 | |||
Frad = rad + rad + 1; | Frad = rad + rad + 1; | |||
Frad = 1.0 / (Frad * Frad); | Frad = 1.0 / (Frad * Frad); | |||
while (true) | while (true) | |||
{ | { | |||
Fend = get_edit_pixels(index,px,py,blend); | Fend = get_edit_pixels(index,px,py,blend); | |||
if (Fend) break; | if (Fend) break; | |||
if (blend == 0) continue; | if (blend == 0) continue; | |||
skipping to change at line 3838 | skipping to change at line 3840 | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int rad, thresh; | int rad, thresh; | |||
int rgb, Fend; | int rgb, Fend; | |||
int px, py, dx, dy; | int px, py, dx, dy; | |||
int nc = E3pxm->nc; | int nc = E3pxm->nc; | |||
float *pix1, *pix3, *pixN; | float *pix1, *pix3, *pixN; | |||
float f1, f2, Frad, pixM[3]; | float f1, f2, Frad, pixM[3]; | |||
float R1, G1, B1, R3, G3, B3, R9, G9, B9; | float R1, G1, B1, R3, G3, B3, R9, G9, B9; | |||
float blend, match, reqmatch; | float blend, match, reqmatch; | |||
rad = dn_radius; | rad = Tradius; | |||
thresh = dn_thresh; | thresh = Tthresh; | |||
reqmatch = 1.0 - 0.01 * thresh; // 20 >> 0.8 | reqmatch = 1.0 - 0.01 * thresh; // 20 >> 0.8 | |||
Frad = rad + rad + 1; | Frad = rad + rad + 1; | |||
Frad = 1.0 / (Frad * Frad); | Frad = 1.0 / (Frad * Frad); | |||
while (true) | while (true) | |||
{ | { | |||
Fend = get_edit_pixels(index,px,py,blend); | Fend = get_edit_pixels(index,px,py,blend); | |||
if (Fend) break; | if (Fend) break; | |||
if (blend == 0) continue; | if (blend == 0) continue; | |||
skipping to change at line 3922 | skipping to change at line 3924 | |||
pix3[1] = G3; | pix3[1] = G3; | |||
pix3[2] = B3; | pix3[2] = B3; | |||
progress_add(index,1); // track progress | progress_add(index,1); // track progress | |||
} | } | |||
return 0; | return 0; | |||
} | } | |||
// Flatten: | // Flatten: | |||
// Flatten outlier pixels within neighborhood group. | // For each pixel, find two best-match opposing neighbors. | |||
// An outlier pixel has an RGB value outside mean +- sigma. | // Set pixel RGB values to mean of best neighbor RGB values. | |||
// Process groups increasing from radius = 1 to dn_radius. | ||||
void * denoise_flatten_wthread(void *arg) | void * denoise_flatten_wthread(void *arg) // 22.31 | |||
{ | { | |||
using namespace denoise_names; | using namespace denoise_names; | |||
int denoise_flatten_compfunc(cchar *rec1, cchar *rec2); | ||||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int rgb, Fend; | int Fend, rad, rgb; | |||
int px, py, dx, dy, rad1, rad2, thresh; | int px, py, px1, py1, px2, py2; | |||
int nc = E3pxm->nc; | float *pix1, *pix3; | |||
float *pix1, *pix3, *pixN, pix9[3]; | float *pixA, *pixB; | |||
float R1, G1, B1, R3, G3, B3, R9, G9, B9; | float *pix91, *pix92, pix9[3]; | |||
float nn, val, sum, sum2, mean, variance, sigma, thresh2; | float blend, thresh; | |||
float blend; | int bmpx, bmpy; | |||
float diffA, diffB, diffAB, mindiff, mrgb; | ||||
rad1 = dn_radius; | rad = Tradius; | |||
thresh = dn_thresh; | thresh = Tthresh; | |||
while (true) | while (true) // loop all image pixels | |||
{ | { | |||
Fend = get_edit_pixels(index,px,py,blend); | Fend = get_edit_pixels(index,px,py,blend); | |||
if (Fend) break; | if (Fend) break; | |||
if (blend == 0) continue; | if (blend == 0) continue; | |||
pix1 = PXMpix(E1pxm,px,py); // input pixel | pix1 = PXMpix(E1pxm,px,py); // input pixel | |||
pix3 = PXMpix(E3pxm,px,py); // output pixel | pix3 = PXMpix(E3pxm,px,py); // output pixel | |||
R1 = pix9[0] = pix1[0]; | for (rgb = 0; rgb < 3; rgb++) | |||
G1 = pix9[1] = pix1[1]; | // loop each RGB color | |||
B1 = pix9[2] = pix1[2]; | ||||
R3 = pix3[0]; | ||||
G3 = pix3[1]; | ||||
B3 = pix3[2]; | ||||
for (rad2 = 1; rad2 <= rad1; rad2++) | ||||
// radius from 1 to max | ||||
{ | { | |||
nn = (rad2 * 2 + 1); | mindiff = 999; | |||
// pixel group NxN size | // remember best matching pixel pair | |||
nn = nn * nn; | bmpx = bmpy = 0; | |||
// pixels in group | ||||
for (rgb = 0; rgb < 3; rgb++) | py1 = -rad; | |||
// loop RGB color | // py1 = top row | |||
py2 = +rad; | ||||
// py2 = bottom row | ||||
for (px1 = -rad; px1 <= +rad; px1++) | ||||
// px1/py1 = top row pixel | ||||
{ | { | |||
sum = sum2 = 0; | px2 = -px1; // px2/py2 = opposite bottom row pixel | |||
for (dy = -rad2; dy <= rad2; dy++) | pixA = PXMpix(E1pxm,px+px1,py+py1); | |||
// loop surrounding pixels | // top row pixel | |||
for (dx = -rad2; dx <= rad2; dx++) | pixB = PXMpix(E1pxm,px+px2,py+py2); | |||
{ | // bottom row pixel | |||
pixN = pix1 + (dy * Eww + dx) * nc; | ||||
val = pixN[rgb]; | diffAB = fabsf(pixA[rgb] - pixB[rgb]); | |||
sum += val; | // test difference | |||
sum2 += val * val; | if (diffAB > thresh) continue; | |||
} | // > thresh, do not use | |||
mean = sum / nn; | diffA = fabsf(pixA[rgb] - pix1[rgb]); | |||
// compute mean and sigma | // diff from pix1 | |||
variance = (sum2 - 2.0 * mean * sum) / nn + mean * mean; | diffB = fabsf(pixB[rgb] - pix1[rgb]); | |||
sigma = sqrtf(variance); | // diff from pix1 | |||
thresh2 = 0.5 * (thresh + sigma); | ||||
diffAB = diffA + diffB; | ||||
if (pix1[rgb] > mean + sigma && pix1[rgb] - mean < thresh2) | // match both with px/py | |||
// if | pixel - mean | > sigma | if (diffAB < mindiff) { | |||
pix9[rgb] = mean; | mindiff = diffAB; | |||
// flatten pixel | // remember best match | |||
else if (pix1[rgb] < mean - sigma && pix1[rgb] - mean > thresh2) | bmpx = px1; | |||
pix9[rgb] = mean; | bmpy = py1; | |||
} | ||||
} | } | |||
} | ||||
R9 = pix9[0]; | px1 = -rad; | |||
G9 = pix9[1]; | // px1 = left col | |||
B9 = pix9[2]; | px2 = +rad; | |||
// px2 = right col | ||||
if (Fpaintedits) | for (py1 = -rad; py1 <= +rad; py1++) | |||
// gradual edit within mouse circle | // px1/py1 = left col | |||
{ | { | |||
if (blend > 0) | py2 = -py1; | |||
{ | // px2/py2 = opposite on right col | |||
// increase edit | ||||
R3 = blend * R9 + (1-blend) * R3; | pixA = PXMpix(E1pxm,px+px1,py+py1); | |||
G3 = blend * G9 + (1-blend) * G3; | // left col pixel | |||
B3 = blend * B9 + (1-blend) * B3; | pixB = PXMpix(E1pxm,px+px2,py+py2); | |||
// right col pixel | ||||
diffA = fabsf(pixA[rgb] - pix1[rgb]); | ||||
// diff from pix1 | ||||
diffB = fabsf(pixB[rgb] - pix1[rgb]); | ||||
// diff from pix1 | ||||
diffAB = fabsf(pixA[rgb] - pixB[rgb]); | ||||
// test difference | ||||
if (diffAB > thresh) continue; | ||||
// > thresh, do not use | ||||
diffAB = diffA + diffB; | ||||
// match both with px/py | ||||
if (diffAB < mindiff) { | ||||
mindiff = diffAB; | ||||
// remember best match | ||||
bmpx = px1; | ||||
bmpy = py1; | ||||
} | ||||
} | } | |||
else if (blend < 0) | px1 = bmpx; | |||
{ | // best matching pixel pair | |||
// decrease edit | py1 = bmpy; | |||
R3 = -blend * R1 + (1+blend) * R3; | // (relative to px/py) | |||
G3 = -blend * G1 + (1+blend) * G3; | px2 = -px1; | |||
B3 = -blend * B1 + (1+blend) * B3; | py2 = -py1; | |||
px1 += px; | ||||
// absolute values | ||||
py1 += py; | ||||
px2 += px; | ||||
py2 += py; | ||||
pix91 = PXMpix(E1pxm,px1,py1); | ||||
// opposing pixel pair | ||||
pix92 = PXMpix(E1pxm,px2,py2); | ||||
mrgb = 0.5 * (pix91[rgb] + pix92[rgb]); | ||||
// mean RGB value | ||||
if (fabsf(pix1[rgb] - mrgb) < thresh) pix9[rgb] = mrgb; | ||||
// change < thresh, output RGB = mean | ||||
else pix9[rgb] = pix1[rgb]; | ||||
// else no change | ||||
if (Fpaintedits) { | ||||
// gradual edit within mouse circle | ||||
if (blend > 0) | ||||
pix3[rgb] = blend * pix9[rgb] + (1-blend) * pix3[rgb]; | ||||
else if (blend < 0) | ||||
pix3[rgb] = -blend * pix1[rgb] + (1+blend) * pix3[rgb]; | ||||
} | } | |||
} | ||||
else | else | |||
// full edit for image or area | // full edit for image or area | |||
{ | pix3[rgb] = blend * pix9[rgb] + (1-blend) * pix1[rgb]; | |||
R3 = blend * R9 + (1-blend) * R1; | ||||
G3 = blend * G9 + (1-blend) * G1; | ||||
B3 = blend * B9 + (1-blend) * B1; | ||||
} | ||||
pix3[0] = R3; | } | |||
// set output pixel | ||||
pix3[1] = G3; | ||||
pix3[2] = B3; | ||||
progress_add(index,1); // track progress | progress_add(index,1); // track progress | |||
} | } | |||
return 0; | return 0; | |||
} | } | |||
// Median: | // Median: | |||
// Use median RGB brightness for pixels within radius | // Use median RGB brightness for pixels within radius | |||
skipping to change at line 4044 | skipping to change at line 4060 | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int ii, rgb, Fend; | int ii, rgb, Fend; | |||
int px, py, dx, dy, rad, Frad, thresh; | int px, py, dx, dy, rad, Frad, thresh; | |||
int nc = E3pxm->nc; | int nc = E3pxm->nc; | |||
float *pix1, *pix3, *pixN, pix9[3]; | float *pix1, *pix3, *pixN, pix9[3]; | |||
float R1, G1, B1, R3, G3, B3, R9, G9, B9; | float R1, G1, B1, R3, G3, B3, R9, G9, B9; | |||
float blend, median; | float blend, median; | |||
int16 rgbdist[256]; | int16 rgbdist[256]; | |||
int rgbsum; | int rgbsum; | |||
rad = dn_radius; | rad = Tradius; | |||
thresh = dn_thresh; | thresh = Tthresh; | |||
Frad = 2 * rad + 1; | Frad = 2 * rad + 1; | |||
Frad = Frad * Frad; | Frad = Frad * Frad; | |||
while (true) | while (true) | |||
{ | { | |||
Fend = get_edit_pixels(index,px,py,blend); | Fend = get_edit_pixels(index,px,py,blend); | |||
if (Fend) break; | if (Fend) break; | |||
if (blend == 0) continue; | if (blend == 0) continue; | |||
skipping to change at line 4153 | skipping to change at line 4169 | |||
int index = *((int *) arg); | int index = *((int *) arg); | |||
int rad, Fend, Npix; | int rad, Fend, Npix; | |||
int px, py, dx, dy; | int px, py, dx, dy; | |||
int nc = E3pxm->nc; | int nc = E3pxm->nc; | |||
float *pix1, *pix3, *pixA, *pixB; | float *pix1, *pix3, *pixA, *pixB; | |||
float R1, G1, B1, R3, G3, B3, R9, G9, B9; | float R1, G1, B1, R3, G3, B3, R9, G9, B9; | |||
float matchA, matchB, Rsum, Gsum, Bsum; | float matchA, matchB, Rsum, Gsum, Bsum; | |||
float blend; | float blend; | |||
rad = dn_radius; | rad = Tradius; | |||
while (true) | while (true) | |||
{ | { | |||
Fend = get_edit_pixels(index,px,py,blend); // get pixels within edit scope | Fend = get_edit_pixels(index,px,py,blend); // get pixels within edit scope | |||
if (Fend) break; | if (Fend) break; | |||
if (blend == 0) continue; | if (blend == 0) continue; | |||
pix1 = PXMpix(E1pxm,px,py); // input pixel | pix1 = PXMpix(E1pxm,px,py); // input pixel | |||
pix3 = PXMpix(E3pxm,px,py); // output pixel | pix3 = PXMpix(E3pxm,px,py); // output pixel | |||
skipping to change at line 5975 | skipping to change at line 5991 | |||
EF_RGB.Frestart = 1; // allow restart | EF_RGB.Frestart = 1; // allow restart | |||
EF_RGB.Fscript = 1; // scripting supported | EF_RGB.Fscript = 1; // scripting supported | |||
EF_RGB.Fpaintedits = 1; // paint edits supported | EF_RGB.Fpaintedits = 1; // paint edits supported | |||
EF_RGB.threadfunc = RGB_thread; // thread function | EF_RGB.threadfunc = RGB_thread; // thread function | |||
if (! edit_setup(EF_RGB)) return; // setup edit | if (! edit_setup(EF_RGB)) return; // setup edit | |||
Eww = E3pxm->ww; | Eww = E3pxm->ww; | |||
Ehh = E3pxm->hh; | Ehh = E3pxm->hh; | |||
/*** | /*** | |||
________________________________ | ________________________________ | |||
| | | | | | |||
| +Brightness =====[]===== | | | +Brightness =====[]===== | | |||
| +Red -Cyan =====[]===== | | | +Red -Cyan =====[]===== | | |||
| +Green -Magenta =====[]===== | | | +Green -Magenta =====[]===== | | |||
| +Blue -Yellow =====[]===== | | | +Blue -Yellow =====[]===== | | |||
| | | | | | |||
| Contrast =====[]===== | | | Contrast =====[]===== | | |||
| Red =====[]===== | | | Red =====[]===== | | |||
| Green =====[]===== | | | Green =====[]===== | | |||
| Blue =====[]===== | | | Blue =====[]===== | | |||
| | | | | | |||
| [reset] [ OK ] [cancel] | | | [reset] [ OK ] [cancel] | | |||
|________________________________| | |________________________________| | |||
***/ | ***/ | |||
zdialog *zd = zdialog_new("Adjust RGB",Mwin,"Reset","OK","Cancel",null); | zdialog *zd = zdialog_new("Adjust RGB",Mwin,"Reset","OK","Cancel",null); | |||
EF_RGB.zd = zd; | EF_RGB.zd = zd; | |||
zdialog_add_widget(zd,"hbox","hb2","dialog"); | zdialog_add_widget(zd,"hbox","hb2","dialog"); | |||
zdialog_add_widget(zd,"vbox","vb1","hb2",0,"homog"); | zdialog_add_widget(zd,"vbox","vb1","hb2",0,"homog"); | |||
zdialog_add_widget(zd,"vbox","vb2","hb2",0,"homog|expand"); | zdialog_add_widget(zd,"vbox","vb2","hb2",0,"homog|expand"); | |||
zdialog_add_widget(zd,"label","labBriteDens","vb1","+Brightness"); | zdialog_add_widget(zd,"label","labBriteDens","vb1","+Brightness"); | |||
skipping to change at line 6079 | skipping to change at line 6095 | |||
} | } | |||
else { | else { | |||
edit_cancel(0); // discard edit | edit_cancel(0); // discard edit | |||
return 1; | return 1; | |||
} | } | |||
} | } | |||
if (strmatch("focus",event)) return 1; | if (strmatch("focus",event)) return 1; | |||
if (strstr("BriteDens RedDens GreenDens BlueDens" // 22.30 | if (strstr("BriteDens RedDens GreenDens BlueDens" // 22.30 | |||
"Contrast RedCon GreenCon BlueCon", event)) | "Contrast RedCon GreenCon BlueCon paint apply", event)) // 22.35 add "paint apply" | |||
{ | { | |||
zdialog_fetch(zd,"BriteDens",inputs[0]); // get all inputs | zdialog_fetch(zd,"BriteDens",inputs[0]); // get all inputs | |||
zdialog_fetch(zd,"RedDens",inputs[1]); | zdialog_fetch(zd,"RedDens",inputs[1]); | |||
zdialog_fetch(zd,"GreenDens",inputs[2]); | zdialog_fetch(zd,"GreenDens",inputs[2]); | |||
zdialog_fetch(zd,"BlueDens",inputs[3]); | zdialog_fetch(zd,"BlueDens",inputs[3]); | |||
zdialog_fetch(zd,"Contrast",inputs[4]); | zdialog_fetch(zd,"Contrast",inputs[4]); | |||
zdialog_fetch(zd,"RedCon",inputs[5]); | zdialog_fetch(zd,"RedCon",inputs[5]); | |||
zdialog_fetch(zd,"GreenCon",inputs[6]); | zdialog_fetch(zd,"GreenCon",inputs[6]); | |||
zdialog_fetch(zd,"BlueCon",inputs[7]); | zdialog_fetch(zd,"BlueCon",inputs[7]); | |||
End of changes. 46 change blocks. | ||||
146 lines changed or deleted | 180 lines changed or added |