Arithmetic coding/As a generalized change of radix: Difference between revisions
Arithmetic coding/As a generalized change of radix (view source)
Revision as of 23:52, 30 January 2016
, 8 years ago→{{header|Perl}}: Optimized the decoding process
m (→{{header|Perl}}: minor code simplification) |
m (→{{header|Perl}}: Optimized the decoding process) |
||
Line 256:
# frequencies of all previously occurring symbols
foreach my $c (@chars) {
$L->bmuladd($base, $cf{$c} * $pf);
$pf->bmul($freq{$c});
}
Line 301:
# Decode the input number
my $decoded = '';
for (my $
▲ my $div = ($enc / $pow);
my $c = $dict{$div};
Line 310 ⟶ 308:
my $cv = $cf{$c};
$decoded .= $c;
}
|