mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge remote-tracking branch 'refs/remotes/upstream/master'
This commit is contained in:
@@ -196,6 +196,10 @@
|
||||
# define CV_NEON 1
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__ && defined __arm__ && (defined __ARM_PCS_VFP || defined __ARM_VFPV3__)
|
||||
# define CV_VFP 1
|
||||
#endif
|
||||
|
||||
#endif // __CUDACC__
|
||||
|
||||
#ifndef CV_POPCNT
|
||||
@@ -263,6 +267,10 @@
|
||||
# define CV_NEON 0
|
||||
#endif
|
||||
|
||||
#ifndef CV_VFP
|
||||
# define CV_VFP 0
|
||||
#endif
|
||||
|
||||
/* primitive types */
|
||||
/*
|
||||
schar - signed 1 byte integer
|
||||
@@ -437,6 +445,23 @@ typedef signed char schar;
|
||||
//! @addtogroup core_utils
|
||||
//! @{
|
||||
|
||||
#if CV_VFP
|
||||
// 1. general scheme
|
||||
#define ARM_ROUND(_value, _asm_string) \
|
||||
int res; \
|
||||
float temp; \
|
||||
asm(_asm_string : [res] "=r" (res), [temp] "=w" (temp) : [value] "w" (_value)); \
|
||||
return res;
|
||||
// 2. version for double
|
||||
#ifdef __clang__
|
||||
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %[value] \n vmov %[res], %[temp]")
|
||||
#else
|
||||
#define ARM_ROUND_DBL(value) ARM_ROUND(value, "vcvtr.s32.f64 %[temp], %P[value] \n vmov %[res], %[temp]")
|
||||
#endif
|
||||
// 3. version for float
|
||||
#define ARM_ROUND_FLT(value) ARM_ROUND(value, "vcvtr.s32.f32 %[temp], %[value]\n vmov %[res], %[temp]")
|
||||
#endif // CV_VFP
|
||||
|
||||
/** @brief Rounds floating-point number to the nearest integer
|
||||
|
||||
@param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the
|
||||
@@ -460,6 +485,8 @@ CV_INLINE int cvRound( double value )
|
||||
#elif defined CV_ICC || defined __GNUC__
|
||||
# ifdef HAVE_TEGRA_OPTIMIZATION
|
||||
TEGRA_ROUND(value);
|
||||
# elif CV_VFP
|
||||
ARM_ROUND_DBL(value)
|
||||
# else
|
||||
return (int)lrint(value);
|
||||
# endif
|
||||
@@ -473,6 +500,26 @@ CV_INLINE int cvRound( double value )
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/** @overload */
|
||||
CV_INLINE int cvRound(float value)
|
||||
{
|
||||
#if CV_VFP && !defined HAVE_TEGRA_OPTIMIZATION
|
||||
ARM_ROUND_FLT(value)
|
||||
#else
|
||||
return cvRound((double)value);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @overload */
|
||||
CV_INLINE int cvRound(int value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
/** @brief Rounds floating-point number to the nearest integer not larger than the original.
|
||||
|
||||
The function computes an integer i such that:
|
||||
|
||||
@@ -2651,7 +2651,6 @@ CV_IMPL CvFileStorage*
|
||||
cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, const char* encoding )
|
||||
{
|
||||
CvFileStorage* fs = 0;
|
||||
char* xml_buf = 0;
|
||||
int default_block_size = 1 << 18;
|
||||
bool append = (flags & 3) == CV_STORAGE_APPEND;
|
||||
bool mem = (flags & CV_STORAGE_MEMORY) != 0;
|
||||
@@ -2692,7 +2691,10 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
(dot_pos[3] == '\0' || (cv_isdigit(dot_pos[3]) && dot_pos[4] == '\0')) )
|
||||
{
|
||||
if( append )
|
||||
{
|
||||
cvReleaseFileStorage( &fs );
|
||||
CV_Error(CV_StsNotImplemented, "Appending data to compressed file is not implemented" );
|
||||
}
|
||||
isGZ = true;
|
||||
compression = dot_pos[3];
|
||||
if( compression )
|
||||
@@ -2713,6 +2715,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
if( !fs->gzfile )
|
||||
goto _exit_;
|
||||
#else
|
||||
cvReleaseFileStorage( &fs );
|
||||
CV_Error(CV_StsNotImplemented, "There is no compressed file storage support in this configuration");
|
||||
#endif
|
||||
}
|
||||
@@ -2765,7 +2768,10 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
if( strcmp( encoding, "UTF-16" ) == 0 ||
|
||||
strcmp( encoding, "utf-16" ) == 0 ||
|
||||
strcmp( encoding, "Utf-16" ) == 0 )
|
||||
{
|
||||
cvReleaseFileStorage( &fs );
|
||||
CV_Error( CV_StsBadArg, "UTF-16 XML encoding is not supported! Use 8-bit encoding\n");
|
||||
}
|
||||
|
||||
CV_Assert( strlen(encoding) < 1000 );
|
||||
char buf[1100];
|
||||
@@ -2783,7 +2789,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
int last_occurence = -1;
|
||||
xml_buf_size = MIN(xml_buf_size, int(file_size));
|
||||
fseek( fs->file, -xml_buf_size, SEEK_END );
|
||||
xml_buf = (char*)cvAlloc( xml_buf_size+2 );
|
||||
char* xml_buf = (char*)cvAlloc( xml_buf_size+2 );
|
||||
// find the last occurence of </opencv_storage>
|
||||
for(;;)
|
||||
{
|
||||
@@ -2801,8 +2807,12 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
ptr += strlen(substr);
|
||||
}
|
||||
}
|
||||
cvFree( &xml_buf );
|
||||
if( last_occurence < 0 )
|
||||
{
|
||||
cvReleaseFileStorage( &fs );
|
||||
CV_Error( CV_StsError, "Could not find </opencv_storage> in the end of file.\n" );
|
||||
}
|
||||
icvCloseFile( fs );
|
||||
fs->file = fopen( fs->filename, "r+t" );
|
||||
fseek( fs->file, last_occurence, SEEK_SET );
|
||||
@@ -2876,10 +2886,18 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
||||
|
||||
//mode = cvGetErrMode();
|
||||
//cvSetErrMode( CV_ErrModeSilent );
|
||||
if( fs->fmt == CV_STORAGE_FORMAT_XML )
|
||||
icvXMLParse( fs );
|
||||
else
|
||||
icvYMLParse( fs );
|
||||
try
|
||||
{
|
||||
if( fs->fmt == CV_STORAGE_FORMAT_XML )
|
||||
icvXMLParse( fs );
|
||||
else
|
||||
icvYMLParse( fs );
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
cvReleaseFileStorage( &fs );
|
||||
throw;
|
||||
}
|
||||
//cvSetErrMode( mode );
|
||||
|
||||
// release resources that we do not need anymore
|
||||
@@ -2904,7 +2922,6 @@ _exit_:
|
||||
}
|
||||
}
|
||||
|
||||
cvFree( &xml_buf );
|
||||
return fs;
|
||||
}
|
||||
|
||||
|
||||
@@ -2320,7 +2320,10 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
||||
depth == CV_8U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8u_C1R :
|
||||
depth == CV_8S ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_8s_C1R :
|
||||
depth == CV_16U ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_16u_C1R :
|
||||
depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R : 0;
|
||||
#if !((defined _MSC_VER && defined _M_IX86) || defined __i386__)
|
||||
depth == CV_32F ? (ippiMinMaxIndxFuncC1)ippiMinMaxIndx_32f_C1R :
|
||||
#endif
|
||||
0;
|
||||
CV_SUPPRESS_DEPRECATED_END
|
||||
|
||||
if( ippFuncC1 )
|
||||
|
||||
@@ -464,6 +464,7 @@ static int icvInitSystem(int* c, char** v)
|
||||
if (!QApplication::instance())
|
||||
{
|
||||
new QApplication(*c, v);
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
|
||||
qDebug() << "init done";
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ CV_IMPL int cvInitSystem( int argc, char** argv )
|
||||
}
|
||||
wasInitialized = 1;
|
||||
}
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -156,6 +156,8 @@ CV_IMPL int cvInitSystem( int , char** )
|
||||
//[application finishLaunching];
|
||||
//atexit(icvCocoaCleanup);
|
||||
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -260,6 +260,8 @@ CV_IMPL int cvInitSystem( int, char** )
|
||||
wasInitialized = 1;
|
||||
}
|
||||
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -5454,7 +5454,7 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0,
|
||||
const ocl::Device & dev = ocl::Device::getDefault();
|
||||
|
||||
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
|
||||
double doubleSupport = dev.doubleFPConfig() > 0;
|
||||
const bool doubleSupport = dev.doubleFPConfig() > 0;
|
||||
|
||||
int interpolation = flags & INTER_MAX;
|
||||
if( interpolation == INTER_AREA )
|
||||
|
||||
@@ -1339,7 +1339,7 @@ public:
|
||||
|
||||
//! Regularization kinds
|
||||
enum RegKinds {
|
||||
REG_NONE = -1, //!< Regularization disabled
|
||||
REG_DISABLE = -1, //!< Regularization disabled
|
||||
REG_L1 = 0, //!< %L1 norm
|
||||
REG_L2 = 1 //!< %L2 norm
|
||||
};
|
||||
|
||||
@@ -322,7 +322,7 @@ double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels
|
||||
theta_b = _init_theta(Range(1, n), Range::all());
|
||||
multiply(theta_b, theta_b, theta_c, 1);
|
||||
|
||||
if(params.norm != REG_NONE)
|
||||
if (params.norm != REG_DISABLE)
|
||||
{
|
||||
llambda = 1;
|
||||
}
|
||||
@@ -377,7 +377,7 @@ Mat LogisticRegressionImpl::compute_batch_gradient(const Mat& _data, const Mat&
|
||||
m = _data.rows;
|
||||
n = _data.cols;
|
||||
|
||||
if(params.norm != REG_NONE)
|
||||
if (params.norm != REG_DISABLE)
|
||||
{
|
||||
llambda = 1;
|
||||
}
|
||||
@@ -449,7 +449,7 @@ Mat LogisticRegressionImpl::compute_mini_batch_gradient(const Mat& _data, const
|
||||
Mat data_d;
|
||||
Mat labels_l;
|
||||
|
||||
if(params.norm != REG_NONE)
|
||||
if (params.norm != REG_DISABLE)
|
||||
{
|
||||
lambda_l = 1;
|
||||
}
|
||||
|
||||
@@ -1235,7 +1235,9 @@ static void init_submodule(PyObject * root, const char * name, PyMethodDef * met
|
||||
submod = PyImport_AddModule(full_name.c_str());
|
||||
PyDict_SetItemString(d, short_name.c_str(), submod);
|
||||
}
|
||||
root = submod;
|
||||
|
||||
if (short_name != "")
|
||||
root = submod;
|
||||
}
|
||||
|
||||
// populate module's dict
|
||||
|
||||
@@ -512,7 +512,7 @@ CV_INLINE void
|
||||
{
|
||||
for (long x = 0; x < _src.cols; x++)
|
||||
{
|
||||
const uchar* data = _src.ptr(y, x);
|
||||
const uchar* data = _src.ptr((int)y, (int)x);
|
||||
|
||||
//update model+ background subtract
|
||||
uchar include=0;
|
||||
@@ -539,15 +539,15 @@ CV_INLINE void
|
||||
{
|
||||
case 0:
|
||||
//foreground
|
||||
*_dst.ptr(y, x) = 255;
|
||||
*_dst.ptr((int)y, (int)x) = 255;
|
||||
break;
|
||||
case 1:
|
||||
//background
|
||||
*_dst.ptr(y, x) = 0;
|
||||
*_dst.ptr((int)y, (int)x) = 0;
|
||||
break;
|
||||
case 2:
|
||||
//shadow
|
||||
*_dst.ptr(y, x) = nShadowDetection;
|
||||
*_dst.ptr((int)y, (int)x) = nShadowDetection;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
||||
@@ -302,7 +302,15 @@ void CvCapture_FFMPEG::close()
|
||||
}
|
||||
|
||||
if( picture )
|
||||
{
|
||||
// FFmpeg and Libav added avcodec_free_frame in different versions.
|
||||
#if LIBAVCODEC_BUILD >= (LIBAVCODEC_VERSION_MICRO >= 100 \
|
||||
? CALC_FFMPEG_VERSION(54, 59, 100) : CALC_FFMPEG_VERSION(54, 28, 0))
|
||||
avcodec_free_frame(&picture);
|
||||
#else
|
||||
av_free(picture);
|
||||
#endif
|
||||
}
|
||||
|
||||
if( video_st )
|
||||
{
|
||||
|
||||
@@ -574,7 +574,7 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
||||
return false;
|
||||
}
|
||||
g_object_unref(G_OBJECT(testfac));
|
||||
filename = "v4lsrc ! "COLOR_ELEM" ! appsink";
|
||||
filename = "v4lsrc ! " COLOR_ELEM " ! appsink";
|
||||
}
|
||||
if (type == CV_CAP_GSTREAMER_V4L2){
|
||||
testfac = gst_element_factory_find("v4l2src");
|
||||
@@ -582,7 +582,7 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
||||
return false;
|
||||
}
|
||||
g_object_unref(G_OBJECT(testfac));
|
||||
filename = "v4l2src ! "COLOR_ELEM" ! appsink";
|
||||
filename = "v4l2src ! " COLOR_ELEM " ! appsink";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user