Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OAID
Tengine
提交
63fcc116
T
Tengine
项目概览
OAID
/
Tengine
10 个月 前同步成功
通知
53
Star
4429
Fork
1032
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
63fcc116
编写于
9月 01, 2020
作者:
J
JackieWu
提交者:
GitHub
9月 01, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
去掉imread函数中多余的数据拷贝 (#392)
* remove unnecessary copy * combine loop
上级
04f5d2a0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
36 deletion
+10
-36
examples/common/tengine_operations.c
examples/common/tengine_operations.c
+10
-36
未找到文件。
examples/common/tengine_operations.c
浏览文件 @
63fcc116
...
...
@@ -634,41 +634,23 @@ void combination_image(image source, image dest, int dx, int dy)
image
imread
(
const
char
*
filename
)
{
image
im
=
load_image_stb
(
filename
,
0
);
for
(
int
c
=
0
;
c
<
im
.
c
;
c
++
)
{
for
(
int
h
=
0
;
h
<
im
.
h
;
h
++
)
{
for
(
int
w
=
0
;
w
<
im
.
w
;
w
++
)
{
int
newIndex
=
(
c
)
*
im
.
h
*
im
.
w
+
h
*
im
.
w
+
w
;
im
.
data
[
newIndex
]
=
im
.
data
[
newIndex
];
}
}
}
return
im
;
return
load_image_stb
(
filename
,
0
);
}
image
imread2post
(
const
char
*
filename
)
{
image
im
=
load_image_stb
(
filename
,
0
);
for
(
int
c
=
0
;
c
<
im
.
c
;
c
++
)
{
for
(
int
h
=
0
;
h
<
im
.
h
;
h
++
)
{
for
(
int
w
=
0
;
w
<
im
.
w
;
w
++
)
{
int
newIndex
=
(
c
)
*
im
.
h
*
im
.
w
+
h
*
im
.
w
+
w
;
im
.
data
[
newIndex
]
=
im
.
data
[
newIndex
]
*
255
;
}
}
const
int
len
=
im
.
c
*
im
.
h
*
im
.
w
;
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
im
.
data
[
i
]
*=
255
;
}
return
im
;
}
image
rgb2bgr_premute
(
image
src
)
{
float
*
GRB
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
src
.
c
*
src
.
h
*
src
.
w
);
const
int
len
=
src
.
c
*
src
.
h
*
src
.
w
;
float
*
GRB
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
len
);
for
(
int
c
=
0
;
c
<
src
.
c
;
c
++
)
{
for
(
int
h
=
0
;
h
<
src
.
h
;
h
++
)
...
...
@@ -681,16 +663,8 @@ image rgb2bgr_premute(image src)
}
}
}
for
(
int
c
=
0
;
c
<
src
.
c
;
c
++
)
{
for
(
int
h
=
0
;
h
<
src
.
h
;
h
++
)
{
for
(
int
w
=
0
;
w
<
src
.
w
;
w
++
)
{
int
newIndex
=
(
c
)
*
src
.
h
*
src
.
w
+
h
*
src
.
w
+
w
;
src
.
data
[
newIndex
]
=
GRB
[
newIndex
];
}
}
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
src
.
data
[
i
]
=
GRB
[
i
];
}
free
(
GRB
);
return
src
;
...
...
@@ -808,7 +782,7 @@ void draw_circle(image im, int x, int y, int radius, int r, int g, int b)
void
subtract
(
image
a
,
image
b
,
image
c
)
{
int
size
=
a
.
c
*
a
.
h
*
a
.
w
;
const
int
size
=
a
.
c
*
a
.
h
*
a
.
w
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
c
.
data
[
i
]
=
a
.
data
[
i
]
-
b
.
data
[
i
];
...
...
@@ -820,7 +794,7 @@ void subtract(image a, image b, image c)
void
multi
(
image
a
,
float
value
,
image
b
)
{
int
size
=
a
.
c
*
a
.
h
*
a
.
w
;
const
int
size
=
a
.
c
*
a
.
h
*
a
.
w
;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
b
.
data
[
i
]
=
a
.
data
[
i
]
*
value
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录