Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
904381c6
Commit
904381c6
authored
Apr 25, 2016
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6020 from mshabunin:hal_dxt
parents
ec63343f
5a938309
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
332 additions
and
129 deletions
+332
-129
CMakeLists.txt
doc/CMakeLists.txt
+7
-1
cvdef.h
modules/core/include/opencv2/core/cvdef.h
+0
-61
hal.hpp
modules/core/include/opencv2/core/hal/hal.hpp
+31
-7
interface.h
modules/core/include/opencv2/core/hal/interface.h
+115
-21
arithm.cpp
modules/core/src/arithm.cpp
+22
-22
arithm_core.hpp
modules/core/src/arithm_core.hpp
+2
-2
dxt.cpp
modules/core/src/dxt.cpp
+0
-0
hal_replacement.hpp
modules/core/src/hal_replacement.hpp
+0
-0
test_dxt.cpp
modules/core/test/test_dxt.cpp
+76
-0
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+5
-0
hal.hpp
modules/imgproc/include/opencv2/imgproc/hal/hal.hpp
+19
-4
interface.h
modules/imgproc/include/opencv2/imgproc/hal/interface.h
+26
-0
hal_replacement.hpp
modules/imgproc/src/hal_replacement.hpp
+0
-0
imgwarp.cpp
modules/imgproc/src/imgwarp.cpp
+0
-0
morph.cpp
modules/imgproc/src/morph.cpp
+8
-8
templmatch.cpp
modules/imgproc/src/templmatch.cpp
+21
-3
No files found.
doc/CMakeLists.txt
View file @
904381c6
...
...
@@ -42,6 +42,7 @@ if(BUILD_DOCS AND DOXYGEN_FOUND)
set
(
paths_bib
)
set
(
paths_sample
)
set
(
paths_tutorial
)
set
(
paths_hal_interface
)
set
(
refs_main
)
set
(
refs_extra
)
set
(
deps
)
...
...
@@ -87,6 +88,11 @@ if(BUILD_DOCS AND DOXYGEN_FOUND)
file
(
APPEND
"
${
tutorial_contrib_root
}
"
"-
${
m
}
. @subpage
${
tutorial_id
}
\n
"
)
endforeach
()
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
set
(
bib_file
"
${
docs_dir
}
/
${
m
}
.bib"
)
...
...
@@ -131,7 +137,7 @@ if(BUILD_DOCS AND DOXYGEN_FOUND)
set
(
example_path
"
${
CMAKE_SOURCE_DIR
}
/samples"
)
# 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
}
"
)
# 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
}
"
)
...
...
modules/core/include/opencv2/core/cvdef.h
View file @
904381c6
...
...
@@ -357,67 +357,6 @@ Cv64suf;
* 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(flags) ((((flags) & CV_MAT_CN_MASK) >> CV_CN_SHIFT) + 1)
#define CV_MAT_TYPE_MASK (CV_DEPTH_MAX*CV_CN_MAX - 1)
...
...
modules/core/include/opencv2/core/hal/hal.hpp
View file @
904381c6
...
...
@@ -46,6 +46,7 @@
#define __OPENCV_HAL_HPP__
#include "opencv2/core/cvdef.h"
#include "opencv2/core/cvstd.hpp"
#include "opencv2/core/hal/interface.h"
//! @cond IGNORED
...
...
@@ -171,13 +172,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
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
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
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
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
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
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
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
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
*
,
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
*
,
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
*
,
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
*
,
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
*
,
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
*
,
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
addWeighted8s
(
const
schar
*
src1
,
size_t
step1
,
const
schar
*
src2
,
size_t
step2
,
schar
*
dst
,
size_t
step
,
int
width
,
int
height
,
void
*
scalars
);
...
...
@@ -187,6 +188,29 @@ CV_EXPORTS void addWeighted32s( const int* src1, size_t step1, const int* src2,
CV_EXPORTS
void
addWeighted32f
(
const
float
*
src1
,
size_t
step1
,
const
float
*
src2
,
size_t
step2
,
float
*
dst
,
size_t
step
,
int
width
,
int
height
,
void
*
scalars
);
CV_EXPORTS
void
addWeighted64f
(
const
double
*
src1
,
size_t
step1
,
const
double
*
src2
,
size_t
step2
,
double
*
dst
,
size_t
step
,
int
width
,
int
height
,
void
*
scalars
);
struct
CV_EXPORTS
DFT1D
{
static
Ptr
<
DFT1D
>
create
(
int
len
,
int
count
,
int
depth
,
int
flags
,
bool
*
useBuffer
=
0
);
virtual
void
apply
(
const
uchar
*
src
,
uchar
*
dst
)
=
0
;
virtual
~
DFT1D
()
{}
};
struct
CV_EXPORTS
DFT2D
{
static
Ptr
<
DFT2D
>
create
(
int
width
,
int
height
,
int
depth
,
int
src_channels
,
int
dst_channels
,
int
flags
,
int
nonzero_rows
=
0
);
virtual
void
apply
(
const
uchar
*
src_data
,
size_t
src_step
,
uchar
*
dst_data
,
size_t
dst_step
)
=
0
;
virtual
~
DFT2D
()
{}
};
struct
CV_EXPORTS
DCT2D
{
static
Ptr
<
DCT2D
>
create
(
int
width
,
int
height
,
int
depth
,
int
flags
);
virtual
void
apply
(
const
uchar
*
src_data
,
size_t
src_step
,
uchar
*
dst_data
,
size_t
dst_step
)
=
0
;
virtual
~
DCT2D
()
{}
};
//! @} core_hal
//=============================================================================
...
...
modules/core/include/opencv2/core/hal/interface.h
View file @
904381c6
#ifndef
_HAL_INTERFACE_HPP_INCLUDED_
#define
_HAL_INTERFACE_HPP_INCLUDED_
#ifndef
OPENCV_CORE_HAL_INTERFACE_H
#define
OPENCV_CORE_HAL_INTERFACE_H
//! @addtogroup core_hal_interface
//! @{
//! @name Return codes
//! @{
#define CV_HAL_ERROR_OK 0
#define CV_HAL_ERROR_NOT_IMPLEMENTED 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
#include <cstddef>
#else
#include <stddef.h>
#include <stdbool.h>
#endif
/* primitive types */
/*
schar - signed 1 byte integer
uchar - unsigned 1 byte integer
short - signed 2 byte integer
ushort - unsigned 2 byte integer
int - signed 4 byte integer
uint - unsigned 4 byte integer
int64 - signed 8 byte integer
uint64 - unsigned 8 byte integer
*/
//! @name Data types
//! primitive types
//! - schar - signed 1 byte integer
//! - uchar - unsigned 1 byte integer
//! - short - signed 2 byte integer
//! - ushort - unsigned 2 byte integer
//! - int - signed 4 byte integer
//! - uint - unsigned 4 byte integer
//! - int64 - signed 8 byte integer
//! - uint64 - unsigned 8 byte integer
//! @{
#if !defined _MSC_VER && !defined __BORLANDC__
# if defined __cplusplus && __cplusplus >= 201103L && !defined __APPLE__
# include <cstdint>
...
...
@@ -64,6 +60,104 @@ typedef signed char schar;
# define CV_BIG_UINT(n) n##ULL
#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
//! @}
//! @name DFT flags
//! @{
#define CV_HAL_DFT_INVERSE 1
#define CV_HAL_DFT_SCALE 2
#define CV_HAL_DFT_ROWS 4
#define CV_HAL_DFT_COMPLEX_OUTPUT 16
#define CV_HAL_DFT_REAL_OUTPUT 32
#define CV_HAL_DFT_TWO_STAGE 64
#define CV_HAL_DFT_STAGE_COLS 128
#define CV_HAL_DFT_IS_CONTINUOUS 512
#define CV_HAL_DFT_IS_INPLACE 1024
//! @}
//! @}
#endif
modules/core/src/arithm.cpp
View file @
904381c6
...
...
@@ -3123,7 +3123,7 @@ void div8u( const uchar* src1, size_t step1, const uchar* src2, size_t step2,
if
(
src1
)
div_i
(
src1
,
step1
,
src2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
);
else
recip_i
(
src
1
,
step1
,
src
2
,
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
,
...
...
@@ -3172,53 +3172,53 @@ void div64f( const double* src1, size_t step1, const double* src2, size_t step2,
// 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
)
{
CALL_HAL
(
recip8u
,
cv_hal_recip8u
,
src
1
,
step1
,
src
2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
)
recip_i
(
src
1
,
step1
,
src
2
,
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
(
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
)
{
CALL_HAL
(
recip8s
,
cv_hal_recip8s
,
src
1
,
step1
,
src
2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
)
recip_i
(
src
1
,
step1
,
src
2
,
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
(
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
)
{
CALL_HAL
(
recip16u
,
cv_hal_recip16u
,
src
1
,
step1
,
src
2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
)
recip_i
(
src
1
,
step1
,
src
2
,
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
(
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
)
{
CALL_HAL
(
recip16s
,
cv_hal_recip16s
,
src
1
,
step1
,
src
2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
)
recip_i
(
src
1
,
step1
,
src
2
,
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
(
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
)
{
CALL_HAL
(
recip32s
,
cv_hal_recip32s
,
src
1
,
step1
,
src
2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
)
recip_i
(
src
1
,
step1
,
src
2
,
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
(
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
)
{
CALL_HAL
(
recip32f
,
cv_hal_recip32f
,
src
1
,
step1
,
src
2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
)
recip_f
(
src
1
,
step1
,
src
2
,
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
(
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
)
{
CALL_HAL
(
recip64f
,
cv_hal_recip64f
,
src
1
,
step1
,
src
2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
)
recip_f
(
src
1
,
step1
,
src
2
,
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
(
src2
,
step2
,
dst
,
step
,
width
,
height
,
*
(
const
double
*
)
scale
);
}
//=======================================
...
...
modules/core/src/arithm_core.hpp
View file @
904381c6
...
...
@@ -528,7 +528,7 @@ div_f( const T* src1, size_t step1, const T* src2, size_t step2,
}
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
)
{
step2
/=
sizeof
(
src2
[
0
]);
...
...
@@ -549,7 +549,7 @@ recip_i( const T*, size_t, const T* src2, size_t step2,
}
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
scale_f
=
(
T
)
scale
;
...
...
modules/core/src/dxt.cpp
View file @
904381c6
This diff is collapsed.
Click to expand it.
modules/core/src/hal_replacement.hpp
View file @
904381c6
This diff is collapsed.
Click to expand it.
modules/core/test/test_dxt.cpp
View file @
904381c6
...
...
@@ -887,3 +887,79 @@ TEST(Core_DFT, complex_output2)
}
}
}
class
Core_DXTReverseTest
:
public
cvtest
::
BaseTest
{
public
:
enum
Mode
{
ModeDFT
,
ModeDCT
};
Core_DXTReverseTest
(
Mode
m
)
:
mode
(
m
)
{}
private
:
Mode
mode
;
protected
:
void
run
(
int
)
{
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
if
(
mode
==
ModeDCT
&&
i
!=
0
)
continue
;
int
flags
=
0
;
int
flags_inv
=
DFT_INVERSE
|
DFT_SCALE
;
int
cn_in
=
0
;
int
cn_out
=
0
;
switch
(
i
)
{
case
0
:
cn_in
=
1
;
cn_out
=
1
;
break
;
case
1
:
cn_in
=
1
;
cn_out
=
2
;
flags
|=
DFT_COMPLEX_OUTPUT
;
flags_inv
|=
DFT_REAL_OUTPUT
;
break
;
case
2
:
cn_in
=
2
;
cn_out
=
2
;
break
;
};
for
(
int
j
=
0
;
j
<
100
;
++
j
)
{
RNG
&
rng
=
ts
->
get_rng
();
int
type
=
rng
.
uniform
(
0
,
2
)
?
CV_64F
:
CV_32F
;
int
m
=
rng
.
uniform
(
1
,
10
);
int
n
=
rng
.
uniform
(
1
,
10
);
if
(
mode
==
ModeDCT
)
{
m
*=
2
;
n
*=
2
;
}
Mat
one
(
m
,
n
,
CV_MAKETYPE
(
type
,
cn_in
));
cvtest
::
randUni
(
rng
,
one
,
Scalar
::
all
(
-
1.
),
Scalar
::
all
(
1.
));
Mat
out
;
Mat
two
;
if
(
mode
==
ModeDFT
)
{
cv
::
dft
(
one
,
out
,
flags
);
cv
::
dft
(
out
,
two
,
flags_inv
);
}
else
if
(
mode
==
ModeDCT
)
{
cv
::
dct
(
one
,
out
,
flags
);
cv
::
dct
(
out
,
two
,
flags_inv
);
}
if
(
out
.
channels
()
!=
cn_out
||
two
.
channels
()
!=
cn_in
||
cvtest
::
norm
(
one
,
two
,
NORM_INF
)
>
1e-5
)
{
cout
<<
"Test #"
<<
j
+
1
<<
" - "
<<
"elements: "
<<
m
<<
" x "
<<
n
<<
", "
<<
"channels: "
<<
one
.
channels
()
<<
" ("
<<
cn_in
<<
")"
<<
" -> "
<<
out
.
channels
()
<<
" ("
<<
cn_out
<<
")"
<<
" -> "
<<
two
.
channels
()
<<
" ("
<<
cn_in
<<
")"
<<
endl
;
cout
<<
"signal:
\n
"
<<
one
<<
endl
<<
endl
;
cout
<<
"spectrum:
\n
"
<<
out
<<
endl
<<
endl
;
cout
<<
"inverse:
\n
"
<<
two
<<
endl
<<
endl
;
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
break
;
}
}
}
}
};
TEST
(
Core_DFT
,
reverse
)
{
Core_DXTReverseTest
test
(
Core_DXTReverseTest
::
ModeDFT
);
test
.
safe_run
();
}
TEST
(
Core_DCT
,
reverse
)
{
Core_DXTReverseTest
test
(
Core_DXTReverseTest
::
ModeDCT
);
test
.
safe_run
();
}
modules/imgproc/include/opencv2/imgproc.hpp
View file @
904381c6
...
...
@@ -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_object Object Detection
@defgroup imgproc_c C API
@defgroup imgproc_hal Hardware Acceleration Layer
@{
@defgroup imgproc_hal_functions Functions
@defgroup imgproc_hal_interface Interface
@}
@}
*/
...
...
modules/imgproc/include/opencv2/imgproc/hal/hal.hpp
View file @
904381c6
...
...
@@ -7,7 +7,7 @@
namespace
cv
{
namespace
hal
{
//! @addtogroup
core
_hal_functions
//! @addtogroup
imgproc
_hal_functions
//! @{
struct
CV_EXPORTS
Filter2D
...
...
@@ -45,9 +45,9 @@ struct CV_EXPORTS SepFilter2D
};
struct
CV_EXPORTS
Morph
Context
struct
CV_EXPORTS
Morph
{
static
Ptr
<
Morph
Context
>
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_width
,
int
kernel_height
,
int
anchor_x
,
int
anchor_y
,
...
...
@@ -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
,
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
;
virtual
~
Morph
Context
()
{}
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
]);
//! @}
}}
...
...
modules/imgproc/include/opencv2/imgproc/hal/interface.h
0 → 100644
View file @
904381c6
#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
modules/imgproc/src/hal_replacement.hpp
View file @
904381c6
This diff is collapsed.
Click to expand it.
modules/imgproc/src/imgwarp.cpp
View file @
904381c6
This diff is collapsed.
Click to expand it.
modules/imgproc/src/morph.cpp
View file @
904381c6
...
...
@@ -1079,7 +1079,7 @@ namespace cv
// ===== 1. replacement implementation
struct
ReplacementMorphImpl
:
public
hal
::
Morph
Context
struct
ReplacementMorphImpl
:
public
hal
::
Morph
{
cvhalFilter2D
*
ctx
;
bool
isInitialized
;
...
...
@@ -1184,7 +1184,7 @@ INIT_TRAIT(CV_32FC4, 32f, 32f_C4R, 4, zero[4] = {0})
//--------------------------------------
struct
IppMorphBaseImpl
:
public
hal
::
Morph
Context
struct
IppMorphBaseImpl
:
public
hal
::
Morph
{
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
,
...
...
@@ -1379,7 +1379,7 @@ static IppMorphBaseImpl * createIppImpl(int type)
// ===== 3. Fallback implementation
struct
OcvMorphImpl
:
public
hal
::
Morph
Context
struct
OcvMorphImpl
:
public
hal
::
Morph
{
Ptr
<
FilterEngine
>
f
;
int
iterations
;
...
...
@@ -1425,7 +1425,7 @@ struct OcvMorphImpl : public hal::MorphContext
namespace
hal
{
Ptr
<
Morph
Context
>
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
anchor_x
,
int
anchor_y
,
int
borderType
,
const
double
borderValue
[
4
],
...
...
@@ -1438,7 +1438,7 @@ Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int
anchor_x
,
anchor_y
,
borderType
,
borderValue
,
iterations
,
isSubmatrix
,
allowInplace
))
{
return
Ptr
<
Morph
Context
>
(
impl
);
return
Ptr
<
Morph
>
(
impl
);
}
delete
impl
;
}
...
...
@@ -1453,7 +1453,7 @@ Ptr<MorphContext> MorphContext ::create(int op, int src_type, int dst_type, int
anchor_x
,
anchor_y
,
borderType
,
borderValue
,
iterations
,
isSubmatrix
,
allowInplace
))
{
return
Ptr
<
Morph
Context
>
(
impl
);
return
Ptr
<
Morph
>
(
impl
);
}
delete
impl
;
}
...
...
@@ -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
,
anchor_x
,
anchor_y
,
borderType
,
borderValue
,
iterations
,
isSubmatrix
,
allowInplace
);
return
Ptr
<
Morph
Context
>
(
impl
);
return
Ptr
<
Morph
>
(
impl
);
}
}
...
...
@@ -1858,7 +1858,7 @@ static void morphOp( int op, InputArray _src, OutputArray _dst,
Size
d_wsz
(
dst
.
cols
,
dst
.
rows
);
dst
.
locateROI
(
d_wsz
,
d_ofs
);
Ptr
<
hal
::
Morph
Context
>
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
,
anchor
.
x
,
anchor
.
y
,
borderType
,
borderValue
.
val
,
iterations
,
src
.
isSubmatrix
(),
src
.
data
==
dst
.
data
);
...
...
modules/imgproc/src/templmatch.cpp
View file @
904381c6
...
...
@@ -632,6 +632,8 @@ static bool ipp_sqrDistance(const Mat& src, const Mat& tpl, Mat& dst)
#endif
#include "opencv2/core/hal/hal.hpp"
void
crossCorr
(
const
Mat
&
img
,
const
Mat
&
_templ
,
Mat
&
corr
,
Size
corrsize
,
int
ctype
,
Point
anchor
,
double
delta
,
int
borderType
)
...
...
@@ -698,6 +700,8 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
buf
.
resize
(
bufSize
);
Ptr
<
hal
::
DFT2D
>
c
=
hal
::
DFT2D
::
create
(
dftsize
.
width
,
dftsize
.
height
,
dftTempl
.
depth
(),
1
,
1
,
CV_HAL_DFT_IS_INPLACE
,
templ
.
rows
);
// compute DFT of each template plane
for
(
k
=
0
;
k
<
tcn
;
k
++
)
{
...
...
@@ -721,7 +725,7 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
Mat
part
(
dst
,
Range
(
0
,
templ
.
rows
),
Range
(
templ
.
cols
,
dst
.
cols
));
part
=
Scalar
::
all
(
0
);
}
dft
(
dst
,
dst
,
0
,
templ
.
rows
);
c
->
apply
(
dst
.
data
,
(
int
)
dst
.
step
,
dst
.
data
,
(
int
)
dst
.
step
);
}
int
tileCountX
=
(
corr
.
cols
+
blocksize
.
width
-
1
)
/
blocksize
.
width
;
...
...
@@ -740,6 +744,12 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
}
borderType
|=
BORDER_ISOLATED
;
Ptr
<
hal
::
DFT2D
>
cF
,
cR
;
int
f
=
CV_HAL_DFT_IS_INPLACE
;
int
f_inv
=
f
|
CV_HAL_DFT_INVERSE
|
CV_HAL_DFT_SCALE
;
cF
=
hal
::
DFT2D
::
create
(
dftsize
.
width
,
dftsize
.
height
,
maxDepth
,
1
,
1
,
f
,
blocksize
.
height
+
templ
.
rows
-
1
);
cR
=
hal
::
DFT2D
::
create
(
dftsize
.
width
,
dftsize
.
height
,
maxDepth
,
1
,
1
,
f_inv
,
blocksize
.
height
);
// calculate correlation by blocks
for
(
i
=
0
;
i
<
tileCount
;
i
++
)
{
...
...
@@ -777,11 +787,19 @@ void crossCorr( const Mat& img, const Mat& _templ, Mat& corr,
copyMakeBorder
(
dst1
,
dst
,
y1
-
y0
,
dst
.
rows
-
dst1
.
rows
-
(
y1
-
y0
),
x1
-
x0
,
dst
.
cols
-
dst1
.
cols
-
(
x1
-
x0
),
borderType
);
dft
(
dftImg
,
dftImg
,
0
,
dsz
.
height
);
if
(
bsz
.
height
==
blocksize
.
height
)
cF
->
apply
(
dftImg
.
data
,
(
int
)
dftImg
.
step
,
dftImg
.
data
,
(
int
)
dftImg
.
step
);
else
dft
(
dftImg
,
dftImg
,
0
,
dsz
.
height
);
Mat
dftTempl1
(
dftTempl
,
Rect
(
0
,
tcn
>
1
?
k
*
dftsize
.
height
:
0
,
dftsize
.
width
,
dftsize
.
height
));
mulSpectrums
(
dftImg
,
dftTempl1
,
dftImg
,
0
,
true
);
dft
(
dftImg
,
dftImg
,
DFT_INVERSE
+
DFT_SCALE
,
bsz
.
height
);
if
(
bsz
.
height
==
blocksize
.
height
)
cR
->
apply
(
dftImg
.
data
,
(
int
)
dftImg
.
step
,
dftImg
.
data
,
(
int
)
dftImg
.
step
);
else
dft
(
dftImg
,
dftImg
,
DFT_INVERSE
+
DFT_SCALE
,
bsz
.
height
);
src
=
dftImg
(
Rect
(
0
,
0
,
bsz
.
width
,
bsz
.
height
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment