Commit 5877debb authored by Maksim Shabunin's avatar Maksim Shabunin

HAL resize, warpAffine, warpPerspective interface

- added HAL documentation support
- added documentation to HAL replacement interface
- updated several HAL functions in imgproc module
parent 06ea0aa0
...@@ -42,6 +42,7 @@ if(BUILD_DOCS AND DOXYGEN_FOUND) ...@@ -42,6 +42,7 @@ if(BUILD_DOCS AND DOXYGEN_FOUND)
set(paths_bib) set(paths_bib)
set(paths_sample) set(paths_sample)
set(paths_tutorial) set(paths_tutorial)
set(paths_hal_interface)
set(refs_main) set(refs_main)
set(refs_extra) set(refs_extra)
set(deps) set(deps)
...@@ -87,6 +88,11 @@ if(BUILD_DOCS AND DOXYGEN_FOUND) ...@@ -87,6 +88,11 @@ if(BUILD_DOCS AND DOXYGEN_FOUND)
file(APPEND "${tutorial_contrib_root}" "- ${m}. @subpage ${tutorial_id}\n") file(APPEND "${tutorial_contrib_root}" "- ${m}. @subpage ${tutorial_id}\n")
endforeach() endforeach()
endif() endif()
# HAL replacement file
set(replacement_header "${OPENCV_MODULE_opencv_${m}_LOCATION}/src/hal_replacement.hpp")
if(EXISTS "${replacement_header}")
list(APPEND paths_hal_interface "${replacement_header}")
endif()
# BiBTeX file # BiBTeX file
set(bib_file "${docs_dir}/${m}.bib") set(bib_file "${docs_dir}/${m}.bib")
...@@ -131,7 +137,7 @@ if(BUILD_DOCS AND DOXYGEN_FOUND) ...@@ -131,7 +137,7 @@ if(BUILD_DOCS AND DOXYGEN_FOUND)
set(example_path "${CMAKE_SOURCE_DIR}/samples") set(example_path "${CMAKE_SOURCE_DIR}/samples")
# set export variables # set export variables
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_INPUT_LIST "${rootfile} ; ${faqfile} ; ${paths_include} ; ${paths_doc} ; ${tutorial_path} ; ${tutorial_py_path} ; ${paths_tutorial} ; ${tutorial_contrib_root}") string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_INPUT_LIST "${rootfile} ; ${faqfile} ; ${paths_include} ; ${paths_hal_interface} ; ${paths_doc} ; ${tutorial_path} ; ${tutorial_py_path} ; ${paths_tutorial} ; ${tutorial_contrib_root}")
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_IMAGE_PATH "${paths_doc} ; ${tutorial_path} ; ${tutorial_py_path} ; ${paths_tutorial}") string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_IMAGE_PATH "${paths_doc} ; ${tutorial_path} ; ${tutorial_py_path} ; ${paths_tutorial}")
# TODO: remove paths_doc from EXAMPLE_PATH after face module tutorials/samples moved to separate folders # TODO: remove paths_doc from EXAMPLE_PATH after face module tutorials/samples moved to separate folders
string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_EXAMPLE_PATH "${example_path} ; ${paths_doc} ; ${paths_sample}") string(REPLACE ";" " \\\n" CMAKE_DOXYGEN_EXAMPLE_PATH "${example_path} ; ${paths_doc} ; ${paths_sample}")
......
...@@ -357,67 +357,6 @@ Cv64suf; ...@@ -357,67 +357,6 @@ Cv64suf;
* Matrix type (Mat) * * Matrix type (Mat) *
\****************************************************************************************/ \****************************************************************************************/
#define CV_CN_MAX 512
#define CV_CN_SHIFT 3
#define CV_DEPTH_MAX (1 << CV_CN_SHIFT)
#define CV_8U 0
#define CV_8S 1
#define CV_16U 2
#define CV_16S 3
#define CV_32S 4
#define CV_32F 5
#define CV_64F 6
#define CV_USRTYPE1 7
#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
#define CV_MAKE_TYPE CV_MAKETYPE
#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
#define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT) #define CV_MAT_CN_MASK ((CV_CN_MAX - 1) << CV_CN_SHIFT)
#define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1) #define CV_MAT_CN(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
#define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1) #define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
......
...@@ -171,13 +171,13 @@ CV_EXPORTS void div32s( const int* src1, size_t step1, const int* src2, size_t s ...@@ -171,13 +171,13 @@ CV_EXPORTS void div32s( const int* src1, size_t step1, const int* src2, size_t s
CV_EXPORTS void div32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void div32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void div64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void div64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void recip8u( const uchar *, size_t, const uchar * src2, size_t step2, uchar* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void recip8s( const schar *, size_t, const schar * src2, size_t step2, schar* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void recip16u( const ushort *, size_t, const ushort * src2, size_t step2, ushort* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip16s( const short* src1, size_t step1, const short* src2, size_t step2, short* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void recip16s( const short *, size_t, const short * src2, size_t step2, short* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip32s( const int* src1, size_t step1, const int* src2, size_t step2, int* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void recip32s( const int *, size_t, const int * src2, size_t step2, int* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip32f( const float* src1, size_t step1, const float* src2, size_t step2, float* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void recip32f( const float *, size_t, const float * src2, size_t step2, float* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void recip64f( const double* src1, size_t step1, const double* src2, size_t step2, double* dst, size_t step, int width, int height, void* scale); CV_EXPORTS void recip64f( const double *, size_t, const double * src2, size_t step2, double* dst, size_t step, int width, int height, void* scale);
CV_EXPORTS void addWeighted8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _scalars ); CV_EXPORTS void addWeighted8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, uchar* dst, size_t step, int width, int height, void* _scalars );
CV_EXPORTS void addWeighted8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scalars ); CV_EXPORTS void addWeighted8s( const schar* src1, size_t step1, const schar* src2, size_t step2, schar* dst, size_t step, int width, int height, void* scalars );
......
#ifndef _HAL_INTERFACE_HPP_INCLUDED_ #ifndef OPENCV_CORE_HAL_INTERFACE_H
#define _HAL_INTERFACE_HPP_INCLUDED_ #define OPENCV_CORE_HAL_INTERFACE_H
//! @addtogroup core_hal_interface //! @addtogroup core_hal_interface
//! @{ //! @{
//! @name Return codes
//! @{
#define CV_HAL_ERROR_OK 0 #define CV_HAL_ERROR_OK 0
#define CV_HAL_ERROR_NOT_IMPLEMENTED 1 #define CV_HAL_ERROR_NOT_IMPLEMENTED 1
#define CV_HAL_ERROR_UNKNOWN -1 #define CV_HAL_ERROR_UNKNOWN -1
//! @}
#define CV_HAL_CMP_EQ 0
#define CV_HAL_CMP_GT 1
#define CV_HAL_CMP_GE 2
#define CV_HAL_CMP_LT 3
#define CV_HAL_CMP_LE 4
#define CV_HAL_CMP_NE 5
#ifdef __cplusplus #ifdef __cplusplus
#include <cstddef> #include <cstddef>
...@@ -21,18 +18,17 @@ ...@@ -21,18 +18,17 @@
#include <stddef.h> #include <stddef.h>
#endif #endif
/* primitive types */ //! @name Data types
/* //! primitive types
schar - signed 1 byte integer //! - schar - signed 1 byte integer
uchar - unsigned 1 byte integer //! - uchar - unsigned 1 byte integer
short - signed 2 byte integer //! - short - signed 2 byte integer
ushort - unsigned 2 byte integer //! - ushort - unsigned 2 byte integer
int - signed 4 byte integer //! - int - signed 4 byte integer
uint - unsigned 4 byte integer //! - uint - unsigned 4 byte integer
int64 - signed 8 byte integer //! - int64 - signed 8 byte integer
uint64 - unsigned 8 byte integer //! - uint64 - unsigned 8 byte integer
*/ //! @{
#if !defined _MSC_VER && !defined __BORLANDC__ #if !defined _MSC_VER && !defined __BORLANDC__
# if defined __cplusplus && __cplusplus >= 201103L && !defined __APPLE__ # if defined __cplusplus && __cplusplus >= 201103L && !defined __APPLE__
# include <cstdint> # include <cstdint>
...@@ -64,6 +60,91 @@ typedef signed char schar; ...@@ -64,6 +60,91 @@ typedef signed char schar;
# define CV_BIG_UINT(n) n##ULL # define CV_BIG_UINT(n) n##ULL
#endif #endif
#define CV_CN_MAX 512
#define CV_CN_SHIFT 3
#define CV_DEPTH_MAX (1 << CV_CN_SHIFT)
#define CV_8U 0
#define CV_8S 1
#define CV_16U 2
#define CV_16S 3
#define CV_32S 4
#define CV_32F 5
#define CV_64F 6
#define CV_USRTYPE1 7
#define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
#define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
#define CV_MAKE_TYPE CV_MAKETYPE
#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
//! @}
//! @name Comparison operation
//! @sa cv::CmpTypes
//! @{
#define CV_HAL_CMP_EQ 0
#define CV_HAL_CMP_GT 1
#define CV_HAL_CMP_GE 2
#define CV_HAL_CMP_LT 3
#define CV_HAL_CMP_LE 4
#define CV_HAL_CMP_NE 5
//! @}
//! @name Border processing modes
//! @sa cv::BorderTypes
//! @{
#define CV_HAL_BORDER_CONSTANT 0
#define CV_HAL_BORDER_REPLICATE 1
#define CV_HAL_BORDER_REFLECT 2
#define CV_HAL_BORDER_WRAP 3
#define CV_HAL_BORDER_REFLECT_101 4
#define CV_HAL_BORDER_TRANSPARENT 5
#define CV_HAL_BORDER_ISOLATED 16
//! @}
//! @} //! @}
#endif #endif
...@@ -3123,7 +3123,7 @@ void div8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, ...@@ -3123,7 +3123,7 @@ void div8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2,
if( src1 ) if( src1 )
div_i(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); div_i(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale);
else else
recip_i(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); recip_i(src2, step2, dst, step, width, height, *(const double*)scale);
} }
void div8s( const schar* src1, size_t step1, const schar* src2, size_t step2, void div8s( const schar* src1, size_t step1, const schar* src2, size_t step2,
...@@ -3172,53 +3172,53 @@ void div64f( const double* src1, size_t step1, const double* src2, size_t step2, ...@@ -3172,53 +3172,53 @@ void div64f( const double* src1, size_t step1, const double* src2, size_t step2,
// Reciprocial // Reciprocial
//======================================= //=======================================
void recip8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2, void recip8u( const uchar*, size_t, const uchar* src2, size_t step2,
uchar* dst, size_t step, int width, int height, void* scale) uchar* dst, size_t step, int width, int height, void* scale)
{ {
CALL_HAL(recip8u, cv_hal_recip8u, src1, step1, src2, step2, dst, step, width, height, *(const double*)scale) CALL_HAL(recip8u, cv_hal_recip8u, src2, step2, dst, step, width, height, *(const double*)scale)
recip_i(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); recip_i(src2, step2, dst, step, width, height, *(const double*)scale);
} }
void recip8s( const schar* src1, size_t step1, const schar* src2, size_t step2, void recip8s( const schar*, size_t, const schar* src2, size_t step2,
schar* dst, size_t step, int width, int height, void* scale) schar* dst, size_t step, int width, int height, void* scale)
{ {
CALL_HAL(recip8s, cv_hal_recip8s, src1, step1, src2, step2, dst, step, width, height, *(const double*)scale) CALL_HAL(recip8s, cv_hal_recip8s, src2, step2, dst, step, width, height, *(const double*)scale)
recip_i(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); recip_i(src2, step2, dst, step, width, height, *(const double*)scale);
} }
void recip16u( const ushort* src1, size_t step1, const ushort* src2, size_t step2, void recip16u( const ushort*, size_t, const ushort* src2, size_t step2,
ushort* dst, size_t step, int width, int height, void* scale) ushort* dst, size_t step, int width, int height, void* scale)
{ {
CALL_HAL(recip16u, cv_hal_recip16u, src1, step1, src2, step2, dst, step, width, height, *(const double*)scale) CALL_HAL(recip16u, cv_hal_recip16u, src2, step2, dst, step, width, height, *(const double*)scale)
recip_i(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); recip_i(src2, step2, dst, step, width, height, *(const double*)scale);
} }
void recip16s( const short* src1, size_t step1, const short* src2, size_t step2, void recip16s( const short*, size_t, const short* src2, size_t step2,
short* dst, size_t step, int width, int height, void* scale) short* dst, size_t step, int width, int height, void* scale)
{ {
CALL_HAL(recip16s, cv_hal_recip16s, src1, step1, src2, step2, dst, step, width, height, *(const double*)scale) CALL_HAL(recip16s, cv_hal_recip16s, src2, step2, dst, step, width, height, *(const double*)scale)
recip_i(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); recip_i(src2, step2, dst, step, width, height, *(const double*)scale);
} }
void recip32s( const int* src1, size_t step1, const int* src2, size_t step2, void recip32s( const int*, size_t, const int* src2, size_t step2,
int* dst, size_t step, int width, int height, void* scale) int* dst, size_t step, int width, int height, void* scale)
{ {
CALL_HAL(recip32s, cv_hal_recip32s, src1, step1, src2, step2, dst, step, width, height, *(const double*)scale) CALL_HAL(recip32s, cv_hal_recip32s, src2, step2, dst, step, width, height, *(const double*)scale)
recip_i(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); recip_i(src2, step2, dst, step, width, height, *(const double*)scale);
} }
void recip32f( const float* src1, size_t step1, const float* src2, size_t step2, void recip32f( const float*, size_t, const float* src2, size_t step2,
float* dst, size_t step, int width, int height, void* scale) float* dst, size_t step, int width, int height, void* scale)
{ {
CALL_HAL(recip32f, cv_hal_recip32f, src1, step1, src2, step2, dst, step, width, height, *(const double*)scale) CALL_HAL(recip32f, cv_hal_recip32f, src2, step2, dst, step, width, height, *(const double*)scale)
recip_f(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); recip_f(src2, step2, dst, step, width, height, *(const double*)scale);
} }
void recip64f( const double* src1, size_t step1, const double* src2, size_t step2, void recip64f( const double*, size_t, const double* src2, size_t step2,
double* dst, size_t step, int width, int height, void* scale) double* dst, size_t step, int width, int height, void* scale)
{ {
CALL_HAL(recip64f, cv_hal_recip64f, src1, step1, src2, step2, dst, step, width, height, *(const double*)scale) CALL_HAL(recip64f, cv_hal_recip64f, src2, step2, dst, step, width, height, *(const double*)scale)
recip_f(src1, step1, src2, step2, dst, step, width, height, *(const double*)scale); recip_f(src2, step2, dst, step, width, height, *(const double*)scale);
} }
//======================================= //=======================================
......
...@@ -528,7 +528,7 @@ div_f( const T* src1, size_t step1, const T* src2, size_t step2, ...@@ -528,7 +528,7 @@ div_f( const T* src1, size_t step1, const T* src2, size_t step2,
} }
template<typename T> static void template<typename T> static void
recip_i( const T*, size_t, const T* src2, size_t step2, recip_i( const T* src2, size_t step2,
T* dst, size_t step, int width, int height, double scale ) T* dst, size_t step, int width, int height, double scale )
{ {
step2 /= sizeof(src2[0]); step2 /= sizeof(src2[0]);
...@@ -549,7 +549,7 @@ recip_i( const T*, size_t, const T* src2, size_t step2, ...@@ -549,7 +549,7 @@ recip_i( const T*, size_t, const T* src2, size_t step2,
} }
template<typename T> static void template<typename T> static void
recip_f( const T*, size_t, const T* src2, size_t step2, recip_f( const T* src2, size_t step2,
T* dst, size_t step, int width, int height, double scale ) T* dst, size_t step, int width, int height, double scale )
{ {
T scale_f = (T)scale; T scale_f = (T)scale;
......
This diff is collapsed.
...@@ -213,6 +213,11 @@ location of points on the plane, building special graphs (such as NNG,RNG), and ...@@ -213,6 +213,11 @@ location of points on the plane, building special graphs (such as NNG,RNG), and
@defgroup imgproc_feature Feature Detection @defgroup imgproc_feature Feature Detection
@defgroup imgproc_object Object Detection @defgroup imgproc_object Object Detection
@defgroup imgproc_c C API @defgroup imgproc_c C API
@defgroup imgproc_hal Hardware Acceleration Layer
@{
@defgroup imgproc_hal_functions Functions
@defgroup imgproc_hal_interface Interface
@}
@} @}
*/ */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace cv { namespace hal { namespace cv { namespace hal {
//! @addtogroup core_hal_functions //! @addtogroup imgproc_hal_functions
//! @{ //! @{
struct CV_EXPORTS Filter2D struct CV_EXPORTS Filter2D
...@@ -45,9 +45,9 @@ struct CV_EXPORTS SepFilter2D ...@@ -45,9 +45,9 @@ struct CV_EXPORTS SepFilter2D
}; };
struct CV_EXPORTS MorphContext struct CV_EXPORTS Morph
{ {
static Ptr<MorphContext> create(int op, int src_type, int dst_type, int max_width, int max_height, static Ptr<Morph> create(int op, int src_type, int dst_type, int max_width, int max_height,
int kernel_type, uchar * kernel_data, size_t kernel_step, int kernel_type, uchar * kernel_data, size_t kernel_step,
int kernel_width, int kernel_height, int kernel_width, int kernel_height,
int anchor_x, int anchor_y, int anchor_x, int anchor_y,
...@@ -56,10 +56,25 @@ struct CV_EXPORTS MorphContext ...@@ -56,10 +56,25 @@ struct CV_EXPORTS MorphContext
virtual void apply(uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height, virtual void apply(uchar * src_data, size_t src_step, uchar * dst_data, size_t dst_step, int width, int height,
int roi_width, int roi_height, int roi_x, int roi_y, int roi_width, int roi_height, int roi_x, int roi_y,
int roi_width2, int roi_height2, int roi_x2, int roi_y2) = 0; int roi_width2, int roi_height2, int roi_x2, int roi_y2) = 0;
virtual ~MorphContext() {} virtual ~Morph() {}
}; };
CV_EXPORTS void resize(int src_type,
const uchar * src_data, size_t src_step, int src_width, int src_height,
uchar * dst_data, size_t dst_step, int dst_width, int dst_height,
double inv_scale_x, double inv_scale_y, int interpolation);
CV_EXPORTS void warpAffine(int src_type,
const uchar * src_data, size_t src_step, int src_width, int src_height,
uchar * dst_data, size_t dst_step, int dst_width, int dst_height,
const double M[6], int interpolation, int borderType, const double borderValue[4]);
CV_EXPORTS void warpPerspectve(int src_type,
const uchar * src_data, size_t src_step, int src_width, int src_height,
uchar * dst_data, size_t dst_step, int dst_width, int dst_height,
const double M[9], int interpolation, int borderType, const double borderValue[4]);
//! @} //! @}
}} }}
......
#ifndef OPENCV_IMGPROC_HAL_INTERFACE_H
#define OPENCV_IMGPROC_HAL_INTERFACE_H
//! @addtogroup imgproc_hal_interface
//! @{
//! @name Interpolation modes
//! @sa cv::InterpolationFlags
//! @{
#define CV_HAL_INTER_NEAREST 0
#define CV_HAL_INTER_LINEAR 1
#define CV_HAL_INTER_CUBIC 2
#define CV_HAL_INTER_AREA 3
#define CV_HAL_INTER_LANCZOS4 4
//! @}
//! @name Morphology operations
//! @sa cv::MorphTypes
//! @{
#define MORPH_ERODE 0
#define MORPH_DILATE 1
//! @}
//! @}
#endif
This diff is collapsed.
This diff is collapsed.
...@@ -1079,7 +1079,7 @@ namespace cv ...@@ -1079,7 +1079,7 @@ namespace cv
// ===== 1. replacement implementation // ===== 1. replacement implementation
struct ReplacementMorphImpl : public hal::MorphContext struct ReplacementMorphImpl : public hal::Morph
{ {
cvhalFilter2D * ctx; cvhalFilter2D * ctx;
bool isInitialized; bool isInitialized;
...@@ -1184,7 +1184,7 @@ INIT_TRAIT(CV_32FC4, 32f, 32f_C4R, 4, zero[4] = {0}) ...@@ -1184,7 +1184,7 @@ INIT_TRAIT(CV_32FC4, 32f, 32f_C4R, 4, zero[4] = {0})
//-------------------------------------- //--------------------------------------
struct IppMorphBaseImpl : public hal::MorphContext struct IppMorphBaseImpl : public hal::Morph
{ {
virtual bool init(int _op, int _src_type, int dst_type, int max_width, int max_height, virtual bool init(int _op, int _src_type, int dst_type, int max_width, int max_height,
int kernel_type, uchar * kernel_data, size_t kernel_step, int kernel_width, int kernel_height, int kernel_type, uchar * kernel_data, size_t kernel_step, int kernel_width, int kernel_height,
...@@ -1379,7 +1379,7 @@ static IppMorphBaseImpl * createIppImpl(int type) ...@@ -1379,7 +1379,7 @@ static IppMorphBaseImpl * createIppImpl(int type)
// ===== 3. Fallback implementation // ===== 3. Fallback implementation
struct OcvMorphImpl : public hal::MorphContext struct OcvMorphImpl : public hal::Morph
{ {
Ptr<FilterEngine> f; Ptr<FilterEngine> f;
int iterations; int iterations;
...@@ -1425,7 +1425,7 @@ struct OcvMorphImpl : public hal::MorphContext ...@@ -1425,7 +1425,7 @@ struct OcvMorphImpl : public hal::MorphContext
namespace hal { namespace hal {
Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int max_width, int max_height, Ptr<Morph> Morph ::create(int op, int src_type, int dst_type, int max_width, int max_height,
int kernel_type, uchar * kernel_data, size_t kernel_step, int kernel_width, int kernel_height, int kernel_type, uchar * kernel_data, size_t kernel_step, int kernel_width, int kernel_height,
int anchor_x, int anchor_y, int anchor_x, int anchor_y,
int borderType, const double borderValue[4], int borderType, const double borderValue[4],
...@@ -1438,7 +1438,7 @@ Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int ...@@ -1438,7 +1438,7 @@ Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int
anchor_x, anchor_y, anchor_x, anchor_y,
borderType, borderValue, iterations, isSubmatrix, allowInplace)) borderType, borderValue, iterations, isSubmatrix, allowInplace))
{ {
return Ptr<MorphContext>(impl); return Ptr<Morph>(impl);
} }
delete impl; delete impl;
} }
...@@ -1453,7 +1453,7 @@ Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int ...@@ -1453,7 +1453,7 @@ Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int
anchor_x, anchor_y, anchor_x, anchor_y,
borderType, borderValue, iterations, isSubmatrix, allowInplace)) borderType, borderValue, iterations, isSubmatrix, allowInplace))
{ {
return Ptr<MorphContext>(impl); return Ptr<Morph>(impl);
} }
delete impl; delete impl;
} }
...@@ -1465,7 +1465,7 @@ Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int ...@@ -1465,7 +1465,7 @@ Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int
kernel_type, kernel_data, kernel_step, kernel_width, kernel_height, kernel_type, kernel_data, kernel_step, kernel_width, kernel_height,
anchor_x, anchor_y, anchor_x, anchor_y,
borderType, borderValue, iterations, isSubmatrix, allowInplace); borderType, borderValue, iterations, isSubmatrix, allowInplace);
return Ptr<MorphContext>(impl); return Ptr<Morph>(impl);
} }
} }
...@@ -1858,7 +1858,7 @@ static void morphOp( int op, InputArray _src, OutputArray _dst, ...@@ -1858,7 +1858,7 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
Size d_wsz(dst.cols, dst.rows); Size d_wsz(dst.cols, dst.rows);
dst.locateROI(d_wsz, d_ofs); dst.locateROI(d_wsz, d_ofs);
Ptr<hal::MorphContext> ctx = hal::MorphContext::create(op, src.type(), dst.type(), src.cols, src.rows, Ptr<hal::Morph> ctx = hal::Morph::create(op, src.type(), dst.type(), src.cols, src.rows,
kernel.type(), kernel.data, kernel.step, kernel.cols, kernel.rows, kernel.type(), kernel.data, kernel.step, kernel.cols, kernel.rows,
anchor.x, anchor.y, borderType, borderValue.val, iterations, anchor.x, anchor.y, borderType, borderValue.val, iterations,
src.isSubmatrix(), src.data == dst.data); src.isSubmatrix(), src.data == dst.data);
......
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