From 0c75535e0efbbbd7cc327bad5fdf54fb64f09366 Mon Sep 17 00:00:00 2001 From: eplankin Date: Fri, 23 May 2025 07:25:56 -0700 Subject: [PATCH 1/3] Update IPP integration (v2022.1.0) --- 3rdparty/ippicv/ippicv.cmake | 10 +++++----- hal/ipp/include/ipp_hal_core.hpp | 2 -- hal/ipp/src/norm_ipp.cpp | 14 -------------- modules/core/include/opencv2/core/private.hpp | 1 - 4 files changed, 5 insertions(+), 22 deletions(-) diff --git a/3rdparty/ippicv/ippicv.cmake b/3rdparty/ippicv/ippicv.cmake index 7bfcf66993..e36694b5f2 100644 --- a/3rdparty/ippicv/ippicv.cmake +++ b/3rdparty/ippicv/ippicv.cmake @@ -2,7 +2,7 @@ function(download_ippicv root_var) set(${root_var} "" PARENT_SCOPE) # Commit SHA in the opencv_3rdparty repo - set(IPPICV_COMMIT "d1cbea44d326eb0421fedcdd16de4630fd8c7ed0") + set(IPPICV_COMMIT "767426b2a40a011eb2fa7f44c677c13e60e205ad") # Define actual ICV versions if(APPLE) set(IPPICV_COMMIT "0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a") @@ -14,8 +14,8 @@ function(download_ippicv root_var) set(OPENCV_ICV_PLATFORM "linux") set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_lnx") if(X86_64) - set(OPENCV_ICV_NAME "ippicv_2022.0.0_lnx_intel64_20240904_general.tgz") - set(OPENCV_ICV_HASH "63717ee0f918ad72fb5a737992a206d1") + set(OPENCV_ICV_NAME "ippicv_2022.1.0_lnx_intel64_20250130_general.tgz") + set(OPENCV_ICV_HASH "98ff71fc242d52db9cc538388e502f57") else() set(IPPICV_COMMIT "7f55c0c26be418d494615afca15218566775c725") set(OPENCV_ICV_NAME "ippicv_2021.12.0_lnx_ia32_20240425_general.tgz") @@ -25,8 +25,8 @@ function(download_ippicv root_var) set(OPENCV_ICV_PLATFORM "windows") set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_win") if(X86_64) - set(OPENCV_ICV_NAME "ippicv_2022.0.0_win_intel64_20240904_general.zip") - set(OPENCV_ICV_HASH "3a6eca7cc3bce7159eb1443c6fca4e31") + set(OPENCV_ICV_NAME "ippicv_2022.1.0_win_intel64_20250130_general.zip") + set(OPENCV_ICV_HASH "67a611ab22410f392239bddff6f91df7") else() set(IPPICV_COMMIT "7f55c0c26be418d494615afca15218566775c725") set(OPENCV_ICV_NAME "ippicv_2021.12.0_win_ia32_20240425_general.zip") diff --git a/hal/ipp/include/ipp_hal_core.hpp b/hal/ipp/include/ipp_hal_core.hpp index 6707db7290..656bc00ce5 100644 --- a/hal/ipp/include/ipp_hal_core.hpp +++ b/hal/ipp/include/ipp_hal_core.hpp @@ -17,8 +17,6 @@ int ipp_hal_minMaxIdxMaskStep(const uchar* src_data, size_t src_step, int width, #undef cv_hal_minMaxIdxMaskStep #define cv_hal_minMaxIdxMaskStep ipp_hal_minMaxIdxMaskStep -#define IPP_DISABLE_NORM_8U 1 // accuracy difference in perf test sanity check - int ipp_hal_norm(const uchar* src, size_t src_step, const uchar* mask, size_t mask_step, int width, int height, int type, int norm_type, double* result); diff --git a/hal/ipp/src/norm_ipp.cpp b/hal/ipp/src/norm_ipp.cpp index 16b0d9bd91..a30172c346 100644 --- a/hal/ipp/src/norm_ipp.cpp +++ b/hal/ipp/src/norm_ipp.cpp @@ -100,9 +100,7 @@ int ipp_hal_norm(const uchar* src, size_t src_step, const uchar* mask, size_t ma 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( - #if (!IPP_DISABLE_NORM_8U) type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C1R : - #endif type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C1R : type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C1R : 0) : 0; @@ -178,26 +176,20 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz ippiNormRelFuncNoHint ippiNormRel = norm_type == cv::NORM_INF ? ( - #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_8u_C1R : - #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16u_C1R : type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16s_C1R : type == CV_32F ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_32f_C1R : 0) : norm_type == cv::NORM_L1 ? ( - #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_8u_C1R : - #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16u_C1R : type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16s_C1R : 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( - #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_8u_C1R : - #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16u_C1R : type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16s_C1R : 0) : 0; @@ -300,26 +292,20 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz ippiNormDiffFuncNoHint ippiNormDiff = norm_type == cv::NORM_INF ? ( - #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R : - #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C1R : type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C1R : type == CV_32F ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C1R : 0) : norm_type == cv::NORM_L1 ? ( - #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C1R : - #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C1R : type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C1R : 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( - #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C1R : - #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C1R : type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C1R : 0) : 0; diff --git a/modules/core/include/opencv2/core/private.hpp b/modules/core/include/opencv2/core/private.hpp index 140264086f..4f23abf6de 100644 --- a/modules/core/include/opencv2/core/private.hpp +++ b/modules/core/include/opencv2/core/private.hpp @@ -209,7 +209,6 @@ T* allocSingletonNew() { return new(allocSingletonNewBuffer(sizeof(T))) T(); } #define IPP_DISABLE_XYZ_RGB 1 // big accuracy difference #define IPP_DISABLE_HOUGH 1 // improper integration/results #define IPP_DISABLE_FILTER2D_BIG_MASK 1 // different results on masks > 7x7 -#define IPP_DISABLE_NORM_8U 1 // accuracy difference in perf test sanity check // Temporary disabled named IPP region. Performance #define IPP_DISABLE_PERF_COPYMAKE 1 // performance variations From 9e2e1601fd68ab9e4a0558a8346c4ea6d7b9216f Mon Sep 17 00:00:00 2001 From: eplankin Date: Tue, 27 May 2025 06:45:47 -0700 Subject: [PATCH 2/3] Returned define --- hal/ipp/include/ipp_hal_core.hpp | 5 ++++- hal/ipp/src/norm_ipp.cpp | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hal/ipp/include/ipp_hal_core.hpp b/hal/ipp/include/ipp_hal_core.hpp index 656bc00ce5..d051fdd8c2 100644 --- a/hal/ipp/include/ipp_hal_core.hpp +++ b/hal/ipp/include/ipp_hal_core.hpp @@ -17,13 +17,16 @@ int ipp_hal_minMaxIdxMaskStep(const uchar* src_data, size_t src_step, int width, #undef cv_hal_minMaxIdxMaskStep #define cv_hal_minMaxIdxMaskStep ipp_hal_minMaxIdxMaskStep +#if (IPP_VERSION_X100 == 202200) +#define IPP_DISABLE_NORM_8U 1 // accuracy difference in perf test sanity check +#endif + int ipp_hal_norm(const uchar* src, size_t src_step, const uchar* mask, size_t mask_step, int width, int height, int type, int norm_type, double* result); #undef cv_hal_norm #define cv_hal_norm ipp_hal_norm - int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, size_t src2_step, const uchar* mask, size_t mask_step, int width, int height, int type, int norm_type, double* result); diff --git a/hal/ipp/src/norm_ipp.cpp b/hal/ipp/src/norm_ipp.cpp index a30172c346..16b0d9bd91 100644 --- a/hal/ipp/src/norm_ipp.cpp +++ b/hal/ipp/src/norm_ipp.cpp @@ -100,7 +100,9 @@ int ipp_hal_norm(const uchar* src, size_t src_step, const uchar* mask, size_t ma 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( + #if (!IPP_DISABLE_NORM_8U) type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C1R : + #endif type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C1R : type == CV_16SC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16s_C1R : 0) : 0; @@ -176,20 +178,26 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz ippiNormRelFuncNoHint ippiNormRel = norm_type == cv::NORM_INF ? ( + #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_8u_C1R : + #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16u_C1R : type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16s_C1R : type == CV_32F ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_32f_C1R : 0) : norm_type == cv::NORM_L1 ? ( + #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_8u_C1R : + #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16u_C1R : type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16s_C1R : 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( + #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_8u_C1R : + #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16u_C1R : type == CV_16S ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16s_C1R : 0) : 0; @@ -292,20 +300,26 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz ippiNormDiffFuncNoHint ippiNormDiff = norm_type == cv::NORM_INF ? ( + #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R : + #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C1R : type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16s_C1R : type == CV_32F ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_32f_C1R : 0) : norm_type == cv::NORM_L1 ? ( + #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C1R : + #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C1R : type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16s_C1R : 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( + #if (!IPP_DISABLE_NORM_8U) type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C1R : + #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C1R : type == CV_16S ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16s_C1R : 0) : 0; From e170b2dad1d1b043300499e8a8a54cc47cd30051 Mon Sep 17 00:00:00 2001 From: eplankin Date: Wed, 28 May 2025 03:27:07 -0700 Subject: [PATCH 3/3] Disabled warnings --- hal/ipp/src/norm_ipp.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hal/ipp/src/norm_ipp.cpp b/hal/ipp/src/norm_ipp.cpp index 16b0d9bd91..e6ed6b1f0b 100644 --- a/hal/ipp/src/norm_ipp.cpp +++ b/hal/ipp/src/norm_ipp.cpp @@ -100,7 +100,7 @@ int ipp_hal_norm(const uchar* src, size_t src_step, const uchar* mask, size_t ma 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( - #if (!IPP_DISABLE_NORM_8U) + #ifndef IPP_DISABLE_NORM_8U type == CV_8UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_8u_C1R : #endif type == CV_16UC1 ? (ippiNormFuncNoHint)ippiNorm_L2_16u_C1R : @@ -178,7 +178,7 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz ippiNormRelFuncNoHint ippiNormRel = norm_type == cv::NORM_INF ? ( - #if (!IPP_DISABLE_NORM_8U) + #ifndef IPP_DISABLE_NORM_8U type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_8u_C1R : #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16u_C1R : @@ -187,7 +187,7 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz 0) : norm_type == cv::NORM_L1 ? ( - #if (!IPP_DISABLE_NORM_8U) + #ifndef IPP_DISABLE_NORM_8U type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_8u_C1R : #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16u_C1R : @@ -195,7 +195,7 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( - #if (!IPP_DISABLE_NORM_8U) + #ifndef IPP_DISABLE_NORM_8U type == CV_8U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_8u_C1R : #endif type == CV_16U ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16u_C1R : @@ -300,7 +300,7 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz ippiNormDiffFuncNoHint ippiNormDiff = norm_type == cv::NORM_INF ? ( - #if (!IPP_DISABLE_NORM_8U) + #ifndef IPP_DISABLE_NORM_8U type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_8u_C1R : #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_Inf_16u_C1R : @@ -309,7 +309,7 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz 0) : norm_type == cv::NORM_L1 ? ( - #if (!IPP_DISABLE_NORM_8U) + #ifndef IPP_DISABLE_NORM_8U type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_8u_C1R : #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L1_16u_C1R : @@ -317,7 +317,7 @@ int ipp_hal_normDiff(const uchar* src1, size_t src1_step, const uchar* src2, siz 0) : norm_type == cv::NORM_L2 || norm_type == cv::NORM_L2SQR ? ( - #if (!IPP_DISABLE_NORM_8U) + #ifndef IPP_DISABLE_NORM_8U type == CV_8U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_8u_C1R : #endif type == CV_16U ? (ippiNormDiffFuncNoHint)ippiNormDiff_L2_16u_C1R :