Skip to main content

Crate ppmd_core

Crate ppmd_core 

Source
Expand description

PPMd-style entropy coder for byte streams.

This crate implements a Prediction by Partial Matching (PPM) compressor/decompressor using a range encoder/decoder underneath. PPM builds adaptive probability models based on the last N bytes of context, where N is the “order.” Higher orders give better compression at the cost of more memory and CPU; lower orders run faster but yield larger output.

§Key Parameters

  • DEFAULT_ORDER: u8 = 5
    The default context length (order-5). A good middle ground between speed and compression.
  • MAX_FREQ: u8 = 124
    Maximum per-symbol frequency in any context. Caps frequencies to avoid overflow.
  • TOP: u32 = 1 << 24 and BOT: u32 = 1 << 15
    Thresholds used by the underlying range coder to renormalize its internal registers. You generally don’t need to touch these unless you’re tuning the coder itself.

Structs§

PpmModel
The central PPM model. Maintains up to max_order contexts and dynamically updates symbol frequencies as you encode or decode.
RangeDecoder
Streaming range‐decoder for arithmetic coding.
RangeEncoder
Streaming range‐encoder for arithmetic coding.

Enums§

PpmError
The set of errors that can occur during PPM encoding or decoding.

Constants§

BOT
DEFAULT_ORDER
MAX_FREQ
TOP

Functions§

decode_file
Decompress input_path (which must have been produced by encode_file) back into output_path, using the default DEFAULT_ORDER = 5.
encode_file
Compress the file at input_path into output_path using PPM.

Type Aliases§

PpmResult
A specialized Result using PpmError for errors.