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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Loidolt
cmp_tool
Commits
6cd59968
Commit
6cd59968
authored
2 years ago
by
Dominik Loidolt
Browse files
Options
Downloads
Patches
Plain Diff
Refactor code; add documentation
parent
7690fa65
No related branches found
No related tags found
1 merge request
!11
decompression/compression for non-imagette data
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/decmp.h
+5
-4
5 additions, 4 deletions
include/decmp.h
lib/decmp.c
+146
-96
146 additions, 96 deletions
lib/decmp.c
test/cmp_icu/test_decmp.c
+63
-20
63 additions, 20 deletions
test/cmp_icu/test_decmp.c
with
214 additions
and
120 deletions
include/decmp.h
+
5
−
4
View file @
6cd59968
...
...
@@ -22,10 +22,11 @@
#include
<cmp_entity.h>
#include
<cmp_support.h>
int
decompress_data
(
uint32_t
*
compressed_data
,
void
*
de_model_buf
,
const
struct
cmp_info
*
info
,
void
*
decompressed_data
);
int
decompress_cmp_entiy
(
struct
cmp_entity
*
ent
,
void
*
model_buf
,
int
decompress_cmp_entiy
(
struct
cmp_entity
*
ent
,
void
*
model_of_data
,
void
*
up_model_buf
,
void
*
decompressed_data
);
int
decompress_rdcu_data
(
uint32_t
*
compressed_data
,
const
struct
cmp_info
*
info
,
uint16_t
*
model_of_data
,
uint16_t
*
up_model_buf
,
uint16_t
*
decompressed_data
);
#endif
/* DECMP_H_ */
This diff is collapsed.
Click to expand it.
lib/decmp.c
+
146
−
96
View file @
6cd59968
This diff is collapsed.
Click to expand it.
test/cmp_icu/test_decmp.c
+
63
−
20
View file @
6cd59968
...
...
@@ -110,7 +110,69 @@ void test_cmp_decmp_n_imagette_raw(void)
}
/*
/**
* @test count_leading_ones
*/
void
test_count_leading_ones
(
void
)
{
unsigned
int
n_leading_bit
;
uint32_t
value
;
value
=
0
;
n_leading_bit
=
count_leading_ones
(
value
);
TEST_ASSERT_EQUAL_INT
(
0
,
n_leading_bit
);
value
=
0x7FFFFFFF
;
n_leading_bit
=
count_leading_ones
(
value
);
TEST_ASSERT_EQUAL_INT
(
0
,
n_leading_bit
);
value
=
0x80000000
;
n_leading_bit
=
count_leading_ones
(
value
);
TEST_ASSERT_EQUAL_INT
(
1
,
n_leading_bit
);
value
=
0xBFFFFFFF
;
n_leading_bit
=
count_leading_ones
(
value
);
TEST_ASSERT_EQUAL_INT
(
1
,
n_leading_bit
);
value
=
0xFFFF0000
;
n_leading_bit
=
count_leading_ones
(
value
);
TEST_ASSERT_EQUAL_INT
(
16
,
n_leading_bit
);
value
=
0xFFFF7FFF
;
n_leading_bit
=
count_leading_ones
(
value
);
TEST_ASSERT_EQUAL_INT
(
16
,
n_leading_bit
);
value
=
0xFFFFFFFF
;
n_leading_bit
=
count_leading_ones
(
value
);
TEST_ASSERT_EQUAL_INT
(
32
,
n_leading_bit
);
}
/**
* @test rice_decoder
*/
void
test_rice_decoder
(
void
)
{
int
cw_len
;
uint32_t
code_word
;
unsigned
int
m
=
~
0
;
/* we don't need this value */
unsigned
int
log2_m
;
unsigned
int
decoded_cw
;
/* test log_2 to big */
code_word
=
0xE0000000
;
log2_m
=
33
;
cw_len
=
rice_decoder
(
code_word
,
m
,
log2_m
,
&
decoded_cw
);
TEST_ASSERT_EQUAL
(
0
,
cw_len
);
log2_m
=
UINT_MAX
;
cw_len
=
rice_decoder
(
code_word
,
m
,
log2_m
,
&
decoded_cw
);
TEST_ASSERT_EQUAL
(
0
,
cw_len
);
}
/**
* @test re_map_to_pos
*/
...
...
@@ -160,25 +222,6 @@ void test_re_map_to_pos(void)
}
void
test_rice_decoder
(
void
)
{
int
cw_len
;
uint32_t
code_word
;
unsigned
int
m
=
~
0
;
/* we don't need this value */
unsigned
int
log2_m
;
unsigned
int
decoded_cw
;
/* test log_2 to big */
code_word
=
0xE0000000
;
log2_m
=
33
;
cw_len
=
rice_decoder
(
code_word
,
m
,
log2_m
,
&
decoded_cw
);
TEST_ASSERT_EQUAL
(
0
,
cw_len
);
log2_m
=
UINT_MAX
;
cw_len
=
rice_decoder
(
code_word
,
m
,
log2_m
,
&
decoded_cw
);
TEST_ASSERT_EQUAL
(
0
,
cw_len
);
}
void
test_decode_normal
(
void
)
{
uint32_t
decoded_value
=
~
0
;
...
...
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