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
9d97007d
Commit
9d97007d
authored
Nov 12, 2012
by
Mathis Rosenhauer
Committed by
Thomas Jahns
Feb 19, 2013
Browse files
Renaming and redundant variable removal
parent
4f989501
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/decode.c
View file @
9d97007d
...
...
@@ -23,11 +23,9 @@
int64_t data; \
struct internal_state *state = strm->state; \
\
state->flush_end = MIN(state->buf_size, state->buf_next_out); \
\
if (state->pp) { \
if (state->flush_start == 0 && state->
flush_end
> 0) { \
state->last_out = state->buf
_out
[0]; \
if (state->flush_start == 0 && state->
buf_i
> 0) {
\
state->last_out = state->buf[0];
\
\
if (strm->flags & AEC_DATA_SIGNED) { \
m = 1ULL << (strm->bit_per_sample - 1); \
...
...
@@ -40,8 +38,8 @@
state->flush_start = 1; \
} \
\
for (i = state->flush_start; i < state->
flush_end
; i++) { \
d = state->buf
_out
[i]; \
for (i = state->flush_start; i < state->
buf_i
; i++) {
\
d = state->buf[i];
\
x = state->last_out; \
lower = x - state->xmin; \
th = MIN(lower, state->xmax - x); \
...
...
@@ -62,15 +60,15 @@
PUTBLOCK; \
} \
} else { \
for (i = state->flush_start; i < state->
flush_end
; i++) { \
data = state->buf
_out
[i]; \
for (i = state->flush_start; i < state->
buf_i
; i++) {
\
data = state->buf[i];
\
PUTBLOCK; \
} \
} \
if (state->
flush_end
== state->buf_size) { \
if (state->
buf_i
== state->buf_size) {
\
state->flush_start = 0; \
} else { \
state->flush_start = state->
flush_end;
\
state->flush_start = state->
buf_i;
\
} \
}
...
...
@@ -130,13 +128,13 @@ static void put_sample(struct aec_stream *strm, uint32_t s)
{
struct
internal_state
*
state
=
strm
->
state
;
state
->
buf
_out
[
state
->
buf_
next_out
++
]
=
s
;
state
->
buf
[
state
->
buf_
i
++
]
=
s
;
strm
->
avail_out
-=
state
->
byte_per_sample
;
strm
->
total_out
+=
state
->
byte_per_sample
;
if
(
state
->
buf_
next_out
==
state
->
buf_size
)
{
if
(
state
->
buf_
i
==
state
->
buf_size
)
{
state
->
flush_output
(
strm
);
state
->
buf_
next_out
=
0
;
state
->
buf_
i
=
0
;
}
}
...
...
@@ -304,7 +302,7 @@ static int m_id(struct aec_stream *strm)
{
struct
internal_state
*
state
=
strm
->
state
;
if
(
state
->
pp
&&
state
->
buf_
next_out
==
0
)
if
(
state
->
pp
&&
state
->
buf_
i
==
0
)
state
->
ref
=
1
;
else
state
->
ref
=
0
;
...
...
@@ -399,7 +397,7 @@ static int m_zero_block(struct aec_stream *strm)
fs_drop
(
strm
);
if
(
zero_blocks
==
ROS
)
{
b
=
state
->
buf_
next_out
/
strm
->
block_size
;
b
=
state
->
buf_
i
/
strm
->
block_size
;
zero_blocks
=
MIN
(
strm
->
rsi
-
b
,
64
-
(
b
%
64
));
}
else
if
(
zero_blocks
>
ROS
)
{
zero_blocks
--
;
...
...
@@ -617,14 +615,14 @@ int aec_decode_init(struct aec_stream *strm)
return
AEC_MEM_ERROR
;
state
->
buf_size
=
strm
->
rsi
*
strm
->
block_size
;
state
->
buf
_out
=
(
uint32_t
*
)
malloc
(
state
->
buf_size
*
sizeof
(
uint32_t
));
if
(
state
->
buf
_out
==
NULL
)
state
->
buf
=
(
uint32_t
*
)
malloc
(
state
->
buf_size
*
sizeof
(
uint32_t
));
if
(
state
->
buf
==
NULL
)
return
AEC_MEM_ERROR
;
strm
->
total_in
=
0
;
strm
->
total_out
=
0
;
state
->
buf_
next_out
=
0
;
state
->
buf_
i
=
0
;
state
->
flush_start
=
0
;
state
->
bitp
=
0
;
state
->
fs
=
0
;
...
...
@@ -658,7 +656,7 @@ int aec_decode_end(struct aec_stream *strm)
free
(
state
->
block
);
free
(
state
->
id_table
);
free
(
state
->
se_table
);
free
(
state
->
buf
_out
);
free
(
state
->
buf
);
free
(
state
);
return
AEC_OK
;
}
...
...
src/decode.h
View file @
9d97007d
...
...
@@ -41,11 +41,10 @@ struct internal_state {
int
pp
;
/* 1 if postprocessor has to be used */
int
byte_per_sample
;
int
*
se_table
;
uint32_t
*
buf
_out
;
uint32_t
buf_
next_out
;
uint32_t
*
buf
;
uint32_t
buf_
i
;
uint32_t
buf_size
;
uint32_t
flush_start
;
uint32_t
flush_end
;
}
decode_state
;
#endif
/* DECODE_H */
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