encode.h 2.04 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
struct internal_state {
    int (*mode)(struct aec_stream *);
    uint32_t (*get_sample)(struct aec_stream *);
18
    void (*get_rsi)(struct aec_stream *);
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
19
    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 */
25 26
    uint32_t *data_pp;      /* RSI blocks of preprocessed input */
    uint32_t *data_raw;     /* RSI blocks of input */
27
    int blocks_avail;       /* remaining blocks in buffer */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
28
    uint32_t *block;        /* current (preprocessed) input block */
29
    int block_len;          /* input block length in byte */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
30 31 32
    uint8_t *cds;           /* current Coded Data Set output */
    uint8_t *cds_buf;       /* buffer for one CDS (only used if
                             * strm->next_out cannot hold full CDS) */
33
    int cds_len;            /* max cds length in byte */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
34
    int direct_out;         /* cds points to strm->next_out (1)
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
35
                             * or cds_buf (0) */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
36
    int bits;               /* Free bits (LSB) in output buffer or
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
37 38 39 40 41
                             * 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 */
42 43 44 45
    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
46
    int kmax;               /* maximum number for k depending on id_len */
47
    int flush;              /* flush option copied from argument */
Mathis Rosenhauer's avatar
Mathis Rosenhauer committed
48
};
49

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