mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user