From d6c5e18e240f9c3dc0d71fa84400e5faa9b7267a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Wed, 12 Jul 2017 18:51:11 +0300 Subject: [PATCH] core(test): fix input data for OCL FP16 test --- modules/core/test/ocl/test_arithm.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/core/test/ocl/test_arithm.cpp b/modules/core/test/ocl/test_arithm.cpp index 1164473e61..7425c17969 100644 --- a/modules/core/test/ocl/test_arithm.cpp +++ b/modules/core/test/ocl/test_arithm.cpp @@ -1639,6 +1639,14 @@ PARAM_TEST_CASE(ConvertFp16, Channels, bool) Size roiSize = randomSize(1, MAX_VALUE); Border srcBorder = randomBorder(0, 0); randomSubMat(src, src_roi, roiSize, srcBorder, stype, -11, 11); // FIXIT: Test with minV, maxV + if (stype == CV_MAKE_TYPE(CV_16S, cn)) // eliminate NaN/Inf FP16 values + { + RNG dataRng(rng.next()); + Mat src_i32 = cvtest::randomMat(dataRng, roiSize, CV_MAKE_TYPE(CV_32S, cn), 0, 0x7c00, false); + Mat shift_i32 = cvtest::randomMat(dataRng, roiSize, src_i32.type(), -1, 1, false); // values: -1, 0 + src_i32 = src_i32 + (shift_i32 * 0x8000); + src_i32.convertTo(src_roi, stype); + } Border dstBorder = randomBorder(0, 0); randomSubMat(dst, dst_roi, roiSize, dstBorder, dtype, 5, 16);