Prototype FSM implementation of adaptive entropy decoder
[platform/upstream/libaec.git] / src / aecd.h
1 #ifndef AELIB_H
2 #define AELIB_H
3
4 #include <inttypes.h>
5
6 struct internal_state;
7
8 typedef struct _ae_stream
9 {
10     uint8_t *next_in;
11     size_t avail_in;  /* number of bytes available at next_in */
12     size_t total_in;  /* total number of input bytes read so far */
13
14     uint32_t *next_out;
15     size_t avail_out; /* remaining free space at next_out */
16     size_t total_out; /* total number of bytes output so far */
17
18         uint32_t bit_per_sample; /* resolution in bits per sample (n = 1,..., 32) */
19         uint32_t block_size; /* block size in samples (J = 8 or 16) */
20         uint32_t segment_size; /* set of blocks between consecutive reference samples */
21         uint8_t pp; /* pre/post-processor used? */
22
23         struct internal_state *state;
24 } ae_stream;
25
26 typedef ae_stream *ae_streamp;
27
28 #define AE_OK            0
29 #define AE_STREAM_END    1
30 #define AE_ERRNO        (-1)
31 #define AE_STREAM_ERROR (-2)
32 #define AE_DATA_ERROR   (-3)
33 #define AE_MEM_ERROR    (-4)
34
35 #define AE_NO_FLUSH      0
36 #define AE_PARTIAL_FLUSH 1
37 #define AE_SYNC_FLUSH    2
38 #define AE_FULL_FLUSH    3
39 #define AE_FINISH        4
40 #define AE_BLOCK         5
41 #define AE_TREES         6
42
43 int ae_decode_init(ae_streamp strm);
44
45 int ae_decode(ae_streamp strm, int flush);
46
47 #endif /* AELIB_H */