**Name**

**arencode2** Arithmetic encoding of a string of symbol

**Command Synopsis**

**arencode2** [-i] [-s *Size*] [-n *NSymbol*] [-c *Cap_Histo*] [-p] [-h *Histo*] [-H] *Input* *.* [*Output* ]

-i : Do not print info on encoding process

-sSize: Number of symbols to encode

-nNSymbol: Number of different symbols in source (size of alphabet)

-cCap_Histo: Capacity of histogram

-p : Use predictive model

-hHisto: Histogram model for input symbols (fsignal)

-H : Insert header with size of alphabet and predictive info

Input: Input string of symbols (fimage)

. (screen output) : Rate of output

Output: Output string of codewords (cimage)

**Function Summary**

void arencode2 (Print , Size , NSymb , Cap_Histo , Predic , Histo , Header , Input , Rate , Output )

int *Print ;

long *Size ;

int *NSymb ;

long *Cap_Histo ;

int *Predic ;

Fsignal Histo ;

int *Header ;

Fimage Input ;

double *Rate ;

Cimage Output ;

**Description**

This module performs arithmetic encoding of symbols contained in the Input fimage according to the algorithm described in [WNC87].

The -s option enables to specify that only the first Size symbols should be encoded.

If the -n option is selected, then symbols in input are supposed to be integer in floating point representation ranging from 0 to NSymbol - 1. If it is not activated, then a first pass is made on Input to search for the minimal alphabet.

The -c option enables to specify the capacity of the empirical source distribution histogram used for arithmetic encoding (see [WNC87]). The default value is 100 times the size of alphabet. This only makes sense when adaptive encoding is performed (i.e. the -h option is not selected).

The -p option specifies that predictive encoding should be performed.

If the -h option is activated, then the histogram contained in the fsignal Histo is used as the fixed source distribution histogram. If this option is not activated, then adaptive encoding is performed, meaning that the source distribution histogram is flat at the beginning, and is updated after the encoding of each symbol so that it is adapted to the sequence of symbols encoded in the past.

If the -H option is selected, then a header is inserted at the beginning of input with information on size of Input alphabet and predictive encoding.

Notice that the 2D structure of the input fimage is not used in this module. The symbols are read in the natural order in the ``gray'' field of the fimage.

**See Also**

`cvsfrecode`, `cvsorgcode`, `fencode`, `fscalq`, `fvq`.

**Version 1.01**

Last Modification date : Thu Nov 29 20:23:57 2001

**Author**

Jean-Pierre D'Ales