Added checking that z is non zero to buildWarpPlaneMaps kernel
authorAlexander Karsakov <alexander.karsakov@itseez.com>
Mon, 27 Oct 2014 12:38:44 +0000 (15:38 +0300)
committerAlexander Karsakov <alexander.karsakov@itseez.com>
Mon, 27 Oct 2014 12:38:44 +0000 (15:38 +0300)
modules/stitching/src/opencl/warpers.cl

index 9d24589..a8f04a6 100644 (file)
@@ -73,8 +73,10 @@ __kernel void buildWarpPlaneMaps(__global uchar * xmapptr, int xmap_step, int xm
             float y = fma(ck_rinv[3], x_, fma(ck_rinv[4], y_, ck_rinv[5] * ct1));
             float z = fma(ck_rinv[6], x_, fma(ck_rinv[7], y_, ck_rinv[8] * ct1));
 
-            x /= z;
-            y /= z;
+            if (z != 0)
+                x /= z, y /= z;
+            else
+                x = y = -1;
 
             xmap[0] = x;
             ymap[0] = y;