Compress-PPMd
view release on metacpan or search on metacpan
use 5.006;
use strict;
use warnings;
our $VERSION = '0.11';
require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = ( 'mrm' => [ qw(MRM_RESTART
MRM_CUTOFF
MRM_FREEZE) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'mrm'} } );
our @EXPORT = qw();
use constant MRM_RESTART => 1;
use constant MRM_CUTOFF => 2;
use constant MRM_FREEZE => 3;
require XSLoader;
XSLoader::load('Compress::PPMd', $VERSION);
sub Compress::PPMd::Encoder::deflate {
if (wantarray) {
return ($_[0]->encode($_[1]), 0)
}
$_[0]->encode($_[1])
}
sub Compress::PPMd::Decoder::inflate {
if (wantarray) {
return ($_[0]->decode($_[1]), 0)
}
$_[0]->decode($_[1])
}
sub Compress::PPMd::Encoder::flush {
wantarray ? ("", 0) : ""
}
1;
__END__
=head1 NAME
Compress::PPMd - PPMd compression
=head1 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);
=head1 ABSTRACT
This package is a Perl wrapper around Dmitry Shkarin PPMd compression
library.
PPMd produces the best compression ratios for textual data.
=head1 DESCRIPTION
L<Compress::PPMd> is compossed of two classes to compress and
decompress data respectively:
=head2 Compress::PPMd::Encoder
=over 4
=item C<Compress::PPMd::Encoder-E<gt>new($MaxOrder, $MemSizeMB, $MRMethod, $Solid)>
creates a new encoder object. The parameters are:
=over 4
=item C<$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.
=item C<$MemSizeMB>
max memory in MB the compressor is able to use, bigger values improve
compression.
Default value is 4MB.
=item C<$MRMethod>
method of model restoration at memory insufficiency, possible values are:
=over 4
=item C<MRM_RESTART=1>
restart model from scratch (fast).
=item C<MRM_CUTOFF=2>
cut off model (default, slow).
=item C<MRM_FREEZE=3>
freeze model (faster but dangerous).
=back
Default value is C<MRM_CUTOFF>.
( run in 1.792 second using v1.01-cache-2.11-cpan-d06a3f9ecfd )