Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hpvm-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
llvm
hpvm-release
Commits
2ea4739b
Commit
2ea4739b
authored
5 years ago
by
Yifan Zhao
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bug in cava
parent
20d22368
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hpvm/test/hpvm-cava/src/cam_pipe_utility.c
+10
-6
10 additions, 6 deletions
hpvm/test/hpvm-cava/src/cam_pipe_utility.c
hpvm/test/hpvm-cava/src/cam_pipe_utility.h
+4
-3
4 additions, 3 deletions
hpvm/test/hpvm-cava/src/cam_pipe_utility.h
with
14 additions
and
9 deletions
hpvm/test/hpvm-cava/src/cam_pipe_utility.c
+
10
−
6
View file @
2ea4739b
...
...
@@ -5,29 +5,33 @@
#include
"cam_pipe_utility.h"
//#include "pipe_stages.h"
uint8_t
*
read_image_from_binary
(
char
*
file_path
,
int
*
row_size
,
int
*
col_size
)
{
uint8_t
*
read_image_from_binary
(
char
*
file_path
,
size_t
*
row_size
,
size_t
*
col_size
)
{
uint8_t
*
image
;
FILE
*
fp
=
fopen
(
file_path
,
"r"
);
int
chan_size
;
if
(
fread
(
row_size
,
sizeof
(
int
),
1
,
fp
)
!=
1
)
int
row_size_tmp
,
col_size_tmp
;
if
(
fread
(
&
row_size_tmp
,
sizeof
(
int
),
1
,
fp
)
!=
1
)
assert
(
"Failed to read row size from binary file!"
);
if
(
fread
(
col_size
,
sizeof
(
int
),
1
,
fp
)
!=
1
)
if
(
fread
(
&
col_size
_tmp
,
sizeof
(
int
),
1
,
fp
)
!=
1
)
assert
(
"Failed to read col size from binary file!"
);
if
(
fread
(
&
chan_size
,
sizeof
(
int
),
1
,
fp
)
!=
1
)
assert
(
"Failed to read row size from binary file!"
);
assert
(
chan_size
==
CHAN_SIZE
&&
"Channel size read from the binary file "
"doesn't equal to the default value!
\n
"
);
in
t
size
=
*
row_size
*
*
col_size
*
CHAN_SIZE
;
size_
t
size
=
(
size_t
)
row_size
_tmp
*
col_size
_tmp
*
CHAN_SIZE
;
image
=
malloc_aligned
(
sizeof
(
uint8_t
)
*
size
);
if
(
fread
(
image
,
sizeof
(
uint8_t
),
size
,
fp
)
!=
size
)
assert
(
"Failed to read the image from binary file!"
);
fclose
(
fp
);
*
row_size
=
(
size_t
)
row_size_tmp
;
*
col_size
=
(
size_t
)
col_size_tmp
;
return
image
;
}
void
write_image_to_binary
(
char
*
file_path
,
uint8_t
*
image
,
in
t
row_size
,
in
t
col_size
)
{
void
write_image_to_binary
(
char
*
file_path
,
uint8_t
*
image
,
size_
t
row_size
,
size_
t
col_size
)
{
FILE
*
fp
=
fopen
(
file_path
,
"w"
);
int
shape
[
3
]
=
{
row_size
,
col_size
,
CHAN_SIZE
};
...
...
This diff is collapsed.
Click to expand it.
hpvm/test/hpvm-cava/src/cam_pipe_utility.h
+
4
−
3
View file @
2ea4739b
...
...
@@ -4,9 +4,10 @@
#include
"pipe_stages.h"
#include
"utility.h"
uint8_t
*
read_image_from_binary
(
char
*
file_path
,
int
*
row_size
,
int
*
col_size
);
void
write_image_to_binary
(
char
*
file_path
,
uint8_t
*
image
,
int
row_size
,
int
col_size
);
uint8_t
*
read_image_from_binary
(
char
*
file_path
,
size_t
*
row_size
,
size_t
*
col_size
);
void
write_image_to_binary
(
char
*
file_path
,
uint8_t
*
image
,
size_t
row_size
,
size_t
col_size
);
float
*
transpose_mat
(
float
*
inmat
,
int
width
,
int
height
);
void
convert_hwc_to_chw
(
uint8_t
*
input
,
int
row_size
,
int
col_size
,
uint8_t
**
result
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment