[xiph-commits] r16961 - trunk/vorbis/vq
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Wed Mar 10 23:15:40 PST 2010
Author: xiphmont
Date: 2010-03-10 23:15:40 -0800 (Wed, 10 Mar 2010)
New Revision: 16961
Added:
trunk/vorbis/vq/44p-1.vqs
trunk/vorbis/vq/44p0.vqs
trunk/vorbis/vq/44p1.vqs
trunk/vorbis/vq/44p2.vqs
trunk/vorbis/vq/44p3.vqs
trunk/vorbis/vq/44p4.vqs
trunk/vorbis/vq/44p5.vqs
trunk/vorbis/vq/44p6.vqs
trunk/vorbis/vq/44p7.vqs
trunk/vorbis/vq/44p8.vqs
trunk/vorbis/vq/44p9.vqs
Removed:
trunk/vorbis/vq/auxpartition.pl
trunk/vorbis/vq/build.c
trunk/vorbis/vq/cascade.c
trunk/vorbis/vq/genericdata.c
trunk/vorbis/vq/lspdata.c
trunk/vorbis/vq/residue_entropy
trunk/vorbis/vq/residuedata.c
trunk/vorbis/vq/residuesplit.c
trunk/vorbis/vq/run.c
trunk/vorbis/vq/train.c
trunk/vorbis/vq/vqext.h
trunk/vorbis/vq/vqsplit.c
trunk/vorbis/vq/vqsplit.h
Modified:
trunk/vorbis/vq/Makefile.am
Log:
Add new book geenration descriptions
Remove more dead utils
Added: trunk/vorbis/vq/44p-1.vqs
===================================================================
--- trunk/vorbis/vq/44p-1.vqs (rev 0)
+++ trunk/vorbis/vq/44p-1.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,49 @@
+GO
+
+>_44pn1 noninterleaved
+haux 44pn1/resaux_0.vqd _44pn1_short 0,80,2 7
+haux 44pn1/resaux_1.vqd _44pn1_long 0,300,2 7
+haux 44pn1/resaux_2.vqd _44pn1_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 2 7 17 31 +
+# 0 99 7 17 31 +
+
+# 0 1 2 3 4 5 6
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . .
+
+:_p1_0 44pn1/res_sub0_part1_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p2_0 44pn1/res_sub0_part2_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p2_1 44pn1/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p3_0 44pn1/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p3_1 44pn1/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p4_0 44pn1/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p4_1 44pn1/res_sub0_part4_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p5_0 44pn1/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p5_1 44pn1/res_sub0_part5_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p4_1 :_p5_2
+
+:_p6_0 44pn1/res_sub0_part6_pass0.vqd, 5, nonseq, 0 +- 625
+:_p6_1 44pn1/res_sub0_part6_pass1.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p6_2 44pn1/res_sub0_part6_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44pn1/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44pn1/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44pn1/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625
+# reuse p7_2/3 for l1_1/2
Added: trunk/vorbis/vq/44p0.vqs
===================================================================
--- trunk/vorbis/vq/44p0.vqs (rev 0)
+++ trunk/vorbis/vq/44p0.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,49 @@
+GO
+
+>_44p0 noninterleaved
+haux 44p0/resaux_0.vqd _44p0_short 0,42,2 7
+haux 44p0/resaux_1.vqd _44p0_long 0,170,2 7
+haux 44p0/resaux_2.vqd _44p0_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 2 7 17 31 +
+# 0 99 7 17 31 +
+
+# 0 1 2 3 4 5 6
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . .
+
+:_p1_0 44p0/res_sub0_part1_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p2_0 44p0/res_sub0_part2_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p2_1 44p0/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p3_0 44p0/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p3_1 44p0/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p4_0 44p0/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p4_1 44p0/res_sub0_part4_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p5_0 44p0/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p5_1 44p0/res_sub0_part5_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p4_1 :_p5_2
+
+:_p6_0 44p0/res_sub0_part6_pass0.vqd, 5, nonseq, 0 +- 625
+:_p6_1 44p0/res_sub0_part6_pass1.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p6_2 44p0/res_sub0_part6_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p0/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p0/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p0/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625
+# reuse p7_2/3 for l1_1/2
Added: trunk/vorbis/vq/44p1.vqs
===================================================================
--- trunk/vorbis/vq/44p1.vqs (rev 0)
+++ trunk/vorbis/vq/44p1.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,49 @@
+GO
+
+>_44p1 noninterleaved
+haux 44p1/resaux_0.vqd _44p1_short 0,42,2 7
+haux 44p1/resaux_1.vqd _44p1_long 0,170,2 7
+haux 44p1/resaux_2.vqd _44p1_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 2 7 17 31 +
+# 0 99 7 17 31 +
+
+# 0 1 2 3 4 5 6
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . .
+
+:_p1_0 44p1/res_sub0_part1_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p2_0 44p1/res_sub0_part2_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p2_1 44p1/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p3_0 44p1/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p3_1 44p1/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p4_0 44p1/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p4_1 44p1/res_sub0_part4_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p5_0 44p1/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p5_1 44p1/res_sub0_part5_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p4_1 :_p5_2
+
+:_p6_0 44p1/res_sub0_part6_pass0.vqd, 5, nonseq, 0 +- 625
+:_p6_1 44p1/res_sub0_part6_pass1.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p6_2 44p1/res_sub0_part6_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p1/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p1/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p1/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625
+# reuse p7_2/3 for l1_1/2
Added: trunk/vorbis/vq/44p2.vqs
===================================================================
--- trunk/vorbis/vq/44p2.vqs (rev 0)
+++ trunk/vorbis/vq/44p2.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,52 @@
+GO
+
+>_44p2 noninterleaved
+haux 44p2/resaux_0.vqd _44p2_short 0,42,2 8
+haux 44p2/resaux_1.vqd _44p2_long 0,170,2 8
+haux 44p2/resaux_2.vqd _44p2_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 1 2 7 17 31 +
+# 0 99 99 7 17 31 +
+
+# 0 1 2 3 4 5 6 7
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . . .
+# 8 .
+
+:_p1_0 44p2/res_sub0_part1_pass2.vqd, 5, nonseq cull, 0 +- 1
+:_p2_0 44p2/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p3_0 44p2/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p3_1 44p2/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p4_0 44p2/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p4_1 44p2/res_sub0_part4_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p5_0 44p2/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p5_1 44p2/res_sub0_part5_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p6_0 44p2/res_sub0_part6_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p6_1 44p2/res_sub0_part6_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p5_1 :_p6_2
+
+:_p7_0 44p2/res_sub0_part7_pass0.vqd, 5, nonseq, 0 +- 1875
+:_p7_1 44p2/res_sub0_part7_pass1.vqd, 5, nonseq, 0 +- 625
+:_p7_2 44p2/res_sub0_part7_pass2.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p7_3 44p2/res_sub0_part7_pass3.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p2/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p2/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p2/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625
+# reuse p7_2/3 for l1_1/2
Added: trunk/vorbis/vq/44p3.vqs
===================================================================
--- trunk/vorbis/vq/44p3.vqs (rev 0)
+++ trunk/vorbis/vq/44p3.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,52 @@
+GO
+
+>_44p3 noninterleaved
+haux 44p3/resaux_0.vqd _44p3_short 0,42,2 8
+haux 44p3/resaux_1.vqd _44p3_long 0,170,2 8
+haux 44p3/resaux_2.vqd _44p3_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 1 2 7 17 31 +
+# 0 99 99 7 17 31 +
+
+# 0 1 2 3 4 5 6 7
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . . .
+# 8 .
+
+:_p1_0 44p3/res_sub0_part1_pass2.vqd, 5, nonseq cull, 0 +- 1
+:_p2_0 44p3/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p3_0 44p3/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p3_1 44p3/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p4_0 44p3/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p4_1 44p3/res_sub0_part4_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p5_0 44p3/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p5_1 44p3/res_sub0_part5_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p6_0 44p3/res_sub0_part6_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p6_1 44p3/res_sub0_part6_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p5_1 :_p6_2 44p3/res_sub0_part6_pass2.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p7_0 44p3/res_sub0_part7_pass0.vqd, 5, nonseq, 0 +- 1875
+:_p7_1 44p3/res_sub0_part7_pass1.vqd, 5, nonseq, 0 +- 625
+:_p7_2 44p3/res_sub0_part7_pass2.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p7_3 44p3/res_sub0_part7_pass3.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p3/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p3/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p3/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625
+# reuse p7_2/3 for l1_1/2
Added: trunk/vorbis/vq/44p4.vqs
===================================================================
--- trunk/vorbis/vq/44p4.vqs (rev 0)
+++ trunk/vorbis/vq/44p4.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,52 @@
+GO
+
+>_44p4 noninterleaved
+haux 44p4/resaux_0.vqd _44p4_short 0,42,2 8
+haux 44p4/resaux_1.vqd _44p4_long 0,170,2 8
+haux 44p4/resaux_2.vqd _44p4_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 1 2 7 17 31 +
+# 0 99 99 7 17 31 +
+
+# 0 1 2 3 4 5 6 7
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . . .
+# 8 .
+
+:_p1_0 44p4/res_sub0_part1_pass2.vqd, 5, nonseq cull, 0 +- 1
+:_p2_0 44p4/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p3_0 44p4/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p3_1 44p4/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p4_0 44p4/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p4_1 44p4/res_sub0_part4_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p5_0 44p4/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p5_1 44p4/res_sub0_part5_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p6_0 44p4/res_sub0_part6_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p6_1 44p4/res_sub0_part6_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p5_1 :_p6_2 44p3/res_sub0_part6_pass2.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p7_0 44p4/res_sub0_part7_pass0.vqd, 5, nonseq, 0 +- 1875
+:_p7_1 44p4/res_sub0_part7_pass1.vqd, 5, nonseq, 0 +- 625
+:_p7_2 44p4/res_sub0_part7_pass2.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p7_3 44p4/res_sub0_part7_pass3.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p4/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p4/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p4/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625
+# reuse p7_2/3 for l1_1/2
Added: trunk/vorbis/vq/44p5.vqs
===================================================================
--- trunk/vorbis/vq/44p5.vqs (rev 0)
+++ trunk/vorbis/vq/44p5.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,52 @@
+GO
+
+>_44p5 noninterleaved
+haux 44p5/resaux_0.vqd _44p5_short 0,42,2 8
+haux 44p5/resaux_1.vqd _44p5_long 0,170,2 8
+haux 44p5/resaux_2.vqd _44p5_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 2 4 7 17 31 +
+# 1 2 4 7 17 31 +
+
+# 0 1 2 3 4 5 6 7
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . . .
+# 8 .
+
+:_p1_0 44p5/res_sub0_part1_pass2.vqd, 5, nonseq cull, 0 +- 1
+:_p2_0 44p5/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p3_0 44p5/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p3_1 44p5/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p4_0 44p5/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p4_1 44p5/res_sub0_part4_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p5_0 44p5/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p5_1 44p5/res_sub0_part5_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p6_0 44p5/res_sub0_part6_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p6_1 44p5/res_sub0_part6_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p5_1 :_p6_2 44p3/res_sub0_part6_pass2.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p7_0 44p5/res_sub0_part7_pass0.vqd, 5, nonseq, 0 +- 1875
+:_p7_1 44p5/res_sub0_part7_pass1.vqd, 5, nonseq, 0 +- 625
+:_p7_2 44p5/res_sub0_part7_pass2.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p7_3 44p5/res_sub0_part7_pass3.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p5/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p5/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p5/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625
+# reuse p6_2/3 for l1_2/3
Added: trunk/vorbis/vq/44p6.vqs
===================================================================
--- trunk/vorbis/vq/44p6.vqs (rev 0)
+++ trunk/vorbis/vq/44p6.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,52 @@
+GO
+
+>_44p6 noninterleaved
+haux 44p6/resaux_0.vqd _44p6_short 0,42,2 8
+haux 44p6/resaux_1.vqd _44p6_long 0,170,2 8
+haux 44p6/resaux_2.vqd _44p6_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 2 4 7 17 31 +
+# 1 2 4 7 17 31 +
+
+# 0 1 2 3 4 5 6 7
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . . .
+# 8 .
+
+:_p1_0 44p6/res_sub0_part1_pass2.vqd, 5, nonseq cull, 0 +- 1
+:_p2_0 44p6/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p3_0 44p6/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p3_1 44p6/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p4_0 44p6/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p4_1 44p6/res_sub0_part4_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p5_0 44p6/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p5_1 44p6/res_sub0_part5_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p6_0 44p6/res_sub0_part6_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p6_1 44p6/res_sub0_part6_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p5_1 :_p6_2 44p3/res_sub0_part6_pass2.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p7_0 44p6/res_sub0_part7_pass0.vqd, 5, nonseq, 0 +- 1875
+:_p7_1 44p6/res_sub0_part7_pass1.vqd, 5, nonseq, 0 +- 625
+:_p7_2 44p6/res_sub0_part7_pass2.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p7_3 44p6/res_sub0_part7_pass3.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p6/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p6/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p6/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625
+# reuse p6_2/3 for l1_2/3
Added: trunk/vorbis/vq/44p7.vqs
===================================================================
--- trunk/vorbis/vq/44p7.vqs (rev 0)
+++ trunk/vorbis/vq/44p7.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,52 @@
+GO
+
+>_44p7 noninterleaved
+haux 44p7/resaux_0.vqd _44p7_short 0,42,2 8
+haux 44p7/resaux_1.vqd _44p7_long 0,170,2 8
+haux 44p7/resaux_2.vqd _44p7_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 2 4 7 17 31 +
+# 1 2 4 7 17 31 +
+
+# 0 1 2 3 4 5 6 7
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . . .
+# 8 .
+
+:_p1_0 44p7/res_sub0_part1_pass2.vqd, 5, nonseq cull, 0 +- 1
+:_p2_0 44p7/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p3_0 44p7/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p3_1 44p7/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p4_0 44p7/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p4_1 44p7/res_sub0_part4_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p5_0 44p7/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p5_1 44p7/res_sub0_part5_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p6_0 44p7/res_sub0_part6_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p6_1 44p7/res_sub0_part6_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p5_1 :_p6_2 44p3/res_sub0_part6_pass2.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p7_0 44p7/res_sub0_part7_pass0.vqd, 5, nonseq, 0 +- 1875
+:_p7_1 44p7/res_sub0_part7_pass1.vqd, 5, nonseq, 0 +- 625
+:_p7_2 44p7/res_sub0_part7_pass2.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p7_3 44p7/res_sub0_part7_pass3.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p7/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p7/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p7/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625 1350
+# reuse p6_2/3 for l1_2/3
Added: trunk/vorbis/vq/44p8.vqs
===================================================================
--- trunk/vorbis/vq/44p8.vqs (rev 0)
+++ trunk/vorbis/vq/44p8.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,52 @@
+GO
+
+>_44p8 noninterleaved
+haux 44p8/resaux_0.vqd _44p8_short 0,42,2 8
+haux 44p8/resaux_1.vqd _44p8_long 0,170,2 8
+haux 44p8/resaux_2.vqd _44p8_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 2 4 7 17 31 +
+# 1 2 4 7 17 31 +
+
+# 0 1 2 3 4 5 6 7
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . . .
+# 8 .
+
+:_p1_0 44p8/res_sub0_part1_pass2.vqd, 5, nonseq cull, 0 +- 1
+:_p2_0 44p8/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p3_0 44p8/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p3_1 44p8/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p4_0 44p8/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p4_1 44p8/res_sub0_part4_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p5_0 44p8/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p5_1 44p8/res_sub0_part5_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p6_0 44p8/res_sub0_part6_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p6_1 44p8/res_sub0_part6_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p5_1 :_p6_2 44p3/res_sub0_part6_pass2.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p7_0 44p8/res_sub0_part7_pass0.vqd, 5, nonseq, 0 +- 3125
+:_p7_1 44p8/res_sub0_part7_pass1.vqd, 5, nonseq, 0 +- 625 1250
+:_p7_2 44p8/res_sub0_part7_pass2.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p7_3 44p8/res_sub0_part7_pass3.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p8/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p8/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p8/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625 1350
+# reuse p6_2/3 for l1_2/3
Added: trunk/vorbis/vq/44p9.vqs
===================================================================
--- trunk/vorbis/vq/44p9.vqs (rev 0)
+++ trunk/vorbis/vq/44p9.vqs 2010-03-11 07:15:40 UTC (rev 16961)
@@ -0,0 +1,52 @@
+GO
+
+>_44p9 noninterleaved
+haux 4pp9/resaux_0.vqd _44p9_short 0,42,2 8
+haux 4pp9/resaux_1.vqd _44p9_long 0,170,2 8
+haux 4pp9/resaux_2.vqd _44p9_lfe 0,2,2 2
+
+#iter 0
+
+# 0 1 2 4 7 17 31 +
+# 1 2 4 7 17 31 +
+
+# 0 1 2 3 4 5 6 7
+# 1 . . . . .
+# 2 . . . . . .
+# 4 . . .
+# 8 .
+
+:_p1_0 44p9/res_sub0_part1_pass2.vqd, 5, nonseq cull, 0 +- 1
+:_p2_0 44p9/res_sub0_part2_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p3_0 44p9/res_sub0_part3_pass0.vqd, 5, nonseq cull, 0 +- 3
+:_p3_1 44p9/res_sub0_part3_pass1.vqd, 5, nonseq cull, 0 +- 1
+
+:_p4_0 44p9/res_sub0_part4_pass0.vqd, 5, nonseq cull, 0 +- 5
+:_p4_1 44p9/res_sub0_part4_pass1.vqd, 5, nonseq cull, 0 +- 1 2
+
+:_p5_0 44p9/res_sub0_part5_pass0.vqd, 5, nonseq cull, 0 +- 7 14
+:_p5_1 44p9/res_sub0_part5_pass1.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p6_0 44p9/res_sub0_part6_pass0.vqd, 5, nonseq cull, 0 +- 21
+:_p6_1 44p9/res_sub0_part6_pass1.vqd, 5, nonseq cull, 0 +- 7
+# reuse p5_1 :_p6_2 44p3/res_sub0_part6_pass2.vqd, 1, nonseq cull, 0 +- 1 2 3
+
+:_p7_0 44p9/res_sub0_part7_pass0.vqd, 5, nonseq, 0 +- 3125 6250
+:_p7_1 44p9/res_sub0_part7_pass1.vqd, 5, nonseq, 0 +- 625 1250
+:_p7_2 44p9/res_sub0_part7_pass2.vqd, 1, nonseq, 0 +- 25 50 75 100 125 150 175 200 225 250 275 300
+:_p7_3 44p9/res_sub0_part7_pass3.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12
+
+# 32 +
+# 0 0
+#
+# 0 1
+# 1 . .
+# 2 . .
+# 4 .
+
+:_l0_0 44p9/res_sub1_part0_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_l0_1 44p9/res_sub1_part0_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_l1_0 44p9/res_sub1_part1_pass0.vqd, 2, nonseq, 0 +- 625 1250
+# reuse p6_2/3 for l1_2/3
Modified: trunk/vorbis/vq/Makefile.am
===================================================================
--- trunk/vorbis/vq/Makefile.am 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/Makefile.am 2010-03-11 07:15:40 UTC (rev 16961)
@@ -21,11 +21,11 @@
44c3.vqs 44c4.vqs 44c5.vqs 44c6.vqs 44c7.vqs 44c8.vqs 44c9.vqs \
44u0.vqs 44u1.vqs 44u2.vqs 44u3.vqs 44u4.vqs 44u5.vqs 44u6.vqs \
44u7.vqs 44u8.vqs 44u9.vqs 8.vqs 8u.vqs floor_11.vqs floor_22.vqs \
- floor_44.vqs
+ floor_44.vqs 44p-1.vqs 44p0.vqs 44p1.vqs 44p2.vqs 44p3.vqs 44p4.vqs \
+ 44p5.vqs 44p6.vqs 44p7.vqs 44p8.vqs 44p9.vqs
-EXTRA_DIST = $(vqs_files) build.c cascade.c genericdata.c lspdata.c \
- make_floor_books.pl make_residue_books.pl metrics.c residue_entropy \
- residuedata.c residuesplit.c run.c train.c vqext.h auxpartition.pl
+EXTRA_DIST = $(vqs_files) make_floor_books.pl make_residue_books.pl \
+ metrics.c
debugvq:
$(MAKE) vq CFLAGS="@DEBUG@"
Deleted: trunk/vorbis/vq/auxpartition.pl
===================================================================
--- trunk/vorbis/vq/auxpartition.pl 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/auxpartition.pl 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,71 +0,0 @@
-#!/usr/bin/perl
-
-if($#ARGV<0){
- &usage;
-}
-
-$|=1;
-
-$bands=0;
-
-foreach $arg (@ARGV){
- ($entries[$bands],$file[$bands])=split(/,/,$arg);
- $bands++;
-}
-
-# no time to deal with globs right now
-if($bands>0){
- die unless open(ONE,"<".$file[0]);
-}
-if($bands>1){
- die unless open(TWO,"<".$file[1]);
-}
-if($bands>2){
- die unless open(THREE,"<".$file[2]);
-}
-
-
-while (<ONE>) {
- my at nums = ();
- @nums = split(/,/);
- my$cols=$#nums;
- for($i=0;$i<$cols;$i++){
- print 0+$nums[$i].", ";
- }
- if($bands>1){
- $_=<TWO>;
- @nums = ();
- @nums = split(/,/);
- $cols=$#nums;
- for($i=0;$i<$cols;$i++){
- print $nums[$i]+$entries[0].", ";
- }
- if($bands>2){
- $_=<THREE>;
- @nums = ();
- @nums = split(/,/);
- $cols=$#nums;
- for($i=0;$i<$cols;$i++){
- print $nums[$i]+$entries[0]+$entries[1].", ";
- }
- }
- }
- print "\n";
-
-}
-
-if($bands>0){
- close ONE;
-}
-if($bands>1){
- close TWO;
-}
-if($bands>2){
- close THREE;
-}
-
-sub usage{
- print "\nOggVorbis auxbook spectral partitioner\n\n";
- print "auxpartition.pl <part_entries>,file [<part_entries>,file...]\n\n";
- exit(1);
-}
Deleted: trunk/vorbis/vq/build.c
===================================================================
--- trunk/vorbis/vq/build.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/build.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,195 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: utility main for building codebooks from training sets
- last mod: $Id$
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <errno.h>
-#include "bookutil.h"
-
-#include "vqgen.h"
-#include "vqsplit.h"
-
-static char *linebuffer=NULL;
-static int lbufsize=0;
-static char *rline(FILE *in,FILE *out){
- long sofar=0;
- if(feof(in))return NULL;
-
- while(1){
- int gotline=0;
-
- while(!gotline){
- if(sofar>=lbufsize){
- if(!lbufsize){
- lbufsize=1024;
- linebuffer=_ogg_malloc(lbufsize);
- }else{
- lbufsize*=2;
- linebuffer=_ogg_realloc(linebuffer,lbufsize);
- }
- }
- {
- long c=fgetc(in);
- switch(c){
- case '\n':
- case EOF:
- gotline=1;
- break;
- default:
- linebuffer[sofar++]=c;
- linebuffer[sofar]='\0';
- break;
- }
- }
- }
-
- if(linebuffer[0]=='#'){
- sofar=0;
- }else{
- return(linebuffer);
- }
- }
-}
-
-/* command line:
- buildvq file
-*/
-
-int main(int argc,char *argv[]){
- vqgen v;
- static_codebook c;
- codebook b;
- quant_meta q;
-
- long *quantlist=NULL;
- int entries=-1,dim=-1,aux=-1;
- FILE *out=NULL;
- FILE *in=NULL;
- char *line,*name;
- long i,j,k;
-
- b.c=&c;
-
- if(argv[1]==NULL){
- fprintf(stderr,"Need a trained data set on the command line.\n");
- exit(1);
- }
-
- {
- char *ptr;
- char *filename=strdup(argv[1]);
-
- in=fopen(filename,"r");
- if(!in){
- fprintf(stderr,"Could not open input file %s\n",filename);
- exit(1);
- }
-
- ptr=strrchr(filename,'-');
- if(ptr){
- *ptr='\0';
- name=strdup(filename);
- sprintf(ptr,".vqh");
- }else{
- name=strdup(filename);
- strcat(filename,".vqh");
- }
-
- out=fopen(filename,"w");
- if(out==NULL){
- fprintf(stderr,"Unable to open %s for writing\n",filename);
- exit(1);
- }
- }
-
- /* suck in the trained book */
-
- /* read book type, but it doesn't matter */
- line=rline(in,out);
-
- line=rline(in,out);
- if(sscanf(line,"%d %d %d",&entries,&dim,&aux)!=3){
- fprintf(stderr,"Syntax error reading book file\n");
- exit(1);
- }
-
- /* just use it to allocate mem */
- vqgen_init(&v,dim,0,entries,0.f,NULL,NULL,0);
-
- /* quant */
- line=rline(in,out);
- if(sscanf(line,"%ld %ld %d %d",&q.min,&q.delta,
- &q.quant,&q.sequencep)!=4){
- fprintf(stderr,"Syntax error reading book file\n");
- exit(1);
- }
-
- /* quantized entries */
- /* save quant data; we don't want to requantize later as our method
- is currently imperfect wrt repeated application */
- i=0;
- quantlist=_ogg_malloc(sizeof(long)*v.elements*v.entries);
- for(j=0;j<entries;j++){
- float a;
- for(k=0;k<dim;k++){
- line=rline(in,out);
- sscanf(line,"%f",&a);
- v.entrylist[i]=a;
- quantlist[i++]=rint(a);
- }
- }
-
- /* ignore bias */
- for(j=0;j<entries;j++)line=rline(in,out);
- free(v.bias);
- v.bias=NULL;
-
- /* training points */
- {
- float *b=alloca(sizeof(float)*(dim+aux));
- i=0;
- v.entries=0; /* hack to avoid reseeding */
- while(1){
- for(k=0;k<dim+aux;k++){
- line=rline(in,out);
- if(!line)break;
- sscanf(line,"%f",b+k);
- }
- if(feof(in))break;
- vqgen_addpoint(&v,b,NULL);
- }
- v.entries=entries;
- }
-
- fclose(in);
- vqgen_unquantize(&v,&q);
-
- /* build the book */
- vqsp_book(&v,&b,quantlist);
- c.q_min=q.min;
- c.q_delta=q.delta;
- c.q_quant=q.quant;
- c.q_sequencep=q.sequencep;
-
- /* save the book in C header form */
- write_codebook(out,name,b.c);
-
- fclose(out);
- exit(0);
-}
Deleted: trunk/vorbis/vq/cascade.c
===================================================================
--- trunk/vorbis/vq/cascade.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/cascade.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,91 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: function call to do simple data cascading
- last mod: $Id$
-
- ********************************************************************/
-
-/* this one outputs residue to stdout. */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-#include "bookutil.h"
-
-/* set up metrics */
-
-float count=0.f;
-
-
-void process_preprocess(codebook **bs,char *basename){
-}
-
-void process_postprocess(codebook **b,char *basename){
- fprintf(stderr,"Done. \n");
-}
-
-float process_one(codebook *b,float *a,int dim,int step,int addmul,
- float base){
- int j;
-
- if(b->c->q_sequencep){
- float temp;
- for(j=0;j<dim;j++){
- temp=a[j*step];
- a[j*step]-=base;
- }
- base=temp;
- }
-
- vorbis_book_besterror(b,a,step,addmul);
-
- return base;
-}
-
-void process_vector(codebook **bs,int *addmul,int inter,float *a,int n){
- int i,bi=0;
- int booknum=0;
-
- while(*bs){
- float base=0.f;
- codebook *b=*bs;
- int dim=b->dim;
-
- if(inter){
- for(i=0;i<n/dim;i++)
- base=process_one(b,a+i,dim,n/dim,addmul[bi],base);
- }else{
- for(i=0;i<=n-dim;i+=dim)
- base=process_one(b,a+i,dim,1,addmul[bi],base);
- }
-
- bs++;
- booknum++;
- bi++;
- }
-
- for(i=0;i<n;i++)
- fprintf(stdout,"%f, ",a[i]);
- fprintf(stdout,"\n");
-
- if((long)(count++)%100)spinnit("working.... lines: ",count);
-}
-
-void process_usage(void){
- fprintf(stderr,
- "usage: vqcascade [-i] +|*<codebook>.vqh [ +|*<codebook.vqh> ]... \n"
- " datafile.vqd [datafile.vqd]...\n\n"
- " data can be taken on stdin. residual error data sent to\n"
- " stdout.\n\n");
-
-}
Deleted: trunk/vorbis/vq/genericdata.c
===================================================================
--- trunk/vorbis/vq/genericdata.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/genericdata.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,61 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: generic euclidian distance metric for VQ codebooks
- last mod: $Id$
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <math.h>
-#include <stdio.h>
-#include "vqgen.h"
-#include "vqext.h"
-
-char *vqext_booktype="GENERICdata";
-int vqext_aux=0;
-quant_meta q={0,0,0,0}; /* non sequence data; each scalar
- independent */
-
-void vqext_quantize(vqgen *v,quant_meta *q){
- vqgen_quantize(v,q);
-}
-
-float *vqext_weight(vqgen *v,float *p){
- /*noop*/
- return(p);
-}
-
- /* candidate,actual */
-float vqext_metric(vqgen *v,float *e, float *p){
- int i;
- float acc=0.f;
- for(i=0;i<v->elements;i++){
- float val=p[i]-e[i];
- acc+=val*val;
- }
- return sqrt(acc/v->elements);
-}
-
-void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
- vqgen_addpoint(v,b+start,NULL);
-}
-
-void vqext_preprocess(vqgen *v){
- /* noop */
-}
-
-
-
-
-
-
Deleted: trunk/vorbis/vq/lspdata.c
===================================================================
--- trunk/vorbis/vq/lspdata.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/lspdata.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,157 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: metrics and quantization code for LSP VQ codebooks
- last mod: $Id$
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <math.h>
-#include <stdio.h>
-#include "vqgen.h"
-#include "vqext.h"
-#include "codebook.h"
-
-char *vqext_booktype="LSPdata";
-quant_meta q={0,0,0,1}; /* set sequence data */
-int vqext_aux=1;
-
-float global_maxdel=M_PI;
-float global_mindel=M_PI;
-#if 0
-void vqext_quantize(vqgen *v,quant_meta *q){
- float delta,mindel;
- float maxquant=((1<<q->quant)-1);
- int j,k;
-
- /* first find the basic delta amount from the maximum span to be
- encoded. Loosen the delta slightly to allow for additional error
- during sequence quantization */
-
- delta=(global_maxdel-global_mindel)/((1<<q->quant)-1.5f);
-
- q->min=_float32_pack(global_mindel);
- q->delta=_float32_pack(delta);
-
- mindel=_float32_unpack(q->min);
- delta=_float32_unpack(q->delta);
-
- for(j=0;j<v->entries;j++){
- float last=0;
- for(k=0;k<v->elements;k++){
- float val=_now(v,j)[k];
- float now=rint((val-last-mindel)/delta);
-
- _now(v,j)[k]=now;
- if(now<0){
- /* be paranoid; this should be impossible */
- fprintf(stderr,"fault; quantized value<0\n");
- exit(1);
- }
-
- if(now>maxquant){
- /* be paranoid; this should be impossible */
- fprintf(stderr,"fault; quantized value>max\n");
- exit(1);
- }
- last=(now*delta)+mindel+last;
- }
- }
-
-}
-#else
-void vqext_quantize(vqgen *v,quant_meta *q){
- vqgen_quantize(v,q);
-}
-#endif
-
-float *weight=NULL;
-#if 0
-/* LSP training metric. We weight error proportional to distance
- *between* LSP vector values. The idea of this metric is not to set
- final cells, but get the midpoint spacing into a form conducive to
- what we want, which is weighting toward preserving narrower
- features. */
-
-#define FUDGE (global_maxdel-weight[i])
-
-float *vqext_weight(vqgen *v,float *p){
- int i;
- int el=v->elements;
- float lastp=0.f;
- for(i=0;i<el;i++){
- float predist=(p[i]-lastp);
- float postdist=(p[i+1]-p[i]);
- weight[i]=(predist<postdist?predist:postdist);
- lastp=p[i];
- }
- return p;
-}
-#else
-#define FUDGE 1.f
-float *vqext_weight(vqgen *v,float *p){
- return p;
-}
-#endif
-
- /* candidate,actual */
-float vqext_metric(vqgen *v,float *e, float *p){
- int i;
- int el=v->elements;
- float acc=0.f;
- for(i=0;i<el;i++){
- float val=(p[i]-e[i])*FUDGE;
- acc+=val*val;
- }
- return sqrt(acc/v->elements);
-}
-
-/* Data files are line-vectors, now just deltas. The codebook entries
- want to be monotonically increasing, so we adjust */
-
-/* assume vqext_aux==1 */
-void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
- float *a=alloca(sizeof(float)*(dim+1)); /* +aux */
- float base=0;
- int i;
-
- for(i=0;i<dim;i++)
- base=a[i]=b[i+start]+base;
-
- if(start+dim+1>cols) /* +aux */
- a[i]=M_PI;
- else
- a[i]=b[i+start]+base;
-
- vqgen_addpoint(v,a,a+dim);
-}
-
-/* we just need to calc the global_maxdel from the training set */
-void vqext_preprocess(vqgen *v){
- long j,k;
-
- global_maxdel=0.f;
- global_mindel=M_PI;
- for(j=0;j<v->points;j++){
- float last=0.;
- for(k=0;k<v->elements+v->aux;k++){
- float p=_point(v,j)[k];
- if(p-last>global_maxdel)global_maxdel=p-last;
- if(p-last<global_mindel)global_mindel=p-last;
- last=p;
- }
- }
-
- weight=_ogg_malloc(sizeof(float)*v->elements);
-}
-
Deleted: trunk/vorbis/vq/residue_entropy
===================================================================
--- trunk/vorbis/vq/residue_entropy 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/residue_entropy 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,58 +0,0 @@
-#!/usr/bin/perl
-
- at quant=(
- 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6,
- 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,
- 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
-);
-
-
-use POSIX;
-my($groupn)=@ARGV;
-my%hash;
-my$count=0;
-my$lines=0;
-
-if(!defined($groupn)){
- print "Usage: residue_entropy <groupsize> \n";
- exit(1);
-}
-$|=1;
-
-while (<STDIN>) {
- chop;
- my at 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){
- if($nums[$j]<0){
- $num=-$quant[int(-$nums[$j]*2)];
- }else{
- $num=$quant[int($nums[$j]*2)];
- }
- $key.=":$num";
- }
-
- if(!defined($hash{$key})){
- $count++;
- $hash{$key}=1;
- }
- }
-
- if(($lines % 1000)==0){
- print "\rworking... $lines lines, found $count values so far";
- }
-}
-
-foreach $key (keys %hash){
- print "\t$key\n";
-}
-
-print "\r$count values total \n";
-print "Done.\n\n";
Deleted: trunk/vorbis/vq/residuedata.c
===================================================================
--- trunk/vorbis/vq/residuedata.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/residuedata.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,160 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: metrics and quantization code for residue VQ codebooks
- last mod: $Id$
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#include "vqgen.h"
-#include "bookutil.h"
-#include "../lib/scales.h"
-#include "vqext.h"
-
-float scalequant=3.f;
-char *vqext_booktype="RESdata";
-quant_meta q={0,0,0,0}; /* set sequence data */
-int vqext_aux=0;
-
-static float *quant_save=NULL;
-
-float *vqext_weight(vqgen *v,float *p){
- return p;
-}
-
-/* quantize aligned on unit boundaries. Because our grid is likely
- very coarse, play 'shuffle the blocks'; don't allow multiple
- entries to fill the same spot as is nearly certain to happen. */
-
-void vqext_quantize(vqgen *v,quant_meta *q){
- int j,k;
- long dim=v->elements;
- long n=v->entries;
- float max=-1;
- float *test=alloca(sizeof(float)*dim);
- int moved=0;
-
-
- /* allow movement only to unoccupied coordinates on the coarse grid */
- for(j=0;j<n;j++){
- for(k=0;k<dim;k++){
- float val=_now(v,j)[k];
- float norm=rint(fabs(val)/scalequant);
- if(norm>max)max=norm;
- test[k]=norm;
- }
-
- /* allow move only if unoccupied */
- if(quant_save){
- for(k=0;k<n;k++)
- if(j!=k && memcmp(test,quant_save+dim*k,dim*sizeof(float))==0)
- break;
- if(k==n){
- if(memcmp(test,quant_save+dim*j,dim*sizeof(float)))
- moved++;
- memcpy(quant_save+dim*j,test,sizeof(float)*dim);
- }
- }else{
- memcpy(_now(v,j),test,sizeof(float)*dim);
- }
- }
-
- /* unlike the other trainers, we fill in our quantization
- information (as we know granularity beforehand and don't need to
- maximize it) */
-
- q->min=_float32_pack(0.f);
- q->delta=_float32_pack(scalequant);
- q->quant=_ilog(max);
-
- if(quant_save){
- memcpy(_now(v,0),quant_save,sizeof(float)*dim*n);
- fprintf(stderr,"cells shifted this iteration: %d\n",moved);
- }
-}
-
- /* candidate,actual */
-float vqext_metric(vqgen *v,float *e, float *p){
- int i;
- float acc=0.f;
- for(i=0;i<v->elements;i++){
- float val=p[i]-e[i];
- acc+=val*val;
- }
- return sqrt(acc);
-}
-
-/* We don't interleave here; we assume that the interleave is provided
- for us by residuesplit in vorbis/huff/ */
-void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
- vqgen_addpoint(v,b+start,NULL);
-}
-
-/* need to reseed because of the coarse quantization we tend to use on
- residuals (which causes lots & lots of dupes) */
-void vqext_preprocess(vqgen *v){
- long i,j,k,l;
- float *test=alloca(sizeof(float)*v->elements);
- scalequant=q.quant;
-
- vqext_quantize(v,&q);
- vqgen_unquantize(v,&q);
-
- /* if there are any dupes, reseed */
- for(k=0;k<v->entries;k++){
- for(l=0;l<k;l++){
- if(memcmp(_now(v,k),_now(v,l),sizeof(float)*v->elements)==0)
- break;
- }
- if(l<k)break;
- }
-
- if(k<v->entries){
- fprintf(stderr,"reseeding with quantization....\n");
-
- /* seed the inputs to input points, but points on unit boundaries,
- ignoring quantbits for now, making sure each seed is unique */
-
- for(i=0,j=0;i<v->points && j<v->entries;i++){
- for(k=0;k<v->elements;k++){
- float val=_point(v,i)[k];
- test[k]=rint(val/scalequant)*scalequant;
- }
-
- for(l=0;l<j;l++){
- for(k=0;k<v->elements;k++)
- if(test[k]!=_now(v,l)[k])
- break;
- if(k==v->elements)break;
- }
- if(l==j){
- memcpy(_now(v,j),test,v->elements*sizeof(float));
- j++;
- }
- }
-
- if(j<v->elements){
- fprintf(stderr,"Not enough unique entries after prequantization\n");
- exit(1);
- }
- }
- vqext_quantize(v,&q);
- quant_save=_ogg_malloc(sizeof(float)*v->elements*v->entries);
- memcpy(quant_save,_now(v,0),sizeof(float)*v->elements*v->entries);
- vqgen_unquantize(v,&q);
-
-}
-
Deleted: trunk/vorbis/vq/residuesplit.c
===================================================================
--- trunk/vorbis/vq/residuesplit.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/residuesplit.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,282 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: residue backend 0 partitioner/classifier
- last mod: $Id$
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <stdio.h>
-#include "bookutil.h"
-
-/* does not guard against invalid settings; eg, a subn of 16 and a
- subgroup request of 32. Max subn of 128 */
-static float _testhack(float *vec,int n){
- int i,j=0;
- float max=0.f;
- float temp[128];
- float entropy=0.;
-
- /* setup */
- for(i=0;i<n;i++)temp[i]=fabs(vec[i]);
-
- /* handle case subgrp==1 outside */
- for(i=0;i<n;i++)
- if(temp[i]>max)max=temp[i];
-
- for(i=0;i<n;i++)temp[i]=rint(temp[i]);
-
- for(i=0;i<n;i++)
- entropy+=temp[i];
- return entropy;
-
- /*while(1){
- entropy[j]=max;
- n>>=1;
- j++;
-
- if(n<=0)break;
- for(i=0;i<n;i++){
- temp[i]+=temp[i+n];
- }
- max=0.f;
- for(i=0;i<n;i++)
- if(temp[i]>max)max=temp[i];
- }*/
-}
-
-static FILE *of;
-static FILE **or;
-
-/* we evaluate the the entropy measure for each interleaved subgroup */
-/* This is currently a bit specific to/hardwired for mapping 0; things
- will need to change in the future when we get real multichannel
- mappings */
-int quantaux(float *res,int n,float *ebound,float *mbound,int *subgrp,int parts, int subn,
- int *class){
- long i,j,part=0;
- int aux;
-
- for(i=0;i<=n-subn;i+=subn,part++){
- float max=0.f;
- float lentropy=0.f;
-
- lentropy=_testhack(res+i,subn);
-
- for(j=0;j<subn;j++)
- if(fabs(res[i+j])>max)max=fabs(res[i+j]);
-
- for(j=0;j<parts-1;j++)
- if(lentropy<=ebound[j] &&
- max<=mbound[j] &&
- part<subgrp[j])
- break;
- class[part]=aux=j;
-
- fprintf(of,"%d, ",aux);
- }
- fprintf(of,"\n");
-
- return(0);
-}
-
-int quantwrite(float *res,int n,int subn, int *class,int offset){
- long i,j,part=0;
- int aux;
-
- for(i=0;i<=n-subn;i+=subn,part++){
- aux=class[part];
-
- for(j=0;j<subn;j++)
- fprintf(or[aux+offset],"%g, ",res[j+i]);
-
- fprintf(or[aux+offset],"\n");
- }
-
- return(0);
-}
-
-static int getline(FILE *in,float *vec,int begin,int n){
- int i,next=0;
-
- reset_next_value();
- if(get_next_value(in,vec))return(0);
- if(begin){
- for(i=1;i<begin;i++)
- get_line_value(in,vec);
- next=0;
- }else{
- next=1;
- }
-
- for(i=next;i<n;i++)
- if(get_line_value(in,vec+i)){
- fprintf(stderr,"ran out of columns in input data\n");
- exit(1);
- }
-
- return(1);
-}
-
-static void usage(){
- fprintf(stderr,
- "usage:\n"
- "residuesplit <res> [<res>] <begin,n,group> <baseout> <ent,peak,sub> [<ent,peak,sub>]...\n"
- " where begin,n,group is first scalar, \n"
- " number of scalars of each in line,\n"
- " number of scalars in a group\n"
- " ent is the maximum entropy value allowed for membership in a group\n"
- " peak is the maximum amplitude value allowed for membership in a group\n"
- " subn is the maximum subpartiton number allowed in the group\n\n");
- exit(1);
-}
-
-int main(int argc, char *argv[]){
- char *buffer;
- char *base;
- int i,j,parts,begin,n,subn,*subgrp,*class;
- FILE **res;
- int resfiles=0;
- float *ebound,*mbound,*vec;
- long c=0;
- if(argc<5)usage();
-
- /* count the res file names, open the files */
- while(!strcmp(argv[resfiles+1]+strlen(argv[resfiles+1])-4,".vqd"))
- resfiles++;
- if(resfiles<1)usage();
-
- res=alloca(sizeof(*res)*resfiles);
- for(i=0;i<resfiles;i++){
- res[i]=fopen(argv[i+1],"r");
- if(!(res+i)){
- fprintf(stderr,"Could not open file %s\n",argv[1+i]);
- exit(1);
- }
- }
-
- base=strdup(argv[2+resfiles]);
- buffer=alloca(strlen(base)+20);
- {
- char *pos=strchr(argv[1+resfiles],',');
- begin=atoi(argv[1+resfiles]);
- if(!pos)
- usage();
- else
- n=atoi(pos+1);
- pos=strchr(pos+1,',');
- if(!pos)
- usage();
- else
- subn=atoi(pos+1);
- if(n/subn*subn != n){
- fprintf(stderr,"n must be divisible by group\n");
- exit(1);
- }
- }
-
- /* how many parts?... */
- parts=argc-resfiles-2;
-
- ebound=_ogg_malloc(sizeof(float)*parts);
- mbound=_ogg_malloc(sizeof(float)*parts);
- subgrp=_ogg_malloc(sizeof(int)*parts);
-
- for(i=0;i<parts-1;i++){
- char *pos=strchr(argv[3+i+resfiles],',');
- subgrp[i]=0;
- if(*argv[3+i+resfiles]==',')
- ebound[i]=1e50f;
- else
- ebound[i]=atof(argv[3+i+resfiles]);
-
- if(!pos){
- mbound[i]=1e50f;
- }else{
- if(*(pos+1)==',')
- mbound[i]=1e50f;
- else
- mbound[i]=atof(pos+1);
- pos=strchr(pos+1,',');
-
- if(pos)
- subgrp[i]=atoi(pos+1);
-
- }
- if(subgrp[i]<=0)subgrp[i]=99999;
- }
-
- ebound[i]=1e50f;
- mbound[i]=1e50f;
- subgrp[i]=9999999;
-
- or=alloca(parts*resfiles*sizeof(FILE*));
- sprintf(buffer,"%saux.vqd",base);
- of=fopen(buffer,"w");
- if(!of){
- fprintf(stderr,"Could not open file %s for writing\n",buffer);
- exit(1);
- }
-
- for(j=0;j<resfiles;j++){
- for(i=0;i<parts;i++){
- sprintf(buffer,"%s_%d%c.vqd",base,i,j+65);
- or[i+j*parts]=fopen(buffer,"w");
- if(!or[i+j*parts]){
- fprintf(stderr,"Could not open file %s for writing\n",buffer);
- exit(1);
- }
- }
- }
-
- vec=_ogg_malloc(sizeof(float)*n);
- class=_ogg_malloc(sizeof(float)*n);
- /* get the input line by line and process it */
- while(1){
- if(getline(res[0],vec,begin,n)){
- quantaux(vec,n,ebound,mbound,subgrp,parts,subn,class);
- quantwrite(vec,n,subn,class,0);
-
- for(i=1;i<resfiles;i++){
- if(getline(res[i],vec,begin,n)){
- quantwrite(vec,n,subn,class,parts*i);
- }else{
- fprintf(stderr,"Getline loss of sync (%d).\n\n",i);
- exit(1);
- }
- }
- }else{
- if(feof(res[0]))break;
- fprintf(stderr,"Getline loss of sync (0).\n\n");
- exit(1);
- }
-
- c++;
- if(!(c&0xf)){
- spinnit("kB so far...",(int)(ftell(res[0])/1024));
- }
- }
- for(i=0;i<resfiles;i++)
- fclose(res[i]);
- fclose(of);
- for(i=0;i<parts*resfiles;i++)
- fclose(or[i]);
- fprintf(stderr,"\rDone \n");
- return(0);
-}
-
-
-
-
Deleted: trunk/vorbis/vq/run.c
===================================================================
--- trunk/vorbis/vq/run.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/run.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,216 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: utility main for loading and operating on codebooks
- last mod: $Id$
-
- ********************************************************************/
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-
-#include "bookutil.h"
-
-/* command line:
- utilname [-i] +|* input_book.vqh [+|* input_book.vqh]
- input_data.vqd [input_data.vqd]
-
- produces output data on stdout
- (may also take input data from stdin)
-
- */
-
-extern void process_preprocess(codebook **b,char *basename);
-extern void process_postprocess(codebook **b,char *basename);
-extern void process_vector(codebook **b,int *addmul, int inter,float *a,int n);
-extern void process_usage(void);
-
-int main(int argc,char *argv[]){
- char *basename;
- codebook **b=_ogg_calloc(1,sizeof(codebook *));
- int *addmul=_ogg_calloc(1,sizeof(int));
- int books=0;
- int input=0;
- int interleave=0;
- int j;
- int start=0;
- int num=-1;
- argv++;
-
- if(*argv==NULL){
- process_usage();
- exit(1);
- }
-
- /* yes, this is evil. However, it's very convenient to parse file
- extentions */
-
- while(*argv){
- if(*argv[0]=='-'){
- /* option */
- if(argv[0][1]=='s'){
- /* subvector */
- if(sscanf(argv[1],"%d,%d",&start,&num)!=2){
- num= -1;
- if(sscanf(argv[1],"%d",&start)!=1){
- fprintf(stderr,"Syntax error using -s\n");
- exit(1);
- }
- }
- argv+=2;
- }
- if(argv[0][1]=='i'){
- /* interleave */
- interleave=1;
- argv+=1;
- }
- }else{
- /* input file. What kind? */
- char *dot;
- char *ext=NULL;
- char *name=strdup(*argv++);
- dot=strrchr(name,'.');
- if(dot)
- ext=dot+1;
- else
- ext="";
-
- /* codebook */
- if(!strcmp(ext,"vqh")){
- int multp=0;
- if(input){
- fprintf(stderr,"specify all input data (.vqd) files following\n"
- "codebook header (.vqh) files\n");
- exit(1);
- }
- /* is it additive or multiplicative? */
- if(name[0]=='*'){
- multp=1;
- name++;
- }
- if(name[0]=='+')name++;
-
- basename=strrchr(name,'/');
- if(basename)
- basename=strdup(basename)+1;
- else
- basename=strdup(name);
- dot=strrchr(basename,'.');
- if(dot)*dot='\0';
-
- b=_ogg_realloc(b,sizeof(codebook *)*(books+2));
- b[books]=codebook_load(name);
- addmul=_ogg_realloc(addmul,sizeof(int)*(books+1));
- addmul[books++]=multp;
- b[books]=NULL;
- }
-
- /* data file */
- if(!strcmp(ext,"vqd")){
- int cols;
- long lines=0;
- char *line;
- float *vec;
- FILE *in=fopen(name,"r");
- if(!in){
- fprintf(stderr,"Could not open input file %s\n",name);
- exit(1);
- }
-
- if(!input){
- process_preprocess(b,basename);
- input++;
- }
-
- reset_next_value();
- line=setup_line(in);
- /* count cols before we start reading */
- {
- char *temp=line;
- while(*temp==' ')temp++;
- for(cols=0;*temp;cols++){
- while(*temp>32)temp++;
- while(*temp==' ')temp++;
- }
- }
- vec=alloca(cols*sizeof(float));
- while(line){
- lines++;
- for(j=0;j<cols;j++)
- if(get_line_value(in,vec+j)){
- fprintf(stderr,"Too few columns on line %ld in data file\n",lines);
- exit(1);
- }
- /* ignores -s for now */
- process_vector(b,addmul,interleave,vec,cols);
-
- line=setup_line(in);
- }
- fclose(in);
- }
- }
- }
-
- /* take any data from stdin */
- {
- struct stat st;
- if(fstat(STDIN_FILENO,&st)==-1){
- fprintf(stderr,"Could not stat STDIN\n");
- exit(1);
- }
- if((S_IFIFO|S_IFREG|S_IFSOCK)&st.st_mode){
- int cols;
- char *line;
- long lines=0;
- float *vec;
- if(!input){
- process_preprocess(b,basename);
- input++;
- }
-
- line=setup_line(stdin);
- /* count cols before we start reading */
- {
- char *temp=line;
- while(*temp==' ')temp++;
- for(cols=0;*temp;cols++){
- while(*temp>32)temp++;
- while(*temp==' ')temp++;
- }
- }
- vec=alloca(cols*sizeof(float));
- while(line){
- lines++;
- for(j=0;j<cols;j++)
- if(get_line_value(stdin,vec+j)){
- fprintf(stderr,"Too few columns on line %ld in data file\n",lines);
- exit(1);
- }
- /* ignores -s for now */
- process_vector(b,addmul,interleave,vec,cols);
-
- line=setup_line(stdin);
- }
- }
- }
-
- process_postprocess(b,basename);
-
- return 0;
-}
Deleted: trunk/vorbis/vq/train.c
===================================================================
--- trunk/vorbis/vq/train.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/train.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,364 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: utility main for training codebooks
- last mod: $Id$
-
- ********************************************************************/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <errno.h>
-#include <signal.h>
-#include "vqgen.h"
-#include "vqext.h"
-#include "bookutil.h"
-
-static char *rline(FILE *in,FILE *out,int pass){
- while(1){
- char *line=get_line(in);
- if(line && line[0]=='#'){
- if(pass)fprintf(out,"%s\n",line);
- }else{
- return(line);
- }
- }
-}
-
-/* command line:
- trainvq vqfile [options] trainfile [trainfile]
-
- options: -params entries,dim,quant
- -subvector start[,num]
- -error desired_error
- -iterations iterations
-*/
-
-static void usage(void){
- fprintf(stderr, "\nOggVorbis %s VQ codebook trainer\n\n"
- "<foo>vqtrain vqfile [options] [datasetfile] [datasetfile]\n"
- "options: -p[arams] <entries,dim,quant>\n"
- " -s[ubvector] <start[,num]>\n"
- " -e[rror] <desired_error>\n"
- " -i[terations] <maxiterations>\n"
- " -d[istance] quantization mesh spacing for density limitation\n"
- " -b <dummy> eliminate cell size biasing; use normal LBG\n\n"
- " -c <dummy> Use centroid (not median) midpoints\n"
-
- "examples:\n"
- " train a new codebook to 1%% tolerance on datafile 'foo':\n"
- " xxxvqtrain book -p 256,6,8 -e .01 foo\n"
- " (produces a trained set in book-0.vqi)\n\n"
- " continue training 'book-0.vqi' (produces book-1.vqi):\n"
- " xxxvqtrain book-0.vqi\n\n"
- " add subvector from element 1 to <dimension> from files\n"
- " data*.m to the training in progress, prodicing book-1.vqi:\n"
- " xxxvqtrain book-0.vqi -s 1,1 data*.m\n\n",vqext_booktype);
-}
-
-int exiting=0;
-void setexit(int dummy){
- fprintf(stderr,"\nexiting... please wait to finish this iteration\n");
- exiting=1;
-}
-
-int main(int argc,char *argv[]){
- vqgen v;
-
- int entries=-1,dim=-1;
- int start=0,num=-1;
- float desired=.05f,mindist=0.f;
- int iter=1000;
- int biasp=1;
- int centroid=0;
-
- FILE *out=NULL;
- char *line;
- long i,j,k;
- int init=0;
- q.quant=-1;
-
- argv++;
- if(!*argv){
- usage();
- exit(0);
- }
-
- /* get the book name, a preexisting book to continue training */
- {
- FILE *in=NULL;
- char *filename=alloca(strlen(*argv)+30),*ptr;
-
- strcpy(filename,*argv);
- in=fopen(filename,"r");
- ptr=strrchr(filename,'-');
- if(ptr){
- int num;
- ptr++;
- num=atoi(ptr);
- sprintf(ptr,"%d.vqi",num+1);
- }else
- strcat(filename,"-0.vqi");
-
- out=fopen(filename,"w");
- if(out==NULL){
- fprintf(stderr,"Unable to open %s for writing\n",filename);
- exit(1);
- }
-
- if(in){
- /* we wish to suck in a preexisting book and continue to train it */
- float a;
-
- line=rline(in,out,1);
- if(strcmp(line,vqext_booktype)){
- fprintf(stderr,"wrong book type; %s!=%s\n",line,vqext_booktype);
- exit(1);
- }
-
- line=rline(in,out,1);
- if(sscanf(line,"%d %d %d",&entries,&dim,&vqext_aux)!=3){
- fprintf(stderr,"Syntax error reading book file\n");
- exit(1);
- }
-
- vqgen_init(&v,dim,vqext_aux,entries,mindist,
- vqext_metric,vqext_weight,centroid);
- init=1;
-
- /* quant setup */
- line=rline(in,out,1);
- if(sscanf(line,"%ld %ld %d %d",&q.min,&q.delta,
- &q.quant,&q.sequencep)!=4){
- fprintf(stderr,"Syntax error reading book file\n");
- exit(1);
- }
-
- /* quantized entries */
- i=0;
- for(j=0;j<entries;j++){
- for(k=0;k<dim;k++){
- line=rline(in,out,0);
- sscanf(line,"%f",&a);
- v.entrylist[i++]=a;
- }
- }
- vqgen_unquantize(&v,&q);
-
- /* bias */
- i=0;
- for(j=0;j<entries;j++){
- line=rline(in,out,0);
- sscanf(line,"%f",&a);
- v.bias[i++]=a;
- }
-
- v.seeded=1;
- {
- float *b=alloca((dim+vqext_aux)*sizeof(float));
- i=0;
- while(1){
- for(k=0;k<dim+vqext_aux;k++){
- line=rline(in,out,0);
- if(!line)break;
- sscanf(line,"%f",b+k);
- }
- if(feof(in))break;
- vqgen_addpoint(&v,b,b+dim);
- }
- }
-
- fclose(in);
- }
- }
-
- /* get the rest... */
- argv=argv++;
- while(*argv){
- if(argv[0][0]=='-'){
- /* it's an option */
- if(!argv[1]){
- fprintf(stderr,"Option %s missing argument.\n",argv[0]);
- exit(1);
- }
- switch(argv[0][1]){
- case 'p':
- if(sscanf(argv[1],"%d,%d,%d",&entries,&dim,&q.quant)!=3)
- goto syner;
- break;
- case 's':
- if(sscanf(argv[1],"%d,%d",&start,&num)!=2){
- num= -1;
- if(sscanf(argv[1],"%d",&start)!=1)
- goto syner;
- }
- break;
- case 'e':
- if(sscanf(argv[1],"%f",&desired)!=1)
- goto syner;
- break;
- case 'd':
- if(sscanf(argv[1],"%f",&mindist)!=1)
- goto syner;
- if(init)v.mindist=mindist;
- break;
- case 'i':
- if(sscanf(argv[1],"%d",&iter)!=1)
- goto syner;
- break;
- case 'b':
- biasp=0;
- break;
- case 'c':
- centroid=1;
- break;
- default:
- fprintf(stderr,"Unknown option %s\n",argv[0]);
- exit(1);
- }
- argv+=2;
- }else{
- /* it's an input file */
- char *file=strdup(*argv++);
- FILE *in;
- int cols=-1;
-
- if(!init){
- if(dim==-1 || entries==-1 || q.quant==-1){
- fprintf(stderr,"-p required when training a new set\n");
- exit(1);
- }
- vqgen_init(&v,dim,vqext_aux,entries,mindist,
- vqext_metric,vqext_weight,centroid);
- init=1;
- }
-
- in=fopen(file,"r");
- if(in==NULL){
- fprintf(stderr,"Could not open input file %s\n",file);
- exit(1);
- }
- fprintf(out,"# training file entry: %s\n",file);
-
- while((line=rline(in,out,0))){
- if(cols==-1){
- char *temp=line;
- while(*temp==' ')temp++;
- for(cols=0;*temp;cols++){
- while(*temp>32)temp++;
- while(*temp==' ')temp++;
- }
-
- fprintf(stderr,"%d colums per line in file %s\n",cols,file);
-
- }
- {
- int i;
- float b[cols];
- if(start+num*dim>cols){
- fprintf(stderr,"ran out of columns reading %s\n",file);
- exit(1);
- }
- while(*line==' ')line++;
- for(i=0;i<cols;i++){
-
- /* static length buffer bug workaround */
- char *temp=line;
- char old;
- while(*temp>32)temp++;
-
- old=temp[0];
- temp[0]='\0';
- b[i]=atof(line);
- temp[0]=old;
-
- while(*line>32)line++;
- while(*line==' ')line++;
- }
- if(num<=0)num=(cols-start)/dim;
- for(i=0;i<num;i++)
- vqext_addpoint_adj(&v,b,start+i*dim,dim,cols,num);
-
- }
- }
- fclose(in);
- }
- }
-
- if(!init){
- fprintf(stderr,"No input files!\n");
- exit(1);
- }
-
- vqext_preprocess(&v);
-
- /* train the book */
- signal(SIGTERM,setexit);
- signal(SIGINT,setexit);
-
- for(i=0;i<iter && !exiting;i++){
- float result;
- if(i!=0){
- vqgen_unquantize(&v,&q);
- vqgen_cellmetric(&v);
- }
- result=vqgen_iterate(&v,biasp);
- vqext_quantize(&v,&q);
- if(result<desired)break;
- }
-
- /* save the book */
-
- fprintf(out,"# OggVorbis VQ codebook trainer, intermediate file\n");
- fprintf(out,"%s\n",vqext_booktype);
- fprintf(out,"%d %d %d\n",entries,dim,vqext_aux);
- fprintf(out,"%ld %ld %d %d\n",
- q.min,q.delta,q.quant,q.sequencep);
-
- /* quantized entries */
- fprintf(out,"# quantized entries---\n");
- i=0;
- for(j=0;j<entries;j++)
- for(k=0;k<dim;k++)
- fprintf(out,"%d\n",(int)(rint(v.entrylist[i++])));
-
- fprintf(out,"# biases---\n");
- i=0;
- for(j=0;j<entries;j++)
- fprintf(out,"%f\n",v.bias[i++]);
-
- /* we may have done the density limiting mesh trick; refetch the
- training points from the temp file */
-
- rewind(v.asciipoints);
- fprintf(out,"# points---\n");
- {
- /* sloppy, no error handling */
- long bytes;
- char buff[4096];
- while((bytes=fread(buff,1,4096,v.asciipoints)))
- while(bytes)bytes-=fwrite(buff,1,bytes,out);
- }
-
- fclose(out);
- fclose(v.asciipoints);
-
- vqgen_unquantize(&v,&q);
- vqgen_cellmetric(&v);
- exit(0);
-
- syner:
- fprintf(stderr,"Syntax error in argument '%s'\n",*argv);
- exit(1);
-}
Deleted: trunk/vorbis/vq/vqext.h
===================================================================
--- trunk/vorbis/vq/vqext.h 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/vqext.h 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,34 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: prototypes for extermal metrics specific to data type
- last mod: $Id$
-
- ********************************************************************/
-
-#ifndef _V_VQEXT_
-#define _V_VQEXT_
-
-#include "vqgen.h"
-
-extern char *vqext_booktype;
-extern quant_meta q;
-extern int vqext_aux;
-
-extern float vqext_metric(vqgen *v,float *e, float *p);
-extern float *vqext_weight(vqgen *v,float *p);
-extern void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num);
-extern void vqext_preprocess(vqgen *v);
-extern void vqext_quantize(vqgen *v,quant_meta *);
-
-
-#endif
Deleted: trunk/vorbis/vq/vqsplit.c
===================================================================
--- trunk/vorbis/vq/vqsplit.c 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/vqsplit.c 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,612 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: build a VQ codebook and the encoding decision 'tree'
- last mod: $Id$
-
- ********************************************************************/
-
-/* This code is *not* part of libvorbis. It is used to generate
- trained codebooks offline and then spit the results into a
- pregenerated codebook that is compiled into libvorbis. It is an
- expensive (but good) algorithm. Run it on big iron. */
-
-/* There are so many optimizations to explore in *both* stages that
- considering the undertaking is almost withering. For now, we brute
- force it all */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include "vqgen.h"
-#include "vqsplit.h"
-#include "bookutil.h"
-
-/* Codebook generation happens in two steps:
-
- 1) Train the codebook with data collected from the encoder: We use
- one of a few error metrics (which represent the distance between a
- given data point and a candidate point in the training set) to
- divide the training set up into cells representing roughly equal
- probability of occurring.
-
- 2) Generate the codebook and auxiliary data from the trained data set
-*/
-
-/* Building a codebook from trained set **********************************
-
- The codebook in raw form is technically finished once it's trained.
- However, we want to finalize the representative codebook values for
- each entry and generate auxiliary information to optimize encoding.
- We generate the auxiliary coding tree using collected data,
- probably the same data as in the original training */
-
-/* At each recursion, the data set is split in half. Cells with data
- points on side A go into set A, same with set B. The sets may
- overlap. If the cell overlaps the deviding line only very slightly
- (provided parameter), we may choose to ignore the overlap in order
- to pare the tree down */
-
-long *isortvals;
-int iascsort(const void *a,const void *b){
- long av=isortvals[*((long *)a)];
- long bv=isortvals[*((long *)b)];
- return(av-bv);
-}
-
-static float _Ndist(int el,float *a, float *b){
- int i;
- float acc=0.f;
- for(i=0;i<el;i++){
- float val=(a[i]-b[i]);
- acc+=val*val;
- }
- return sqrt(acc);
-}
-
-#define _Npoint(i) (pointlist+dim*(i))
-#define _Nnow(i) (entrylist+dim*(i))
-
-
-/* goes through the split, but just counts it and returns a metric*/
-int vqsp_count(float *entrylist,float *pointlist,int dim,
- long *membership,long *reventry,
- long *entryindex,long entries,
- long *pointindex,long points,int splitp,
- long *entryA,long *entryB,
- long besti,long bestj,
- long *entriesA,long *entriesB,long *entriesC){
- long i,j;
- long A=0,B=0,C=0;
- long pointsA=0;
- long pointsB=0;
- long *temppointsA=NULL;
- long *temppointsB=NULL;
-
- if(splitp){
- temppointsA=_ogg_malloc(points*sizeof(long));
- temppointsB=_ogg_malloc(points*sizeof(long));
- }
-
- memset(entryA,0,sizeof(long)*entries);
- memset(entryB,0,sizeof(long)*entries);
-
- /* Do the points belonging to this cell occur on sideA, sideB or
- both? */
-
- for(i=0;i<points;i++){
- float *ppt=_Npoint(pointindex[i]);
- long firstentry=membership[pointindex[i]];
-
- if(firstentry==besti){
- entryA[reventry[firstentry]]=1;
- if(splitp)temppointsA[pointsA++]=pointindex[i];
- continue;
- }
- if(firstentry==bestj){
- entryB[reventry[firstentry]]=1;
- if(splitp)temppointsB[pointsB++]=pointindex[i];
- continue;
- }
- {
- float distA=_Ndist(dim,ppt,_Nnow(besti));
- float distB=_Ndist(dim,ppt,_Nnow(bestj));
- if(distA<distB){
- entryA[reventry[firstentry]]=1;
- if(splitp)temppointsA[pointsA++]=pointindex[i];
- }else{
- entryB[reventry[firstentry]]=1;
- if(splitp)temppointsB[pointsB++]=pointindex[i];
- }
- }
- }
-
- /* The entry splitting isn't total, so that storage has to be
- allocated for recursion. Reuse the entryA/entryB vectors */
- /* keep the entries in ascending order (relative to the original
- list); we rely on that stability when ordering p/q choice */
- for(j=0;j<entries;j++){
- if(entryA[j] && entryB[j])C++;
- if(entryA[j])entryA[A++]=entryindex[j];
- if(entryB[j])entryB[B++]=entryindex[j];
- }
- *entriesA=A;
- *entriesB=B;
- *entriesC=C;
- if(splitp){
- memcpy(pointindex,temppointsA,sizeof(long)*pointsA);
- memcpy(pointindex+pointsA,temppointsB,sizeof(long)*pointsB);
- free(temppointsA);
- free(temppointsB);
- }
- return(pointsA);
-}
-
-int lp_split(float *pointlist,long totalpoints,
- codebook *b,
- long *entryindex,long entries,
- long *pointindex,long points,
- long *membership,long *reventry,
- long depth, long *pointsofar){
-
- encode_aux_nearestmatch *t=b->c->nearest_tree;
-
- /* The encoder, regardless of book, will be using a straight
- euclidian distance-to-point metric to determine closest point.
- Thus we split the cells using the same (we've already trained the
- codebook set spacing and distribution using special metrics and
- even a midpoint division won't disturb the basic properties) */
-
- int dim=b->dim;
- float *entrylist=b->valuelist;
- long ret;
- long *entryA=_ogg_calloc(entries,sizeof(long));
- long *entryB=_ogg_calloc(entries,sizeof(long));
- long entriesA=0;
- long entriesB=0;
- long entriesC=0;
- long pointsA=0;
- long i,j,k;
-
- long besti=-1;
- long bestj=-1;
-
- char spinbuf[80];
- sprintf(spinbuf,"splitting [%ld left]... ",totalpoints-*pointsofar);
-
- /* one reverse index needed */
- for(i=0;i<b->entries;i++)reventry[i]=-1;
- for(i=0;i<entries;i++)reventry[entryindex[i]]=i;
-
- /* We need to find the dividing hyperplane. find the median of each
- axis as the centerpoint and the normal facing farthest point */
-
- /* more than one way to do this part. For small sets, we can brute
- force it. */
-
- if(entries<8 || (float)points*entries*entries<16.f*1024*1024){
- /* try every pair possibility */
- float best=0;
- float this;
- for(i=0;i<entries-1;i++){
- for(j=i+1;j<entries;j++){
- spinnit(spinbuf,entries-i);
- vqsp_count(b->valuelist,pointlist,dim,
- membership,reventry,
- entryindex,entries,
- pointindex,points,0,
- entryA,entryB,
- entryindex[i],entryindex[j],
- &entriesA,&entriesB,&entriesC);
- this=(entriesA-entriesC)*(entriesB-entriesC);
-
- /* when choosing best, we also want some form of stability to
- make sure more branches are pared later; secondary
- weighting isn;t needed as the entry lists are in ascending
- order, and we always try p/q in the same sequence */
-
- if( (besti==-1) ||
- (this>best) ){
-
- best=this;
- besti=entryindex[i];
- bestj=entryindex[j];
-
- }
- }
- }
- }else{
- float *p=alloca(dim*sizeof(float));
- float *q=alloca(dim*sizeof(float));
- float best=0.f;
-
- /* try COG/normal and furthest pairs */
- /* meanpoint */
- /* eventually, we want to select the closest entry and figure n/c
- from p/q (because storing n/c is too large */
- for(k=0;k<dim;k++){
- spinnit(spinbuf,entries);
-
- p[k]=0.f;
- for(j=0;j<entries;j++)
- p[k]+=b->valuelist[entryindex[j]*dim+k];
- p[k]/=entries;
-
- }
-
- /* we go through the entries one by one, looking for the entry on
- the other side closest to the point of reflection through the
- center */
-
- for(i=0;i<entries;i++){
- float *ppi=_Nnow(entryindex[i]);
- float ref_best=0.f;
- float ref_j=-1;
- float this;
- spinnit(spinbuf,entries-i);
-
- for(k=0;k<dim;k++)
- q[k]=2*p[k]-ppi[k];
-
- for(j=0;j<entries;j++){
- if(j!=i){
- float this=_Ndist(dim,q,_Nnow(entryindex[j]));
- if(ref_j==-1 || this<=ref_best){ /* <=, not <; very important */
- ref_best=this;
- ref_j=entryindex[j];
- }
- }
- }
-
- vqsp_count(b->valuelist,pointlist,dim,
- membership,reventry,
- entryindex,entries,
- pointindex,points,0,
- entryA,entryB,
- entryindex[i],ref_j,
- &entriesA,&entriesB,&entriesC);
- this=(entriesA-entriesC)*(entriesB-entriesC);
-
- /* when choosing best, we also want some form of stability to
- make sure more branches are pared later; secondary
- weighting isn;t needed as the entry lists are in ascending
- order, and we always try p/q in the same sequence */
-
- if( (besti==-1) ||
- (this>best) ){
-
- best=this;
- besti=entryindex[i];
- bestj=ref_j;
-
- }
- }
- if(besti>bestj){
- long temp=besti;
- besti=bestj;
- bestj=temp;
- }
-
- }
-
- /* find cells enclosing points */
- /* count A/B points */
-
- pointsA=vqsp_count(b->valuelist,pointlist,dim,
- membership,reventry,
- entryindex,entries,
- pointindex,points,1,
- entryA,entryB,
- besti,bestj,
- &entriesA,&entriesB,&entriesC);
-
- /* fprintf(stderr,"split: total=%ld depth=%ld set A=%ld:%ld:%ld=B\n",
- entries,depth,entriesA-entriesC,entriesC,entriesB-entriesC);*/
- {
- long thisaux=t->aux++;
- if(t->aux>=t->alloc){
- t->alloc*=2;
- t->ptr0=_ogg_realloc(t->ptr0,sizeof(long)*t->alloc);
- t->ptr1=_ogg_realloc(t->ptr1,sizeof(long)*t->alloc);
- t->p=_ogg_realloc(t->p,sizeof(long)*t->alloc);
- t->q=_ogg_realloc(t->q,sizeof(long)*t->alloc);
- }
-
- t->p[thisaux]=besti;
- t->q[thisaux]=bestj;
-
- if(entriesA==1){
- ret=1;
- t->ptr0[thisaux]=entryA[0];
- *pointsofar+=pointsA;
- }else{
- t->ptr0[thisaux]= -t->aux;
- ret=lp_split(pointlist,totalpoints,b,entryA,entriesA,pointindex,pointsA,
- membership,reventry,depth+1,pointsofar);
- }
- if(entriesB==1){
- ret++;
- t->ptr1[thisaux]=entryB[0];
- *pointsofar+=points-pointsA;
- }else{
- t->ptr1[thisaux]= -t->aux;
- ret+=lp_split(pointlist,totalpoints,b,entryB,entriesB,pointindex+pointsA,
- points-pointsA,membership,reventry,
- depth+1,pointsofar);
- }
- }
- free(entryA);
- free(entryB);
- return(ret);
-}
-
-static int _node_eq(encode_aux_nearestmatch *v, long a, long b){
- long Aptr0=v->ptr0[a];
- long Aptr1=v->ptr1[a];
- long Bptr0=v->ptr0[b];
- long Bptr1=v->ptr1[b];
-
- /* the possibility of choosing the same p and q, but switched, can;t
- happen because we always look for the best p/q in the same search
- order and the search is stable */
-
- if(Aptr0==Bptr0 && Aptr1==Bptr1)
- return(1);
-
- return(0);
-}
-
-void vqsp_book(vqgen *v, codebook *b, long *quantlist){
- long i,j;
- static_codebook *c=(static_codebook *)b->c;
- encode_aux_nearestmatch *t;
-
- memset(b,0,sizeof(codebook));
- memset(c,0,sizeof(static_codebook));
- b->c=c;
- t=c->nearest_tree=_ogg_calloc(1,sizeof(encode_aux_nearestmatch));
- c->maptype=2;
-
- /* make sure there are no duplicate entries and that every
- entry has points */
-
- for(i=0;i<v->entries;){
- /* duplicate? if so, eliminate */
- for(j=0;j<i;j++){
- if(_Ndist(v->elements,_now(v,i),_now(v,j))==0.f){
- fprintf(stderr,"found a duplicate entry! removing...\n");
- v->entries--;
- memcpy(_now(v,i),_now(v,v->entries),sizeof(float)*v->elements);
- memcpy(quantlist+i*v->elements,quantlist+v->entries*v->elements,
- sizeof(long)*v->elements);
- break;
- }
- }
- if(j==i)i++;
- }
-
- {
- v->assigned=_ogg_calloc(v->entries,sizeof(long));
- for(i=0;i<v->points;i++){
- float *ppt=_point(v,i);
- float firstmetric=_Ndist(v->elements,_now(v,0),ppt);
- long firstentry=0;
-
- if(!(i&0xff))spinnit("checking... ",v->points-i);
-
- for(j=0;j<v->entries;j++){
- float thismetric=_Ndist(v->elements,_now(v,j),ppt);
- if(thismetric<firstmetric){
- firstmetric=thismetric;
- firstentry=j;
- }
- }
-
- v->assigned[firstentry]++;
- }
-
- for(j=0;j<v->entries;){
- if(v->assigned[j]==0){
- fprintf(stderr,"found an unused entry! removing...\n");
- v->entries--;
- memcpy(_now(v,j),_now(v,v->entries),sizeof(float)*v->elements);
- v->assigned[j]=v->assigned[v->elements];
- memcpy(quantlist+j*v->elements,quantlist+v->entries*v->elements,
- sizeof(long)*v->elements);
- continue;
- }
- j++;
- }
- }
-
- fprintf(stderr,"Building a book with %ld unique entries...\n",v->entries);
-
- {
- long *entryindex=_ogg_malloc(v->entries*sizeof(long *));
- long *pointindex=_ogg_malloc(v->points*sizeof(long));
- long *membership=_ogg_malloc(v->points*sizeof(long));
- long *reventry=_ogg_malloc(v->entries*sizeof(long));
- long pointssofar=0;
-
- for(i=0;i<v->entries;i++)entryindex[i]=i;
- for(i=0;i<v->points;i++)pointindex[i]=i;
-
- t->alloc=4096;
- t->ptr0=_ogg_malloc(sizeof(long)*t->alloc);
- t->ptr1=_ogg_malloc(sizeof(long)*t->alloc);
- t->p=_ogg_malloc(sizeof(long)*t->alloc);
- t->q=_ogg_malloc(sizeof(long)*t->alloc);
- t->aux=0;
- c->dim=v->elements;
- c->entries=v->entries;
- c->lengthlist=_ogg_calloc(c->entries,sizeof(long));
- b->valuelist=v->entrylist; /* temporary; replaced later */
- b->dim=c->dim;
- b->entries=c->entries;
-
- for(i=0;i<v->points;i++)membership[i]=-1;
- for(i=0;i<v->points;i++){
- float *ppt=_point(v,i);
- long firstentry=0;
- float firstmetric=_Ndist(v->elements,_now(v,0),ppt);
-
- if(!(i&0xff))spinnit("assigning... ",v->points-i);
-
- for(j=1;j<v->entries;j++){
- if(v->assigned[j]!=-1){
- float thismetric=_Ndist(v->elements,_now(v,j),ppt);
- if(thismetric<=firstmetric){
- firstmetric=thismetric;
- firstentry=j;
- }
- }
- }
-
- membership[i]=firstentry;
- }
-
- fprintf(stderr,"Leaves added: %d \n",
- lp_split(v->pointlist,v->points,
- b,entryindex,v->entries,
- pointindex,v->points,
- membership,reventry,
- 0,&pointssofar));
-
- free(pointindex);
- free(membership);
- free(reventry);
-
- fprintf(stderr,"Paring/rerouting redundant branches... ");
-
- /* The tree is likely big and redundant. Pare and reroute branches */
- {
- int changedflag=1;
-
- while(changedflag){
- changedflag=0;
-
- /* span the tree node by node; list unique decision nodes and
- short circuit redundant branches */
-
- for(i=0;i<t->aux;){
- int k;
-
- /* check list of unique decisions */
- for(j=0;j<i;j++)
- if(_node_eq(t,i,j))break;
-
- if(j<i){
- /* a redundant entry; find all higher nodes referencing it and
- short circuit them to the previously noted unique entry */
- changedflag=1;
- for(k=0;k<t->aux;k++){
- if(t->ptr0[k]==-i)t->ptr0[k]=-j;
- if(t->ptr1[k]==-i)t->ptr1[k]=-j;
- }
-
- /* Now, we need to fill in the hole from this redundant
- entry in the listing. Insert the last entry in the list.
- Fix the forward pointers to that last entry */
- t->aux--;
- t->ptr0[i]=t->ptr0[t->aux];
- t->ptr1[i]=t->ptr1[t->aux];
- t->p[i]=t->p[t->aux];
- t->q[i]=t->q[t->aux];
- for(k=0;k<t->aux;k++){
- if(t->ptr0[k]==-t->aux)t->ptr0[k]=-i;
- if(t->ptr1[k]==-t->aux)t->ptr1[k]=-i;
- }
- /* hole plugged */
-
- }else
- i++;
- }
-
- fprintf(stderr,"\rParing/rerouting redundant branches... "
- "%ld remaining ",t->aux);
- }
- fprintf(stderr,"\n");
- }
- }
-
- /* run all training points through the decision tree to get a final
- probability count */
- {
- long *probability=_ogg_malloc(c->entries*sizeof(long));
- for(i=0;i<c->entries;i++)probability[i]=1; /* trivial guard */
- b->dim=c->dim;
-
- /* sigh. A necessary hack */
- for(i=0;i<t->aux;i++)t->p[i]*=c->dim;
- for(i=0;i<t->aux;i++)t->q[i]*=c->dim;
-
- for(i=0;i<v->points;i++){
- /* we use the linear matcher regardless becuase the trainer
- doesn't convert log to linear */
- int ret=_best(b,v->pointlist+i*v->elements,1);
- probability[ret]++;
- if(!(i&0xff))spinnit("counting hits... ",v->points-i);
- }
- for(i=0;i<t->aux;i++)t->p[i]/=c->dim;
- for(i=0;i<t->aux;i++)t->q[i]/=c->dim;
-
- build_tree_from_lengths(c->entries,probability,c->lengthlist);
-
- free(probability);
- }
-
- /* Sort the entries by codeword length, short to long (eases
- assignment and packing to do it now) */
- {
- long *wordlen=c->lengthlist;
- long *index=_ogg_malloc(c->entries*sizeof(long));
- long *revindex=_ogg_malloc(c->entries*sizeof(long));
- int k;
- for(i=0;i<c->entries;i++)index[i]=i;
- isortvals=c->lengthlist;
- qsort(index,c->entries,sizeof(long),iascsort);
-
- /* rearrange storage; ptr0/1 first as it needs a reverse index */
- /* n and c stay unchanged */
- for(i=0;i<c->entries;i++)revindex[index[i]]=i;
- for(i=0;i<t->aux;i++){
- if(!(i&0x3f))spinnit("sorting... ",t->aux-i);
-
- if(t->ptr0[i]>=0)t->ptr0[i]=revindex[t->ptr0[i]];
- if(t->ptr1[i]>=0)t->ptr1[i]=revindex[t->ptr1[i]];
- t->p[i]=revindex[t->p[i]];
- t->q[i]=revindex[t->q[i]];
- }
- free(revindex);
-
- /* map lengthlist and vallist with index */
- c->lengthlist=_ogg_calloc(c->entries,sizeof(long));
- b->valuelist=_ogg_malloc(sizeof(float)*c->entries*c->dim);
- c->quantlist=_ogg_malloc(sizeof(long)*c->entries*c->dim);
- for(i=0;i<c->entries;i++){
- long e=index[i];
- for(k=0;k<c->dim;k++){
- b->valuelist[i*c->dim+k]=v->entrylist[e*c->dim+k];
- c->quantlist[i*c->dim+k]=quantlist[e*c->dim+k];
- }
- c->lengthlist[i]=wordlen[e];
- }
-
- free(wordlen);
- }
-
- fprintf(stderr,"Done. \n\n");
-}
-
Deleted: trunk/vorbis/vq/vqsplit.h
===================================================================
--- trunk/vorbis/vq/vqsplit.h 2010-03-10 23:04:34 UTC (rev 16960)
+++ trunk/vorbis/vq/vqsplit.h 2010-03-11 07:15:40 UTC (rev 16961)
@@ -1,37 +0,0 @@
-/********************************************************************
- * *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
- * *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
- * by the Xiph.Org Foundation http://www.xiph.org/ *
- * *
- ********************************************************************
-
- function: build a VQ codebook decision tree
- last mod: $Id$
-
- ********************************************************************/
-
-#ifndef _VQSPL_H_
-#define _VQSPL_H_
-
-#include "codebook.h"
-
-extern void vqsp_book(vqgen *v,codebook *b,long *quantlist);
-extern int vqenc_entry(codebook *b,float *val);
-extern int lp_split(float *pointlist,long totalpoints,
- codebook *b,
- long *entryindex,long entries,
- long *pointindex,long points,
- long *membership,long *reventry,
- long depth, long *pointsofar);
-
-#endif
-
-
-
-
-
More information about the commits
mailing list