gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 262eb66f 2/2: Warp: optimized by ignoring outp


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 262eb66f 2/2: Warp: optimized by ignoring output pixels with no overlap
Date: Fri, 12 Apr 2024 16:17:17 -0400 (EDT)

branch: master
commit 262eb66fb5f52e957cc94cbd23a05b31168edbdb
Author: Giacomo Lorenzetti <glorenzetti@cefca.es>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Warp: optimized by ignoring output pixels with no overlap
    
    Until now, when an output pixel did not overlap with the input image in
    linear warps, the program performed unneeded calculations.
    
    With this commit, the output pixels that are fully outside of the input
    image are detected and no further processing is done on them. This
    optimization is able to halve the execution time of many troublesome
    projections.
    
    Note: the 'start > end' situation occurs in special projections. It is
    probably due to a misbehaviour, and will be addressed in the future. Bug
---
 bin/warp/warp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/bin/warp/warp.c b/bin/warp/warp.c
index 2480f496..0f6357cd 100644
--- a/bin/warp/warp.c
+++ b/bin/warp/warp.c
@@ -147,6 +147,17 @@ warp_onthread_linear(void *inparam)
           printf("Y: %ld -- %ld\n", ystart, yend);
         }
       */
+
+      /* In special projections (for example '--shear=0.2
+         --project=0.001,0.0005' of https://savannah.gnu.org/bugs/?65561)
+         the following wrong situations will occur and cause an infinite
+         execution time in the next loop to parse over the input pixels. We
+         still have not figured out how to catch such situations at a lower
+         level. */
+      if(    xstart>xend || xstart>is1
+          || ystart>yend || ystart>is0 )
+      { output[ind]=NAN; continue; }
+
       /* Go over all the input pixels that are covered. Note that x
          and y are the centers of the pixel. */
       for(y=ystart;y<yend;++y)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]