#eg:
# >res0_128_128 interleaved
-# haux res0_96_128aux.vqd 0,4,2
+# haux 44c0_s/resaux_0.vqd res0_96_128aux 0,4,2 9
# :1 res0_128_128_1.vqd, 4, nonseq cull, 0 +- 1
-# +1a, 4, nonseq, 0 +- .25 .5
# :2 res0_128_128_2.vqd, 4, nonseq, 0 +- 1(.7) 2
# :3 res0_128_128_3.vqd, 4, nonseq, 0 +- 1(.7) 3 5
# :4 res0_128_128_4.vqd, 2, nonseq, 0 +- 1(.7) 3 5 8 11
next;
}
- # haux res0_96_128aux.vqd 0,4,2
+ # haux 44c0_s/resaux_0.vqd res0_96_128aux 0,4,2 9
if($line=~m/^h(.*)/){
# build a huffman book (no mapping)
- my($name,$datafile,$arg)=split(' ',$1);
+ my($name,$datafile,$bookname,$interval,$range)=split(' ',$1);
- my $command="huffbuild $datafile $arg";
- print ">>> $command\n";
- die "Couldn't build huffbook.\n\tcommand:$command\n"
- if syst($command);
- next;
- }
-
- # :1 res0_128_128_1.vqd, 4, nonseq, 0 +- 1
- if($line=~m/^:(.*)/){
- my($namedata,$dim,$seqp,$vals)=split(',',$1);
- my($name,$datafile)=split(' ',$namedata);
- # build value list
- my$plusminus="+";
- my$list;
- my$thlist;
- my$count=0;
- foreach my$val (split(' ',$vals)){
- if($val=~/\-?\+?\d+/){
- my$th;
-
- # got an explicit threshhint?
- if($val=~/([0-9\.]+)\(([^\)]+)/){
- $val=$1;
- $th=$2;
- }
-
- if($plusminus=~/-/){
- $list.="-$val ";
- if(defined($th)){
- $thlist.="," if(defined($thlist));
- $thlist.="-$th";
- }
- $count++;
- }
- if($plusminus=~/\+/){
- $list.="$val ";
- if(defined($th)){
- $thlist.="," if(defined($thlist));
- $thlist.="$th";
- }
- $count++;
- }
- }else{
- $plusminus=$val;
- }
- }
- die "Couldn't open temp file temp$$.vql: $!" unless
- open(G,">temp$$.vql");
- print G "$count $dim 0 ";
- if($seqp=~/non/){
- print G "0\n$list\n";
- }else{
- print G "1\n$list\n";
- }
- close(G);
-
- my $command="latticebuild temp$$.vql > $globalname$name.vqh";
- print ">>> $command\n";
- die "Couldn't build latticebook.\n\tcommand:$command\n"
- if syst($command);
+ # check the desired subdir to see if the data file exists
+ if(-e $datafile){
+ my $command="cp $datafile $bookname.tmp";
+ print ">>> $command\n";
+ die "Couldn't access partition data file.\n\tcommand:$command\n"
+ if syst($command);
- my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
- print ">>> $command\n";
- die "Couldn't pre-hint latticebook.\n\tcommand:$command\n"
- if syst($command);
-
- if($interleave=~/non/){
- $restune="res1tune";
- }else{
- $restune="res0tune";
- }
+ my $command="huffbuild $bookname.tmp $interval";
+ print ">>> $command\n";
+ die "Couldn't build huffbook.\n\tcommand:$command\n"
+ if syst($command);
- if($seqp=~/cull/){
- my $command="$restune temp$$.vqh $datafile 1 > $globalname$name.vqh";
+ my $command="rm $bookname.tmp";
print ">>> $command\n";
- die "Couldn't tune latticebook.\n\tcommand:$command\n"
+ die "Couldn't remove temporary file.\n\tcommand:$command\n"
if syst($command);
}else{
- my $command="$restune temp$$.vqh $datafile > $globalname$name.vqh";
+ my $command="huffbuild $bookname.tmp 0-$range";
print ">>> $command\n";
- die "Couldn't tune latticebook.\n\tcommand:$command\n"
+ die "Couldn't build huffbook.\n\tcommand:$command\n"
if syst($command);
- }
-
- my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
- print ">>> $command\n";
- die "Couldn't post-hint latticebook.\n\tcommand:$command\n"
- if syst($command);
-
- my $command="mv temp$$.vqh $globalname$name.vqh";
- print ">>> $command\n";
- die "Couldn't rename latticebook.\n\tcommand:$command\n"
- if syst($command);
- # run the training data through book to cascade
- if($interleave=~/non/){
- $vqcascade="vqcascade";
- }else{
- $vqcascade="vqcascade -i";
}
-
- my $command="$vqcascade +$globalname$name.vqh $datafile > temp$$.vqd";
- print ">>> $command\n";
- die "Couldn't cascade latticebook.\n\tcommand:$command\n"
- if syst($command);
-
-
- my $command="rm temp$$.vql";
- print ">>> $command\n";
- die "Couldn't remove temp files.\n\tcommand:$command\n"
- if syst($command);
-
next;
}
- # +a 4, nonseq, 0 +- 1
- if($line=~m/^\+(.*)/){
- my($name,$dim,$seqp,$vals)=split(',',$1);
+ # :1 res0_128_128_1.vqd, 4, nonseq, 0 +- 1
+ if($line=~m/^:(.*)/){
+ my($namedata,$dim,$seqp,$vals)=split(',',$1);
+ my($name,$datafile)=split(' ',$namedata);
# build value list
my$plusminus="+";
my$list;
$plusminus=$val;
}
}
- die "Couldn't open temp file temp$$.vql: $!" unless
- open(G,">temp$$.vql");
+ die "Couldn't open temp file $globalname$name.vql: $!" unless
+ open(G,">$globalname$name.vql");
print G "$count $dim 0 ";
if($seqp=~/non/){
print G "0\n$list\n";
}
close(G);
- my $command="latticebuild temp$$.vql > $globalname$name.vqh";
+ my $command="latticebuild $globalname$name.vql > $globalname$name.vqh";
print ">>> $command\n";
die "Couldn't build latticebook.\n\tcommand:$command\n"
if syst($command);
- my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
- print ">>> $command\n";
- die "Couldn't pre-hint latticebook.\n\tcommand:$command\n"
- if syst($command);
+ if(-e $datafile){
- if($interleave=~/non/){
- $restune="res1tune";
- }else{
- $restune="res0tune";
- }
+ if($interleave=~/non/){
+ $restune="res1tune";
+ }else{
+ $restune="res0tune";
+ }
+
+ if($seqp=~/cull/){
+ my $command="$restune $globalname$name.vqh $datafile 1 > temp$$.vqh";
+ print ">>> $command\n";
+ die "Couldn't tune latticebook.\n\tcommand:$command\n"
+ if syst($command);
+ }else{
+ my $command="$restune $globalname$name.vqh $datafile > temp$$.vqh";
+ print ">>> $command\n";
+ die "Couldn't tune latticebook.\n\tcommand:$command\n"
+ if syst($command);
+ }
- if($seqp=~/cull/){
- my $command="$restune temp$$.vqh temp$$.vqd 1 > $globalname$name.vqh";
+ my $command="mv temp$$.vqh $globalname$name.vqh";
print ">>> $command\n";
- die "Couldn't tune latticebook.\n\tcommand:$command\n"
+ die "Couldn't rename latticebook.\n\tcommand:$command\n"
if syst($command);
- }else{
- my $command="$restune temp$$.vqh temp$$.vqd > $globalname$name.vqh";
- print ">>> $command\n";
- die "Couldn't tune latticebook.\n\tcommand:$command\n"
- if syst($command);
- }
- my $command="latticehint $globalname$name.vqh $thlist > temp$$.vqh";
- print ">>> $command\n";
- die "Couldn't post-hint latticebook.\n\tcommand:$command\n"
- if syst($command);
-
- my $command="mv temp$$.vqh $globalname$name.vqh";
- print ">>> $command\n";
- die "Couldn't rename latticebook.\n\tcommand:$command\n"
- if syst($command);
-
- # run the training data through book to cascade
- if($interleave=~/non/){
- $vqcascade="vqcascade";
}else{
- $vqcascade="vqcascade -i";
+ print "No matching training file; leaving this codebook untrained.\n";
}
- my $command="$vqcascade +$globalname$name.vqh temp$$.vqd > tempa$$.vqd";
- print ">>> $command\n";
- die "Couldn't cascade latticebook.\n\tcommand:$command\n"
- if syst($command);
-
-
- my $command="rm temp$$.vql";
+ my $command="rm $globalname$name.vql";
print ">>> $command\n";
die "Couldn't remove temp files.\n\tcommand:$command\n"
if syst($command);
- my $command="mv tempa$$.vqd temp$$.vqd";
- print ">>> $command\n";
- die "Couldn't rename temp file.\n\tcommand:$command\n"
- if syst($command);
-
next;
}
}
-$command="rm temp$$.vqd";
+$command="rm -f temp$$.vqd";
print ">>> $command\n";
die "Couldn't remove temp files.\n\tcommand:$command\n"
if syst($command);