X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=vq%2Fmake_residue_books.pl;h=b37d0dcd20f5ca6a8fbe5f4ca3dd85fdfd1366ab;hb=2d7d933302d8fe78c451f42a2ae2e6f0c2de346e;hp=5411f5a2c931b9f29b83234dcf089297baab00a8;hpb=b836dfde4262a1e71774b67df40947b3fc3557ae;p=platform%2Fupstream%2Flibvorbis.git diff --git a/vq/make_residue_books.pl b/vq/make_residue_books.pl index 5411f5a..b37d0dc 100755 --- a/vq/make_residue_books.pl +++ b/vq/make_residue_books.pl @@ -7,7 +7,7 @@ #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 # :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 @@ -44,15 +44,34 @@ while($line=){ 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); + # 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="huffbuild $bookname.tmp $interval"; + print ">>> $command\n"; + die "Couldn't build huffbook.\n\tcommand:$command\n" + if syst($command); + + my $command="rm $bookname.tmp"; + print ">>> $command\n"; + die "Couldn't remove temporary file.\n\tcommand:$command\n" + if syst($command); + }else{ + my $command="huffbuild $bookname.tmp 0-$range"; + print ">>> $command\n"; + die "Couldn't build huffbook.\n\tcommand:$command\n" + if syst($command); + + } next; } @@ -95,8 +114,8 @@ while($line=){ $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"; @@ -105,16 +124,11 @@ while($line=){ } 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/){ @@ -124,32 +138,27 @@ while($line=){ } if($seqp=~/cull/){ - my $command="$restune temp$$.vqh $datafile 1 > $globalname$name.vqh"; + 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 temp$$.vqh $datafile > $globalname$name.vqh"; + my $command="$restune $globalname$name.vqh $datafile > temp$$.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"; + my $command="mv temp$$.vqh $globalname$name.vqh"; print ">>> $command\n"; - die "Couldn't post-hint latticebook.\n\tcommand:$command\n" + die "Couldn't rename latticebook.\n\tcommand:$command\n" if syst($command); }else{ print "No matching training file; leaving this codebook untrained.\n"; } - my $command="mv temp$$.vqh $globalname$name.vqh"; - print ">>> $command\n"; - die "Couldn't rename 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);