Changeset 7178
- Timestamp:
- 02/27/08 04:57:51 (5 years ago)
- Files:
-
- 1 modified
-
lang/cplusplus/range_coder/build_table.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/range_coder/build_table.pl
r7161 r7178 32 32 33 33 my @freq; 34 my $acc = 0;35 34 my $cc = sum @cnt; 36 my ($mult, $mult_diff) = (0x8000, 0);35 my $mult = 0x8000; 37 36 while (1) { 38 $acc = 0; 37 print STDERR "$mult\n"; 38 my $acc = 0; 39 39 for (my $i = 0; $i < 256; $i++) { 40 40 push @freq, $acc; 41 41 $acc += $cnt[$i] != 0 ? max(int($cnt[$i] / $cc * $mult + 0.5), 1) : 0; 42 42 } 43 last if $acc == 0x8000;43 last if $acc <= 0x8000; 44 44 @freq = (); 45 $mult_diff = $mult_diff != 0 ? $mult_diff / 2 : abs($acc - 0x8000); 46 if ($acc < 0x8000) { 47 $mult += $mult_diff; 48 } else { 49 $mult -= $mult_diff; 50 } 45 $mult--; 51 46 } 47 push @freq, 0x8000; 52 48 53 49 print "#define MAX_FREQ 0x8000\n";
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)