Merge pull request #21626 from anna-khakimova:ak/workaround_for_16s

This commit is contained in:
Alexander Alekhin 2022-02-16 17:47:48 +00:00
commit 31881209d6

View File

@ -436,8 +436,8 @@ PERF_TEST_P_(DivPerfTest, TestPerformance)
// FIXIT Unstable input data for divide // FIXIT Unstable input data for divide
initMatsRandU(type, sz, dtype, false); initMatsRandU(type, sz, dtype, false);
//This condition need to workaround bug in OpenCV. //This condition need to workaround issue in the OpenCV.
//It reinitializes divider matrix without zero values. //It reinitializes divider matrix without zero values for CV_16S DST type.
if (dtype == CV_16S && dtype != type) if (dtype == CV_16S && dtype != type)
cv::randu(in_mat2, cv::Scalar::all(1), cv::Scalar::all(255)); cv::randu(in_mat2, cv::Scalar::all(1), cv::Scalar::all(255));
@ -482,6 +482,11 @@ PERF_TEST_P_(DivCPerfTest, TestPerformance)
// FIXIT Unstable input data for divide // FIXIT Unstable input data for divide
initMatsRandU(type, sz, dtype, false); initMatsRandU(type, sz, dtype, false);
//This condition need as workaround the issue in the OpenCV.
//It reinitializes divider scalar without zero values for CV_16S DST type.
if (dtype == CV_16S || (type == CV_16S && dtype == -1))
cv::randu(sc, cv::Scalar::all(1), cv::Scalar::all(SHRT_MAX));
// OpenCV code /////////////////////////////////////////////////////////// // OpenCV code ///////////////////////////////////////////////////////////
cv::divide(in_mat1, sc, out_mat_ocv, scale, dtype); cv::divide(in_mat1, sc, out_mat_ocv, scale, dtype);