Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zstd
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
CodeLinaro
yocto-mirrors
zstd
Commits
67fad95f
Commit
67fad95f
authored
1 month ago
by
Yann Collet
Browse files
Options
Downloads
Patches
Plain Diff
derive hashratelog from hashlog when only hashlog is set
parent
339bca66
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/compress/zstd_ldm.c
+15
-10
15 additions, 10 deletions
lib/compress/zstd_ldm.c
with
15 additions
and
10 deletions
lib/compress/zstd_ldm.c
+
15
−
10
View file @
67fad95f
...
...
@@ -133,18 +133,26 @@ done:
}
void
ZSTD_ldm_adjustParameters
(
ldmParams_t
*
params
,
ZSTD_compressionParameters
const
*
cParams
)
const
ZSTD_compressionParameters
*
cParams
)
{
params
->
windowLog
=
cParams
->
windowLog
;
ZSTD_STATIC_ASSERT
(
LDM_BUCKET_SIZE_LOG
<=
ZSTD_LDM_BUCKETSIZELOG_MAX
);
DEBUGLOG
(
4
,
"ZSTD_ldm_adjustParameters"
);
if
(
params
->
hashRateLog
==
0
)
{
assert
(
1
<=
(
int
)
cParams
->
strategy
&&
(
int
)
cParams
->
strategy
<=
9
);
/* mapping: strat1 -> rate8 ... strat9 -> rate4*/
params
->
hashRateLog
=
7
-
(
cParams
->
strategy
/
3
);
if
(
params
->
hashLog
>
0
)
{
/* if params->hashLog is set, derive hashRateLog from it */
assert
(
params
->
hashLog
<=
ZSTD_HASHLOG_MAX
);
if
(
params
->
windowLog
>
params
->
hashLog
)
{
params
->
hashRateLog
=
params
->
windowLog
-
params
->
hashLog
;
}
}
else
{
assert
(
1
<=
(
int
)
cParams
->
strategy
&&
(
int
)
cParams
->
strategy
<=
9
);
/* mapping: strat1 -> rate8 ... strat9 -> rate4*/
params
->
hashRateLog
=
7
-
(
cParams
->
strategy
/
3
);
}
}
if
(
params
->
hashLog
==
0
)
{
params
->
hashLog
=
MIN
(
MAX
(
ZSTD_HASHLOG_MIN
,
params
->
windowLog
-
params
->
hashRateLog
)
,
ZSTD_HASHLOG_MAX
);
params
->
hashLog
=
BOUNDED
(
ZSTD_HASHLOG_MIN
,
params
->
windowLog
-
params
->
hashRateLog
,
ZSTD_HASHLOG_MAX
);
}
if
(
params
->
minMatchLength
==
0
)
{
params
->
minMatchLength
=
LDM_MIN_MATCH_LENGTH
;
...
...
@@ -152,11 +160,8 @@ void ZSTD_ldm_adjustParameters(ldmParams_t* params,
params
->
minMatchLength
/=
2
;
}
if
(
params
->
bucketSizeLog
==
0
)
{
params
->
bucketSizeLog
=
LDM_BUCKET_SIZE_LOG
;
if
(
cParams
->
strategy
>
ZSTD_lazy
)
{
params
->
bucketSizeLog
+=
(
U32
)
cParams
->
strategy
-
(
U32
)
ZSTD_lazy
;
}
params
->
bucketSizeLog
=
MIN
(
params
->
bucketSizeLog
,
ZSTD_LDM_BUCKETSIZELOG_MAX
);
assert
(
1
<=
(
int
)
cParams
->
strategy
&&
(
int
)
cParams
->
strategy
<=
9
);
params
->
bucketSizeLog
=
BOUNDED
(
LDM_BUCKET_SIZE_LOG
,
(
U32
)
cParams
->
strategy
,
ZSTD_LDM_BUCKETSIZELOG_MAX
);
}
params
->
bucketSizeLog
=
MIN
(
params
->
bucketSizeLog
,
params
->
hashLog
);
}
...
...
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