Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -75,6 +75,7 @@
|
||||
@defgroup core_utils_sse SSE utilities
|
||||
@defgroup core_utils_neon NEON utilities
|
||||
@defgroup core_utils_softfloat Softfloat support
|
||||
@defgroup core_utils_samples Utility functions for OpenCV samples
|
||||
@}
|
||||
@defgroup core_opengl OpenGL interoperability
|
||||
@defgroup core_ipp Intel IPP Asynchronous C/C++ Converters
|
||||
|
||||
@@ -349,6 +349,15 @@ Cv64suf;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CV_DEPRECATED_EXTERNAL
|
||||
# if defined(__OPENCV_BUILD)
|
||||
# define CV_DEPRECATED_EXTERNAL /* nothing */
|
||||
# else
|
||||
# define CV_DEPRECATED_EXTERNAL CV_DEPRECATED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef CV_EXTERN_C
|
||||
# ifdef __cplusplus
|
||||
# define CV_EXTERN_C extern "C"
|
||||
|
||||
@@ -1363,25 +1363,22 @@ inline v_float64x4 v_cvt_f64_high(const v_float32x8& a)
|
||||
|
||||
inline v_int32x8 v_lut(const int* tab, const v_int32x8& idxvec)
|
||||
{
|
||||
int CV_DECL_ALIGNED(32) idx[8];
|
||||
v_store_aligned(idx, idxvec);
|
||||
return v_int32x8(_mm256_setr_epi32(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]],
|
||||
tab[idx[4]], tab[idx[5]], tab[idx[6]], tab[idx[7]]));
|
||||
return v_int32x8(_mm256_i32gather_epi32(tab, idxvec.val, 4));
|
||||
}
|
||||
|
||||
inline v_uint32x8 v_lut(const unsigned* tab, const v_int32x8& idxvec)
|
||||
{
|
||||
return v_reinterpret_as_u32(v_lut((const int *)tab, idxvec));
|
||||
}
|
||||
|
||||
inline v_float32x8 v_lut(const float* tab, const v_int32x8& idxvec)
|
||||
{
|
||||
int CV_DECL_ALIGNED(32) idx[8];
|
||||
v_store_aligned(idx, idxvec);
|
||||
return v_float32x8(_mm256_setr_ps(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]],
|
||||
tab[idx[4]], tab[idx[5]], tab[idx[6]], tab[idx[7]]));
|
||||
return v_float32x8(_mm256_i32gather_ps(tab, idxvec.val, 4));
|
||||
}
|
||||
|
||||
inline v_float64x4 v_lut(const double* tab, const v_int32x8& idxvec)
|
||||
{
|
||||
int CV_DECL_ALIGNED(32) idx[8];
|
||||
v_store_aligned(idx, idxvec);
|
||||
return v_float64x4(_mm256_setr_pd(tab[idx[0]], tab[idx[1]], tab[idx[2]], tab[idx[3]]));
|
||||
return v_float64x4(_mm256_i32gather_pd(tab, _mm256_castsi256_si128(idxvec.val), 8));
|
||||
}
|
||||
|
||||
inline void v_lut_deinterleave(const float* tab, const v_int32x8& idxvec, v_float32x8& x, v_float32x8& y)
|
||||
|
||||
@@ -794,6 +794,82 @@ CV_EXPORTS InstrNode* getCurrentNode();
|
||||
#define CV_INSTRUMENT_REGION(); CV_INSTRUMENT_REGION_();
|
||||
#endif
|
||||
|
||||
namespace cv {
|
||||
|
||||
namespace utils {
|
||||
|
||||
//! @addtogroup core_utils
|
||||
//! @{
|
||||
|
||||
/** @brief Try to find requested data file
|
||||
|
||||
Search directories:
|
||||
|
||||
1. Directories passed via `addDataSearchPath()`
|
||||
2. Check path specified by configuration parameter with "_HINT" suffix (name of environment variable).
|
||||
3. Check path specified by configuration parameter (name of environment variable).
|
||||
If parameter value is not empty and nothing is found then stop searching.
|
||||
4. Detects build/install path based on:
|
||||
a. current working directory (CWD)
|
||||
b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
|
||||
5. Scan `<source>/{,data}` directories if build directory is detected or the current directory is in source tree.
|
||||
6. Scan `<install>/share/OpenCV` directory if install directory is detected.
|
||||
|
||||
@param relative_path Relative path to data file
|
||||
@param required Specify "file not found" handling.
|
||||
If true, function prints information message and raises cv::Exception.
|
||||
If false, function returns empty result
|
||||
@param configuration_parameter specify configuration parameter name. Default NULL value means "OPENCV_DATA_PATH".
|
||||
@return Returns path (absolute or relative to the current directory) or empty string if file is not found
|
||||
|
||||
@note Implementation is not thread-safe.
|
||||
*/
|
||||
CV_EXPORTS
|
||||
cv::String findDataFile(const cv::String& relative_path, bool required = true,
|
||||
const char* configuration_parameter = NULL);
|
||||
|
||||
/** @overload
|
||||
@param relative_path Relative path to data file
|
||||
@param configuration_parameter specify configuration parameter name. Default NULL value means "OPENCV_DATA_PATH".
|
||||
@param search_paths override addDataSearchPath() settings.
|
||||
@param subdir_paths override addDataSearchSubDirectory() settings.
|
||||
@return Returns path (absolute or relative to the current directory) or empty string if file is not found
|
||||
|
||||
@note Implementation is not thread-safe.
|
||||
*/
|
||||
CV_EXPORTS
|
||||
cv::String findDataFile(const cv::String& relative_path,
|
||||
const char* configuration_parameter,
|
||||
const std::vector<String>* search_paths,
|
||||
const std::vector<String>* subdir_paths);
|
||||
|
||||
/** @brief Override default search data path by adding new search location
|
||||
|
||||
Use this only to override default behavior
|
||||
Passed paths are used in LIFO order.
|
||||
|
||||
@param path Path to used samples data
|
||||
|
||||
@note Implementation is not thread-safe.
|
||||
*/
|
||||
CV_EXPORTS void addDataSearchPath(const cv::String& path);
|
||||
|
||||
/** @brief Append default search data sub directory
|
||||
|
||||
General usage is to add OpenCV modules name (`<opencv_contrib>/modules/<name>/data` -> `modules/<name>/data` + `<name>/data`).
|
||||
Passed subdirectories are used in LIFO order.
|
||||
|
||||
@param subdir samples data sub directory
|
||||
|
||||
@note Implementation is not thread-safe.
|
||||
*/
|
||||
CV_EXPORTS void addDataSearchSubDirectory(const cv::String& subdir);
|
||||
|
||||
//! @}
|
||||
|
||||
} // namespace utils
|
||||
} // namespace cv
|
||||
|
||||
//! @endcond
|
||||
|
||||
#endif // OPENCV_CORE_PRIVATE_HPP
|
||||
|
||||
@@ -1234,8 +1234,75 @@ enum FLAGS
|
||||
CV_EXPORTS void setFlags(FLAGS modeFlags);
|
||||
static inline void setFlags(int modeFlags) { setFlags((FLAGS)modeFlags); }
|
||||
CV_EXPORTS FLAGS getFlags();
|
||||
|
||||
} // namespace instr
|
||||
|
||||
|
||||
namespace samples {
|
||||
|
||||
//! @addtogroup core_utils_samples
|
||||
// This section describes utility functions for OpenCV samples.
|
||||
//
|
||||
// @note Implementation of these utilities is not thread-safe.
|
||||
//
|
||||
//! @{
|
||||
|
||||
/** @brief Try to find requested data file
|
||||
|
||||
Search directories:
|
||||
|
||||
1. Directories passed via `addSamplesDataSearchPath()`
|
||||
2. OPENCV_SAMPLES_DATA_PATH_HINT environment variable
|
||||
3. OPENCV_SAMPLES_DATA_PATH environment variable
|
||||
If parameter value is not empty and nothing is found then stop searching.
|
||||
4. Detects build/install path based on:
|
||||
a. current working directory (CWD)
|
||||
b. and/or binary module location (opencv_core/opencv_world, doesn't work with static linkage)
|
||||
5. Scan `<source>/{,data,samples/data}` directories if build directory is detected or the current directory is in source tree.
|
||||
6. Scan `<install>/share/OpenCV` directory if install directory is detected.
|
||||
|
||||
@see cv::utils::findDataFile
|
||||
|
||||
@param relative_path Relative path to data file
|
||||
@param required Specify "file not found" handling.
|
||||
If true, function prints information message and raises cv::Exception.
|
||||
If false, function returns empty result
|
||||
@param silentMode Disables messages
|
||||
@return Returns path (absolute or relative to the current directory) or empty string if file is not found
|
||||
*/
|
||||
CV_EXPORTS_W cv::String findFile(const cv::String& relative_path, bool required = true, bool silentMode = false);
|
||||
|
||||
CV_EXPORTS_W cv::String findFileOrKeep(const cv::String& relative_path, bool silentMode = false);
|
||||
|
||||
inline cv::String findFileOrKeep(const cv::String& relative_path, bool silentMode)
|
||||
{
|
||||
cv::String res = findFile(relative_path, false, silentMode);
|
||||
if (res.empty())
|
||||
return relative_path;
|
||||
return res;
|
||||
}
|
||||
|
||||
/** @brief Override search data path by adding new search location
|
||||
|
||||
Use this only to override default behavior
|
||||
Passed paths are used in LIFO order.
|
||||
|
||||
@param path Path to used samples data
|
||||
*/
|
||||
CV_EXPORTS_W void addSamplesDataSearchPath(const cv::String& path);
|
||||
|
||||
/** @brief Append samples search data sub directory
|
||||
|
||||
General usage is to add OpenCV modules name (`<opencv_contrib>/modules/<name>/samples/data` -> `<name>/samples/data` + `modules/<name>/samples/data`).
|
||||
Passed subdirectories are used in LIFO order.
|
||||
|
||||
@param subdir samples data sub directory
|
||||
*/
|
||||
CV_EXPORTS_W void addSamplesDataSearchSubDirectory(const cv::String& subdir);
|
||||
|
||||
//! @}
|
||||
} // namespace samples
|
||||
|
||||
namespace utils {
|
||||
|
||||
CV_EXPORTS int getThreadID();
|
||||
|
||||
@@ -16,6 +16,13 @@ CV_EXPORTS void remove_all(const cv::String& path);
|
||||
|
||||
CV_EXPORTS cv::String getcwd();
|
||||
|
||||
/** @brief Converts path p to a canonical absolute path
|
||||
* Symlinks are processed if there is support for them on running platform.
|
||||
*
|
||||
* @param path input path. Target file/directory should exist.
|
||||
*/
|
||||
CV_EXPORTS cv::String canonical(const cv::String& path);
|
||||
|
||||
/** Join path components */
|
||||
CV_EXPORTS cv::String join(const cv::String& base, const cv::String& path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user