Author: abrander
Date: 2009-07-06 17:27:45 +0200 (Mon, 06 Jul 2009)
New Revision: 2560

Modified:
   trunk/librawstudio/rs-filter.c
   trunk/librawstudio/rs-filter.h
   trunk/plugins/basic-render/basic-render.c
   trunk/plugins/cache/cache.c
   trunk/plugins/crop/crop.c
   trunk/plugins/demosaic/demosaic.c
   trunk/plugins/denoise/denoise.c
   trunk/plugins/exposure-mask/exposure-mask.c
   trunk/plugins/input-file/input-file.c
   trunk/plugins/input-image16/input-image16.c
   trunk/plugins/lensfun/lensfun.c
   trunk/plugins/output-jpegfile/output-jpegfile.c
   trunk/plugins/output-pngfile/output-pngfile.c
   trunk/plugins/output-tifffile/output-tifffile.c
   trunk/plugins/resample/resample.c
   trunk/plugins/rotate/rotate.c
   trunk/src/rs-batch.c
   trunk/src/rs-loupe.c
   trunk/src/rs-navigator.c
   trunk/src/rs-preview-widget.c
Log:
Ported all filters, plugins and users to RSFilterResponse.

Modified: trunk/librawstudio/rs-filter.c
===================================================================
--- trunk/librawstudio/rs-filter.c      2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/librawstudio/rs-filter.c      2009-07-06 15:27:45 UTC (rev 2560)
@@ -162,7 +162,7 @@
  * @param param A RSFilterParam defining parameters for a image request
  * @return A RS_IMAGE16, this must be unref'ed
  */
-RS_IMAGE16 *
+RSFilterResponse *
 rs_filter_get_image(RSFilter *filter, const RSFilterParam *param)
 {
        filter_debug("rs_filter_get_image(%s [%p])", RS_FILTER_NAME(filter), 
filter);
@@ -173,6 +173,7 @@
        gfloat elapsed;
        static GTimer *gt = NULL;
 
+       RSFilterResponse *response;
        RS_IMAGE16 *image;
        g_assert(RS_IS_FILTER(filter));
 
@@ -181,10 +182,12 @@
        count++;
 
        if (RS_FILTER_GET_CLASS(filter)->get_image && filter->enabled)
-               image = RS_FILTER_GET_CLASS(filter)->get_image(filter, param);
+               response = RS_FILTER_GET_CLASS(filter)->get_image(filter, 
param);
        else
-               image = rs_filter_get_image(filter->previous, param);
+               response = rs_filter_get_image(filter->previous, param);
 
+       image = rs_filter_response_get_image(response);
+
        elapsed = g_timer_elapsed(gt, NULL) - last_elapsed;
 
        printf("%s took: \033[32m%.0f\033[0mms", RS_FILTER_NAME(filter), 
elapsed*1000);
@@ -206,7 +209,10 @@
                g_timer_destroy(gt);
        }
 
-       return image;
+       if (image)
+               g_object_unref(image);
+
+       return response;
 }
 
 /**
@@ -215,7 +221,7 @@
  * @param param A RSFilterParam defining parameters for a image request
  * @return A RS_IMAGE16, this must be unref'ed
  */
-GdkPixbuf *
+RSFilterResponse *
 rs_filter_get_image8(RSFilter *filter, const RSFilterParam *param)
 {
        filter_debug("rs_filter_get_image8(%s [%p])", RS_FILTER_NAME(filter), 
filter);
@@ -226,6 +232,7 @@
        gfloat elapsed;
        static GTimer *gt = NULL;
 
+       RSFilterResponse *response;
        GdkPixbuf *image = NULL;
        g_assert(RS_IS_FILTER(filter));
 
@@ -234,10 +241,11 @@
        count++;
 
        if (RS_FILTER_GET_CLASS(filter)->get_image8 && filter->enabled)
-               image = RS_FILTER_GET_CLASS(filter)->get_image8(filter, param);
+               response = RS_FILTER_GET_CLASS(filter)->get_image8(filter, 
param);
        else if (filter->previous)
-               image = rs_filter_get_image8(filter->previous, param);
+               response = rs_filter_get_image8(filter->previous, param);
 
+       image = rs_filter_response_get_image8(response);
        elapsed = g_timer_elapsed(gt, NULL) - last_elapsed;
 
        printf("%s took: \033[32m%.0f\033[0mms", RS_FILTER_NAME(filter), 
elapsed*1000);
@@ -256,7 +264,10 @@
                g_timer_destroy(gt);
        }
 
-       return image;
+       if (image)
+               g_object_unref(image);
+
+       return response;
 }
 
 /**

Modified: trunk/librawstudio/rs-filter.h
===================================================================
--- trunk/librawstudio/rs-filter.h      2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/librawstudio/rs-filter.h      2009-07-06 15:27:45 UTC (rev 2560)
@@ -89,8 +89,8 @@
 struct _RSFilterClass {
        GObjectClass parent_class;
        const gchar *name;
-       RS_IMAGE16 *(*get_image)(RSFilter *filter, const RSFilterParam *param);
-       GdkPixbuf *(*get_image8)(RSFilter *filter, const RSFilterParam *param);
+       RSFilterResponse *(*get_image)(RSFilter *filter, const RSFilterParam 
*param);
+       RSFilterResponse *(*get_image8)(RSFilter *filter, const RSFilterParam 
*param);
        RSIccProfile *(*get_icc_profile)(RSFilter *filter);
        gint (*get_width)(RSFilter *filter);
        gint (*get_height)(RSFilter *filter);
@@ -128,7 +128,7 @@
  * @param param A RSFilterParam defining parameters for a image request
  * @return A RS_IMAGE16, this must be unref'ed
  */
-extern RS_IMAGE16 *rs_filter_get_image(RSFilter *filter, const RSFilterParam 
*param);
+extern RSFilterResponse *rs_filter_get_image(RSFilter *filter, const 
RSFilterParam *param);
 
 /**
  * Get 8 bit output image from a RSFilter
@@ -136,8 +136,7 @@
  * @param param A RSFilterParam defining parameters for a image request
  * @return A RS_IMAGE16, this must be unref'ed
  */
-GdkPixbuf *
-rs_filter_get_image8(RSFilter *filter, const RSFilterParam *param);
+extern RSFilterResponse *rs_filter_get_image8(RSFilter *filter, const 
RSFilterParam *param);
 
 /**
  * Get the ICC profile from a filter

Modified: trunk/plugins/basic-render/basic-render.c
===================================================================
--- trunk/plugins/basic-render/basic-render.c   2009-07-06 15:26:14 UTC (rev 
2559)
+++ trunk/plugins/basic-render/basic-render.c   2009-07-06 15:27:45 UTC (rev 
2560)
@@ -121,8 +121,8 @@
 static gpointer thread_func_sse8(gpointer _thread_info);
 static gpointer thread_func_sse8_cms(gpointer _thread_info);
 #endif /* __i386__ || __x86_64__ */
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
-static GdkPixbuf *get_image8(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
+static RSFilterResponse *get_image8(RSFilter *filter, const RSFilterParam 
*param);
 static RSIccProfile *get_icc_profile(RSFilter *filter);
 
 static RSFilterClass *rs_basic_render_parent_class = NULL;
@@ -924,21 +924,28 @@
 
 #endif /* __i386__ || __x86_64__ */
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
        RSBasicRenderClass *klass = RS_BASIC_RENDER_GET_CLASS(filter);
        guint i, y_offset, y_per_thread, threaded_h;
        const guint threads = rs_get_number_of_processor_cores();
        RSBasicRender *basic_render = RS_BASIC_RENDER(filter);
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        RS_IMAGE16 *input;
        RS_IMAGE16 *output = NULL;
 
-       input = rs_filter_get_image(filter->previous, param);
+       previous_response = rs_filter_get_image(filter->previous, param);
+       input = rs_filter_response_get_image(previous_response);
        if (!RS_IS_IMAGE16(input))
-               return input;
+               return previous_response;
 
+       response = rs_filter_response_clone(previous_response);
+       g_object_unref(previous_response);
        output = rs_image16_copy(input, FALSE);
+       rs_filter_response_set_image(response, output);
+       g_object_unref(output);
 
        render_tables(basic_render);
        render_matrix(basic_render);
@@ -974,26 +981,33 @@
 
        g_object_unref(input);
 
-       return output;
+       return response;
 }
 
-static GdkPixbuf *
+static RSFilterResponse *
 get_image8(RSFilter *filter, const RSFilterParam *param)
 {
        RSBasicRenderClass *klass = RS_BASIC_RENDER_GET_CLASS(filter);
        guint i, x_offset, y_offset, y_per_thread, threaded_h;
        const guint threads = rs_get_number_of_processor_cores();
        RSBasicRender *basic_render = RS_BASIC_RENDER(filter);
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        RS_IMAGE16 *input;
        GdkPixbuf *output = NULL;
        gint width, height;
        GdkRectangle *roi;
 
-       input = rs_filter_get_image(filter->previous, param);
+       previous_response = rs_filter_get_image(filter->previous, param);
+       input = rs_filter_response_get_image(previous_response);
        if (!RS_IS_IMAGE16(input))
-               return NULL;
+               return previous_response;
 
+       response = rs_filter_response_clone(previous_response);
+       g_object_unref(previous_response);
        output = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, input->w, 
input->h);
+       rs_filter_response_set_image8(response, output);
+       g_object_unref(output);
 
        render_tables(basic_render);
        render_matrix(basic_render);
@@ -1046,5 +1060,5 @@
 
        g_object_unref(input);
 
-       return output;
+       return response;
 }

Modified: trunk/plugins/cache/cache.c
===================================================================
--- trunk/plugins/cache/cache.c 2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/plugins/cache/cache.c 2009-07-06 15:27:45 UTC (rev 2560)
@@ -38,6 +38,7 @@
        RSFilterChangedMask mask;
        GdkRectangle *last_roi;
        gboolean ignore_roi;
+       gboolean quick;
        gint latency;
 };
 
@@ -56,8 +57,8 @@
 static void finalize(GObject *object);
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
-static GdkPixbuf *get_image8(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
+static RSFilterResponse *get_image8(RSFilter *filter, const RSFilterParam 
*param);
 static void flush(RSCache *cache);
 static void previous_changed(RSFilter *filter, RSFilter *parent, 
RSFilterChangedMask mask);
 
@@ -169,12 +170,14 @@
        return TRUE;
 }
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
+       RSFilterResponse *response;
        RSCache *cache = RS_CACHE(filter);
        GdkRectangle *roi = rs_filter_param_get_roi(param);
 
+       /* FIXME: Fix this to save more correct RSFilterResponse */
        if (!cache->ignore_roi && roi)
        {
                if (cache->last_roi)
@@ -190,19 +193,37 @@
                        *cache->last_roi = *roi;
                }
        }
+printf("QUICK: %d %d\n", cache->quick, rs_filter_param_get_quick(param));
+       if (cache->quick && !rs_filter_param_get_quick(param))
+               flush(cache);
 
        if (!cache->image)
-               cache->image = rs_filter_get_image(filter->previous, param);
+       {
+               response = rs_filter_get_image(filter->previous, param);
+               cache->image = rs_filter_response_get_image(response);
+               cache->quick = rs_filter_response_get_quick(response);
+               g_object_unref(response);
+       }
 
-       return (cache->image) ? g_object_ref(cache->image) : NULL;
+       response = rs_filter_response_new();
+
+       if (cache->quick)
+               rs_filter_response_set_quick(response);
+
+       if (cache->image)
+               rs_filter_response_set_image(response, cache->image);
+
+       return response;
 }
 
-static GdkPixbuf *
+static RSFilterResponse *
 get_image8(RSFilter *filter, const RSFilterParam *param)
 {
+       RSFilterResponse *response;
        RSCache *cache = RS_CACHE(filter);
        GdkRectangle *roi = rs_filter_param_get_roi(param);
 
+       /* FIXME: Fix this to save more correct RSFilterResponse */
        if (!cache->ignore_roi && roi)
        {
                if (cache->last_roi)
@@ -219,10 +240,23 @@
                }
        }
 
+       if (cache->quick && !rs_filter_param_get_quick(param))
+               flush(cache);
+
        if (!cache->image8)
-               cache->image8 = rs_filter_get_image8(filter->previous, param);
+       {
+               response = rs_filter_get_image8(filter->previous, param);
+               cache->image8 = rs_filter_response_get_image8(response);
+               cache->quick = rs_filter_response_get_quick(response);
+               g_object_unref(response);
+       }
 
-       return (cache->image8) ? g_object_ref(cache->image8) : NULL;
+       response = rs_filter_response_new();
+
+       if (cache->image8)
+               rs_filter_response_set_image8(response, cache->image8);
+
+       return response;
 }
 
 static gboolean

Modified: trunk/plugins/crop/crop.c
===================================================================
--- trunk/plugins/crop/crop.c   2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/plugins/crop/crop.c   2009-07-06 15:27:45 UTC (rev 2560)
@@ -53,7 +53,7 @@
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
 static gint get_width(RSFilter *filter);
 static gint get_height(RSFilter *filter);
 
@@ -176,11 +176,13 @@
        }
 }
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
        g_assert(RS_IS_FILTER(filter));
        RSCrop *crop = RS_CROP(filter);
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        RS_IMAGE16 *output;
        RS_IMAGE16 *input;
        gint parent_width = rs_filter_get_width(filter->previous);
@@ -194,16 +196,22 @@
        gint width = x2 - x1 + 1;
        gint height = y2 - y1 + 1;
 
-       input = rs_filter_get_image(filter->previous, param);
+       previous_response = rs_filter_get_image(filter->previous, param);
+       /* Special case for full crop */
+       if ((width == parent_width) && (height==parent_height))
+               return previous_response;
 
+       input = rs_filter_response_get_image(previous_response);
+
        if (!RS_IS_IMAGE16(input))
-               return input;
+               return previous_response;
 
-       /* Special case for full crop */
-       if ((width == parent_width) && (height==parent_height))
-               return input;
+       response = rs_filter_response_clone(previous_response);
+       g_object_unref(previous_response);
 
        output = rs_image16_new(width, height, 3, 4);
+       rs_filter_response_set_image(response, output);
+       g_object_unref(output);
 
        /* Copy a row at a time */
        for(row=0; row<output->h; row++)
@@ -211,7 +219,7 @@
 
        g_object_unref(input);
 
-       return output;
+       return response;
 }
 
 static gint

Modified: trunk/plugins/demosaic/demosaic.c
===================================================================
--- trunk/plugins/demosaic/demosaic.c   2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/plugins/demosaic/demosaic.c   2009-07-06 15:27:45 UTC (rev 2560)
@@ -71,7 +71,7 @@
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
 static inline int fc_INDI (const unsigned int filters, const int row, const 
int col);
 static void border_interpolate_INDI (RS_IMAGE16 *image, const unsigned int 
filters, int colors, int border);
 static void lin_interpolate_INDI(RS_IMAGE16 *image, const unsigned int 
filters, const int colors);
@@ -159,10 +159,12 @@
 #define FC(row,col) \
   (int)(filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
        RSDemosaic *demosaic = RS_DEMOSAIC(filter);
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        RS_IMAGE16 *input;
        RS_IMAGE16 *output = NULL;
        gint row, col;
@@ -170,18 +172,28 @@
        gushort *src;
        gushort *dest;
 
-       input = rs_filter_get_image(filter->previous, param);
+       previous_response = rs_filter_get_image(filter->previous, param);
+
+       input = rs_filter_response_get_image(previous_response);
+
        if (!RS_IS_IMAGE16(input))
-               return input;
+               return previous_response;
 
        /* Just pass on output from previous filter if the image is not CFA */
        if (input->filters == 0)
-               return input;
+       {
+               g_object_unref(input);
+               return previous_response;
+       }
 
        g_assert(input->channels == 1);
        g_assert(input->filters != 0);
 
+       response = rs_filter_response_clone(previous_response);
+       g_object_unref(previous_response);
        output = rs_image16_new(input->w, input->h, 3, 4);
+       rs_filter_response_set_image(response, output);
+       g_object_unref(output);
 
        /* Magic - Ask Dave ;) */
        filters = input->filters;
@@ -220,7 +232,7 @@
     }
   
        g_object_unref(input);
-       return output;
+       return response;
 }
 
 /*

Modified: trunk/plugins/denoise/denoise.c
===================================================================
--- trunk/plugins/denoise/denoise.c     2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/plugins/denoise/denoise.c     2009-07-06 15:27:45 UTC (rev 2560)
@@ -59,7 +59,7 @@
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
 static void settings_changed(RSSettings *settings, RSSettingsMask mask, 
RSDenoise *denoise);
 
 static RSFilterClass *rs_denoise_parent_class = NULL;
@@ -231,24 +231,43 @@
        }
 }
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
        RSDenoise *denoise = RS_DENOISE(filter);
        GdkRectangle *roi;
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        RS_IMAGE16 *input;
        RS_IMAGE16 *output;
        RS_IMAGE16 *tmp;
-       input = rs_filter_get_image(filter->previous, param);
+
+       previous_response = rs_filter_get_image(filter->previous, param);
+
        if (!RS_IS_FILTER(filter->previous))
-               return input;
+               return previous_response;
 
        if ((denoise->sharpen + denoise->denoise_luma + 
denoise->denoise_chroma) == 0)
-               return input;
+               return previous_response;
 
+       input = rs_filter_response_get_image(previous_response);
+       response = rs_filter_response_clone(previous_response);
+
+       /* If the request is marked as "quick", bail out, we're slow */
+       if (rs_filter_param_get_quick(param))
+       {
+               rs_filter_response_set_image(response, input);
+               rs_filter_response_set_quick(response);
+               g_object_unref(input);
+               return response;
+       }
+
        output = rs_image16_copy(input, TRUE);
        g_object_unref(input);
 
+       rs_filter_response_set_image(response, output);
+       g_object_unref(output);
+
        if ((roi = rs_filter_param_get_roi(param)))
                tmp = rs_image16_new_subframe(output, roi);
        else
@@ -271,5 +290,5 @@
        denoiseImage(&denoise->info);
        g_object_unref(tmp);
 
-       return output;
+       return response;
 }

Modified: trunk/plugins/exposure-mask/exposure-mask.c
===================================================================
--- trunk/plugins/exposure-mask/exposure-mask.c 2009-07-06 15:26:14 UTC (rev 
2559)
+++ trunk/plugins/exposure-mask/exposure-mask.c 2009-07-06 15:27:45 UTC (rev 
2560)
@@ -48,7 +48,7 @@
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
-static GdkPixbuf *get_image8(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image8(RSFilter *filter, const RSFilterParam 
*param);
 
 static RSFilterClass *rs_exposure_mask_parent_class = NULL;
 
@@ -115,10 +115,12 @@
        }
 }
 
-static GdkPixbuf *
+static RSFilterResponse *
 get_image8(RSFilter *filter, const RSFilterParam *param)
 {
        RSExposureMask *exposure_mask = RS_EXPOSURE_MASK(filter);
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        GdkPixbuf *input;
        GdkPixbuf *output;
        gint width, col;
@@ -127,7 +129,10 @@
        guchar *out_pixel;
        gint channels;
 
-       input = rs_filter_get_image8(filter->previous, param);
+       previous_response = rs_filter_get_image8(filter->previous, param);
+       input = rs_filter_response_get_image8(previous_response);
+       response = rs_filter_response_clone(previous_response);
+       g_object_unref(previous_response);
 
        /* FIXME: Support ROI */
        if (exposure_mask->exposure_mask)
@@ -177,5 +182,11 @@
        else
                output = input;
 
-       return output;
+       if (output)
+       {
+               rs_filter_response_set_image8(response, output);
+               g_object_unref(output);
+       }
+
+       return response;
 }

Modified: trunk/plugins/input-file/input-file.c
===================================================================
--- trunk/plugins/input-file/input-file.c       2009-07-06 15:26:14 UTC (rev 
2559)
+++ trunk/plugins/input-file/input-file.c       2009-07-06 15:27:45 UTC (rev 
2560)
@@ -47,7 +47,7 @@
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
 static gint get_width(RSFilter *filter);
 static gint get_height(RSFilter *filter);
 
@@ -124,12 +124,15 @@
        }
 }
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
+       RSFilterResponse *response = rs_filter_response_new();
        RSInputFile *input = RS_INPUT_FILE(filter);
 
-       return g_object_ref(input->image);
+       rs_filter_response_set_image(response, input->image);
+
+       return response;
 }
 
 static gint

Modified: trunk/plugins/input-image16/input-image16.c
===================================================================
--- trunk/plugins/input-image16/input-image16.c 2009-07-06 15:26:14 UTC (rev 
2559)
+++ trunk/plugins/input-image16/input-image16.c 2009-07-06 15:27:45 UTC (rev 
2560)
@@ -51,7 +51,7 @@
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
 static RSIccProfile *get_icc_profile(RSFilter *filter);
 static void dispose (GObject *object);
 static gint get_width(RSFilter *filter);
@@ -162,15 +162,16 @@
        G_OBJECT_CLASS (rs_input_image16_parent_class)->dispose (object);
 }
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
+       RSFilterResponse *response = rs_filter_response_new();
        RSInputImage16 *input_image16 = RS_INPUT_IMAGE16(filter);
 
-       if (!RS_IS_IMAGE16(input_image16->image))
-               return NULL;
+       if (RS_IS_IMAGE16(input_image16->image))
+               rs_filter_response_set_image(response, input_image16->image);
 
-       return g_object_ref(input_image16->image);
+       return response;
 }
 
 static RSIccProfile *

Modified: trunk/plugins/lensfun/lensfun.c
===================================================================
--- trunk/plugins/lensfun/lensfun.c     2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/plugins/lensfun/lensfun.c     2009-07-06 15:27:45 UTC (rev 2560)
@@ -61,7 +61,7 @@
 
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
 static void inline rs_image16_nearest_full(RS_IMAGE16 *in, gushort *out, 
gfloat *pos);
 static void inline rs_image16_bilinear_full(RS_IMAGE16 *in, gushort *out, 
gfloat *pos);
 
@@ -232,24 +232,38 @@
 
        return NULL;
 }
-static RS_IMAGE16 *
+
+
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
        RSLensfun *lensfun = RS_LENSFUN(filter);
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        RS_IMAGE16 *input;
        RS_IMAGE16 *output = NULL;
        const gchar *make = NULL;
        const gchar *model = NULL;
 
-       input = rs_filter_get_image(filter->previous, param);
+       previous_response = rs_filter_get_image(filter->previous, param);
+       input = rs_filter_response_get_image(previous_response);
+       response = rs_filter_response_clone(previous_response);
 
+       /* FIXME: This filter should not modify pixels in-place! */
+       if (input)
+       {
+               rs_filter_response_set_image(response, input);
+               g_object_unref(input);
+       }
+       g_object_unref(previous_response);
+
        gint i, j;
        lfDatabase *ldb = lf_db_new ();
 
        if (!ldb)
        {
                g_warning ("Failed to create database");
-               return input;
+               return response;
        }
 
        lf_db_load (ldb);
@@ -260,8 +274,8 @@
 
        if (!cameras)
        {
-               g_warning("camera not found (make: \"%s\" model: \"%s\")", 
lensfun->make, lensfun->model);
-               return input;
+               g_debug("camera not found (make: \"%s\" model: \"%s\")", 
lensfun->make, lensfun->model);
+               return response;
        }
 
        for (i = 0; cameras [i]; i++)
@@ -289,8 +303,8 @@
        lenses = lf_db_find_lenses_hd(ldb, cameras[0], make, model, 0);
        if (!lenses)
        {
-               g_warning("lens not found (make: \"%s\" model: \"%s\")", 
lensfun->lens_make, model);
-               return input;
+               g_debug("lens not found (make: \"%s\" model: \"%s\")", 
lensfun->lens_make, model);
+               return response;
        }
 
        for (i = 0; lenses [i]; i++)
@@ -378,11 +392,11 @@
                        output = g_object_ref(input);
        }
        else
-               g_warning("lf_lens_check() failed");
+               g_debug("lf_lens_check() failed");
 //     lfModifier *mod = lfModifier::Create (lens, opts.Crop, img->width, 
img->height);
 
        g_object_unref(input);
-       return output;
+       return response;
 }
 
 static void inline

Modified: trunk/plugins/output-jpegfile/output-jpegfile.c
===================================================================
--- trunk/plugins/output-jpegfile/output-jpegfile.c     2009-07-06 15:26:14 UTC 
(rev 2559)
+++ trunk/plugins/output-jpegfile/output-jpegfile.c     2009-07-06 15:27:45 UTC 
(rev 2560)
@@ -190,7 +190,8 @@
        FILE * outfile;
        JSAMPROW row_pointer[1];
        RSIccProfile *profile = rs_filter_get_icc_profile(filter);
-       GdkPixbuf *pixbuf = rs_filter_get_image8(filter, NULL);
+       RSFilterResponse *response = rs_filter_get_image8(filter, NULL);
+       GdkPixbuf *pixbuf = rs_filter_response_get_image8(response);
 
        cinfo.err = jpeg_std_error(&jerr);
        jpeg_create_compress(&cinfo);
@@ -222,5 +223,7 @@
        jpeg_finish_compress(&cinfo);
        fclose(outfile);
        jpeg_destroy_compress(&cinfo);
+       g_object_unref(pixbuf);
+       g_object_unref(response);
        return(TRUE);
 }

Modified: trunk/plugins/output-pngfile/output-pngfile.c
===================================================================
--- trunk/plugins/output-pngfile/output-pngfile.c       2009-07-06 15:26:14 UTC 
(rev 2559)
+++ trunk/plugins/output-pngfile/output-pngfile.c       2009-07-06 15:27:45 UTC 
(rev 2560)
@@ -118,8 +118,16 @@
 static gboolean
 execute(RSOutput *output, RSFilter *filter)
 {
+       gboolean ret;
+       RSFilterResponse *response;
        RSPngfile *pngfile = RS_PNGFILE(output);
-       GdkPixbuf *pixbuf = rs_filter_get_image8(filter, NULL);
+       response = rs_filter_get_image8(filter, NULL);
+       GdkPixbuf *pixbuf = rs_filter_response_get_image8(response);
 
-       return gdk_pixbuf_save(pixbuf, pngfile->filename, "png", NULL, NULL);
+       ret = gdk_pixbuf_save(pixbuf, pngfile->filename, "png", NULL, NULL);
+
+       g_object_unref(response);
+       g_object_unref(pixbuf);
+
+       return ret;
 }

Modified: trunk/plugins/output-tifffile/output-tifffile.c
===================================================================
--- trunk/plugins/output-tifffile/output-tifffile.c     2009-07-06 15:26:14 UTC 
(rev 2559)
+++ trunk/plugins/output-tifffile/output-tifffile.c     2009-07-06 15:27:45 UTC 
(rev 2560)
@@ -177,6 +177,7 @@
 static gboolean
 execute(RSOutput *output, RSFilter *filter)
 {
+       RSFilterResponse *response;
        RSTifffile *tifffile = RS_TIFFFILE(output);
        const gchar *profile_filename = NULL;
        TIFF *tiff;
@@ -191,7 +192,8 @@
        {
                gint width = rs_filter_get_width(filter);
                gint col;
-               RS_IMAGE16 *image = rs_filter_get_image(filter, NULL);
+               response = rs_filter_get_image(filter, NULL);
+               RS_IMAGE16 *image = rs_filter_response_get_image(response);
                gushort *line = g_new(gushort, width*3);
 
                g_assert(image->channels == 3);
@@ -212,11 +214,13 @@
                }
 
                g_object_unref(image);
+               g_object_unref(response);
                g_free(line);
        }
        else
        {
-               GdkPixbuf *pixbuf = rs_filter_get_image8(filter, NULL);
+               response = rs_filter_get_image8(filter, NULL);
+               GdkPixbuf *pixbuf = rs_filter_response_get_image8(response);
 
                TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8);
                for(row=0;row<gdk_pixbuf_get_height(pixbuf);row++)
@@ -226,6 +230,7 @@
                }
 
                g_object_unref(pixbuf);
+               g_object_unref(response);
        }
 
        TIFFClose(tiff);

Modified: trunk/plugins/resample/resample.c
===================================================================
--- trunk/plugins/resample/resample.c   2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/plugins/resample/resample.c   2009-07-06 15:27:45 UTC (rev 2560)
@@ -73,7 +73,7 @@
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
 static void previous_changed(RSFilter *filter, RSFilter *parent, 
RSFilterChangedMask mask);
 static RSFilterChangedMask recalculate_dimensions(RSResample *resample);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
 static gint get_width(RSFilter *filter);
 static gint get_height(RSFilter *filter);
 static void ResizeH(ResampleInfo *info);
@@ -268,10 +268,12 @@
        return NULL; /* Make the compiler shut up - we'll never return */
 }
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
        RSResample *resample = RS_RESAMPLE(filter);
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        RS_IMAGE16 *afterHorizontal;
        RS_IMAGE16 *input;
        RS_IMAGE16 *output = NULL;
@@ -283,23 +285,28 @@
        {
                RSFilterParam *new_param = rs_filter_param_clone(param);
                rs_filter_param_set_roi(new_param, NULL);
-               input = rs_filter_get_image(filter->previous, new_param);
+               previous_response = rs_filter_get_image(filter->previous, 
new_param);
                g_object_unref(new_param);
        }
        else
-               input = rs_filter_get_image(filter->previous, param);
+               previous_response = rs_filter_get_image(filter->previous, 
param);
 
-       if (!RS_IS_IMAGE16(input))
-               return input;
-
        /* Return the input, if the new size is uninitialized */
        if ((resample->new_width == -1) || (resample->new_height == -1))
-               return input;
+               return previous_response;
 
        /* Simply return the input, if we don't scale */
        if ((input_width == resample->new_width) && (input_height == 
resample->new_height))
-               return input;
+               return previous_response;
 
+       input = rs_filter_response_get_image(previous_response);
+
+       if (!RS_IS_IMAGE16(input))
+               return previous_response;
+
+       response = rs_filter_response_clone(previous_response);
+       g_object_unref(previous_response);
+
        /* Use compatible (and slow) version if input isn't 3 channels and 
pixelsize 4 */ 
        gboolean use_compatible = ( ! ( input->pixelsize == 4 && 
input->channels == 3));
        gboolean use_fast = FALSE;
@@ -378,7 +385,9 @@
        g_free(v_resample);
        g_object_unref(afterHorizontal);
 
-       return output;
+       rs_filter_response_set_image(response, output);
+       g_object_unref(output);
+       return response;
 }
 
 static gint

Modified: trunk/plugins/rotate/rotate.c
===================================================================
--- trunk/plugins/rotate/rotate.c       2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/plugins/rotate/rotate.c       2009-07-06 15:27:45 UTC (rev 2560)
@@ -71,7 +71,7 @@
 static void get_property (GObject *object, guint property_id, GValue *value, 
GParamSpec *pspec);
 static void set_property (GObject *object, guint property_id, const GValue 
*value, GParamSpec *pspec);
 static void previous_changed(RSFilter *filter, RSFilter *parent, 
RSFilterChangedMask mask);
-static RS_IMAGE16 *get_image(RSFilter *filter, const RSFilterParam *param);
+static RSFilterResponse *get_image(RSFilter *filter, const RSFilterParam 
*param);
 static void turn_right_angle(RS_IMAGE16 *in, RS_IMAGE16 *out, gint start_y, 
gint end_y, const int direction);
 static gint get_width(RSFilter *filter);
 static gint get_height(RSFilter *filter);
@@ -187,20 +187,27 @@
        rs_filter_changed(filter, mask);
 }
 
-static RS_IMAGE16 *
+static RSFilterResponse *
 get_image(RSFilter *filter, const RSFilterParam *param)
 {
        RSRotate *rotate = RS_ROTATE(filter);
+       RSFilterResponse *previous_response;
+       RSFilterResponse *response;
        RS_IMAGE16 *input;
        RS_IMAGE16 *output = NULL;
 
-       input = rs_filter_get_image(filter->previous, param);
+       previous_response = rs_filter_get_image(filter->previous, param);
 
+       if ((rotate->angle < 0.001) && (rotate->orientation==0))
+               return previous_response;
+
+       input = rs_filter_response_get_image(previous_response);
+
        if (!RS_IS_IMAGE16(input))
-               return input;
+               return previous_response;
 
-       if ((rotate->angle < 0.001) && (rotate->orientation==0))
-               return input;
+       response = rs_filter_response_clone(previous_response);
+       g_object_unref(previous_response);
 
        gboolean straight = FALSE;
 
@@ -247,7 +254,10 @@
        g_free(t);
        g_object_unref(input);
 
-       return output;
+       rs_filter_response_set_image(response, output);
+       g_object_unref(output);
+
+       return response;
 }
 
 gpointer

Modified: trunk/src/rs-batch.c
===================================================================
--- trunk/src/rs-batch.c        2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/src/rs-batch.c        2009-07-06 15:27:45 UTC (rev 2560)
@@ -401,6 +401,7 @@
        RSFilter *fdenoise= rs_filter_new("RSDenoise", fresample);
        RSFilter *fbasic_render = rs_filter_new("RSBasicRender", fdenoise);
        RSFilter *fend = fbasic_render;
+       RSFilterResponse *filter_response;
 
        /* FIXME: This is just a temporary hack to make batch work */
        {
@@ -517,12 +518,14 @@
                        g_object_set(fresample, "width", width, "height", 
height, NULL);
 
                        /* Render preview image */
-                       pixbuf = rs_filter_get_image8(fend, NULL);
+                       filter_response = rs_filter_get_image8(fend, NULL);
+                       pixbuf = rs_filter_response_get_image8(filter_response);
                        if (pixbuf)
                        {
                                gtk_image_set_from_pixbuf(GTK_IMAGE(preview), 
pixbuf);
                                g_object_unref(pixbuf);
                        }
+                       g_object_unref(filter_response);
 
                        /* Build text for small preview-window */
                        basename = g_path_get_basename(parsed_filename);

Modified: trunk/src/rs-loupe.c
===================================================================
--- trunk/src/rs-loupe.c        2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/src/rs-loupe.c        2009-07-06 15:27:45 UTC (rev 2560)
@@ -240,7 +240,9 @@
        request.height = window_height;
        rs_filter_param_set_roi(param, &request);
 
-       GdkPixbuf *buffer = rs_filter_get_image8(loupe->filter, param);
+       RSFilterResponse *response = rs_filter_get_image8(loupe->filter, param);
+       GdkPixbuf *buffer = rs_filter_response_get_image8(response);
+       g_object_unref(response);
 
        g_object_unref(param);
 

Modified: trunk/src/rs-navigator.c
===================================================================
--- trunk/src/rs-navigator.c    2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/src/rs-navigator.c    2009-07-06 15:27:45 UTC (rev 2560)
@@ -291,7 +291,8 @@
 
        if (navigator->cache->previous)
        {
-               GdkPixbuf *pixbuf = rs_filter_get_image8(navigator->cache, 
NULL);
+               RSFilterResponse *response = 
rs_filter_get_image8(navigator->cache, NULL);
+               GdkPixbuf *pixbuf = rs_filter_response_get_image8(response);
                GdkRectangle placement, rect;
 
                placement.width = rs_filter_get_width(navigator->cache);
@@ -336,6 +337,7 @@
                cairo_stroke (cr);
 
                g_object_unref(pixbuf);
+               g_object_unref(response);
        }
 
        gdk_draw_drawable(drawable, gc, blitter, 0, 0, 0, 0, 
navigator->widget_width, navigator->widget_height);

Modified: trunk/src/rs-preview-widget.c
===================================================================
--- trunk/src/rs-preview-widget.c       2009-07-06 15:26:14 UTC (rev 2559)
+++ trunk/src/rs-preview-widget.c       2009-07-06 15:27:45 UTC (rev 2560)
@@ -151,6 +151,7 @@
        RSFilter *filter_cache3[MAX_VIEWS];
        RSFilter *filter_end[MAX_VIEWS]; /* For convenience */
 
+       RSFilterParam *param[MAX_VIEWS];
        GdkRectangle *last_roi[MAX_VIEWS];
        RS_PHOTO *photo;
        void *transform;
@@ -341,6 +342,8 @@
 
                g_object_set(preview->filter_resample[i], "bounding-box", TRUE, 
NULL);
                g_object_set(preview->filter_cache3[i], "latency", 1, NULL);
+
+               preview->param[i] = rs_filter_param_new();
 #if MAX_VIEWS > 3
 #error Fix line below
 #endif
@@ -1309,7 +1312,6 @@
                /* Render the photo itself */
                if (gdk_rectangle_intersect(dirty_area, &placement, &area))
                {
-                       RSFilterParam *param = rs_filter_param_new();
                        GdkRectangle roi = area;
                        roi.x -= placement.x;
                        roi.y -= placement.y;
@@ -1318,9 +1320,9 @@
                                preview->last_roi[i] = g_new(GdkRectangle, 1);
                        *preview->last_roi[i] = roi;
 
-                       rs_filter_param_set_roi(param, &roi);
-                       GdkPixbuf *buffer = 
rs_filter_get_image8(preview->filter_end[i], param);
-                       g_object_unref(param);
+                       rs_filter_param_set_roi(preview->param[i], &roi);
+                       RSFilterResponse *response = 
rs_filter_get_image8(preview->filter_end[i], preview->param[i]);
+                       GdkPixbuf *buffer = 
rs_filter_response_get_image8(response);
 
                        if (buffer)
                        {
@@ -1336,6 +1338,7 @@
 
                                g_object_unref(buffer);
                        }
+                       g_object_unref(response);
                }
 
                if (preview->state & DRAW_ROI)
@@ -1678,7 +1681,7 @@
        gint i;
 
        for(i=0;i<MAX_VIEWS;i++)
-               rs_filter_set_enabled(preview->filter_denoise[i], FALSE);
+               rs_filter_param_set_quick(preview->param[i], TRUE);
 
        return FALSE;
 }
@@ -1690,7 +1693,7 @@
        gint i;
 
        for(i=0;i<MAX_VIEWS;i++)
-               rs_filter_set_enabled(preview->filter_denoise[i], TRUE);
+               rs_filter_param_set_quick(preview->param[i], FALSE);
 
        DIRTY(preview->dirty[0], SCREEN);
        rs_preview_widget_update(preview, TRUE);
@@ -2373,11 +2376,20 @@
        RSFilterParam *param = rs_filter_param_new();
        rs_filter_param_set_roi(param, preview->last_roi[view]);
 
-       RS_IMAGE16 *image = rs_filter_get_image(preview->filter_cache1[view], 
param);
-       GdkPixbuf *buffer = rs_filter_get_image8(preview->filter_end[view], 
param);
-
+       RSFilterResponse *response = 
rs_filter_get_image(preview->filter_cache1[view], param);
+       RS_IMAGE16 *image = rs_filter_response_get_image(response);
+       g_object_unref(response);
+       response = rs_filter_get_image8(preview->filter_end[view], param);
+       GdkPixbuf *buffer = rs_filter_response_get_image8(response);
+       g_object_unref(response);
        g_object_unref(param);
 
+       if (!image)
+               return FALSE;
+
+       if (!buffer)
+               return FALSE;
+
        /* Get the real coordinates */
        cbdata->pixel = rs_image16_get_pixel(image, screen_x, screen_y, TRUE);
 
@@ -2403,6 +2415,7 @@
        cbdata->pixelfloat[G] = (gfloat) g/9.0f;
        cbdata->pixelfloat[B] = (gfloat) b/9.0f;
 
+       g_object_unref(buffer);
        g_object_unref(image);
        return TRUE;
 }


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to