… | |
… | |
34 | |
34 | |
35 | require XSLoader; |
35 | require XSLoader; |
36 | |
36 | |
37 | no warnings; |
37 | no warnings; |
38 | |
38 | |
39 | $VERSION = 0.5; |
39 | $VERSION = '1.1'; |
40 | |
40 | |
41 | XSLoader::load Algorithm::FEC, $VERSION; |
41 | XSLoader::load Algorithm::FEC, $VERSION; |
42 | |
42 | |
43 | =item $fec = new Algorithm::FEC $data_blocks, $encoded_blocks, $blocksize |
43 | =item $fec = new Algorithm::FEC $data_blocks, $encoded_blocks, $blocksize |
44 | |
44 | |
… | |
… | |
89 | =item $fec->set_decode_blocks ([array_of_blocks], [array_of_indices]) |
89 | =item $fec->set_decode_blocks ([array_of_blocks], [array_of_indices]) |
90 | |
90 | |
91 | Prepares to decode C<data_blocks> of blocks (see C<set_encode_blocks> for |
91 | Prepares to decode C<data_blocks> of blocks (see C<set_encode_blocks> for |
92 | the C<array_of_blocks> parameter). |
92 | the C<array_of_blocks> parameter). |
93 | |
93 | |
94 | Since these are not necessarily the original data blocks, an array of |
94 | Since these are not usually the original data blocks, an array of |
95 | indices (ranging from C<0> to C<encoded_blocks-1>) must be supplied as |
95 | indices (ranging from C<0> to C<encoded_blocks-1>) must be supplied as |
96 | the second arrayref. |
96 | the second arrayref. |
97 | |
97 | |
98 | Both arrays must have exactly C<data_blocks> entries. |
98 | Both arrays must have exactly C<data_blocks> entries. |
99 | |
99 | |
100 | This method also reorders the blocks and index array in place (if |
100 | This method also reorders the blocks and index array in place (if |
101 | necessary) to reflect the order the blocks will have in the decoded |
101 | necessary) to reflect the order the blocks will have in the decoded |
102 | result. |
102 | result. |
103 | |
|
|
104 | Both arrays must have exactly C<data_blocks> entries. |
|
|
105 | |
103 | |
106 | The index array represents the decoded ordering, in that the n-th entry |
104 | The index array represents the decoded ordering, in that the n-th entry |
107 | in the indices array corresponds to the n-th data block of the decoded |
105 | in the indices array corresponds to the n-th data block of the decoded |
108 | result. The value stored in the n-th place in the array will contain the |
106 | result. The value stored in the n-th place in the array will contain the |
109 | index of the encoded data block. |
107 | index of the encoded data block. |
… | |
… | |
135 | |
133 | |
136 | The same same as C<set_decode_blocks>, with the exception that the blocks |
134 | The same same as C<set_decode_blocks>, with the exception that the blocks |
137 | are not actually set for decoding. |
135 | are not actually set for decoding. |
138 | |
136 | |
139 | This method is not normally used, but if you want to move blocks |
137 | This method is not normally used, but if you want to move blocks |
140 | around after reodering and before decoding, then calling Cshuffle> |
138 | around after reordering and before decoding, then calling C<shuffle> |
141 | followed by C<set_decode_blocks> incurs lower overhead than calling |
139 | followed by C<set_decode_blocks> incurs lower overhead than calling |
142 | C<set_decode_blocks> twice, as files are not mmapped etc. |
140 | C<set_decode_blocks> twice, as files are not mmapped etc. |
143 | |
141 | |
144 | =item $fec->decode |
142 | =item $fec->decode |
145 | |
143 | |
… | |
… | |
157 | |
155 | |
158 | =head1 COMPATIBILITY |
156 | =head1 COMPATIBILITY |
159 | |
157 | |
160 | The way this module works is compatible with the way freenet |
158 | The way this module works is compatible with the way freenet |
161 | (L<http://freenet.sf.net>) encodes files. Comaptibility to other file |
159 | (L<http://freenet.sf.net>) encodes files. Comaptibility to other file |
162 | formats or networks is not know, please tell me if you find more examples. |
160 | formats or networks is not known, please tell me if you find more examples. |
163 | |
161 | |
164 | =head1 SEE ALSO |
162 | =head1 SEE ALSO |
165 | |
163 | |
166 | L<Net::FCP>. And the author, who might be happy to receive mail from any |
164 | L<Net::FCP>. And the author, who might be happy to receive mail from any |
167 | user, just to see that this rather rarely-used module is actually being |
165 | user, just to see that this rather rarely-used module is actually being |
… | |
… | |
175 | * utility functions for files should be provided. |
173 | * utility functions for files should be provided. |
176 | * 16 bit version not tested |
174 | * 16 bit version not tested |
177 | |
175 | |
178 | =head1 AUTHOR |
176 | =head1 AUTHOR |
179 | |
177 | |
180 | Marc Lehmann <pcg@goof.com> |
178 | Marc Lehmann <schmorp@schmorp.de> |
181 | http://home.schmorp.de |
179 | http://home.schmorp.de |
182 | |
180 | |
183 | =cut |
181 | =cut |
184 | |
182 | |
185 | 1; |
183 | 1; |