Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathis Rosenhauer
libaec
Commits
68283f60
Commit
68283f60
authored
Aug 30, 2012
by
Mathis Rosenhauer
Browse files
Emit full block
parent
38f4d444
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/aee.c
View file @
68283f60
...
...
@@ -88,6 +88,39 @@ static inline void emitfs(encode_state *state, int fs)
}
}
static
inline
void
emitblock
(
ae_streamp
strm
,
int
k
,
int
skip
)
{
int
i
;
uint64_t
acc
;
encode_state
*
state
=
strm
->
state
;
int64_t
*
in
=
state
->
in_block
+
skip
;
int64_t
*
in_end
=
state
->
in_block
+
strm
->
block_size
;
int64_t
mask
=
(
1ULL
<<
k
)
-
1
;
uint8_t
*
out
=
state
->
out_bp
;
acc
=
*
out
;
while
(
in
<
in_end
)
{
acc
<<=
56
;
state
->
bitp
=
(
state
->
bitp
%
8
)
+
56
;
while
(
state
->
bitp
>
k
&&
in
<
in_end
)
{
state
->
bitp
-=
k
;
acc
+=
(
*
in
++
&
mask
)
<<
state
->
bitp
;
}
for
(
i
=
56
;
i
>
(
state
->
bitp
&
~
7
);
i
-=
8
)
*
out
++
=
acc
>>
i
;
acc
>>=
i
;
}
*
out
=
acc
;
state
->
out_bp
=
out
;
state
->
bitp
%=
8
;
}
static
inline
void
preprocess
(
ae_streamp
strm
)
{
int
i
;
...
...
@@ -483,20 +516,18 @@ static inline int m_encode_splitting(ae_streamp strm)
for
(
i
=
state
->
ref
;
i
<
strm
->
block_size
;
i
++
)
emitfs
(
state
,
state
->
in_block
[
i
]
>>
k
);
for
(
i
=
state
->
ref
;
i
<
strm
->
block_size
;
i
++
)
emit
(
state
,
state
->
in_block
[
i
]
&
((
1ULL
<<
k
)
-
1
),
k
);
if
(
k
)
emit
block
(
strm
,
k
,
state
->
ref
);
return
m_flush_block
(
strm
);
}
static
inline
int
m_encode_uncomp
(
ae_streamp
strm
)
{
int
i
;
encode_state
*
state
=
strm
->
state
;
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
);
emitblock
(
strm
,
strm
->
bit_per_sample
,
0
);
return
m_flush_block
(
strm
);
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment