Patent ID: 7656320

Claim:
A computer implemented method for encoding data, the method comprising: in response to a symbol retrieved from an input stream having a sequence of symbols, determining whether a current context can encode the retrieved symbol, wherein the current context includes a plurality entries, wherein each entry represents a symbol that the current context is able to encode, including a count value representing a frequency of each entry being used, wherein each symbol in the current context is listed in a literal stream; generating a code to be emitted to a code stream, the code representing a difference between an index of an entry in the current context associated with the retrieved symbol and a previous index used for encoding a previous symbol, if the current context can encode the retrieved symbol; incrementing a count value corresponding to the entry associated with the retrieved symbol in the current context; and sorting at least a portion of the current context based on count values of all entries in the current context, wherein the code stream and the literal stream are to be compressed and encoded by a compressor.