From e362c3fb3898101d8baa8f933a3619f8495cb2d7 Mon Sep 17 00:00:00 2001 From: Elena Gvozdeva Date: Tue, 6 May 2014 11:10:26 +0400 Subject: [PATCH] fixed --- modules/core/perf/perf_dft.cpp | 16 +++++--- modules/core/src/dxt.cpp | 89 ++++++++++++++++++++++++------------------ 2 files changed, 62 insertions(+), 43 deletions(-) diff --git a/modules/core/perf/perf_dft.cpp b/modules/core/perf/perf_dft.cpp index a2d3d50..5d02b84 100644 --- a/modules/core/perf/perf_dft.cpp +++ b/modules/core/perf/perf_dft.cpp @@ -9,23 +9,29 @@ using std::tr1::get; #define MAT_TYPES_DFT CV_32FC1, CV_32FC2, CV_64FC1 #define MAT_SIZES_DFT cv::Size(320, 480), cv::Size(800, 600), cv::Size(1280, 1024), sz1080p, sz2K CV_ENUM(FlagsType, 0, DFT_INVERSE, DFT_SCALE, DFT_COMPLEX_OUTPUT, DFT_ROWS, DFT_INVERSE|DFT_COMPLEX_OUTPUT) -#define TEST_MATS_DFT testing::Combine(testing::Values(MAT_SIZES_DFT), testing::Values(MAT_TYPES_DFT), FlagsType::all()) +#define TEST_MATS_DFT testing::Combine(testing::Values(MAT_SIZES_DFT), testing::Values(MAT_TYPES_DFT), FlagsType::all(), testing::Values(true, false)) -typedef std::tr1::tuple Size_MatType_FlagsType_t; -typedef perf::TestBaseWithParam Size_MatType_FlagsType; +typedef std::tr1::tuple Size_MatType_FlagsType_NzeroRows_t; +typedef perf::TestBaseWithParam Size_MatType_FlagsType_NzeroRows; -PERF_TEST_P(Size_MatType_FlagsType, dft, TEST_MATS_DFT) +PERF_TEST_P(Size_MatType_FlagsType_NzeroRows, dft, TEST_MATS_DFT) { Size sz = get<0>(GetParam()); int type = get<1>(GetParam()); int flags = get<2>(GetParam()); + bool isNzeroRows = get<3>(GetParam()); + + int nonzero_rows = 0; Mat src(sz, type); Mat dst(sz, type); declare.in(src, WARMUP_RNG).time(60); - TEST_CYCLE() dft(src, dst, flags); + if (isNzeroRows) + nonzero_rows = sz.height/2; + + TEST_CYCLE() dft(src, dst, flags, nonzero_rows); SANITY_CHECK(dst, 1e-5, ERROR_RELATIVE); } \ No newline at end of file diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index e3525b9..77b0f9a 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -466,56 +466,56 @@ template<> struct DFT_VecR4 #endif #ifdef USE_IPP_DFT -static void ippsDFTFwd_CToC( const Complex* src, Complex* dst, +static IppStatus ippsDFTFwd_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - ippsDFTFwd_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, - (const IppsDFTSpec_C_32fc*)spec, buf); + return ippsDFTFwd_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, + (const IppsDFTSpec_C_32fc*)spec, buf); } -static void ippsDFTFwd_CToC( const Complex* src, Complex* dst, +static IppStatus ippsDFTFwd_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - ippsDFTFwd_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, - (const IppsDFTSpec_C_64fc*)spec, buf); + return ippsDFTFwd_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, + (const IppsDFTSpec_C_64fc*)spec, buf); } -static void ippsDFTInv_CToC( const Complex* src, Complex* dst, +static IppStatus ippsDFTInv_CToC( const Complex* src, Complex* dst, const void* spec, uchar* buf) { - ippsDFTInv_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, - (const IppsDFTSpec_C_32fc*)spec, buf); + return ippsDFTInv_CToC_32fc( (const Ipp32fc*)src, (Ipp32fc*)dst, + (const IppsDFTSpec_C_32fc*)spec, buf); } -static void ippsDFTInv_CToC( const Complex* src, Complex* dst, - const void* spec, uchar* buf) +static IppStatus ippsDFTInv_CToC( const Complex* src, Complex* dst, + const void* spec, uchar* buf) { - ippsDFTInv_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, - (const IppsDFTSpec_C_64fc*)spec, buf); + return ippsDFTInv_CToC_64fc( (const Ipp64fc*)src, (Ipp64fc*)dst, + (const IppsDFTSpec_C_64fc*)spec, buf); } -static void ippsDFTFwd_RToPack( const float* src, float* dst, - const void* spec, uchar* buf) +static IppStatus ippsDFTFwd_RToPack( const float* src, float* dst, + const void* spec, uchar* buf) { - ippsDFTFwd_RToPack_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); + return ippsDFTFwd_RToPack_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); } -static void ippsDFTFwd_RToPack( const double* src, double* dst, - const void* spec, uchar* buf) +static IppStatus ippsDFTFwd_RToPack( const double* src, double* dst, + const void* spec, uchar* buf) { - ippsDFTFwd_RToPack_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); + return ippsDFTFwd_RToPack_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); } -static void ippsDFTInv_PackToR( const float* src, float* dst, - const void* spec, uchar* buf) +static IppStatus ippsDFTInv_PackToR( const float* src, float* dst, + const void* spec, uchar* buf) { - ippsDFTInv_PackToR_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); + return ippsDFTInv_PackToR_32f( src, dst, (const IppsDFTSpec_R_32f*)spec, buf); } -static void ippsDFTInv_PackToR( const double* src, double* dst, - const void* spec, uchar* buf) +static IppStatus ippsDFTInv_PackToR( const double* src, double* dst, + const void* spec, uchar* buf) { - ippsDFTInv_PackToR_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); + return ippsDFTInv_PackToR_64f( src, dst, (const IppsDFTSpec_R_64f*)spec, buf); } #endif @@ -551,10 +551,16 @@ DFT( const Complex* src, Complex* dst, int n, if( spec ) { if( !inv ) - ippsDFTFwd_CToC( src, dst, spec, (uchar*)buf ); + { + if (ippsDFTFwd_CToC( src, dst, spec, (uchar*)buf ) >= 0) + return; + } else - ippsDFTInv_CToC( src, dst, spec, (uchar*)buf ); - return; + { + if (ippsDFTInv_CToC( src, dst, spec, (uchar*)buf ) >= 0) + return; + } + setIppErrorStatus(); } #endif @@ -981,15 +987,18 @@ RealDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab, #ifdef USE_IPP_DFT if( spec ) { - ippsDFTFwd_RToPack( src, dst, spec, (uchar*)buf ); - if( complex_output ) + if (ippsDFTFwd_RToPack( src, dst, spec, (uchar*)buf ) >=0) { - dst[-1] = dst[0]; - dst[0] = 0; - if( (n & 1) == 0 ) - dst[n] = 0; + if( complex_output ) + { + dst[-1] = dst[0]; + dst[0] = 0; + if( (n & 1) == 0 ) + dst[n] = 0; + } + return; } - return; + setIppErrorStatus(); } #endif assert( tab_size == n ); @@ -1113,8 +1122,10 @@ CCSIDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab, #ifdef USE_IPP_DFT if( spec ) { - ippsDFTInv_PackToR( src, dst, spec, (uchar*)buf ); - goto finalize; + if (ippsDFTInv_PackToR( src, dst, spec, (uchar*)buf ) >=0) + goto finalize; + + setIppErrorStatus(); } #endif if( n == 1 ) @@ -2186,6 +2197,8 @@ void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows ) spec = 0; sz += worksize; } + else + setIppErrorStatus(); } else #endif @@ -3299,4 +3312,4 @@ cvGetOptimalDFTSize( int size0 ) return cv::getOptimalDFTSize(size0); } -/* End of file. */ +/* End of file. */ \ No newline at end of file -- 2.7.4