decode.h 1.77 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#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

15 16
#define SAFE(strm) (strm->avail_in >= strm->state->in_blklen    \
              && strm->avail_out >= strm->state->out_blklen)
17 18 19 20 21 22 23 24 25

#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 */
26
    void (*flush_output)(struct aec_stream *);
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
    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 */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
42
    int bytes_per_sample;
43
    int *se_table;
44 45
    uint32_t *buf;
    uint32_t buf_i;
46 47
    uint32_t buf_size;
    uint32_t flush_start;
48 49 50
} decode_state;

#endif /* DECODE_H */