Algorithm-FEC

 view release on metacpan or  search on metacpan

FEC.pm  view on Meta::CPAN

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
in the indices array corresponds to the n-th data block of the decoded
result. The value stored in the n-th place in the array will contain the
index of the encoded data block.

Input blocks with indices less than C<data_blocks> will be moved to their
final position (block k to position k), while the gaps between them will
be filled with check blocks. The decoding process will not modify the
already decoded data blocks, but will modify the check blocks.

That is, if you call this function with C<indices = [4,3,1]>, with
C<data_blocks = 3>, then this array will be returned: C<[0,2,1]>. This
means that input block C<0> corresponds to file block C<0>, input block
C<1> to file block C<2> and input block C<2> to data block C<1>.

You can just iterate over this array and write out the corresponding data
block (although this is inefficient):

   for my $i (0 .. $#idx)

README  view on Meta::CPAN

        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
        entry in the indices array corresponds to the n-th data block of the
        decoded result. The value stored in the n-th place in the array will
        contain the index of the encoded data block.

        Input blocks with indices less than "data_blocks" will be moved to
        their final position (block k to position k), while the gaps between
        them will be filled with check blocks. The decoding process will not
        modify the already decoded data blocks, but will modify the check
        blocks.

        That is, if you call this function with "indices = [4,3,1]", with
        "data_blocks = 3", then this array will be returned: "[0,2,1]". This
        means that input block 0 corresponds to file block 0, input block 1
        to file block 2 and input block 2 to data block 1.

        You can just iterate over this array and write out the corresponding
        data block (although this is inefficient):



( run in 0.246 second using v1.01-cache-2.11-cpan-26ccb49234f )