Skip to content

Commit d3ebe66

Browse files
committed
core: fix IPP optimization for sortIdx
1 parent 9067310 commit d3ebe66

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

modules/core/src/matrix.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4384,11 +4384,10 @@ static bool ipp_sortIdx( const Mat& src, Mat& dst, int flags )
43844384
{
43854385
CV_INSTRUMENT_REGION_IPP()
43864386

4387-
bool sortRows = (flags & 1) == CV_SORT_EVERY_ROW;
4388-
bool sortDescending = (flags & CV_SORT_DESCENDING) != 0;
4387+
bool sortRows = (flags & 1) == SORT_EVERY_ROW;
4388+
bool sortDescending = (flags & SORT_DESCENDING) != 0;
43894389
int depth = src.depth();
43904390
IppDataType type = ippiGetDataType(depth);
4391-
Ipp32s elemSize = (Ipp32s)src.elemSize1();
43924391

43934392
IppSortIndexFunc ippsSortRadixIndex = getSortIndexFunc(depth, sortDescending);
43944393
if(!ippsSortRadixIndex)
@@ -4405,7 +4404,7 @@ static bool ipp_sortIdx( const Mat& src, Mat& dst, int flags )
44054404

44064405
for(int i = 0; i < src.rows; i++)
44074406
{
4408-
if(CV_INSTRUMENT_FUN_IPP(ippsSortRadixIndex, (void*)src.ptr(i), elemSize, (Ipp32s*)dst.ptr(i), src.cols, buffer) < 0)
4407+
if(CV_INSTRUMENT_FUN_IPP(ippsSortRadixIndex, (const void*)src.ptr(i), (Ipp32s)src.step[1], (Ipp32s*)dst.ptr(i), src.cols, buffer) < 0)
44094408
return false;
44104409
}
44114410
}
@@ -4422,13 +4421,13 @@ static bool ipp_sortIdx( const Mat& src, Mat& dst, int flags )
44224421

44234422
buffer.allocate(bufferSize);
44244423

4425-
Ipp32s pixStride = elemSize*dst.cols;
4424+
Ipp32s srcStep = (Ipp32s)src.step[0];
44264425
for(int i = 0; i < src.cols; i++)
44274426
{
44284427
subRect.x = i;
44294428
dstSub = Mat(dst, subRect);
44304429

4431-
if(CV_INSTRUMENT_FUN_IPP(ippsSortRadixIndex, (void*)src.ptr(0, i), pixStride, (Ipp32s*)dstRow.ptr(), src.rows, buffer) < 0)
4430+
if(CV_INSTRUMENT_FUN_IPP(ippsSortRadixIndex, (const void*)src.ptr(0, i), srcStep, (Ipp32s*)dstRow.ptr(), src.rows, buffer) < 0)
44324431
return false;
44334432

44344433
dstRow = dstRow.reshape(1, dstSub.rows);

0 commit comments

Comments
 (0)