[gegl] lens-distortion: use premultiplied RGBA to get rid of resampling fringing



commit 574caf048c9cddde55cccd5fbd15d1c200c376d4
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Nov 12 23:09:21 2016 +0100

    lens-distortion: use premultiplied RGBA to get rid of resampling fringing
    
    also add comment about duplicated code that can be factored away,
    lens-distoration implements its own cubic resampler.

 operations/common/lens-distortion.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/operations/common/lens-distortion.c b/operations/common/lens-distortion.c
index 9ed69be..9b32478 100644
--- a/operations/common/lens-distortion.c
+++ b/operations/common/lens-distortion.c
@@ -54,7 +54,7 @@ property_double (brighten, _("Brighten"), 0.0)
     description (_("Adjust brightness in corners"))
     value_range (-100.0, 100.0)
 
-property_color  (background, _("Background color"), "transparent")
+property_color  (background, _("Background color"), "none")
 
 #else
 
@@ -268,8 +268,8 @@ prepare (GeglOperation *operation)
 }
 
 /*
- * Catmull-Rom cubic interpolation
- *
+ * Catmull-Rom cubic interpolation XXX: FIXME: use gegl resampler instead of
+ *                                             reimplementing cubic sampler here
  * equally spaced points p0, p1, p2, p3
  * interpolate 0 <= u < 1 between p1 and p2
  *
@@ -422,7 +422,7 @@ process (GeglOperation       *operation,
   src_buf = g_new0 (gfloat, SQR (MAX_WH) * 4);
   dst_buf = g_new0 (gfloat, SQR (CHUNK_SIZE) * 4);
 
-  gegl_color_get_pixel (o->background, babl_format ("RGBA float"), background);
+  gegl_color_get_pixel (o->background, babl_format ("RaGaBaA float"), background);
 
   for (j = 0; (j-1) * CHUNK_SIZE < result->height; j++)
     for (i = 0; (i-1) * CHUNK_SIZE < result->width; i++)
@@ -444,7 +444,7 @@ process (GeglOperation       *operation,
 
         clamp_area (&area, lens.centre_x, lens.centre_y);
 
-        gegl_buffer_get (input, &area, 1.0, babl_format ("RGBA float"), src_buf,
+        gegl_buffer_get (input, &area, 1.0, babl_format ("RaGaBaA float"), src_buf,
                          GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_CLAMP);
 
         for (y = chunked_result.y; y < chunked_result.y + chunked_result.height; y++)
@@ -454,7 +454,7 @@ process (GeglOperation       *operation,
                                  &lens, x, y, input, background, level);
             }
 
-        gegl_buffer_set (output, &chunked_result, 0, babl_format ("RGBA float"),
+        gegl_buffer_set (output, &chunked_result, 0, babl_format ("RaGaBaA float"),
                          dst_buf, GEGL_AUTO_ROWSTRIDE);
       }
 


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