Merge pull request #21107 from take1014:remove_assert_21038

resolves #21038

* remove C assert

* revert C header

* fix several points in review

* fix test_ds.cpp
pull/21152/head
yuki takehara 3 years ago committed by GitHub
parent b55d8f46f4
commit a6277370ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      modules/calib3d/src/calibration.cpp
  2. 6
      modules/calib3d/src/compat_ptsetreg.cpp
  3. 22
      modules/calib3d/test/test_cameracalibration.cpp
  4. 8
      modules/calib3d/test/test_fundam.cpp
  5. 34
      modules/calib3d/test/test_stereomatching.cpp
  6. 8
      modules/core/include/opencv2/core/wimage.hpp
  7. 20
      modules/core/src/array.cpp
  8. 60
      modules/core/src/datastructs.cpp
  9. 26
      modules/core/src/dxt.cpp
  10. 4
      modules/core/src/lapack.cpp
  11. 4
      modules/core/src/matmul.simd.hpp
  12. 2
      modules/core/src/matrix_sparse.cpp
  13. 2
      modules/core/src/opencl/runtime/opencl_clamdblas.cpp
  14. 2
      modules/core/src/opencl/runtime/opencl_clamdfft.cpp
  15. 2
      modules/core/src/opencl/runtime/opencl_core.cpp
  16. 4
      modules/core/src/persistence.cpp
  17. 2
      modules/core/src/persistence_json.cpp
  18. 18
      modules/core/src/persistence_types.cpp
  19. 6
      modules/core/src/persistence_xml.cpp
  20. 2
      modules/core/src/persistence_yml.cpp
  21. 46
      modules/core/test/test_ds.cpp
  22. 2
      modules/core/test/test_dxt.cpp
  23. 6
      modules/core/test/test_mat.cpp
  24. 14
      modules/core/test/test_math.cpp
  25. 1
      modules/dnn/src/ocl4dnn/src/ocl4dnn_conv_spatial.cpp
  26. 4
      modules/features2d/test/test_descriptors_regression.cpp
  27. 4
      modules/features2d/test/test_detectors_regression.cpp
  28. 2
      modules/features2d/test/test_nearestneighbors.cpp
  29. 4
      modules/flann/include/opencv2/flann/nn_index.h
  30. 1
      modules/highgui/src/precomp.hpp
  31. 2
      modules/highgui/src/window_carbon.cpp
  32. 2
      modules/highgui/src/window_gtk.cpp
  33. 7
      modules/highgui/src/window_w32.cpp
  34. 1
      modules/highgui/src/window_winrt.cpp
  35. 20
      modules/imgproc/src/approx.cpp
  36. 2
      modules/imgproc/src/bilateral_filter.simd.hpp
  37. 4
      modules/imgproc/src/contours.cpp
  38. 2
      modules/imgproc/src/convhull.cpp
  39. 12
      modules/imgproc/src/drawing.cpp
  40. 6
      modules/imgproc/src/emd.cpp
  41. 8
      modules/imgproc/src/hough.cpp
  42. 2
      modules/imgproc/src/median_blur.simd.hpp
  43. 2
      modules/imgproc/src/moments.cpp
  44. 1
      modules/imgproc/src/precomp.hpp
  45. 8
      modules/imgproc/src/resize.cpp
  46. 2
      modules/imgproc/src/samplers.cpp
  47. 6
      modules/imgproc/src/segmentation.cpp
  48. 2
      modules/imgproc/src/subdivision2d.cpp
  49. 4
      modules/imgproc/test/test_approxpoly.cpp
  50. 2
      modules/imgproc/test/test_bilateral_filter.cpp
  51. 2
      modules/imgproc/test/test_canny.cpp
  52. 12
      modules/imgproc/test/test_color.cpp
  53. 2
      modules/imgproc/test/test_contours.cpp
  54. 16
      modules/imgproc/test/test_convhull.cpp
  55. 2
      modules/imgproc/test/test_distancetransform.cpp
  56. 8
      modules/imgproc/test/test_filter.cpp
  57. 4
      modules/imgproc/test/test_imgwarp.cpp
  58. 2
      modules/imgproc/test/test_imgwarp_strict.cpp
  59. 2
      modules/imgproc/test/test_templmatch.cpp
  60. 4
      modules/imgproc/test/test_thresh.cpp
  61. 1
      modules/ml/src/precomp.hpp
  62. 2
      modules/ml/src/tree.cpp
  63. 8
      modules/objdetect/src/cascadedetect.cpp
  64. 1
      modules/objdetect/src/detection_based_tracker.cpp
  65. 4
      modules/objdetect/src/haar.cpp
  66. 4
      modules/objdetect/src/hog.cpp
  67. 12
      modules/objdetect/test/test_cascadeandhog.cpp
  68. 2
      modules/ts/src/ocl_perf.cpp
  69. 2
      modules/ts/src/ts.cpp
  70. 6
      modules/ts/src/ts_arrtest.cpp
  71. 8
      modules/ts/src/ts_func.cpp
  72. 8
      modules/ts/src/ts_perf.cpp
  73. 4
      modules/videoio/src/cap_cmu.cpp
  74. 2
      modules/videoio/src/cap_dc1394.cpp
  75. 1
      modules/videoio/src/cap_dc1394_v2.cpp
  76. 9
      modules/videoio/src/cap_ffmpeg_impl.hpp
  77. 2
      modules/videoio/src/cap_giganetix.cpp
  78. 3
      modules/videoio/src/cap_libv4l.cpp
  79. 5
      modules/videoio/src/cap_qt.cpp
  80. 5
      modules/videoio/src/cap_v4l.cpp
  81. 1
      modules/videoio/src/precomp.hpp

@ -2125,7 +2125,7 @@ static double cvStereoCalibrateImpl( const CvMat* _objectPoints, const CvMat* _i
if( solver.state == CvLevMarq::CALC_J )
{
int iofs = (nimages+1)*6 + k*NINTRINSIC, eofs = (i+1)*6;
assert( JtJ && JtErr );
CV_Assert( JtJ && JtErr );
Mat _JtJ(cvarrToMat(JtJ)), _JtErr(cvarrToMat(JtErr));
@ -2929,7 +2929,7 @@ cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
CvMat Qx = cvMat(3, 3, CV_64F, _Qx);
cvMatMul(&M, &Qx, &R);
assert(fabs(matR[2][1]) < FLT_EPSILON);
CV_DbgAssert(fabs(matR[2][1]) < FLT_EPSILON);
matR[2][1] = 0;
/* Find Givens rotation for y axis. */
@ -2948,7 +2948,7 @@ cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
CvMat Qy = cvMat(3, 3, CV_64F, _Qy);
cvMatMul(&R, &Qy, &M);
assert(fabs(matM[2][0]) < FLT_EPSILON);
CV_DbgAssert(fabs(matM[2][0]) < FLT_EPSILON);
matM[2][0] = 0;
/* Find Givens rotation for z axis. */
@ -2968,7 +2968,7 @@ cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
CvMat Qz = cvMat(3, 3, CV_64F, _Qz);
cvMatMul(&M, &Qz, &R);
assert(fabs(matR[1][0]) < FLT_EPSILON);
CV_DbgAssert(fabs(matR[1][0]) < FLT_EPSILON);
matR[1][0] = 0;
// Solve the decomposition ambiguity.

@ -121,7 +121,7 @@ bool CvLevMarq::update( const CvMat*& _param, CvMat*& matJ, CvMat*& _err )
{
matJ = _err = 0;
assert( !err.empty() );
CV_Assert( !err.empty() );
if( state == DONE )
{
_param = param;
@ -154,7 +154,7 @@ bool CvLevMarq::update( const CvMat*& _param, CvMat*& matJ, CvMat*& _err )
return true;
}
assert( state == CHECK_ERR );
CV_Assert( state == CHECK_ERR );
errNorm = cvNorm( err, 0, CV_L2 );
if( errNorm > prevErrNorm )
{
@ -222,7 +222,7 @@ bool CvLevMarq::updateAlt( const CvMat*& _param, CvMat*& _JtJ, CvMat*& _JtErr, d
return true;
}
assert( state == CHECK_ERR );
CV_Assert( state == CHECK_ERR );
if( errNorm > prevErrNorm )
{
if( ++lambdaLg10 <= 16 )

@ -831,30 +831,30 @@ void CV_CameraCalibrationTest_CPP::calibrate(int imageCount, int* pointCounts,
perViewErrorsMat,
flags );
assert( stdDevsMatInt.type() == CV_64F );
assert( stdDevsMatInt.total() == static_cast<size_t>(CV_CALIB_NINTRINSIC) );
CV_Assert( stdDevsMatInt.type() == CV_64F );
CV_Assert( stdDevsMatInt.total() == static_cast<size_t>(CV_CALIB_NINTRINSIC) );
memcpy( stdDevs, stdDevsMatInt.ptr(), CV_CALIB_NINTRINSIC*sizeof(double) );
assert( stdDevsMatExt.type() == CV_64F );
assert( stdDevsMatExt.total() == static_cast<size_t>(6*imageCount) );
CV_Assert( stdDevsMatExt.type() == CV_64F );
CV_Assert( stdDevsMatExt.total() == static_cast<size_t>(6*imageCount) );
memcpy( stdDevs + CV_CALIB_NINTRINSIC, stdDevsMatExt.ptr(), 6*imageCount*sizeof(double) );
assert( perViewErrorsMat.type() == CV_64F);
assert( perViewErrorsMat.total() == static_cast<size_t>(imageCount) );
CV_Assert( perViewErrorsMat.type() == CV_64F);
CV_Assert( perViewErrorsMat.total() == static_cast<size_t>(imageCount) );
memcpy( perViewErrors, perViewErrorsMat.ptr(), imageCount*sizeof(double) );
assert( cameraMatrix.type() == CV_64FC1 );
CV_Assert( cameraMatrix.type() == CV_64FC1 );
memcpy( _cameraMatrix, cameraMatrix.ptr(), 9*sizeof(double) );
assert( cameraMatrix.type() == CV_64FC1 );
CV_Assert( cameraMatrix.type() == CV_64FC1 );
memcpy( _distortionCoeffs, distCoeffs.ptr(), 4*sizeof(double) );
vector<Mat>::iterator rvecsIt = rvecs.begin();
vector<Mat>::iterator tvecsIt = tvecs.begin();
double *rm = rotationMatrices,
*tm = translationVectors;
assert( rvecsIt->type() == CV_64FC1 );
assert( tvecsIt->type() == CV_64FC1 );
CV_Assert( rvecsIt->type() == CV_64FC1 );
CV_Assert( tvecsIt->type() == CV_64FC1 );
for( int i = 0; i < imageCount; ++rvecsIt, ++tvecsIt, i++, rm+=9, tm+=3 )
{
Mat r9( 3, 3, CV_64FC1 );
@ -1141,7 +1141,7 @@ void CV_ProjectPointsTest::run(int)
imgPoints, dpdrot, dpdt, dpdf, dpdc, dpddist, 0 );
// calculate and check image points
assert( (int)imgPoints.size() == pointCount );
CV_Assert( (int)imgPoints.size() == pointCount );
vector<Point2f>::const_iterator it = imgPoints.begin();
for( int i = 0; i < pointCount; i++, ++it )
{

@ -56,7 +56,7 @@ static int cvTsRodrigues( const CvMat* src, CvMat* dst, CvMat* jacobian )
if( jacobian )
{
assert( (jacobian->rows == 9 && jacobian->cols == 3) ||
CV_Assert( (jacobian->rows == 9 && jacobian->cols == 3) ||
(jacobian->rows == 3 && jacobian->cols == 9) );
}
@ -65,7 +65,7 @@ static int cvTsRodrigues( const CvMat* src, CvMat* dst, CvMat* jacobian )
double r[3], theta;
CvMat _r = cvMat( src->rows, src->cols, CV_MAKETYPE(CV_64F,CV_MAT_CN(src->type)), r);
assert( dst->rows == 3 && dst->cols == 3 );
CV_Assert( dst->rows == 3 && dst->cols == 3 );
cvConvert( src, &_r );
@ -320,7 +320,7 @@ static int cvTsRodrigues( const CvMat* src, CvMat* dst, CvMat* jacobian )
}
else
{
assert(0);
CV_Assert(0);
return 0;
}
@ -404,7 +404,7 @@ static void test_convertHomogeneous( const Mat& _src, Mat& _dst )
}
else
{
assert( count == dst.cols );
CV_Assert( count == dst.cols );
ddims = dst.channels()*dst.rows;
if( dst.rows == 1 )
{

@ -406,7 +406,7 @@ void CV_StereoMatchingTest::run(int)
{
string dataPath = ts->get_data_path() + "cv/";
string algorithmName = name;
assert( !algorithmName.empty() );
CV_Assert( !algorithmName.empty() );
if( dataPath.empty() )
{
ts->printf( cvtest::TS::LOG, "dataPath is empty" );
@ -553,22 +553,22 @@ int CV_StereoMatchingTest::processStereoMatchingResults( FileStorage& fs, int ca
{
// rightDisp is not used in current test virsion
int code = cvtest::TS::OK;
assert( fs.isOpened() );
assert( trueLeftDisp.type() == CV_32FC1 );
assert( trueRightDisp.empty() || trueRightDisp.type() == CV_32FC1 );
assert( leftDisp.type() == CV_32FC1 && (rightDisp.empty() || rightDisp.type() == CV_32FC1) );
CV_Assert( fs.isOpened() );
CV_Assert( trueLeftDisp.type() == CV_32FC1 );
CV_Assert( trueRightDisp.empty() || trueRightDisp.type() == CV_32FC1 );
CV_Assert( leftDisp.type() == CV_32FC1 && (rightDisp.empty() || rightDisp.type() == CV_32FC1) );
// get masks for unknown ground truth disparity values
Mat leftUnknMask, rightUnknMask;
DatasetParams params = datasetsParams[caseDatasets[caseIdx]];
absdiff( trueLeftDisp, Scalar(params.dispUnknVal), leftUnknMask );
leftUnknMask = leftUnknMask < std::numeric_limits<float>::epsilon();
assert(leftUnknMask.type() == CV_8UC1);
CV_Assert(leftUnknMask.type() == CV_8UC1);
if( !trueRightDisp.empty() )
{
absdiff( trueRightDisp, Scalar(params.dispUnknVal), rightUnknMask );
rightUnknMask = rightUnknMask < std::numeric_limits<float>::epsilon();
assert(rightUnknMask.type() == CV_8UC1);
CV_Assert(rightUnknMask.type() == CV_8UC1);
}
// calculate errors
@ -623,7 +623,7 @@ int CV_StereoMatchingTest::readDatasetsParams( FileStorage& fs )
}
datasetsParams.clear();
FileNode fn = fs.getFirstTopLevelNode();
assert(fn.isSeq());
CV_Assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=3 )
{
String _name = fn[i];
@ -649,7 +649,7 @@ int CV_StereoMatchingTest::readRunParams( FileStorage& fs )
void CV_StereoMatchingTest::writeErrors( const string& errName, const vector<float>& errors, FileStorage* fs )
{
assert( (int)errors.size() == ERROR_KINDS_COUNT );
CV_Assert( (int)errors.size() == ERROR_KINDS_COUNT );
vector<float>::const_iterator it = errors.begin();
if( fs )
for( int i = 0; i < ERROR_KINDS_COUNT; i++, ++it )
@ -696,9 +696,9 @@ void CV_StereoMatchingTest::readROI( FileNode& fn, Rect& validROI )
int CV_StereoMatchingTest::compareErrors( const vector<float>& calcErrors, const vector<float>& validErrors,
const vector<float>& eps, const string& errName )
{
assert( (int)calcErrors.size() == ERROR_KINDS_COUNT );
assert( (int)validErrors.size() == ERROR_KINDS_COUNT );
assert( (int)eps.size() == ERROR_KINDS_COUNT );
CV_Assert( (int)calcErrors.size() == ERROR_KINDS_COUNT );
CV_Assert( (int)validErrors.size() == ERROR_KINDS_COUNT );
CV_Assert( (int)eps.size() == ERROR_KINDS_COUNT );
vector<float>::const_iterator calcIt = calcErrors.begin(),
validIt = validErrors.begin(),
epsIt = eps.begin();
@ -757,7 +757,7 @@ protected:
{
int code = CV_StereoMatchingTest::readRunParams( fs );
FileNode fn = fs.getFirstTopLevelNode();
assert(fn.isSeq());
CV_Assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=5 )
{
String caseName = fn[i], datasetName = fn[i+1];
@ -776,8 +776,8 @@ protected:
Rect& calcROI, Mat& leftDisp, Mat& /*rightDisp*/, int caseIdx )
{
RunParams params = caseRunParams[caseIdx];
assert( params.ndisp%16 == 0 );
assert( _leftImg.type() == CV_8UC3 && _rightImg.type() == CV_8UC3 );
CV_Assert( params.ndisp%16 == 0 );
CV_Assert( _leftImg.type() == CV_8UC3 && _rightImg.type() == CV_8UC3 );
Mat leftImg; cvtColor( _leftImg, leftImg, COLOR_BGR2GRAY );
Mat rightImg; cvtColor( _rightImg, rightImg, COLOR_BGR2GRAY );
@ -883,7 +883,7 @@ protected:
{
int code = CV_StereoMatchingTest::readRunParams(fs);
FileNode fn = fs.getFirstTopLevelNode();
assert(fn.isSeq());
CV_Assert(fn.isSeq());
for( int i = 0; i < (int)fn.size(); i+=5 )
{
String caseName = fn[i], datasetName = fn[i+1];
@ -902,7 +902,7 @@ protected:
Rect& calcROI, Mat& leftDisp, Mat& /*rightDisp*/, int caseIdx )
{
RunParams params = caseRunParams[caseIdx];
assert( params.ndisp%16 == 0 );
CV_Assert( params.ndisp%16 == 0 );
Ptr<StereoSGBM> sgbm = StereoSGBM::create( 0, params.ndisp, params.winSize,
10*params.winSize*params.winSize,
40*params.winSize*params.winSize,

@ -236,11 +236,11 @@ protected:
void operator=(const WImage&);
explicit WImage(IplImage* img) : image_(img) {
assert(!img || img->depth == Depth());
CV_Assert(!img || img->depth == Depth());
}
void SetIpl(IplImage* image) {
assert(!image || image->depth == Depth());
CV_Assert(!image || image->depth == Depth());
image_ = image;
}
@ -260,7 +260,7 @@ public:
enum { kChannels = C };
explicit WImageC(IplImage* img) : WImage<T>(img) {
assert(!img || img->nChannels == Channels());
CV_Assert(!img || img->nChannels == Channels());
}
// Construct a view into a region of this image
@ -283,7 +283,7 @@ protected:
void operator=(const WImageC&);
void SetIpl(IplImage* image) {
assert(!image || image->depth == WImage<T>::Depth());
CV_Assert(!image || image->depth == WImage<T>::Depth());
WImage<T>::SetIpl(image);
}
};

@ -497,7 +497,7 @@ cvInitNArrayIterator( int count, CvArr** arrs,
// returns zero value if iteration is finished, non-zero otherwise
CV_IMPL int cvNextNArraySlice( CvNArrayIterator* iterator )
{
assert( iterator != 0 );
CV_Assert( iterator != 0 );
int i, dims;
for( dims = iterator->dims; dims > 0; dims-- )
@ -648,7 +648,7 @@ icvGetNodePtr( CvSparseMat* mat, const int* idx, int* _type,
int i, tabidx;
unsigned hashval = 0;
CvSparseNode *node;
assert( CV_IS_SPARSE_MAT( mat ));
CV_Assert( CV_IS_SPARSE_MAT( mat ));
if( !precalc_hashval )
{
@ -697,7 +697,7 @@ icvGetNodePtr( CvSparseMat* mat, const int* idx, int* _type,
int newrawsize = newsize*sizeof(newtable[0]);
CvSparseMatIterator iterator;
assert( (newsize & (newsize - 1)) == 0 );
CV_Assert( (newsize & (newsize - 1)) == 0 );
// resize hash table
newtable = (void**)cvAlloc( newrawsize );
@ -742,7 +742,7 @@ icvDeleteNode( CvSparseMat* mat, const int* idx, unsigned* precalc_hashval )
int i, tabidx;
unsigned hashval = 0;
CvSparseNode *node, *prev = 0;
assert( CV_IS_SPARSE_MAT( mat ));
CV_Assert( CV_IS_SPARSE_MAT( mat ));
if( !precalc_hashval )
{
@ -1462,7 +1462,7 @@ cvScalarToRawData( const CvScalar* scalar, void* data, int type, int extend_to_1
int cn = CV_MAT_CN( type );
int depth = type & CV_MAT_DEPTH_MASK;
assert( scalar && data );
CV_Assert( scalar && data );
if( (unsigned)(cn - 1) >= 4 )
CV_Error( CV_StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" );
@ -1509,7 +1509,7 @@ cvScalarToRawData( const CvScalar* scalar, void* data, int type, int extend_to_1
((double*)data)[cn] = (double)(scalar->val[cn]);
break;
default:
assert(0);
CV_Assert(0);
CV_Error( CV_BadDepth, "" );
}
@ -1534,7 +1534,7 @@ cvRawDataToScalar( const void* data, int flags, CvScalar* scalar )
{
int cn = CV_MAT_CN( flags );
assert( scalar && data );
CV_Assert( scalar && data );
if( (unsigned)(cn - 1) >= 4 )
CV_Error( CV_StsOutOfRange, "The number of channels must be 1, 2, 3 or 4" );
@ -1572,7 +1572,7 @@ cvRawDataToScalar( const void* data, int flags, CvScalar* scalar )
scalar->val[cn] = ((double*)data)[cn];
break;
default:
assert(0);
CV_Assert(0);
CV_Error( CV_BadDepth, "" );
}
}
@ -2623,7 +2623,7 @@ cvReshapeMatND( const CvArr* arr,
{
CvMatND* mat = (CvMatND*)arr;
assert( new_cn > 0 );
CV_Assert( new_cn > 0 );
int last_dim_size = mat->dim[mat->dims-1].size*CV_MAT_CN(mat->type);
int new_size = last_dim_size/new_cn;
@ -2901,7 +2901,7 @@ CV_IMPL IplImage *
cvCreateImage( CvSize size, int depth, int channels )
{
IplImage *img = cvCreateImageHeader( size, depth, channels );
assert( img );
CV_Assert( img );
cvCreateData( img );
return img;

@ -97,7 +97,7 @@ icvInitMemStorage( CvMemStorage* storage, int block_size )
block_size = CV_STORAGE_BLOCK_SIZE;
block_size = cvAlign( block_size, CV_STRUCT_ALIGN );
assert( sizeof(CvMemBlock) % CV_STRUCT_ALIGN == 0 );
CV_Assert( sizeof(CvMemBlock) % CV_STRUCT_ALIGN == 0 );
memset( storage, 0, sizeof( *storage ));
storage->signature = CV_STORAGE_MAGIC_VAL;
@ -240,7 +240,7 @@ icvGoNextMemBlock( CvMemStorage * storage )
if( block == parent->top ) /* the single allocated block */
{
assert( parent->bottom == block );
CV_Assert( parent->bottom == block );
parent->top = parent->bottom = 0;
parent->free_space = 0;
}
@ -266,7 +266,7 @@ icvGoNextMemBlock( CvMemStorage * storage )
if( storage->top->next )
storage->top = storage->top->next;
storage->free_space = storage->block_size - sizeof(CvMemBlock);
assert( storage->free_space % CV_STRUCT_ALIGN == 0 );
CV_Assert( storage->free_space % CV_STRUCT_ALIGN == 0 );
}
@ -331,7 +331,7 @@ cvMemStorageAlloc( CvMemStorage* storage, size_t size )
if( size > INT_MAX )
CV_Error( CV_StsOutOfRange, "Too large memory block is requested" );
assert( storage->free_space % CV_STRUCT_ALIGN == 0 );
CV_Assert( storage->free_space % CV_STRUCT_ALIGN == 0 );
if( (size_t)storage->free_space < size )
{
@ -343,7 +343,7 @@ cvMemStorageAlloc( CvMemStorage* storage, size_t size )
}
ptr = ICV_FREE_PTR(storage);
assert( (size_t)ptr % CV_STRUCT_ALIGN == 0 );
CV_Assert( (size_t)ptr % CV_STRUCT_ALIGN == 0 );
storage->free_space = cvAlignLeft(storage->free_space - (int)size, CV_STRUCT_ALIGN );
return ptr;
@ -683,7 +683,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of )
else
{
icvGoNextMemBlock( storage );
assert( storage->free_space >= delta );
CV_Assert( storage->free_space >= delta );
}
}
@ -716,7 +716,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of )
* For used blocks it means current number
* of sequence elements in the block:
*/
assert( block->count % seq->elem_size == 0 && block->count > 0 );
CV_Assert( block->count % seq->elem_size == 0 && block->count > 0 );
if( !in_front_of )
{
@ -732,7 +732,7 @@ icvGrowSeq( CvSeq *seq, int in_front_of )
if( block != block->prev )
{
assert( seq->first->start_index == 0 );
CV_Assert( seq->first->start_index == 0 );
seq->first = block;
}
else
@ -760,7 +760,7 @@ icvFreeSeqBlock( CvSeq *seq, int in_front_of )
{
CvSeqBlock *block = seq->first;
assert( (in_front_of ? block : block->prev)->count == 0 );
CV_Assert( (in_front_of ? block : block->prev)->count == 0 );
if( block == block->prev ) /* single block case */
{
@ -775,7 +775,7 @@ icvFreeSeqBlock( CvSeq *seq, int in_front_of )
if( !in_front_of )
{
block = block->prev;
assert( seq->ptr == block->data );
CV_Assert( seq->ptr == block->data );
block->count = (int)(seq->block_max - seq->ptr);
seq->block_max = seq->ptr = block->prev->data +
@ -804,7 +804,7 @@ icvFreeSeqBlock( CvSeq *seq, int in_front_of )
block->next->prev = block->prev;
}
assert( block->count > 0 && block->count % seq->elem_size == 0 );
CV_Assert( block->count > 0 && block->count % seq->elem_size == 0 );
block->next = seq->free_blocks;
seq->free_blocks = block;
}
@ -861,7 +861,7 @@ cvFlushSeqWriter( CvSeqWriter * writer )
CvSeqBlock *block = first_block;
writer->block->count = (int)((writer->ptr - writer->block->data) / seq->elem_size);
assert( writer->block->count > 0 );
CV_Assert( writer->block->count > 0 );
do
{
@ -891,7 +891,7 @@ cvEndWriteSeq( CvSeqWriter * writer )
CvMemStorage *storage = seq->storage;
schar *storage_block_max = (schar *) storage->top + storage->block_size;
assert( writer->block->count > 0 );
CV_Assert( writer->block->count > 0 );
if( (unsigned)((storage_block_max - storage->free_space)
- seq->block_max) < CV_STRUCT_ALIGN )
@ -1147,7 +1147,7 @@ cvSeqPush( CvSeq *seq, const void *element )
icvGrowSeq( seq, 0 );
ptr = seq->ptr;
assert( ptr + elem_size <= seq->block_max /*&& ptr == seq->block_min */ );
CV_Assert( ptr + elem_size <= seq->block_max /*&& ptr == seq->block_min */ );
}
if( element )
@ -1183,7 +1183,7 @@ cvSeqPop( CvSeq *seq, void *element )
if( --(seq->first->prev->count) == 0 )
{
icvFreeSeqBlock( seq, 0 );
assert( seq->ptr == seq->block_max );
CV_Assert( seq->ptr == seq->block_max );
}
}
@ -1207,7 +1207,7 @@ cvSeqPushFront( CvSeq *seq, const void *element )
icvGrowSeq( seq, 1 );
block = seq->first;
assert( block->start_index > 0 );
CV_Assert( block->start_index > 0 );
}
ptr = block->data -= elem_size;
@ -1289,7 +1289,7 @@ cvSeqInsert( CvSeq *seq, int before_index, const void *element )
icvGrowSeq( seq, 0 );
ptr = seq->ptr + elem_size;
assert( ptr <= seq->block_max );
CV_Assert( ptr <= seq->block_max );
}
delta_index = seq->first->start_index;
@ -1307,7 +1307,7 @@ cvSeqInsert( CvSeq *seq, int before_index, const void *element )
block = prev_block;
/* Check that we don't fall into an infinite loop: */
assert( block != seq->first->prev );
CV_Assert( block != seq->first->prev );
}
before_index = (before_index - block->start_index + delta_index) * elem_size;
@ -1346,7 +1346,7 @@ cvSeqInsert( CvSeq *seq, int before_index, const void *element )
block = next_block;
/* Check that we don't fall into an infinite loop: */
assert( block != seq->first );
CV_Assert( block != seq->first );
}
before_index = (before_index - block->start_index + delta_index) * elem_size;
@ -1502,7 +1502,7 @@ cvSeqPushMulti( CvSeq *seq, const void *_elements, int count, int front )
icvGrowSeq( seq, 1 );
block = seq->first;
assert( block->start_index > 0 );
CV_Assert( block->start_index > 0 );
}
delta = MIN( block->start_index, count );
@ -1543,7 +1543,7 @@ cvSeqPopMulti( CvSeq *seq, void *_elements, int count, int front )
int delta = seq->first->prev->count;
delta = MIN( delta, count );
assert( delta > 0 );
CV_Assert( delta > 0 );
seq->first->prev->count -= delta;
seq->total -= delta;
@ -1568,7 +1568,7 @@ cvSeqPopMulti( CvSeq *seq, void *_elements, int count, int front )
int delta = seq->first->count;
delta = MIN( delta, count );
assert( delta > 0 );
CV_Assert( delta > 0 );
seq->first->count -= delta;
seq->total -= delta;
@ -2418,7 +2418,7 @@ cvSeqPartition( const CvSeq* seq, CvMemStorage* storage, CvSeq** labels,
root2->rank += root->rank == root2->rank;
root = root2;
}
assert( root->parent == 0 );
CV_Assert( root->parent == 0 );
// Compress path from node2 to the root:
while( node2->parent )
@ -2521,7 +2521,7 @@ cvSetAdd( CvSet* set, CvSetElem* element, CvSetElem** inserted_element )
((CvSetElem*)ptr)->flags = count | CV_SET_ELEM_FREE_FLAG;
((CvSetElem*)ptr)->next_free = (CvSetElem*)(ptr + elem_size);
}
assert( count <= CV_SET_ELEM_IDX_MASK+1 );
CV_Assert( count <= CV_SET_ELEM_IDX_MASK+1 );
((CvSetElem*)(ptr - elem_size))->next_free = 0;
set->first->prev->count += count - set->total;
set->total = count;
@ -2720,7 +2720,7 @@ cvFindGraphEdgeByPtr( const CvGraph* graph,
for( ; edge; edge = edge->next[ofs] )
{
ofs = start_vtx == edge->vtx[1];
assert( ofs == 1 || start_vtx == edge->vtx[0] );
CV_Assert( ofs == 1 || start_vtx == edge->vtx[0] );
if( edge->vtx[1] == end_vtx )
break;
}
@ -2784,7 +2784,7 @@ cvGraphAddEdgeByPtr( CvGraph* graph,
"vertex pointers coincide (or set to NULL)" );
edge = (CvGraphEdge*)cvSetNew( (CvSet*)(graph->edges) );
assert( edge->flags >= 0 );
CV_Assert( edge->flags >= 0 );
edge->vtx[0] = start_vtx;
edge->vtx[1] = end_vtx;
@ -2861,7 +2861,7 @@ cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx, CvGraphVtx* end_v
prev_ofs = ofs, prev_edge = edge, edge = edge->next[ofs] )
{
ofs = start_vtx == edge->vtx[1];
assert( ofs == 1 || start_vtx == edge->vtx[0] );
CV_Assert( ofs == 1 || start_vtx == edge->vtx[0] );
if( edge->vtx[1] == end_vtx )
break;
}
@ -2879,7 +2879,7 @@ cvGraphRemoveEdgeByPtr( CvGraph* graph, CvGraphVtx* start_vtx, CvGraphVtx* end_v
prev_ofs = ofs, prev_edge = edge, edge = edge->next[ofs] )
{
ofs = end_vtx == edge->vtx[1];
assert( ofs == 1 || end_vtx == edge->vtx[0] );
CV_Assert( ofs == 1 || end_vtx == edge->vtx[0] );
if( edge->vtx[0] == start_vtx )
break;
}
@ -3396,7 +3396,7 @@ cvInsertNodeIntoTree( void* _node, void* _parent, void* _frame )
node->v_prev = _parent != _frame ? parent : 0;
node->h_next = parent->v_next;
assert( parent->v_next != node );
CV_Assert( parent->v_next != node );
if( parent->v_next )
parent->v_next->h_prev = node;
@ -3430,7 +3430,7 @@ cvRemoveNodeFromTree( void* _node, void* _frame )
if( parent )
{
assert( parent->v_next == node );
CV_Assert( parent->v_next == node );
parent->v_next = node->h_next;
}
}

@ -238,7 +238,7 @@ DFTInit( int n0, int nf, const int* factors, int* itab, int elem_size, void* _wa
else
{
// radix[] is initialized from index 'nf' down to zero
assert (nf < 34);
CV_Assert (nf < 34);
radix[nf] = 1;
digits[nf] = 0;
for( i = 0; i < nf; i++ )
@ -374,7 +374,7 @@ DFTInit( int n0, int nf, const int* factors, int* itab, int elem_size, void* _wa
else
{
Complex<float>* wave = (Complex<float>*)_wave;
assert( elem_size == sizeof(Complex<float>) );
CV_Assert( elem_size == sizeof(Complex<float>) );
wave[0].re = 1.f;
wave[0].im = 0.f;
@ -874,13 +874,13 @@ DFT(const OcvDftOptions & c, const Complex<T>* src, Complex<T>* dst)
// 0. shuffle data
if( dst != src )
{
assert( !c.noPermute );
CV_Assert( !c.noPermute );
if( !inv )
{
for( i = 0; i <= n - 2; i += 2, itab += 2*tab_step )
{
int k0 = itab[0], k1 = itab[tab_step];
assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
CV_Assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
dst[i] = src[k0]; dst[i+1] = src[k1];
}
@ -892,7 +892,7 @@ DFT(const OcvDftOptions & c, const Complex<T>* src, Complex<T>* dst)
for( i = 0; i <= n - 2; i += 2, itab += 2*tab_step )
{
int k0 = itab[0], k1 = itab[tab_step];
assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
CV_Assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
t.re = src[k0].re; t.im = -src[k0].im;
dst[i] = t;
t.re = src[k1].re; t.im = -src[k1].im;
@ -921,7 +921,7 @@ DFT(const OcvDftOptions & c, const Complex<T>* src, Complex<T>* dst)
for( i = 0; i < n2; i += 2, itab += tab_step*2 )
{
j = itab[0];
assert( (unsigned)j < (unsigned)n2 );
CV_Assert( (unsigned)j < (unsigned)n2 );
CV_SWAP(dst[i+1], dsth[j], t);
if( j > i )
@ -938,7 +938,7 @@ DFT(const OcvDftOptions & c, const Complex<T>* src, Complex<T>* dst)
for( i = 0; i < n; i++, itab += tab_step )
{
j = itab[0];
assert( (unsigned)j < (unsigned)n );
CV_Assert( (unsigned)j < (unsigned)n );
if( j > i )
CV_SWAP(dst[i], dst[j], t);
}
@ -1218,7 +1218,7 @@ RealDFT(const OcvDftOptions & c, const T* src, T* dst)
setIppErrorStatus();
#endif
}
assert( c.tab_size == n );
CV_Assert( c.tab_size == n );
if( n == 1 )
{
@ -1338,11 +1338,11 @@ CCSIDFT(const OcvDftOptions & c, const T* src, T* dst)
T save_s1 = 0.;
T t0, t1, t2, t3, t;
assert( c.tab_size == n );
CV_Assert( c.tab_size == n );
if( complex_input )
{
assert( src != dst );
CV_Assert( src != dst );
save_s1 = src[1];
((T*)src)[1] = src[0];
src++;
@ -3175,7 +3175,7 @@ protected:
}
else
{
assert( !inv );
CV_Assert( !inv );
CopyColumn( dbuf0, complex_elem_size, dptr0,
dst_step, len, complex_elem_size );
if( even )
@ -3872,7 +3872,7 @@ DCTInit( int n, int elem_size, void* _wave, int inv )
if( n == 1 )
return;
assert( (n&1) == 0 );
CV_Assert( (n&1) == 0 );
if( (n & (n - 1)) == 0 )
{
@ -3910,7 +3910,7 @@ DCTInit( int n, int elem_size, void* _wave, int inv )
else
{
Complex<float>* wave = (Complex<float>*)_wave;
assert( elem_size == sizeof(Complex<float>) );
CV_Assert( elem_size == sizeof(Complex<float>) );
w.re = (float)scale;
w.im = 0.f;

@ -1020,7 +1020,7 @@ double invert( InputArray _src, OutputArray _dst, int method )
}
else
{
assert( n == 1 );
CV_Assert( n == 1 );
if( type == CV_32FC1 )
{
@ -1208,7 +1208,7 @@ bool solve( InputArray _src, InputArray _src2arg, OutputArray _dst, int method )
}
else
{
assert( src.rows == 1 );
CV_Assert( src.rows == 1 );
if( type == CV_32FC1 )
{

@ -169,7 +169,7 @@ GEMM_TransposeBlock( const uchar* src, size_t src_step,
}
break;
default:
assert(0);
CV_Assert(0);
return;
}
}
@ -2062,7 +2062,7 @@ MulTransposedR(const Mat& srcmat, const Mat& dstmat, const Mat& deltamat, double
if( delta && delta_cols < size.width )
{
assert( delta_cols == 1 );
CV_Assert( delta_cols == 1 );
buf_size *= 5;
}
buf.allocate(buf_size);

@ -638,7 +638,7 @@ void SparseMat::resizeHashTab(size_t newsize)
uchar* SparseMat::newNode(const int* idx, size_t hashval)
{
const int HASH_MAX_FILL_FACTOR=3;
assert(hdr);
CV_Assert(hdr);
size_t hsize = hdr->hashtab.size();
if( ++hdr->nodeCount > hsize*HASH_MAX_FILL_FACTOR )
{

@ -113,7 +113,7 @@ static void* openclamdblas_check_fn(int ID);
static void* openclamdblas_check_fn(int ID)
{
assert(ID >= 0 && ID < (int)(sizeof(openclamdblas_fn)/sizeof(openclamdblas_fn[0])));
CV_Assert(ID >= 0 && ID < (int)(sizeof(openclamdblas_fn)/sizeof(openclamdblas_fn[0])));
const struct DynamicFnEntry* e = openclamdblas_fn[ID];
void* func = CV_CL_GET_PROC_ADDRESS(e->fnName);
if (!func)

@ -113,7 +113,7 @@ static void* openclamdfft_check_fn(int ID);
static void* openclamdfft_check_fn(int ID)
{
assert(ID >= 0 && ID < (int)(sizeof(openclamdfft_fn)/sizeof(openclamdfft_fn[0])));
CV_Assert(ID >= 0 && ID < (int)(sizeof(openclamdfft_fn)/sizeof(openclamdfft_fn[0])));
const struct DynamicFnEntry* e = openclamdfft_fn[ID];
void* func = CV_CL_GET_PROC_ADDRESS(e->fnName);
if (!func)

@ -360,7 +360,7 @@ static void* opencl_gl_check_fn(int ID);
static void* opencl_gl_check_fn(int ID)
{
const struct DynamicFnEntry* e = NULL;
assert(ID >= 0 && ID < (int)(sizeof(opencl_gl_fn_list)/sizeof(opencl_gl_fn_list[0])));
CV_Assert(ID >= 0 && ID < (int)(sizeof(opencl_gl_fn_list)/sizeof(opencl_gl_fn_list[0])));
e = opencl_gl_fn_list[ID];
void* func = CV_CL_GET_PROC_ADDRESS(e->fnName);
if (!func)

@ -160,7 +160,7 @@ void icvFSCreateCollection( CvFileStorage* fs, int tag, CvFileNode* collection )
{
if( collection->tag != CV_NODE_NONE )
{
assert( fs->fmt == CV_STORAGE_FORMAT_XML );
CV_Assert( fs->fmt == CV_STORAGE_FORMAT_XML );
CV_PARSE_ERROR( "Sequence element should not have name (use <_></_>)" );
}
@ -551,7 +551,7 @@ int icvDecodeFormat( const char* dt, int* fmt_pairs, int max_len )
if( !dt || !len )
return 0;
assert( fmt_pairs != 0 && max_len > 0 );
CV_Assert( fmt_pairs != 0 && max_len > 0 );
fmt_pairs[0] = 0;
max_len *= 2;

@ -756,7 +756,7 @@ void icvJSONEndWriteStruct( CvFileStorage* fs )
cvSeqPop( fs->write_stack, &parent_flags );
fs->struct_indent -= 4;
fs->struct_flags = parent_flags & ~CV_NODE_EMPTY;
assert( fs->struct_indent >= 0 );
CV_Assert( fs->struct_indent >= 0 );
if ( CV_NODE_IS_COLLECTION(struct_flags) )
{

@ -34,7 +34,7 @@ static void icvWriteMat( CvFileStorage* fs, const char* name, const void* struct
cv::Size size;
int y;
assert( CV_IS_MAT_HDR_Z(mat) );
CV_Assert( CV_IS_MAT_HDR_Z(mat) );
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_MAT );
cvWriteInt( fs, "rows", mat->rows );
@ -121,7 +121,7 @@ static void icvWriteMatND( CvFileStorage* fs, const char* name, const void* stru
int dims, sizes[CV_MAX_DIM];
char dt[16];
assert( CV_IS_MATND_HDR(mat) );
CV_Assert( CV_IS_MATND_HDR(mat) );
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_MATND );
dims = cvGetDims( mat, sizes );
@ -237,7 +237,7 @@ static void icvWriteSparseMat( CvFileStorage* fs, const char* name, const void*
int *prev_idx = 0;
char dt[16];
assert( CV_IS_SPARSE_MAT(mat) );
CV_Assert( CV_IS_SPARSE_MAT(mat) );
memstorage = cvCreateMemStorage();
@ -273,7 +273,7 @@ static void icvWriteSparseMat( CvFileStorage* fs, const char* name, const void*
if( i > 0 )
{
for( ; idx[k] == prev_idx[k]; k++ )
assert( k < dims );
CV_Assert( k < dims );
if( k < dims - 1 )
fs->write_int( fs, 0, k - dims + 1 );
}
@ -383,7 +383,7 @@ static void icvWriteImage( CvFileStorage* fs, const char* name, const void* stru
cv::Size size;
int y, depth;
assert( CV_IS_IMAGE(image) );
CV_Assert( CV_IS_IMAGE(image) );
if( image->dataOrder == IPL_DATA_ORDER_PLANE )
CV_Error( CV_StsUnsupportedFormat,
@ -623,7 +623,7 @@ static void icvWriteSeq( CvFileStorage* fs, const char* name, const void* struct
char buf[128];
char dt_buf[128], *dt;
assert( CV_IS_SEQ( seq ));
CV_Assert( CV_IS_SEQ( seq ));
cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_SEQ );
if( level >= 0 )
@ -671,7 +671,7 @@ static void icvWriteSeqTree( CvFileStorage* fs, const char* name, const void* st
strcmp(recursive_value,"False") != 0 &&
strcmp(recursive_value,"FALSE") != 0;
assert( CV_IS_SEQ( seq ));
CV_Assert( CV_IS_SEQ( seq ));
if( !is_recursive )
{
@ -873,7 +873,7 @@ static void* icvReadSeqTree( CvFileStorage* fs, CvFileNode* node )
root = seq;
if( level > prev_level )
{
assert( level == prev_level + 1 );
CV_Assert( level == prev_level + 1 );
parent = prev_seq;
prev_seq = 0;
if( parent )
@ -933,7 +933,7 @@ static void icvWriteGraph( CvFileStorage* fs, const char* name, const void* stru
char edge_dt_buf[128], *edge_dt;
int write_buf_size;
assert( CV_IS_GRAPH(graph) );
CV_Assert( CV_IS_GRAPH(graph) );
vtx_count = cvGraphGetVtxCount( graph );
edge_count = cvGraphGetEdgeCount( graph );
flag_buf = (int*)cvAlloc( vtx_count*sizeof(flag_buf[0]));

@ -37,7 +37,7 @@ icvXMLSkipSpaces( CvFileStorage* fs, char* ptr, int mode )
if( c == '-' )
{
assert( ptr[1] == '-' && ptr[2] == '>' );
CV_Assert( ptr[1] == '-' && ptr[2] == '>' );
mode = 0;
ptr += 3;
}
@ -484,7 +484,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag,
else if( *ptr == '!' )
{
tag_type = CV_XML_DIRECTIVE_TAG;
assert( ptr[1] != '-' || ptr[2] != '-' );
CV_Assert( ptr[1] != '-' || ptr[2] != '-' );
ptr++;
}
else
@ -549,7 +549,7 @@ icvXMLParseTag( CvFileStorage* fs, char* ptr, CvStringHashNode** _tag,
}
ptr = icvXMLParseValue( fs, ptr, &stub, CV_NODE_STRING );
assert( stub.tag == CV_NODE_STRING );
CV_Assert( stub.tag == CV_NODE_STRING );
last->attr[count*2+1] = stub.data.str.ptr;
count++;
}

@ -797,7 +797,7 @@ void icvYMLEndWriteStruct( CvFileStorage* fs )
if( !CV_NODE_IS_FLOW(parent_flags) )
fs->struct_indent -= CV_YML_INDENT + CV_NODE_IS_FLOW(struct_flags);
assert( fs->struct_indent >= 0 );
CV_Assert( fs->struct_indent >= 0 );
fs->struct_flags = parent_flags;
}

@ -33,7 +33,7 @@ static void cvTsReleaseSimpleSeq( CvTsSimpleSeq** seq )
static schar* cvTsSimpleSeqElem( CvTsSimpleSeq* seq, int index )
{
assert( 0 <= index && index < seq->count );
CV_Assert( 0 <= index && index < seq->count );
return seq->array + index * seq->elem_size;
}
@ -50,7 +50,11 @@ static void cvTsSimpleSeqShiftAndCopy( CvTsSimpleSeq* seq, int from_idx, int to_
if( from_idx == to_idx )
return;
assert( (from_idx > to_idx && !elem) || (from_idx < to_idx && elem) );
if (elem)
CV_Assert(from_idx < to_idx);
else
CV_Assert(from_idx > to_idx);
if( from_idx < seq->count )
{
@ -128,7 +132,7 @@ static void cvTsReleaseSimpleSet( CvTsSimpleSet** set_header )
static schar* cvTsSimpleSetFind( CvTsSimpleSet* set_header, int index )
{
int idx = index * set_header->elem_size;
assert( 0 <= index && index < set_header->max_count );
CV_Assert( 0 <= index && index < set_header->max_count );
return set_header->array[idx] ? set_header->array + idx + 1 : 0;
}
@ -136,11 +140,11 @@ static schar* cvTsSimpleSetFind( CvTsSimpleSet* set_header, int index )
static int cvTsSimpleSetAdd( CvTsSimpleSet* set_header, void* elem )
{
int idx, idx2;
assert( set_header->free_count > 0 );
CV_Assert( set_header->free_count > 0 );
idx = set_header->free_stack[--set_header->free_count];
idx2 = idx * set_header->elem_size;
assert( set_header->array[idx2] == 0 );
CV_Assert( set_header->array[idx2] == 0 );
set_header->array[idx2] = 1;
if( set_header->elem_size > 1 )
memcpy( set_header->array + idx2 + 1, elem, set_header->elem_size - 1 );
@ -152,9 +156,9 @@ static int cvTsSimpleSetAdd( CvTsSimpleSet* set_header, void* elem )
static void cvTsSimpleSetRemove( CvTsSimpleSet* set_header, int index )
{
assert( set_header->free_count < set_header->max_count &&
0 <= index && index < set_header->max_count );
assert( set_header->array[index * set_header->elem_size] == 1 );
CV_Assert( set_header->free_count < set_header->max_count &&
0 <= index && index < set_header->max_count );
CV_Assert( set_header->array[index * set_header->elem_size] == 1 );
set_header->free_stack[set_header->free_count++] = index;
set_header->array[index * set_header->elem_size] = 0;
@ -187,7 +191,7 @@ static CvTsSimpleGraph* cvTsCreateSimpleGraph( int max_vtx_count, int vtx_size,
{
CvTsSimpleGraph* graph;
assert( max_vtx_count > 1 && vtx_size >= 0 && edge_size >= 0 );
CV_Assert( max_vtx_count > 1 && vtx_size >= 0 && edge_size >= 0 );
graph = (CvTsSimpleGraph*)cvAlloc( sizeof(*graph) +
max_vtx_count * max_vtx_count * (edge_size + 1));
graph->vtx = cvTsCreateSimpleSet( max_vtx_count, vtx_size );
@ -235,13 +239,13 @@ static void cvTsSimpleGraphAddEdge( CvTsSimpleGraph* graph, int idx1, int idx2,
{
int i, t, n = graph->oriented ? 1 : 2;
assert( cvTsSimpleSetFind( graph->vtx, idx1 ) &&
cvTsSimpleSetFind( graph->vtx, idx2 ));
CV_Assert( cvTsSimpleSetFind( graph->vtx, idx1 ) &&
cvTsSimpleSetFind( graph->vtx, idx2 ));
for( i = 0; i < n; i++ )
{
int ofs = (idx1*graph->vtx->max_count + idx2)*graph->edge_size;
assert( graph->matrix[ofs] == 0 );
CV_Assert( graph->matrix[ofs] == 0 );
graph->matrix[ofs] = 1;
if( graph->edge_size > 1 )
memcpy( graph->matrix + ofs + 1, edge, graph->edge_size - 1 );
@ -255,13 +259,13 @@ static void cvTsSimpleGraphRemoveEdge( CvTsSimpleGraph* graph, int idx1, int id
{
int i, t, n = graph->oriented ? 1 : 2;
assert( cvTsSimpleSetFind( graph->vtx, idx1 ) &&
CV_Assert( cvTsSimpleSetFind( graph->vtx, idx1 ) &&
cvTsSimpleSetFind( graph->vtx, idx2 ));
for( i = 0; i < n; i++ )
{
int ofs = (idx1*graph->vtx->max_count + idx2)*graph->edge_size;
assert( graph->matrix[ofs] == 1 );
CV_Assert( graph->matrix[ofs] == 1 );
graph->matrix[ofs] = 0;
CV_SWAP( idx1, idx2, t );
}
@ -291,7 +295,7 @@ static int cvTsSimpleGraphVertexDegree( CvTsSimpleGraph* graph, int index )
int i, count = 0;
int edge_size = graph->edge_size;
int max_vtx_count = graph->vtx->max_count;
assert( cvTsSimpleGraphFindVertex( graph, index ) != 0 );
CV_Assert( cvTsSimpleGraphFindVertex( graph, index ) != 0 );
for( i = 0; i < max_vtx_count; i++ )
{
@ -301,7 +305,7 @@ static int cvTsSimpleGraphVertexDegree( CvTsSimpleGraph* graph, int index )
if( !graph->oriented )
{
assert( count % 2 == 0 );
CV_Assert( count % 2 == 0 );
count /= 2;
}
return count;
@ -609,7 +613,7 @@ int Core_SeqBaseTest::test_get_seq_elem( int _struct_idx, int iters )
CvTsSimpleSeq* sseq = (CvTsSimpleSeq*)simple_struct[_struct_idx];
struct_idx = _struct_idx;
assert( seq->total == sseq->count );
CV_Assert( seq->total == sseq->count );
if( sseq->count == 0 )
return 0;
@ -656,7 +660,7 @@ int Core_SeqBaseTest::test_get_seq_reading( int _struct_idx, int iters )
vector<schar> _elem(sseq->elem_size);
schar* elem = &_elem[0];
assert( total == sseq->count );
CV_Assert( total == sseq->count );
this->struct_idx = _struct_idx;
int pos = cvtest::randInt(rng) % 2;
@ -964,7 +968,7 @@ int Core_SeqBaseTest::test_seq_ops( int iters )
"The sequence doesn't become empty after clear" );
break;
default:
assert(0);
CV_Assert(0);
return -1;
}
@ -1903,7 +1907,7 @@ int Core_GraphScanTest::create_random_graph( int _struct_idx )
for( i = 0; i < vtx_count; i++ )
cvGraphAddVtx( graph );
assert( graph->active_count == vtx_count );
CV_Assert( graph->active_count == vtx_count );
for( i = 0; i < edge_count; i++ )
{
@ -1914,7 +1918,7 @@ int Core_GraphScanTest::create_random_graph( int _struct_idx )
cvGraphAddEdge( graph, j, k );
}
assert( graph->active_count == vtx_count && graph->edges->active_count <= edge_count );
CV_Assert( graph->active_count == vtx_count && graph->edges->active_count <= edge_count );
return 0;
}

@ -204,7 +204,7 @@ static void DCT_1D( const Mat& _src, Mat& _dst, int flags, const Mat& _wave=Mat(
}
}
else
assert(0);
CV_Assert(0);
}

@ -28,7 +28,7 @@ protected:
template<class Type>
void testReduce( const Mat& src, Mat& sum, Mat& avg, Mat& max, Mat& min, int dim )
{
assert( src.channels() == 1 );
CV_Assert( src.channels() == 1 );
if( dim == 0 ) // row
{
sum.create( 1, src.cols, CV_64FC1 );
@ -138,7 +138,7 @@ int Core_ReduceTest::checkOp( const Mat& src, int dstType, int opType, const Mat
eps = 0.6;
}
assert( opRes.type() == CV_64FC1 );
CV_Assert( opRes.type() == CV_64FC1 );
Mat _dst, dst, diff;
cv::reduce( src, _dst, dim, opType, dstType );
_dst.convertTo( dst, CV_64FC1 );
@ -192,7 +192,7 @@ int Core_ReduceTest::checkCase( int srcType, int dstType, int dim, Size sz )
else if( srcType == CV_64FC1 )
testReduce<double>( src, sum, avg, max, min, dim );
else
assert( 0 );
CV_Assert( 0 );
// 1. sum
tempCode = checkOp( src, dstType, CV_REDUCE_SUM, sum, dim );

@ -1039,7 +1039,7 @@ static void cvTsPerspectiveTransform( const CvArr* _src, CvArr* _dst, const CvMa
}
else
{
assert( mat_depth == CV_64F );
CV_Assert( mat_depth == CV_64F );
for( i = 0; i < transmat->rows; i++ )
for( j = 0; j < cols; j++ )
mat[i*cols + j] = ((double*)(transmat->data.ptr + transmat->step*i))[j];
@ -1065,7 +1065,7 @@ static void cvTsPerspectiveTransform( const CvArr* _src, CvArr* _dst, const CvMa
buf[j] = ((double*)src)[j];
break;
default:
assert(0);
CV_Assert(0);
}
switch( cn )
@ -1095,7 +1095,7 @@ static void cvTsPerspectiveTransform( const CvArr* _src, CvArr* _dst, const CvMa
}
break;
default:
assert(0);
CV_Assert(0);
}
switch( depth )
@ -1109,7 +1109,7 @@ static void cvTsPerspectiveTransform( const CvArr* _src, CvArr* _dst, const CvMa
((double*)dst)[j] = buf[j];
break;
default:
assert(0);
CV_Assert(0);
}
}
}
@ -1458,8 +1458,8 @@ static double cvTsLU( CvMat* a, CvMat* b=NULL, CvMat* x=NULL, int* rank=0 )
double *a0 = a->data.db, *b0 = b ? b->data.db : 0;
double *x0 = x ? x->data.db : 0;
double t, det = 1.;
assert( CV_MAT_TYPE(a->type) == CV_64FC1 &&
(!b || CV_ARE_TYPES_EQ(a,b)) && (!x || CV_ARE_TYPES_EQ(a,x)));
CV_Assert( CV_MAT_TYPE(a->type) == CV_64FC1 &&
(!b || CV_ARE_TYPES_EQ(a,b)) && (!x || CV_ARE_TYPES_EQ(a,x)));
for( i = 0; i < Nm; i++ )
{
@ -1514,7 +1514,7 @@ static double cvTsLU( CvMat* a, CvMat* b=NULL, CvMat* x=NULL, int* rank=0 )
if( x )
{
assert( b );
CV_Assert( b );
for( i = N-1; i >= 0; i-- )
{

@ -48,7 +48,6 @@
#include <vector>
#include <fstream>
#include <sys/stat.h>
#include <assert.h>
#include "../include/common.hpp"
#include "../include/ocl4dnn.hpp"
#include "opencl_kernels_dnn.hpp"

@ -159,7 +159,7 @@ protected:
void emptyDataTest()
{
assert( dextractor );
CV_Assert( dextractor );
// One image.
Mat image;
@ -205,7 +205,7 @@ protected:
void regressionTest()
{
assert( dextractor );
CV_Assert( dextractor );
// Read the test image.
string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME;

@ -154,7 +154,7 @@ void CV_FeatureDetectorTest::compareKeypointSets( const vector<KeyPoint>& validK
}
}
assert( minDist >= 0 );
CV_Assert( minDist >= 0 );
if( !isSimilarKeypoints( validKeypoints[v], calcKeypoints[nearestIdx] ) )
badPointCount++;
}
@ -171,7 +171,7 @@ void CV_FeatureDetectorTest::compareKeypointSets( const vector<KeyPoint>& validK
void CV_FeatureDetectorTest::regressionTest()
{
assert( !fdetector.empty() );
CV_Assert( !fdetector.empty() );
string imgFilename = string(ts->get_data_path()) + FEATURES2D_DIR + "/" + IMAGE_FILENAME;
string resFilename = string(ts->get_data_path()) + DETECTOR_DIR + "/" + string(name) + ".xml.gz";

@ -312,7 +312,7 @@ void CV_FlannSavedIndexTest::createModel(const cv::Mat &data)
case 1: createIndex( data, KDTreeIndexParams() ); break;
//case 2: createIndex( data, CompositeIndexParams() ); break; // nothing to save for linear search
//case 2: createIndex( data, AutotunedIndexParams() ); break; // possible linear index !
default: assert(0);
default: CV_Assert(0);
}
string filename = tempfile();
index->save( filename );

@ -106,8 +106,8 @@ public:
fprintf(stderr, "I can only search one feature at a time for range search\n");
return -1;
}
assert(query.cols == veclen());
assert(indices.cols == dists.cols);
CV_Assert(query.cols == veclen());
CV_Assert(indices.cols == dists.cols);
int n = 0;
int* indices_ptr = NULL;

@ -58,7 +58,6 @@
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <assert.h>
#if defined _WIN32 || defined WINCE
#include <windows.h>

@ -119,7 +119,7 @@ static CvWindow* hg_windows = 0;
if( !(exp) ) \
{ \
printf("Assertion: %s %s: %d\n", #exp, __FILE__, __LINE__);\
assert(exp); \
CV_Assert(exp); \
}
static int wasInitialized = 0;

@ -356,7 +356,7 @@ static void cvImageWidget_set_size(GtkWidget * widget, int max_width, int max_he
}
assert( image_widget->scaled_image );
CV_Assert( image_widget->scaled_image );
}
static void

@ -60,7 +60,6 @@ using namespace cv;
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#ifdef HAVE_OPENGL
#include <memory>
@ -105,7 +104,7 @@ static const char* trackbar_text =
static void FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin )
{
assert( bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));
CV_Assert( bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));
BITMAPINFOHEADER* bmih = &(bmi->bmiHeader);
@ -1107,7 +1106,7 @@ static RECT icvCalcWindowRect( CvWindow* window )
{
RECT crect = { 0 }, trect = { 0 }, rect = { 0 };
assert(window);
CV_Assert(window);
GetClientRect(window->frame, &crect);
if (window->toolbar.toolbar)
@ -1157,7 +1156,7 @@ static bool icvGetBitmapData( CvWindow* window, SIZE* size, int* channels, void*
static void icvUpdateWindowPos( CvWindow* window )
{
RECT rect = { 0 };
assert(window);
CV_Assert(window);
if( (window->flags & CV_WINDOW_AUTOSIZE) && window->image )
{

@ -30,7 +30,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <opencv2\highgui.hpp>
#include <opencv2\highgui\highgui_winrt.hpp>
#include "window_winrt_bridge.hpp"

@ -129,7 +129,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size,
len = i;
current = temp.next;
assert( current );
CV_Assert( current );
/* Pass 1.
Determines support region for all the remained points */
@ -148,7 +148,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size,
int dx, dy;
Cv32suf d;
assert( k <= len );
CV_Assert( k <= len );
/* calc indices */
i1 = i - k;
@ -205,7 +205,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size,
((double)dx2 * dx2 + (double)dy2 * dy2) ));
sk.f = (float) (temp_num + 1.1);
assert( 0 <= sk.f && sk.f <= 2.2 );
CV_Assert( 0 <= sk.f && sk.f <= 2.2 );
if( j < k && sk.i <= s )
break;
@ -258,7 +258,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size,
/* Pass 3.
Removes non-dominant points with 1-length support region */
current = temp.next;
assert( current );
CV_Assert( current );
prev_current = &temp;
do
@ -293,7 +293,7 @@ CvSeq* icvApproximateChainTC89( CvChain* chain, int header_size,
/* Pass 4.
Cleans remained couples of points */
assert( temp.next );
CV_Assert( temp.next );
if( array[0].s != 0 && array[len - 1].s != 0 ) /* specific case */
{
@ -362,7 +362,7 @@ copy_vect:
// gather points
current = temp.next;
assert( current );
CV_Assert( current );
do
{
@ -439,7 +439,7 @@ cvApproxChains( CvSeq* src_seq,
if( src_seq->v_next && len >= minimal_perimeter )
{
assert( prev_contour != 0 );
CV_Assert( prev_contour != 0 );
parent = prev_contour;
prev_contour = 0;
src_seq = src_seq->v_next;
@ -590,7 +590,7 @@ approxPolyDP_( const Point_<T>* src_contour, int count0, Point_<T>* dst_contour,
dx = end_pt.x - start_pt.x;
dy = end_pt.y - start_pt.y;
assert( dx != 0 || dy != 0 );
CV_Assert( dx != 0 || dy != 0 );
while( pos != slice.end )
{
@ -815,7 +815,7 @@ cvApproxPoly( const void* array, int header_size,
CV_Error( CV_StsBadArg, "Invalid approximation method" );
}
assert( contour );
CV_Assert( contour );
if( header_size >= (int)sizeof(CvContour))
cvBoundingRect( contour, 1 );
@ -836,7 +836,7 @@ cvApproxPoly( const void* array, int header_size,
if( src_seq->v_next )
{
assert( prev_contour != 0 );
CV_Assert( prev_contour != 0 );
parent = prev_contour;
prev_contour = 0;
src_seq = src_seq->v_next;

@ -205,7 +205,7 @@ public:
}
else
{
assert( cn == 3 );
CV_Assert( cn == 3 );
AutoBuffer<float> buf(alignSize(size.width, CV_SIMD_WIDTH)*3 + size.width + CV_SIMD_WIDTH - 1);
memset(buf.data(), 0, buf.size() * sizeof(float));
float *sum_b = alignPtr(buf.data(), CV_SIMD_WIDTH);

@ -97,7 +97,7 @@ cvReadChainPoint( CvChainPtReader * reader )
reader->ptr = ptr;
reader->code = (schar)code;
assert( (code & ~7) == 0 );
CV_Assert( (code & ~7) == 0 );
reader->pt.x = pt.x + icvCodeDeltas[code].x;
reader->pt.y = pt.y + icvCodeDeltas[code].y;
}
@ -1187,7 +1187,7 @@ cvFindNextContour( CvContourScanner scanner )
}
/* hole flag of the parent must differ from the flag of the contour */
assert( par_info->is_hole != is_hole );
CV_Assert( par_info->is_hole != is_hole );
if( par_info->contour == 0 ) /* removed contour */
goto resume_scan;
}

@ -716,7 +716,7 @@ CV_IMPL CvSeq* cvConvexityDefects( const CvArr* array,
dx0 = (double)hull_next->x - (double)hull_cur->x;
dy0 = (double)hull_next->y - (double)hull_cur->y;
assert( dx0 != 0 || dy0 != 0 );
CV_Assert( dx0 != 0 || dy0 != 0 );
scale = 1./std::sqrt(dx0*dx0 + dy0*dy0);
defect.start = hull_cur;

@ -138,7 +138,7 @@ bool clipLine( Size2l img_size, Point2l& pt1, Point2l& pt2 )
}
}
assert( (c1 & c2) != 0 || (x1 | y1 | x2 | y2) >= 0 );
CV_Assert( (c1 & c2) != 0 || (x1 | y1 | x2 | y2) >= 0 );
}
return (c1 | c2) == 0;
@ -222,7 +222,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
if( connectivity == 8 )
{
assert( dx >= 0 && dy >= 0 );
CV_Assert( dx >= 0 && dy >= 0 );
err = dx - (dy + dy);
plusDelta = dx + dx;
@ -233,7 +233,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
}
else /* connectivity == 4 */
{
assert( dx >= 0 && dy >= 0 );
CV_Assert( dx >= 0 && dy >= 0 );
err = 0;
plusDelta = (dx + dx) + (dy + dy);
@ -1102,7 +1102,7 @@ FillConvexPoly( Mat& img, const Point2l* v, int npts, const void* color, int lin
p0.x <<= XY_SHIFT - shift;
p0.y <<= XY_SHIFT - shift;
assert( 0 <= shift && shift <= XY_SHIFT );
CV_Assert( 0 <= shift && shift <= XY_SHIFT );
xmin = xmax = v[0].x;
ymin = ymax = v[0].y;
@ -1322,7 +1322,7 @@ FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
for( i = 0; i < total; i++ )
{
PolyEdge& e1 = edges[i];
assert( e1.y0 < e1.y1 );
CV_Assert( e1.y0 < e1.y1 );
// Determine x-coordinate of the end of the edge.
// (This is not necessary x-coordinate of any vertex in the array.)
int64 x1 = e1.x + (e1.y1 - e1.y0) * e1.dx;
@ -2596,7 +2596,7 @@ cvDrawContours( void* _img, CvSeq* contour,
char code;
CV_READ_SEQ_ELEM( code, reader );
assert( (code & ~7) == 0 );
CV_Assert( (code & ~7) == 0 );
if( code != prev_code )
{

@ -336,7 +336,7 @@ static int icvInitEMD( const float* signature1, int size1,
char *buffer, *buffer_end;
memset( state, 0, sizeof( *state ));
assert( cost_step % sizeof(float) == 0 );
CV_Assert( cost_step % sizeof(float) == 0 );
cost_step /= sizeof(float);
/* calculate buffer size */
@ -510,7 +510,7 @@ static int icvInitEMD( const float* signature1, int size1,
}
else
{
assert( cost );
CV_Assert( cost );
val = cost[cost_step*ci + cj];
}
state->cost[i][j] = val;
@ -552,7 +552,7 @@ static int icvInitEMD( const float* signature1, int size1,
buffer += dsize;
}
assert( buffer <= buffer_end );
CV_Assert( buffer <= buffer_end );
icvRussel( state );

@ -340,8 +340,8 @@ HoughLinesSDiv( InputArray image, OutputArray lines, int type,
rv = r0 * std::cos( phi );
i = (int)rv * tn;
i += cvFloor( phi1 );
assert( i >= 0 );
assert( i < rn * tn );
CV_Assert( i >= 0 );
CV_Assert( i < rn * tn );
caccum[i] = (uchar) (caccum[i] + ((i ^ iprev) != 0));
iprev = i;
if( cmax < caccum[i] )
@ -405,8 +405,8 @@ HoughLinesSDiv( InputArray image, OutputArray lines, int type,
i = CV_IMAX( i, -1 );
i = CV_IMIN( i, sfn );
mcaccum[i]++;
assert( i >= -1 );
assert( i <= sfn );
CV_Assert( i >= -1 );
CV_Assert( i <= sfn );
}
}

@ -463,7 +463,7 @@ medianBlur_8u_Om( const Mat& _src, Mat& _dst, int m )
}
else
{
assert( cn == 4 );
CV_Assert( cn == 4 );
for( k = 0; k < m*4; k += 4 )
{
UPDATE_ACC01( src_top[k], 0, -- );

@ -52,7 +52,7 @@ static void completeMomentState( Moments* moments )
double cx = 0, cy = 0;
double mu20, mu11, mu02;
double inv_m00 = 0.0;
assert( moments != 0 );
CV_Assert( moments != 0 );
if( fabs(moments->m00) > DBL_EPSILON )
{

@ -54,7 +54,6 @@
#include "hal_replacement.hpp"
#include <math.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

@ -3191,7 +3191,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
if( sx1 - fsx1 > 1e-3 )
{
assert( k < ssize*2 );
CV_Assert( k < ssize*2 );
tab[k].di = dx * cn;
tab[k].si = (sx1 - 1) * cn;
tab[k++].alpha = (float)((sx1 - fsx1) / cellWidth);
@ -3199,7 +3199,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
for(int sx = sx1; sx < sx2; sx++ )
{
assert( k < ssize*2 );
CV_Assert( k < ssize*2 );
tab[k].di = dx * cn;
tab[k].si = sx * cn;
tab[k++].alpha = float(1.0 / cellWidth);
@ -3207,7 +3207,7 @@ static int computeResizeAreaTab( int ssize, int dsize, int cn, double scale, Dec
if( fsx2 - sx2 > 1e-3 )
{
assert( k < ssize*2 );
CV_Assert( k < ssize*2 );
tab[k].di = dx * cn;
tab[k].si = sx2 * cn;
tab[k++].alpha = (float)(std::min(std::min(fsx2 - sx2, 1.), cellWidth) / cellWidth);
@ -3899,7 +3899,7 @@ void resize(int src_type,
{
if( k == 0 || ytab[k].di != ytab[k-1].di )
{
assert( ytab[k].di == dy );
CV_Assert( ytab[k].di == dy );
tabofs[dy++] = k;
}
}

@ -74,7 +74,7 @@ adjustRect( const uchar* src, size_t src_step, int pix_size,
src += rect.width*pix_size;
rect.width = 0;
}
assert( rect.width <= win_size.width );
CV_Assert( rect.width <= win_size.width );
}
if( ip.y >= 0 )

@ -155,7 +155,7 @@ void cv::watershed( InputArray _src, InputOutputArray _markers )
dr = std::abs((ptr1)[2] - (ptr2)[2]);\
diff = ws_max(db,dg); \
diff = ws_max(diff,dr); \
assert( 0 <= diff && diff <= 255 ); \
CV_Assert( 0 <= diff && diff <= 255 ); \
}
CV_Assert( src.type() == CV_8UC3 && dst.type() == CV_32SC1 );
@ -215,7 +215,7 @@ void cv::watershed( InputArray _src, InputOutputArray _markers )
}
// Add to according queue
assert( 0 <= idx && idx <= 255 );
CV_Assert( 0 <= idx && idx <= 255 );
ws_push( idx, i*mstep + j, i*istep + j*3 );
m[0] = IN_QUEUE;
}
@ -286,7 +286,7 @@ void cv::watershed( InputArray _src, InputOutputArray _markers )
}
// Set label to current pixel in marker image
assert( lab != 0 );
CV_Assert( lab != 0 );
m[0] = lab;
if( lab == WSHED )

@ -436,7 +436,7 @@ int Subdiv2D::insert(Point2f pt)
else
CV_Error_(CV_StsError, ("Subdiv2D::locate returned invalid location = %d", location) );
assert( curr_edge != 0 );
CV_Assert( curr_edge != 0 );
validGeometry = false;
curr_point = newPoint(pt, false);

@ -182,7 +182,7 @@ int CV_ApproxPolyTest::check_slice( CvPoint StartPt, CvPoint EndPt,
////////////////////////////////
if( SrcReader == NULL )
{
assert( false );
CV_Assert( false );
return 0;
}
@ -237,7 +237,7 @@ int CV_ApproxPolyTest::check( CvSeq* SrcSeq, CvSeq* DstSeq, float Eps )
int Count;
int i,j;
assert( SrcSeq && DstSeq );
CV_Assert( SrcSeq && DstSeq );
////////// init ////////////////////
Count = SrcSeq->total;

@ -203,7 +203,7 @@ namespace opencv_test { namespace {
}
else
{
assert( cn == 3 );
CV_Assert( cn == 3 );
for( j = 0; j < size.width*3; j += 3 )
{
float sum_b = 0, sum_g = 0, sum_r = 0, wsum = 0;

@ -249,7 +249,7 @@ test_Canny( const Mat& src, Mat& dst,
}
else
{
assert( fabs(tg) > tan_3pi_8 );
CV_Assert( fabs(tg) > tan_3pi_8 );
x1 = x2 = x; y1 = y + 1; y2 = y - 1;
}

@ -217,7 +217,7 @@ void CV_ColorCvtBaseTest::convert_forward( const Mat& src, Mat& dst )
float* dst_buf = &_dst_buf[0];
int i, j;
assert( (cn == 3 || cn == 4) && (dst_cn == 3 || dst_cn == 1) );
CV_Assert( (cn == 3 || cn == 4) && (dst_cn == 3 || dst_cn == 1) );
for( i = 0; i < src.rows; i++ )
{
@ -281,7 +281,7 @@ void CV_ColorCvtBaseTest::convert_forward( const Mat& src, Mat& dst )
}
break;
default:
assert(0);
CV_Assert(0);
}
}
}
@ -312,7 +312,7 @@ void CV_ColorCvtBaseTest::convert_backward( const Mat& src, const Mat& dst, Mat&
float* dst_buf = &_dst_buf[0];
int i, j;
assert( cn == 3 || cn == 4 );
CV_Assert( cn == 3 || cn == 4 );
for( i = 0; i < src.rows; i++ )
{
@ -385,7 +385,7 @@ void CV_ColorCvtBaseTest::convert_backward( const Mat& src, const Mat& dst, Mat&
}
break;
default:
assert(0);
CV_Assert(0);
}
}
}
@ -1571,7 +1571,7 @@ void CV_ColorRGBTest::convert_forward( const Mat& src, Mat& dst )
}
break;
default:
assert(0);
CV_Assert(0);
}
}
}
@ -1677,7 +1677,7 @@ void CV_ColorRGBTest::convert_backward( const Mat& /*src*/, const Mat& src, Mat&
}
break;
default:
assert(0);
CV_Assert(0);
}
}
}

@ -208,7 +208,7 @@ cvTsMarkContours( IplImage* img, int val )
int i, j;
int step = img->widthStep;
assert( img->depth == IPL_DEPTH_8U && img->nChannels == 1 && (val&1) != 0);
CV_Assert( img->depth == IPL_DEPTH_8U && img->nChannels == 1 && (val&1) != 0);
for( i = 1; i < img->height - 1; i++ )
for( j = 1; j < img->width - 1; j++ )

@ -301,7 +301,7 @@ void CV_BaseShapeDescrTest::generate_point_set( void* pointsSet )
else
{
CvMat* ptm = (CvMat*)pointsSet;
assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
CV_Assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
total = ptm->rows + ptm->cols - 1;
point_type = CV_MAT_TYPE(ptm->type);
data = ptm->data.ptr;
@ -310,7 +310,7 @@ void CV_BaseShapeDescrTest::generate_point_set( void* pointsSet )
n = CV_MAT_CN(point_type);
point_type = CV_MAT_DEPTH(point_type);
assert( (point_type == CV_32S || point_type == CV_32F) && n <= 4 );
CV_Assert( (point_type == CV_32S || point_type == CV_32F) && n <= 4 );
for( i = 0; i < total; i++ )
{
@ -1335,7 +1335,7 @@ void CV_FitEllipseTest::generate_point_set( void* pointsSet )
else
{
CvMat* ptm = (CvMat*)pointsSet;
assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
CV_Assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
total = ptm->rows + ptm->cols - 1;
point_type = CV_MAT_TYPE(ptm->type);
data = ptm->data.ptr;
@ -1621,7 +1621,7 @@ void CV_FitLineTest::generate_point_set( void* pointsSet )
else
{
CvMat* ptm = (CvMat*)pointsSet;
assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
CV_Assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
total = ptm->rows + ptm->cols - 1;
point_type = CV_MAT_DEPTH(CV_MAT_TYPE(ptm->type));
data = ptm->data.ptr;
@ -1788,13 +1788,13 @@ cvTsGenerateTousledBlob( CvPoint2D32f center, CvSize2D32f axes,
else
{
CvMat* ptm = (CvMat*)points;
assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
CV_Assert( CV_IS_MAT(ptm) && CV_IS_MAT_CONT(ptm->type) );
total = ptm->rows + ptm->cols - 1;
point_type = CV_MAT_TYPE(ptm->type);
data = ptm->data.ptr;
}
assert( point_type == CV_32SC2 || point_type == CV_32FC2 );
CV_Assert( point_type == CV_32SC2 || point_type == CV_32FC2 );
for( i = 0; i < total; i++ )
{
@ -1874,8 +1874,8 @@ void CV_ContourMomentsTest::generate_point_set( void* pointsSet )
center.x = (float)(img_size.width*0.5 + (cvtest::randReal(rng)-0.5)*(img_size.width - max_sz*2)*0.8);
center.y = (float)(img_size.height*0.5 + (cvtest::randReal(rng)-0.5)*(img_size.height - max_sz*2)*0.8);
assert( 0 < center.x - max_sz && center.x + max_sz < img_size.width &&
0 < center.y - max_sz && center.y + max_sz < img_size.height );
CV_Assert( 0 < center.x - max_sz && center.x + max_sz < img_size.width &&
0 < center.y - max_sz && center.y + max_sz < img_size.height );
max_r_scale = cvtest::randReal(rng)*max_max_r_scale*0.01;
angle = cvtest::randReal(rng)*360;

@ -161,7 +161,7 @@ cvTsDistTransform( const CvMat* _src, CvMat* _dst, int dist_type,
float delta[16];
int tstep, count;
assert( mask_size == 3 || mask_size == 5 );
CV_Assert( mask_size == 3 || mask_size == 5 );
if( dist_type == CV_DIST_USER )
memcpy( mask, _mask, sizeof(mask) );

@ -992,8 +992,8 @@ static void test_medianFilter( const Mat& src, Mat& dst, int m )
median_pair *buf0 = &_buf0[0], *buf1 = &_buf1[0];
int step = (int)(src.step/src.elemSize());
assert( src.rows == dst.rows + m - 1 && src.cols == dst.cols + m - 1 &&
src.type() == dst.type() && src.type() == CV_8UC1 );
CV_Assert( src.rows == dst.rows + m - 1 && src.cols == dst.cols + m - 1 &&
src.type() == dst.type() && src.type() == CV_8UC1 );
for( i = 0; i < dst.rows; i++ )
{
@ -1050,7 +1050,7 @@ static void test_medianFilter( const Mat& src, Mat& dst, int m )
*buf1++ = buf0[k++];
else
{
assert( col_buf[l] < INT_MAX );
CV_Assert( col_buf[l] < INT_MAX );
*buf1++ = median_pair(ins_col,col_buf[l++]);
}
}
@ -1061,7 +1061,7 @@ static void test_medianFilter( const Mat& src, Mat& dst, int m )
if( del_col < 0 )
n += m;
buf1 -= n;
assert( n == m2 );
CV_Assert( n == m2 );
dst1[j] = (uchar)buf1[n/2].val;
median_pair* tbuf;
CV_SWAP( buf0, buf1, tbuf );

@ -169,7 +169,7 @@ int CV_ImgWarpBaseTest::prepare_test_case( int test_case_idx )
}
break;
default:
assert(0);
CV_Assert(0);
}
/*switch( depth )
@ -482,7 +482,7 @@ static void test_remap( const Mat& src, Mat& dst, const Mat& mapx, const Mat& ma
}
break;
default:
assert(0);
CV_Assert(0);
}
}
}

@ -935,7 +935,7 @@ void CV_Remap_Test::remap_generic(const Mat& _src, Mat& _dst)
else if (interpolation == INTER_LANCZOS4)
ksize = 8;
else if (interpolation != INTER_LINEAR)
assert(0);
CV_Assert(0);
int ofs = (ksize / 2) - 1;
CV_Assert(_src.depth() == CV_32F && _dst.type() == _src.type());

@ -185,7 +185,7 @@ static void cvTsMatchTemplate( const CvMat* img, const CvMat* templ, CvMat* resu
b_denom = 1.;
}
assert( CV_TM_SQDIFF <= method && method <= CV_TM_CCOEFF_NORMED );
CV_Assert( CV_TM_SQDIFF <= method && method <= CV_TM_CCOEFF_NORMED );
for( i = 0; i < result->rows; i++ )
{

@ -157,7 +157,7 @@ static void test_threshold( const Mat& _src, Mat& _dst,
imaxval = cvRound(maxval);
}
assert( depth == CV_8U || depth == CV_16S || depth == CV_16U || depth == CV_32F || depth == CV_64F );
CV_Assert( depth == CV_8U || depth == CV_16S || depth == CV_16U || depth == CV_32F || depth == CV_64F );
switch( thresh_type )
{
@ -407,7 +407,7 @@ static void test_threshold( const Mat& _src, Mat& _dst,
}
break;
default:
assert(0);
CV_Assert(0);
}
}

@ -48,7 +48,6 @@
#include "opencv2/core/private.hpp"
#include <assert.h>
#include <float.h>
#include <limits.h>
#include <math.h>

@ -869,7 +869,7 @@ DTreesImpl::WSplit DTreesImpl::findSplitCatClass( int vi, const vector<int>& _si
}
else
{
assert( m == 2 );
CV_Assert( m == 2 );
dbl_ptr = (double**)(c_weights + _mi);
for( j = 0; j < mi; j++ )
dbl_ptr[j] = cjk + j*2 + 1;

@ -960,10 +960,10 @@ int CascadeClassifierImpl::runAt( Ptr<FeatureEvaluator>& evaluator, Point pt, in
{
CV_INSTRUMENT_REGION();
assert( !oldCascade &&
(data.featureType == FeatureEvaluator::HAAR ||
data.featureType == FeatureEvaluator::LBP ||
data.featureType == FeatureEvaluator::HOG) );
CV_Assert( !oldCascade &&
(data.featureType == FeatureEvaluator::HAAR ||
data.featureType == FeatureEvaluator::LBP ||
data.featureType == FeatureEvaluator::HOG) );
if( !evaluator->setWindow(pt, scaleIdx) )
return -1;

@ -42,7 +42,6 @@
//M*/
#include "precomp.hpp"
#include <cassert>
#ifdef CV_CXX11
#define USE_STD_THREADS

@ -291,7 +291,7 @@ icvCreateHidHaarClassifierCascade( CvHaarClassifierCascade* cascade )
}
cascade->hid_cascade = out;
assert( (char*)haar_node_ptr - (char*)out <= datasize );
CV_Assert( (char*)haar_node_ptr - (char*)out <= datasize );
return out;
}
@ -622,7 +622,7 @@ cvRunHaarClassifierCascadeSum( const CvHaarClassifierCascade* _cascade,
if( cascade->is_tree )
{
CvHidHaarStageClassifier* ptr = cascade->stage_classifier;
assert( start_stage == 0 );
CV_Assert( start_stage == 0 );
while( ptr )
{

@ -852,7 +852,7 @@ void HOGCache::init(const HOGDescriptor* _descriptor,
data->gradWeight = weights(i,j);
}
assert( count1 + count2 + count4 == rawBlockSize );
CV_Assert( count1 + count2 + count4 == rawBlockSize );
// defragment pixData
for( j = 0; j < count2; j++ )
pixData[j + count1] = pixData[j + rawBlockSize];
@ -874,7 +874,7 @@ void HOGCache::init(const HOGDescriptor* _descriptor,
const float* HOGCache::getBlock(Point pt, float* buf)
{
float* blockHist = buf;
assert(descriptor != 0);
CV_Assert(descriptor != 0);
// Size blockSize = descriptor->blockSize;
pt += imgoffset;

@ -191,7 +191,7 @@ void CV_DetectorTest::run( int )
// write detectors
validationFS << DETECTORS << "{";
assert( detectorNames.size() == detectorFilenames.size() );
CV_Assert( detectorNames.size() == detectorFilenames.size() );
nit = detectorNames.begin();
for( int di = 0; nit != detectorNames.end(); ++nit, di++ )
{
@ -291,7 +291,7 @@ static bool isZero( uchar i ) {return i == 0;}
int CV_DetectorTest::validate( int detectorIdx, vector<vector<Rect> >& objects )
{
assert( imageFilenames.size() == objects.size() );
CV_Assert( imageFilenames.size() == objects.size() );
int imageIdx = 0;
int totalNoPair = 0, totalValRectCount = 0;
@ -504,7 +504,7 @@ int CV_HOGDetectorTest::detectMultiScale( int di, const Mat& img,
if( detectorFilenames[di].empty() )
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
else
assert(0);
CV_Assert(0);
hog.detectMultiScale(img, objects);
return cvtest::TS::OK;
}
@ -787,7 +787,7 @@ void HOGCacheTester::init(const HOGDescriptorTester* _descriptor,
data->gradWeight = weights(i,j);
}
assert( count1 + count2 + count4 == rawBlockSize );
CV_Assert( count1 + count2 + count4 == rawBlockSize );
// defragment pixData
for( j = 0; j < count2; j++ )
pixData[j + count1] = pixData[j + rawBlockSize];
@ -809,7 +809,7 @@ void HOGCacheTester::init(const HOGDescriptorTester* _descriptor,
const float* HOGCacheTester::getBlock(Point pt, float* buf)
{
float* blockHist = buf;
assert(descriptor != 0);
CV_Assert(descriptor != 0);
Size blockSize = descriptor->blockSize;
pt += imgoffset;
@ -1285,7 +1285,7 @@ void HOGDescriptorTester::computeGradient(const Mat& img, Mat& grad, Mat& qangle
hidx += _nbins;
else if( hidx >= _nbins )
hidx -= _nbins;
assert( (unsigned)hidx < (unsigned)_nbins );
CV_Assert( (unsigned)hidx < (unsigned)_nbins );
qanglePtr[x*2] = (uchar)hidx;
hidx++;

@ -50,7 +50,7 @@ namespace perf {
void checkDeviceMaxMemoryAllocSize(const Size& size, int type, int factor)
{
assert(factor > 0);
CV_Assert(factor > 0);
if (!cv::ocl::useOpenCL())
return;

@ -377,7 +377,7 @@ void BaseTest::run( int start_from )
void BaseTest::run_func(void)
{
assert(0);
CV_Assert(0);
}

@ -268,14 +268,14 @@ void ArrayTest::fill_array( int /*test_case_idx*/, int i, int j, Mat& arr )
double ArrayTest::get_success_error_level( int /*test_case_idx*/, int i, int j )
{
int elem_depth = CV_MAT_DEPTH(cvGetElemType(test_array[i][j]));
assert( i == OUTPUT || i == INPUT_OUTPUT );
CV_Assert( i == OUTPUT || i == INPUT_OUTPUT );
return elem_depth < CV_32F ? 0 : elem_depth == CV_32F ? FLT_EPSILON*100: DBL_EPSILON*5000;
}
void ArrayTest::prepare_to_validation( int /*test_case_idx*/ )
{
assert(0);
CV_Assert(0);
}
@ -293,7 +293,7 @@ int ArrayTest::validate_test_results( int test_case_idx )
int i1 = i == 0 ? REF_OUTPUT : REF_INPUT_OUTPUT;
size_t sizei = test_array[i0].size();
assert( sizei == test_array[i1].size() );
CV_Assert( sizei == test_array[i1].size() );
for( j = 0; j < sizei; j++ )
{
double err_level;

@ -2094,7 +2094,7 @@ int cmpEps( const Mat& arr, const Mat& refarr, double* _realmaxdiff,
}
break;
default:
assert(0);
CV_Assert(0);
return CMP_EPS_BIG_DIFF;
}
if(_realmaxdiff)
@ -2705,7 +2705,7 @@ static void calcSobelKernel1D( int order, int _aperture_size, int size, vector<i
if( _aperture_size < 0 )
{
static const int scharr[8] = { 3, 10, 3, -1, 0, 1, 0, 0 }; // extra elements to eliminate "-Warray-bounds" bogus warning
assert( size == 3 );
CV_Assert( size == 3 && order < 2 );
for( i = 0; i < size; i++ )
kernel[i] = scharr[order*3 + i];
return;
@ -2999,7 +2999,7 @@ void threshold( const Mat& _src, Mat& _dst,
imaxval = cvRound(maxval);
}
assert( depth == CV_8U || depth == CV_16S || depth == CV_32F );
CV_Assert( depth == CV_8U || depth == CV_16S || depth == CV_32F );
switch( thresh_type )
{
@ -3161,7 +3161,7 @@ void threshold( const Mat& _src, Mat& _dst,
}
break;
default:
assert(0);
CV_Assert(0);
}
}

@ -1366,7 +1366,7 @@ bool TestBase::next()
bool has_next = false;
do {
assert(currentIter == times.size());
CV_Assert(currentIter == times.size());
if (currentIter == 0)
{
has_next = true;
@ -1379,7 +1379,7 @@ bool TestBase::next()
}
else
{
assert(getCurrentPerformanceStrategy() == PERF_STRATEGY_SIMPLE);
CV_Assert(getCurrentPerformanceStrategy() == PERF_STRATEGY_SIMPLE);
if (totalTime - lastActivityPrintTime >= cv::getTickFrequency() * 10)
{
std::cout << '.' << std::endl;
@ -1638,7 +1638,7 @@ performance_metrics& TestBase::calcMetrics()
}
else
{
assert(false);
CV_Assert(false);
}
int offset = static_cast<int>(start - times.begin());
@ -1714,7 +1714,7 @@ void TestBase::validateMetrics()
}
else
{
assert(false);
CV_Assert(false);
}
}

@ -212,7 +212,7 @@ int CvCaptureCAM_CMU::getDepth()
// TODO
if( format==7 ) {
assert(0);
CV_Assert(0);
return 1;
}
// irrelvant to depth
@ -233,7 +233,7 @@ int CvCaptureCAM_CMU::getNChannels()
int mode = cmucam->GetVideoMode();
if( format==7 ){
assert(0);
CV_Assert(0);
return 1;
}

@ -272,7 +272,7 @@ static CvCaptureCAM_DC1394 * icvCaptureFromCAM_DC1394 (int index)
format_idx = preferred_modes[i] - FORMAT_MIN;
continue;
}
assert(format_idx != -1);
CV_Assert(format_idx != -1);
if ( ! icvFormatSupportedCAM_DC1394(pcap->format, formats) )
continue;
if ( icvModeSupportedCAM_DC1394(pcap->format, preferred_modes[i], modes[format_idx]) ){

@ -64,7 +64,6 @@ static uint32_t getControlRegister(dc1394camera_t *camera, uint64_t offset)
uint32_t value = 0;
dc1394error_t err = dc1394_get_control_register(camera, offset, &value);
assert(err == DC1394_SUCCESS);
return err == DC1394_SUCCESS ? value : 0xffffffff;
}

@ -44,7 +44,6 @@
#if !(defined(_WIN32) || defined(WINCE))
# include <pthread.h>
#endif
#include <assert.h>
#include <algorithm>
#include <limits>
@ -405,7 +404,7 @@ static
inline int _opencv_ffmpeg_interrupt_callback(void *ptr)
{
AVInterruptCallbackMetadata* metadata = (AVInterruptCallbackMetadata*)ptr;
assert(metadata);
CV_Assert(metadata);
if (metadata->timeout_after_ms == 0)
{
@ -2113,7 +2112,7 @@ bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int
}
}
else {
assert(false);
CV_Assert(false);
}
if( (width & -2) != frame_width || (height & -2) != frame_height || !data )
@ -2165,7 +2164,7 @@ bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int
}
if ( c->pix_fmt != input_pix_fmt ) {
assert( input_picture );
CV_Assert( input_picture );
// let input_picture point to the raw data buffer of 'image'
_opencv_ffmpeg_av_image_fill_arrays(input_picture, (uint8_t *) data,
(AVPixelFormat)input_pix_fmt, width, height);
@ -2441,7 +2440,7 @@ bool CvVideoWriter_FFMPEG::open( const char * filename, int fourcc,
#else
oc = av_alloc_format_context();
#endif
assert (oc);
CV_Assert (oc);
/* set file name */
oc->oformat = fmt;

@ -441,7 +441,7 @@ CvCaptureCAM_Giganetix::grabImage ()
{
gige::IImageInfo imageInfo;
m_device->GetImageInfo (&imageInfo);
assert(imageInfo.IsValid());
CV_Assert(imageInfo.IsValid());
if (m_device->GetPendingImagesCount() == 1)
{

@ -249,7 +249,6 @@ make & enjoy!
#include <string.h>
#include <stdlib.h>
#include <asm/types.h> /* for videodev2.h */
#include <assert.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
@ -1125,7 +1124,7 @@ static int read_frame_v4l2(CvCaptureCAM_V4L* capture) {
}
}
assert(buf.index < capture->req.count);
CV_Assert(buf.index < capture->req.count);
#ifdef USE_TEMP_BUFFER
memcpy(capture->buffers[MAX_V4L_BUFFERS].start,

@ -55,7 +55,6 @@
// standard includes
#include <cstdio>
#include <cassert>
// Mac OS includes
#include <Carbon/Carbon.h>
@ -608,14 +607,14 @@ static CvCapture_QT_Cam * icvCaptureFromCam_QT (const int index)
/// capture properties currently unimplemented for QuickTime camera interface
static double icvGetProperty_QT_Cam (CvCapture_QT_Cam * capture, int property_id)
{
assert (0);
CV_Assert (0);
return 0;
}
/// capture properties currently unimplemented for QuickTime camera interface
static int icvSetProperty_QT_Cam (CvCapture_QT_Cam * capture, int property_id, double value)
{
assert (0);
CV_Assert (0);
return 0;
}

@ -220,7 +220,6 @@ make & enjoy!
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <limits>
@ -929,8 +928,8 @@ bool CvCaptureCAM_V4L::read_frame_v4l2()
return false;
}
assert(buf.index < req.count);
assert(buffers[buf.index].length == buf.length);
CV_Assert(buf.index < req.count);
CV_Assert(buffers[buf.index].length == buf.length);
//We shouldn't use this buffer in the queue while not retrieve frame from it.
buffers[buf.index].buffer = buf;

@ -68,7 +68,6 @@
#include <string.h>
#include <limits.h>
#include <ctype.h>
#include <assert.h> // FIXIT remove this
#if defined _WIN32 || defined WINCE
#if !defined _WIN32_WINNT

Loading…
Cancel
Save