Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Heatshrink
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Grant Kim
Heatshrink
Commits
7e818d55
Commit
7e818d55
authored
9 years ago
by
Vadim Vygonets
Committed by
Scott Vokes
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Start with backlog full of zeroes
Closes #21
parent
ffa900fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
heatshrink_encoder.c
+1
-30
1 addition, 30 deletions
heatshrink_encoder.c
with
1 addition
and
30 deletions
heatshrink_encoder.c
+
1
−
30
View file @
7e818d55
...
...
@@ -44,8 +44,6 @@ enum {
FLAG_IS_FINISHING
=
0x01
,
FLAG_HAS_LITERAL
=
0x02
,
FLAG_ON_FINAL_LITERAL
=
0x04
,
FLAG_BACKLOG_IS_PARTIAL
=
0x08
,
FLAG_BACKLOG_IS_FILLED
=
0x10
,
};
typedef
struct
{
...
...
@@ -62,8 +60,6 @@ static uint16_t get_lookahead_size(heatshrink_encoder *hse);
static
void
add_tag_bit
(
heatshrink_encoder
*
hse
,
output_info
*
oi
,
uint8_t
tag
);
static
int
can_take_byte
(
output_info
*
oi
);
static
int
is_finishing
(
heatshrink_encoder
*
hse
);
static
int
backlog_is_partial
(
heatshrink_encoder
*
hse
);
static
int
backlog_is_filled
(
heatshrink_encoder
*
hse
);
static
int
on_final_literal
(
heatshrink_encoder
*
hse
);
static
void
save_backlog
(
heatshrink_encoder
*
hse
);
static
int
has_literal
(
heatshrink_encoder
*
hse
);
...
...
@@ -282,16 +278,7 @@ static HSE_state st_step_search(heatshrink_encoder *hse) {
uint16_t
input_offset
=
get_input_offset
(
hse
);
uint16_t
end
=
input_offset
+
msi
;
uint16_t
start
=
0
;
if
(
backlog_is_filled
(
hse
))
{
/* last WINDOW_LENGTH bytes */
start
=
end
-
window_length
+
1
;
}
else
if
(
backlog_is_partial
(
hse
))
{
/* clamp to available data */
start
=
end
-
window_length
+
1
;
if
(
start
<
lookahead_sz
)
{
start
=
lookahead_sz
;
}
}
else
{
/* only scan available input */
start
=
input_offset
;
}
uint16_t
start
=
end
-
window_length
;
uint16_t
max_possible
=
lookahead_sz
;
if
(
hse
->
input_size
-
msi
<
lookahead_sz
)
{
...
...
@@ -472,14 +459,6 @@ static int is_finishing(heatshrink_encoder *hse) {
return
hse
->
flags
&
FLAG_IS_FINISHING
;
}
static
int
backlog_is_partial
(
heatshrink_encoder
*
hse
)
{
return
hse
->
flags
&
FLAG_BACKLOG_IS_PARTIAL
;
}
static
int
backlog_is_filled
(
heatshrink_encoder
*
hse
)
{
return
hse
->
flags
&
FLAG_BACKLOG_IS_FILLED
;
}
static
int
on_final_literal
(
heatshrink_encoder
*
hse
)
{
return
hse
->
flags
&
FLAG_ON_FINAL_LITERAL
;
}
...
...
@@ -637,14 +616,6 @@ static void save_backlog(heatshrink_encoder *hse) {
&
hse
->
buffer
[
input_buf_sz
-
rem
],
shift_sz
);
if
(
backlog_is_partial
(
hse
))
{
/* The whole backlog is filled in now, so include it in scans. */
hse
->
flags
|=
FLAG_BACKLOG_IS_FILLED
;
}
else
{
/* Include backlog, except for the first lookahead_sz bytes, which
* are still undefined. */
hse
->
flags
|=
FLAG_BACKLOG_IS_PARTIAL
;
}
hse
->
match_scan_index
=
0
;
hse
->
input_size
-=
input_buf_sz
-
rem
;
}
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