home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / l / lds_10.zip / COMP / CODER.H < prev    next >
C/C++ Source or Header  |  1990-05-22  |  1KB  |  39 lines

  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 );
  34. void initialize_arithmetic_encoder( void );
  35. void encode_symbol( FILE *stream, SYMBOL *s );
  36. void flush_arithmetic_encoder( FILE *stream );
  37. short int get_current_count( SYMBOL *s );
  38.  
  39.