[gegl] gblur-1d: improve mipmap geometry computation



commit 8bdbe3db69602d855039fa4a1db1894755e34277
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Dec 20 01:17:03 2017 +0100

    gblur-1d: improve mipmap geometry computation
    
    Incorporated improvements to the code - and a todo comment from massimo from
    bug #790424.

 operations/common/gblur-1d.c |   14 ++++++++++++--
 tests/mipmap/unsharp-crop.sh |    2 +-
 2 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/operations/common/gblur-1d.c b/operations/common/gblur-1d.c
index d340fb6..0af262d 100644
--- a/operations/common/gblur-1d.c
+++ b/operations/common/gblur-1d.c
@@ -821,11 +821,21 @@ gegl_gblur_1d_process (GeglOperation       *operation,
   GeglRectangle rect2;
   if (level)
   {
+    /*
+      if a thread is asked to render rows from result->y to
+      result->y + result->height at a level, it means that the thread
+      rendering the chunk below will render starting from the row
+      (result->y + result->height) >> level
+
+      XXX: Probably it is also better to double check that it works seamlessly
+      around the origin (I mean I don't remember whether shifting negative
+      numbers rounds toward 0 or not)
+    */
     rect2 = *result;
     rect2.x      = result->x >> level;
     rect2.y      = result->y >> level;
-    rect2.width  = result->width >> level;
-    rect2.height = result->height >> level;
+    rect2.width  = ((result->width + result->x) >> level) - rect2.x;
+    rect2.height = ((result->height + result->y) >> level) - rect2.y;
     result = &rect2;
     std_dev = std_dev * (1.0/(1<<level));
   }
diff --git a/tests/mipmap/unsharp-crop.sh b/tests/mipmap/unsharp-crop.sh
index 2225d3a..f4568e5 100755
--- a/tests/mipmap/unsharp-crop.sh
+++ b/tests/mipmap/unsharp-crop.sh
@@ -8,7 +8,7 @@ if [ ! -f $abs_top_builddir/bin/gegl ]; then
   echo "Skipping test-unsharp-crop due to lack of gegl executable"
   exit 77
 else
-  GEGL_TILE_SIZE=8x8 GEGL_THREADS=2 GEGL_PATH=$abs_top_builddir/operations GEGL_USE_OPENCL=no 
GEGL_MIPMAP_RENDERING=1 $abs_top_builddir/bin/gegl                                       \
+  GEGL_TILE_SIZE=8x8 GEGL_PATH=$abs_top_builddir/operations GEGL_USE_OPENCL=no GEGL_MIPMAP_RENDERING=1 
$abs_top_builddir/bin/gegl                                       \
           -s 0.33 $abs_top_srcdir/tests/compositions/data/car-stack.png -o      \
           $abs_top_builddir/tests/mipmap/unsharp-crop-output.png           \
           -- unsharp-mask scale=10.0 crop x=147 y=66 width=200 height=200 \


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