Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmp_tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Loidolt
cmp_tool
Commits
e5a43ec5
Commit
e5a43ec5
authored
Jan 26, 2022
by
Dominik Loidolt
Browse files
Options
Downloads
Patches
Plain Diff
Clarity of naming
Correction some code formatting stuff
parent
c3b88304
No related branches found
No related tags found
1 merge request
!9
update the header definition according to PLATO-UVIE-PL-UM-0001 Draft 6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
cmp_tool.c
+1
-1
1 addition, 1 deletion
cmp_tool.c
include/cmp_entity.h
+5
-5
5 additions, 5 deletions
include/cmp_entity.h
lib/cmp_entity.c
+17
-17
17 additions, 17 deletions
lib/cmp_entity.c
lib/cmp_io.c
+9
-6
9 additions, 6 deletions
lib/cmp_io.c
with
32 additions
and
29 deletions
cmp_tool.c
+
1
−
1
View file @
e5a43ec5
...
...
@@ -502,7 +502,7 @@ static enum cmp_ent_data_type cmp_ent_map_cmp_mode_data_type(uint32_t cmp_mode)
/* set raw bit if needed */
if
(
raw_mode_is_used
(
cmp_mode
))
data_type
|=
1UL
<<
RAW_BIT_
IN_
DATA_TYPE
;
data_type
|=
1UL
<<
RAW_BIT_DATA_TYPE
_POS
;
return
data_type
;
}
...
...
This diff is collapsed.
Click to expand it.
include/cmp_entity.h
+
5
−
5
View file @
e5a43ec5
...
...
@@ -75,7 +75,7 @@ enum cmp_ent_data_type {
#define CMP_ENTITY_MAX_SIZE 0xFFFFFFUL
#define RAW_BIT_
IN_
DATA_TYPE 15U
#define RAW_BIT_DATA_TYPE
_POS
15U
#define CMP_TOOL_VERSION_ID_BIT 0x80000000U
...
...
@@ -128,7 +128,7 @@ compile_time_assert(sizeof(struct non_imagette_header) == SPECIFIC_NON_IMAGETTE_
__extension__
struct
cmp_entity
{
uint32_t
asw_
version_id
;
/* ICU ASW Version ID */
uint32_t
version_id
;
/* ICU ASW
/cmp_tool
Version ID */
uint32_t
cmp_ent_size
:
24
;
/* Compression Entity Size */
uint32_t
original_size
:
24
;
/* Original Data Size */
union
{
...
...
@@ -163,7 +163,7 @@ size_t cmp_ent_create(struct cmp_entity *ent, enum cmp_ent_data_type data_type,
/* create a compression entity and set the header fields */
size_t
cmp_ent_build
(
struct
cmp_entity
*
ent
,
enum
cmp_ent_data_type
data_type
,
uint32_t
asw_
version_id
,
uint64_t
start_time
,
uint32_t
version_id
,
uint64_t
start_time
,
uint64_t
end_time
,
uint16_t
model_id
,
uint8_t
model_counter
,
struct
cmp_info
*
info
,
struct
cmp_cfg
*
cfg
);
...
...
@@ -173,7 +173,7 @@ int cmp_ent_read_imagette_header(struct cmp_entity *ent, struct cmp_info *info);
/* set functions for generic compression entity header */
int
cmp_ent_set_
asw_
version_id
(
struct
cmp_entity
*
ent
,
uint32_t
asw_
version_id
);
int
cmp_ent_set_version_id
(
struct
cmp_entity
*
ent
,
uint32_t
version_id
);
int
cmp_ent_set_size
(
struct
cmp_entity
*
ent
,
uint32_t
cmp_ent_size
);
int
cmp_ent_set_original_size
(
struct
cmp_entity
*
ent
,
uint32_t
original_size
);
...
...
@@ -235,7 +235,7 @@ int cmp_ent_set_non_ima_cmp_par6(struct cmp_entity *ent, uint32_t cmp_par6_used)
/* get functions for generic compression entity header */
uint32_t
cmp_ent_get_
asw_
version_id
(
struct
cmp_entity
*
ent
);
uint32_t
cmp_ent_get_version_id
(
struct
cmp_entity
*
ent
);
uint32_t
cmp_ent_get_size
(
struct
cmp_entity
*
ent
);
uint32_t
cmp_ent_get_original_size
(
struct
cmp_entity
*
ent
);
...
...
This diff is collapsed.
Click to expand it.
lib/cmp_entity.c
+
17
−
17
View file @
e5a43ec5
...
...
@@ -84,7 +84,7 @@ uint32_t cmp_ent_cal_hdr_size(enum cmp_ent_data_type data_type)
return
0
;
}
if
((
data_type
>>
RAW_BIT_
IN_
DATA_TYPE
)
&
1U
)
if
((
data_type
>>
RAW_BIT_DATA_TYPE
_POS
)
&
1U
)
return
GENERIC_HEADER_SIZE
;
return
0
;
...
...
@@ -112,17 +112,17 @@ int cmp_ent_data_type_valid(enum cmp_ent_data_type data_type)
* @brief set ICU ASW Version ID in the compression entity header
*
* @param ent pointer to a compression entity
* @param
asw_
version_id the applications software version identifier
* @param version_id the applications software version identifier
*
* @returns 0 on success, otherwise error
*/
int
cmp_ent_set_
asw_
version_id
(
struct
cmp_entity
*
ent
,
uint32_t
asw_
version_id
)
int
cmp_ent_set_version_id
(
struct
cmp_entity
*
ent
,
uint32_t
version_id
)
{
if
(
!
ent
)
return
-
1
;
ent
->
asw_
version_id
=
cpu_to_be32
(
asw_
version_id
);
ent
->
version_id
=
cpu_to_be32
(
version_id
);
return
0
;
}
...
...
@@ -939,12 +939,12 @@ int cmp_ent_set_non_ima_cmp_par6(struct cmp_entity *ent, uint32_t cmp_par_6_used
* @returns the ASW version identifier on success, 0 on error
*/
uint32_t
cmp_ent_get_
asw_
version_id
(
struct
cmp_entity
*
ent
)
uint32_t
cmp_ent_get_version_id
(
struct
cmp_entity
*
ent
)
{
if
(
!
ent
)
return
0
;
return
be32_to_cpu
(
ent
->
asw_
version_id
);
return
be32_to_cpu
(
ent
->
version_id
);
}
...
...
@@ -1136,7 +1136,7 @@ int cmp_ent_get_data_type_raw_bit(struct cmp_entity *ent)
if
(
!
ent
)
return
0
;
return
(
be16_to_cpu
(
ent
->
data_type
)
>>
RAW_BIT_
IN_
DATA_TYPE
)
&
1U
;
return
(
be16_to_cpu
(
ent
->
data_type
)
>>
RAW_BIT_DATA_TYPE
_POS
)
&
1U
;
}
...
...
@@ -1934,7 +1934,7 @@ size_t cmp_ent_create(struct cmp_entity *ent, enum cmp_ent_data_type data_type,
* @param ent pointer to a compression entity; if NULL, the
* function returns the needed size
* @param data_type compression entity data product type
* @param
asw_
version_id applications software version identifier
* @param version_id applications software version identifier
* @param start_time compression start timestamp (coarse and fine)
* @param end_time compression end timestamp (coarse and fine)
* @param model_id model identifier
...
...
@@ -1947,7 +1947,7 @@ size_t cmp_ent_create(struct cmp_entity *ent, enum cmp_ent_data_type data_type,
*/
size_t
cmp_ent_build
(
struct
cmp_entity
*
ent
,
enum
cmp_ent_data_type
data_type
,
uint32_t
asw_
version_id
,
uint64_t
start_time
,
uint32_t
version_id
,
uint64_t
start_time
,
uint64_t
end_time
,
uint16_t
model_id
,
uint8_t
model_counter
,
struct
cmp_info
*
info
,
struct
cmp_cfg
*
cfg
)
{
...
...
@@ -1961,7 +1961,7 @@ size_t cmp_ent_build(struct cmp_entity *ent, enum cmp_ent_data_type data_type,
return
0
;
if
(
ent
)
{
if
(
cmp_ent_set_
asw_
version_id
(
ent
,
asw_
version_id
))
if
(
cmp_ent_set_version_id
(
ent
,
version_id
))
return
0
;
if
(
cmp_ent_set_start_timestamp
(
ent
,
start_time
))
return
0
;
...
...
@@ -2194,20 +2194,20 @@ void cmp_ent_print(struct cmp_entity *ent)
static
void
cmp_ent_parse_generic_header
(
struct
cmp_entity
*
ent
)
{
uint32_t
asw_
version_id
,
cmp_ent_size
,
original_size
,
cmp_mode_used
,
uint32_t
version_id
,
cmp_ent_size
,
original_size
,
cmp_mode_used
,
model_value_used
,
model_id
,
model_counter
,
lossy_cmp_par_used
,
start_coarse_time
,
end_coarse_time
;
uint16_t
start_fine_time
,
end_fine_time
;
enum
cmp_ent_data_type
data_type
;
int
raw_bit
;
asw_
version_id
=
cmp_ent_get_
asw_
version_id
(
ent
);
if
(
asw_
version_id
&
CMP_TOOL_VERSION_ID_BIT
)
{
uint16_t
major
=
(
asw_
version_id
&
0x7FFF0000U
)
>>
16U
;
uint16_t
minor
=
asw_
version_id
&
0xFFFFU
;
version_id
=
cmp_ent_get_version_id
(
ent
);
if
(
version_id
&
CMP_TOOL_VERSION_ID_BIT
)
{
uint16_t
major
=
(
version_id
&
0x7FFF0000U
)
>>
16U
;
uint16_t
minor
=
version_id
&
0xFFFFU
;
printf
(
"Compressed with cmp_tool version: %u.%02u
\n
"
,
major
,
minor
);
}
else
printf
(
"ICU ASW Version ID: %u
\n
"
,
asw_
version_id
);
printf
(
"ICU ASW Version ID: %u
\n
"
,
version_id
);
cmp_ent_size
=
cmp_ent_get_size
(
ent
);
printf
(
"Compression Entity Size: %u byte
\n
"
,
cmp_ent_size
);
...
...
This diff is collapsed.
Click to expand it.
lib/cmp_io.c
+
9
−
6
View file @
e5a43ec5
...
...
@@ -937,6 +937,7 @@ static const char *skip_space(const char *str)
static
const
char
*
skip_comment
(
const
char
*
str
)
{
char
c
=
*
str
;
if
(
c
==
'#'
)
{
do
{
str
++
;
...
...
@@ -1048,6 +1049,7 @@ static ssize_t str2uint8_arr(const char *str, uint8_t *data, uint32_t n_word,
for
(
i
=
0
;
i
<
n_word
;
)
{
uint8_t
read_val
;
unsigned
char
c
=
*
nptr
;
if
(
c
==
'\0'
)
{
if
(
!
data
)
/* finished counting the sample */
break
;
...
...
@@ -1140,15 +1142,15 @@ ssize_t read_file8(const char *file_name, uint8_t *buf, uint32_t n_word, int ver
char
*
file_cpy
=
NULL
;
long
file_size
;
ssize_t
size
;
size_t
ret_code
;
if
(
!
file_name
)
abort
();
errno
=
0
;
fp
=
fopen
(
file_name
,
"r"
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
goto
fail
;
}
/* Get the number of bytes */
if
(
fseek
(
fp
,
0L
,
SEEK_END
)
!=
0
)
...
...
@@ -1172,7 +1174,7 @@ ssize_t read_file8(const char *file_name, uint8_t *buf, uint32_t n_word, int ver
}
/* copy all the text into the file_cpy buffer */
size_t
ret_code
=
fread
(
file_cpy
,
sizeof
(
char
),
file_size
,
fp
);
ret_code
=
fread
(
file_cpy
,
sizeof
(
char
),
file_size
,
fp
);
if
(
ret_code
!=
(
size_t
)
file_size
)
{
if
(
feof
(
fp
))
printf
(
"%s: %s: Error: unexpected end of file.
\n
"
,
PROGRAM_NAME
,
file_name
);
...
...
@@ -1304,6 +1306,7 @@ ssize_t read_file_cmp_entity(const char *file_name, struct cmp_entity *ent,
if
(
ent
)
{
enum
cmp_ent_data_type
data_type
=
cmp_ent_get_data_type
(
ent
);
if
(
!
cmp_ent_data_type_valid
(
data_type
))
{
fprintf
(
stderr
,
"%s: %s: Error: Compression data type is not supported.
\n
"
,
PROGRAM_NAME
,
file_name
);
...
...
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