Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
libaec
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Mathis Rosenhauer
libaec
Commits
38f4d444
Commit
38f4d444
authored
Aug 27, 2012
by
Mathis Rosenhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new emit with less masking and initializing
parent
cb37f682
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
src/aee.c
src/aee.c
+19
-18
No files found.
src/aee.c
View file @
38f4d444
...
...
@@ -42,22 +42,24 @@ static int m_encode_zero(ae_streamp strm);
static
inline
void
emit
(
encode_state
*
state
,
uint64_t
data
,
int
bits
)
{
for
(;;
)
if
(
bits
<=
state
->
bitp
)
{
data
&=
((
1ULL
<<
bits
)
-
1
);
if
(
bits
<=
state
->
bitp
)
{
state
->
bitp
-=
bits
;
*
state
->
out_bp
+=
data
<<
state
->
bitp
;
break
;
}
else
state
->
bitp
-=
bits
;
*
state
->
out_bp
+=
data
<<
state
->
bitp
;
}
else
{
bits
-=
state
->
bitp
;
*
state
->
out_bp
++
+=
data
>>
bits
;
while
(
bits
&
~
7
)
{
bits
-=
state
->
bitp
;
*
state
->
out_bp
+=
data
>>
bits
;
*++
state
->
out_bp
=
0
;
state
->
bitp
=
8
;
bits
-=
8
;
*
state
->
out_bp
++
=
data
>>
bits
;
}
state
->
bitp
=
8
-
bits
;
*
state
->
out_bp
=
data
<<
state
->
bitp
;
}
}
...
...
@@ -69,12 +71,11 @@ static inline void emitfs(encode_state *state, int fs)
fs zero bits followed by one 1 bit.
*/
fs
++
;
for
(;;)
{
if
(
fs
<
=
state
->
bitp
)
if
(
fs
<
state
->
bitp
)
{
state
->
bitp
-=
fs
;
state
->
bitp
-=
fs
+
1
;
*
state
->
out_bp
+=
1
<<
state
->
bitp
;
break
;
}
...
...
@@ -483,7 +484,7 @@ static inline int m_encode_splitting(ae_streamp strm)
emitfs
(
state
,
state
->
in_block
[
i
]
>>
k
);
for
(
i
=
state
->
ref
;
i
<
strm
->
block_size
;
i
++
)
emit
(
state
,
state
->
in_block
[
i
],
k
);
emit
(
state
,
state
->
in_block
[
i
]
&
((
1ULL
<<
k
)
-
1
)
,
k
);
return
m_flush_block
(
strm
);
}
...
...
@@ -493,7 +494,7 @@ static inline int m_encode_uncomp(ae_streamp strm)
int
i
;
encode_state
*
state
=
strm
->
state
;
emit
(
state
,
0x1f
,
state
->
id_len
);
emit
(
state
,
(
1
<<
state
->
id_len
)
-
1
,
state
->
id_len
);
for
(
i
=
0
;
i
<
strm
->
block_size
;
i
++
)
emit
(
state
,
state
->
in_block
[
i
],
strm
->
bit_per_sample
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment