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
4e64405a
Commit
4e64405a
authored
Sep 16, 2012
by
Mathis Rosenhauer
Committed by
Thomas Jahns
Feb 19, 2013
Browse files
Rename everything to aec
parent
833c349c
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/aec.c
View file @
4e64405a
...
...
@@ -5,13 +5,13 @@
#include
<inttypes.h>
#include
<string.h>
#include
<getopt.h>
#include
"libae.h"
#include
"libae
c
.h"
#define CHUNK 1024
int
main
(
int
argc
,
char
*
argv
[])
{
ae_stream
strm
;
ae
c
_stream
strm
;
uint8_t
*
in
;
uint8_t
*
out
;
int
chunk
,
total_out
,
status
,
c
;
...
...
@@ -25,7 +25,7 @@ int main(int argc, char *argv[])
strm
.
bit_per_sample
=
8
;
strm
.
block_size
=
8
;
strm
.
rsi
=
2
;
strm
.
flags
=
AE_DATA_PREPROCESS
;
strm
.
flags
=
AE
C
_DATA_PREPROCESS
;
opterr
=
0
;
while
((
c
=
getopt
(
argc
,
argv
,
"d3Mscb:B:R:J:"
))
!=
-
1
)
...
...
@@ -50,13 +50,13 @@ int main(int argc, char *argv[])
cflag
=
1
;
break
;
case
's'
:
strm
.
flags
|=
AE_DATA_SIGNED
;
strm
.
flags
|=
AE
C
_DATA_SIGNED
;
break
;
case
'M'
:
strm
.
flags
|=
AE_DATA_MSB
;
strm
.
flags
|=
AE
C
_DATA_MSB
;
break
;
case
'3'
:
strm
.
flags
|=
AE_DATA_3BYTE
;
strm
.
flags
|=
AE
C
_DATA_3BYTE
;
break
;
case
'?'
:
if
(
optopt
==
'b'
)
...
...
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
if
(
strm
.
bit_per_sample
>
16
)
{
if
(
strm
.
bit_per_sample
<=
24
&&
strm
.
flags
&
AE_DATA_3BYTE
)
if
(
strm
.
bit_per_sample
<=
24
&&
strm
.
flags
&
AE
C
_DATA_3BYTE
)
chunk
*=
3
;
else
chunk
*=
4
;
...
...
@@ -124,16 +124,16 @@ int main(int argc, char *argv[])
if
(
dflag
)
{
if
((
ext
=
strstr
(
infn
,
".ae
e
"
))
==
NULL
)
if
((
ext
=
strstr
(
infn
,
".ae
c
"
))
==
NULL
)
{
fprintf
(
stderr
,
"Error: input file needs to end with .ae
e
\n
"
);
fprintf
(
stderr
,
"Error: input file needs to end with .ae
c
\n
"
);
exit
(
-
1
);
}
strncpy
(
outfn
,
infn
,
ext
-
infn
);
}
else
{
sprintf
(
outfn
,
"%s.ae
e
"
,
infn
);
sprintf
(
outfn
,
"%s.ae
c
"
,
infn
);
}
if
((
outfp
=
fopen
(
outfn
,
"w"
))
==
NULL
)
...
...
@@ -142,12 +142,12 @@ int main(int argc, char *argv[])
if
(
dflag
)
{
if
(
ae_decode_init
(
&
strm
)
!=
AE_OK
)
if
(
ae
c
_decode_init
(
&
strm
)
!=
AE
C
_OK
)
return
1
;
}
else
{
if
(
ae_encode_init
(
&
strm
)
!=
AE_OK
)
if
(
ae
c
_encode_init
(
&
strm
)
!=
AE
C
_OK
)
return
1
;
}
...
...
@@ -162,11 +162,11 @@ int main(int argc, char *argv[])
}
if
(
dflag
)
status
=
ae_decode
(
&
strm
,
AE_NO_FLUSH
);
status
=
ae
c
_decode
(
&
strm
,
AE
C
_NO_FLUSH
);
else
status
=
ae_encode
(
&
strm
,
AE_NO_FLUSH
);
status
=
ae
c
_encode
(
&
strm
,
AE
C
_NO_FLUSH
);
if
(
status
!=
AE_OK
)
if
(
status
!=
AE
C
_OK
)
{
fprintf
(
stderr
,
"error is %i
\n
"
,
status
);
return
1
;
...
...
@@ -189,11 +189,11 @@ int main(int argc, char *argv[])
if
(
dflag
)
{
ae_decode_end
(
&
strm
);
ae
c
_decode_end
(
&
strm
);
}
else
{
if
((
status
=
ae_encode
(
&
strm
,
AE_FLUSH
))
!=
AE_OK
)
if
((
status
=
ae
c
_encode
(
&
strm
,
AE
C
_FLUSH
))
!=
AE
C
_OK
)
{
fprintf
(
stderr
,
"error is %i
\n
"
,
status
);
return
1
;
...
...
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
fwrite
(
out
,
strm
.
total_out
-
total_out
,
1
,
outfp
);
}
ae_encode_end
(
&
strm
);
ae
c
_encode_end
(
&
strm
);
}
fclose
(
infp
);
...
...
src/aee_accessors.h
deleted
100644 → 0
View file @
833c349c
#ifndef AEE_ACCESSORS_H
#define AEE_ACCESSORS_H
#include
<inttypes.h>
#include
"libae.h"
uint32_t
get_8
(
ae_streamp
strm
);
uint32_t
get_lsb_16
(
ae_streamp
strm
);
uint32_t
get_msb_16
(
ae_streamp
strm
);
uint32_t
get_lsb_32
(
ae_streamp
strm
);
uint32_t
get_msb_24
(
ae_streamp
strm
);
uint32_t
get_lsb_24
(
ae_streamp
strm
);
uint32_t
get_msb_32
(
ae_streamp
strm
);
extern
void
(
*
get_block_funcs_8
[
4
])(
ae_streamp
);
extern
void
(
*
get_block_funcs_lsb_16
[
4
])(
ae_streamp
);
extern
void
(
*
get_block_funcs_msb_16
[
4
])(
ae_streamp
);
extern
void
(
*
get_block_funcs_lsb_24
[
4
])(
ae_streamp
);
extern
void
(
*
get_block_funcs_msb_24
[
4
])(
ae_streamp
);
extern
void
(
*
get_block_funcs_lsb_32
[
4
])(
ae_streamp
);
extern
void
(
*
get_block_funcs_msb_32
[
4
])(
ae_streamp
);
#endif
src/
aed
.c
→
src/
decode
.c
View file @
4e64405a
...
...
@@ -7,7 +7,7 @@
#include
<inttypes.h>
#include
<string.h>
#include
"libae.h"
#include
"libae
c
.h"
#define MIN(a, b) (((a) < (b))? (a): (b))
...
...
@@ -20,7 +20,7 @@ typedef struct internal_state {
int
id
;
/* option ID */
int
id_len
;
/* bit length of code option identification key */
int
*
id_table
;
/* table maps IDs to states */
void
(
*
put_sample
)(
ae_streamp
,
int64_t
);
void
(
*
put_sample
)(
ae
c
_streamp
,
int64_t
);
int
ref_int
;
/* reference sample is every ref_int samples */
int64_t
last_out
;
/* previous output for post-processing */
int64_t
xmin
;
/* minimum integer for post-processing */
...
...
@@ -42,7 +42,8 @@ typedef struct internal_state {
}
decode_state
;
/* decoding table for the second-extension option */
static
const
int
second_extension
[
92
][
2
]
=
{
static
const
int
second_extension
[
92
][
2
]
=
{
{
0
,
0
},
{
1
,
1
},
{
1
,
1
},
{
2
,
3
},
{
2
,
3
},
{
2
,
3
},
...
...
@@ -74,7 +75,7 @@ enum
M_UNCOMP_COPY
,
};
static
void
put_msb_32
(
ae_streamp
strm
,
int64_t
data
)
static
void
put_msb_32
(
ae
c
_streamp
strm
,
int64_t
data
)
{
*
strm
->
next_out
++
=
data
>>
24
;
*
strm
->
next_out
++
=
data
>>
16
;
...
...
@@ -84,7 +85,7 @@ static void put_msb_32(ae_streamp strm, int64_t data)
strm
->
total_out
+=
4
;
}
static
void
put_msb_24
(
ae_streamp
strm
,
int64_t
data
)
static
void
put_msb_24
(
ae
c
_streamp
strm
,
int64_t
data
)
{
*
strm
->
next_out
++
=
data
>>
16
;
*
strm
->
next_out
++
=
data
>>
8
;
...
...
@@ -93,7 +94,7 @@ static void put_msb_24(ae_streamp strm, int64_t data)
strm
->
total_out
+=
3
;
}
static
void
put_msb_16
(
ae_streamp
strm
,
int64_t
data
)
static
void
put_msb_16
(
ae
c
_streamp
strm
,
int64_t
data
)
{
*
strm
->
next_out
++
=
data
>>
8
;
*
strm
->
next_out
++
=
data
;
...
...
@@ -101,7 +102,7 @@ static void put_msb_16(ae_streamp strm, int64_t data)
strm
->
total_out
+=
2
;
}
static
void
put_lsb_32
(
ae_streamp
strm
,
int64_t
data
)
static
void
put_lsb_32
(
ae
c
_streamp
strm
,
int64_t
data
)
{
*
strm
->
next_out
++
=
data
;
*
strm
->
next_out
++
=
data
>>
8
;
...
...
@@ -111,7 +112,7 @@ static void put_lsb_32(ae_streamp strm, int64_t data)
strm
->
total_out
+=
4
;
}
static
void
put_lsb_24
(
ae_streamp
strm
,
int64_t
data
)
static
void
put_lsb_24
(
ae
c
_streamp
strm
,
int64_t
data
)
{
*
strm
->
next_out
++
=
data
;
*
strm
->
next_out
++
=
data
>>
8
;
...
...
@@ -120,7 +121,7 @@ static void put_lsb_24(ae_streamp strm, int64_t data)
strm
->
total_out
+=
3
;
}
static
void
put_lsb_16
(
ae_streamp
strm
,
int64_t
data
)
static
void
put_lsb_16
(
ae
c
_streamp
strm
,
int64_t
data
)
{
*
strm
->
next_out
++
=
data
;
*
strm
->
next_out
++
=
data
>>
8
;
...
...
@@ -128,14 +129,14 @@ static void put_lsb_16(ae_streamp strm, int64_t data)
strm
->
total_out
+=
2
;
}
static
void
put_8
(
ae_streamp
strm
,
int64_t
data
)
static
void
put_8
(
ae
c
_streamp
strm
,
int64_t
data
)
{
*
strm
->
next_out
++
=
data
;
strm
->
avail_out
--
;
strm
->
total_out
++
;
}
static
inline
void
u_put
(
ae_streamp
strm
,
int64_t
sample
)
static
inline
void
u_put
(
ae
c
_streamp
strm
,
int64_t
sample
)
{
int64_t
x
,
d
,
th
,
D
,
lower
;
decode_state
*
state
=
strm
->
state
;
...
...
@@ -163,7 +164,7 @@ static inline void u_put(ae_streamp strm, int64_t sample)
}
else
{
if
(
strm
->
flags
&
AE_DATA_SIGNED
)
if
(
strm
->
flags
&
AE
C
_DATA_SIGNED
)
{
int
m
=
64
-
strm
->
bit_per_sample
;
/* Reference samples have to be sign extended */
...
...
@@ -175,7 +176,7 @@ static inline void u_put(ae_streamp strm, int64_t sample)
state
->
samples_out
++
;
}
static
inline
int64_t
u_get
(
ae_streamp
strm
,
unsigned
int
n
)
static
inline
int64_t
u_get
(
ae
c
_streamp
strm
,
unsigned
int
n
)
{
/**
Unsafe get n bit from input stream
...
...
@@ -197,7 +198,7 @@ static inline int64_t u_get(ae_streamp strm, unsigned int n)
return
(
state
->
acc
>>
state
->
bitp
)
&
((
1ULL
<<
n
)
-
1
);
}
static
inline
int64_t
u_get_fs
(
ae_streamp
strm
)
static
inline
int64_t
u_get_fs
(
ae
c
_streamp
strm
)
{
/**
Interpret a Fundamental Sequence from the input buffer.
...
...
@@ -214,7 +215,7 @@ static inline int64_t u_get_fs(ae_streamp strm)
return
fs
;
}
static
inline
void
fast_split
(
ae_streamp
strm
)
static
inline
void
fast_split
(
ae
c
_streamp
strm
)
{
int
i
,
k
;
decode_state
*
state
;
...
...
@@ -235,7 +236,7 @@ static inline void fast_split(ae_streamp strm)
}
}
static
inline
void
fast_zero
(
ae_streamp
strm
)
static
inline
void
fast_zero
(
ae
c
_streamp
strm
)
{
int
i
=
strm
->
state
->
i
;
...
...
@@ -243,7 +244,7 @@ static inline void fast_zero(ae_streamp strm)
u_put
(
strm
,
0
);
}
static
inline
void
fast_se
(
ae_streamp
strm
)
static
inline
void
fast_se
(
ae
c
_streamp
strm
)
{
int
i
;
int64_t
gamma
,
beta
,
ms
,
delta1
;
...
...
@@ -267,7 +268,7 @@ static inline void fast_se(ae_streamp strm)
}
}
static
inline
void
fast_uncomp
(
ae_streamp
strm
)
static
inline
void
fast_uncomp
(
ae
c
_streamp
strm
)
{
int
i
;
...
...
@@ -275,7 +276,7 @@ static inline void fast_uncomp(ae_streamp strm)
u_put
(
strm
,
u_get
(
strm
,
strm
->
bit_per_sample
));
}
int
ae_decode_init
(
ae_streamp
strm
)
int
ae
c
_decode_init
(
ae
c
_streamp
strm
)
{
int
i
,
modi
;
decode_state
*
state
;
...
...
@@ -283,14 +284,14 @@ int ae_decode_init(ae_streamp strm)
/* Some sanity checks */
if
(
strm
->
bit_per_sample
>
32
||
strm
->
bit_per_sample
==
0
)
{
return
AE_CONF_ERROR
;
return
AE
C
_CONF_ERROR
;
}
/* Internal state for decoder */
state
=
(
decode_state
*
)
malloc
(
sizeof
(
decode_state
));
if
(
state
==
NULL
)
{
return
AE_MEM_ERROR
;
return
AE
C
_MEM_ERROR
;
}
strm
->
state
=
state
;
...
...
@@ -298,10 +299,10 @@ int ae_decode_init(ae_streamp strm)
{
state
->
id_len
=
5
;
if
(
strm
->
bit_per_sample
<=
24
&&
strm
->
flags
&
AE_DATA_3BYTE
)
if
(
strm
->
bit_per_sample
<=
24
&&
strm
->
flags
&
AE
C
_DATA_3BYTE
)
{
state
->
byte_per_sample
=
3
;
if
(
strm
->
flags
&
AE_DATA_MSB
)
if
(
strm
->
flags
&
AE
C
_DATA_MSB
)
state
->
put_sample
=
put_msb_24
;
else
state
->
put_sample
=
put_lsb_24
;
...
...
@@ -309,7 +310,7 @@ int ae_decode_init(ae_streamp strm)
else
{
state
->
byte_per_sample
=
4
;
if
(
strm
->
flags
&
AE_DATA_MSB
)
if
(
strm
->
flags
&
AE
C
_DATA_MSB
)
state
->
put_sample
=
put_msb_32
;
else
state
->
put_sample
=
put_lsb_32
;
...
...
@@ -322,7 +323,7 @@ int ae_decode_init(ae_streamp strm)
state
->
byte_per_sample
=
2
;
state
->
id_len
=
4
;
state
->
out_blklen
=
strm
->
block_size
*
2
;
if
(
strm
->
flags
&
AE_DATA_MSB
)
if
(
strm
->
flags
&
AE
C
_DATA_MSB
)
state
->
put_sample
=
put_msb_16
;
else
state
->
put_sample
=
put_lsb_16
;
...
...
@@ -333,10 +334,9 @@ int ae_decode_init(ae_streamp strm)
state
->
id_len
=
3
;
state
->
out_blklen
=
strm
->
block_size
;
state
->
put_sample
=
put_8
;
}
if
(
strm
->
flags
&
AE_DATA_SIGNED
)
if
(
strm
->
flags
&
AE
C
_DATA_SIGNED
)
{
state
->
xmin
=
-
(
1ULL
<<
(
strm
->
bit_per_sample
-
1
));
state
->
xmax
=
(
1ULL
<<
(
strm
->
bit_per_sample
-
1
))
-
1
;
...
...
@@ -355,7 +355,7 @@ int ae_decode_init(ae_streamp strm)
state
->
id_table
=
(
int
*
)
malloc
(
modi
*
sizeof
(
int
));
if
(
state
->
id_table
==
NULL
)
{
return
AE_MEM_ERROR
;
return
AE
C
_MEM_ERROR
;
}
state
->
id_table
[
0
]
=
M_LOW_ENTROPY
;
for
(
i
=
1
;
i
<
modi
-
1
;
i
++
)
...
...
@@ -367,7 +367,7 @@ int ae_decode_init(ae_streamp strm)
state
->
block
=
(
int64_t
*
)
malloc
(
strm
->
block_size
*
sizeof
(
int64_t
));
if
(
state
->
block
==
NULL
)
{
return
AE_MEM_ERROR
;
return
AE
C
_MEM_ERROR
;
}
strm
->
total_in
=
0
;
strm
->
total_out
=
0
;
...
...
@@ -375,12 +375,12 @@ int ae_decode_init(ae_streamp strm)
state
->
samples_out
=
0
;
state
->
bitp
=
0
;
state
->
fs
=
0
;
state
->
pp
=
strm
->
flags
&
AE_DATA_PREPROCESS
;
state
->
pp
=
strm
->
flags
&
AE
C
_DATA_PREPROCESS
;
state
->
mode
=
M_ID
;
return
AE_OK
;
return
AE
C
_OK
;
}
int
ae_decode_end
(
ae_streamp
strm
)
int
ae
c
_decode_end
(
ae
c
_streamp
strm
)
{
decode_state
*
state
;
...
...
@@ -388,7 +388,7 @@ int ae_decode_end(ae_streamp strm)
free
(
state
->
block
);
free
(
state
->
id_table
);
free
(
state
);
return
AE_OK
;
return
AE
C
_OK
;
}
#define ASK(n) \
...
...
@@ -452,7 +452,7 @@ int ae_decode_end(ae_streamp strm)
} while (0)
int
ae_decode
(
ae_streamp
strm
,
int
flush
)
int
ae
c
_decode
(
ae
c
_streamp
strm
,
int
flush
)
{
/**
Finite-state machine implementation of the adaptive entropy
...
...
@@ -643,10 +643,10 @@ int ae_decode(ae_streamp strm, int flush)
break
;
default:
return
AE_STREAM_ERROR
;
return
AE
C
_STREAM_ERROR
;
}
}
req_buffer:
return
AE_OK
;
return
AE
C
_OK
;
}
src/
a
ee.c
→
src/e
ncod
e.c
View file @
4e64405a
/**
* @file
a
ee.c
* @file e
ncod
e.c
* @author Mathis Rosenhauer, Deutsches Klimarechenzentrum
* @section DESCRIPTION
*
...
...
@@ -14,25 +14,25 @@
#include
<inttypes.h>
#include
<string.h>
#include
"libae.h"
#include
"
a
ee.h"
#include
"
a
ee_accessors.h"
#include
"libae
c
.h"
#include
"e
ncod
e.h"
#include
"e
ncod
e_accessors.h"
/* Marker for Remainder Of Segment condition in zero block encoding */
#define ROS -1
#define MIN(a, b) (((a) < (b))? (a): (b))
static
int
m_get_block
(
ae_streamp
strm
);
static
int
m_get_block_cautious
(
ae_streamp
strm
);
static
int
m_check_zero_block
(
ae_streamp
strm
);
static
int
m_select_code_option
(
ae_streamp
strm
);
static
int
m_flush_block
(
ae_streamp
strm
);
static
int
m_flush_block_cautious
(
ae_streamp
strm
);
static
int
m_encode_splitting
(
ae_streamp
strm
);
static
int
m_encode_uncomp
(
ae_streamp
strm
);
static
int
m_encode_se
(
ae_streamp
strm
);
static
int
m_encode_zero
(
ae_streamp
strm
);
static
int
m_get_block
(
ae
c
_streamp
strm
);
static
int
m_get_block_cautious
(
ae
c
_streamp
strm
);
static
int
m_check_zero_block
(
ae
c
_streamp
strm
);
static
int
m_select_code_option
(
ae
c
_streamp
strm
);
static
int
m_flush_block
(
ae
c
_streamp
strm
);
static
int
m_flush_block_cautious
(
ae
c
_streamp
strm
);
static
int
m_encode_splitting
(
ae
c
_streamp
strm
);
static
int
m_encode_uncomp
(
ae
c
_streamp
strm
);
static
int
m_encode_se
(
ae
c
_streamp
strm
);
static
int
m_encode_zero
(
ae
c
_streamp
strm
);
/*
*
...
...
@@ -89,7 +89,7 @@ static inline void emitfs(encode_state *state, int fs)
}
#define EMITBLOCK(ref) \
static inline void emitblock_##ref(ae_streamp strm, int k)
\
static inline void emitblock_##ref(ae
c
_streamp strm, int k) \
{ \
int b; \
uint64_t a; \
...
...
@@ -126,7 +126,7 @@ static inline void emitfs(encode_state *state, int fs)
EMITBLOCK
(
0
);
EMITBLOCK
(
1
);
static
void
preprocess_unsigned
(
ae_streamp
strm
)
static
void
preprocess_unsigned
(
ae
c
_streamp
strm
)
{
int
i
;
int64_t
theta
,
Delta
,
prev
;
...
...
@@ -160,7 +160,7 @@ static void preprocess_unsigned(ae_streamp strm)
}
}
static
void
preprocess_signed
(
ae_streamp
strm
)
static
void
preprocess_signed
(
ae
c
_streamp
strm
)
{
int
i
,
m
;
int64_t
theta
,
Delta
,
prev
,
sample
;
...
...
@@ -202,7 +202,7 @@ static void preprocess_signed(ae_streamp strm)
*
*/
static
int
m_get_block
(
ae_streamp
strm
)
static
int
m_get_block
(
ae
c
_streamp
strm
)
{
encode_state
*
state
=
strm
->
state
;
...
...
@@ -236,7 +236,7 @@ static int m_get_block(ae_streamp strm)
{
state
->
get_block
(
strm
);
if
(
strm
->
flags
&
AE_DATA_PREPROCESS
)
if
(
strm
->
flags
&
AE
C
_DATA_PREPROCESS
)
state
->
preprocess
(
strm
);
return
m_check_zero_block
(
strm
);
...
...
@@ -257,7 +257,7 @@ static int m_get_block(ae_streamp strm)
return
M_CONTINUE
;
}
static
int
m_get_block_cautious
(
ae_streamp
strm
)
static
int
m_get_block_cautious
(
ae
c
_streamp
strm
)
{
int
j
;
encode_state
*
state
=
strm
->
state
;
...
...
@@ -270,7 +270,7 @@ static int m_get_block_cautious(ae_streamp strm)
}
else
{
if
(
state
->
flush
==
AE_FLUSH
)
if
(
state
->
flush
==
AE
C
_FLUSH
)
{
if
(
state
->
i
>
0
)
{
...
...
@@ -310,13 +310,13 @@ static int m_get_block_cautious(ae_streamp strm)
}
while
(
++
state
->
i
<
strm
->
rsi
*
strm
->
block_size
);
if
(
strm
->
flags
&
AE_DATA_PREPROCESS
)
if
(
strm
->
flags
&
AE
C
_DATA_PREPROCESS
)
state
->
preprocess
(
strm
);
return
m_check_zero_block
(
strm
);
}
static
inline
int
m_check_zero_block
(
ae_streamp
strm
)
static
inline
int
m_check_zero_block
(
ae
c
_streamp
strm
)
{
int
i
;
encode_state
*
state
=
strm
->
state
;
...
...
@@ -361,7 +361,7 @@ static inline int m_check_zero_block(ae_streamp strm)
return
M_CONTINUE
;
}
static
inline
int
m_select_code_option
(
ae_streamp
strm
)
static
inline
int
m_select_code_option
(
ae
c
_streamp
strm
)
{
int
i
,
j
,
k
,
this_bs
,
looked_bothways
,
direction
;
uint64_t
split_len
,
uncomp_len
;
...
...
@@ -534,7 +534,7 @@ static inline int m_select_code_option(ae_streamp strm)
}
}
static
inline
int
m_encode_splitting
(
ae_streamp
strm
)
static
inline
int
m_encode_splitting
(
ae
c
_streamp
strm
)
{
int
i
;
encode_state
*
state
=
strm
->
state
;
...
...
@@ -559,7 +559,7 @@ static inline int m_encode_splitting(ae_streamp strm)
return
m_flush_block
(
strm
);
}
static
inline
int
m_encode_uncomp
(
ae_streamp
strm
)
static
inline
int
m_encode_uncomp
(
ae
c
_streamp
strm
)
{
encode_state
*
state
=
strm
->
state
;
...
...
@@ -569,7 +569,7 @@ static inline int m_encode_uncomp(ae_streamp strm)
return
m_flush_block
(
strm
);
}
static
inline
int
m_encode_se
(
ae_streamp
strm
)
static
inline
int
m_encode_se
(
ae
c
_streamp
strm
)
{
int
i
;
uint32_t
d
;
...
...
@@ -588,7 +588,7 @@ static inline int m_encode_se(ae_streamp strm)
return
m_flush_block
(
strm
);
}
static
inline
int
m_encode_zero
(
ae_streamp
strm
)
static
inline
int
m_encode_zero
(
ae
c
_streamp
strm
)
{
encode_state
*
state
=
strm
->
state
;
...
...
@@ -608,7 +608,7 @@ static inline int m_encode_zero(ae_streamp strm)
return
m_flush_block
(
strm
);
}
static
inline
int
m_flush_block
(
ae_streamp
strm
)
static
inline
int
m_flush_block
(
ae
c
_streamp
strm
)
{
int
n
;
encode_state
*
state
=
strm
->
state
;
...
...
@@ -628,7 +628,7 @@ static inline int m_flush_block(ae_streamp strm)
return
M_CONTINUE
;
}
static
inline
int
m_flush_block_cautious
(
ae_streamp
strm
)
static
inline
int
m_flush_block_cautious
(
ae
c
_streamp
strm
)
{
encode_state
*
state
=
strm
->
state
;
...
...
@@ -653,29 +653,29 @@ static inline int m_flush_block_cautious(ae_streamp strm)
*
*/
int
ae_encode_init
(
ae_streamp
strm
)
int
ae
c
_encode_init
(
ae
c
_streamp
strm
)
{
int
bs
,
bsi
;
encode_state
*
state
;
/* Some sanity checks */
if
(
strm
->
bit_per_sample
>
32
||
strm
->
bit_per_sample
==
0
)
return
AE_CONF_ERROR
;
return
AE
C
_CONF_ERROR
;
if
(
strm
->
block_size
!=
8
&&
strm
->
block_size
!=
16
&&
strm
->
block_size
!=
32
&&
strm
->
block_size
!=
64
)
return
AE_CONF_ERROR
;
return
AE
C
_CONF_ERROR
;
if
(
strm
->
rsi
>
4096
)
return
AE_CONF_ERROR
;
return
AE
C
_CONF_ERROR
;
/* Internal state for encoder */
state
=
(
encode_state
*
)
malloc
(
sizeof
(
encode_state
));
if
(
state
==
NULL
)
{
return
AE_MEM_ERROR
;
return
AE
C
_MEM_ERROR
;
}
memset
(
state
,
0
,
sizeof
(
encode_state
));
strm
->
state
=
state
;
...
...
@@ -690,10 +690,10 @@ int ae_encode_init(ae_streamp strm)
/* 24/32 input bit settings */
state
->
id_len
=
5
;
if
(
strm
->
bit_per_sample
<=
24
&&
strm
->
flags
&
AE_DATA_3BYTE
)
if
(
strm
->
bit_per_sample
<=
24
&&
strm
->
flags
&
AE
C
_DATA_3BYTE
)
{
state
->
block_len
=
3
*
strm
->
block_size
;