From ebfaf4c5d871397d7de10f791907b2e7e0246fbd Mon Sep 17 00:00:00 2001 From: Alexander Karsakov Date: Mon, 27 Oct 2014 15:38:44 +0300 Subject: [PATCH] Added checking that z is non zero to buildWarpPlaneMaps kernel --- modules/stitching/src/opencl/warpers.cl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/stitching/src/opencl/warpers.cl b/modules/stitching/src/opencl/warpers.cl index 9d245893cf..a8f04a63cd 100644 --- a/modules/stitching/src/opencl/warpers.cl +++ b/modules/stitching/src/opencl/warpers.cl @@ -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;