On Mon, Sep 21, 2009 at 01:46:25AM -0500, Udi Fuchs wrote:
> I applied your patch with some implementation changes.
> 
> I still didn't enable 100% zoom. Enabling it requires the simple patch:
> 
> diff -r1.18 ufraw_ui.h
> 18c18
> < #define min_scale 2
> ---
> > #define min_scale 1
> 
> The progress bar didn't work for me. I think the call to
> gtk_main_iteration() is the culprit.
> 
> There is also a problem with the denoise preview.

The patch below seems to fix the denoise issue. It is deliberately not
cleaned up now but kept at a bare minimum for readability. This and
the previous zoom related patch need some cleanup anyway I think:

ufraw_preview.c:
-       Fix spelling in "temporeraly" in two places. It hurts my eyes ;-)
-       A previous fix contains Developer!=NULL tests but I think this is not
        necessary.
-       Replace the data->UF->Images[phase].valid = 0 code by a call to
        preview_invalidate_layer().

other:
-       There's still some developer denoise code active when denoising is
        actually done by dcraw_wavelet_denoise() before the raw conversion.
        Just search for "threshold > 0".
-       dcraw_wavelet_denoise() calls wavelet_denoise_INDI() with an unused
        last argument. Remove it and simplify dcraw_wavelet_denoise(),
        returning void.
-       s/doWB/doall/g


diff --git a/ufraw_preview.c b/ufraw_preview.c
index 5a792b6..5234efd 100644
--- a/ufraw_preview.c
+++ b/ufraw_preview.c
@@ -2601,6 +2601,9 @@ static void button_update(GtkWidget *button, gpointer 
user_data)
     }
     if (button==data->ResetThresholdButton) {
        CFG->threshold = conf_default.threshold;
+       UFRawPhase phase = data->UF->developer->doWB ?
+               ufraw_denoise_phase : ufraw_first_phase;
+       preview_invalidate_layer(data, phase);
     }
 #ifdef UFRAW_CONTRAST
     if (button==data->ResetContrastButton) {
@@ -2834,7 +2837,9 @@ static void adjustment_update(GtkAdjustment *adj, double 
*valuep)
        CFG->Scale = 0;
        preview_invalidate_layer(data, ufraw_first_phase);
     } else if (valuep==&CFG->threshold) {
-       preview_invalidate_layer (data, ufraw_denoise_phase);
+       UFRawPhase phase = data->UF->developer->doWB ?
+               ufraw_denoise_phase : ufraw_first_phase;
+       preview_invalidate_layer(data, phase);
     } else {
         if (CFG->autoExposure==enabled_state) CFG->autoExposure = apply_state;
         if (CFG->autoBlack==enabled_state) CFG->autoBlack = apply_state;
diff --git a/ufraw_ufraw.c b/ufraw_ufraw.c
index 0289a07..2fc5ebb 100644
--- a/ufraw_ufraw.c
+++ b/ufraw_ufraw.c
@@ -949,11 +949,15 @@ int ufraw_convert_image_first_phase(ufraw_data *uf, 
gboolean lensfix)
        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_image_type *tmp = raw->raw.image;
+       raw->raw.image = g_memdup(tmp, raw->raw.height * raw->raw.width * 
sizeof (dcraw_image_type));
+       status = 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;
+       if (status!=DCRAW_SUCCESS)
+           return status;
        uf->developer->doWB = 0;
     }
 
@@ -1127,7 +1131,7 @@ ufraw_image_data *ufraw_convert_image_area (
     {
         case ufraw_denoise_phase:
             {
-                if (uf->conf->threshold == 0)
+                if (uf->conf->threshold == 0 || !uf->developer->doWB)
                     // No denoise phase, return the image from previous phase
                     return in;
 

-- 
Frank

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
ufraw-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-devel

Reply via email to