encode.h 1.83 KB
Newer Older
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
1 2
#ifndef ENCODE_H
#define ENCODE_H
3

4 5 6 7 8 9
#include <config.h>

#if HAVE_STDINT_H
# include <stdint.h>
#endif

Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
10
#include "libaec.h"
11 12 13 14

#define M_CONTINUE 1
#define M_EXIT 0

Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
15 16 17 18 19
struct internal_state {
    int (*mode)(struct aec_stream *);
    void (*get_block)(struct aec_stream *);
    uint32_t (*get_sample)(struct aec_stream *);
    void (*preprocess)(struct aec_stream *);
20 21 22 23

    int id_len;             /* bit length of code option identification key */
    int64_t xmin;           /* minimum integer for preprocessing */
    int64_t xmax;           /* maximum integer for preprocessing */
24
    int i;                  /* counter */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
25
    uint32_t *block_buf;    /* RSI blocks of input */
26
    int blocks_avail;       /* remaining blocks in buffer */
27
    uint32_t *block_p;       /* pointer to current block */
28 29 30 31 32
    int block_len;          /* input block length in byte */
    uint8_t *cds_buf;       /* Buffer for one Coded Data Set */
    int cds_len;            /* max cds length in byte */
    uint8_t *cds_p;         /* pointer to current output */
    int direct_out;         /* output to strm->next_out (1)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
33 34 35 36 37 38 39
                             * or cds_buf (0) */
    int bit_p;              /* bit pointer to the next unused bit in
                             * accumulator */
    int ref;                /* length of reference sample in current
                             * block i.e. 0 or 1 depending on whether
                             * the block has a reference sample or
                             * not */
40 41 42 43
    int zero_ref;           /* current zero block has a reference sample */
    int64_t zero_ref_sample;/* reference sample of zero block */
    int zero_blocks;        /* number of contiguous zero blocks */
    int k;                  /* splitting position */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
44
    int kmax;
45
    int flush;              /* flush option copied from argument */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
46
};
47

Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
48
#endif /* ENCODE_H */