header->cols = total_width / new_cn;
if( header->cols * new_cn != total_width ||
- new_sizes && header->cols != new_sizes[1] )
+ (new_sizes && header->cols != new_sizes[1]) )
CV_ERROR( CV_StsBadArg, "The total matrix width is not "
"divisible by the new number of columns" );
}
static void
-icvGetColorModel( int nchannels, char** colorModel, char** channelSeq )
+icvGetColorModel( int nchannels, const char** colorModel, const char** channelSeq )
{
- static char* tab[][2] =
+ static const char* tab[][2] =
{
{"GRAY", "GRAY"},
{"",""},
}
else
{
- char *colorModel;
- char *channelSeq;
+ const char *colorModel, *channelSeq;
icvGetColorModel( channels, &colorModel, &channelSeq );
- img = CvIPL.createHeader( channels, 0, depth, colorModel, channelSeq,
+ img = CvIPL.createHeader( channels, 0, depth, (char*)colorModel, (char*)channelSeq,
IPL_DATA_ORDER_PIXEL, IPL_ORIGIN_TL,
CV_DEFAULT_IMAGE_ROW_ALIGN,
size.width, size.height, 0, 0, 0, 0 );
__BEGIN__;
- char *colorModel, *channelSeq;
+ const char *colorModel, *channelSeq;
if( !image )
CV_ERROR( CV_HeaderIsNull, "null pointer to header" );
else if( !inv && CV_MAT_CN(src->type) == 1 && CV_MAT_CN(dst->type) == 2 )
{
if( (src->cols != 1 || dst->cols != 1 ||
- src->rows/2+1 != dst->rows && src->rows != dst->rows) &&
+ (src->rows/2+1 != dst->rows && src->rows != dst->rows)) &&
(src->cols/2+1 != dst->cols || src->rows != dst->rows) )
CV_ERROR( CV_StsUnmatchedSizes, "" );
real_transform = 1;
else if( inv && CV_MAT_CN(src->type) == 2 && CV_MAT_CN(dst->type) == 1 )
{
if( (src->cols != 1 || dst->cols != 1 ||
- dst->rows/2+1 != src->rows && src->rows != dst->rows) &&
+ (dst->rows/2+1 != src->rows && src->rows != dst->rows)) &&
(dst->cols/2+1 != src->cols || src->rows != dst->rows) )
CV_ERROR( CV_StsUnmatchedSizes, "" );
real_transform = 1;
// determine, which transform to do first - row-wise
// (stage 0) or column-wise (stage 1) transform
if( !(flags & CV_DXT_ROWS) && src->rows > 1 &&
- (src->cols == 1 && !CV_IS_MAT_CONT(src->type & dst->type) ||
- src->cols > 1 && inv && real_transform) )
+ ((src->cols == 1 && !CV_IS_MAT_CONT(src->type & dst->type)) ||
+ (src->cols > 1 && inv && real_transform)) )
stage = 1;
ipp_norm_flag = !(flags & CV_DXT_SCALE) ? 8 : (flags & CV_DXT_INVERSE) ? 2 : 1;
if( (factors[i] & 1) != 0 && factors[i] > 5 )
sz += (factors[i]+1)*complex_elem_size;
- if( stage == 0 && (src->data.ptr == dst->data.ptr && !inplace_transform || odd_real) ||
- stage == 1 && !inplace_transform )
+ if( (stage == 0 && ((src->data.ptr == dst->data.ptr && !inplace_transform) || odd_real)) ||
+ (stage == 1 && !inplace_transform) )
{
use_buf = 1;
sz += len*complex_elem_size;
if( sz > buf_size )
{
- prev_len = 0; // because we release the buffer,
+ prev_len = 0; // because we release the buffer,
// force recalculation of
// twiddle factors and permutation table
if( !local_alloc && buffer )
rows = srcA->rows;
cols = srcA->cols;
is_1d = (flags & CV_DXT_ROWS) ||
- (rows == 1 || cols == 1 &&
- CV_IS_MAT_CONT( srcA->type & srcB->type & dst->type ));
+ (rows == 1 || (cols == 1 &&
+ CV_IS_MAT_CONT( srcA->type & srcB->type & dst->type )));
if( is_1d && !(flags & CV_DXT_ROWS) )
cols = cols + rows - 1, rows = 1;
dct_func = dct_tbl[inv + (depth == CV_64F)*2];
if( (flags & CV_DXT_ROWS) || src->rows == 1 ||
- src->cols == 1 && CV_IS_MAT_CONT(src->type & dst->type))
+ (src->cols == 1 && CV_IS_MAT_CONT(src->type & dst->type)))
{
stage = end_stage = 0;
}
{
const char* suffix = strrchr( filename, '.' );
return suffix &&
- strcmp( suffix, ".xml" ) == 0 ||
+ (strcmp( suffix, ".xml" ) == 0 ||
strcmp( suffix, ".Xml" ) == 0 ||
strcmp( suffix, ".XML" ) == 0 ||
strcmp( suffix, ".yml" ) == 0 ||
strcmp( suffix, ".YML" ) == 0 ||
strcmp( suffix, ".yaml" ) == 0 ||
strcmp( suffix, ".Yaml" ) == 0 ||
- strcmp( suffix, ".YAML" ) == 0;
+ strcmp( suffix, ".YAML" ) == 0);
}
lut_data = shuffled_lut;
}
- if( lut_cn == 1 || lut_cn <= 4 && depth == CV_8U )
+ if( lut_cn == 1 || (lut_cn <= 4 && depth == CV_8U) )
{
CvLUT_TransformFunc func = depth == CV_8U ? lut_8u_tab[cn-1] :
(CvLUT_TransformFunc)(lut_c1_tab.fn_2d[depth]);
-
+
if( !func )
CV_ERROR( CV_StsUnsupportedFormat, "" );
DBLINT;
#define EXPTAB_SCALE 6
-#define EXPTAB_MASK (1 << EXPTAB_SCALE) - 1
+#define EXPTAB_MASK ((1 << EXPTAB_SCALE) - 1)
#define EXPPOLY_32F_A0 .9670371139572337719125840413672004409288e-2
if( !CV_ARE_TYPES_EQ( C, D ))
CV_ERROR( CV_StsUnmatchedFormats, "" );
- if( (flags&CV_GEMM_C_T) == 0 && (C->cols != D->cols || C->rows != D->rows) ||
- (flags&CV_GEMM_C_T) != 0 && (C->rows != D->cols || C->cols != D->rows))
+ if( ((flags&CV_GEMM_C_T) == 0 && (C->cols != D->cols || C->rows != D->rows)) ||
+ ((flags&CV_GEMM_C_T) != 0 && (C->rows != D->cols || C->cols != D->rows)))
CV_ERROR( CV_StsUnmatchedSizes, "" );
if( (flags & CV_GEMM_C_T) != 0 && C->data.ptr == D->data.ptr )
&_beta, D->data.ptr, &ldd );
}
}
- else if( (d_size.height <= block_lin_size/2 || d_size.width <= block_lin_size/2) &&
- len <= 10000 || len <= 10 ||
- d_size.width <= block_lin_size && d_size.height <= block_lin_size && len <= block_lin_size )
+ else if( ((d_size.height <= block_lin_size/2 || d_size.width <= block_lin_size/2) &&
+ len <= 10000) || len <= 10 ||
+ (d_size.width <= block_lin_size && d_size.height <= block_lin_size && len <= block_lin_size) )
{
single_mul_func( A->data.ptr, A->step, B->data.ptr, b_step,
C->data.ptr, C->step, D->data.ptr, D->step,
CV_SWAP( a_bl_size.width, a_bl_size.height, t );
_a = a_buf;
}
-
+
if( dj < d_size.width )
{
CvSize b_size;
{
if( !src_seq )
{
- if( CV_IS_MAT_CONT(src->type) || src->rows != 1 && src->cols != 1 )
+ if( CV_IS_MAT_CONT(src->type) || (src->rows != 1 && src->cols != 1) )
CV_ERROR( CV_StsBadSize, "if eigher the source or destination is a sequence, "
"the other array must be also a sequence of continous 1d vector" );
src_seq = cvMakeSeqHeaderForArray( CV_MAT_TYPE(src->type), sizeof(hdr),
if( !dst_seq )
{
- if( CV_IS_MAT_CONT(dst->type) || dst->rows != 1 && dst->cols != 1 )
+ if( CV_IS_MAT_CONT(dst->type) || (dst->rows != 1 && dst->cols != 1) )
CV_ERROR( CV_StsBadSize, "if eigher the source or destination is a sequence, "
"the other array must be also a sequence of continous 1d vector" );
if( dst->rows + dst->cols - 1 != src_seq->total )
CV_CALL( shift = cvGetMat( shift, &shiftstub, &coi ));
if( CV_MAT_CN( shift->type ) * shift->cols * shift->rows == dst_cn &&
- (shift->rows == 1 || shift->rows == dst_cn) ||
- (shift->cols == 1 || shift->cols == dst_cn) )
+ (shift->rows == 1 || shift->cols == 1) )
{
if( CV_MAT_DEPTH( shift->type ) == CV_64F )
{
if( !dot_func )
CV_ERROR( CV_StsUnsupportedFormat,
"The format of input vectors is not supported" );
-
+
for( i = 0; i < count; i++ )
{
int a, b, delta;
(order == 0 && src->rows != dst->rows))
CV_ERROR( CV_StsUnmatchedSizes, "" );
- if( src->data.ptr == dst->data.ptr || stype == dtype &&
+ if( src->data.ptr == dst->data.ptr || (stype == dtype &&
(dst->cols >= gemm_level && dst->rows >= gemm_level &&
- src->cols >= gemm_level && src->rows >= gemm_level))
+ src->cols >= gemm_level && src->rows >= gemm_level)))
{
if( deltaarr )
{
cvSub( src, src2, src2 );
src = src2;
}
- cvGEMM( src, src, scale, 0, 0, dst, order == 0 ? CV_GEMM_B_T : CV_GEMM_A_T );
+ cvGEMM( src, src, scale, 0, 0, dst, order == 0 ? CV_GEMM_B_T : CV_GEMM_A_T );
}
else
{
if( CV_MAT_CN(data->type) != 1 || CV_MAT_CN(avg->type) != 1 )
CV_ERROR( CV_StsUnsupportedFormat, "All the input and output arrays must be 1-channel" );
- if( CV_MAT_TYPE(avg->type) != CV_32FC1 && CV_MAT_TYPE(avg->type) != CV_64FC1 ||
+ if( (CV_MAT_TYPE(avg->type) != CV_32FC1 && CV_MAT_TYPE(avg->type) != CV_64FC1) ||
!CV_ARE_TYPES_EQ(avg, evects) || !CV_ARE_TYPES_EQ(avg, result) )
CV_ERROR( CV_StsUnsupportedFormat,
"All the input and output arrays (except for data) must have the same type, 32fC1 or 64fC1" );
if( !CV_IS_MAT(result) )
CV_CALL( result = cvGetMat( result, &rstub ));
- if( CV_MAT_TYPE(avg->type) != CV_32FC1 && CV_MAT_TYPE(avg->type) != CV_64FC1 ||
+ if( (CV_MAT_TYPE(avg->type) != CV_32FC1 && CV_MAT_TYPE(avg->type) != CV_64FC1) ||
!CV_ARE_TYPES_EQ(avg, data) || !CV_ARE_TYPES_EQ(avg, evects) || !CV_ARE_TYPES_EQ(avg, result) )
CV_ERROR( CV_StsUnsupportedFormat,
"All the input and output arrays must have the same type, 32fC1 or 64fC1" );
}
if( isdigit(c) ||
- (c == '-' || c == '+') && (isdigit(d) || d == '.') ||
- c == '.' && isalnum(d)) // a number
+ ((c == '-' || c == '+') && (isdigit(d) || d == '.')) ||
+ (c == '.' && isalnum(d))) // a number
{
double fval;
int ival;
buf[len++] = '\r';
else if( d == 't' )
buf[len++] = '\t';
- else if( d == 'x' || isdigit(d) && d < '8' )
+ else if( d == 'x' || (isdigit(d) && d < '8') )
{
int val, is_hex = d == 'x';
c = ptr[3];
do c = *++endptr;
while( cv_isprint(c) &&
- (!is_parent_flow || c != ',' && c != '}' && c != ']') &&
+ (!is_parent_flow || (c != ',' && c != '}' && c != ']')) &&
(is_parent_flow || c != ':' || value_type == CV_NODE_STRING));
if( endptr == ptr )
if( len > CV_FS_MAX_LEN )
CV_ERROR( CV_StsBadArg, "The written string is too long" );
- if( quote || len == 0 || str[0] != str[len-1] || str[0] != '\"' && str[0] != '\'' )
+ if( quote || len == 0 || str[0] != str[len-1] || (str[0] != '\"' && str[0] != '\'') )
{
int need_quote = quote || len == 0;
data = buf;
char c = *ptr, d;
char* endptr;
- if( isspace(c) || c == '\0' || c == '<' && ptr[1] == '!' && ptr[2] == '-' )
+ if( isspace(c) || c == '\0' || (c == '<' && ptr[1] == '!' && ptr[2] == '-') )
{
CV_CALL( ptr = icvXMLSkipSpaces( fs, ptr, 0 ));
have_space = 1;
}
if( value_type != CV_NODE_STRING &&
- (isdigit(c) || (c == '-' || c == '+') &&
- (isdigit(d) || d == '.') || c == '.' && isalnum(d)) ) // a number
+ (isdigit(c) || ((c == '-' || c == '+') &&
+ (isdigit(d) || d == '.')) || (c == '.' && isalnum(d))) ) // a number
{
double fval;
int ival;
}
if( (CV_NODE_TYPE(node->tag) == CV_NODE_NONE ||
- CV_NODE_TYPE(node->tag) != value_type &&
- !CV_NODE_IS_COLLECTION(node->tag)) &&
+ (CV_NODE_TYPE(node->tag) != value_type &&
+ !CV_NODE_IS_COLLECTION(node->tag))) &&
CV_NODE_IS_COLLECTION(value_type) )
{
CV_CALL( icvFSCreateCollection( fs, CV_NODE_IS_MAP(value_type) ?
const CvSeq* seq = (CvSeq*)struct_ptr;
const char* recursive_value = cvAttrValue( &attr, "recursive" );
- int is_recursive = !(!recursive_value || strcmp(recursive_value,"0") == 0 ||
- strlen(recursive_value) == 5 &&
- (strcmp(recursive_value,"false") == 0 ||
- strcmp(recursive_value,"False") == 0 ||
- strcmp(recursive_value,"FALSE") == 0 ));
+ int is_recursive = recursive_value &&
+ strcmp(recursive_value,"0") != 0 &&
+ strcmp(recursive_value,"false") != 0 &&
+ strcmp(recursive_value,"False") != 0 &&
+ strcmp(recursive_value,"FALSE") != 0;
assert( CV_IS_SEQ( seq ));
for( i = 0; i < fmt_pair_count; i += 2 )
edge_items_per_elem += fmt_pairs[i];
- if( edge_dt[2] == 'f' || edge_dt[2] == '1' && edge_dt[3] == 'f' )
+ if( edge_dt[2] == 'f' || (edge_dt[2] == '1' && edge_dt[3] == 'f') )
dst_edge_dt = edge_dt + 3 + isdigit(edge_dt[2]);
else
{
if( dim > 1 )
CV_ERROR( CV_StsOutOfRange, "The reduced dimensionality index is out of range" );
- if( dim == 0 && (dst->cols != src->cols || dst->rows != 1) ||
- dim == 1 && (dst->rows != src->rows || dst->cols != 1) )
+ if( (dim == 0 && (dst->cols != src->cols || dst->rows != 1)) ||
+ (dim == 1 && (dst->rows != src->rows || dst->cols != 1)) )
CV_ERROR( CV_StsBadSize, "The output array size is incorrect" );
if( op == CV_REDUCE_AVG )
CV_ERROR( CV_StsUnsupportedFormat,
"samples should be floating-point matrix, cluster_idx - integer vector" );
- if( labels->rows != 1 && (labels->cols != 1 || !CV_IS_MAT_CONT(labels->type)) ||
+ if( (labels->rows != 1 && (labels->cols != 1 || !CV_IS_MAT_CONT(labels->type))) ||
labels->rows + labels->cols - 1 != samples->rows )
CV_ERROR( CV_StsUnmatchedSizes,
"cluster_idx should be 1D vector of the same number of elements as samples' number of rows" );
double a0 = 1., a1, a2, a3;
double x0 = 0., x1 = 0., x2 = 0.;
int step = 1, coeff_count;
-
+
if( !CV_IS_MAT(coeffs) )
CV_ERROR( !coeffs ? CV_StsNullPtr : CV_StsBadArg, "Input parameter is not a valid matrix" );
if( !CV_IS_MAT(roots) )
CV_ERROR( !roots ? CV_StsNullPtr : CV_StsBadArg, "Output parameter is not a valid matrix" );
- if( CV_MAT_TYPE(coeffs->type) != CV_32FC1 && CV_MAT_TYPE(coeffs->type) != CV_64FC1 ||
- CV_MAT_TYPE(roots->type) != CV_32FC1 && CV_MAT_TYPE(roots->type) != CV_64FC1 )
+ if( (CV_MAT_TYPE(coeffs->type) != CV_32FC1 && CV_MAT_TYPE(coeffs->type) != CV_64FC1) ||
+ (CV_MAT_TYPE(roots->type) != CV_32FC1 && CV_MAT_TYPE(roots->type) != CV_64FC1) )
CV_ERROR( CV_StsUnsupportedFormat,
"Both matrices should be floating-point (single or double precision)" );
coeff_count = coeffs->rows + coeffs->cols - 1;
- if( coeffs->rows != 1 && coeffs->cols != 1 || coeff_count != 3 && coeff_count != 4 )
+ if( (coeffs->rows != 1 && coeffs->cols != 1) || (coeff_count != 3 && coeff_count != 4) )
CV_ERROR( CV_StsBadSize,
"The matrix of coefficients must be 1-dimensional vector of 3 or 4 elements" );
- if( roots->rows != 1 && roots->cols != 1 ||
+ if( (roots->rows != 1 && roots->cols != 1) ||
roots->rows + roots->cols - 1 != 3 )
CV_ERROR( CV_StsBadSize,
"The matrix of roots must be 1-dimensional vector of 3 elements" );
if( flags & CV_SORT_EVERY_COLUMN )
CV_SWAP( len, count, t );
- if( (flags & CV_SORT_DESCENDING) || idx && dst && dst->data.ptr == src->data.ptr )
+ if( (flags & CV_SORT_DESCENDING) || (idx && dst && dst->data.ptr == src->data.ptr) )
tsrc = (uchar*)cvAlloc(len*elemSize);
for( i = 0; i < count; i++ )