PPMd(3)

NAME
Compress::PPMd - PPMd compression

SYNOPSIS
  use Compress::PPMd;

  my $encoder=Compress::PPMd::Encoder->new();
  my $encoded=$encoder->encode($text);
  my $encoded2=$encoder->encode($text2);

  my $decoder=Compress::PPMd::Decoder->new();
  my $decoded=$encoder->decode($encoded);
  my $decoded2=$encoder->decode($encoded2);

ABSTRACT
This package is a Perl wrapper around Dmitry Shkarin PPMd compression library.

PPMd produces the best compression ratios for textual data.

DESCRIPTION
Compress::PPMd is compossed of two classes to compress and decompress data respectively:

  Compress::PPMd::Encoder

"Compress::PPMd::Encoder->new($MaxOrder, $MemSizeMB, $MRMethod, $Solid)"
    creates a new encoder object. The parameters are:

    $MaxOrder
        max order for the PPM modelling ranging from 2 to 16, higher values produce better compression ratios but are slower.

        Default value is 8.

    $MemSizeMB
        max memory in MB the compressor is able to use, bigger values improve compression.

        Default value is 4MB.

    $MRMethod
        method of model restoration at memory insufficiency, possible values are:

        "MRM_RESTART=1"
            restart model from scratch (fast).

        "MRM_CUTOFF=2"
            cut off model (default, slow).

        "MRM_FREEZE=3"
            freeze model (faster but dangerous).

        Default value is "MRM_CUTOFF".

    $Solid
        when true, chunks are compressed with data from previous chunks and so they are dependant and have to be decompressed in the same sequence.

        Default value is true.

"$encoder->encode($data)"
    compresses a chunk of data.

"$encoder->reset()"
    in "solid" mode "reset" causes the encoder to clean its memory.

"$encoder->deflate($data)"
    wrapper around "encode" method for Compress::Zlib interface compatibility.

"$encoder->flush($mode)"
    do nothing method for Compress::Zlib interface compatibility.

  Compress::PPMd::Decoder

"Compress::PPMd::Decoder->new($MaxOrder, $MemSizeMB, $MRMethod, $Solid)"
    the decoder has to be initialized with the same parameters that were used to create the encoder or the decompressed data will be corrupted.

"$decoder->decode($encoded_data)"
    decodes a chunk of data generated by the encoder. Partial decodes are not possible, only full chunks *exactly* as generated by the encoder are accepted.

"$decoder->reset()"
    has the same function that the equivalent encoder method and has to be used symmetrically, that is, for every time "$encoder->reset" is called "$decoder->reset" also has to be called.

"$encoder->inflate($data)"
    wrapper around "decode" method for Compress::Zlib interface compatibility.

  EXPORT
MRMethod constants when used with ":mrm":

"MRM_RESTART=1"
"MRM_CUTOFF=2"
"MRM_FREEZE=3"

BUGS
This is a very early release, expect bugs.

Only tested on Linux and NetBSD, support for Win32 planned.

PPMd library doesn't work on 64bits architectures.

I will probably change the interface later.

PPMd library doen't checks for data validity when decompressing, this can cause crashes and introduce security holes in your code, so ...

DON'T USE THIS LIBRARY ON NETWORK APPLICATIONS

... unless you can trust both client and server programs.

Bug reports, patches and any feedback are appreciated.

SEE ALSO
Compress::ZLib.

Original PPMd I1 code at <ftp://ftp.elf.stuba.sk/pub/pc/pack/ppmdi1.rar>.

If you can read Russian, Dmitry Shkarin web pages at <http://compression.graphicon.ru/ds/> may be of interest to you.

For general information about data compression visit <http://DataCompression.info/>.

AUTHOR
Salvador Fandiño <sfandino@yahoo.com>

COPYRIGHT AND LICENSE
Copyright 2003 by Salvador Fandiño

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Based on code released to the public domain by Dmitry Shkarin.

POD ERRORS
Hey! The above document had some coding errors, which are explained below:

Around line 228:
    Non-ASCII character seen before =encoding in 'Fandiño'. Assuming CP1252