[gegl] buffer: swap cubic and catmull rom coefficients



commit bdd2bb8fa4fdb81a783884e83c01400c3566a0ee
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Apr 4 16:31:13 2019 +0200

    buffer: swap cubic and catmull rom coefficients
    
    Fixing Issue #145, comments in the code indicate that the code has been left in
    an experimental state - and even then the divergence from what the coefficients
    are used for which named cubic variant and what they should be are documented.
    
    This patch removes the extra needed comments about things are not right, making
    the cubic sampler as sharp as is commonly expected - while keeping the smoother
    cubic variant catmull-rom optional (inaccesible in GIMP - but other samplers
    available probably fill the same niche)

 gegl/buffer/gegl-sampler-cubic.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/gegl/buffer/gegl-sampler-cubic.c b/gegl/buffer/gegl-sampler-cubic.c
index 8acf14bd1..52d144d8c 100644
--- a/gegl/buffer/gegl-sampler-cubic.c
+++ b/gegl/buffer/gegl-sampler-cubic.c
@@ -130,23 +130,15 @@ gegl_sampler_cubic_init (GeglSamplerCubic *self)
   self->type = g_strdup("cubic");
   if (strcmp (self->type, "cubic"))
     {
-      /*
-       * The following values are actually not the correct ones for
-       * cubic B-spline smoothing. The correct values are b=1 and c=0.
-       */
       /* cubic B-spline */
-      self->b = 0.0;
-      self->c = 0.5;
+      self->b = 1.0;
+      self->c = 0.0;
     }
   else if (strcmp (self->type, "catmullrom"))
     {
-      /*
-       * The following values are actually not the correct ones for
-       * Catmull-Rom. The correct values are b=0 and c=0.5.
-       */
       /* Catmull-Rom spline */
-      self->b = 1.0;
-      self->c = 0.0;
+      self->b = 0.0;
+      self->c = 0.5;
     }
   else if (strcmp (self->type, "formula"))
     {
@@ -282,12 +274,14 @@ set_property (GObject      *object,
     {
       case PROP_B:
         self->b = g_value_get_double (value);
+        gegl_sampler_cubic_init (self);
         break;
 
       case PROP_TYPE:
         if (self->type)
           g_free (self->type);
         self->type = g_value_dup_string (value);
+        gegl_sampler_cubic_init (self);
         break;
 
       default:


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