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
b63f830b
Commit
b63f830b
authored
Oct 04, 2012
by
Mathis Rosenhauer
Committed by
Thomas Jahns
Feb 19, 2013
Browse files
Fix another zero block bug with check
parent
74ea5524
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/decode.c
View file @
b63f830b
...
...
@@ -439,7 +439,7 @@ int aec_decode(struct aec_stream *strm, int flush)
of the states are called. Inspired by zlib.
*/
int
zero_blocks
;
int
zero_blocks
,
b
;
int64_t
gamma
,
beta
,
ms
,
delta1
;
int
k
;
decode_state
*
state
;
...
...
@@ -522,9 +522,8 @@ int aec_decode(struct aec_stream *strm, int flush)
DROPFS
();
if
(
zero_blocks
==
ROS
)
{
zero_blocks
=
64
-
(
(
state
->
samples_out
/
strm
->
block_size
)
%
strm
->
rsi
%
64
);
b
=
(
state
->
samples_out
/
strm
->
block_size
)
%
strm
->
rsi
;
zero_blocks
=
MIN
(
strm
->
rsi
-
b
,
64
-
(
b
%
64
));
}
else
if
(
zero_blocks
>
ROS
)
{
zero_blocks
--
;
}
...
...
src/encode.c
View file @
b63f830b
...
...
@@ -302,7 +302,8 @@ static int m_check_zero_block(struct aec_stream *strm)
state
->
zero_ref
=
state
->
ref
;
state
->
zero_ref_sample
=
state
->
block_p
[
0
];
}
if
((
strm
->
rsi
-
state
->
blocks_avail
)
%
64
==
0
)
{
if
(
state
->
blocks_avail
==
0
||
(
strm
->
rsi
-
state
->
blocks_avail
)
%
64
==
0
)
{
if
(
state
->
zero_blocks
>
4
)
state
->
zero_blocks
=
ROS
;
state
->
mode
=
m_encode_zero
;
...
...
tests/check_code_options.c
View file @
b63f830b
...
...
@@ -9,21 +9,26 @@
int
check_block_sizes
(
struct
test_state
*
state
,
int
id
,
int
id_len
)
{
int
bs
,
status
;
int
bs
,
status
,
rsi
,
max_rsi
;
for
(
bs
=
8
;
bs
<=
64
;
bs
*=
2
)
{
state
->
strm
->
block_size
=
bs
;
state
->
strm
->
rsi
=
state
->
buf_len
/
(
bs
*
state
->
byte_per_sample
);
status
=
encode_decode
(
state
);
if
(
status
)
return
status
;
max_rsi
=
state
->
buf_len
/
(
bs
*
state
->
byte_per_sample
);
if
(
max_rsi
>
4096
)
max_rsi
=
4096
;
for
(
rsi
=
1
;
rsi
<=
max_rsi
;
rsi
++
)
{
state
->
strm
->
rsi
=
rsi
;
status
=
encode_decode
(
state
);
if
(
status
)
return
status
;
if
((
state
->
cbuf
[
0
]
>>
(
8
-
id_len
))
!=
id
)
{
printf
(
"FAIL: Unexpected block of size %i created %x.
\n
"
,
bs
,
state
->
cbuf
[
0
]
>>
(
8
-
id_len
));
return
99
;
if
((
state
->
cbuf
[
0
]
>>
(
8
-
id_len
))
!=
id
)
{
printf
(
"FAIL: Unexpected block of size %i created ID:%x.
\n
"
,
bs
,
state
->
cbuf
[
0
]
>>
(
8
-
id_len
));
return
99
;
}
}
}
return
0
;
...
...
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