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
ef5de19b
Commit
ef5de19b
authored
Feb 26, 2013
by
Mathis Rosenhauer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash when input data isn't a multiple of the storage size
parent
24f6bb40
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
README
README
+6
-4
src/encode.c
src/encode.c
+6
-6
src/encode.h
src/encode.h
+1
-0
No files found.
README
View file @
ef5de19b
...
...
@@ -124,10 +124,12 @@ sample size storage size
9 - 16 bit 2 bytes
17 - 32 bit 4 bytes (also for 24bit if AEC_DATA_3BYTE is not set)
If you use less bits than the storage size provides, then you have to
make sure that unused bits are not set. Libaec does not check this for
performance reasons and will produce undefined output if unused bits
are set.
If a sample requires less bits than the storage size provides, then
you have to make sure that unused bits are not set. Libaec does not
check this for performance reasons and will produce undefined output
if unused bits are set. All input data must be a multiple of the
storage size in bytes. Remaining bytes which do not form a complete
sample will be ignored.
Libaec accesses next_in and next_out buffers only bytewise. There are
no alignment requirements for these buffers.
...
...
src/encode.c
View file @
ef5de19b
...
...
@@ -686,7 +686,7 @@ static int m_get_rsi_resumable(struct aec_stream *strm)
struct
internal_state
*
state
=
strm
->
state
;
do
{
if
(
strm
->
avail_in
>
0
)
{
if
(
strm
->
avail_in
>
=
state
->
bytes_per_sample
)
{
state
->
data_raw
[
state
->
i
]
=
state
->
get_sample
(
strm
);
}
else
{
if
(
state
->
flush
==
AEC_FLUSH
)
{
...
...
@@ -796,7 +796,7 @@ int aec_encode_init(struct aec_stream *strm)
if
(
strm
->
bits_per_sample
<=
24
&&
strm
->
flags
&
AEC_DATA_3BYTE
)
{
state
->
rsi_len
=
3
;
state
->
bytes_per_sample
=
3
;
if
(
strm
->
flags
&
AEC_DATA_MSB
)
{
state
->
get_sample
=
aec_get_msb_24
;
state
->
get_rsi
=
aec_get_rsi_msb_24
;
...
...
@@ -805,7 +805,7 @@ int aec_encode_init(struct aec_stream *strm)
state
->
get_rsi
=
aec_get_rsi_lsb_24
;
}
}
else
{
state
->
rsi_len
=
4
;
state
->
bytes_per_sample
=
4
;
if
(
strm
->
flags
&
AEC_DATA_MSB
)
{
state
->
get_sample
=
aec_get_msb_32
;
state
->
get_rsi
=
aec_get_rsi_msb_32
;
...
...
@@ -818,7 +818,7 @@ int aec_encode_init(struct aec_stream *strm)
else
if
(
strm
->
bits_per_sample
>
8
)
{
/* 16 bit settings */
state
->
id_len
=
4
;
state
->
rsi_len
=
2
;
state
->
bytes_per_sample
=
2
;
if
(
strm
->
flags
&
AEC_DATA_MSB
)
{
state
->
get_sample
=
aec_get_msb_16
;
...
...
@@ -830,12 +830,12 @@ int aec_encode_init(struct aec_stream *strm)
}
else
{
/* 8 bit settings */
state
->
id_len
=
3
;
state
->
rsi_len
=
1
;
state
->
bytes_per_sample
=
1
;
state
->
get_sample
=
aec_get_8
;
state
->
get_rsi
=
aec_get_rsi_8
;
}
state
->
rsi_len
*=
strm
->
rsi
*
strm
->
block_siz
e
;
state
->
rsi_len
=
strm
->
rsi
*
strm
->
block_size
*
state
->
bytes_per_sampl
e
;
if
(
strm
->
flags
&
AEC_DATA_SIGNED
)
{
state
->
xmin
=
-
(
1ULL
<<
(
strm
->
bits_per_sample
-
1
));
...
...
src/encode.h
View file @
ef5de19b
...
...
@@ -95,6 +95,7 @@ struct internal_state {
* not */
int
zero_ref
;
/* current zero block has a reference sample */
uint32_t
zero_ref_sample
;
/* reference sample of zero block */
int
bytes_per_sample
;
/* storage size of samples in bytes */
int
zero_blocks
;
/* number of contiguous zero blocks */
int
block_nonzero
;
/* 1 if this is the first non-zero block
* after one or more zero blocks */
...
...
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