summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2000-04-13 01:33:35 +0000
committerMonty <xiphmont@xiph.org>2000-04-13 01:33:35 +0000
commit652270ac9a91f0677af433968e231305a1b4e346 (patch)
treeff1beedb477cef4a9370cad4605881cff98acc6d
parentb30b7f218d137dffd0dd1e30377c8b282e8e72a5 (diff)
downloadlibvorbis-git-652270ac9a91f0677af433968e231305a1b4e346.tar.gz
Cute, useful 'approx how many cells for lossless book?' tool.
svn path=/branches/new_acoustics_pending_merge_20000328/vorbis/; revision=321
-rwxr-xr-xvq/residue_entropy51
1 files changed, 51 insertions, 0 deletions
diff --git a/vq/residue_entropy b/vq/residue_entropy
new file mode 100755
index 00000000..7aa44bc5
--- /dev/null
+++ b/vq/residue_entropy
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+use POSIX;
+my($groupn,$quant,$sink)=@ARGV;
+my%hash;
+my$count=0;
+my$lines=0;
+
+if(!defined($quant)){
+ print "Usage: residue_entropy <groupsize> <quant>\n";
+ exit(1);
+}
+$|=1;
+
+while (<STDIN>) {
+ chop;
+ my@nums = ();
+ @nums = split(/,/);
+ $lines++;
+
+ my$step=$#nums/$groupn;
+ for(my$i=0;$i<$step;$i++){
+ my$key="";
+ for(my$j=$i;$j<$#nums;$j+=$step){
+
+ $num=$nums[$j];
+ if($num!=0){
+ if($num<0){
+ $num= -POSIX::floor(log(-$num)*8.6858896/$quant+.5)-1;
+ }else{
+ $num= POSIX::floor(log($num)*8.6858896/$quant+.5)+1;
+ }
+ }else{
+ $num=0;
+ }
+ $key.=":$num";
+ }
+
+ if(!defined($hash{$key})){
+ $count++;
+ $hash{$key}=1;
+ }
+ }
+
+ if(($lines % 1000)==0){
+ print "\rworking... $lines lines, found $count values so far";
+ }
+}
+
+print "\r$count values total \n";
+print "Done.\n\n";