Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Elias gamma/delta code

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

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.

Something went wrong with that request. Please try again.