Context algorithm
Semi-predictive context algorithm implementation
 All Data Structures Files Functions Variables Typedefs Macros Pages
coder.h
Go to the documentation of this file.
1 /*
2  * Listing 1 -- coder.h
3  *
4  * This header file contains the constants, declarations, and
5  * prototypes needed to use the arithmetic coding routines. These
6  * declarations are for routines that need to interface with the
7  * arithmetic coding stuff in coder.c
8  *
9  */
10 
11 #define MAXIMUM_SCALE 16383 /* Maximum allowed frequency count */
12 #define ESCAPE 256 /* The escape symbol */
13 #define DONE -1 /* The output stream empty symbol */
14 #define FLUSH -2 /* The symbol to flush the model */
15 
16 /*
17  * A symbol can either be represented as an int, or as a pair of
18  * counts on a scale. This structure gives a standard way of
19  * defining it as a pair of counts.
20  */
21 typedef struct {
22  unsigned short int low_count;
23  unsigned short int high_count;
24  unsigned short int scale;
25  } SYMBOL;
26 
27 extern long underflow_bits; /* The present underflow count in */
28  /* the arithmetic coder. */
29 /*
30  * Function prototypes.
31  */
32 void initialize_arithmetic_decoder( FILE *stream );
33 void remove_symbol_from_stream( FILE *stream, SYMBOL *s );
35 void encode_symbol( FILE *stream, SYMBOL *s );
36 void flush_arithmetic_encoder( FILE *stream );
37 short int get_current_count( SYMBOL *s );
38 
void initialize_arithmetic_decoder(FILE *stream)
Definition: coder.c:141
unsigned short int scale
Definition: coder.h:24
void encode_symbol(FILE *stream, SYMBOL *s)
Definition: coder.c:54
Definition: coder.h:21
void initialize_arithmetic_encoder()
Definition: coder.c:37
long underflow_bits
Definition: coder.c:29
unsigned short int low_count
Definition: coder.h:22
void flush_arithmetic_encoder(FILE *stream)
Definition: coder.c:108
unsigned short int high_count
Definition: coder.h:23
void remove_symbol_from_stream(FILE *stream, SYMBOL *s)
Definition: coder.c:161
short int get_current_count(SYMBOL *s)
Definition: coder.c:124