From dfe6adebb94f0a70a9f4dc9f45129d4bde7d7c48 Mon Sep 17 00:00:00 2001 From: vbystricky Date: Tue, 22 Apr 2014 15:07:03 +0400 Subject: [PATCH] Fix error in arguments of ipp function --- modules/core/src/stat.cpp | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index b03fe73..bc9dcc2 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -2442,30 +2442,43 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m } else { - typedef IppStatus (CV_STDCALL* ippiNormRelFunc)(const void *, int, const void *, int, IppiSize, Ipp64f *); - ippiNormRelFunc ippFunc = + typedef IppStatus (CV_STDCALL* ippiNormRelFuncNoHint)(const void *, int, const void *, int, IppiSize, Ipp64f *); + typedef IppStatus (CV_STDCALL* ippiNormRelFuncHint)(const void *, int, const void *, int, IppiSize, Ipp64f *, IppHintAlgorithm hint); + ippiNormRelFuncNoHint ippFuncNoHint = normType == NORM_INF ? - (type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_Inf_8u_C1R : - type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_Inf_16u_C1R : - type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_Inf_16s_C1R : - type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_Inf_32f_C1R : + (type == CV_8UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_8u_C1R : + type == CV_16UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16u_C1R : + type == CV_16SC1 ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_16s_C1R : + type == CV_32FC1 ? (ippiNormRelFuncNoHint)ippiNormRel_Inf_32f_C1R : 0) : normType == NORM_L1 ? - (type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_L1_8u_C1R : - type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_L1_16u_C1R : - type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_L1_16s_C1R : - type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_L1_32f_C1R : + (type == CV_8UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L1_8u_C1R : + type == CV_16UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16u_C1R : + type == CV_16SC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L1_16s_C1R : 0) : normType == NORM_L2 || normType == NORM_L2SQR ? - (type == CV_8UC1 ? (ippiNormRelFunc)ippiNormRel_L2_8u_C1R : - type == CV_16UC1 ? (ippiNormRelFunc)ippiNormRel_L2_16u_C1R : - type == CV_16SC1 ? (ippiNormRelFunc)ippiNormRel_L2_16s_C1R : - type == CV_32FC1 ? (ippiNormRelFunc)ippiNormRel_L2_32f_C1R : + (type == CV_8UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L2_8u_C1R : + type == CV_16UC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16u_C1R : + type == CV_16SC1 ? (ippiNormRelFuncNoHint)ippiNormRel_L2_16s_C1R : 0) : 0; - if( ippFunc ) + ippiNormRelFuncHint ippFuncHint = + normType == NORM_L1 ? + (type == CV_32FC1 ? (ippiNormRelFuncHint)ippiNormRel_L1_32f_C1R : + 0) : + normType == NORM_L2 || normType == NORM_L2SQR ? + (type == CV_32FC1 ? (ippiNormRelFuncHint)ippiNormRel_L2_32f_C1R : + 0) : 0; + if (ippFuncNoHint) + { + Ipp64f norm; + if( ippFuncNoHint(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], sz, &norm) >= 0 ) + return (double)norm; + setIppErrorStatus(); + } + if (ippFuncHint) { Ipp64f norm; - if( ippFunc(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], sz, &norm) >= 0 ) + if( ippFuncHint(src1.data, (int)src1.step[0], src2.data, (int)src2.step[0], sz, &norm, ippAlgHintAccurate) >= 0 ) return (double)norm; setIppErrorStatus(); } -- 2.7.4