Update of /cvsroot/ufraw/ufraw
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13499

Modified Files:
        ufraw.h ufraw_lens_ui.c ufraw_preview.c ufraw_ufraw.c 
        ufraw_writer.c 
Log Message:
Some code refactoring.


Index: ufraw.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw.h,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- ufraw.h     3 Nov 2009 06:49:39 -0000       1.130
+++ ufraw.h     4 Nov 2009 02:48:54 -0000       1.131
@@ -114,7 +114,7 @@
     lightness_adjustment lightnessAdjustment[max_adjustments];
 } developer_data;
 
-typedef guint16 image_type[4];
+typedef guint16 ufraw_image_type[4];
 
 typedef struct {
     char name[max_name];
@@ -280,8 +280,9 @@
     int RawChanMul[4];
     int RawCount;
 #ifdef HAVE_LENSFUN
-    int postproc_ops; /* postprocessing operations (LF_MODIFY_XXX) */
+    int modFlags; /* postprocessing operations (LF_MODIFY_XXX) */
     lfModifier *modifier;
+    void *lanczos_func; /* the Lanczos kernel */
 #endif /* HAVE_LENSFUN */
     int hotpixels;
     gboolean mark_hotpixels;
@@ -308,7 +309,7 @@
 void ufraw_convert_image_raw(ufraw_data *uf, UFRawPhase phase);
 void ufraw_convert_image_first(ufraw_data *uf, UFRawPhase phase);
 #ifdef HAVE_LENSFUN
-int ufraw_prepare_lensfun(ufraw_data *uf);
+void ufraw_prepare_lensfun(ufraw_data *uf, UFRawPhase phase);
 void ufraw_lensfun_init(ufraw_data *uf);
 #endif
 void ufraw_image_format(int *colors, int *bytes, ufraw_image_data *img,

Index: ufraw_writer.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_writer.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- ufraw_writer.c      15 Oct 2009 04:30:10 -0000      1.65
+++ ufraw_writer.c      4 Nov 2009 02:48:54 -0000       1.66
@@ -210,7 +210,8 @@
 {
     int row, row0;
     int rowStride = uf->Images[ufraw_first_phase].width;
-    image_type *rawImage = (image_type *)uf->Images[ufraw_first_phase].buffer;
+    ufraw_image_type *rawImage =
+           (ufraw_image_type *)uf->Images[ufraw_first_phase].buffer;
     int byteDepth = (bitDepth+7)/8;
     guint8 pixbuf8[width * 3 * byteDepth * DEVELOP_BATCH];
 
@@ -653,8 +654,8 @@
 
        int row;
        int i;
-       image_type *rawImage =
-               (image_type *)uf->Images[ufraw_first_phase].buffer;
+       ufraw_image_type *rawImage =
+               (ufraw_image_type *)uf->Images[ufraw_first_phase].buffer;
        int rowStride = uf->Images[ufraw_first_phase].width;
        guint16 pixbuf16[3];
 

Index: ufraw_lens_ui.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_lens_ui.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ufraw_lens_ui.c     3 Nov 2009 06:41:31 -0000       1.16
+++ ufraw_lens_ui.c     4 Nov 2009 02:48:54 -0000       1.17
@@ -372,7 +372,7 @@
         g_signal_emit_by_name (GTK_COMBO_BOX (data->LensVignettingModel),
                                "changed", NULL, NULL);
 
-    if (data->UF->postproc_ops & LF_MODIFY_VIGNETTING)
+    if (data->UF->modFlags & LF_MODIFY_VIGNETTING)
         ufraw_invalidate_layer(data->UF, ufraw_develop_phase);
     else
         ufraw_invalidate_layer(data->UF, ufraw_lensfun_phase);

Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -d -r1.206 -r1.207
--- ufraw_ufraw.c       3 Nov 2009 06:49:39 -0000       1.206
+++ ufraw_ufraw.c       4 Nov 2009 02:48:54 -0000       1.207
@@ -33,7 +33,7 @@
 #include "nikon_curve.h"
 #include "ufraw.h"
 
-static void ufraw_convert_image_lensfun(ufraw_data *uf, UFRawPhase phase);
+static void ufraw_convert_image_lensfun(ufraw_data *uf, ufraw_image_data *img);
 static void ufraw_convert_reverse_wb(ufraw_data *uf, UFRawPhase phase);
 static void ufraw_convert_import_buffer(ufraw_data *uf, UFRawPhase phase, 
dcraw_image_data *dcimg);
 static void ufraw_convert_prepare_buffers(ufraw_data *uf);
@@ -238,6 +238,11 @@
     uf->widget = NULL;
     uf->RawHistogram = NULL;
     uf->HaveFilters = raw->filters!=0;
+#ifdef HAVE_LENSFUN
+    uf->modFlags = 0;
+    uf->modifier = NULL;
+    uf->lanczos_func = NULL;
+#endif
     ufraw_message(UFRAW_SET_LOG, "ufraw_open: w:%d h:%d curvesize:%d\n",
            raw->width, raw->height, raw->toneCurveSize);
 
@@ -660,6 +665,10 @@
     developer_destroy(uf->developer);
     developer_destroy(uf->AutoDeveloper);
     g_free(uf->RawHistogram);
+#ifdef HAVE_LENSFUN
+    g_free(uf->modifier);
+    g_free(uf->lanczos_func);
+#endif
     if ( uf->conf->darkframe!=NULL ) {
        ufraw_close(uf->conf->darkframe);
        g_free(uf->conf->darkframe);
@@ -718,7 +727,11 @@
     ufraw_developer_prepare(uf, file_developer);
     ufraw_convert_image_raw(uf, ufraw_raw_phase);
     ufraw_convert_image_first(uf, ufraw_first_phase);
-    ufraw_convert_image_lensfun(uf, ufraw_first_phase);
+#ifdef HAVE_LENSFUN
+    ufraw_prepare_lensfun(uf, ufraw_first_phase);
+    if (uf->modifier != NULL)
+       ufraw_convert_image_lensfun(uf, &uf->Images[ufraw_first_phase]);
+#endif
     return UFRAW_SUCCESS;
 }
 
@@ -750,151 +763,117 @@
 #define LANCZOS_DATA_ONE 4096
 #endif
 
-void ufraw_lensfun_modify (
-    dcraw_image_data *img, lfModifier *modifier, int modflags)
+static void ufraw_convert_image_lensfun(ufraw_data *uf, ufraw_image_data *img)
 {
     /* Apply vignetting correction first, before distorting the image */
-    if (modflags & LF_MODIFY_VIGNETTING)
+    if (uf->modFlags & LF_MODIFY_VIGNETTING)
         lf_modifier_apply_color_modification (
-            modifier, img->image, 0.0, 0.0, img->width, img->height,
-            LF_CR_4 (RED, GREEN, BLUE, UNKNOWN),
-            img->width * sizeof (dcraw_image_type));
+            uf->modifier, img->buffer, 0.0, 0.0, img->width, img->height,
+            LF_CR_4(RED, GREEN, BLUE, UNKNOWN), img->rowstride);
 
     /* Now apply distortion, TCA and geometry in a single pass */
-    if (modflags & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING))
-    {
-        dcraw_image_type *image2 = g_new (dcraw_image_type, img->height * 
img->width);
-        dcraw_image_type *cur = image2;
-        dcraw_image_type *tmp;
-        int i, x, y, c;
+    if ((uf->modFlags & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING)) == 0)
+       return;
 
-        /* Precompute the Lanczos kernel */
-        LANCZOS_DATA_TYPE lanczos_func [LANCZOS_SUPPORT * LANCZOS_SUPPORT * 
LANCZOS_TABLE_RES];
-        for (i = 0; i < LANCZOS_SUPPORT * LANCZOS_SUPPORT * LANCZOS_TABLE_RES; 
i++)
-            if (i == 0)
-                lanczos_func [i] = LANCZOS_DATA_ONE;
-            else
-            {
-                float d = sqrt (((float)i) / LANCZOS_TABLE_RES);
-                lanczos_func [i] = (LANCZOS_DATA_TYPE)
-                    ((LANCZOS_DATA_ONE * LANCZOS_SUPPORT *
-                      sin (M_PI * d) * sin ((M_PI / LANCZOS_SUPPORT) * d)) /
-                     (M_PI * M_PI * d * d));
-            }
+    guint8 *buffer2 = g_new(guint8, img->height * img->rowstride);
+    ufraw_image_type *cur = (ufraw_image_type *)buffer2;
+    int x, y, c;
 
-        float *buff = g_new (float, img->width * 3 * 2);
-        for (y = 0; y < img->height; y++)
-        {
-            if (!lf_modifier_apply_subpixel_geometry_distortion (
-                modifier, 0, y, img->width, 1, buff))
-                goto no_distortion; /* should not happen */
+    /* Use precomputed Lanczos kernel */
+    LANCZOS_DATA_TYPE *lanczos_func = uf->lanczos_func;
 
-            float *modcoord = buff;
-            for (x = 0; x < img->width; x++, cur++)
-                for (c = 0; c < 3; c++, modcoord += 2)
-                {
-#ifdef LANCZOS_DATA_FLOAT
-                    float xs = ceilf  (modcoord [0]) - LANCZOS_SUPPORT;
-                    float xe = floorf (modcoord [0]) + LANCZOS_SUPPORT;
-                    float ys = ceilf  (modcoord [1]) - LANCZOS_SUPPORT;
-                    float ye = floorf (modcoord [1]) + LANCZOS_SUPPORT;
-                    int dsrc = img->width - (xe - xs) - 1;
-                    int r = 0;
-                    if (xs >= 0 && ys >= 0 && xe < img->width && ye < 
img->height)
-                    {
-                        dcraw_image_type *src = img->image +
-                            (((long)ys) * img->width + ((long)xs));
+    float *buff = g_new(float, img->width * 3 * 2);
+    for (y = 0; y < img->height; y++) {
+        if (!lf_modifier_apply_subpixel_geometry_distortion(uf->modifier,
+                   0, y, img->width, 1, buff))
+           g_error("ufraw_convert_image_lensfun: "
+                   "lf_modifier_apply_subpixel_geometry_distortion() failed");
 
-                        float norm = 0.0;
-                        float sum = 0.0;
+       float *modcoord = buff;
+       for (x = 0; x < img->width; x++, cur++) {
+           for (c = 0; c < 3; c++, modcoord += 2) {
+#ifdef LANCZOS_DATA_FLOAT
+               float xs = ceilf(modcoord[0]) - LANCZOS_SUPPORT;
+               float xe = floorf(modcoord[0]) + LANCZOS_SUPPORT;
+               float ys = ceilf(modcoord[1]) - LANCZOS_SUPPORT;
+               float ye = floorf(modcoord[1]) + LANCZOS_SUPPORT;
+               if (xs < 0 || ys < 0 || xe >= img->width || ye >= img->height) {
+                   cur[0][c] = 0;
+                   continue;
+               }
+               ufraw_image_type *src = (ufraw_image_type *)(img->buffer +
+                       (long)ys * img->rowstride + (long)xs * img->depth);
+               int dsrc = img->width - (xe - xs) - 1;
 
-                        float _dx = modcoord [0] - xs;
-                        float dy = modcoord [1] - ys;
-                        for (; ys <= ye; ys += 1.0, dy -= 1.0)
-                        {
-                            float xc, dx = _dx;
-                            for (xc = xs; xc <= xe; xc += 1.0, dx -= 1.0, 
src++)
-                            {
-                                float d = dx * dx + dy * dy;
-                                if (d >= LANCZOS_SUPPORT * LANCZOS_SUPPORT)
-                                    continue;
+               float norm = 0.0;
+               float sum = 0.0;
 
-                                d = lanczos_func [(int)(d * 
LANCZOS_TABLE_RES)];
-                                norm += d;
-                                sum += d * src [0][c];
-                            }
-                            src += dsrc;
-                        }
+               float _dx = modcoord[0] - xs;
+               float dy = modcoord[1] - ys;
+               for (; ys <= ye; ys += 1.0, dy -= 1.0) {
+                   float xc, dx = _dx;
+                   for (xc = xs; xc <= xe; xc += 1.0, dx -= 1.0, src++) {
+                       float d = dx * dx + dy * dy;
+                       if (d >= LANCZOS_SUPPORT * LANCZOS_SUPPORT)
+                           continue;
 
-                        if (norm != 0.0)
-                        {
-                            r = (int)sum / norm;
-                            if (r > 0xffff)
-                                r = 0xffff;
-                            else if (r < 0)
-                                r = 0;
-                        }
+                       d = lanczos_func[(int)(d * LANCZOS_TABLE_RES)];
+                       norm += d;
+                       sum += d * src[0][c];
                     }
-                    cur [0][c] = r;
+                   src += dsrc;
+               }
+               if (norm != 0.0)
+                   cur[0][c] = LIM((int)(sum / norm), 0, 0xffff);
+               else
+                   cur[0][c] = 0;
 #else
-                    /* Do it in integer arithmetic, it's faster */
-                    int xx = (int)modcoord [0];
-                    int yy = (int)modcoord [1];
-                    int xs = xx + 1 - LANCZOS_SUPPORT;
-                    int xe = xx     + LANCZOS_SUPPORT;
-                    int ys = yy + 1 - LANCZOS_SUPPORT;
-                    int ye = yy     + LANCZOS_SUPPORT;
-                    int dsrc = img->width - (xe - xs) - 1;
-                    int r = 0;
-                    if (xs >= 0 && ys >= 0 && xe < img->width && ye < 
img->height)
-                    {
-                        dcraw_image_type *src = img->image + (ys * img->width 
+ xs);
-
-                        int norm = 0;
-                        int sum = 0;
+               /* Do it in integer arithmetic, it's faster */
+               int xx = (int)modcoord[0];
+               int yy = (int)modcoord[1];
+               int xs = xx + 1 - LANCZOS_SUPPORT;
+               int xe = xx     + LANCZOS_SUPPORT;
+               int ys = yy + 1 - LANCZOS_SUPPORT;
+               int ye = yy     + LANCZOS_SUPPORT;
+               if (xs < 0 || ys < 0 || xe >= img->width || ye >= img->height) {
+                   cur[0][c] = 0;
+                   continue;
+               }
+               ufraw_image_type *src = (ufraw_image_type *)(img->buffer +
+                       ys * img->rowstride + xs * img->depth);
+               int dsrc = img->width - (xe - xs) - 1;
 
-                        int _dx = (int)(modcoord [0] * 4096.0) - (xs << 12);
-                        int dy = (int)(modcoord [1] * 4096.0) - (ys << 12);
-                        for (; ys <= ye; ys++, dy -= 4096)
-                        {
-                            int xc, dx = _dx;
-                            for (xc = xs; xc <= xe; xc++, src++, dx -= 4096)
-                            {
-                                int d = (dx * dx + dy * dy) >> 12;
-                                if (d >= 4096 * LANCZOS_SUPPORT * 
LANCZOS_SUPPORT)
-                                    continue;
+               int norm = 0;
+               int sum = 0;
 
-                                d = lanczos_func [(d * LANCZOS_TABLE_RES) >> 
12];
-                                norm += d;
-                                sum += d * src [0][c];
-                            }
-                            src += dsrc;
-                        }
+               int _dx = (int)(modcoord[0] * 4096.0) - (xs << 12);
+               int dy = (int)(modcoord[1] * 4096.0) - (ys << 12);
+               for (; ys <= ye; ys++, dy -= 4096) {
+                   int xc, dx = _dx;
+                   for (xc = xs; xc <= xe; xc++, src++, dx -= 4096) {
+                       int d = (dx * dx + dy * dy) >> 12;
+                       if (d >= 4096 * LANCZOS_SUPPORT * LANCZOS_SUPPORT)
+                           continue;
 
-                        if (norm != 0)
-                        {
-                            r = sum / norm;
-                            if (r > 0xffff)
-                                r = 0xffff;
-                            else if (r < 0)
-                                r = 0;
-                        }
-                    }
-                    cur [0][c] = r;
+                       d = lanczos_func[(d * LANCZOS_TABLE_RES) >> 12];
+                       norm += d;
+                       sum += d * src[0][c];
+                   }
+                   src += dsrc;
+               }
+               if (norm != 0)
+                   cur[0][c] = LIM(sum / norm, 0, 0xffff);
+               else
+                   cur[0][c] = 0;
 #endif
-                }
-        }
-
-        /* Exchange the original image and the modified one */
-        tmp = img->image;
-        img->image = image2;
-        image2 = tmp;
-
-no_distortion:
-        /* Intermediate buffers not needed anymore */
-        g_free (buff);
-        g_free (image2);
+           }
+       }
     }
+
+    /* Exchange the original image and the modified one */
+    g_free(img->buffer);
+    img->buffer = buffer2;
+    g_free(buff);
 }
 
 #endif /* HAVE_LENSFUN */
@@ -1060,7 +1039,7 @@
     dcraw_image_type *rawimage;
     dcraw_image_data final;
 
-    final.image = (image_type *)out->buffer;
+    final.image = (ufraw_image_type *)out->buffer;
     final.width = out->width;
     final.height = out->height;
 
@@ -1109,42 +1088,6 @@
     }
 }
 
-static void ufraw_convert_image_lensfun(ufraw_data *uf, UFRawPhase phase)
-{
-#ifdef HAVE_LENSFUN
-    conf_data *conf = uf->conf;
-    ufraw_image_data *img = &uf->Images[phase];
-    lfModifier *modifier;
-    float real_scale;
-    int finmodflags;
-
-    if (conf->camera == NULL || conf->lens == NULL)
-       return;
-
-    modifier = lf_modifier_new(conf->lens, conf->camera->CropFactor,
-           img->width, img->height);
-    if (modifier == NULL)
-       return;
-
-    real_scale = pow(2.0, conf->lens_scale);
-    finmodflags = lf_modifier_initialize(modifier, conf->lens, LF_PF_U16,
-           conf->focal_len, conf->aperture, conf->subject_distance,
-           real_scale, conf->cur_lens_type, UF_LF_ALL, FALSE);
-    if (finmodflags & UF_LF_ALL) {
-       dcraw_image_data args;
-       args.image = (image_type *)img->buffer;
-       args.width = img->width;
-       args.height = img->height;
-       ufraw_lensfun_modify(&args, modifier, finmodflags);
-       img->buffer = (guint8 *)args.image;
-    }
-    lf_modifier_destroy(modifier);
-#else
-    (void)uf;
-    (void)phase;
-#endif /* HAVE_LENSFUN */
-}
-
 #ifdef HAVE_LENSFUN
 void ufraw_lensfun_init(ufraw_data *uf)
 {
@@ -1253,27 +1196,52 @@
 }
 
 #ifdef HAVE_LENSFUN
-int ufraw_prepare_lensfun(ufraw_data *uf)
+void ufraw_prepare_lensfun(ufraw_data *uf, UFRawPhase phase)
 {
-    ufraw_image_data *img = &uf->Images[ufraw_lensfun_phase];
+    ufraw_image_data *img = &uf->Images[phase];
     conf_data *conf = uf->conf;
-    float real_scale;
 
-    if (uf->modifier)
-        lf_modifier_destroy(uf->modifier);
+    if (uf->modifier != NULL)
+       lf_modifier_destroy(uf->modifier);
+    uf->modifier = NULL;
+
+    if (conf->camera == NULL || conf->lens == NULL)
+       return;
+
     uf->modifier = lf_modifier_new(conf->lens, conf->camera->CropFactor,
            img->width, img->height);
+    if (uf->modifier == NULL)
+       return;
 
-    real_scale = pow(2.0, conf->lens_scale);
-    uf->postproc_ops = lf_modifier_initialize(uf->modifier, conf->lens,
-           LF_PF_U8, conf->focal_len, conf->aperture, conf->subject_distance,
+    int bitDepth = img->depth>4 ? LF_PF_U16 : LF_PF_U8;
+    float real_scale = pow(2.0, conf->lens_scale);
+    uf->modFlags = lf_modifier_initialize(uf->modifier, conf->lens,
+           bitDepth, conf->focal_len, conf->aperture, conf->subject_distance,
            real_scale, conf->cur_lens_type, UF_LF_ALL, FALSE);
-    if (!(uf->postproc_ops & UF_LF_ALL)) {
-        lf_modifier_destroy(uf->modifier);
-        uf->modifier = NULL;
-        img->valid = 0;
+    if ((uf->modFlags & UF_LF_ALL) == 0) {
+       lf_modifier_destroy(uf->modifier);
+       uf->modifier = NULL;
+//     img->valid = 0;
+    }
+
+    if (uf->lanczos_func != NULL)
+       return;
+    /* Precompute the Lanczos kernel */
+    LANCZOS_DATA_TYPE *lanczos_func = g_new(LANCZOS_DATA_TYPE,
+           LANCZOS_SUPPORT * LANCZOS_SUPPORT * LANCZOS_TABLE_RES);
+    uf->lanczos_func = lanczos_func;
+    int i;
+    for (i = 0; i < LANCZOS_SUPPORT*LANCZOS_SUPPORT * LANCZOS_TABLE_RES; i++) {
+       if (i == 0) {
+            lanczos_func[i] = LANCZOS_DATA_ONE;
+        } else {
+            float d = sqrt((float)i / LANCZOS_TABLE_RES);
+            lanczos_func[i] = (LANCZOS_DATA_TYPE)(
+                   LANCZOS_DATA_ONE * LANCZOS_SUPPORT *
+                   sin(M_PI * d) * sin(M_PI / LANCZOS_SUPPORT * d) /
+                   (M_PI * M_PI * d * d) );
+       }
     }
-    return UFRAW_SUCCESS;
 }
 #endif /* HAVE_LENSFUN */
 
@@ -1348,7 +1316,7 @@
     phase = ufraw_develop_phase;
 #ifdef HAVE_LENSFUN
     if (uf->modifier &&
-       (uf->postproc_ops & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING)))
+       (uf->modFlags & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING)))
        phase = ufraw_lensfun_phase;
 #endif /* HAVE_LENSFUN */
     if (bufferok) {
@@ -1379,7 +1347,7 @@
     if (uf->developer->working2displayTransform == NULL) {
 #ifdef HAVE_LENSFUN
        if (uf->modifier &&
-           (uf->postproc_ops & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING)))
+           (uf->modFlags & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING)))
            phase = ufraw_lensfun_phase;
        else
            phase = ufraw_develop_phase;
@@ -1465,7 +1433,7 @@
 
 #ifdef HAVE_LENSFUN
                     if (uf->modifier &&
-                        (uf->postproc_ops & LF_MODIFY_VIGNETTING))
+                        (uf->modFlags & LF_MODIFY_VIGNETTING))
                     {
                         /* Apply de-vignetting filter here, to avoid
                          * creating a separate pass for it which will
@@ -1484,7 +1452,7 @@
 #ifdef HAVE_LENSFUN
             {
                 if (!uf->modifier ||
-                    !(uf->postproc_ops & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING))) 
{
+                    !(uf->modFlags & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING))) {
                    out->valid = in->valid;     /* for invalidate_event */
                    return in;
                }
@@ -1727,7 +1695,7 @@
     ufraw_flip_image_buffer(&uf->Images[ufraw_develop_phase], flip);
 #ifdef HAVE_LENSFUN
     if (uf->modifier &&
-       (uf->postproc_ops & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING)))
+       (uf->modFlags & (UF_LF_ALL & ~LF_MODIFY_VIGNETTING)))
        ufraw_flip_image_buffer(&uf->Images[ufraw_lensfun_phase], flip);
 #endif /* HAVE_LENSFUN */
     if (uf->developer->working2displayTransform != NULL)
@@ -1851,8 +1819,7 @@
     } else if ( !strcmp(uf->conf->wb, auto_wb) ) {
        int p;
        /* Build a raw channel histogram */
-       image_type *histogram;
-       histogram = g_new0(image_type, uf->rgbMax+1);
+       ufraw_image_type *histogram = g_new0(ufraw_image_type, uf->rgbMax+1);
        for (i=0; i<raw->raw.height*raw->raw.width; i++) {
            gboolean countPixel = TRUE;
            /* The -25 bound was copied from dcraw */
@@ -2025,7 +1992,7 @@
 void ufraw_auto_expose(ufraw_data *uf)
 {
     int sum, stop, wp, c, pMax, pMin, p;
-    image_type pix;
+    ufraw_image_type pix;
     guint16 p16[3];
 
     if (uf->conf->autoExposure!=apply_state) return;
@@ -2069,7 +2036,7 @@
 void ufraw_auto_black(ufraw_data *uf)
 {
     int sum, stop, bp, c;
-    image_type pix;
+    ufraw_image_type pix;
     guint16 p16[3];
 
     if (uf->conf->autoBlack==disabled_state) return;
@@ -2102,7 +2069,7 @@
 void ufraw_auto_curve(ufraw_data *uf)
 {
     int sum, stop, steps=8, bp, p, i, j, c;
-    image_type pix;
+    ufraw_image_type pix;
     guint16 p16[3];
     CurveData *curve = &uf->conf->curve[uf->conf->curveIndex];
     double decay = 0.90;

Index: ufraw_preview.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v
retrieving revision 1.295
retrieving revision 1.296
diff -u -d -r1.295 -r1.296
--- ufraw_preview.c     3 Nov 2009 06:49:39 -0000       1.295
+++ ufraw_preview.c     4 Nov 2009 02:48:54 -0000       1.296
@@ -871,7 +871,7 @@
 {
     if (data->FreezeDialog) return FALSE;
     guint8 pix[99], *p8, pen[4][3];
-    image_type p16;
+    ufraw_image_type p16;
     int x, c, cl, y, y0, y1;
     int raw_his[raw_his_size][4], raw_his_max;
 
@@ -1051,7 +1051,7 @@
     /* Vignetting is done in the development phase as an optimization
      * but if development_phase is invalidated then lensfun is too. */
     if (ufraw_invalidate_layer_event(data->UF, ufraw_lensfun_phase))
-       ufraw_prepare_lensfun(data->UF);
+       ufraw_prepare_lensfun(data->UF, ufraw_lensfun_phase);
 #endif
 
 #ifdef _OPENMP


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to