Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
libaec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Mathis Rosenhauer
libaec
Commits
405a4707
Commit
405a4707
authored
12 years ago
by
Mathis Rosenhauer
Browse files
Options
Downloads
Patches
Plain Diff
No dynamic allocation of cds_buffer. Struct member instead.
parent
ece3bd3d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/encode.c
+1
-11
1 addition, 11 deletions
src/encode.c
src/encode.h
+8
-2
8 additions, 2 deletions
src/encode.h
with
9 additions
and
13 deletions
src/encode.c
+
1
−
11
View file @
405a4707
...
...
@@ -66,9 +66,6 @@
#include
"encode.h"
#include
"encode_accessors.h"
/* Marker for Remainder Of Segment condition in zero block encoding */
#define ROS -1
static
int
m_get_block
(
struct
aec_stream
*
strm
);
static
inline
void
emit
(
struct
internal_state
*
state
,
...
...
@@ -471,7 +468,7 @@ static void init_output(struct aec_stream *strm)
struct
internal_state
*
state
=
strm
->
state
;
if
(
strm
->
avail_out
>
state
->
cds_len
)
{
if
(
strm
->
avail_out
>
CDSLEN
)
{
if
(
!
state
->
direct_out
)
{
state
->
direct_out
=
1
;
*
strm
->
next_out
=
*
state
->
cds
;
...
...
@@ -867,12 +864,6 @@ int aec_encode_init(struct aec_stream *strm)
state
->
block
=
state
->
data_pp
;
/* Largest possible CDS according to specs */
state
->
cds_len
=
(
5
+
64
*
32
)
/
8
+
3
;
state
->
cds_buf
=
malloc
(
state
->
cds_len
);
if
(
state
->
cds_buf
==
NULL
)
return
AEC_MEM_ERROR
;
strm
->
total_in
=
0
;
strm
->
total_out
=
0
;
...
...
@@ -920,7 +911,6 @@ int aec_encode_end(struct aec_stream *strm)
if
(
strm
->
flags
&
AEC_DATA_PREPROCESS
)
free
(
state
->
data_raw
);
free
(
state
->
data_pp
);
free
(
state
->
cds_buf
);
free
(
state
);
return
AEC_OK
;
}
...
...
This diff is collapsed.
Click to expand it.
src/encode.h
+
8
−
2
View file @
405a4707
...
...
@@ -66,6 +66,13 @@
#define M_EXIT 0
#define MIN(a, b) (((a) < (b))? (a): (b))
/* Maximum CDS length in bytes: 5 bits ID, 64 * 32 bits samples, 7
* bits carry from previous CDS */
#define CDSLEN ((5 + 64 * 32 + 7 + 7) / 8)
/* Marker for Remainder Of Segment condition in zero block encoding */
#define ROS -1
struct
internal_state
{
int
(
*
mode
)(
struct
aec_stream
*
);
uint32_t
(
*
get_sample
)(
struct
aec_stream
*
);
...
...
@@ -82,9 +89,8 @@ struct internal_state {
uint32_t
*
block
;
/* current (preprocessed) input block */
int
rsi_len
;
/* reference sample interval in byte */
uint8_t
*
cds
;
/* current Coded Data Set output */
uint8_t
*
cds_buf
;
/* buffer for one CDS (only used if
uint8_t
cds_buf
[
CDSLEN
];
/* buffer for one CDS (only used if
* strm->next_out cannot hold full CDS) */
int
cds_len
;
/* max cds length in byte */
int
direct_out
;
/* cds points to strm->next_out (1)
* or cds_buf (0) */
int
bits
;
/* Free bits (LSB) in output buffer or
...
...
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