Update of /cvsroot/ufraw/ufraw
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21155
Modified Files:
dcraw_api.cc dcraw_api.h dcraw_indi.c ufraw_preview.c
ufraw_ufraw.c ufraw_ui.h
Log Message:
Update 100% zoom preview when denoise threshold is changed.
Based on patch by Frank van Maarseveen.
100% preview is now enabled.
Index: dcraw_indi.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw_indi.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- dcraw_indi.c 7 Sep 2009 16:00:06 -0000 1.75
+++ dcraw_indi.c 27 Sep 2009 22:39:39 -0000 1.76
@@ -114,8 +114,8 @@
void CLASS wavelet_denoise_INDI(ushort (*image)[4], const int black,
const int iheight, const int iwidth, const int height, const int width,
- const int colors, const int shrink, float pre_mul[4],
- const float threshold, const unsigned filters, void *dcraw)
+ const int colors, const int shrink, const float pre_mul[4],
+ const float threshold, const unsigned filters)
{
float *fimg=0, /* *temp,*/ thold, mul[2], avg, diff;
int /*scale=1,*/ size, lev, hpass, lpass, row, col, nc, c, i, wlast;
@@ -123,7 +123,6 @@
static const float noise[] =
{ 0.8002,0.2735,0.1202,0.0585,0.0291,0.0152,0.0080,0.0044 };
- (void)dcraw;
// dcraw_message (dcraw, DCRAW_VERBOSE,_("Wavelet denoising...\n")); /*UF*/
/* Scaling is done somewhere else - NKBJ*/
Index: ufraw_preview.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v
retrieving revision 1.273
retrieving revision 1.274
diff -u -d -r1.273 -r1.274
--- ufraw_preview.c 26 Sep 2009 01:31:29 -0000 1.273
+++ ufraw_preview.c 27 Sep 2009 22:39:39 -0000 1.274
@@ -823,6 +823,9 @@
void preview_invalidate_layer(preview_data *data, UFRawPhase phase)
{
+ if (phase==ufraw_denoise_phase && !Developer->doWB)
+ // !doWB means denoise should be done in first phase
+ phase = ufraw_first_phase;
for (; phase < ufraw_phases_num; phase++)
data->UF->Images[phase].valid = 0;
}
@@ -1873,7 +1876,7 @@
CFG->size = 0;
CFG->shrink = CFG->Scale;
}
- preview_invalidate_layer(data, ufraw_denoise_phase);
+ preview_invalidate_layer(data, ufraw_first_phase);
ufraw_developer_prepare(data->UF, display_developer);
ufraw_convert_image_init(data->UF);
ufraw_convert_image_first_phase(data->UF, FALSE);
@@ -2596,6 +2599,7 @@
}
if (button==data->ResetThresholdButton) {
CFG->threshold = conf_default.threshold;
+ preview_invalidate_layer(data, ufraw_denoise_phase);
}
#ifdef UFRAW_CONTRAST
if (button==data->ResetContrastButton) {
@@ -2830,7 +2834,7 @@
CFG->Scale = 0;
preview_invalidate_layer(data, ufraw_first_phase);
} else if (valuep==&CFG->threshold) {
- preview_invalidate_layer (data, ufraw_denoise_phase);
+ preview_invalidate_layer(data, ufraw_denoise_phase);
} else {
if (CFG->autoExposure==enabled_state) CFG->autoExposure = apply_state;
if (CFG->autoBlack==enabled_state) CFG->autoBlack = apply_state;
Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -d -r1.186 -r1.187
--- ufraw_ufraw.c 26 Sep 2009 01:23:17 -0000 1.186
+++ ufraw_ufraw.c 27 Sep 2009 22:39:39 -0000 1.187
@@ -745,7 +745,6 @@
ufraw_convert_image_init(uf);
ufraw_convert_image_first_phase(uf, TRUE);
if (uf->ConvertShrink>1) {
- dcraw_data *raw = uf->raw;
dcraw_image_data final;
final.height = uf->image.height;
final.width = uf->image.width;
@@ -753,7 +752,7 @@
/* Scale threshold according to shrink factor, as the effect of
* neighbouring pixels decays about exponentially with distance. */
float threshold = uf->conf->threshold * exp(-(uf->ConvertShrink/2.0-1));
- dcraw_wavelet_denoise_shrinked(&final, raw, threshold);
+ dcraw_wavelet_denoise_shrinked(&final, threshold);
}
return UFRAW_SUCCESS;
}
@@ -936,7 +935,6 @@
* ufraw_convert_image_area() */
int ufraw_convert_image_first_phase(ufraw_data *uf, gboolean lensfix)
{
- int status;
dcraw_data *raw = uf->raw;
// final->image memory will be realloc'd as needed
dcraw_image_data final;
@@ -949,11 +947,21 @@
dcraw_finalize_shrink(&final, raw, dark, uf->ConvertShrink);
uf->developer->doWB = 1;
} else {
- if ( (status=dcraw_wavelet_denoise(raw,
- uf->conf->threshold))!=DCRAW_SUCCESS )
- return status;
- dcraw_finalize_interpolate(&final, raw, dark, uf->conf->interpolation,
- uf->conf->smoothing, uf->developer->rgbWB);
+ if (uf->conf->threshold>0) {
+ dcraw_image_type *tmp = raw->raw.image;
+ raw->raw.image = g_memdup(tmp, raw->raw.height * raw->raw.width *
+ sizeof (dcraw_image_type));
+ dcraw_wavelet_denoise(raw, uf->conf->threshold);
+ dcraw_finalize_interpolate(&final, raw, dark,
+ uf->conf->interpolation, uf->conf->smoothing,
+ uf->developer->rgbWB);
+ g_free(raw->raw.image);
+ raw->raw.image = tmp;
+ } else {
+ dcraw_finalize_interpolate(&final, raw, dark,
+ uf->conf->interpolation, uf->conf->smoothing,
+ uf->developer->rgbWB);
+ }
uf->developer->doWB = 0;
}
@@ -1024,6 +1032,12 @@
return UFRAW_SUCCESS;
}
+static gboolean ufraw_do_denoise_phase(ufraw_data *uf)
+{
+ // !doWB means denoise was done in first phase
+ return uf->conf->threshold>0 && uf->developer->doWB;
+}
+
int ufraw_convert_image_init_phase(ufraw_data *uf)
{
ufraw_image_data *FirstImage = &uf->Images[ufraw_first_phase];
@@ -1031,8 +1045,7 @@
/* Denoise image layer */
img = &uf->Images[ufraw_denoise_phase];
- if (uf->conf->threshold > 0)
- {
+ if (ufraw_do_denoise_phase(uf)) {
/* Mark layer invalid if we're resizing */
if (img->height != FirstImage->height ||
img->width != FirstImage->width ||
@@ -1135,7 +1148,7 @@
{
case ufraw_denoise_phase:
{
- if (uf->conf->threshold == 0)
+ if (!ufraw_do_denoise_phase(uf))
// No denoise phase, return the image from previous phase
return in;
@@ -1165,7 +1178,7 @@
/* Scale threshold according to shrink factor, as the effect of
* neighbouring pixels decays about exponentially with
distance. */
float threshold = uf->conf->threshold * exp(1.0 -
uf->ConvertShrink / 2.0);
- dcraw_wavelet_denoise_shrinked (&tmp, uf->raw, threshold);
+ dcraw_wavelet_denoise_shrinked(&tmp, threshold);
for (yy = 0; yy < h; yy++)
memcpy (out->buffer + ((y + yy) * out->width + x) *
out->depth,
tmp.image [(yy + y - by) * tmp.width + x - bx], w
* out->depth);
@@ -1365,7 +1378,7 @@
ufraw_flip_orientation(uf, flip);
ufraw_flip_image_buffer(&uf->Images[ufraw_first_phase], flip);
- if ( uf->conf->threshold>0 )
+ if (ufraw_do_denoise_phase(uf))
ufraw_flip_image_buffer(&uf->Images[ufraw_denoise_phase], flip);
ufraw_flip_image_buffer(&uf->Images[ufraw_develop_phase], flip);
#ifdef HAVE_LENSFUN
Index: ufraw_ui.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ui.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- ufraw_ui.h 7 Aug 2009 16:15:09 -0000 1.18
+++ ufraw_ui.h 27 Sep 2009 22:39:39 -0000 1.19
@@ -15,7 +15,7 @@
#define raw_his_size 320
#define live_his_size 256
-#define min_scale 2
+#define min_scale 1
#define max_scale 20
typedef struct {
Index: dcraw_api.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw_api.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- dcraw_api.h 16 Dec 2008 06:58:54 -0000 1.33
+++ dcraw_api.h 27 Sep 2009 22:39:39 -0000 1.34
@@ -70,9 +70,8 @@
int dcraw_image_stretch(dcraw_image_data *image, double pixel_aspect);
int dcraw_flip_image(dcraw_image_data *image, int flip);
int dcraw_set_color_scale(dcraw_data *h, int useAutoWB, int useCameraWB);
-int dcraw_wavelet_denoise(dcraw_data *h, float threshold);
-int dcraw_wavelet_denoise_shrinked(dcraw_image_data *f,
- dcraw_data *h, float threshold);
+void dcraw_wavelet_denoise(dcraw_data *h, float threshold);
+void dcraw_wavelet_denoise_shrinked(dcraw_image_data *f, float threshold);
int dcraw_finalize_interpolate(dcraw_image_data *f, dcraw_data *h,
dcraw_data *dark, int interpolation, int smoothing, int rgbWB[4]);
void dcraw_close(dcraw_data *h);
Index: dcraw_api.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/dcraw_api.cc,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- dcraw_api.cc 13 Mar 2009 04:26:48 -0000 1.52
+++ dcraw_api.cc 27 Sep 2009 22:39:39 -0000 1.53
@@ -37,8 +37,8 @@
int fc_INDI (const unsigned filters, const int row, const int col);
void wavelet_denoise_INDI(gushort (*image)[4], const int black,
const int iheight, const int iwidth, const int height, const int width,
- const int colors, const int shrink, float pre_mul[4],
- const float threshold, const unsigned filters, void *dcraw);
+ const int colors, const int shrink, const float pre_mul[4],
+ const float threshold, const unsigned filters);
void scale_colors_INDI(gushort (*image)[4], const int maximum, const int black,
const int use_auto_wb, const int use_camera_wb, const float cam_mul[4],
const unsigned iheight, const unsigned iwidth, const int colors,
@@ -508,33 +508,19 @@
return d->lastStatus;
}
-int dcraw_wavelet_denoise(dcraw_data *h, float threshold)
+void dcraw_wavelet_denoise(dcraw_data *h, float threshold)
{
- DCRaw *d = (DCRaw *)h->dcraw;
- g_free(d->messageBuffer);
- d->messageBuffer = NULL;
- d->lastStatus = DCRAW_SUCCESS;
- memcpy(h->post_mul, h->pre_mul, sizeof h->post_mul);
if (threshold)
wavelet_denoise_INDI(h->raw.image, h->black, h->raw.height,
h->raw.width, h->height, h->width, h->raw.colors, h->shrink,
- h->post_mul, threshold, h->filters, d);
- h->message = d->messageBuffer;
- return d->lastStatus;
+ h->pre_mul, threshold, h->filters);
}
-int dcraw_wavelet_denoise_shrinked(dcraw_image_data *f,
- dcraw_data *h, float threshold)
+void dcraw_wavelet_denoise_shrinked(dcraw_image_data *f, float threshold)
{
- DCRaw *d = (DCRaw *)h->dcraw;
- g_free(d->messageBuffer);
- d->messageBuffer = NULL;
- d->lastStatus = DCRAW_SUCCESS;
if (threshold)
wavelet_denoise_INDI(f->image, 0, f->height, f->width, 0, 0, 4, 0,
- NULL, threshold, 0, d);
- h->message = d->messageBuffer;
- return d->lastStatus;
+ NULL, threshold, 0);
}
int dcraw_finalize_interpolate(dcraw_image_data *f, dcraw_data *h,
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs