[gegl] Enable high quality scale for double precision formats



commit 533a6e93767b0802b051c7ff490a9036b182e74e
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Sat Mar 8 07:20:51 2014 -0800

    Enable high quality scale for double precision formats

 gegl/gegl-algorithms.c |   28 +++++++++-------------------
 gegl/gegl-algorithms.h |   17 +++++++++++++++++
 2 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/gegl/gegl-algorithms.c b/gegl/gegl-algorithms.c
index fbf3bd9..9f1c9e4 100644
--- a/gegl/gegl-algorithms.c
+++ b/gegl/gegl-algorithms.c
@@ -49,6 +49,8 @@ void gegl_downscale_2x2 (const Babl *format,
     gegl_downscale_2x2_u16 (bpp, src_width, src_height, src_data, src_rowstride, dst_data, dst_rowstride);
   else if (comp_type == babl_type ("u32"))
     gegl_downscale_2x2_u32 (bpp, src_width, src_height, src_data, src_rowstride, dst_data, dst_rowstride);
+  else if (comp_type == babl_type ("double"))
+    gegl_downscale_2x2_double (bpp, src_width, src_height, src_data, src_rowstride, dst_data, dst_rowstride);
   else
     gegl_downscale_2x2_nearest (bpp, src_width, src_height, src_data, src_rowstride, dst_data, 
dst_rowstride);
 }
@@ -103,25 +105,17 @@ void gegl_resample_boxfilter (guchar              *dest_buf,
                                    gint                 d_rowstride) = NULL;
 
   if (comp_type == babl_type ("u8"))
-    {
-      resample_boxfilter_func = gegl_resample_boxfilter_u8;
-    }
+    resample_boxfilter_func = gegl_resample_boxfilter_u8;
   else if (comp_type == babl_type ("u16"))
-    {
-      resample_boxfilter_func = gegl_resample_boxfilter_u16;
-    }
+    resample_boxfilter_func = gegl_resample_boxfilter_u16;
   else if (comp_type == babl_type ("u32"))
-    {
-      resample_boxfilter_func = gegl_resample_boxfilter_u32;
-    }
+    resample_boxfilter_func = gegl_resample_boxfilter_u32;
   else if (comp_type == babl_type ("float"))
-    {
-      resample_boxfilter_func = gegl_resample_boxfilter_float;
-    }
+    resample_boxfilter_func = gegl_resample_boxfilter_float;
+  else if (comp_type == babl_type ("double"))
+    resample_boxfilter_func = gegl_resample_boxfilter_double;
   else
-    {
-      resample_boxfilter_func = gegl_resample_nearest;
-    }
+    resample_boxfilter_func = gegl_resample_nearest;
 
   resample_boxfilter_func (dest_buf,
                            source_buf,
@@ -162,7 +156,6 @@ gegl_resample_nearest (guchar              *dst,
     }
 }
 
-/*
 #define BOXFILTER_FUNCNAME   gegl_resample_boxfilter_double
 #define BOXFILTER_TYPE       gdouble
 #define BOXFILTER_ROUND(val) (val)
@@ -170,7 +163,6 @@ gegl_resample_nearest (guchar              *dst,
 #undef BOXFILTER_FUNCNAME
 #undef BOXFILTER_TYPE
 #undef BOXFILTER_ROUND
-*/
 
 #define BOXFILTER_FUNCNAME   gegl_resample_boxfilter_float
 #define BOXFILTER_TYPE       gfloat
@@ -204,7 +196,6 @@ gegl_resample_nearest (guchar              *dst,
 #undef BOXFILTER_TYPE
 #undef BOXFILTER_ROUND
 
-/*
 #define DOWNSCALE_FUNCNAME gegl_downscale_2x2_double
 #define DOWNSCALE_TYPE     gdouble
 #define DOWNSCALE_SUM      gdouble
@@ -214,7 +205,6 @@ gegl_resample_nearest (guchar              *dst,
 #undef DOWNSCALE_TYPE
 #undef DOWNSCALE_SUM
 #undef DOWNSCALE_DIVISOR
-*/
 
 #define DOWNSCALE_FUNCNAME gegl_downscale_2x2_float
 #define DOWNSCALE_TYPE     gfloat
diff --git a/gegl/gegl-algorithms.h b/gegl/gegl-algorithms.h
index ce8b9dd..3faa12a 100644
--- a/gegl/gegl-algorithms.h
+++ b/gegl/gegl-algorithms.h
@@ -31,6 +31,14 @@ void gegl_downscale_2x2 (const Babl *format,
                          guchar *dst_data,
                          gint    dst_rowstride);
 
+void gegl_downscale_2x2_double (gint    bpp,
+                                gint    src_width,
+                                gint    src_height,
+                                guchar *src_data,
+                                gint    src_rowstride,
+                                guchar *dst_data,
+                                gint    dst_rowstride);
+
 void gegl_downscale_2x2_float (gint    bpp,
                                gint    src_width,
                                gint    src_height,
@@ -84,6 +92,15 @@ void gegl_resample_boxfilter (guchar              *dest_buf,
                               const Babl          *format,
                               gint                 d_rowstride);
 
+void gegl_resample_boxfilter_double (guchar              *dest_buf,
+                                     const guchar        *source_buf,
+                                     const GeglRectangle *dst_rect,
+                                     const GeglRectangle *src_rect,
+                                     gint                 s_rowstride,
+                                     gdouble              scale,
+                                     gint                 bpp,
+                                     gint                 d_rowstride);
+
 void gegl_resample_boxfilter_float (guchar              *dest_buf,
                                     const guchar        *source_buf,
                                     const GeglRectangle *dst_rect,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]