Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / libvorbis / vq / residue_entropy
blob49c55a535c405cda06bf59e2743db11e8b43bbe1
1 #!/usr/bin/perl
3 @quant=(
4 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
5 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,
6 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11,
7 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
8 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
9 );
12 use POSIX;
13 my($groupn)=@ARGV;
14 my%hash;
15 my$count=0;
16 my$lines=0;
18 if(!defined($groupn)){
19 print "Usage: residue_entropy <groupsize> \n";
20 exit(1);
22 $|=1;
24 while (<STDIN>) {
25 chop;
26 my@nums = ();
27 @nums = split(/,/);
28 $lines++;
30 my$step=$#nums/$groupn;
31 for(my$i=0;$i<$step;$i++){
32 my$key="";
33 for(my$j=$i;$j<$#nums;$j+=$step){
34 if($nums[$j]<0){
35 $num=-$quant[int(-$nums[$j]*2)];
36 }else{
37 $num=$quant[int($nums[$j]*2)];
39 $key.=":$num";
42 if(!defined($hash{$key})){
43 $count++;
44 $hash{$key}=1;
48 if(($lines % 1000)==0){
49 print "\rworking... $lines lines, found $count values so far";
53 foreach $key (keys %hash){
54 print "\t$key\n";
57 print "\r$count values total \n";
58 print "Done.\n\n";