using std::tr1::get;
#define TYPICAL_MAT_SIZES_SORT TYPICAL_MAT_SIZES
-#define TYPICAL_MAT_TYPES_SORT CV_8SC1, CV_16UC1, CV_32FC1
+#define TYPICAL_MAT_TYPES_SORT CV_8UC1, CV_16UC1, CV_32FC1
#define SORT_TYPES SORT_EVERY_ROW | SORT_ASCENDING, SORT_EVERY_ROW | SORT_DESCENDING
#define TYPICAL_MATS_SORT testing::Combine( testing::Values(TYPICAL_MAT_SIZES_SORT), testing::Values(TYPICAL_MAT_TYPES_SORT), testing::Values(SORT_TYPES) )
TEST_CYCLE() cv::sortIdx(a, b, flags);
- SANITY_CHECK(b);
+ SANITY_CHECK_NOTHING();
}
{
#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
+#define USE_IPP_SORT
typedef IppStatus (CV_STDCALL *IppSortFunc)(void *, int);
+typedef IppSortFunc IppFlipFunc;
static IppSortFunc getSortFunc(int depth, bool sortDescending)
{
depth == CV_64F ? (IppSortFunc)ippsSortDescend_64f_I : 0;
}
+static IppFlipFunc getFlipFunc(int depth)
+{
+ CV_SUPPRESS_DEPRECATED_START
+ return
+ depth == CV_8U || depth == CV_8S ? (IppFlipFunc)ippsFlip_8u_I :
+ depth == CV_16U || depth == CV_16S ? (IppFlipFunc)ippsFlip_16u_I :
+ depth == CV_32S || depth == CV_32F ? (IppFlipFunc)ippsFlip_32f_I :
+ depth == CV_64F ? (IppFlipFunc)ippsFlip_64f_I : 0;
+ CV_SUPPRESS_DEPRECATED_END
+}
+
+
#endif
template<typename T> static void sort_( const Mat& src, Mat& dst, int flags )
}
bptr = (T*)buf;
-#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
- IppSortFunc ippFunc = getSortFunc(src.depth(), sortDescending);
+#ifdef USE_IPP_SORT
+ int depth = src.depth();
+ IppSortFunc ippSortFunc = getSortFunc(depth, sortDescending);
+ IppFlipFunc ippFlipFunc = getFlipFunc(depth);
#endif
for( i = 0; i < n; i++ )
ptr[j] = ((const T*)(src.data + src.step*j))[i];
}
-#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
- if (!ippFunc || ippFunc(ptr, len) < 0)
+#ifdef USE_IPP_SORT
+ if (!ippSortFunc || ippSortFunc(ptr, len) < 0)
#endif
{
+#ifdef USE_IPP_SORT
+ setIppErrorStatus();
+#endif
std::sort( ptr, ptr + len );
if( sortDescending )
- for( j = 0; j < len/2; j++ )
- std::swap(ptr[j], ptr[len-1-j]);
+ {
+#ifdef USE_IPP_SORT
+ if (!ippFlipFunc || ippFlipFunc(ptr, len) < 0)
+#endif
+ {
+#ifdef USE_IPP_SORT
+ setIppErrorStatus();
+#endif
+ for( j = 0; j < len/2; j++ )
+ std::swap(ptr[j], ptr[len-1-j]);
+ }
+ }
}
if( !sortRows )
const _Tp* arr;
};
-#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
+#ifdef USE_IPP_SORT
typedef IppStatus (CV_STDCALL *IppSortIndexFunc)(void *, int *, int);
bptr = (T*)buf;
_iptr = (int*)ibuf;
-#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
- IppSortIndexFunc ippFunc = getSortIndexFunc(src.depth(), sortDescending);
+#ifdef USE_IPP_SORT
+ int depth = src.depth();
+ IppSortIndexFunc ippFunc = getSortIndexFunc(depth, sortDescending);
+ IppFlipFunc ippFlipFunc = getFlipFunc(depth);
#endif
for( i = 0; i < n; i++ )
for( j = 0; j < len; j++ )
iptr[j] = j;
-#if IPP_VERSION_X100 > 0 && !defined HAVE_IPP_ICV_ONLY
+#ifdef USE_IPP_SORT
if (sortRows || !ippFunc || ippFunc(ptr, iptr, len) < 0)
#endif
{
+#ifdef USE_IPP_SORT
+ setIppErrorStatus();
+#endif
std::sort( iptr, iptr + len, LessThanIdx<T>(ptr) );
if( sortDescending )
- for( j = 0; j < len/2; j++ )
- std::swap(iptr[j], iptr[len-1-j]);
+ {
+#ifdef USE_IPP_SORT
+ if (!ippFlipFunc || ippFlipFunc(iptr, len) < 0)
+#endif
+ {
+#ifdef USE_IPP_SORT
+ setIppErrorStatus();
+#endif
+ for( j = 0; j < len/2; j++ )
+ std::swap(iptr[j], iptr[len-1-j]);
+ }
+ }
}
if( !sortRows )