[xiph-commits] r13703 - in trunk/ghost: . scripts

jm at svn.xiph.org jm at svn.xiph.org
Sun Sep 2 16:48:51 PDT 2007


Author: jm
Date: 2007-09-02 16:48:51 -0700 (Sun, 02 Sep 2007)
New Revision: 13703

Added:
   trunk/ghost/scripts/
   trunk/ghost/scripts/dump_vectors.sh
   trunk/ghost/scripts/mkquant.sh
   trunk/ghost/scripts/test_msvq.n
   trunk/ghost/scripts/training.n
Log:
A few scripts for training of the quantizer


Added: trunk/ghost/scripts/dump_vectors.sh
===================================================================
--- trunk/ghost/scripts/dump_vectors.sh	                        (rev 0)
+++ trunk/ghost/scripts/dump_vectors.sh	2007-09-02 23:48:51 UTC (rev 13703)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo '<Vector<ObjectRef> ' > nbands.vec; cat $* | ../libghost/testghost /dev/stdin /dev/null | sed -e 's/^/<Vector<float> /' -e 's/$/>/' >> nbands.vec; echo ' > ' >> nbands.vec


Property changes on: trunk/ghost/scripts/dump_vectors.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/ghost/scripts/mkquant.sh
===================================================================
--- trunk/ghost/scripts/mkquant.sh	                        (rev 0)
+++ trunk/ghost/scripts/mkquant.sh	2007-09-02 23:48:51 UTC (rev 13703)
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+E1=`sed 's/>/\n/g' band1.vq | grep -c Vector`
+E2=`sed 's/>/\n/g' band2.vq | grep -c Vector`
+E3a=`sed 's/>/\n/g' band3a.vq | grep -c Vector`
+E3b=`sed 's/>/\n/g' band3b.vq | grep -c Vector`
+E3c=`sed 's/>/\n/g' band3c.vq | grep -c Vector`
+L3a=`grep length band3a.vq | awk '{print $2}' | sed 's/>//'`
+L3b=`grep length band3b.vq | awk '{print $2}' | sed 's/>//'`
+L3c=`grep length band3c.vq | awk '{print $2}' | sed 's/>//'`
+
+echo "#define ENTRIES1 $E1" > bands_quant.c
+echo "#define ENTRIES2 $E2" >> bands_quant.c
+echo "#define ENTRIES3A $E3a" >> bands_quant.c
+echo "#define ENTRIES3B $E3b" >> bands_quant.c
+echo "#define ENTRIES3C $E3c" >> bands_quant.c
+
+echo "#define LEN3A $L3a" >> bands_quant.c
+echo "#define LEN3B $L3b" >> bands_quant.c
+echo "#define LEN3C $L3c" >> bands_quant.c
+
+cat band1.vq| perl -ne 's/> *<Vector/,\n/g;s/>//g;s/<Vector//g;s/<length .*/};/g;s/<KMeans//;s/<means/float cdbk_band1\[\]=\{/;s/([0-9\-]) +([\-0-9\.])/$1, $2/g; print' >> bands_quant.c
+cat band2.vq| perl -ne 's/> *<Vector/,\n/g;s/>//g;s/<Vector//g;s/<length .*/};/g;s/<KMeans//;s/<means/float cdbk_band2\[\]=\{/;s/([0-9\-]) +([\-0-9\.])/$1, $2/g; print' >> bands_quant.c
+cat band3a.vq| perl -ne 's/> *<Vector/,\n/g;s/>//g;s/<Vector//g;s/<length .*/};/g;s/<KMeans//;s/<means/float cdbk_band3a\[\]=\{/;s/([0-9\-]) +([\-0-9\.])/$1, $2/g; print' >> bands_quant.c
+cat band3b.vq| perl -ne 's/> *<Vector/,\n/g;s/>//g;s/<Vector//g;s/<length .*/};/g;s/<KMeans//;s/<means/float cdbk_band3b\[\]=\{/;s/([0-9\-]) +([\-0-9\.])/$1, $2/g; print' >> bands_quant.c
+cat band3c.vq| perl -ne 's/> *<Vector/,\n/g;s/>//g;s/<Vector//g;s/<length .*/};/g;s/<KMeans//;s/<means/float cdbk_band3c\[\]=\{/;s/([0-9\-]) +([\-0-9\.])/$1, $2/g; print' >> bands_quant.c


Property changes on: trunk/ghost/scripts/mkquant.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/ghost/scripts/test_msvq.n
===================================================================
--- trunk/ghost/scripts/test_msvq.n	                        (rev 0)
+++ trunk/ghost/scripts/test_msvq.n	2007-09-02 23:48:51 UTC (rev 13703)
@@ -0,0 +1,108 @@
+#!/usr/bin/env batchflow
+<?xml version="1.0"?>
+<Document>
+  <Network type="subnet" name="MAIN">
+    <Node name="node_LoadFile_1" type="LoadFile" x="10.000000" y="-3.000000">
+      <Parameter name="FILENAME" type="subnet_param" value="ARG1" description=""/>
+    </Node>
+    <Node name="node_LOOP0_1" type="LOOP0" x="286.000000" y="118.000000">
+      <Parameter name="DOWHILE" type="int" value="" description=""/>
+    </Node>
+    <Node name="node_LoadFile_2" type="LoadFile" x="12.000000" y="62.000000">
+      <Parameter name="FILENAME" type="string" value="band1.vq" description=""/>
+    </Node>
+    <Node name="node_LoadFile_3" type="LoadFile" x="14.000000" y="93.000000">
+      <Parameter name="FILENAME" type="string" value="band2.vq" description=""/>
+    </Node>
+    <Node name="node_LoadFile_4" type="LoadFile" x="16.000000" y="126.000000">
+      <Parameter name="FILENAME" type="string" value="band3a.vq" description=""/>
+    </Node>
+    <Node name="node_LoadFile_5" type="LoadFile" x="18.000000" y="174.000000">
+      <Parameter name="FILENAME" type="string" value="band3b.vq" description=""/>
+    </Node>
+    <Node name="node_LoadFile_6" type="LoadFile" x="16.000000" y="221.000000">
+      <Parameter name="FILENAME" type="string" value="band3c.vq" description=""/>
+    </Node>
+    <Node name="node_Constant_1" type="Constant" x="-27.000000" y="284.000000">
+      <Parameter name="VALUE" type="subnet_param" value="ARG2" description="The value"/>
+    </Node>
+    <Node name="node_Discard_1" type="Discard" x="416.000000" y="119.000000"/>
+    <Node name="node_OutputStream_1" type="OutputStream" x="136.000000" y="287.000000">
+      <Parameter name="TYPE" type="string" value="" description="Type of stream: stream, fd, or FILE (default stream)"/>
+    </Node>
+    <Link from="node_LoadFile_2" output="OUTPUT" to="node_LOOP0_1" input="VQ"/>
+    <Link from="node_LoadFile_1" output="OUTPUT" to="node_LOOP0_1" input="INPUT"/>
+    <Link from="node_LoadFile_3" output="OUTPUT" to="node_LOOP0_1" input="VQ2"/>
+    <Link from="node_LoadFile_4" output="OUTPUT" to="node_LOOP0_1" input="VQ_3"/>
+    <Link from="node_LoadFile_5" output="OUTPUT" to="node_LOOP0_1" input="VQ_4"/>
+    <Link from="node_LoadFile_6" output="OUTPUT" to="node_LOOP0_1" input="VQ_5"/>
+    <Link from="node_LOOP0_1" output="OUTPUT" to="node_Discard_1" input="INPUT"/>
+    <Link from="node_OutputStream_1" output="OUTPUT" to="node_LOOP0_1" input="STREAM"/>
+    <Link from="node_Constant_1" output="VALUE" to="node_OutputStream_1" input="INPUT"/>
+    <NetOutput name="OUTPUT" node="node_Discard_1" terminal="OUTPUT" object_type="NilObject" description="Always return a NilObject"/>
+  </Network>
+  <Network type="iterator" name="LOOP0">
+    <Node name="node_UnPack_1" type="UnPack" x="-207.000000" y="89.000000"/>
+    <Node name="node_VQuantize_1" type="VQuantize" x="51.000000" y="102.000000"/>
+    <Node name="node_Sub_1" type="Sub" x="196.000000" y="65.000000"/>
+    <Node name="node_VQuantize_2" type="VQuantize" x="349.000000" y="112.000000"/>
+    <Node name="node_Sub_2" type="Sub" x="532.000000" y="70.000000"/>
+    <Node name="node_Select_1" type="Select" x="667.000000" y="-81.000000">
+      <Parameter name="START" type="int" value="9" description=""/>
+      <Parameter name="END" type="int" value="19" description=""/>
+    </Node>
+    <Node name="node_Select_2" type="Select" x="657.000000" y="85.000000">
+      <Parameter name="START" type="int" value="3" description=""/>
+      <Parameter name="END" type="int" value="8" description=""/>
+    </Node>
+    <Node name="node_Select_3" type="Select" x="658.000000" y="198.000000">
+      <Parameter name="START" type="int" value="0" description=""/>
+      <Parameter name="END" type="int" value="2" description=""/>
+    </Node>
+    <Node name="node_Sub_3" type="Sub" x="1003.000000" y="-75.000000"/>
+    <Node name="node_Sub_4" type="Sub" x="1026.000000" y="82.000000"/>
+    <Node name="node_Sub_5" type="Sub" x="1087.000000" y="203.000000"/>
+    <Node name="node_VQuantize_3" type="VQuantize" x="834.000000" y="275.000000"/>
+    <Node name="node_VQuantize_4" type="VQuantize" x="832.000000" y="11.000000"/>
+    <Node name="node_VQuantize_5" type="VQuantize" x="859.000000" y="132.000000"/>
+    <Node name="node_Concat_1" type="Concat" x="1328.000000" y="160.000000"/>
+    <Node name="node_Concat_2" type="Concat" x="1303.000000" y="-4.000000"/>
+    <Node name="node_Save_1" type="Save" x="1473.000000" y="-2.000000">
+      <Parameter name="PRETTY_PRINT" type="bool" value="true" description="If we want to print human readable output (and Matlab)"/>
+    </Node>
+    <Link from="node_UnPack_1" output="OUTPUT" to="node_VQuantize_1" input="INPUT"/>
+    <Link from="node_VQuantize_1" output="OUTPUT" to="node_Sub_1" input="INPUT2"/>
+    <Link from="node_UnPack_1" output="OUTPUT" to="node_Sub_1" input="INPUT1"/>
+    <Link from="node_VQuantize_2" output="OUTPUT" to="node_Sub_2" input="INPUT2"/>
+    <Link from="node_Sub_1" output="OUTPUT" to="node_VQuantize_2" input="INPUT"/>
+    <Link from="node_Sub_1" output="OUTPUT" to="node_Sub_2" input="INPUT1"/>
+    <Link from="node_Sub_2" output="OUTPUT" to="node_Select_1" input="INPUT"/>
+    <Link from="node_Sub_2" output="OUTPUT" to="node_Select_2" input="INPUT"/>
+    <Link from="node_Sub_2" output="OUTPUT" to="node_Select_3" input="INPUT"/>
+    <Link from="node_Select_1" output="OUTPUT" to="node_Sub_3" input="INPUT1"/>
+    <Link from="node_Select_1" output="OUTPUT" to="node_VQuantize_4" input="INPUT"/>
+    <Link from="node_Select_2" output="OUTPUT" to="node_Sub_4" input="INPUT1"/>
+    <Link from="node_Concat_1" output="OUTPUT" to="node_Concat_2" input="INPUT1"/>
+    <Link from="node_Select_3" output="OUTPUT" to="node_VQuantize_3" input="INPUT"/>
+    <Link from="node_VQuantize_3" output="OUTPUT" to="node_Sub_5" input="INPUT2"/>
+    <Link from="node_VQuantize_4" output="OUTPUT" to="node_Sub_3" input="INPUT2"/>
+    <Link from="node_VQuantize_5" output="OUTPUT" to="node_Sub_4" input="INPUT2"/>
+    <Link from="node_Select_3" output="OUTPUT" to="node_Sub_5" input="INPUT1"/>
+    <Link from="node_Select_2" output="OUTPUT" to="node_VQuantize_5" input="INPUT"/>
+    <Link from="node_Concat_2" output="OUTPUT" to="node_Save_1" input="OBJECT"/>
+    <Link from="node_Sub_5" output="OUTPUT" to="node_Concat_1" input="INPUT1"/>
+    <Link from="node_Sub_4" output="OUTPUT" to="node_Concat_1" input="INPUT2"/>
+    <Link from="node_Sub_3" output="OUTPUT" to="node_Concat_2" input="INPUT2"/>
+    <NetInput name="INPUT" node="node_UnPack_1" terminal="INPUT" object_type="any" description="No description available"/>
+    <NetCondition name="CONDITION" node="node_UnPack_1" terminal="NOT_END"/>
+    <NetInput name="VQ" node="node_VQuantize_1" terminal="VQ" object_type="any" description="No description available"/>
+    <NetInput name="VQ2" node="node_VQuantize_2" terminal="VQ" object_type="any" description="No description available"/>
+    <NetInput name="VQ_3" node="node_VQuantize_3" terminal="VQ" object_type="any" description="No description available"/>
+    <NetInput name="VQ_4" node="node_VQuantize_5" terminal="VQ" object_type="any" description="No description available"/>
+    <NetInput name="VQ_5" node="node_VQuantize_4" terminal="VQ" object_type="any" description="No description available"/>
+    <NetInput name="STREAM" node="node_Save_1" terminal="STREAM" object_type="Stream" description="The output stream where to save"/>
+    <NetOutput name="OUTPUT" node="node_Save_1" terminal="OUTPUT" object_type="any" description="The input object"/>
+  </Network>
+  <Parameter name="ARG1" type="" value=""/>
+  <Parameter name="ARG2" type="" value=""/>
+</Document>


Property changes on: trunk/ghost/scripts/test_msvq.n
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/ghost/scripts/training.n
===================================================================
--- trunk/ghost/scripts/training.n	                        (rev 0)
+++ trunk/ghost/scripts/training.n	2007-09-02 23:48:51 UTC (rev 13703)
@@ -0,0 +1,116 @@
+#!/usr/bin/env batchflow
+<?xml version="1.0"?>
+<Document>
+  <Network type="subnet" name="MAIN">
+    <Node name="node_LoadFile_1" type="LoadFile" x="-75.000000" y="69.000000">
+      <Parameter name="FILENAME" type="subnet_param" value="ARG1" description=""/>
+    </Node>
+    <Node name="node_LOOP0_1" type="LOOP0" x="242.000000" y="84.000000">
+      <Parameter name="START" type="int" value="0" description=""/>
+      <Parameter name="END" type="int" value="19" description=""/>
+      <Parameter name="DOWHILE" type="int" value="" description=""/>
+    </Node>
+    <Node name="node_NewAccumulator_1" type="NewAccumulator" x="57.000000" y="208.000000"/>
+    <Node name="node_VQTrain_1" type="VQTrain" x="379.000000" y="98.000000">
+      <Parameter name="MEANS" type="int" value="8" description=""/>
+      <Parameter name="BINARY" type="bool" value="true" description=""/>
+    </Node>
+    <Node name="node_SaveAs_1" type="SaveAs" x="438.000000" y="238.000000">
+      <Parameter name="FILENAME" type="string" value="band2.vq" description=""/>
+    </Node>
+    <Node name="node_VQTrain_2" type="VQTrain" x="33.000000" y="145.000000">
+      <Parameter name="MEANS" type="int" value="8" description=""/>
+      <Parameter name="BINARY" type="bool" value="true" description=""/>
+    </Node>
+    <Node name="node_LOOP0_2" type="LOOP0" x="653.000000" y="99.000000">
+      <Parameter name="START" type="int" value="0" description=""/>
+      <Parameter name="END" type="int" value="2" description=""/>
+      <Parameter name="DOWHILE" type="int" value="" description=""/>
+    </Node>
+    <Node name="node_NewAccumulator_2" type="NewAccumulator" x="488.000000" y="160.000000"/>
+    <Node name="node_LOOP0_3" type="LOOP0" x="653.000000" y="-90.000000">
+      <Parameter name="START" type="int" value="3" description=""/>
+      <Parameter name="END" type="int" value="8" description=""/>
+      <Parameter name="DOWHILE" type="int" value="" description=""/>
+    </Node>
+    <Node name="node_VQTrain_3" type="VQTrain" x="778.000000" y="98.000000">
+      <Parameter name="MEANS" type="int" value="8" description=""/>
+      <Parameter name="BINARY" type="bool" value="true" description=""/>
+    </Node>
+    <Node name="node_NewAccumulator_3" type="NewAccumulator" x="473.000000" y="24.000000"/>
+    <Node name="node_VQTrain_4" type="VQTrain" x="779.000000" y="-90.000000">
+      <Parameter name="MEANS" type="int" value="8" description=""/>
+      <Parameter name="BINARY" type="bool" value="true" description=""/>
+    </Node>
+    <Node name="node_SaveAs_2" type="SaveAs" x="274.000000" y="190.000000">
+      <Parameter name="FILENAME" type="string" value="band1.vq" description=""/>
+    </Node>
+    <Node name="node_SaveAs_3" type="SaveAs" x="950.000000" y="-92.000000">
+      <Parameter name="FILENAME" type="string" value="band3b.vq" description=""/>
+    </Node>
+    <Node name="node_SaveAs_4" type="SaveAs" x="938.000000" y="101.000000">
+      <Parameter name="FILENAME" type="string" value="band3a.vq" description=""/>
+    </Node>
+    <Node name="node_LOOP0_4" type="LOOP0" x="668.000000" y="-217.000000">
+      <Parameter name="START" type="int" value="9" description=""/>
+      <Parameter name="END" type="int" value="19" description=""/>
+      <Parameter name="DOWHILE" type="int" value="" description=""/>
+    </Node>
+    <Node name="node_NewAccumulator_4" type="NewAccumulator" x="458.000000" y="-208.000000"/>
+    <Node name="node_VQTrain_5" type="VQTrain" x="785.000000" y="-230.000000">
+      <Parameter name="MEANS" type="int" value="8" description=""/>
+      <Parameter name="BINARY" type="bool" value="true" description=""/>
+    </Node>
+    <Node name="node_SaveAs_5" type="SaveAs" x="930.000000" y="-236.000000">
+      <Parameter name="FILENAME" type="string" value="band3c.vq" description=""/>
+    </Node>
+    <Link from="node_LoadFile_1" output="OUTPUT" to="node_LOOP0_1" input="INPUT"/>
+    <Link from="node_NewAccumulator_1" output="OUTPUT" to="node_LOOP0_1" input="ACCUM"/>
+    <Link from="node_VQTrain_1" output="OUTPUT" to="node_SaveAs_1" input="INPUT"/>
+    <Link from="node_LOOP0_1" output="OUTPUT" to="node_VQTrain_1" input="FRAMES"/>
+    <Link from="node_LoadFile_1" output="OUTPUT" to="node_VQTrain_2" input="FRAMES"/>
+    <Link from="node_VQTrain_2" output="OUTPUT" to="node_LOOP0_1" input="VQ"/>
+    <Link from="node_VQTrain_1" output="OUTPUT" to="node_LOOP0_2" input="VQ"/>
+    <Link from="node_LOOP0_1" output="OUTPUT" to="node_LOOP0_2" input="INPUT"/>
+    <Link from="node_NewAccumulator_2" output="OUTPUT" to="node_LOOP0_2" input="ACCUM"/>
+    <Link from="node_LOOP0_1" output="OUTPUT" to="node_LOOP0_3" input="INPUT"/>
+    <Link from="node_NewAccumulator_3" output="OUTPUT" to="node_LOOP0_3" input="ACCUM"/>
+    <Link from="node_VQTrain_1" output="OUTPUT" to="node_LOOP0_3" input="VQ"/>
+    <Link from="node_LOOP0_3" output="OUTPUT" to="node_VQTrain_4" input="FRAMES"/>
+    <Link from="node_LOOP0_2" output="OUTPUT" to="node_VQTrain_3" input="FRAMES"/>
+    <Link from="node_VQTrain_2" output="OUTPUT" to="node_SaveAs_2" input="INPUT"/>
+    <Link from="node_VQTrain_4" output="OUTPUT" to="node_SaveAs_3" input="INPUT"/>
+    <Link from="node_VQTrain_3" output="OUTPUT" to="node_SaveAs_4" input="INPUT"/>
+    <Link from="node_VQTrain_1" output="OUTPUT" to="node_LOOP0_4" input="VQ"/>
+    <Link from="node_NewAccumulator_4" output="OUTPUT" to="node_LOOP0_4" input="ACCUM"/>
+    <Link from="node_LOOP0_1" output="OUTPUT" to="node_LOOP0_4" input="INPUT"/>
+    <Link from="node_LOOP0_4" output="OUTPUT" to="node_VQTrain_5" input="FRAMES"/>
+    <Link from="node_VQTrain_5" output="OUTPUT" to="node_SaveAs_5" input="INPUT"/>
+    <NetOutput name="OUTPUT" node="node_SaveAs_1" terminal="OUTPUT" object_type="any" description="No description available"/>
+    <NetOutput name="OUTPUT_1" node="node_SaveAs_2" terminal="OUTPUT" object_type="any" description="No description available"/>
+    <NetOutput name="OUTPUT_2" node="node_SaveAs_5" terminal="OUTPUT" object_type="any" description="No description available"/>
+    <NetOutput name="OUTPUT_3" node="node_SaveAs_3" terminal="OUTPUT" object_type="any" description="No description available"/>
+    <NetOutput name="OUTPUT_4" node="node_SaveAs_4" terminal="OUTPUT" object_type="any" description="No description available"/>
+  </Network>
+  <Network type="iterator" name="LOOP0">
+    <Node name="node_UnPack_1" type="UnPack" x="-205.000000" y="63.000000"/>
+    <Node name="node_VQuantize_1" type="VQuantize" x="51.000000" y="102.000000"/>
+    <Node name="node_Sub_1" type="Sub" x="196.000000" y="65.000000"/>
+    <Node name="node_Accumulate_1" type="Accumulate" x="504.000000" y="57.000000"/>
+    <Node name="node_Select_1" type="Select" x="302.000000" y="65.000000">
+      <Parameter name="START" type="subnet_param" value="START" description=""/>
+      <Parameter name="END" type="subnet_param" value="END" description=""/>
+    </Node>
+    <Link from="node_UnPack_1" output="OUTPUT" to="node_VQuantize_1" input="INPUT"/>
+    <Link from="node_VQuantize_1" output="OUTPUT" to="node_Sub_1" input="INPUT2"/>
+    <Link from="node_UnPack_1" output="OUTPUT" to="node_Sub_1" input="INPUT1"/>
+    <Link from="node_Select_1" output="OUTPUT" to="node_Accumulate_1" input="INPUT"/>
+    <Link from="node_Sub_1" output="OUTPUT" to="node_Select_1" input="INPUT"/>
+    <NetInput name="INPUT" node="node_UnPack_1" terminal="INPUT" object_type="any" description="No description available"/>
+    <NetCondition name="CONDITION" node="node_UnPack_1" terminal="NOT_END"/>
+    <NetInput name="VQ" node="node_VQuantize_1" terminal="VQ" object_type="any" description="No description available"/>
+    <NetInput name="ACCUM" node="node_Accumulate_1" terminal="ACCUM" object_type="any" description="No description available"/>
+    <NetOutput name="OUTPUT" node="node_Accumulate_1" terminal="OUTPUT" object_type="any" description="No description available"/>
+  </Network>
+  <Parameter name="ARG1" type="string" value=""/>
+</Document>


Property changes on: trunk/ghost/scripts/training.n
___________________________________________________________________
Name: svn:executable
   + *



More information about the commits mailing list