summaryrefslogtreecommitdiff
path: root/src/decode.h
diff options
context:
space:
mode:
authorMathis Rosenhauer <rosenhauer@dkrz.de>2012-10-23 13:13:03 +0200
committerThomas Jahns <jahns@dkrz.de>2013-02-19 11:33:00 +0100
commitfca3dc1f18393aabacf34bb1736ae9a05253e5d5 (patch)
treeea7d40eb725c28642b08d5c37c5d6d5c300b7e20 /src/decode.h
parentec53d5ad5687e4dce2a2013b67cd522f6ec82786 (diff)
downloadlibaec-fca3dc1f18393aabacf34bb1736ae9a05253e5d5.tar.gz
libaec-fca3dc1f18393aabacf34bb1736ae9a05253e5d5.tar.bz2
libaec-fca3dc1f18393aabacf34bb1736ae9a05253e5d5.zip
Decoder: turn FSM switch into functions
Diffstat (limited to 'src/decode.h')
-rw-r--r--src/decode.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/decode.h b/src/decode.h
new file mode 100644
index 0000000..8bd50ab
--- /dev/null
+++ b/src/decode.h
@@ -0,0 +1,46 @@
+#ifndef DECODE_H
+#define DECODE_H
+
+#include <config.h>
+
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
+#include "libaec.h"
+
+#define M_CONTINUE 1
+#define M_EXIT 0
+
+#define SAFE (strm->avail_in >= state->in_blklen \
+ && strm->avail_out >= state->out_blklen)
+
+#define ROS 5
+#define MIN(a, b) (((a) < (b))? (a): (b))
+
+struct internal_state {
+ int (*mode)(struct aec_stream *);
+ int id; /* option ID */
+ int id_len; /* bit length of code option identification key */
+ int (**id_table)(struct aec_stream *); /* table maps IDs to states */
+ void (*put_sample)(struct aec_stream *, 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 */
+ int64_t xmax; /* maximum integer for post-processing */
+ int in_blklen; /* length of uncompressed input block
+ should be the longest possible block */
+ int out_blklen; /* length of output block in bytes */
+ int n, i; /* counter for samples */
+ int64_t *block; /* block buffer for split-sample options */
+ int se; /* set if second extension option is selected */
+ uint64_t acc; /* accumulator for currently used bit sequence */
+ int bitp; /* bit pointer to the next unused bit in accumulator */
+ int fs; /* last fundamental sequence in accumulator */
+ int ref; /* 1 if current block has reference sample */
+ int pp; /* 1 if postprocessor has to be used */
+ int byte_per_sample;
+ size_t samples_out;
+} decode_state;
+
+#endif /* DECODE_H */