Skip to content

Commit 49bb0bf

Browse files
committed
Merge pull request opencv#9149 from alalek:ocl_fp16_test
2 parents 617e6b4 + d6c5e18 commit 49bb0bf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/core/test/ocl/test_arithm.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,14 @@ PARAM_TEST_CASE(ConvertFp16, Channels, bool)
16391639
Size roiSize = randomSize(1, MAX_VALUE);
16401640
Border srcBorder = randomBorder(0, 0);
16411641
randomSubMat(src, src_roi, roiSize, srcBorder, stype, -11, 11); // FIXIT: Test with minV, maxV
1642+
if (stype == CV_MAKE_TYPE(CV_16S, cn)) // eliminate NaN/Inf FP16 values
1643+
{
1644+
RNG dataRng(rng.next());
1645+
Mat src_i32 = cvtest::randomMat(dataRng, roiSize, CV_MAKE_TYPE(CV_32S, cn), 0, 0x7c00, false);
1646+
Mat shift_i32 = cvtest::randomMat(dataRng, roiSize, src_i32.type(), -1, 1, false); // values: -1, 0
1647+
src_i32 = src_i32 + (shift_i32 * 0x8000);
1648+
src_i32.convertTo(src_roi, stype);
1649+
}
16421650

16431651
Border dstBorder = randomBorder(0, 0);
16441652
randomSubMat(dst, dst_roi, roiSize, dstBorder, dtype, 5, 16);

0 commit comments

Comments
 (0)