[python-dtcwt] 158/497: opencl: refine colifilt implementation

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:06:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.

commit 3a58066be93a233af72f4457c128cd0a3ddc4741
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Fri Nov 8 10:40:55 2013 +0000

    opencl: refine colifilt implementation
---
 dtcwt/opencl/lowlevel.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/dtcwt/opencl/lowlevel.py b/dtcwt/opencl/lowlevel.py
index 10f7bba..5067758 100644
--- a/dtcwt/opencl/lowlevel.py
+++ b/dtcwt/opencl/lowlevel.py
@@ -487,6 +487,7 @@ void __kernel convolve_kernel(
     float4 output = { 0, 0, 0, 0 };
 
     int m = h_shape>>1;
+    int4 offsets = (m % 2 == 0) ? (int4)(-1,-2,1,0) : (int4)(1,0,1,0);
     for(int d=0; d<m; ++d) {
         int X_offset = 2*((m>>1)-d);
 
@@ -497,11 +498,16 @@ void __kernel convolve_kernel(
             h[h_offset + ((m-d-1)*2)*h_stride],     // hb even
         };
 
+        // swap odd and even samples of h if length of h is not multiple of 4
+        if(m % 2 == 0) {
+            h_samples = h_samples.zwxy;
+        }
+
         float4 X_samples = {
-            X[coord_to_offset(reflect(X_coord + (X_offset+0)*one_px_advance, coord_min, coord_max), X_spec)],
-            X[coord_to_offset(reflect(X_coord + (X_offset+1)*one_px_advance, coord_min, coord_max), X_spec)],
-            X[coord_to_offset(reflect(X_coord + (X_offset+0)*one_px_advance, coord_min, coord_max), X_spec)],
-            X[coord_to_offset(reflect(X_coord + (X_offset+1)*one_px_advance, coord_min, coord_max), X_spec)],
+            X[coord_to_offset(reflect(X_coord + (X_offset+offsets.s0)*one_px_advance, coord_min, coord_max), X_spec)],
+            X[coord_to_offset(reflect(X_coord + (X_offset+offsets.s1)*one_px_advance, coord_min, coord_max), X_spec)],
+            X[coord_to_offset(reflect(X_coord + (X_offset+offsets.s2)*one_px_advance, coord_min, coord_max), X_spec)],
+            X[coord_to_offset(reflect(X_coord + (X_offset+offsets.s3)*one_px_advance, coord_min, coord_max), X_spec)],
         };
 
         output += X_samples * h_samples;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git



More information about the debian-science-commits mailing list