@@ -2547,6 +2547,8 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0,
2547
2547
(!doubleSupport && depth == CV_64F) || cn > 4 )
2548
2548
return false ;
2549
2549
2550
+ bool useDouble = depth == CV_64F;
2551
+
2550
2552
const char * const interpolationMap[3 ] = { " NEAREST" , " LINEAR" , " CUBIC" };
2551
2553
ocl::ProgramSource program = op_type == OCL_OP_AFFINE ?
2552
2554
ocl::imgproc::warp_affine_oclsrc : ocl::imgproc::warp_perspective_oclsrc;
@@ -2561,23 +2563,27 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0,
2561
2563
String opts;
2562
2564
if (interpolation == INTER_NEAREST)
2563
2565
{
2564
- opts = format (" -D INTER_NEAREST -D T=%s%s -D T1=%s -D ST=%s -D cn=%d -D rowsPerWI=%d" ,
2565
- ocl::typeToStr (type), doubleSupport ? " -D DOUBLE_SUPPORT" : " " ,
2566
+ opts = format (" -D INTER_NEAREST -D T=%s%s -D CT=%s -D T1=%s -D ST=%s -D cn=%d -D rowsPerWI=%d" ,
2567
+ ocl::typeToStr (type),
2568
+ doubleSupport ? " -D DOUBLE_SUPPORT" : " " ,
2569
+ useDouble ? " double" : " float" ,
2566
2570
ocl::typeToStr (CV_MAT_DEPTH (type)),
2567
2571
ocl::typeToStr (sctype), cn, rowsPerWI);
2568
2572
}
2569
2573
else
2570
2574
{
2571
2575
char cvt[2 ][50 ];
2572
2576
opts = format (" -D INTER_%s -D T=%s -D T1=%s -D ST=%s -D WT=%s -D depth=%d"
2573
- " -D convertToWT=%s -D convertToT=%s%s -D cn=%d -D rowsPerWI=%d" ,
2577
+ " -D convertToWT=%s -D convertToT=%s%s -D CT=%s -D cn=%d -D rowsPerWI=%d" ,
2574
2578
interpolationMap[interpolation], ocl::typeToStr (type),
2575
2579
ocl::typeToStr (CV_MAT_DEPTH (type)),
2576
2580
ocl::typeToStr (sctype),
2577
2581
ocl::typeToStr (CV_MAKE_TYPE (wdepth, cn)), depth,
2578
2582
ocl::convertTypeStr (depth, wdepth, cn, cvt[0 ]),
2579
2583
ocl::convertTypeStr (wdepth, depth, cn, cvt[1 ]),
2580
- doubleSupport ? " -D DOUBLE_SUPPORT" : " " , cn, rowsPerWI);
2584
+ doubleSupport ? " -D DOUBLE_SUPPORT" : " " ,
2585
+ useDouble ? " double" : " float" ,
2586
+ cn, rowsPerWI);
2581
2587
}
2582
2588
2583
2589
k.create (kernelName, program, opts);
@@ -2614,7 +2620,7 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0,
2614
2620
M[2 ] = b1; M[5 ] = b2;
2615
2621
}
2616
2622
}
2617
- matM.convertTo (M0, doubleSupport ? CV_64F : CV_32F);
2623
+ matM.convertTo (M0, useDouble ? CV_64F : CV_32F);
2618
2624
2619
2625
k.args (ocl::KernelArg::ReadOnly (src), ocl::KernelArg::WriteOnly (dst), ocl::KernelArg::PtrReadOnly (M0),
2620
2626
ocl::KernelArg (ocl::KernelArg::CONSTANT, 0 , 0 , 0 , borderBuf, CV_ELEM_SIZE (sctype)));
0 commit comments