Commit a8c5e356 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

some more fixes towards binary compatibility

parent e2ff0ed1
...@@ -1388,7 +1388,7 @@ public: ...@@ -1388,7 +1388,7 @@ public:
virtual bool fixedType() const; virtual bool fixedType() const;
virtual bool needed() const; virtual bool needed() const;
virtual Mat& getMatRef(int i=-1) const; virtual Mat& getMatRef(int i=-1) const;
virtual gpu::GpuMat& getGpuMatRef() const; /*virtual*/ gpu::GpuMat& getGpuMatRef() const;
virtual void create(Size sz, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; virtual void create(Size sz, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
virtual void create(int rows, int cols, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; virtual void create(int rows, int cols, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
virtual void create(int dims, const int* size, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const; virtual void create(int dims, const int* size, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
...@@ -2131,7 +2131,7 @@ CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst); ...@@ -2131,7 +2131,7 @@ CV_EXPORTS_W void merge(InputArrayOfArrays mv, OutputArray dst);
//! copies each plane of a multi-channel array to a dedicated array //! copies each plane of a multi-channel array to a dedicated array
CV_EXPORTS void split(const Mat& src, Mat* mvbegin); CV_EXPORTS void split(const Mat& src, Mat* mvbegin);
CV_EXPORTS void split(const Mat& src, vector<Mat>& mv ); CV_EXPORTS void split(const Mat& m, vector<Mat>& mv );
//! copies each plane of a multi-channel array to a dedicated array //! copies each plane of a multi-channel array to a dedicated array
CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv); CV_EXPORTS_W void split(InputArray m, OutputArrayOfArrays mv);
...@@ -4392,6 +4392,11 @@ public: ...@@ -4392,6 +4392,11 @@ public:
int (Algorithm::*getter)()=0, int (Algorithm::*getter)()=0,
void (Algorithm::*setter)(int)=0, void (Algorithm::*setter)(int)=0,
const string& help=string()); const string& help=string());
void addParam(Algorithm& algo, const char* name,
short& value, bool readOnly=false,
int (Algorithm::*getter)()=0,
void (Algorithm::*setter)(int)=0,
const string& help=string());
void addParam(Algorithm& algo, const char* name, void addParam(Algorithm& algo, const char* name,
bool& value, bool readOnly=false, bool& value, bool readOnly=false,
int (Algorithm::*getter)()=0, int (Algorithm::*getter)()=0,
...@@ -4441,7 +4446,7 @@ protected: ...@@ -4441,7 +4446,7 @@ protected:
struct CV_EXPORTS Param struct CV_EXPORTS Param
{ {
enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7, UNSIGNED_INT=8, UINT64=9 }; enum { INT=0, BOOLEAN=1, REAL=2, STRING=3, MAT=4, MAT_VECTOR=5, ALGORITHM=6, FLOAT=7, UNSIGNED_INT=8, UINT64=9, SHORT=10 };
Param(); Param();
Param(int _type, bool _readonly, int _offset, Param(int _type, bool _readonly, int _offset,
...@@ -4472,6 +4477,14 @@ template<> struct ParamType<int> ...@@ -4472,6 +4477,14 @@ template<> struct ParamType<int>
enum { type = Param::INT }; enum { type = Param::INT };
}; };
template<> struct ParamType<short>
{
typedef int const_param_type;
typedef int member_type;
enum { type = Param::SHORT };
};
template<> struct ParamType<double> template<> struct ParamType<double>
{ {
typedef double const_param_type; typedef double const_param_type;
...@@ -4542,8 +4555,8 @@ template<> struct ParamType<uint64> ...@@ -4542,8 +4555,8 @@ template<> struct ParamType<uint64>
class CV_EXPORTS CommandLineParser class CV_EXPORTS CommandLineParser
{ {
public: public:
CommandLineParser(int argc, const char* const argv[], const char* keys); CommandLineParser(int argc, const char* const argv[], const char* key_map);
CommandLineParser(int argc, const char* const argv[], const string& keys); CommandLineParser(int argc, const char* const argv[], const string& key_map);
CommandLineParser(const CommandLineParser& parser); CommandLineParser(const CommandLineParser& parser);
CommandLineParser& operator = (const CommandLineParser& parser); CommandLineParser& operator = (const CommandLineParser& parser);
...@@ -4565,7 +4578,7 @@ public: ...@@ -4565,7 +4578,7 @@ public:
return val; return val;
} }
bool has(const string& name); bool has(const string& keys);
bool check() const; bool check() const;
void about(const string& message); void about(const string& message);
......
...@@ -456,7 +456,8 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con ...@@ -456,7 +456,8 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
if( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL ) if( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL )
{ {
CV_Assert( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN ); CV_Assert( p->type == Param::INT || p->type == Param::REAL || p->type == Param::BOOLEAN ||
(p->type == Param::SHORT && argType == Param::INT) );
if( p->type == Param::INT ) if( p->type == Param::INT )
{ {
...@@ -468,6 +469,14 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con ...@@ -468,6 +469,14 @@ void AlgorithmInfo::set(Algorithm* algo, const char* parameter, int argType, con
else else
*(int*)((uchar*)algo + p->offset) = val; *(int*)((uchar*)algo + p->offset) = val;
} }
else if( p->type == Param::SHORT )
{
int val = *(const int*)value;
if( p->setter )
(algo->*f.set_int)(val);
else
*(short*)((uchar*)algo + p->offset) = (short)val;
}
else if( p->type == Param::BOOLEAN ) else if( p->type == Param::BOOLEAN )
{ {
bool val = argType == Param::INT ? *(const int*)value != 0 : bool val = argType == Param::INT ? *(const int*)value != 0 :
...@@ -554,6 +563,13 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp ...@@ -554,6 +563,13 @@ void AlgorithmInfo::get(const Algorithm* algo, const char* parameter, int argTyp
else else
*(double*)value = val; *(double*)value = val;
} }
else if( p->type == Param::SHORT )
{
CV_Assert( argType == Param::INT );
int val = p->getter ? (algo->*f.get_int)() : *(short*)((uchar*)algo + p->offset);
*(int*)value = val;
}
else if( p->type == Param::BOOLEAN ) else if( p->type == Param::BOOLEAN )
{ {
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL ); CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || argType == Param::REAL );
...@@ -639,7 +655,7 @@ void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argTyp ...@@ -639,7 +655,7 @@ void AlgorithmInfo::addParam_(Algorithm& algo, const char* parameter, int argTyp
CV_Assert( argType == Param::INT || argType == Param::BOOLEAN || CV_Assert( argType == Param::INT || argType == Param::BOOLEAN ||
argType == Param::REAL || argType == Param::STRING || argType == Param::REAL || argType == Param::STRING ||
argType == Param::MAT || argType == Param::MAT_VECTOR || argType == Param::MAT || argType == Param::MAT_VECTOR ||
argType == Param::ALGORITHM ); argType == Param::ALGORITHM || argType == Param::SHORT );
data->params.add(string(parameter), Param(argType, readOnly, data->params.add(string(parameter), Param(argType, readOnly,
(int)((size_t)value - (size_t)(void*)&algo), (int)((size_t)value - (size_t)(void*)&algo),
getter, setter, help)); getter, setter, help));
...@@ -656,6 +672,16 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, ...@@ -656,6 +672,16 @@ void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help); (Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
} }
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
short& value, bool readOnly,
int (Algorithm::*getter)(),
void (Algorithm::*setter)(int),
const string& help)
{
addParam_(algo, parameter, ParamType<int>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
bool& value, bool readOnly, bool& value, bool readOnly,
int (Algorithm::*getter)(), int (Algorithm::*getter)(),
......
...@@ -586,7 +586,7 @@ protected: ...@@ -586,7 +586,7 @@ protected:
int threshold; int threshold;
bool nonmaxSuppression; bool nonmaxSuppression;
int type; short type;
}; };
......
...@@ -1192,15 +1192,12 @@ public: ...@@ -1192,15 +1192,12 @@ public:
} }
private: private:
const Mat src; Mat src;
Mat dst; Mat dst;
const int* xofs, *yofs; const int* xofs, *yofs;
const AT* alpha, *_beta; const AT* alpha, *_beta;
const Size ssize, dsize; Size ssize, dsize;
const int ksize, xmin, xmax; int ksize, xmin, xmax;
resizeGeneric_Invoker(const resizeGeneric_Invoker&);
resizeGeneric_Invoker& operator=(const resizeGeneric_Invoker&);
}; };
template<class HResize, class VResize> template<class HResize, class VResize>
...@@ -1236,10 +1233,10 @@ struct ResizeAreaFastNoVec ...@@ -1236,10 +1233,10 @@ struct ResizeAreaFastNoVec
int operator() (const T* /*S*/, T* /*D*/, int /*w*/) const { return 0; } int operator() (const T* /*S*/, T* /*D*/, int /*w*/) const { return 0; }
}; };
template <typename T, typename WT> template<typename T>
struct ResizeAreaFast_2x2_8u struct ResizeAreaFastVec
{ {
ResizeAreaFast_2x2_8u(int _scale_x, int _scale_y, int _cn, int _step/*, const int* _ofs*/) : ResizeAreaFastVec(int _scale_x, int _scale_y, int _cn, int _step/*, const int* _ofs*/) :
scale_x(_scale_x), scale_y(_scale_y), cn(_cn), step(_step)/*, ofs(_ofs)*/ scale_x(_scale_x), scale_y(_scale_y), cn(_cn), step(_step)/*, ofs(_ofs)*/
{ {
fast_mode = scale_x == 2 && scale_y == 2 && (cn == 1 || cn == 3 || cn == 4); fast_mode = scale_x == 2 && scale_y == 2 && (cn == 1 || cn == 3 || cn == 4);
...@@ -1250,22 +1247,22 @@ struct ResizeAreaFast_2x2_8u ...@@ -1250,22 +1247,22 @@ struct ResizeAreaFast_2x2_8u
if( !fast_mode ) if( !fast_mode )
return 0; return 0;
const T* nextS = S + step; const T* nextS = (const T*)((const uchar*)S + step);
int dx = 0; int dx = 0;
if (cn == 1) if (cn == 1)
for( ; dx < w; ++dx ) for( ; dx < w; ++dx )
{ {
int index = dx*2; int index = dx*2;
D[dx] = (S[index] + S[index+1] + nextS[index] + nextS[index+1] + 2) >> 2; D[dx] = (T)((S[index] + S[index+1] + nextS[index] + nextS[index+1] + 2) >> 2);
} }
else if (cn == 3) else if (cn == 3)
for( ; dx < w; dx += 3 ) for( ; dx < w; dx += 3 )
{ {
int index = dx*2; int index = dx*2;
D[dx] = (S[index] + S[index+3] + nextS[index] + nextS[index+3] + 2) >> 2; D[dx] = (T)((S[index] + S[index+3] + nextS[index] + nextS[index+3] + 2) >> 2);
D[dx+1] = (S[index+1] + S[index+4] + nextS[index+1] + nextS[index+4] + 2) >> 2; D[dx+1] = (T)((S[index+1] + S[index+4] + nextS[index+1] + nextS[index+4] + 2) >> 2);
D[dx+2] = (S[index+2] + S[index+5] + nextS[index+2] + nextS[index+5] + 2) >> 2; D[dx+2] = (T)((S[index+2] + S[index+5] + nextS[index+2] + nextS[index+5] + 2) >> 2);
} }
else else
{ {
...@@ -1273,10 +1270,10 @@ struct ResizeAreaFast_2x2_8u ...@@ -1273,10 +1270,10 @@ struct ResizeAreaFast_2x2_8u
for( ; dx < w; dx += 4 ) for( ; dx < w; dx += 4 )
{ {
int index = dx*2; int index = dx*2;
D[dx] = (S[index] + S[index+4] + nextS[index] + nextS[index+4] + 2) >> 2; D[dx] = (T)((S[index] + S[index+4] + nextS[index] + nextS[index+4] + 2) >> 2);
D[dx+1] = (S[index+1] + S[index+5] + nextS[index+1] + nextS[index+5] + 2) >> 2; D[dx+1] = (T)((S[index+1] + S[index+5] + nextS[index+1] + nextS[index+5] + 2) >> 2);
D[dx+2] = (S[index+2] + S[index+6] + nextS[index+2] + nextS[index+6] + 2) >> 2; D[dx+2] = (T)((S[index+2] + S[index+6] + nextS[index+2] + nextS[index+6] + 2) >> 2);
D[dx+3] = (S[index+3] + S[index+7] + nextS[index+3] + nextS[index+7] + 2) >> 2; D[dx+3] = (T)((S[index+3] + S[index+7] + nextS[index+3] + nextS[index+7] + 2) >> 2);
} }
} }
...@@ -1284,13 +1281,10 @@ struct ResizeAreaFast_2x2_8u ...@@ -1284,13 +1281,10 @@ struct ResizeAreaFast_2x2_8u
} }
private: private:
const int scale_x, scale_y; int scale_x, scale_y;
const int cn; int cn;
bool fast_mode; bool fast_mode;
const int step; int step;
ResizeAreaFast_2x2_8u(const ResizeAreaFast_2x2_8u&);
ResizeAreaFast_2x2_8u& operator=(const ResizeAreaFast_2x2_8u&);
}; };
template <typename T, typename WT, typename VecOp> template <typename T, typename WT, typename VecOp>
...@@ -1376,11 +1370,8 @@ public: ...@@ -1376,11 +1370,8 @@ public:
private: private:
const Mat src; const Mat src;
Mat dst; Mat dst;
const int scale_x, scale_y; int scale_x, scale_y;
const int *ofs, *xofs; const int *ofs, *xofs;
resizeAreaFast_Invoker(const resizeAreaFast_Invoker&);
resizeAreaFast_Invoker& operator=(const resizeAreaFast_Invoker&);
}; };
template<typename T, typename WT, typename VecOp> template<typename T, typename WT, typename VecOp>
...@@ -1413,7 +1404,7 @@ public: ...@@ -1413,7 +1404,7 @@ public:
{ {
} }
void resize_signle_band(const Range& range) const void resize_single_band(const Range& range) const
{ {
Size ssize = src.size(), dsize = dst.size(); Size ssize = src.size(), dsize = dst.size();
int cn = src.channels(); int cn = src.channels();
...@@ -1520,21 +1511,18 @@ public: ...@@ -1520,21 +1511,18 @@ public:
for (int i = range.start; i < range.end; ++i) for (int i = range.start; i < range.end; ++i)
{ {
Range band_range(bands[i].first, bands[i].second); Range band_range(bands[i].first, bands[i].second);
resize_signle_band(band_range); resize_single_band(band_range);
} }
} }
private: private:
const Mat src; Mat src;
Mat dst; Mat dst;
const DecimateAlpha* xofs; const DecimateAlpha* xofs;
const int xofs_count; int xofs_count;
const double scale_y_; double scale_y_;
const int *cur_dy_ofs; const int *cur_dy_ofs;
std::vector<std::pair<int, int> > bands; std::vector<std::pair<int, int> > bands;
resizeArea_Invoker(const resizeArea_Invoker&);
resizeArea_Invoker& operator=(const resizeArea_Invoker&);
}; };
template <typename T, typename WT> template <typename T, typename WT>
...@@ -1566,7 +1554,8 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in ...@@ -1566,7 +1554,8 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in
Range range(0, bands.size()); Range range(0, bands.size());
resizeArea_Invoker<T, WT> invoker(src, dst, xofs, xofs_count, scale_y_, cur_dy_ofs, bands); resizeArea_Invoker<T, WT> invoker(src, dst, xofs, xofs_count, scale_y_, cur_dy_ofs, bands);
parallel_for_(range, invoker); //parallel_for_(range, invoker);
invoker(Range(range.start, range.end));
} }
...@@ -1678,10 +1667,10 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, ...@@ -1678,10 +1667,10 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
static ResizeAreaFastFunc areafast_tab[] = static ResizeAreaFastFunc areafast_tab[] =
{ {
resizeAreaFast_<uchar, int, ResizeAreaFast_2x2_8u<uchar, int> >, resizeAreaFast_<uchar, int, ResizeAreaFastVec<uchar> >,
0, 0,
resizeAreaFast_<ushort, float, ResizeAreaFastNoVec<ushort, float> >, resizeAreaFast_<ushort, float, ResizeAreaFastVec<ushort> >,
resizeAreaFast_<short, float, ResizeAreaFastNoVec<short, float> >, resizeAreaFast_<short, float, ResizeAreaFastVec<short> >,
0, 0,
resizeAreaFast_<float, float, ResizeAreaFastNoVec<float, float> >, resizeAreaFast_<float, float, ResizeAreaFastNoVec<float, float> >,
resizeAreaFast_<double, double, ResizeAreaFastNoVec<double, double> >, resizeAreaFast_<double, double, ResizeAreaFastNoVec<double, double> >,
...@@ -1739,11 +1728,9 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, ...@@ -1739,11 +1728,9 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize,
// in case of scale_x && scale_y is equal to 2 // in case of scale_x && scale_y is equal to 2
// INTER_AREA (fast) also is equal to INTER_LINEAR // INTER_AREA (fast) also is equal to INTER_LINEAR
if ( interpolation == INTER_LINEAR && std::abs(scale_x - 2.0) < DBL_EPSILON && if( interpolation == INTER_LINEAR && is_area_fast && iscale_x == 2 && iscale_y == 2 )
std::abs(scale_y - 2.0) < DBL_EPSILON)
{ {
interpolation = INTER_AREA; interpolation = INTER_AREA;
is_area_fast = true;
} }
// true "area" interpolation is only implemented for the case (scale_x <= 1 && scale_y <= 1). // true "area" interpolation is only implemented for the case (scale_x <= 1 && scale_y <= 1).
...@@ -2882,18 +2869,16 @@ public: ...@@ -2882,18 +2869,16 @@ public:
} }
private: private:
const Mat src; Mat src;
Mat dst; Mat dst;
const Mat map1, map2, *m1, *m2; Mat map1, map2;
const Mat *m1, *m2;
int interpolation, borderType; int interpolation, borderType;
const Scalar borderValue; Scalar borderValue;
int planar_input; int planar_input;
RemapNNFunc nnfunc; RemapNNFunc nnfunc;
RemapFunc ifunc; RemapFunc ifunc;
const void *ctab; const void *ctab;
remapInvoker(const remapInvoker&);
remapInvoker& operator=(const remapInvoker&);
}; };
} }
...@@ -3252,15 +3237,12 @@ public: ...@@ -3252,15 +3237,12 @@ public:
} }
private: private:
const Mat src; Mat src;
Mat dst; Mat dst;
int interpolation, borderType; int interpolation, borderType;
const Scalar borderValue; Scalar borderValue;
int *adelta, *bdelta; int *adelta, *bdelta;
double *M; double *M;
warpAffineInvoker(const warpAffineInvoker&);
warpAffineInvoker& operator=(const warpAffineInvoker&);
}; };
} }
...@@ -3409,13 +3391,11 @@ public: ...@@ -3409,13 +3391,11 @@ public:
} }
private: private:
const Mat src; Mat src;
Mat dst; Mat dst;
double* M; double* M;
int interpolation, borderType; int interpolation, borderType;
const Scalar borderValue; Scalar borderValue;
warpPerspectiveInvoker(const warpPerspectiveInvoker&);
warpPerspectiveInvoker& operator=(const warpPerspectiveInvoker&);
}; };
} }
......
...@@ -2069,6 +2069,7 @@ protected: ...@@ -2069,6 +2069,7 @@ protected:
char delimiter; char delimiter;
char miss_ch; char miss_ch;
short header_lines_number;
//char flt_separator; //char flt_separator;
CvMat* values; CvMat* values;
...@@ -2093,8 +2094,6 @@ protected: ...@@ -2093,8 +2094,6 @@ protected:
int* sample_idx; // data of train_sample_idx and test_sample_idx int* sample_idx; // data of train_sample_idx and test_sample_idx
cv::RNG* rng; cv::RNG* rng;
int header_lines_number;
}; };
......
...@@ -121,7 +121,7 @@ void CvMLData::clear() ...@@ -121,7 +121,7 @@ void CvMLData::clear()
void CvMLData::set_header_lines_number( int idx ) void CvMLData::set_header_lines_number( int idx )
{ {
header_lines_number = std::max(0, idx); header_lines_number = (short)std::max(0, idx);
} }
int CvMLData::get_header_lines_number() const int CvMLData::get_header_lines_number() const
......
...@@ -1572,13 +1572,9 @@ cvHaarDetectObjectsForROC( const CvArr* _img, ...@@ -1572,13 +1572,9 @@ cvHaarDetectObjectsForROC( const CvArr* _img,
cvIntegral( &img1, &sum1, &sqsum1, _tilted ); cvIntegral( &img1, &sum1, &sqsum1, _tilted );
int ystep = factor > 2 ? 1 : 2; int ystep = factor > 2 ? 1 : 2;
#ifdef HAVE_TBB
const int LOCS_PER_THREAD = 1000; const int LOCS_PER_THREAD = 1000;
int stripCount = ((sz1.width/ystep)*(sz1.height + ystep-1)/ystep + LOCS_PER_THREAD/2)/LOCS_PER_THREAD; int stripCount = ((sz1.width/ystep)*(sz1.height + ystep-1)/ystep + LOCS_PER_THREAD/2)/LOCS_PER_THREAD;
stripCount = std::min(std::max(stripCount, 1), 100); stripCount = std::min(std::max(stripCount, 1), 100);
#else
const int stripCount = 1;
#endif
#ifdef HAVE_IPP #ifdef HAVE_IPP
if( use_ipp ) if( use_ipp )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment