Hi everyone,
I just find a small bug in the clipping module. Step by step to reproduce :
1- open an horizontal image
2- set horizontal keystone to ~ 0.70 (yes, that's a lot but...)
3- the transform is so important that DT can't apply autocrop completely (and that's great, otherwise, we would have a _very_ small image !)

Here, if you test with CPU, we see two black zone on the resulting image (normal)
with Opencl, you get some strange lines...

Here is a patch which correct this by testing in the opencl routine if the pixel we want to interpolate exist.

Hope everything is ok

AlicVB

PS : and a s usual, sorry for my English...
>From 87aa0eb3b19a08dfd3ff0e660eed8ca15ebb71f7 Mon Sep 17 00:00:00 2001
From: alicvb <alic...@gmail.com>
Date: Tue, 13 Nov 2012 21:36:27 +0100
Subject: [PATCH] BUG : opencl doesn't handle "out of source" portion well

---
 data/kernels/basic.cl |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/data/kernels/basic.cl b/data/kernels/basic.cl
index 97d6161..9251c81 100644
--- a/data/kernels/basic.cl
+++ b/data/kernels/basic.cl
@@ -469,7 +469,8 @@ clip_rotate_bicubic(read_only image2d_t in, write_only image2d_t out, const int
     float wy = interpolation_func_bicubic((float)(ty + jj) - po.y);
     float w = wx * wy;
 
-    pixel += read_imagef(in, sampleri, (int2)(tx + ii, ty + jj)) * w;
+    if (tx+ii>=0 && tx+ii<in_width && ty+jj>=0 && ty+jj<in_height)
+      pixel += read_imagef(in, sampleri, (int2)(tx + ii, ty + jj)) * w;
     weight += w;
   }
 
@@ -522,7 +523,8 @@ clip_rotate_lanczos2(read_only image2d_t in, write_only image2d_t out, const int
     float wy = interpolation_func_lanczos(2, (float)(ty + jj) - po.y);
     float w = wx * wy;
 
-    pixel += read_imagef(in, sampleri, (int2)(tx + ii, ty + jj)) * w;
+    if (tx+ii>=0 && tx+ii<in_width && ty+jj>=0 && ty+jj<in_height)
+      pixel += read_imagef(in, sampleri, (int2)(tx + ii, ty + jj)) * w;
     weight += w;
   }
 
@@ -576,7 +578,8 @@ clip_rotate_lanczos3(read_only image2d_t in, write_only image2d_t out, const int
     float wy = interpolation_func_lanczos(3, (float)(ty + jj) - po.y);
     float w = wx * wy;
 
-    pixel += read_imagef(in, sampleri, (int2)(tx + ii, ty + jj)) * w;
+    if (tx+ii>=0 && tx+ii<in_width && ty+jj>=0 && ty+jj<in_height)
+      pixel += read_imagef(in, sampleri, (int2)(tx + ii, ty + jj)) * w;
     weight += w;
   }
 
-- 
1.7.9.5

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
darktable-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to