Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
8f0edf6a
O
Opencv
项目概览
Greenplum
/
Opencv
12 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8f0edf6a
编写于
10月 04, 2022
作者:
A
Alexander Smorkalov
提交者:
GitHub
10月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22074 from bwang30:opencv-warpAffine-ippiw
Add warpAffine IPPIW implementation to replace with old version
上级
bf5d7c0c
ed3b56d7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
123 addition
and
0 deletion
+123
-0
modules/imgproc/src/imgwarp.cpp
modules/imgproc/src/imgwarp.cpp
+123
-0
未找到文件。
modules/imgproc/src/imgwarp.cpp
浏览文件 @
8f0edf6a
...
@@ -2542,6 +2542,127 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0,
...
@@ -2542,6 +2542,127 @@ static bool ocl_warpTransform(InputArray _src, OutputArray _dst, InputArray _M0,
#endif
#endif
#ifdef HAVE_IPP
#define IPP_WARPAFFINE_PARALLEL 1
#ifdef HAVE_IPP_IW
class
ipp_warpAffineParallel
:
public
ParallelLoopBody
{
public:
ipp_warpAffineParallel
(
::
ipp
::
IwiImage
&
src
,
::
ipp
::
IwiImage
&
dst
,
IppiInterpolationType
_inter
,
double
(
&
_coeffs
)[
2
][
3
],
::
ipp
::
IwiBorderType
_borderType
,
IwTransDirection
_iwTransDirection
,
bool
*
_ok
)
:
m_src
(
src
),
m_dst
(
dst
)
{
pOk
=
_ok
;
inter
=
_inter
;
borderType
=
_borderType
;
iwTransDirection
=
_iwTransDirection
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
coeffs
[
i
][
j
]
=
_coeffs
[
i
][
j
];
*
pOk
=
true
;
}
~
ipp_warpAffineParallel
()
{}
virtual
void
operator
()
(
const
Range
&
range
)
const
CV_OVERRIDE
{
CV_INSTRUMENT_REGION_IPP
();
if
(
*
pOk
==
false
)
return
;
try
{
::
ipp
::
IwiTile
tile
=
::
ipp
::
IwiRoi
(
0
,
range
.
start
,
m_dst
.
m_size
.
width
,
range
.
end
-
range
.
start
);
CV_INSTRUMENT_FUN_IPP
(
::
ipp
::
iwiWarpAffine
,
m_src
,
m_dst
,
coeffs
,
iwTransDirection
,
inter
,
::
ipp
::
IwiWarpAffineParams
(),
borderType
,
tile
);
}
catch
(
const
::
ipp
::
IwException
&
)
{
*
pOk
=
false
;
return
;
}
}
private:
::
ipp
::
IwiImage
&
m_src
;
::
ipp
::
IwiImage
&
m_dst
;
IppiInterpolationType
inter
;
double
coeffs
[
2
][
3
];
::
ipp
::
IwiBorderType
borderType
;
IwTransDirection
iwTransDirection
;
bool
*
pOk
;
const
ipp_warpAffineParallel
&
operator
=
(
const
ipp_warpAffineParallel
&
);
};
#endif
static
bool
ipp_warpAffine
(
InputArray
_src
,
OutputArray
_dst
,
int
interpolation
,
int
borderType
,
InputArray
_M
,
int
flags
)
{
#ifdef HAVE_IPP_IW
CV_INSTRUMENT_REGION_IPP
();
if
(
!
cv
::
ipp
::
useIPP_NotExact
())
return
false
;
IppiInterpolationType
ippInter
=
ippiGetInterpolation
(
interpolation
);
if
((
int
)
ippInter
<
0
)
return
false
;
// Acquire data and begin processing
try
{
Mat
src
=
_src
.
getMat
();
Mat
dst
=
_dst
.
getMat
();
::
ipp
::
IwiImage
iwSrc
=
ippiGetImage
(
src
);
::
ipp
::
IwiImage
iwDst
=
ippiGetImage
(
dst
);
::
ipp
::
IwiBorderType
ippBorder
(
ippiGetBorderType
(
borderType
));
IwTransDirection
iwTransDirection
;
if
(
!
ippBorder
)
return
false
;
if
(
!
(
flags
&
WARP_INVERSE_MAP
)
)
iwTransDirection
=
iwTransForward
;
else
iwTransDirection
=
iwTransInverse
;
Mat
M
=
_M
.
getMat
();
double
coeffs
[
2
][
3
];
for
(
int
i
=
0
;
i
<
2
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
coeffs
[
i
][
j
]
=
M
.
at
<
double
>
(
i
,
j
);
const
int
threads
=
ippiSuggestThreadsNum
(
iwDst
,
2
);
if
(
IPP_WARPAFFINE_PARALLEL
&&
threads
>
1
)
{
bool
ok
=
true
;
Range
range
(
0
,
(
int
)
iwDst
.
m_size
.
height
);
ipp_warpAffineParallel
invoker
(
iwSrc
,
iwDst
,
ippInter
,
coeffs
,
ippBorder
,
iwTransDirection
,
&
ok
);
if
(
!
ok
)
return
false
;
parallel_for_
(
range
,
invoker
,
threads
*
4
);
if
(
!
ok
)
return
false
;
}
else
{
CV_INSTRUMENT_FUN_IPP
(
::
ipp
::
iwiWarpAffine
,
iwSrc
,
iwDst
,
coeffs
,
iwTransDirection
,
ippInter
,
::
ipp
::
IwiWarpAffineParams
(),
ippBorder
);
}
}
catch
(
const
::
ipp
::
IwException
&
)
{
return
false
;
}
return
true
;
#endif
}
#endif
namespace
hal
{
namespace
hal
{
void
warpAffine
(
int
src_type
,
void
warpAffine
(
int
src_type
,
...
@@ -2611,6 +2732,8 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
...
@@ -2611,6 +2732,8 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
CV_Assert
(
(
M0
.
type
()
==
CV_32F
||
M0
.
type
()
==
CV_64F
)
&&
M0
.
rows
==
2
&&
M0
.
cols
==
3
);
CV_Assert
(
(
M0
.
type
()
==
CV_32F
||
M0
.
type
()
==
CV_64F
)
&&
M0
.
rows
==
2
&&
M0
.
cols
==
3
);
M0
.
convertTo
(
matM
,
matM
.
type
());
M0
.
convertTo
(
matM
,
matM
.
type
());
CV_IPP_RUN_FAST
(
ipp_warpAffine
(
src
,
dst
,
interpolation
,
borderType
,
matM
,
flags
));
if
(
!
(
flags
&
WARP_INVERSE_MAP
)
)
if
(
!
(
flags
&
WARP_INVERSE_MAP
)
)
{
{
double
D
=
M
[
0
]
*
M
[
4
]
-
M
[
1
]
*
M
[
3
];
double
D
=
M
[
0
]
*
M
[
4
]
-
M
[
1
]
*
M
[
3
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录