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
7a3c9a40
Commit
7a3c9a40
authored
Oct 5, 2021
by
Dominik Loidolt
Browse files
Options
Downloads
Patches
Plain Diff
Implement get_max_spill with a lookup table for speed up;
add cmp_get_good_spill function
parent
1b0f5727
Branches
Branches containing commit
No related tags found
1 merge request
!2
added feature to guess the compression configuration
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/cmp_support.h
+1
-0
1 addition, 0 deletions
include/cmp_support.h
lib/cmp_support.c
+52
-13
52 additions, 13 deletions
lib/cmp_support.c
with
53 additions
and
13 deletions
include/cmp_support.h
+
1
−
0
View file @
7a3c9a40
...
...
@@ -173,6 +173,7 @@ unsigned int cal_up_model(unsigned int data, unsigned int model, unsigned int
model_value
);
uint32_t
get_max_spill
(
unsigned
int
golomb_par
,
unsigned
int
cmp_mode
);
uint32_t
cmp_get_good_spill
(
unsigned
int
golomb_par
,
unsigned
int
cmp_mode
);
size_t
size_of_a_sample
(
unsigned
int
cmp_mode
);
unsigned
int
size_of_bitstream
(
unsigned
int
cmp_size
);
...
...
This diff is collapsed.
Click to expand it.
lib/cmp_support.c
+
52
−
13
View file @
7a3c9a40
...
...
@@ -391,29 +391,68 @@ unsigned int cal_up_model(unsigned int data, unsigned int model, unsigned int
uint32_t
get_max_spill
(
unsigned
int
golomb_par
,
unsigned
int
cmp_mode
)
{
unsigned
int
cutoff
;
unsigned
int
max_n_sym_offset
;
unsigned
int
max_cw_bits
;
const
uint32_t
LUT_MAX_RDCU
[
MAX_RDCU_GOLOMB_PAR
+
1
]
=
{
0
,
8
,
22
,
35
,
48
,
60
,
72
,
84
,
96
,
107
,
118
,
129
,
140
,
151
,
162
,
173
,
184
,
194
,
204
,
214
,
224
,
234
,
244
,
254
,
264
,
274
,
284
,
294
,
304
,
314
,
324
,
334
,
344
,
353
,
362
,
371
,
380
,
389
,
398
,
407
,
416
,
425
,
434
,
443
,
452
,
461
,
470
,
479
,
488
,
497
,
506
,
515
,
524
,
533
,
542
,
551
,
560
,
569
,
578
,
587
,
596
,
605
,
614
,
623
};
if
(
golomb_par
==
0
)
return
0
;
if
(
rdcu_supported_mode_is_used
(
cmp_mode
))
{
max_cw_bits
=
16
;
/* the RDCU compressor can only generate code
* words with a length of maximal 16 bits.
*/
}
else
{
max_cw_bits
=
32
;
/* the ICU compressor can generate code
* words with a length of maximal 32 bits.
*/
}
if
(
golomb_par
>
MAX_RDCU_GOLOMB_PAR
)
return
0
;
cutoff
=
(
1UL
<<
(
ilog_2
(
golomb_par
)
+
1
))
-
golomb_par
;
max_n_sym_offset
=
max_cw_bits
/
2
-
1
;
return
LUT_MAX_RDCU
[
golomb_par
];
}
else
{
if
(
golomb_par
>
MAX_ICU_GOLOMB_PAR
)
return
0
;
/* the ICU compressor can generate code words with a length of
* maximal 32 bits. */
unsigned
int
max_cw_bits
=
32
;
unsigned
int
cutoff
=
(
1UL
<<
(
ilog_2
(
golomb_par
)
+
1
))
-
golomb_par
;
unsigned
int
max_n_sym_offset
=
max_cw_bits
/
2
-
1
;
return
(
max_cw_bits
-
1
-
ilog_2
(
golomb_par
))
*
golomb_par
+
cutoff
-
max_n_sym_offset
-
1
;
}
}
/**
* @brief get a good spill threshold parameter for the selected Golomb parameter
* and compression mode
*
* @param golomb_par Golomb parameter
* @param cmp_mode compression mode
*
* @returns a good spill parameter (optimal for zero escape mechanism)
* @warning icu compression not support yet!
*/
uint32_t
cmp_get_good_spill
(
unsigned
int
golomb_par
,
unsigned
int
cmp_mode
)
{
const
uint32_t
LUT_RDCU_MULIT
[
MAX_RDCU_GOLOMB_PAR
+
1
]
=
{
0
,
8
,
16
,
23
,
30
,
36
,
44
,
51
,
58
,
64
,
71
,
77
,
84
,
90
,
97
,
108
,
115
,
121
,
128
,
135
,
141
,
148
,
155
,
161
,
168
,
175
,
181
,
188
,
194
,
201
,
207
,
214
,
229
,
236
,
242
,
250
,
256
,
263
,
269
,
276
,
283
,
290
,
296
,
303
,
310
,
317
,
324
,
330
,
336
,
344
,
351
,
358
,
363
,
370
,
377
,
383
,
391
,
397
,
405
,
411
,
418
,
424
,
431
,
452
};
if
(
zero_escape_mech_is_used
(
cmp_mode
)
||
cmp_mode
==
MODE_DIFF_MULTI
)
return
get_max_spill
(
golomb_par
,
cmp_mode
);
if
(
cmp_mode
==
MODE_MODEL_MULTI
)
{
if
(
golomb_par
>
MAX_RDCU_GOLOMB_PAR
)
return
0
;
else
return
LUT_RDCU_MULIT
[
golomb_par
];
}
return
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