Algorithm-FEC

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

          to get this right :)

0.03  Sat Sep 13 16:18:57 CEST 2003
	- fix index ordering that decode returns.

0.02  Wed Sep 10 01:11:03 CEST 2003
	- removed funny "magic" that uses undefined u_long,
          spotted by Autrijus Tang.

0.01  Mon Sep  8 22:11:12 CEST 2003
	- original version; cloned from Digest::Hashcash

FEC.pm  view on Meta::CPAN

=head1 DESCRIPTION

This module is an interface to the fec library by Luigi Rizzo et al., see
the file README.fec in the distribution for more details.

This library implements a simple (C<encoded_blocks>,C<data_blocks>)
erasure code based on Vandermonde matrices.  The encoder takes
C<data_blocks> blocks of size C<block_size> each, and is able to produce
up to C<encoded_blocks> different encoded blocks, numbered from C<0>
to C<encoded_blocks-1>, such that any subset of C<data_blocks> members
permits reconstruction of the original data.

Allowed values for C<data_blocks> and C<encoded_blocks> must obey the
following equation:

   data_blocks <= encoded_blocks <= MAXBLOCKS

Where C<MAXBLOCKS=256> for the fast implementation and C<MAXBLOCKS=65536>
for the slow implementation (the implementation is chosen automatically).

=over 4

FEC.pm  view on Meta::CPAN

your scalar (this might enable nice tricks, like C<$fec->copy (..., my
$x)> :). Mail me if you want this to happen.

If called without arguments, the internal storage associated with the
blocks is freed again.

=item $block = $fec->encode ($block_index)

Creates a single encoded block of index C<block_index>, which must be
between C<0> and C<encoded_blocks-1> (inclusive). The blocks from C<0> to
C<data_blocks-1> are simply copies of the original data blocks.

The encoded block is returned as a perl scalar (so the blocks should fit
into memory. If this is a problem for you mail me and I'll make it a file.

=item $fec->set_decode_blocks ([array_of_blocks], [array_of_indices])

Prepares to decode C<data_blocks> of blocks (see C<set_encode_blocks> for
the C<array_of_blocks> parameter).

Since these are not usually the original data blocks, an array of
indices (ranging from C<0> to C<encoded_blocks-1>) must be supplied as
the second arrayref.

Both arrays must have exactly C<data_blocks> entries.

This method also reorders the blocks and index array in place (if
necessary) to reflect the order the blocks will have in the decoded
result.

The index array represents the decoded ordering, in that the n-th entry

README  view on Meta::CPAN


DESCRIPTION
    This module is an interface to the fec library by Luigi Rizzo et al.,
    see the file README.fec in the distribution for more details.

    This library implements a simple ("encoded_blocks","data_blocks")
    erasure code based on Vandermonde matrices. The encoder takes
    "data_blocks" blocks of size "block_size" each, and is able to produce
    up to "encoded_blocks" different encoded blocks, numbered from 0 to
    "encoded_blocks-1", such that any subset of "data_blocks" members
    permits reconstruction of the original data.

    Allowed values for "data_blocks" and "encoded_blocks" must obey the
    following equation:

       data_blocks <= encoded_blocks <= MAXBLOCKS

    Where "MAXBLOCKS=256" for the fast implementation and "MAXBLOCKS=65536"
    for the slow implementation (the implementation is chosen
    automatically).

README  view on Meta::CPAN

        Future versions might instead load the short segment into memory or
        extend your scalar (this might enable nice tricks, like "$fec-"copy
        (..., my $x)> :). Mail me if you want this to happen.

        If called without arguments, the internal storage associated with
        the blocks is freed again.

    $block = $fec->encode ($block_index)
        Creates a single encoded block of index "block_index", which must be
        between 0 and "encoded_blocks-1" (inclusive). The blocks from 0 to
        "data_blocks-1" are simply copies of the original data blocks.

        The encoded block is returned as a perl scalar (so the blocks should
        fit into memory. If this is a problem for you mail me and I'll make
        it a file.

    $fec->set_decode_blocks ([array_of_blocks], [array_of_indices])
        Prepares to decode "data_blocks" of blocks (see "set_encode_blocks"
        for the "array_of_blocks" parameter).

        Since these are not usually the original data blocks, an array of
        indices (ranging from 0 to "encoded_blocks-1") must be supplied as
        the second arrayref.

        Both arrays must have exactly "data_blocks" entries.

        This method also reorders the blocks and index array in place (if
        necessary) to reflect the order the blocks will have in the decoded
        result.

        The index array represents the decoded ordering, in that the n-th

fec.3  view on Meta::CPAN

erasure code based on Vandermonde matrices.
The encoder takes 
.Fa k
packets of size
.Fa sz
each, and is able to produce up to
.Fa n
different encoded packets, numbered from 0 to n-1,
such that any subset of
.Fa k
of them permits reconstruction of the original data.
.Pp
The data structures necessary for the encoding/decoding must
first be created using calling
.Fn fec_new
with the desired parameters. The code descriptor returned by the function
must be passed to other functions, and destroyed calling
.Fn fec_free
.Pp
Allowed values for k and n depend on a compile-time value
of



( run in 0.246 second using v1.01-cache-2.11-cpan-069f9db706d )