1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Fixed several issues found by static analysis

This commit is contained in:
Maksim Shabunin
2017-06-28 16:26:55 +03:00
parent bbb14d3746
commit a769d69a9d
35 changed files with 113 additions and 66 deletions
+12 -10
View File
@@ -447,17 +447,19 @@ namespace
{
CV_OCL_RUN(_dst.isUMat(),
ocl_calcBtvRegularization(_src, _dst, btvKernelSize, ubtvWeights))
(void)ubtvWeights;
typedef void (*func_t)(InputArray _src, OutputArray _dst, int btvKernelSize, const std::vector<float>& btvWeights);
static const func_t funcs[] =
CV_UNUSED(ubtvWeights);
if (_src.channels() == 1)
{
0, calcBtvRegularizationImpl<float>, 0, calcBtvRegularizationImpl<Point3f>, 0
};
const func_t func = funcs[_src.channels()];
CV_Assert(func != 0);
func(_src, _dst, btvKernelSize, btvWeights);
calcBtvRegularizationImpl<float>(_src, _dst, btvKernelSize, btvWeights);
}
else if (_src.channels() == 3)
{
calcBtvRegularizationImpl<Point3f>(_src, _dst, btvKernelSize, btvWeights);
}
else
{
CV_Error(Error::StsBadArg, "Unsupported number of channels in _src");
}
}
class BTVL1_Base : public cv::superres::SuperResolution
+4 -3
View File
@@ -200,10 +200,11 @@ namespace
void convertToDepth(InputArray src, OutputArray dst, int depth)
{
CV_Assert( src.depth() <= CV_64F );
const int sdepth = src.depth();
CV_Assert( sdepth <= CV_64F );
CV_Assert( depth == CV_8U || depth == CV_32F );
static const double maxVals[] =
static const double maxVals[CV_64F + 1] =
{
(double)std::numeric_limits<uchar>::max(),
(double)std::numeric_limits<schar>::max(),
@@ -214,7 +215,7 @@ namespace
1.0,
};
const double scale = maxVals[depth] / maxVals[src.depth()];
const double scale = maxVals[depth] / maxVals[sdepth];
switch (src.kind())
{