Warning fixes continued

This commit is contained in:
Andrey Kamaev
2012-06-09 15:00:04 +00:00
parent f6b451c607
commit f2d3b9b4a1
127 changed files with 6298 additions and 6277 deletions

View File

@@ -7,7 +7,7 @@
// copy or use the software.
//
//
// License Agreement
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
@@ -46,7 +46,7 @@ namespace cv
{
using std::pair;
template<typename _KeyTp, typename _ValueTp> struct sorted_vector
{
sorted_vector() {}
@@ -54,7 +54,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
size_t size() const { return vec.size(); }
_ValueTp& operator [](size_t idx) { return vec[idx]; }
const _ValueTp& operator [](size_t idx) const { return vec[idx]; }
void add(const _KeyTp& k, const _ValueTp& val)
{
pair<_KeyTp, _ValueTp> p(k, val);
@@ -64,7 +64,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
std::swap(vec[i-1], vec[i]);
CV_Assert( i == 0 || vec[i].first != vec[i-1].first );
}
bool find(const _KeyTp& key, _ValueTp& value) const
{
size_t a = 0, b = vec.size();
@@ -76,7 +76,7 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
else
b = c;
}
if( a < vec.size() && vec[a].first == key )
{
value = vec[a].second;
@@ -84,26 +84,26 @@ template<typename _KeyTp, typename _ValueTp> struct sorted_vector
}
return false;
}
void get_keys(vector<_KeyTp>& keys) const
{
size_t i = 0, n = vec.size();
keys.resize(n);
for( i = 0; i < n; i++ )
keys[i] = vec[i].first;
}
vector<pair<_KeyTp, _ValueTp> > vec;
};
template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<string, _ValueTp>& vec,
const char* key)
{
if( !key )
return 0;
size_t a = 0, b = vec.vec.size();
while( b > a )
{
@@ -113,13 +113,13 @@ template<typename _ValueTp> inline const _ValueTp* findstr(const sorted_vector<s
else
b = c;
}
if( strcmp(vec.vec[a].first.c_str(), key) == 0 )
return &vec.vec[a].second;
return 0;
}
Param::Param()
{
type = 0;
@@ -129,7 +129,7 @@ Param::Param()
setter = 0;
}
Param::Param(int _type, bool _readonly, int _offset,
Algorithm::Getter _getter, Algorithm::Setter _setter,
const string& _help)
@@ -148,7 +148,7 @@ struct CV_EXPORTS AlgorithmInfoData
string _name;
};
static sorted_vector<string, Algorithm::Constructor>& alglist()
{
static sorted_vector<string, Algorithm::Constructor> alglist_var;
@@ -171,152 +171,152 @@ Ptr<Algorithm> Algorithm::_create(const string& name)
Algorithm::Algorithm()
{
}
Algorithm::~Algorithm()
{
}
string Algorithm::name() const
{
return info()->name();
}
void Algorithm::set(const string& name, int value)
void Algorithm::set(const string& parameter, int value)
{
info()->set(this, name.c_str(), ParamType<int>::type, &value);
info()->set(this, parameter.c_str(), ParamType<int>::type, &value);
}
void Algorithm::set(const string& name, double value)
void Algorithm::set(const string& parameter, double value)
{
info()->set(this, name.c_str(), ParamType<double>::type, &value);
info()->set(this, parameter.c_str(), ParamType<double>::type, &value);
}
void Algorithm::set(const string& name, bool value)
void Algorithm::set(const string& parameter, bool value)
{
info()->set(this, name.c_str(), ParamType<bool>::type, &value);
info()->set(this, parameter.c_str(), ParamType<bool>::type, &value);
}
void Algorithm::set(const string& name, const string& value)
void Algorithm::set(const string& parameter, const string& value)
{
info()->set(this, name.c_str(), ParamType<string>::type, &value);
info()->set(this, parameter.c_str(), ParamType<string>::type, &value);
}
void Algorithm::set(const string& name, const Mat& value)
void Algorithm::set(const string& parameter, const Mat& value)
{
info()->set(this, name.c_str(), ParamType<Mat>::type, &value);
info()->set(this, parameter.c_str(), ParamType<Mat>::type, &value);
}
void Algorithm::set(const string& name, const vector<Mat>& value)
void Algorithm::set(const string& parameter, const vector<Mat>& value)
{
info()->set(this, name.c_str(), ParamType<vector<Mat> >::type, &value);
}
void Algorithm::set(const string& name, const Ptr<Algorithm>& value)
{
info()->set(this, name.c_str(), ParamType<Algorithm>::type, &value);
info()->set(this, parameter.c_str(), ParamType<vector<Mat> >::type, &value);
}
void Algorithm::set(const char* name, int value)
void Algorithm::set(const string& parameter, const Ptr<Algorithm>& value)
{
info()->set(this, name, ParamType<int>::type, &value);
info()->set(this, parameter.c_str(), ParamType<Algorithm>::type, &value);
}
void Algorithm::set(const char* name, double value)
void Algorithm::set(const char* parameter, int value)
{
info()->set(this, name, ParamType<double>::type, &value);
info()->set(this, parameter, ParamType<int>::type, &value);
}
void Algorithm::set(const char* name, bool value)
void Algorithm::set(const char* parameter, double value)
{
info()->set(this, name, ParamType<bool>::type, &value);
info()->set(this, parameter, ParamType<double>::type, &value);
}
void Algorithm::set(const char* name, const string& value)
void Algorithm::set(const char* parameter, bool value)
{
info()->set(this, name, ParamType<string>::type, &value);
info()->set(this, parameter, ParamType<bool>::type, &value);
}
void Algorithm::set(const char* name, const Mat& value)
void Algorithm::set(const char* parameter, const string& value)
{
info()->set(this, name, ParamType<Mat>::type, &value);
info()->set(this, parameter, ParamType<string>::type, &value);
}
void Algorithm::set(const char* name, const vector<Mat>& value)
void Algorithm::set(const char* parameter, const Mat& value)
{
info()->set(this, name, ParamType<vector<Mat> >::type, &value);
}
void Algorithm::set(const char* name, const Ptr<Algorithm>& value)
{
info()->set(this, name, ParamType<Algorithm>::type, &value);
}
int Algorithm::getInt(const string& name) const
{
return get<int>(name);
}
double Algorithm::getDouble(const string& name) const
{
return get<double>(name);
info()->set(this, parameter, ParamType<Mat>::type, &value);
}
bool Algorithm::getBool(const string& name) const
void Algorithm::set(const char* parameter, const vector<Mat>& value)
{
return get<bool>(name);
info()->set(this, parameter, ParamType<vector<Mat> >::type, &value);
}
string Algorithm::getString(const string& name) const
void Algorithm::set(const char* parameter, const Ptr<Algorithm>& value)
{
return get<string>(name);
info()->set(this, parameter, ParamType<Algorithm>::type, &value);
}
Mat Algorithm::getMat(const string& name) const
int Algorithm::getInt(const string& parameter) const
{
return get<Mat>(name);
return get<int>(parameter);
}
vector<Mat> Algorithm::getMatVector(const string& name) const
double Algorithm::getDouble(const string& parameter) const
{
return get<vector<Mat> >(name);
return get<double>(parameter);
}
Ptr<Algorithm> Algorithm::getAlgorithm(const string& name) const
bool Algorithm::getBool(const string& parameter) const
{
return get<Algorithm>(name);
}
string Algorithm::paramHelp(const string& name) const
{
return info()->paramHelp(name.c_str());
}
int Algorithm::paramType(const string& name) const
{
return info()->paramType(name.c_str());
return get<bool>(parameter);
}
int Algorithm::paramType(const char* name) const
string Algorithm::getString(const string& parameter) const
{
return info()->paramType(name);
}
return get<string>(parameter);
}
Mat Algorithm::getMat(const string& parameter) const
{
return get<Mat>(parameter);
}
vector<Mat> Algorithm::getMatVector(const string& parameter) const
{
return get<vector<Mat> >(parameter);
}
Ptr<Algorithm> Algorithm::getAlgorithm(const string& parameter) const
{
return get<Algorithm>(parameter);
}
string Algorithm::paramHelp(const string& parameter) const
{
return info()->paramHelp(parameter.c_str());
}
int Algorithm::paramType(const string& parameter) const
{
return info()->paramType(parameter.c_str());
}
int Algorithm::paramType(const char* parameter) const
{
return info()->paramType(parameter);
}
void Algorithm::getParams(vector<string>& names) const
{
info()->getParams(names);
}
void Algorithm::write(FileStorage& fs) const
{
info()->write(this, fs);
}
void Algorithm::read(const FileNode& fn)
{
info()->read(this, fn);
}
}
AlgorithmInfo::AlgorithmInfo(const string& _name, Algorithm::Constructor create)
{
data = new AlgorithmInfoData;
@@ -327,8 +327,8 @@ AlgorithmInfo::AlgorithmInfo(const string& _name, Algorithm::Constructor create)
AlgorithmInfo::~AlgorithmInfo()
{
delete data;
}
}
void AlgorithmInfo::write(const Algorithm* algo, FileStorage& fs) const
{
size_t i = 0, nparams = data->params.vec.size();
@@ -364,7 +364,7 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
{
size_t i = 0, nparams = data->params.vec.size();
AlgorithmInfo* info = algo->info();
for( i = 0; i < nparams; i++ )
{
const Param& p = data->params.vec[i].second;
@@ -414,13 +414,13 @@ void AlgorithmInfo::read(Algorithm* algo, const FileNode& fn) const
else
CV_Error( CV_StsUnsupportedFormat, "unknown/unsupported parameter type");
}
}
}
string AlgorithmInfo::name() const
{
return data->_name;
}
union GetSetParam
{
int (Algorithm::*get_int)() const;
@@ -430,7 +430,7 @@ union GetSetParam
Mat (Algorithm::*get_mat)() const;
vector<Mat> (Algorithm::*get_mat_vector)() const;
Ptr<Algorithm> (Algorithm::*get_algo)() const;
void (Algorithm::*set_int)(int);
void (Algorithm::*set_bool)(bool);
void (Algorithm::*set_double)(double);
@@ -440,15 +440,15 @@ union GetSetParam
void (Algorithm::*set_algo)(const Ptr<Algorithm>&);
};
void AlgorithmInfo::set(Algorithm* algo, const char* name, int argType, const void* value, bool force) const
void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, const void* value, bool force) const
{
const Param* p = findstr(data->params, name);
const Param* p = findstr(data->params, parameter);
if( !p )
CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", name ? name : "<NULL>") );
CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );
if( !force && p->readonly )
CV_Error_( CV_StsError, ("Parameter '%s' is readonly", name));
CV_Error_( CV_StsError, ("Parameter '%s' is readonly", parameter));
GetSetParam f;
f.set_int = p->setter;
@@ -531,23 +531,23 @@ void AlgorithmInfo::set(Algorithm* algo, const char* name, int argType, const vo
else
CV_Error(CV_StsBadArg, "Unknown/unsupported parameter type");
}
void AlgorithmInfo::get(const Algorithm* algo, const char* name, int argType, void* value) const
void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argType, void* value) const
{
const Param* p = findstr(data->params, name);
const Param* p = findstr(data->params, parameter);
if( !p )
CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", name ? name : "<NULL>") );
CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );
GetSetParam f;
f.get_int = p->getter;
if( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL )
{
if( p->type == Param::INT )
{
CV_Assert( argType == Param::INT || argType == Param::REAL );
int val = p->getter ? (algo->*f.get_int)() : *(int*)((uchar*)algo + p->offset);
if( argType == Param::INT )
*(int*)value = val;
else
@@ -557,7 +557,7 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* name, int argType, vo
{
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL );
bool val = p->getter ? (algo->*f.get_bool)() : *(bool*)((uchar*)algo + p->offset);
if( argType == Param::INT )
*(int*)value = (int)val;
else if( argType == Param::BOOLEAN )
@@ -569,35 +569,35 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* name, int argType, vo
{
CV_Assert( argType == Param::REAL );
double val = p->getter ? (algo->*f.get_double)() : *(double*)((uchar*)algo + p->offset);
*(double*)value = val;
}
}
else if( argType == Param::STRING )
{
CV_Assert( p->type == Param::STRING );
*(string*)value = p->getter ? (algo->*f.get_string)() :
*(string*)((uchar*)algo + p->offset);
}
else if( argType == Param::MAT )
{
CV_Assert( p->type == Param::MAT );
*(Mat*)value = p->getter ? (algo->*f.get_mat)() :
*(Mat*)((uchar*)algo + p->offset);
}
else if( argType == Param::MAT_VECTOR )
{
CV_Assert( p->type == Param::MAT_VECTOR );
*(vector<Mat>*)value = p->getter ? (algo->*f.get_mat_vector)() :
*(vector<Mat>*)((uchar*)algo + p->offset);
}
else if( argType == Param::ALGORITHM )
{
CV_Assert( p->type == Param::ALGORITHM );
*(Ptr<Algorithm>*)value = p->getter ? (algo->*f.get_algo)() :
*(Ptr<Algorithm>*)((uchar*)algo + p->offset);
}
@@ -605,21 +605,21 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* name, int argType, vo
CV_Error(CV_StsBadArg, "Unknown/unsupported parameter type");
}
int AlgorithmInfo::paramType(const char* name) const
int AlgorithmInfo::paramType(const char* parameter) const
{
const Param* p = findstr(data->params, name);
const Param* p = findstr(data->params, parameter);
if( !p )
CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", name ? name : "<NULL>") );
CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );
return p->type;
}
string AlgorithmInfo::paramHelp(const char* name) const
string AlgorithmInfo::paramHelp(const char* parameter) const
{
const Param* p = findstr(data->params, name);
const Param* p = findstr(data->params, parameter);
if( !p )
CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", name ? name : "<NULL>") );
CV_Error_( CV_StsBadArg, ("No parameter '%s' is found", parameter ? parameter : "<NULL>") );
return p->help;
}
@@ -628,10 +628,10 @@ void AlgorithmInfo::getParams(vector<string>& names) const
{
data->params.get_keys(names);
}
void AlgorithmInfo::addParam_(Algorithm& algo, const char* name, int argType,
void* value, bool readOnly,
void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argType,
void* value, bool readOnly,
Algorithm::Getter getter, Algorithm::Setter setter,
const string& help)
{
@@ -639,82 +639,82 @@ void AlgorithmInfo::addParam_(Algorithm& algo, const char* name, int argType,
argType == Param::REAL || argType == Param::STRING ||
argType == Param::MAT || argType == Param::MAT_VECTOR ||
argType == Param::ALGORITHM );
data->params.add(string(name), Param(argType, readOnly,
data->params.add(string(parameter), Param(argType, readOnly,
(int)((size_t)value - (size_t)(void*)&algo),
getter, setter, help));
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* name,
int& value, bool readOnly,
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
int& value, bool readOnly,
int (Algorithm::*getter)(),
void (Algorithm::*setter)(int),
const string& help)
{
addParam_(algo, name, ParamType<int>::type, &value, readOnly,
addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* name,
bool& value, bool readOnly,
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
bool& value, bool readOnly,
int (Algorithm::*getter)(),
void (Algorithm::*setter)(int),
const string& help)
{
addParam_(algo, name, ParamType<bool>::type, &value, readOnly,
addParam_(algo, parameter, ParamType<bool>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* name,
double& value, bool readOnly,
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
double& value, bool readOnly,
double (Algorithm::*getter)(),
void (Algorithm::*setter)(double),
const string& help)
{
addParam_(algo, name, ParamType<double>::type, &value, readOnly,
addParam_(algo, parameter, ParamType<double>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* name,
string& value, bool readOnly,
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
string& value, bool readOnly,
string (Algorithm::*getter)(),
void (Algorithm::*setter)(const string&),
const string& help)
{
addParam_(algo, name, ParamType<string>::type, &value, readOnly,
addParam_(algo, parameter, ParamType<string>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* name,
Mat& value, bool readOnly,
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Mat& value, bool readOnly,
Mat (Algorithm::*getter)(),
void (Algorithm::*setter)(const Mat&),
const string& help)
{
addParam_(algo, name, ParamType<Mat>::type, &value, readOnly,
addParam_(algo, parameter, ParamType<Mat>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* name,
vector<Mat>& value, bool readOnly,
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
vector<Mat>& value, bool readOnly,
vector<Mat> (Algorithm::*getter)(),
void (Algorithm::*setter)(const vector<Mat>&),
const string& help)
{
addParam_(algo, name, ParamType<vector<Mat> >::type, &value, readOnly,
addParam_(algo, parameter, ParamType<vector<Mat> >::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* name,
Ptr<Algorithm>& value, bool readOnly,
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<Algorithm>& value, bool readOnly,
Ptr<Algorithm> (Algorithm::*getter)(),
void (Algorithm::*setter)(const Ptr<Algorithm>&),
const string& help)
{
addParam_(algo, name, ParamType<Algorithm>::type, &value, readOnly,
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
}
}
/* End of file. */

View File

@@ -88,7 +88,7 @@ split_( const T* src, T** dst, int len, int cn )
dst2[i] = src[j+2]; dst3[i] = src[j+3];
}
}
for( ; k < cn; k += 4 )
{
T *dst0 = dst[k], *dst1 = dst[k+1], *dst2 = dst[k+2], *dst3 = dst[k+3];
@@ -99,7 +99,7 @@ split_( const T* src, T** dst, int len, int cn )
}
}
}
template<typename T> static void
merge_( const T** src, T* dst, int len, int cn )
{
@@ -139,7 +139,7 @@ merge_( const T** src, T* dst, int len, int cn )
dst[j+2] = src2[i]; dst[j+3] = src3[i];
}
}
for( ; k < cn; k += 4 )
{
const T *src0 = src[k], *src1 = src[k+1], *src2 = src[k+2], *src3 = src[k+3];
@@ -165,7 +165,7 @@ static void split32s(const int* src, int** dst, int len, int cn )
{
split_(src, dst, len, cn);
}
static void split64s(const int64* src, int64** dst, int len, int cn )
{
split_(src, dst, len, cn);
@@ -189,7 +189,7 @@ static void merge32s(const int** src, int* dst, int len, int cn )
static void merge64s(const int64** src, int64* dst, int len, int cn )
{
merge_(src, dst, len, cn);
}
}
typedef void (*SplitFunc)(const uchar* src, uchar** dst, int len, int cn);
typedef void (*MergeFunc)(const uchar** src, uchar* dst, int len, int cn);
@@ -205,9 +205,9 @@ static MergeFunc mergeTab[] =
(MergeFunc)GET_OPTIMIZED(merge8u), (MergeFunc)GET_OPTIMIZED(merge8u), (MergeFunc)GET_OPTIMIZED(merge16u), (MergeFunc)GET_OPTIMIZED(merge16u),
(MergeFunc)GET_OPTIMIZED(merge32s), (MergeFunc)GET_OPTIMIZED(merge32s), (MergeFunc)GET_OPTIMIZED(merge64s), 0
};
}
void cv::split(const Mat& src, Mat* mv)
{
int k, depth = src.depth(), cn = src.channels();
@@ -219,30 +219,30 @@ void cv::split(const Mat& src, Mat* mv)
SplitFunc func = splitTab[depth];
CV_Assert( func != 0 );
int esz = (int)src.elemSize(), esz1 = (int)src.elemSize1();
int blocksize0 = (BLOCK_SIZE + esz-1)/esz;
AutoBuffer<uchar> _buf((cn+1)*(sizeof(Mat*) + sizeof(uchar*)) + 16);
const Mat** arrays = (const Mat**)(uchar*)_buf;
uchar** ptrs = (uchar**)alignPtr(arrays + cn + 1, 16);
arrays[0] = &src;
for( k = 0; k < cn; k++ )
{
mv[k].create(src.dims, src.size, depth);
arrays[k+1] = &mv[k];
}
NAryMatIterator it(arrays, ptrs, cn+1);
int total = (int)it.size, blocksize = cn <= 4 ? total : std::min(total, blocksize0);
for( size_t i = 0; i < it.nplanes; i++, ++it )
{
for( int j = 0; j < total; j += blocksize )
{
int bsz = std::min(total - j, blocksize);
func( ptrs[0], &ptrs[1], bsz, cn );
if( j + blocksize < total )
{
ptrs[0] += bsz*esz;
@@ -252,7 +252,7 @@ void cv::split(const Mat& src, Mat* mv)
}
}
}
void cv::split(InputArray _m, OutputArrayOfArrays _mv)
{
Mat m = _m.getMat();
@@ -266,38 +266,38 @@ void cv::split(InputArray _m, OutputArrayOfArrays _mv)
Mat* dst = &_mv.getMatRef(0);
split(m, dst);
}
void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
{
CV_Assert( mv && n > 0 );
int depth = mv[0].depth();
bool allch1 = true;
int k, cn = 0;
size_t i;
for( i = 0; i < n; i++ )
{
CV_Assert(mv[i].size == mv[0].size && mv[i].depth() == depth);
allch1 = allch1 && mv[i].channels() == 1;
cn += mv[i].channels();
}
CV_Assert( 0 < cn && cn <= CV_CN_MAX );
_dst.create(mv[0].dims, mv[0].size, CV_MAKETYPE(depth, cn));
Mat dst = _dst.getMat();
if( n == 1 )
{
mv[0].copyTo(dst);
return;
}
if( !allch1 )
{
AutoBuffer<int> pairs(cn*2);
int j, ni=0;
for( i = 0, j = 0; i < n; i++, j += ni )
{
ni = mv[i].channels();
@@ -310,33 +310,33 @@ void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
mixChannels( mv, n, &dst, 1, &pairs[0], cn );
return;
}
size_t esz = dst.elemSize(), esz1 = dst.elemSize1();
int blocksize0 = (int)((BLOCK_SIZE + esz-1)/esz);
AutoBuffer<uchar> _buf((cn+1)*(sizeof(Mat*) + sizeof(uchar*)) + 16);
const Mat** arrays = (const Mat**)(uchar*)_buf;
uchar** ptrs = (uchar**)alignPtr(arrays + cn + 1, 16);
arrays[0] = &dst;
for( k = 0; k < cn; k++ )
arrays[k+1] = &mv[k];
NAryMatIterator it(arrays, ptrs, cn+1);
int total = (int)it.size, blocksize = cn <= 4 ? total : std::min(total, blocksize0);
MergeFunc func = mergeTab[depth];
for( i = 0; i < it.nplanes; i++, ++it )
{
for( int j = 0; j < total; j += blocksize )
{
int bsz = std::min(total - j, blocksize);
func( (const uchar**)&ptrs[1], ptrs[0], bsz, cn );
if( j + blocksize < total )
{
ptrs[0] += bsz*esz;
for( int k = 0; k < cn; k++ )
ptrs[k+1] += bsz*esz1;
for( int t = 0; t < cn; t++ )
ptrs[t+1] += bsz*esz1;
}
}
}
@@ -347,7 +347,7 @@ void cv::merge(InputArrayOfArrays _mv, OutputArray _dst)
vector<Mat> mv;
_mv.getMatVector(mv);
merge(!mv.empty() ? &mv[0] : 0, mv.size(), _dst);
}
}
/****************************************************************************************\
* Generalized split/merge: mixing channels *
@@ -387,7 +387,7 @@ mixChannels_( const T** src, const int* sdelta,
}
}
static void mixChannels8u( const uchar** src, const int* sdelta,
uchar** dst, const int* ddelta,
int len, int npairs )
@@ -408,14 +408,14 @@ static void mixChannels32s( const int** src, const int* sdelta,
{
mixChannels_(src, sdelta, dst, ddelta, len, npairs);
}
static void mixChannels64s( const int64** src, const int* sdelta,
int64** dst, const int* ddelta,
int len, int npairs )
{
mixChannels_(src, sdelta, dst, ddelta, len, npairs);
}
typedef void (*MixChannelsFunc)( const uchar** src, const int* sdelta,
uchar** dst, const int* ddelta, int len, int npairs );
@@ -423,17 +423,17 @@ static MixChannelsFunc mixchTab[] =
{
(MixChannelsFunc)mixChannels8u, (MixChannelsFunc)mixChannels8u, (MixChannelsFunc)mixChannels16u,
(MixChannelsFunc)mixChannels16u, (MixChannelsFunc)mixChannels32s, (MixChannelsFunc)mixChannels32s,
(MixChannelsFunc)mixChannels64s, 0
(MixChannelsFunc)mixChannels64s, 0
};
}
void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, const int* fromTo, size_t npairs )
{
if( npairs == 0 )
return;
CV_Assert( src && nsrcs > 0 && dst && ndsts > 0 && fromTo && npairs > 0 );
size_t i, j, k, esz1 = dst[0].elemSize1();
int depth = dst[0].depth();
@@ -444,13 +444,13 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
uchar** dsts = (uchar**)(srcs + npairs);
int* tab = (int*)(dsts + npairs);
int *sdelta = (int*)(tab + npairs*4), *ddelta = sdelta + npairs;
for( i = 0; i < nsrcs; i++ )
arrays[i] = &src[i];
for( i = 0; i < ndsts; i++ )
arrays[i + nsrcs] = &dst[i];
ptrs[nsrcs + ndsts] = 0;
for( i = 0; i < npairs; i++ )
{
int i0 = fromTo[i*2], i1 = fromTo[i*2+1];
@@ -468,7 +468,7 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
tab[i*4] = (int)(nsrcs + ndsts); tab[i*4+1] = 0;
sdelta[i] = 0;
}
for( j = 0; j < ndsts; i1 -= dst[j].channels(), j++ )
if( i1 < dst[j].channels() )
break;
@@ -480,7 +480,7 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
NAryMatIterator it(arrays, ptrs, (int)(nsrcs + ndsts));
int total = (int)it.size, blocksize = std::min(total, (int)((BLOCK_SIZE + esz1-1)/esz1));
MixChannelsFunc func = mixchTab[depth];
for( i = 0; i < it.nplanes; i++, ++it )
{
for( k = 0; k < npairs; k++ )
@@ -488,13 +488,13 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
srcs[k] = ptrs[tab[k*4]] + tab[k*4+1];
dsts[k] = ptrs[tab[k*4+2]] + tab[k*4+3];
}
for( int j = 0; j < total; j += blocksize )
for( int t = 0; t < total; t += blocksize )
{
int bsz = std::min(total - j, blocksize);
int bsz = std::min(total - t, blocksize);
func( srcs, sdelta, dsts, ddelta, bsz, (int)npairs );
if( j + blocksize < total )
if( t + blocksize < total )
for( k = 0; k < npairs; k++ )
{
srcs[k] += blocksize*sdelta[k]*esz1;
@@ -524,7 +524,7 @@ void cv::mixChannels(InputArrayOfArrays src, InputArrayOfArrays dst,
int i;
int nsrc = src_is_mat ? 1 : (int)src.total();
int ndst = dst_is_mat ? 1 : (int)dst.total();
CV_Assert(fromTo.size()%2 == 0 && nsrc > 0 && ndst > 0);
cv::AutoBuffer<Mat> _buf(nsrc + ndst);
Mat* buf = _buf;
@@ -568,7 +568,7 @@ cvtScaleAbs_( const T* src, size_t sstep,
{
sstep /= sizeof(src[0]);
dstep /= sizeof(dst[0]);
for( ; size.height--; src += sstep, dst += dstep )
{
int x = 0;
@@ -583,11 +583,11 @@ cvtScaleAbs_( const T* src, size_t sstep,
t1 = saturate_cast<DT>(std::abs(src[x+3]*scale + shift));
dst[x+2] = t0; dst[x+3] = t1;
}
#endif
#endif
for( ; x < size.width; x++ )
dst[x] = saturate_cast<DT>(std::abs(src[x]*scale + shift));
}
}
}
template<typename T, typename DT, typename WT> static void
@@ -597,7 +597,7 @@ cvtScale_( const T* src, size_t sstep,
{
sstep /= sizeof(src[0]);
dstep /= sizeof(dst[0]);
for( ; size.height--; src += sstep, dst += dstep )
{
int x = 0;
@@ -623,38 +623,38 @@ cvtScale_( const T* src, size_t sstep,
template<> void
cvtScale_<short, short, float>( const short* src, size_t sstep,
short* dst, size_t dstep, Size size,
float scale, float shift )
float scale, float shift )
{
sstep /= sizeof(src[0]);
dstep /= sizeof(dst[0]);
for( ; size.height--; src += sstep, dst += dstep )
for( ; size.height--; src += sstep, dst += dstep )
{
int x = 0;
#if CV_SSE2
if(USE_SSE2)
#if CV_SSE2
if(USE_SSE2)
{
__m128 scale128 = _mm_set1_ps (scale);
__m128 shift128 = _mm_set1_ps (shift);
for(; x <= size.width - 8; x += 8 )
{
__m128i r0 = _mm_loadl_epi64((const __m128i*)(src + x));
for(; x <= size.width - 8; x += 8 )
{
__m128i r0 = _mm_loadl_epi64((const __m128i*)(src + x));
__m128i r1 = _mm_loadl_epi64((const __m128i*)(src + x + 4));
__m128 rf0 =_mm_cvtepi32_ps(_mm_srai_epi32(_mm_unpacklo_epi16(r0, r0), 16));
__m128 rf0 =_mm_cvtepi32_ps(_mm_srai_epi32(_mm_unpacklo_epi16(r0, r0), 16));
__m128 rf1 =_mm_cvtepi32_ps(_mm_srai_epi32(_mm_unpacklo_epi16(r1, r1), 16));
rf0 = _mm_add_ps(_mm_mul_ps(rf0, scale128), shift128);
rf1 = _mm_add_ps(_mm_mul_ps(rf1, scale128), shift128);
r0 = _mm_cvtps_epi32(rf0);
r1 = _mm_cvtps_epi32(rf1);
r0 = _mm_packs_epi32(r0, r1);
_mm_storeu_si128((__m128i*)(dst + x), r0);
}
}
r0 = _mm_cvtps_epi32(rf0);
r1 = _mm_cvtps_epi32(rf1);
r0 = _mm_packs_epi32(r0, r1);
_mm_storeu_si128((__m128i*)(dst + x), r0);
}
}
#endif
for(; x < size.width; x++ )
dst[x] = saturate_cast<short>(src[x]*scale + shift);
}
}
}
@@ -664,21 +664,21 @@ cvt_( const T* src, size_t sstep,
{
sstep /= sizeof(src[0]);
dstep /= sizeof(dst[0]);
for( ; size.height--; src += sstep, dst += dstep )
{
int x = 0;
#if CV_ENABLE_UNROLLED
for( ; x <= size.width - 4; x += 4 )
{
DT t0, t1;
t0 = saturate_cast<DT>(src[x]);
t1 = saturate_cast<DT>(src[x+1]);
dst[x] = t0; dst[x+1] = t1;
t0 = saturate_cast<DT>(src[x+2]);
t1 = saturate_cast<DT>(src[x+3]);
dst[x+2] = t0; dst[x+3] = t1;
}
#if CV_ENABLE_UNROLLED
for( ; x <= size.width - 4; x += 4 )
{
DT t0, t1;
t0 = saturate_cast<DT>(src[x]);
t1 = saturate_cast<DT>(src[x+1]);
dst[x] = t0; dst[x+1] = t1;
t0 = saturate_cast<DT>(src[x+2]);
t1 = saturate_cast<DT>(src[x+3]);
dst[x+2] = t0; dst[x+3] = t1;
}
#endif
for( ; x < size.width; x++ )
dst[x] = saturate_cast<DT>(src[x]);
@@ -692,24 +692,24 @@ cvt_<float, short>( const float* src, size_t sstep,
{
sstep /= sizeof(src[0]);
dstep /= sizeof(dst[0]);
for( ; size.height--; src += sstep, dst += dstep )
{
int x = 0;
#if CV_SSE2
if(USE_SSE2){
for( ; x <= size.width - 8; x += 8 )
{
__m128 src128 = _mm_loadu_ps (src + x);
__m128i src_int128 = _mm_cvtps_epi32 (src128);
src128 = _mm_loadu_ps (src + x + 4);
__m128i src1_int128 = _mm_cvtps_epi32 (src128);
src1_int128 = _mm_packs_epi32(src_int128, src1_int128);
_mm_storeu_si128((__m128i*)(dst + x),src1_int128);
}
}
#if CV_SSE2
if(USE_SSE2){
for( ; x <= size.width - 8; x += 8 )
{
__m128 src128 = _mm_loadu_ps (src + x);
__m128i src_int128 = _mm_cvtps_epi32 (src128);
src128 = _mm_loadu_ps (src + x + 4);
__m128i src1_int128 = _mm_cvtps_epi32 (src128);
src1_int128 = _mm_packs_epi32(src_int128, src1_int128);
_mm_storeu_si128((__m128i*)(dst + x),src1_int128);
}
}
#endif
for( ; x < size.width; x++ )
dst[x] = saturate_cast<short>(src[x]);
@@ -723,11 +723,11 @@ cpy_( const T* src, size_t sstep, T* dst, size_t dstep, Size size )
{
sstep /= sizeof(src[0]);
dstep /= sizeof(dst[0]);
for( ; size.height--; src += sstep, dst += dstep )
memcpy(dst, src, size.width*sizeof(src[0]));
}
#define DEF_CVT_SCALE_ABS_FUNC(suffix, tfunc, stype, dtype, wtype) \
static void cvtScaleAbs##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
dtype* dst, size_t dstep, Size size, double* scale) \
@@ -741,8 +741,8 @@ dtype* dst, size_t dstep, Size size, double* scale) \
{ \
cvtScale_(src, sstep, dst, dstep, size, (wtype)scale[0], (wtype)scale[1]); \
}
#define DEF_CVT_FUNC(suffix, stype, dtype) \
static void cvt##suffix( const stype* src, size_t sstep, const uchar*, size_t, \
dtype* dst, size_t dstep, Size size, double*) \
@@ -756,15 +756,15 @@ stype* dst, size_t dstep, Size size, double*) \
{ \
cpy_(src, sstep, dst, dstep, size); \
}
DEF_CVT_SCALE_ABS_FUNC(8u, cvtScaleAbs_, uchar, uchar, float);
DEF_CVT_SCALE_ABS_FUNC(8s8u, cvtScaleAbs_, schar, uchar, float);
DEF_CVT_SCALE_ABS_FUNC(16u8u, cvtScaleAbs_, ushort, uchar, float);
DEF_CVT_SCALE_ABS_FUNC(16s8u, cvtScaleAbs_, short, uchar, float);
DEF_CVT_SCALE_ABS_FUNC(32s8u, cvtScaleAbs_, int, uchar, float);
DEF_CVT_SCALE_ABS_FUNC(32f8u, cvtScaleAbs_, float, uchar, float);
DEF_CVT_SCALE_ABS_FUNC(64f8u, cvtScaleAbs_, double, uchar, float);
DEF_CVT_SCALE_ABS_FUNC(64f8u, cvtScaleAbs_, double, uchar, float);
DEF_CVT_SCALE_FUNC(8u, uchar, uchar, float);
DEF_CVT_SCALE_FUNC(8s8u, schar, uchar, float);
@@ -772,7 +772,7 @@ DEF_CVT_SCALE_FUNC(16u8u, ushort, uchar, float);
DEF_CVT_SCALE_FUNC(16s8u, short, uchar, float);
DEF_CVT_SCALE_FUNC(32s8u, int, uchar, float);
DEF_CVT_SCALE_FUNC(32f8u, float, uchar, float);
DEF_CVT_SCALE_FUNC(64f8u, double, uchar, float);
DEF_CVT_SCALE_FUNC(64f8u, double, uchar, float);
DEF_CVT_SCALE_FUNC(8u8s, uchar, schar, float);
DEF_CVT_SCALE_FUNC(8s, schar, schar, float);
@@ -780,7 +780,7 @@ DEF_CVT_SCALE_FUNC(16u8s, ushort, schar, float);
DEF_CVT_SCALE_FUNC(16s8s, short, schar, float);
DEF_CVT_SCALE_FUNC(32s8s, int, schar, float);
DEF_CVT_SCALE_FUNC(32f8s, float, schar, float);
DEF_CVT_SCALE_FUNC(64f8s, double, schar, float);
DEF_CVT_SCALE_FUNC(64f8s, double, schar, float);
DEF_CVT_SCALE_FUNC(8u16u, uchar, ushort, float);
DEF_CVT_SCALE_FUNC(8s16u, schar, ushort, float);
@@ -788,7 +788,7 @@ DEF_CVT_SCALE_FUNC(16u, ushort, ushort, float);
DEF_CVT_SCALE_FUNC(16s16u, short, ushort, float);
DEF_CVT_SCALE_FUNC(32s16u, int, ushort, float);
DEF_CVT_SCALE_FUNC(32f16u, float, ushort, float);
DEF_CVT_SCALE_FUNC(64f16u, double, ushort, float);
DEF_CVT_SCALE_FUNC(64f16u, double, ushort, float);
DEF_CVT_SCALE_FUNC(8u16s, uchar, short, float);
DEF_CVT_SCALE_FUNC(8s16s, schar, short, float);
@@ -797,7 +797,7 @@ DEF_CVT_SCALE_FUNC(16s, short, short, float);
DEF_CVT_SCALE_FUNC(32s16s, int, short, float);
DEF_CVT_SCALE_FUNC(32f16s, float, short, float);
DEF_CVT_SCALE_FUNC(64f16s, double, short, float);
DEF_CVT_SCALE_FUNC(8u32s, uchar, int, float);
DEF_CVT_SCALE_FUNC(8s32s, schar, int, float);
DEF_CVT_SCALE_FUNC(16u32s, ushort, int, float);
@@ -874,7 +874,7 @@ DEF_CVT_FUNC(16s64f, short, double);
DEF_CVT_FUNC(32s64f, int, double);
DEF_CVT_FUNC(32f64f, float, double);
DEF_CPY_FUNC(64s, int64);
static BinaryFunc cvtScaleAbsTab[] =
{
(BinaryFunc)cvtScaleAbs8u, (BinaryFunc)cvtScaleAbs8s8u, (BinaryFunc)cvtScaleAbs16u8u,
@@ -965,7 +965,7 @@ static BinaryFunc cvtTab[][8] =
0, 0, 0, 0, 0, 0, 0, 0
}
};
BinaryFunc getConvertFunc(int sdepth, int ddepth)
{
return cvtTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)];
@@ -974,10 +974,10 @@ BinaryFunc getConvertFunc(int sdepth, int ddepth)
BinaryFunc getConvertScaleFunc(int sdepth, int ddepth)
{
return cvtScaleTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)];
}
}
}
void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, double beta )
{
Mat src = _src.getMat();
@@ -987,7 +987,7 @@ void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, doubl
Mat dst = _dst.getMat();
BinaryFunc func = cvtScaleAbsTab[src.depth()];
CV_Assert( func != 0 );
if( src.dims <= 2 )
{
Size sz = getContinuousSize(src, dst, cn);
@@ -999,7 +999,7 @@ void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, doubl
uchar* ptrs[2];
NAryMatIterator it(arrays, ptrs);
Size sz((int)it.size*cn, 1);
for( size_t i = 0; i < it.nplanes; i++, ++it )
func( ptrs[0], 0, 0, 0, ptrs[1], 0, sz, scale );
}
@@ -1022,12 +1022,12 @@ void cv::Mat::convertTo(OutputArray _dst, int _type, double alpha, double beta)
}
Mat src = *this;
BinaryFunc func = noScale ? getConvertFunc(sdepth, ddepth) : getConvertScaleFunc(sdepth, ddepth);
double scale[] = {alpha, beta};
int cn = channels();
CV_Assert( func != 0 );
if( dims <= 2 )
{
_dst.create( size(), _type );
@@ -1043,7 +1043,7 @@ void cv::Mat::convertTo(OutputArray _dst, int _type, double alpha, double beta)
uchar* ptrs[2];
NAryMatIterator it(arrays, ptrs);
Size sz((int)(it.size*cn), 1);
for( size_t i = 0; i < it.nplanes; i++, ++it )
func(ptrs[0], 0, 0, 0, ptrs[1], 0, sz, scale);
}
@@ -1105,10 +1105,10 @@ static void LUT8u_32f( const uchar* src, const float* lut, float* dst, int len,
static void LUT8u_64f( const uchar* src, const double* lut, double* dst, int len, int cn, int lutcn )
{
LUT8u_( src, lut, dst, len, cn, lutcn );
}
}
typedef void (*LUTFunc)( const uchar* src, const uchar* lut, uchar* dst, int len, int cn, int lutcn );
static LUTFunc lutTab[] =
{
(LUTFunc)LUT8u_8u, (LUTFunc)LUT8u_8s, (LUTFunc)LUT8u_16u, (LUTFunc)LUT8u_16s,
@@ -1116,7 +1116,7 @@ static LUTFunc lutTab[] =
};
}
void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst, int interpolation )
{
Mat src = _src.getMat(), lut = _lut.getMat();
@@ -1132,12 +1132,12 @@ void cv::LUT( InputArray _src, InputArray _lut, OutputArray _dst, int interpolat
LUTFunc func = lutTab[lut.depth()];
CV_Assert( func != 0 );
const Mat* arrays[] = {&src, &dst, 0};
uchar* ptrs[2];
NAryMatIterator it(arrays, ptrs);
int len = (int)it.size;
for( size_t i = 0; i < it.nplanes; i++, ++it )
func(ptrs[0], lut.data, ptrs[1], len, cn, lutcn);
}
@@ -1147,7 +1147,7 @@ void cv::normalize( InputArray _src, OutputArray _dst, double a, double b,
int norm_type, int rtype, InputArray _mask )
{
Mat src = _src.getMat(), mask = _mask.getMat();
double scale = 1, shift = 0;
if( norm_type == CV_MINMAX )
{
@@ -1165,13 +1165,13 @@ void cv::normalize( InputArray _src, OutputArray _dst, double a, double b,
}
else
CV_Error( CV_StsBadArg, "Unknown/unsupported norm type" );
if( rtype < 0 )
rtype = _dst.fixedType() ? _dst.depth() : src.depth();
_dst.create(src.dims, src.size, CV_MAKETYPE(rtype, src.channels()));
Mat dst = _dst.getMat();
if( !mask.data )
src.convertTo( dst, rtype, scale, shift );
else
@@ -1282,7 +1282,7 @@ cvConvertScale( const void* srcarr, void* dstarr,
double scale, double shift )
{
cv::Mat src = cv::cvarrToMat(srcarr), dst = cv::cvarrToMat(dstarr);
CV_Assert( src.size == dst.size && src.channels() == dst.channels() );
src.convertTo(dst, dst.type(), scale, shift);
}

View File

@@ -59,7 +59,7 @@ copyMask_(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep, ucha
const T* src = (const T*)_src;
T* dst = (T*)_dst;
int x = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; x <= size.width - 4; x += 4 )
{
if( mask[x] )
@@ -96,16 +96,16 @@ copyMaskGeneric(const uchar* _src, size_t sstep, const uchar* mask, size_t mstep
}
}
}
#define DEF_COPY_MASK(suffix, type) \
static void copyMask##suffix(const uchar* src, size_t sstep, const uchar* mask, size_t mstep, \
uchar* dst, size_t dstep, Size size, void*) \
{ \
copyMask_<type>(src, sstep, mask, mstep, dst, dstep, size); \
}
DEF_COPY_MASK(8u, uchar);
DEF_COPY_MASK(16u, ushort);
DEF_COPY_MASK(8uC3, Vec3b);
@@ -116,7 +116,7 @@ DEF_COPY_MASK(32sC3, Vec3i);
DEF_COPY_MASK(32sC4, Vec4i);
DEF_COPY_MASK(32sC6, Vec6i);
DEF_COPY_MASK(32sC8, Vec8i);
BinaryFunc copyMaskTab[] =
{
0,
@@ -137,7 +137,7 @@ BinaryFunc copyMaskTab[] =
0, 0, 0, 0, 0, 0, 0,
copyMask32sC8
};
BinaryFunc getCopyMaskFunc(size_t esz)
{
return esz <= 32 && copyMaskTab[esz] ? copyMaskTab[esz] : copyMaskGeneric;
@@ -152,51 +152,51 @@ void Mat::copyTo( OutputArray _dst ) const
convertTo( _dst, dtype );
return;
}
if( empty() )
{
_dst.release();
return;
}
if( dims <= 2 )
{
_dst.create( rows, cols, type() );
Mat dst = _dst.getMat();
if( data == dst.data )
return;
if( rows > 0 && cols > 0 )
{
const uchar* sptr = data;
uchar* dptr = dst.data;
// to handle the copying 1xn matrix => nx1 std vector.
Size sz = size() == dst.size() ?
getContinuousSize(*this, dst) :
getContinuousSize(*this);
size_t len = sz.width*elemSize();
for( ; sz.height--; sptr += step, dptr += dst.step )
memcpy( dptr, sptr, len );
}
return;
}
_dst.create( dims, size, type() );
Mat dst = _dst.getMat();
if( data == dst.data )
return;
if( total() != 0 )
{
const Mat* arrays[] = { this, &dst };
uchar* ptrs[2];
NAryMatIterator it(arrays, ptrs, 2);
size_t size = it.size*elemSize();
size_t sz = it.size*elemSize();
for( size_t i = 0; i < it.nplanes; i++, ++it )
memcpy(ptrs[1], ptrs[0], size);
memcpy(ptrs[1], ptrs[0], sz);
}
}
@@ -208,33 +208,33 @@ void Mat::copyTo( OutputArray _dst, InputArray _mask ) const
copyTo(_dst);
return;
}
int cn = channels(), mcn = mask.channels();
CV_Assert( mask.depth() == CV_8U && (mcn == 1 || mcn == cn) );
bool colorMask = mcn > 1;
size_t esz = colorMask ? elemSize1() : elemSize();
BinaryFunc copymask = getCopyMaskFunc(esz);
uchar* data0 = _dst.getMat().data;
_dst.create( dims, size, type() );
Mat dst = _dst.getMat();
if( dst.data != data0 ) // do not leave dst uninitialized
dst = Scalar(0);
if( dims <= 2 )
{
Size sz = getContinuousSize(*this, dst, mask, mcn);
copymask(data, step, mask.data, mask.step, dst.data, dst.step, sz, &esz);
return;
}
const Mat* arrays[] = { this, &dst, &mask, 0 };
uchar* ptrs[3];
NAryMatIterator it(arrays, ptrs);
Size sz((int)(it.size*mcn), 1);
for( size_t i = 0; i < it.nplanes; i++, ++it )
copymask(ptrs[0], 0, ptrs[2], 0, ptrs[1], 0, sz, &esz);
}
@@ -242,14 +242,14 @@ void Mat::copyTo( OutputArray _dst, InputArray _mask ) const
Mat& Mat::operator = (const Scalar& s)
{
const Mat* arrays[] = { this };
uchar* ptr;
NAryMatIterator it(arrays, &ptr, 1);
size_t size = it.size*elemSize();
uchar* dptr;
NAryMatIterator it(arrays, &dptr, 1);
size_t elsize = it.size*elemSize();
if( s[0] == 0 && s[1] == 0 && s[2] == 0 && s[3] == 0 )
{
for( size_t i = 0; i < it.nplanes; i++, ++it )
memset( ptr, 0, size );
memset( dptr, 0, elsize );
}
else
{
@@ -258,50 +258,50 @@ Mat& Mat::operator = (const Scalar& s)
double scalar[12];
scalarToRawData(s, scalar, type(), 12);
size_t blockSize = 12*elemSize1();
for( size_t j = 0; j < size; j += blockSize )
for( size_t j = 0; j < elsize; j += blockSize )
{
size_t sz = MIN(blockSize, size - j);
memcpy( ptr + j, scalar, sz );
size_t sz = MIN(blockSize, elsize - j);
memcpy( dptr + j, scalar, sz );
}
}
for( size_t i = 1; i < it.nplanes; i++ )
{
++it;
memcpy( ptr, data, size );
memcpy( dptr, data, elsize );
}
}
return *this;
}
Mat& Mat::setTo(InputArray _value, InputArray _mask)
{
if( !data )
return *this;
Mat value = _value.getMat(), mask = _mask.getMat();
CV_Assert( checkScalar(value, type(), _value.kind(), _InputArray::MAT ));
CV_Assert( mask.empty() || mask.type() == CV_8U );
size_t esz = elemSize();
BinaryFunc copymask = getCopyMaskFunc(esz);
const Mat* arrays[] = { this, !mask.empty() ? &mask : 0, 0 };
uchar* ptrs[2]={0,0};
NAryMatIterator it(arrays, ptrs);
int total = (int)it.size, blockSize0 = std::min(total, (int)((BLOCK_SIZE + esz-1)/esz));
int totalsz = (int)it.size, blockSize0 = std::min(totalsz, (int)((BLOCK_SIZE + esz-1)/esz));
AutoBuffer<uchar> _scbuf(blockSize0*esz + 32);
uchar* scbuf = alignPtr((uchar*)_scbuf, (int)sizeof(double));
convertAndUnrollScalar( value, type(), scbuf, blockSize0 );
for( size_t i = 0; i < it.nplanes; i++, ++it )
{
for( int j = 0; j < total; j += blockSize0 )
for( int j = 0; j < totalsz; j += blockSize0 )
{
Size sz(std::min(blockSize0, total - j), 1);
Size sz(std::min(blockSize0, totalsz - j), 1);
size_t blockSize = sz.width*esz;
if( ptrs[1] )
{
@@ -323,7 +323,7 @@ flipHoriz( const uchar* src, size_t sstep, uchar* dst, size_t dstep, Size size,
int i, j, limit = (int)(((size.width + 1)/2)*esz);
AutoBuffer<int> _tab(size.width*esz);
int* tab = _tab;
for( i = 0; i < size.width; i++ )
for( size_t k = 0; k < esz; k++ )
tab[i*esz + k] = (int)((size.width - i - 1)*esz + k);
@@ -403,7 +403,7 @@ flipVert( const uchar* src0, size_t sstep, uchar* dst0, size_t dstep, Size size,
void flip( InputArray _src, OutputArray _dst, int flip_mode )
{
Mat src = _src.getMat();
CV_Assert( src.dims <= 2 );
_dst.create( src.size(), src.type() );
Mat dst = _dst.getMat();
@@ -413,7 +413,7 @@ void flip( InputArray _src, OutputArray _dst, int flip_mode )
flipVert( src.data, src.step, dst.data, dst.step, src.size(), esz );
else
flipHoriz( src.data, src.step, dst.data, dst.step, src.size(), esz );
if( flip_mode < 0 )
flipHoriz( dst.data, dst.step, dst.data, dst.step, dst.size(), esz );
}
@@ -423,7 +423,7 @@ void repeat(InputArray _src, int ny, int nx, OutputArray _dst)
{
Mat src = _src.getMat();
CV_Assert( src.dims <= 2 );
_dst.create(src.rows*ny, src.cols*nx, src.type());
Mat dst = _dst.getMat();
Size ssize = src.size(), dsize = dst.size();
@@ -493,25 +493,25 @@ cvCopy( const void* srcarr, void* dstarr, const void* maskarr )
}
cv::Mat src = cv::cvarrToMat(srcarr, false, true, 1), dst = cv::cvarrToMat(dstarr, false, true, 1);
CV_Assert( src.depth() == dst.depth() && src.size == dst.size );
int coi1 = 0, coi2 = 0;
if( CV_IS_IMAGE(srcarr) )
coi1 = cvGetImageCOI((const IplImage*)srcarr);
if( CV_IS_IMAGE(dstarr) )
coi2 = cvGetImageCOI((const IplImage*)dstarr);
if( coi1 || coi2 )
{
CV_Assert( (coi1 != 0 || src.channels() == 1) &&
(coi2 != 0 || dst.channels() == 1) );
int pair[] = { std::max(coi1-1, 0), std::max(coi2-1, 0) };
cv::mixChannels( &src, 1, &dst, 1, pair, 1 );
return;
}
else
CV_Assert( src.channels() == dst.channels() );
if( !maskarr )
src.copyTo(dst);
else
@@ -548,12 +548,12 @@ cvFlip( const CvArr* srcarr, CvArr* dstarr, int flip_mode )
{
cv::Mat src = cv::cvarrToMat(srcarr);
cv::Mat dst;
if (!dstarr)
dst = src;
else
dst = cv::cvarrToMat(dstarr);
CV_Assert( src.type() == dst.type() && src.size() == dst.size() );
cv::flip( src, dst, flip_mode );
}

View File

@@ -3349,7 +3349,7 @@ cvTreeToNodeSeq( const void* first, int header_size, CvMemStorage* storage )
}
}
return allseq;
}
@@ -3531,9 +3531,9 @@ namespace cv
// both cv (CvFeatureTree) and ml (kNN).
// The algorithm is taken from:
// J.S. Beis and D.G. Lowe. Shape indexing using approximate nearest-neighbor search
// in highdimensional spaces. In Proc. IEEE Conf. Comp. Vision Patt. Recog.,
// pages 1000--1006, 1997. http://citeseer.ist.psu.edu/beis97shape.html
// J.S. Beis and D.G. Lowe. Shape indexing using approximate nearest-neighbor search
// in highdimensional spaces. In Proc. IEEE Conf. Comp. Vision Patt. Recog.,
// pages 1000--1006, 1997. http://citeseer.ist.psu.edu/beis97shape.html
const int MAX_TREE_DEPTH = 32;
@@ -3555,8 +3555,8 @@ KDTree::KDTree(InputArray _points, InputArray _labels, bool _copyData)
maxDepth = -1;
normType = NORM_L2;
build(_points, _labels, _copyData);
}
}
struct SubTree
{
SubTree() : first(0), last(0), nodeIdx(0), depth(0) {}
@@ -3596,7 +3596,7 @@ medianPartition( size_t* ofs, int a, int b, const float* vals )
else
a = i0;
}
float pivot = vals[ofs[middle]];
int less = 0, more = 0;
for( k = a0; k < middle; k++ )
@@ -3632,7 +3632,7 @@ computeSums( const Mat& points, const size_t* ofs, int a, int b, double* sums )
}
}
void KDTree::build(InputArray _points, bool _copyData)
{
build(_points, noArray(), _copyData);
@@ -3652,8 +3652,8 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
points.release();
points.create(_points.size(), _points.type());
}
int i, j, n = _points.rows, dims = _points.cols, top = 0;
int i, j, n = _points.rows, ptdims = _points.cols, top = 0;
const float* data = _points.ptr<float>(0);
float* dstdata = points.ptr<float>(0);
size_t step = _points.step1();
@@ -3661,7 +3661,7 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
int ptpos = 0;
labels.resize(n);
const int* _labels_data = 0;
if( !_labels.empty() )
{
int nlabels = _labels.checkVector(1, CV_32S, true);
@@ -3669,9 +3669,9 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
_labels_data = (const int*)_labels.data;
}
Mat sumstack(MAX_TREE_DEPTH*2, dims*2, CV_64F);
Mat sumstack(MAX_TREE_DEPTH*2, ptdims*2, CV_64F);
SubTree stack[MAX_TREE_DEPTH*2];
vector<size_t> _ptofs(n);
size_t* ptofs = &_ptofs[0];
@@ -3682,7 +3682,7 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
computeSums(points, ptofs, 0, n-1, sumstack.ptr<double>(top));
stack[top++] = SubTree(0, n-1, 0, 0);
int _maxDepth = 0;
while( --top >= 0 )
{
int first = stack[top].first, last = stack[top].last;
@@ -3700,16 +3700,16 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
{
const float* src = data + ptofs[first];
float* dst = dstdata + idx*dstep;
for( j = 0; j < dims; j++ )
for( j = 0; j < ptdims; j++ )
dst[j] = src[j];
}
labels[idx] = _labels_data ? _labels_data[idx0] : idx0;
labels[idx] = _labels_data ? _labels_data[idx0] : idx0;
_maxDepth = std::max(_maxDepth, depth);
continue;
}
// find the dimensionality with the biggest variance
for( j = 0; j < dims; j++ )
for( j = 0; j < ptdims; j++ )
{
double m = sums[j*2]*invCount;
double varj = sums[j*2+1]*invCount - m*m;
@@ -3729,9 +3729,9 @@ void KDTree::build(InputArray __points, InputArray __labels, bool _copyData)
nodes[nidx].boundary = medianPartition(ptofs, first, last, data + dim);
int middle = (first + last)/2;
double *lsums = (double*)sums, *rsums = lsums + dims*2;
double *lsums = (double*)sums, *rsums = lsums + ptdims*2;
computeSums(points, ptofs, middle+1, last, rsums);
for( j = 0; j < dims*2; j++ )
for( j = 0; j < ptdims*2; j++ )
lsums[j] = sums[j] - rsums[j];
stack[top++] = SubTree(first, middle, left, depth+1);
stack[top++] = SubTree(middle+1, last, right, depth+1);
@@ -3752,13 +3752,13 @@ struct PQueueElem
int KDTree::findNearest(InputArray _vec, int K, int emax,
OutputArray _neighborsIdx, OutputArray _neighbors,
OutputArray _dist, OutputArray _labels) const
{
Mat vecmat = _vec.getMat();
CV_Assert( vecmat.isContinuous() && vecmat.type() == CV_32F && vecmat.total() == (size_t)points.cols );
const float* vec = vecmat.ptr<float>();
K = std::min(K, points.rows);
int dims = points.cols;
int ptdims = points.cols;
CV_Assert(K > 0 && (normType == NORM_L2 || normType == NORM_L1));
@@ -3776,7 +3776,7 @@ int KDTree::findNearest(InputArray _vec, int K, int emax,
{
float d, alt_d = 0.f;
int nidx;
if( e == 0 )
nidx = 0;
else
@@ -3803,7 +3803,7 @@ int KDTree::findNearest(InputArray _vec, int K, int emax,
i = left;
}
}
if( ncount == K && alt_d > dist[ncount-1] )
continue;
}
@@ -3813,21 +3813,21 @@ int KDTree::findNearest(InputArray _vec, int K, int emax,
if( nidx < 0 )
break;
const Node& n = nodes[nidx];
if( n.idx < 0 )
{
i = ~n.idx;
const float* row = points.ptr<float>(i);
if( normType == NORM_L2 )
for( j = 0, d = 0.f; j < dims; j++ )
for( j = 0, d = 0.f; j < ptdims; j++ )
{
float t = vec[j] - row[j];
d += t*t;
}
else
for( j = 0, d = 0.f; j < dims; j++ )
for( j = 0, d = 0.f; j < ptdims; j++ )
d += std::abs(vec[j] - row[j]);
dist[ncount] = d;
idx[ncount] = i;
for( i = ncount-1; i >= 0; i-- )
@@ -3839,9 +3839,9 @@ int KDTree::findNearest(InputArray _vec, int K, int emax,
}
ncount += ncount < K;
e++;
break;
break;
}
int alt;
if( vec[n.idx] <= n.boundary )
{
@@ -3853,7 +3853,7 @@ int KDTree::findNearest(InputArray _vec, int K, int emax,
nidx = n.right;
alt = n.left;
}
d = vec[n.idx] - n.boundary;
if( normType == NORM_L2 )
d = d*d + alt_d;
@@ -3898,22 +3898,22 @@ void KDTree::findOrthoRange(InputArray _lowerBound,
OutputArray _neighbors,
OutputArray _labels ) const
{
int dims = points.cols;
int ptdims = points.cols;
Mat lowerBound = _lowerBound.getMat(), upperBound = _upperBound.getMat();
CV_Assert( lowerBound.size == upperBound.size &&
lowerBound.isContinuous() &&
upperBound.isContinuous() &&
lowerBound.type() == upperBound.type() &&
lowerBound.type() == CV_32F &&
lowerBound.total() == (size_t)dims );
lowerBound.total() == (size_t)ptdims );
const float* L = lowerBound.ptr<float>();
const float* R = upperBound.ptr<float>();
vector<int> idx;
AutoBuffer<int> _stack(MAX_TREE_DEPTH*2 + 1);
int* stack = _stack;
int top = 0;
stack[top++] = 0;
while( --top >= 0 )
@@ -3926,10 +3926,10 @@ void KDTree::findOrthoRange(InputArray _lowerBound,
{
int j, i = ~n.idx;
const float* row = points.ptr<float>(i);
for( j = 0; j < dims; j++ )
for( j = 0; j < ptdims; j++ )
if( row[j] < L[j] || row[j] >= R[j] )
break;
if( j == dims )
if( j == ptdims )
idx.push_back(i);
continue;
}
@@ -3948,7 +3948,7 @@ void KDTree::findOrthoRange(InputArray _lowerBound,
getPoints( idx, _neighbors, _labels );
}
void KDTree::getPoints(InputArray _idx, OutputArray _pts, OutputArray _labels) const
{
Mat idxmat = _idx.getMat(), pts, labelsmat;
@@ -3956,8 +3956,8 @@ void KDTree::getPoints(InputArray _idx, OutputArray _pts, OutputArray _labels) c
(idxmat.cols == 1 || idxmat.rows == 1) );
const int* idx = idxmat.ptr<int>();
int* dstlabels = 0;
int dims = points.cols;
int ptdims = points.cols;
int i, nidx = (int)idxmat.total();
if( nidx == 0 )
{
@@ -3965,13 +3965,13 @@ void KDTree::getPoints(InputArray _idx, OutputArray _pts, OutputArray _labels) c
_labels.release();
return;
}
if( _pts.needed() )
{
_pts.create( nidx, dims, points.type());
_pts.create( nidx, ptdims, points.type());
pts = _pts.getMat();
}
if(_labels.needed())
{
_labels.create(nidx, 1, CV_32S, -1, true);
@@ -3980,14 +3980,14 @@ void KDTree::getPoints(InputArray _idx, OutputArray _pts, OutputArray _labels) c
dstlabels = labelsmat.ptr<int>();
}
const int* srclabels = !labels.empty() ? &labels[0] : 0;
for( i = 0; i < nidx; i++ )
{
int k = idx[i];
CV_Assert( (unsigned)k < (unsigned)points.rows );
const float* src = points.ptr<float>(k);
if( pts.data )
std::copy(src, src + dims, pts.ptr<float>(i));
std::copy(src, src + ptdims, pts.ptr<float>(i));
if( dstlabels )
dstlabels[i] = srclabels ? srclabels[k] : k;
}
@@ -4007,9 +4007,9 @@ int KDTree::dims() const
{
return !points.empty() ? points.cols : 0;
}
////////////////////////////////////////////////////////////////////////////////
schar* seqPush( CvSeq* seq, const void* element )
{
return cvSeqPush(seq, element);

View File

@@ -169,7 +169,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
}
int bt_pix0 = (int)img.elemSize(), bt_pix = bt_pix0;
size_t step = img.step;
size_t istep = img.step;
int dx = pt2.x - pt1.x;
int dy = pt2.y - pt1.y;
@@ -188,11 +188,11 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
bt_pix = (bt_pix ^ s) - s;
}
ptr = (uchar*)(img.data + pt1.y * step + pt1.x * bt_pix0);
ptr = (uchar*)(img.data + pt1.y * istep + pt1.x * bt_pix0);
s = dy < 0 ? -1 : 0;
dy = (dy ^ s) - s;
step = (step ^ s) - s;
istep = (istep ^ s) - s;
s = dy > dx ? -1 : 0;
@@ -201,9 +201,9 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
dy ^= dx & s;
dx ^= dy & s;
bt_pix ^= step & s;
step ^= bt_pix & s;
bt_pix ^= step & s;
bt_pix ^= istep & s;
istep ^= bt_pix & s;
bt_pix ^= istep & s;
if( connectivity == 8 )
{
@@ -212,7 +212,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
err = dx - (dy + dy);
plusDelta = dx + dx;
minusDelta = -(dy + dy);
plusStep = (int)step;
plusStep = (int)istep;
minusStep = bt_pix;
count = dx + 1;
}
@@ -223,7 +223,7 @@ LineIterator::LineIterator(const Mat& img, Point pt1, Point pt2,
err = 0;
plusDelta = (dx + dx) + (dy + dy);
minusDelta = -(dy + dy);
plusStep = (int)step - bt_pix;
plusStep = (int)istep - bt_pix;
minusStep = bt_pix;
count = dx + dy + 1;
}

View File

@@ -524,30 +524,30 @@ cv::gpu::GpuMat::GpuMat(Size size_, int type_, void* data_, size_t step_) :
dataend += step * (rows - 1) + minstep;
}
cv::gpu::GpuMat::GpuMat(const GpuMat& m, Range rowRange, Range colRange)
cv::gpu::GpuMat::GpuMat(const GpuMat& m, Range _rowRange, Range _colRange)
{
flags = m.flags;
step = m.step; refcount = m.refcount;
data = m.data; datastart = m.datastart; dataend = m.dataend;
if (rowRange == Range::all())
if (_rowRange == Range::all())
rows = m.rows;
else
{
CV_Assert(0 <= rowRange.start && rowRange.start <= rowRange.end && rowRange.end <= m.rows);
CV_Assert(0 <= _rowRange.start && _rowRange.start <= _rowRange.end && _rowRange.end <= m.rows);
rows = rowRange.size();
data += step*rowRange.start;
rows = _rowRange.size();
data += step*_rowRange.start;
}
if (colRange == Range::all())
if (_colRange == Range::all())
cols = m.cols;
else
{
CV_Assert(0 <= colRange.start && colRange.start <= colRange.end && colRange.end <= m.cols);
CV_Assert(0 <= _colRange.start && _colRange.start <= _colRange.end && _colRange.end <= m.cols);
cols = colRange.size();
data += colRange.start*elemSize();
cols = _colRange.size();
data += _colRange.start*elemSize();
flags &= cols < m.cols ? ~Mat::CONTINUOUS_FLAG : -1;
}

View File

@@ -63,7 +63,7 @@ GEMM_CopyBlock( const uchar* src, size_t src_step,
for( ; size.height--; src += src_step, dst += dst_step )
{
j=0;
j=0;
#if CV_ENABLE_UNROLLED
for( ; j <= size.width - 4; j += 4 )
{
@@ -345,7 +345,7 @@ GEMMSingleMul( const T* a_data, size_t a_step,
for( k = 0; k < n; k++, b_data += b_step )
{
WT al(a_data[k]);
j=0;
j=0;
#if CV_ENABLE_UNROLLED
for(; j <= m - 4; j += 4 )
{
@@ -513,8 +513,8 @@ GEMMStore( const T* c_data, size_t c_step,
if( _c_data )
{
c_data = _c_data;
j=0;
#if CV_ENABLE_UNROLLED
j=0;
#if CV_ENABLE_UNROLLED
for(; j <= d_size.width - 4; j += 4, c_data += 4*c_step1 )
{
WT t0 = alpha*d_buf[j];
@@ -539,8 +539,8 @@ GEMMStore( const T* c_data, size_t c_step,
}
else
{
j = 0;
#if CV_ENABLE_UNROLLED
j = 0;
#if CV_ENABLE_UNROLLED
for( ; j <= d_size.width - 4; j += 4 )
{
WT t0 = alpha*d_buf[j];
@@ -552,7 +552,7 @@ GEMMStore( const T* c_data, size_t c_step,
d_data[j+2] = T(t0);
d_data[j+3] = T(t1);
}
#endif
#endif
for( ; j < d_size.width; j++ )
d_data[j] = T(alpha*d_buf[j]);
}
@@ -597,7 +597,7 @@ static void GEMMSingleMul_64f( const double* a_data, size_t a_step,
alpha, beta, flags);
}
static void GEMMSingleMul_32fc( const Complexf* a_data, size_t a_step,
const Complexf* b_data, size_t b_step,
const Complexf* c_data, size_t c_step,
@@ -620,7 +620,7 @@ static void GEMMSingleMul_64fc( const Complexd* a_data, size_t a_step,
GEMMSingleMul<Complexd,Complexd>(a_data, a_step, b_data, b_step, c_data,
c_step, d_data, d_step, a_size, d_size,
alpha, beta, flags);
}
}
static void GEMMBlockMul_32f( const float* a_data, size_t a_step,
const float* b_data, size_t b_step,
@@ -696,7 +696,7 @@ static void GEMMStore_64fc( const Complexd* c_data, size_t c_step,
}
void cv::gemm( InputArray matA, InputArray matB, double alpha,
InputArray matC, double beta, OutputArray matD, int flags )
InputArray matC, double beta, OutputArray _matD, int flags )
{
const int block_lin_size = 128;
const int block_size = block_lin_size * block_lin_size;
@@ -741,8 +741,8 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha,
((flags&GEMM_3_T) != 0 && C.rows == d_size.width && C.cols == d_size.height)));
}
matD.create( d_size.height, d_size.width, type );
Mat D = matD.getMat();
_matD.create( d_size.height, d_size.width, type );
Mat D = _matD.getMat();
if( (flags & GEMM_3_T) != 0 && C.data == D.data )
{
transpose( C, C );
@@ -2008,7 +2008,7 @@ static void scaleAdd_32f(const float* src1, const float* src2, float* dst,
t1 = src1[i+3]*alpha + src2[i+3];
dst[i+2] = t0; dst[i+3] = t1;
}
for(; i < len; i++ )
for(; i < len; i++ )
dst[i] = src1[i]*alpha + src2[i];
}
@@ -2035,7 +2035,7 @@ static void scaleAdd_64f(const double* src1, const double* src2, double* dst,
}
else
#endif
//vz why do we need unroll here?
//vz why do we need unroll here?
for( ; i <= len - 4; i += 4 )
{
double t0, t1;
@@ -2046,7 +2046,7 @@ static void scaleAdd_64f(const double* src1, const double* src2, double* dst,
t1 = src1[i+3]*alpha + src2[i+3];
dst[i+2] = t0; dst[i+3] = t1;
}
for(; i < len; i++ )
for(; i < len; i++ )
dst[i] = src1[i]*alpha + src2[i];
}
@@ -2072,7 +2072,7 @@ void cv::scaleAdd( InputArray _src1, double alpha, InputArray _src2, OutputArray
float falpha = (float)alpha;
void* palpha = depth == CV_32F ? (void*)&falpha : (void*)&alpha;
ScaleAddFunc func = depth == CV_32F ? (ScaleAddFunc)scaleAdd_32f : (ScaleAddFunc)scaleAdd_64f;
ScaleAddFunc func = depth == CV_32F ? (ScaleAddFunc)scaleAdd_32f : (ScaleAddFunc)scaleAdd_64f;
if( src1.isContinuous() && src2.isContinuous() && dst.isContinuous() )
{
@@ -2134,12 +2134,12 @@ void cv::calcCovarMatrix( const Mat* data, int nsamples, Mat& covar, Mat& _mean,
_mean = mean.reshape(1, size.height);
}
void cv::calcCovarMatrix( InputArray _data, OutputArray _covar, InputOutputArray _mean, int flags, int ctype )
void cv::calcCovarMatrix( InputArray _src, OutputArray _covar, InputOutputArray _mean, int flags, int ctype )
{
if(_data.kind() == _InputArray::STD_VECTOR_MAT)
if(_src.kind() == _InputArray::STD_VECTOR_MAT)
{
std::vector<cv::Mat> src;
_data.getMatVector(src);
_src.getMatVector(src);
CV_Assert( src.size() > 0 );
@@ -2185,7 +2185,7 @@ void cv::calcCovarMatrix( InputArray _data, OutputArray _covar, InputOutputArray
return;
}
Mat data = _data.getMat(), mean;
Mat data = _src.getMat(), mean;
CV_Assert( ((flags & CV_COVAR_ROWS) != 0) ^ ((flags & CV_COVAR_COLS) != 0) );
bool takeRows = (flags & CV_COVAR_ROWS) != 0;
int type = data.type();
@@ -2209,7 +2209,7 @@ void cv::calcCovarMatrix( InputArray _data, OutputArray _covar, InputOutputArray
else
{
ctype = std::max(CV_MAT_DEPTH(ctype >= 0 ? ctype : type), CV_32F);
reduce( _data, _mean, takeRows ? 0 : 1, CV_REDUCE_AVG, ctype );
reduce( _src, _mean, takeRows ? 0 : 1, CV_REDUCE_AVG, ctype );
mean = _mean.getMat();
}
@@ -2223,7 +2223,7 @@ void cv::calcCovarMatrix( InputArray _data, OutputArray _covar, InputOutputArray
double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar )
{
Mat v1 = _v1.getMat(), v2 = _v2.getMat(), icovar = _icovar.getMat();
Mat v1 = _v1.getMat(), v2 = _v2.getMat(), icovar = _icovar.getMat();
int type = v1.type(), depth = v1.depth();
Size sz = v1.size();
int i, j, len = sz.width*sz.height*v1.channels();
@@ -2261,7 +2261,7 @@ double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar )
{
double row_sum = 0;
j = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for(; j <= len - 4; j += 4 )
row_sum += diff[j]*mat[j] + diff[j+1]*mat[j+1] +
diff[j+2]*mat[j+2] + diff[j+3]*mat[j+3];
@@ -2292,7 +2292,7 @@ double cv::Mahalanobis( InputArray _v1, InputArray _v2, InputArray _icovar )
{
double row_sum = 0;
j = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for(; j <= len - 4; j += 4 )
row_sum += diff[j]*mat[j] + diff[j+1]*mat[j+1] +
diff[j+2]*mat[j+2] + diff[j+3]*mat[j+3];
@@ -2642,7 +2642,7 @@ dotProd_(const T* src1, const T* src2, int len)
{
int i = 0;
double result = 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; i <= len - 4; i += 4 )
result += (double)src1[i]*src2[i] + (double)src1[i+1]*src2[i+1] +
(double)src1[i+2]*src2[i+2] + (double)src1[i+3]*src2[i+3];
@@ -2674,7 +2674,7 @@ static double dotProd_8u(const uchar* src1, const uchar* src2, int len)
{
blockSize = std::min(len0 - i, blockSize0);
__m128i s = _mm_setzero_si128();
j = 0;
j = 0;
for( ; j <= blockSize - 16; j += 16 )
{
__m128i b0 = _mm_loadu_si128((const __m128i*)(src1 + j));
@@ -2806,9 +2806,9 @@ double Mat::dot(InputArray _mat) const
PCA::PCA() {}
PCA::PCA(InputArray data, InputArray mean, int flags, int maxComponents)
PCA::PCA(InputArray data, InputArray _mean, int flags, int maxComponents)
{
operator()(data, mean, flags, maxComponents);
operator()(data, _mean, flags, maxComponents);
}
PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, int maxComponents)
@@ -2964,7 +2964,7 @@ void cv::PCACompute(InputArray data, InputOutputArray mean,
pca.mean.copyTo(mean);
pca.eigenvectors.copyTo(eigenvectors);
}
void cv::PCAProject(InputArray data, InputArray mean,
InputArray eigenvectors, OutputArray result)
{

File diff suppressed because it is too large Load Diff

View File

@@ -210,9 +210,9 @@ void Mat::create(int d, const int* _sizes, int _type)
#endif
if( !allocator )
{
size_t total = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
data = datastart = (uchar*)fastMalloc(total + (int)sizeof(*refcount));
refcount = (int*)(data + total);
size_t totalsize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
data = datastart = (uchar*)fastMalloc(totalsize + (int)sizeof(*refcount));
refcount = (int*)(data + totalsize);
*refcount = 1;
}
else
@@ -262,15 +262,15 @@ void Mat::deallocate()
}
Mat::Mat(const Mat& m, const Range& rowRange, const Range& colRange) : size(&rows)
Mat::Mat(const Mat& m, const Range& _rowRange, const Range& _colRange) : size(&rows)
{
initEmpty();
CV_Assert( m.dims >= 2 );
if( m.dims > 2 )
{
AutoBuffer<Range> rs(m.dims);
rs[0] = rowRange;
rs[1] = colRange;
rs[0] = _rowRange;
rs[1] = _colRange;
for( int i = 2; i < m.dims; i++ )
rs[i] = Range::all();
*this = m(rs);
@@ -278,19 +278,19 @@ Mat::Mat(const Mat& m, const Range& rowRange, const Range& colRange) : size(&row
}
*this = m;
if( rowRange != Range::all() && rowRange != Range(0,rows) )
if( _rowRange != Range::all() && _rowRange != Range(0,rows) )
{
CV_Assert( 0 <= rowRange.start && rowRange.start <= rowRange.end && rowRange.end <= m.rows );
rows = rowRange.size();
data += step*rowRange.start;
CV_Assert( 0 <= _rowRange.start && _rowRange.start <= _rowRange.end && _rowRange.end <= m.rows );
rows = _rowRange.size();
data += step*_rowRange.start;
flags |= SUBMATRIX_FLAG;
}
if( colRange != Range::all() && colRange != Range(0,cols) )
if( _colRange != Range::all() && _colRange != Range(0,cols) )
{
CV_Assert( 0 <= colRange.start && colRange.start <= colRange.end && colRange.end <= m.cols );
cols = colRange.size();
data += colRange.start*elemSize();
CV_Assert( 0 <= _colRange.start && _colRange.start <= _colRange.end && _colRange.end <= m.cols );
cols = _colRange.size();
data += _colRange.start*elemSize();
flags &= cols < m.cols ? ~CONTINUOUS_FLAG : -1;
flags |= SUBMATRIX_FLAG;
}
@@ -473,14 +473,14 @@ Mat::Mat(const IplImage* img, bool copyData) : size(&rows)
dims = 2;
CV_DbgAssert(CV_IS_IMAGE(img) && img->imageData != 0);
int depth = IPL2CV_DEPTH(img->depth);
int imgdepth = IPL2CV_DEPTH(img->depth);
size_t esz;
step[0] = img->widthStep;
if(!img->roi)
{
CV_Assert(img->dataOrder == IPL_DATA_ORDER_PIXEL);
flags = MAGIC_VAL + CV_MAKETYPE(depth, img->nChannels);
flags = MAGIC_VAL + CV_MAKETYPE(imgdepth, img->nChannels);
rows = img->height; cols = img->width;
datastart = data = (uchar*)img->imageData;
esz = CV_ELEM_SIZE(flags);
@@ -489,7 +489,7 @@ Mat::Mat(const IplImage* img, bool copyData) : size(&rows)
{
CV_Assert(img->dataOrder == IPL_DATA_ORDER_PIXEL || img->roi->coi != 0);
bool selectedPlane = img->roi->coi && img->dataOrder == IPL_DATA_ORDER_PLANE;
flags = MAGIC_VAL + CV_MAKETYPE(depth, selectedPlane ? 1 : img->nChannels);
flags = MAGIC_VAL + CV_MAKETYPE(imgdepth, selectedPlane ? 1 : img->nChannels);
rows = img->roi->height; cols = img->roi->width;
esz = CV_ELEM_SIZE(flags);
data = datastart = (uchar*)img->imageData +
@@ -1299,38 +1299,38 @@ bool _OutputArray::fixedType() const
return (flags & FIXED_TYPE) == FIXED_TYPE;
}
void _OutputArray::create(Size _sz, int type, int i, bool allowTransposed, int fixedDepthMask) const
void _OutputArray::create(Size _sz, int mtype, int i, bool allowTransposed, int fixedDepthMask) const
{
int k = kind();
if( k == MAT && i < 0 && !allowTransposed && fixedDepthMask == 0 )
{
CV_Assert(!fixedSize() || ((Mat*)obj)->size.operator()() == _sz);
CV_Assert(!fixedType() || ((Mat*)obj)->type() == type);
((Mat*)obj)->create(_sz, type);
CV_Assert(!fixedType() || ((Mat*)obj)->type() == mtype);
((Mat*)obj)->create(_sz, mtype);
return;
}
int sz[] = {_sz.height, _sz.width};
create(2, sz, type, i, allowTransposed, fixedDepthMask);
int sizes[] = {_sz.height, _sz.width};
create(2, sizes, mtype, i, allowTransposed, fixedDepthMask);
}
void _OutputArray::create(int rows, int cols, int type, int i, bool allowTransposed, int fixedDepthMask) const
void _OutputArray::create(int rows, int cols, int mtype, int i, bool allowTransposed, int fixedDepthMask) const
{
int k = kind();
if( k == MAT && i < 0 && !allowTransposed && fixedDepthMask == 0 )
{
CV_Assert(!fixedSize() || ((Mat*)obj)->size.operator()() == Size(cols, rows));
CV_Assert(!fixedType() || ((Mat*)obj)->type() == type);
((Mat*)obj)->create(rows, cols, type);
CV_Assert(!fixedType() || ((Mat*)obj)->type() == mtype);
((Mat*)obj)->create(rows, cols, mtype);
return;
}
int sz[] = {rows, cols};
create(2, sz, type, i, allowTransposed, fixedDepthMask);
int sizes[] = {rows, cols};
create(2, sizes, mtype, i, allowTransposed, fixedDepthMask);
}
void _OutputArray::create(int dims, const int* size, int type, int i, bool allowTransposed, int fixedDepthMask) const
void _OutputArray::create(int dims, const int* sizes, int mtype, int i, bool allowTransposed, int fixedDepthMask) const
{
int k = kind();
type = CV_MAT_TYPE(type);
mtype = CV_MAT_TYPE(mtype);
if( k == MAT )
{
@@ -1345,24 +1345,24 @@ void _OutputArray::create(int dims, const int* size, int type, int i, bool allow
}
if( dims == 2 && m.dims == 2 && m.data &&
m.type() == type && m.rows == size[1] && m.cols == size[0] )
m.type() == mtype && m.rows == sizes[1] && m.cols == sizes[0] )
return;
}
if(fixedType())
{
if(CV_MAT_CN(type) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0 )
type = m.type();
if(CV_MAT_CN(mtype) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0 )
mtype = m.type();
else
CV_Assert(CV_MAT_TYPE(type) == m.type());
CV_Assert(CV_MAT_TYPE(mtype) == m.type());
}
if(fixedSize())
{
CV_Assert(m.dims == dims);
for(int j = 0; j < dims; ++j)
CV_Assert(m.size[j] == size[j]);
CV_Assert(m.size[j] == sizes[j]);
}
m.create(dims, size, type);
m.create(dims, sizes, mtype);
return;
}
@@ -1370,16 +1370,16 @@ void _OutputArray::create(int dims, const int* size, int type, int i, bool allow
{
CV_Assert( i < 0 );
int type0 = CV_MAT_TYPE(flags);
CV_Assert( type == type0 || (CV_MAT_CN(type) == 1 && ((1 << type0) & fixedDepthMask) != 0) );
CV_Assert( dims == 2 && ((size[0] == sz.height && size[1] == sz.width) ||
(allowTransposed && size[0] == sz.width && size[1] == sz.height)));
CV_Assert( mtype == type0 || (CV_MAT_CN(mtype) == 1 && ((1 << type0) & fixedDepthMask) != 0) );
CV_Assert( dims == 2 && ((sizes[0] == sz.height && sizes[1] == sz.width) ||
(allowTransposed && sizes[0] == sz.width && sizes[1] == sz.height)));
return;
}
if( k == STD_VECTOR || k == STD_VECTOR_VECTOR )
{
CV_Assert( dims == 2 && (size[0] == 1 || size[1] == 1 || size[0]*size[1] == 0) );
size_t len = size[0]*size[1] > 0 ? size[0] + size[1] - 1 : 0;
CV_Assert( dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) );
size_t len = sizes[0]*sizes[1] > 0 ? sizes[0] + sizes[1] - 1 : 0;
vector<uchar>* v = (vector<uchar>*)obj;
if( k == STD_VECTOR_VECTOR )
@@ -1398,7 +1398,7 @@ void _OutputArray::create(int dims, const int* size, int type, int i, bool allow
CV_Assert( i < 0 );
int type0 = CV_MAT_TYPE(flags);
CV_Assert( type == type0 || (CV_MAT_CN(type) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0) );
CV_Assert( mtype == type0 || (CV_MAT_CN(mtype) == CV_MAT_CN(type0) && ((1 << type0) & fixedDepthMask) != 0) );
int esz = CV_ELEM_SIZE(type0);
CV_Assert(!fixedSize() || len == ((vector<uchar>*)v)->size() / esz);
@@ -1471,20 +1471,20 @@ void _OutputArray::create(int dims, const int* size, int type, int i, bool allow
if( i < 0 )
{
CV_Assert( dims == 2 && (size[0] == 1 || size[1] == 1 || size[0]*size[1] == 0) );
size_t len = size[0]*size[1] > 0 ? size[0] + size[1] - 1 : 0, len0 = v.size();
CV_Assert( dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0) );
size_t len = sizes[0]*sizes[1] > 0 ? sizes[0] + sizes[1] - 1 : 0, len0 = v.size();
CV_Assert(!fixedSize() || len == len0);
v.resize(len);
if( fixedType() )
{
int type = CV_MAT_TYPE(flags);
int _type = CV_MAT_TYPE(flags);
for( size_t j = len0; j < len; j++ )
{
if( v[i].type() == type )
if( v[i].type() == _type )
continue;
CV_Assert( v[i].empty() );
v[i].flags = (v[i].flags & ~CV_MAT_TYPE_MASK) | type;
v[i].flags = (v[i].flags & ~CV_MAT_TYPE_MASK) | _type;
}
}
return;
@@ -1502,25 +1502,25 @@ void _OutputArray::create(int dims, const int* size, int type, int i, bool allow
}
if( dims == 2 && m.dims == 2 && m.data &&
m.type() == type && m.rows == size[1] && m.cols == size[0] )
m.type() == mtype && m.rows == sizes[1] && m.cols == sizes[0] )
return;
}
if(fixedType())
{
if(CV_MAT_CN(type) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0 )
type = m.type();
if(CV_MAT_CN(mtype) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0 )
mtype = m.type();
else
CV_Assert(!fixedType() || (CV_MAT_CN(type) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0));
CV_Assert(!fixedType() || (CV_MAT_CN(mtype) == m.channels() && ((1 << CV_MAT_TYPE(flags)) & fixedDepthMask) != 0));
}
if(fixedSize())
{
CV_Assert(m.dims == dims);
for(int j = 0; j < dims; ++j)
CV_Assert(m.size[j] == size[j]);
CV_Assert(m.size[j] == sizes[j]);
}
m.create(dims, size, type);
m.create(dims, sizes, mtype);
}
}
@@ -1929,10 +1929,10 @@ void cv::completeSymm( InputOutputArray _m, bool LtoR )
cv::Mat cv::Mat::cross(InputArray _m) const
{
Mat m = _m.getMat();
int t = type(), d = CV_MAT_DEPTH(t);
CV_Assert( dims <= 2 && m.dims <= 2 && size() == m.size() && t == m.type() &&
int tp = type(), d = CV_MAT_DEPTH(tp);
CV_Assert( dims <= 2 && m.dims <= 2 && size() == m.size() && tp == m.type() &&
((rows == 3 && cols == 1) || (cols*channels() == 3 && rows == 1)));
Mat result(rows, cols, t);
Mat result(rows, cols, tp);
if( d == CV_32F )
{
@@ -2845,7 +2845,7 @@ cvRange( CvArr* arr, double start, double end )
CV_IMPL void
cvSort( const CvArr* _src, CvArr* _dst, CvArr* _idx, int flags )
{
cv::Mat src = cv::cvarrToMat(_src), dst, idx;
cv::Mat src = cv::cvarrToMat(_src);
if( _idx )
{
@@ -3410,22 +3410,22 @@ SparseMat::SparseMat(const Mat& m)
int i, idx[CV_MAX_DIM] = {0}, d = m.dims, lastSize = m.size[d - 1];
size_t esz = m.elemSize();
uchar* ptr = m.data;
uchar* dptr = m.data;
for(;;)
{
for( i = 0; i < lastSize; i++, ptr += esz )
for( i = 0; i < lastSize; i++, dptr += esz )
{
if( isZeroElem(ptr, esz) )
if( isZeroElem(dptr, esz) )
continue;
idx[d-1] = i;
uchar* to = newNode(idx, hash(idx));
copyElem( ptr, to, esz );
copyElem( dptr, to, esz );
}
for( i = d - 2; i >= 0; i-- )
{
ptr += m.step[i] - m.size[i+1]*m.step[i+1];
dptr += m.step[i] - m.size[i+1]*m.step[i+1];
if( ++idx[i] < m.size[i] )
break;
idx[i] = 0;

View File

@@ -163,11 +163,11 @@ void icvSetOpenGlFuncTab(const CvOpenGlFuncTab* tab)
void cv::gpu::setGlDevice(int device)
{
#ifndef HAVE_CUDA
(void)device;
(void)device;
throw_nocuda;
#else
#ifndef HAVE_OPENGL
(void)device;
(void)device;
throw_nogl;
#else
if (!glFuncTab()->isGlContextInitialized())
@@ -287,7 +287,7 @@ class cv::GlBuffer::Impl
{
public:
static const Ptr<Impl>& empty();
Impl(int rows, int cols, int type, unsigned int target);
Impl(const Mat& m, unsigned int target);
~Impl();
@@ -311,7 +311,7 @@ public:
private:
Impl();
unsigned int buffer_;
#ifdef HAVE_CUDA
@@ -484,57 +484,57 @@ inline void cv::GlBuffer::Impl::unmapDevice(cudaStream_t stream)
#endif // HAVE_OPENGL
cv::GlBuffer::GlBuffer(Usage usage) : rows_(0), cols_(0), type_(0), usage_(usage)
cv::GlBuffer::GlBuffer(Usage _usage) : rows_(0), cols_(0), type_(0), usage_(_usage)
{
#ifndef HAVE_OPENGL
(void)usage;
(void)_usage;
throw_nogl;
#else
impl_ = Impl::empty();
#endif
}
cv::GlBuffer::GlBuffer(int rows, int cols, int type, Usage usage) : rows_(0), cols_(0), type_(0), usage_(usage)
cv::GlBuffer::GlBuffer(int _rows, int _cols, int _type, Usage _usage) : rows_(0), cols_(0), type_(0), usage_(_usage)
{
#ifndef HAVE_OPENGL
(void)rows;
(void)cols;
(void)type;
(void)usage;
(void)_rows;
(void)_cols;
(void)_type;
(void)_usage;
throw_nogl;
#else
impl_ = new Impl(rows, cols, type, usage);
rows_ = rows;
cols_ = cols;
type_ = type;
impl_ = new Impl(_rows, _cols, _type, _usage);
rows_ = _rows;
cols_ = _cols;
type_ = _type;
#endif
}
cv::GlBuffer::GlBuffer(Size size, int type, Usage usage) : rows_(0), cols_(0), type_(0), usage_(usage)
cv::GlBuffer::GlBuffer(Size _size, int _type, Usage _usage) : rows_(0), cols_(0), type_(0), usage_(_usage)
{
#ifndef HAVE_OPENGL
(void)size;
(void)type;
(void)usage;
(void)_size;
(void)_type;
(void)_usage;
throw_nogl;
#else
impl_ = new Impl(size.height, size.width, type, usage);
rows_ = size.height;
cols_ = size.width;
type_ = type;
impl_ = new Impl(_size.height, _size.width, _type, _usage);
rows_ = _size.height;
cols_ = _size.width;
type_ = _type;
#endif
}
cv::GlBuffer::GlBuffer(InputArray mat_, Usage usage) : rows_(0), cols_(0), type_(0), usage_(usage)
cv::GlBuffer::GlBuffer(InputArray mat_, Usage _usage) : rows_(0), cols_(0), type_(0), usage_(_usage)
{
#ifndef HAVE_OPENGL
(void)mat_;
(void)usage;
(void)mat_;
(void)_usage;
throw_nogl;
#else
int kind = mat_.kind();
Size size = mat_.size();
int type = mat_.type();
Size _size = mat_.size();
int _type = mat_.type();
if (kind == _InputArray::GPU_MAT)
{
@@ -542,38 +542,38 @@ cv::GlBuffer::GlBuffer(InputArray mat_, Usage usage) : rows_(0), cols_(0), type_
throw_nocuda;
#else
GpuMat d_mat = mat_.getGpuMat();
impl_ = new Impl(d_mat.rows, d_mat.cols, d_mat.type(), usage);
impl_ = new Impl(d_mat.rows, d_mat.cols, d_mat.type(), _usage);
impl_->copyFrom(d_mat);
#endif
}
else
{
Mat mat = mat_.getMat();
impl_ = new Impl(mat, usage);
impl_ = new Impl(mat, _usage);
}
rows_ = size.height;
cols_ = size.width;
type_ = type;
rows_ = _size.height;
cols_ = _size.width;
type_ = _type;
#endif
}
void cv::GlBuffer::create(int rows, int cols, int type, Usage usage)
void cv::GlBuffer::create(int _rows, int _cols, int _type, Usage _usage)
{
#ifndef HAVE_OPENGL
(void)rows;
(void)cols;
(void)type;
(void)usage;
(void)_rows;
(void)_cols;
(void)_type;
(void)_usage;
throw_nogl;
#else
if (rows_ != rows || cols_ != cols || type_ != type || usage_ != usage)
if (rows_ != _rows || cols_ != _cols || type_ != _type || usage_ != _usage)
{
impl_ = new Impl(rows, cols, type, usage);
rows_ = rows;
cols_ = cols;
type_ = type;
usage_ = usage;
impl_ = new Impl(_rows, _cols, _type, _usage);
rows_ = _rows;
cols_ = _cols;
type_ = _type;
usage_ = _usage;
}
#endif
}
@@ -590,14 +590,14 @@ void cv::GlBuffer::release()
void cv::GlBuffer::copyFrom(InputArray mat_)
{
#ifndef HAVE_OPENGL
(void)mat_;
(void)mat_;
throw_nogl;
#else
int kind = mat_.kind();
Size size = mat_.size();
int type = mat_.type();
Size _size = mat_.size();
int _type = mat_.type();
create(size, type);
create(_size, _type);
switch (kind)
{
@@ -728,7 +728,7 @@ public:
private:
Impl();
GLuint tex_;
};
@@ -926,45 +926,45 @@ cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTUR
#endif
}
cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
cv::GlTexture::GlTexture(int _rows, int _cols, int _type) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
{
#ifndef HAVE_OPENGL
(void)rows;
(void)cols;
(void)type;
(void)_rows;
(void)_cols;
(void)_type;
throw_nogl;
#else
impl_ = new Impl(rows, cols, type);
rows_ = rows;
cols_ = cols;
type_ = type;
impl_ = new Impl(_rows, _cols, _type);
rows_ = _rows;
cols_ = _cols;
type_ = _type;
#endif
}
cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
cv::GlTexture::GlTexture(Size _size, int _type) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
{
#ifndef HAVE_OPENGL
(void)size;
(void)type;
(void)_size;
(void)_type;
throw_nogl;
#else
impl_ = new Impl(size.height, size.width, type);
rows_ = size.height;
cols_ = size.width;
type_ = type;
impl_ = new Impl(_size.height, _size.width, _type);
rows_ = _size.height;
cols_ = _size.width;
type_ = _type;
#endif
}
cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER)
{
#ifndef HAVE_OPENGL
(void)mat_;
(void)bgra;
(void)mat_;
(void)bgra;
throw_nogl;
#else
#else
int kind = mat_.kind();
Size size = mat_.size();
int type = mat_.type();
Size _size = mat_.size();
int _type = mat_.type();
switch (kind)
{
@@ -994,26 +994,26 @@ cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows_(0), cols_(0), type_
}
}
rows_ = size.height;
cols_ = size.width;
type_ = type;
rows_ = _size.height;
cols_ = _size.width;
type_ = _type;
#endif
}
void cv::GlTexture::create(int rows, int cols, int type)
void cv::GlTexture::create(int _rows, int _cols, int _type)
{
#ifndef HAVE_OPENGL
(void)rows;
(void)cols;
(void)type;
(void)_rows;
(void)_cols;
(void)_type;
throw_nogl;
#else
if (rows_ != rows || cols_ != cols || type_ != type)
if (rows_ != _rows || cols_ != _cols || type_ != _type)
{
impl_ = new Impl(rows, cols, type);
rows_ = rows;
cols_ = cols;
type_ = type;
impl_ = new Impl(_rows, _cols, _type);
rows_ = _rows;
cols_ = _cols;
type_ = _type;
}
#endif
}
@@ -1030,15 +1030,15 @@ void cv::GlTexture::release()
void cv::GlTexture::copyFrom(InputArray mat_, bool bgra)
{
#ifndef HAVE_OPENGL
(void)mat_;
(void)bgra;
(void)mat_;
(void)bgra;
throw_nogl;
#else
int kind = mat_.kind();
Size size = mat_.size();
int type = mat_.type();
Size _size = mat_.size();
int _type = mat_.type();
create(size, type);
create(_size, _type);
switch(kind)
{
@@ -1244,8 +1244,8 @@ void cv::GlArrays::unbind() const
////////////////////////////////////////////////////////////////////////
// GlFont
cv::GlFont::GlFont(const string& family, int height, Weight weight, Style style)
: family_(family), height_(height), weight_(weight), style_(style), base_(0)
cv::GlFont::GlFont(const string& _family, int _height, Weight _weight, Style _style)
: family_(_family), height_(_height), weight_(_weight), style_(_style), base_(0)
{
#ifndef HAVE_OPENGL
throw_nogl;
@@ -1253,7 +1253,7 @@ cv::GlFont::GlFont(const string& family, int height, Weight weight, Style style)
base_ = glGenLists(256);
CV_CheckGlError();
glFuncTab()->generateBitmapFont(family, height, weight, (style & STYLE_ITALIC) != 0, (style & STYLE_UNDERLINE) != 0, 0, 256, base_);
glFuncTab()->generateBitmapFont(family_, height_, weight_, (style_ & STYLE_ITALIC) != 0, (style_ & STYLE_UNDERLINE) != 0, 0, 256, base_);
#endif
}
@@ -1283,7 +1283,7 @@ namespace
class FontCompare : public unary_function<Ptr<GlFont>, bool>
{
public:
inline FontCompare(const string& family, int height, GlFont::Weight weight, GlFont::Style style)
inline FontCompare(const string& family, int height, GlFont::Weight weight, GlFont::Style style)
: family_(family), height_(height), weight_(weight), style_(style)
{
}
@@ -1304,10 +1304,10 @@ namespace
Ptr<GlFont> cv::GlFont::get(const std::string& family, int height, Weight weight, Style style)
{
#ifndef HAVE_OPENGL
(void)family;
(void)height;
(void)weight;
(void)style;
(void)family;
(void)height;
(void)weight;
(void)style;
throw_nogl;
return Ptr<GlFont>();
#else
@@ -1333,9 +1333,9 @@ Ptr<GlFont> cv::GlFont::get(const std::string& family, int height, Weight weight
void cv::render(const GlTexture& tex, Rect_<double> wndRect, Rect_<double> texRect)
{
#ifndef HAVE_OPENGL
(void)tex;
(void)wndRect;
(void)texRect;
(void)tex;
(void)wndRect;
(void)texRect;
throw_nogl;
#else
if (!tex.empty())
@@ -1368,9 +1368,9 @@ void cv::render(const GlTexture& tex, Rect_<double> wndRect, Rect_<double> texRe
void cv::render(const GlArrays& arr, int mode, Scalar color)
{
#ifndef HAVE_OPENGL
(void)arr;
(void)mode;
(void)color;
(void)arr;
(void)mode;
(void)color;
throw_nogl;
#else
glColor3d(color[0] / 255.0, color[1] / 255.0, color[2] / 255.0);
@@ -1386,10 +1386,10 @@ void cv::render(const GlArrays& arr, int mode, Scalar color)
void cv::render(const string& str, const Ptr<GlFont>& font, Scalar color, Point2d pos)
{
#ifndef HAVE_OPENGL
(void)str;
(void)font;
(void)color;
(void)pos;
(void)str;
(void)font;
(void)color;
(void)pos;
throw_nogl;
#else
glPushAttrib(GL_DEPTH_BUFFER_BIT);
@@ -1544,9 +1544,9 @@ void cv::GlCamera::setupModelViewMatrix() const
bool icvCheckGlError(const char* file, const int line, const char* func)
{
#ifndef HAVE_OPENGL
(void)file;
(void)line;
(void)func;
(void)file;
(void)line;
(void)func;
return true;
#else
GLenum err = glGetError();