-Wunused-parameter -Wunused-local-typedefs -Wsign-compare -Wsign-promo
-Wundef -Wtautological-undefined-compare -Wignored-qualifiers -Wextra
-Wunused-function -Wunused-const-variable -Wshorten-64-to-32 -Wno-invalid-offsetof
+ -Wenum-compare-switch
)
endif()
if(CV_ICC)
//-------------------------------Optimization
- for(int iter = 0; iter <= std::numeric_limits<int>::max(); ++iter)
+ for(int iter = 0; iter < std::numeric_limits<int>::max(); ++iter)
{
if ((criteria.type == 1 && iter >= criteria.maxCount) ||
(criteria.type == 2 && change <= criteria.epsilon) ||
#endif
#ifdef CV_STATIC_ANALYSIS
+
// In practice, some macro are not processed correctly (noreturn is not detected).
// We need to use simplified definition for them.
#define CV_Error(...) do { abort(); } while (0)
-#define CV_Error_(...) do { abort(); } while (0)
-#define CV_Assert(cond) do { if (!(cond)) abort(); } while (0)
+#define CV_Error_( code, args ) do { cv::format args; abort(); } while (0)
#define CV_ErrorNoReturn(...) do { abort(); } while (0)
#define CV_ErrorNoReturn_(...) do { abort(); } while (0)
+#define CV_Assert_1( expr ) do { if (!(expr)) abort(); } while (0)
#else // CV_STATIC_ANALYSIS
*/
#define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ )
-/** @brief Checks a condition at runtime and throws exception if it fails
-
-The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression. If it is 0, the macros
-raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release
-configurations while CV_DbgAssert is only retained in the Debug configuration.
-*/
+/** same as CV_Error(code,msg), but does not return */
+#define CV_ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
-#define CV_VA_NUM_ARGS_HELPER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
-#define CV_VA_NUM_ARGS(...) CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
+/** same as CV_Error_(code,args), but does not return */
+#define CV_ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
#define CV_Assert_1( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
+
+#endif // CV_STATIC_ANALYSIS
+
#define CV_Assert_2( expr1, expr2 ) CV_Assert_1(expr1); CV_Assert_1(expr2)
#define CV_Assert_3( expr1, expr2, expr3 ) CV_Assert_2(expr1, expr2); CV_Assert_1(expr3)
#define CV_Assert_4( expr1, expr2, expr3, expr4 ) CV_Assert_3(expr1, expr2, expr3); CV_Assert_1(expr4)
#define CV_Assert_9( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ) CV_Assert_8(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8 ); CV_Assert_1(expr9)
#define CV_Assert_10( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9, expr10 ) CV_Assert_9(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ); CV_Assert_1(expr10)
-#define CV_Assert(...) CVAUX_CONCAT(CV_Assert_, CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__)
-
-/** same as CV_Error(code,msg), but does not return */
-#define CV_ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
+#define CV_VA_NUM_ARGS_HELPER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
+#define CV_VA_NUM_ARGS(...) CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
-/** same as CV_Error_(code,args), but does not return */
-#define CV_ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
+/** @brief Checks a condition at runtime and throws exception if it fails
-#endif // CV_STATIC_ANALYSIS
+The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression. If it is 0, the macros
+raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release
+configurations while CV_DbgAssert is only retained in the Debug configuration.
+*/
+#define CV_Assert(...) do { CVAUX_CONCAT(CV_Assert_, CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0)
/** replaced with CV_Assert(expr) in Debug configuration */
#ifdef _DEBUG
dst = (IplImage*)cvAlloc( sizeof(*dst));
memcpy( dst, src, sizeof(*src));
+ dst->nSize = sizeof(IplImage);
dst->imageData = dst->imageDataOrigin = 0;
dst->roi = 0;
return plan->enqueueTransform(_src, _dst, nonzero_cols, flags, fftType, false);
}
+inline FftType determineFFTType(bool real_input, bool complex_input, bool real_output, bool complex_output, bool inv)
+{
+ // output format is not specified
+ if (!real_output && !complex_output)
+ complex_output = true;
+
+ // input or output format is ambiguous
+ if (real_input == complex_input || real_output == complex_output)
+ CV_Error(Error::StsBadArg, "Invalid FFT input or output format");
+
+ FftType result = real_input ? (real_output ? R2R : R2C) : (real_output ? C2R : C2C);
+
+ // Forward Complex to CCS not supported
+ if (result == C2R && !inv)
+ result = C2C;
+
+ // Inverse CCS to Complex not supported
+ if (result == R2C && inv)
+ result = R2R;
+
+ return result;
+}
+
static bool ocl_dft(InputArray _src, OutputArray _dst, int flags, int nonzero_rows)
{
int type = _src.type(), cn = CV_MAT_CN(type), depth = CV_MAT_DEPTH(type);
Size ssize = _src.size();
bool doubleSupport = ocl::Device::getDefault().doubleFPConfig() > 0;
- if ( !((cn == 1 || cn == 2) && (depth == CV_32F || (depth == CV_64F && doubleSupport))) )
+ if (!(cn == 1 || cn == 2)
+ || !(depth == CV_32F || (depth == CV_64F && doubleSupport))
+ || ((flags & DFT_REAL_OUTPUT) && (flags & DFT_COMPLEX_OUTPUT)))
return false;
// if is not a multiplication of prime numbers { 2, 3, 5 }
return false;
UMat src = _src.getUMat();
- int complex_input = cn == 2 ? 1 : 0;
- int complex_output = (flags & DFT_COMPLEX_OUTPUT) != 0;
- int real_input = cn == 1 ? 1 : 0;
- int real_output = (flags & DFT_REAL_OUTPUT) != 0;
bool inv = (flags & DFT_INVERSE) != 0 ? 1 : 0;
if( nonzero_rows <= 0 || nonzero_rows > _src.rows() )
nonzero_rows = _src.rows();
bool is1d = (flags & DFT_ROWS) != 0 || nonzero_rows == 1;
- // if output format is not specified
- if (complex_output + real_output == 0)
- {
- if (real_input)
- real_output = 1;
- else
- complex_output = 1;
- }
-
- FftType fftType = (FftType)(complex_input << 0 | complex_output << 1);
-
- // Forward Complex to CCS not supported
- if (fftType == C2R && !inv)
- fftType = C2C;
-
- // Inverse CCS to Complex not supported
- if (fftType == R2C && inv)
- fftType = R2R;
+ FftType fftType = determineFFTType(cn == 1, cn == 2,
+ (flags & DFT_REAL_OUTPUT) != 0, (flags & DFT_COMPLEX_OUTPUT) != 0, inv);
UMat output;
if (fftType == C2C || fftType == R2C)
}
}
+ bool result = false;
if (!inv)
{
- if (!ocl_dft_rows(src, output, nonzero_rows, flags, fftType))
- return false;
-
+ int nonzero_cols = fftType == R2R ? output.cols/2 + 1 : output.cols;
+ result = ocl_dft_rows(src, output, nonzero_rows, flags, fftType);
if (!is1d)
- {
- int nonzero_cols = fftType == R2R ? output.cols/2 + 1 : output.cols;
- if (!ocl_dft_cols(output, _dst, nonzero_cols, flags, fftType))
- return false;
- }
+ result = result && ocl_dft_cols(output, _dst, nonzero_cols, flags, fftType);
}
else
{
if (fftType == C2C)
{
// complex output
- if (!ocl_dft_rows(src, output, nonzero_rows, flags, fftType))
- return false;
-
+ result = ocl_dft_rows(src, output, nonzero_rows, flags, fftType);
if (!is1d)
- {
- if (!ocl_dft_cols(output, output, output.cols, flags, fftType))
- return false;
- }
+ result = result && ocl_dft_cols(output, output, output.cols, flags, fftType);
}
else
{
if (is1d)
{
- if (!ocl_dft_rows(src, output, nonzero_rows, flags, fftType))
- return false;
+ result = ocl_dft_rows(src, output, nonzero_rows, flags, fftType);
}
else
{
int nonzero_cols = src.cols/2 + 1;
- if (!ocl_dft_cols(src, output, nonzero_cols, flags, fftType))
- return false;
-
- if (!ocl_dft_rows(output, _dst, nonzero_rows, flags, fftType))
- return false;
+ result = ocl_dft_cols(src, output, nonzero_cols, flags, fftType);
+ result = result && ocl_dft_rows(output, _dst, nonzero_rows, flags, fftType);
}
}
}
- return true;
+ return result;
}
} // namespace cv;
size_t lastRowCorner_ind = 0, next_lastRowCorner_ind = 0;
std::vector<int> nmsFlags;
- std::vector<KeyPoint>::iterator currCorner_nms;
std::vector<KeyPoint>::const_iterator currCorner;
currCorner = kpts.begin();
*/
u_rational_t ExifReader::getURational(const size_t offset) const
{
- u_rational_t result;
uint32_t numerator = getU32( offset );
uint32_t denominator = getU32( offset + 4 );
}
IppiMaskSize maskSize = ippiGetMaskSize(ksize, ksize);
- if(maskSize < 0)
+ if((int)maskSize < 0)
return false;
#if IPP_VERSION_X100 <= 201703
#endif
IwiDerivativeType derivType = ippiGetDerivType(dx, dy, (useScharr)?false:true);
- if(derivType < 0)
+ if((int)derivType < 0)
return false;
// Acquire data and begin processing
useScale = true;
IppiMaskSize maskSize = ippiGetMaskSize(ksize, ksize);
- if(maskSize < 0)
+ if((int)maskSize < 0)
return false;
// Acquire data and begin processing
CV_UNUSED(isSubmatrix);
- if(morphType < 0)
+ if((int)morphType < 0)
return false;
if(iterations > 1 && morphType != iwiMorphErode && morphType != iwiMorphDilate)
IppDataType ippDataType = ippiGetDataType(depth);
IppiInterpolationType ippInter = ippiGetInterpolation(interpolation);
- if(ippInter < 0)
+ if((int)ippInter < 0)
return false;
// Resize which doesn't match OpenCV exactly