@@ -1333,23 +1333,23 @@ static bool ipp_countNonZero( Mat &src, int &res )
1333
1333
{
1334
1334
IppStatus status;
1335
1335
const Mat *arrays[] = {&src, NULL };
1336
- uchar *ptrs [1 ] = { NULL } ;
1337
- NAryMatIterator it (arrays, ptrs );
1336
+ Mat planes [1 ];
1337
+ NAryMatIterator it (arrays, planes, 1 );
1338
1338
IppiSize size = {(int )it.size *src.channels (), 1 };
1339
-
1339
+ res = 0 ;
1340
1340
for (size_t i = 0 ; i < it.nplanes ; i++, ++it)
1341
1341
{
1342
1342
if (depth == CV_8U)
1343
- status = CV_INSTRUMENT_FUN_IPP (ippiCountInRange_8u_C1R, ( const Ipp8u *)src. ptr (), (int )src. step , size, &count, 0 , 0 );
1343
+ status = CV_INSTRUMENT_FUN_IPP (ippiCountInRange_8u_C1R, it. planes -> ptr <Ipp8u> (), (int )it. planes -> step , size, &count, 0 , 0 );
1344
1344
else if (depth == CV_32F)
1345
- status = CV_INSTRUMENT_FUN_IPP (ippiCountInRange_32f_C1R, ( const Ipp32f *)src. ptr (), (int )src. step , size, &count, 0 , 0 );
1345
+ status = CV_INSTRUMENT_FUN_IPP (ippiCountInRange_32f_C1R, it. planes -> ptr <Ipp32f> (), (int )it. planes -> step , size, &count, 0 , 0 );
1346
1346
else
1347
1347
return false ;
1348
1348
1349
- if (status < 0 )
1349
+ if (status < 0 || ( int )it. planes -> total ()*src. channels () < count )
1350
1350
return false ;
1351
1351
1352
- res += (size. width *size. height - count) ;
1352
+ res += (int )it. planes -> total ()*src. channels () - count;
1353
1353
}
1354
1354
}
1355
1355
0 commit comments