Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
b5426a86
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
b5426a86
编写于
11月 13, 2019
作者:
A
Anton Potapov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
G-API (Fluid) core support for I420
- Extended NV12 support in Fluid Core engine to cover I420
上级
b6a58818
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
18 deletion
+19
-18
modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp
modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp
+1
-1
modules/gapi/src/backends/fluid/gfluidbackend.cpp
modules/gapi/src/backends/fluid/gfluidbackend.cpp
+17
-16
modules/gapi/test/gapi_fluid_test_kernels.cpp
modules/gapi/test/gapi_fluid_test_kernels.cpp
+1
-1
未找到文件。
modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp
浏览文件 @
b5426a86
...
...
@@ -50,7 +50,7 @@ public:
{
Filter
,
Resize
,
NV12to
RGB
YUV420toRGB
//Color conversion of 4:2:0 chroma sub-sampling formats (NV12, I420 ..etc) to
RGB
};
// This function is a generic "doWork" callback
...
...
modules/gapi/src/backends/fluid/gfluidbackend.cpp
浏览文件 @
b5426a86
...
...
@@ -198,7 +198,7 @@ public:
using
FluidAgent
::
FluidAgent
;
};
struct
Fluid
NV12
toRGBAgent
:
public
FluidAgent
struct
Fluid
420
toRGBAgent
:
public
FluidAgent
{
private:
virtual
int
firstWindow
(
std
::
size_t
inPort
)
const
override
;
...
...
@@ -313,7 +313,7 @@ static int maxLineConsumption(const cv::GFluidKernel::Kind kind, int window, int
return
(
inH
==
1
)
?
1
:
2
+
lpi
-
1
;
}
}
break
;
case
cv
::
GFluidKernel
::
Kind
::
NV12
toRGB
:
return
inPort
==
0
?
2
:
1
;
break
;
case
cv
::
GFluidKernel
::
Kind
::
YUV420
toRGB
:
return
inPort
==
0
?
2
:
1
;
break
;
default:
GAPI_Assert
(
false
);
return
0
;
}
}
...
...
@@ -325,7 +325,7 @@ static int borderSize(const cv::GFluidKernel::Kind kind, int window)
case
cv
::
GFluidKernel
::
Kind
::
Filter
:
return
(
window
-
1
)
/
2
;
break
;
// Resize never reads from border pixels
case
cv
::
GFluidKernel
::
Kind
::
Resize
:
return
0
;
break
;
case
cv
::
GFluidKernel
::
Kind
::
NV12
toRGB
:
return
0
;
break
;
case
cv
::
GFluidKernel
::
Kind
::
YUV420
toRGB
:
return
0
;
break
;
default:
GAPI_Assert
(
false
);
return
0
;
}
}
...
...
@@ -435,13 +435,13 @@ std::pair<int,int> cv::gimpl::FluidResizeAgent::linesReadAndnextWindow(std::size
return
m_mapper
->
linesReadAndNextWindow
(
outIdx
,
lpi
);
}
int
cv
::
gimpl
::
Fluid
NV12
toRGBAgent
::
firstWindow
(
std
::
size_t
inPort
)
const
int
cv
::
gimpl
::
Fluid
420
toRGBAgent
::
firstWindow
(
std
::
size_t
inPort
)
const
{
// 2 lines for Y, 1 for UV
return
inPort
==
0
?
2
:
1
;
}
std
::
pair
<
int
,
int
>
cv
::
gimpl
::
Fluid
NV12
toRGBAgent
::
linesReadAndnextWindow
(
std
::
size_t
inPort
)
const
std
::
pair
<
int
,
int
>
cv
::
gimpl
::
Fluid
420
toRGBAgent
::
linesReadAndnextWindow
(
std
::
size_t
inPort
)
const
{
// 2 lines for Y, 1 for UV
return
inPort
==
0
?
std
::
make_pair
(
2
,
2
)
:
std
::
make_pair
(
1
,
1
);
...
...
@@ -675,7 +675,7 @@ void cv::gimpl::GFluidExecutable::initBufferRois(std::vector<int>& readStarts,
return
roi
;
};
auto
adj
NV12
Roi
=
[
&
](
cv
::
gapi
::
own
::
Rect
produced
,
std
::
size_t
port
)
{
auto
adj
420
Roi
=
[
&
](
cv
::
gapi
::
own
::
Rect
produced
,
std
::
size_t
port
)
{
GAPI_Assert
(
produced
.
x
%
2
==
0
);
GAPI_Assert
(
produced
.
y
%
2
==
0
);
GAPI_Assert
(
produced
.
width
%
2
==
0
);
...
...
@@ -684,7 +684,8 @@ void cv::gimpl::GFluidExecutable::initBufferRois(std::vector<int>& readStarts,
cv
::
gapi
::
own
::
Rect
roi
;
switch
(
port
)
{
case
0
:
roi
=
produced
;
break
;
case
1
:
roi
=
cv
::
gapi
::
own
::
Rect
{
produced
.
x
/
2
,
produced
.
y
/
2
,
produced
.
width
/
2
,
produced
.
height
/
2
};
break
;
case
1
:
case
2
:
roi
=
cv
::
gapi
::
own
::
Rect
{
produced
.
x
/
2
,
produced
.
y
/
2
,
produced
.
width
/
2
,
produced
.
height
/
2
};
break
;
default:
GAPI_Assert
(
false
);
}
return
roi
;
...
...
@@ -696,19 +697,19 @@ void cv::gimpl::GFluidExecutable::initBufferRois(std::vector<int>& readStarts,
cv
::
gapi
::
own
::
Rect
resized
;
switch
(
fg
.
metadata
(
oh
).
get
<
FluidUnit
>
().
k
.
m_kind
)
{
case
GFluidKernel
::
Kind
::
Filter
:
resized
=
produced
;
break
;
case
GFluidKernel
::
Kind
::
Resize
:
resized
=
adjResizeRoi
(
produced
,
in_meta
.
size
,
meta
.
size
);
break
;
case
GFluidKernel
::
Kind
::
NV12toRGB
:
resized
=
adjNV12
Roi
(
produced
,
m_gm
.
metadata
(
in_edge
).
get
<
Input
>
().
port
);
break
;
case
GFluidKernel
::
Kind
::
Filter
:
resized
=
produced
;
break
;
case
GFluidKernel
::
Kind
::
Resize
:
resized
=
adjResizeRoi
(
produced
,
in_meta
.
size
,
meta
.
size
);
break
;
case
GFluidKernel
::
Kind
::
YUV420toRGB
:
resized
=
adj420
Roi
(
produced
,
m_gm
.
metadata
(
in_edge
).
get
<
Input
>
().
port
);
break
;
default:
GAPI_Assert
(
false
);
}
// All below transformations affect roi of the writer, preserve read start position here
int
readStart
=
resized
.
y
;
// Extend required input roi (both y and height) to be even if it's produced by
NV12
toRGB
// Extend required input roi (both y and height) to be even if it's produced by
CS420
toRGB
if
(
!
in_node
->
inNodes
().
empty
())
{
auto
in_data_producer
=
in_node
->
inNodes
().
front
();
if
(
fg
.
metadata
(
in_data_producer
).
get
<
FluidUnit
>
().
k
.
m_kind
==
GFluidKernel
::
Kind
::
NV12
toRGB
)
{
if
(
fg
.
metadata
(
in_data_producer
).
get
<
FluidUnit
>
().
k
.
m_kind
==
GFluidKernel
::
Kind
::
YUV420
toRGB
)
{
if
(
resized
.
y
%
2
!=
0
)
{
resized
.
y
--
;
resized
.
height
++
;
...
...
@@ -840,9 +841,9 @@ cv::gimpl::GFluidExecutable::GFluidExecutable(const ade::Graph
std
::
unique_ptr
<
FluidAgent
>
agent_ptr
;
switch
(
agent_data
.
kind
)
{
case
GFluidKernel
::
Kind
::
Filter
:
agent_ptr
.
reset
(
new
FluidFilterAgent
(
g
,
agent_data
.
nh
));
break
;
case
GFluidKernel
::
Kind
::
Resize
:
agent_ptr
.
reset
(
new
FluidResizeAgent
(
g
,
agent_data
.
nh
));
break
;
case
GFluidKernel
::
Kind
::
NV12toRGB
:
agent_ptr
.
reset
(
new
FluidNV12toRGBAgent
(
g
,
agent_data
.
nh
));
break
;
case
GFluidKernel
::
Kind
::
Filter
:
agent_ptr
.
reset
(
new
FluidFilterAgent
(
g
,
agent_data
.
nh
));
break
;
case
GFluidKernel
::
Kind
::
Resize
:
agent_ptr
.
reset
(
new
FluidResizeAgent
(
g
,
agent_data
.
nh
));
break
;
case
GFluidKernel
::
Kind
::
YUV420toRGB
:
agent_ptr
.
reset
(
new
Fluid420toRGBAgent
(
g
,
agent_data
.
nh
));
break
;
default:
GAPI_Assert
(
false
);
}
std
::
tie
(
agent_ptr
->
in_buffer_ids
,
agent_ptr
->
out_buffer_ids
)
=
std
::
tie
(
agent_data
.
in_buffer_ids
,
agent_data
.
out_buffer_ids
);
...
...
@@ -1005,7 +1006,7 @@ namespace
GAPI_Assert
((
out_ws
.
size
()
==
1
&&
out_hs
.
size
()
==
1
)
&&
((
in_hs
.
size
()
==
1
)
||
((
in_hs
.
size
()
==
2
)
&&
fu
.
k
.
m_kind
==
cv
::
GFluidKernel
::
Kind
::
NV12
toRGB
)));
((
in_hs
.
size
()
==
2
)
&&
fu
.
k
.
m_kind
==
cv
::
GFluidKernel
::
Kind
::
YUV420
toRGB
)));
const
auto
&
op
=
g
.
metadata
(
node
).
get
<
Op
>
();
fu
.
line_consumption
.
resize
(
op
.
args
.
size
(),
0
);
...
...
modules/gapi/test/gapi_fluid_test_kernels.cpp
浏览文件 @
b5426a86
...
...
@@ -530,7 +530,7 @@ GAPI_FLUID_KERNEL(FNV12toRGB, cv::gapi::imgproc::GNV12toRGB, false)
{
static
const
int
Window
=
1
;
static
const
int
LPI
=
2
;
static
const
auto
Kind
=
GFluidKernel
::
Kind
::
NV12
toRGB
;
static
const
auto
Kind
=
GFluidKernel
::
Kind
::
YUV420
toRGB
;
static
void
run
(
const
cv
::
gapi
::
fluid
::
View
&
in1
,
const
cv
::
gapi
::
fluid
::
View
&
in2
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录