Elias gamma/delta code
Perl
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
inc/Module
lib/Integer
t
Changes
MANIFEST
Makefile.PL
README

README

NAME
    Integer::Elias - Elias coder

SYNOPSIS
      use Integer::Elias::Encoder;
      use Integer::Elias::Decoder;

      ## Gamma code
      my $encoder = Integer::Elias::Encoder->new;
      $encoder->gamma_encode(0); ## this module can encode 0
      $encoder->gamma_encode(5);
      $encoder->gamma_encode(10);
      $encoder->finish;

      say $encoder->as_string;

      my $decoder = Integer::Elias::Decoder->new( $encoder->binary );
      $decoder->gamma_decode; # 0
      $decoder->gamma_decode; # 5
      $decoder->gamma_decode; # 10

      ## Delta code
      $encoder = Integer::Elias::Encoder->new;
      $encoder->delta_encode(10);
      ...
      $encoder->finish;

      say $encoder->as_string;

      $decoder = Integer::Elias::Decoder->new( $encoder->binary );
      $decoder->delta_decode;
      ...

DESCRIPTION
    Elias gamma/delta code is a universal code encoding positive integers.

SEE ALSO
    <http://en.wikipedia.org/wiki/Universal_code_(data_compression)>
    <http://www.geocities.jp/m_hiroi/light/pyalgo30.html>

AUTHOR
    Naoya Ito, <naoya at bloghackers.net>

COPYRIGHT AND LICENSE
    Copyright (C) 2008 by Naoya Ito

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself, either Perl version 5.8.8 or, at
    your option, any later version of Perl 5 you may have available.