summaryrefslogtreecommitdiffhomepage
path: root/vorbis/vq
diff options
context:
space:
mode:
Diffstat (limited to 'vorbis/vq')
-rw-r--r--vorbis/vq/16.vqs74
-rw-r--r--vorbis/vq/16u.vqs69
-rw-r--r--vorbis/vq/44c-1.vqs63
-rw-r--r--vorbis/vq/44c0.vqs65
-rw-r--r--vorbis/vq/44c1.vqs66
-rw-r--r--vorbis/vq/44c2.vqs37
-rw-r--r--vorbis/vq/44c3.vqs36
-rw-r--r--vorbis/vq/44c4.vqs36
-rw-r--r--vorbis/vq/44c5.vqs37
-rw-r--r--vorbis/vq/44c6.vqs37
-rw-r--r--vorbis/vq/44c7.vqs38
-rw-r--r--vorbis/vq/44c8.vqs39
-rw-r--r--vorbis/vq/44c9.vqs37
-rw-r--r--vorbis/vq/44p-1.vqs49
-rw-r--r--vorbis/vq/44p0.vqs49
-rw-r--r--vorbis/vq/44p1.vqs49
-rw-r--r--vorbis/vq/44p2.vqs52
-rw-r--r--vorbis/vq/44p3.vqs52
-rw-r--r--vorbis/vq/44p4.vqs52
-rw-r--r--vorbis/vq/44p5.vqs52
-rw-r--r--vorbis/vq/44p6.vqs52
-rw-r--r--vorbis/vq/44p7.vqs52
-rw-r--r--vorbis/vq/44p8.vqs52
-rw-r--r--vorbis/vq/44p9.vqs52
-rw-r--r--vorbis/vq/44u0.vqs33
-rw-r--r--vorbis/vq/44u1.vqs33
-rw-r--r--vorbis/vq/44u2.vqs32
-rw-r--r--vorbis/vq/44u3.vqs33
-rw-r--r--vorbis/vq/44u4.vqs33
-rw-r--r--vorbis/vq/44u5.vqs35
-rw-r--r--vorbis/vq/44u6.vqs35
-rw-r--r--vorbis/vq/44u7.vqs34
-rw-r--r--vorbis/vq/44u8.vqs35
-rw-r--r--vorbis/vq/44u9.vqs36
-rw-r--r--vorbis/vq/8.vqs43
-rw-r--r--vorbis/vq/8u.vqs41
-rw-r--r--vorbis/vq/Makefile.am36
-rw-r--r--vorbis/vq/bookutil.c476
-rw-r--r--vorbis/vq/bookutil.h42
-rw-r--r--vorbis/vq/distribution.c247
-rw-r--r--vorbis/vq/floor_11.vqs10
-rw-r--r--vorbis/vq/floor_22.vqs27
-rw-r--r--vorbis/vq/floor_44.vqs83
-rw-r--r--vorbis/vq/huffbuild.c197
-rw-r--r--vorbis/vq/latticebuild.c176
-rw-r--r--vorbis/vq/latticetune.c163
-rw-r--r--vorbis/vq/localcodebook.h120
-rwxr-xr-xvorbis/vq/make_floor_books.pl108
-rwxr-xr-xvorbis/vq/make_residue_books.pl177
-rw-r--r--vorbis/vq/metrics.c294
-rw-r--r--vorbis/vq/vqgen.c566
-rw-r--r--vorbis/vq/vqgen.h84
52 files changed, 4426 insertions, 0 deletions
diff --git a/vorbis/vq/16.vqs b/vorbis/vq/16.vqs
new file mode 100644
index 0000000..3d15f40
--- /dev/null
+++ b/vorbis/vq/16.vqs
@@ -0,0 +1,74 @@
+
+GO
+
+>_16c0_s noninterleaved
+haux 16c0_s/resaux_0.vqd _16c0_s_single 0,64,2 10
+
+:_p1_0 16c0_s/res_sub0_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 16c0_s/res_sub0_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 16c0_s/res_sub0_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 16c0_s/res_sub0_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 16c0_s/res_sub0_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 16c0_s/res_sub0_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 16c0_s/res_sub0_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 16c0_s/res_sub0_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 16c0_s/res_sub0_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 16c0_s/res_sub0_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p9_0 16c0_s/res_sub0_part9_pass0.vqd, 4, nonseq, 0 +- 315
+:_p9_1 16c0_s/res_sub0_part9_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p9_2 16c0_s/res_sub0_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+>_16c1s_s noninterleaved
+haux 16c1_s/resaux_0.vqd _16c1_s_short 0,64,2 10
+
+>_16c1_s noninterleaved
+haux 16c1_s/resaux_1.vqd _16c1_s_long 0,64,2 10
+
+:_p1_0 16c1_s/res_sub0_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 16c1_s/res_sub0_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 16c1_s/res_sub0_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 16c1_s/res_sub0_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 16c1_s/res_sub0_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 16c1_s/res_sub0_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 16c1_s/res_sub0_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 16c1_s/res_sub0_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 16c1_s/res_sub0_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 16c1_s/res_sub0_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p9_0 16c1_s/res_sub0_part9_pass0.vqd, 2, nonseq, 0 +- 315 630 945 1260 1575 1890
+:_p9_1 16c1_s/res_sub0_part9_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p9_2 16c1_s/res_sub0_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+>_16c2s_s noninterleaved
+haux 16c2_s/resaux_0.vqd _16c2_s_short 0,64,2 10
+>_16c2_s noninterleaved
+haux 16c2_s/resaux_1.vqd _16c2_s_long 0,64,2 10
+
+:_p1_0 16c2_s/res_sub0_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 16c2_s/res_sub0_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 16c2_s/res_sub0_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 16c2_s/res_sub0_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p5_0 16c2_s/res_sub0_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 16c2_s/res_sub0_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p6_0 16c2_s/res_sub0_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 16c2_s/res_sub0_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 16c2_s/res_sub0_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 16c2_s/res_sub0_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 16c2_s/res_sub0_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 16c2_s/res_sub0_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 16c2_s/res_sub0_part9_pass0.vqd, 2, nonseq, 0 +- 931 1862 2793 3724 4655 5586 6517 7448
+:_p9_1 16c2_s/res_sub0_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 343 392 441
+:_p9_2 16c2_s/res_sub0_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
+
diff --git a/vorbis/vq/16u.vqs b/vorbis/vq/16u.vqs
new file mode 100644
index 0000000..854de98
--- /dev/null
+++ b/vorbis/vq/16u.vqs
@@ -0,0 +1,69 @@
+
+GO
+
+>_16u0_ noninterleaved
+haux 16u0/resaux_0.vqd _16u0__single 0,64,2 8
+
+:_p1_0 16u0/res_sub0_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 16u0/res_sub0_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 16u0/res_sub0_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 16u0/res_sub0_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 16u0/res_sub0_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p6_0 16u0/res_sub0_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 16u0/res_sub0_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 16u0/res_sub0_part7_pass0.vqd, 4, nonseq, 0 +- 315
+:_p7_1 16u0/res_sub0_part7_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p7_2 16u0/res_sub0_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+
+>_16u1s_ noninterleaved
+haux 16u1/resaux_0.vqd _16u1__short 0,64,2 10
+>_16u1_ noninterleaved
+haux 16u1/resaux_1.vqd _16u1__long 0,64,2 10
+
+:_p1_0 16u1/res_sub0_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 16u1/res_sub0_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 16u1/res_sub0_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 16u1/res_sub0_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 16u1/res_sub0_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 16u1/res_sub0_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p7_0 16u1/res_sub0_part7_pass0.vqd, 4, nonseq, 0 +- 11
+:_p7_1 16u1/res_sub0_part7_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p8_0 16u1/res_sub0_part8_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55
+:_p8_1 16u1/res_sub0_part8_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p9_0 16u1/res_sub0_part9_pass0.vqd, 2, nonseq, 0 +- 255 510 765 1020 1275 1530 1785
+:_p9_1 16u1/res_sub0_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 119
+:_p9_2 16u1/res_sub0_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
+>_16u2s noninterleaved
+haux 16u2/resaux_0.vqd _16u2__short 0,16,2 10
+
+>_16u2 noninterleaved
+haux 16u2/resaux_1.vqd _16u2__long 0,64,2 10
+
+:_p1_0 16u2/res_sub0_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 16u2/res_sub0_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 16u2/res_sub0_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 16u2/res_sub0_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p5_0 16u2/res_sub0_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 16u2/res_sub0_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p6_0 16u2/res_sub0_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 16u2/res_sub0_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 16u2/res_sub0_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 16u2/res_sub0_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 16u2/res_sub0_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 16u2/res_sub0_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 16u2/res_sub0_part9_pass0.vqd, 2, nonseq, 0 +- 931 1862 2793 3724 4655 5586 6517
+:_p9_1 16u2/res_sub0_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 343 392 441
+:_p9_2 16u2/res_sub0_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
+
diff --git a/vorbis/vq/44c-1.vqs b/vorbis/vq/44c-1.vqs
new file mode 100644
index 0000000..ff30d65
--- /dev/null
+++ b/vorbis/vq/44c-1.vqs
@@ -0,0 +1,63 @@
+GO
+
+>_44cn1s_s noninterleaved
+haux 44c-1_s/resaux_0.vqd _44cn1_s_short 0,16,2 9
+
+>_44cn1_s noninterleaved
+haux 44c-1_s/resaux_1.vqd _44cn1_s_long 0,64,2 9
+
+# 0 1 2 2 4 8 16 32 +
+# 0 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8
+# 1 . . .
+# 2 . . .
+# 4 . . . . . .
+
+:_p1_0 44c-1_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c-1_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c-1_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c-1_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c-1_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p6_0 44c-1_s/res_part6_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p6_1 44c-1_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p7_0 44c-1_s/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p7_1 44c-1_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p8_0 44c-1_s/res_part8_pass0.vqd, 4, nonseq, 0 +- 221 442
+:_p8_1 44c-1_s/res_part8_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102
+:_p8_2 44c-1_s/res_part8_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
+
+>_44cn1s_sm noninterleaved
+haux 44c-1_sm/resaux_0.vqd _44cn1_sm_short 0,16,2 9
+
+>_44cn1_sm noninterleaved
+haux 44c-1_sm/resaux_1.vqd _44cn1_sm_long 0,64,2 9
+
+# 0 1 2 2 4 8 16 32 +
+# 0 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8
+# 1 . . .
+# 2 . . .
+# 4 . . . . . .
+
+:_p1_0 44c-1_sm/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c-1_sm/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c-1_sm/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c-1_sm/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c-1_sm/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p6_0 44c-1_sm/res_part6_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p6_1 44c-1_sm/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p7_0 44c-1_sm/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p7_1 44c-1_sm/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p8_0 44c-1_sm/res_part8_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884
+:_p8_1 44c-1_sm/res_part8_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102
+:_p8_2 44c-1_sm/res_part8_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
diff --git a/vorbis/vq/44c0.vqs b/vorbis/vq/44c0.vqs
new file mode 100644
index 0000000..f650f8f
--- /dev/null
+++ b/vorbis/vq/44c0.vqs
@@ -0,0 +1,65 @@
+GO
+
+>_44c0s_s noninterleaved
+haux 44c0_s/resaux_0.vqd _44c0_s_short 0,16,2 9
+
+>_44c0_s noninterleaved
+haux 44c0_s/resaux_1.vqd _44c0_s_long 0,64,2 9
+
+# 0 1 2 2 4 8 16 32 +
+# 0 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8
+# 1 . . .
+# 2 . . .
+# 4 . . . . . .
+
+:_p1_0 44c0_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c0_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c0_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c0_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c0_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p6_0 44c0_s/res_part6_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p6_1 44c0_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p7_0 44c0_s/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p7_1 44c0_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p8_0 44c0_s/res_part8_pass0.vqd, 4, nonseq, 0 +- 221 442
+:_p8_1 44c0_s/res_part8_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102
+:_p8_2 44c0_s/res_part8_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
+
+>_44c0s_sm noninterleaved
+haux 44c0_sm/resaux_0.vqd _44c0_sm_short 0,16,2 9
+
+>_44c0_sm noninterleaved
+haux 44c0_sm/resaux_1.vqd _44c0_sm_long 0,64,2 9
+
+# 0 1 2 2 4 8 16 32 +
+# 0 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8
+# 1 . . .
+# 2 . . .
+# 4 . . . . . .
+
+:_p1_0 44c0_sm/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c0_sm/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c0_sm/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c0_sm/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c0_sm/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p6_0 44c0_sm/res_part6_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p6_1 44c0_sm/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p7_0 44c0_sm/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p7_1 44c0_sm/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p8_0 44c0_sm/res_part8_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884
+:_p8_1 44c0_sm/res_part8_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102
+:_p8_2 44c0_sm/res_part8_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
diff --git a/vorbis/vq/44c1.vqs b/vorbis/vq/44c1.vqs
new file mode 100644
index 0000000..c21a6b3
--- /dev/null
+++ b/vorbis/vq/44c1.vqs
@@ -0,0 +1,66 @@
+
+GO
+
+>_44c1s_s noninterleaved
+haux 44c1_s/resaux_0.vqd _44c1_s_short 0,16,2 9
+
+>_44c1_s noninterleaved
+haux 44c1_s/resaux_1.vqd _44c1_s_long 0,64,2 9
+
+# 0 1 2 2 4 8 16 32 +
+# 0 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8
+# 1 . . .
+# 2 . . .
+# 4 . . . . . .
+
+:_p1_0 44c1_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c1_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c1_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c1_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c1_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p6_0 44c1_s/res_part6_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p6_1 44c1_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p7_0 44c1_s/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p7_1 44c1_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p8_0 44c1_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326
+:_p8_1 44c1_s/res_part8_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102
+:_p8_2 44c1_s/res_part8_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
+
+>_44c1s_sm noninterleaved
+haux 44c1_sm/resaux_0.vqd _44c1_sm_short 0,16,2 9
+
+>_44c1_sm noninterleaved
+haux 44c1_sm/resaux_1.vqd _44c1_sm_long 0,64,2 9
+
+# 0 1 2 2 4 8 16 32 +
+# 0 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8
+# 1 . . .
+# 2 . . .
+# 4 . . . . . .
+
+:_p1_0 44c1_sm/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c1_sm/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c1_sm/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c1_sm/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c1_sm/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p6_0 44c1_sm/res_part6_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p6_1 44c1_sm/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p7_0 44c1_sm/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p7_1 44c1_sm/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p8_0 44c1_sm/res_part8_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326
+:_p8_1 44c1_sm/res_part8_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102
+:_p8_2 44c1_sm/res_part8_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
diff --git a/vorbis/vq/44c2.vqs b/vorbis/vq/44c2.vqs
new file mode 100644
index 0000000..9fdbd03
--- /dev/null
+++ b/vorbis/vq/44c2.vqs
@@ -0,0 +1,37 @@
+GO
+
+>_44c2s_s noninterleaved
+haux 44c2_s/resaux_0.vqd _44c2_s_short 0,16,2 10
+
+>_44c2_s noninterleaved
+haux 44c2_s/resaux_1.vqd _44c2_s_long 0,64,2 10
+
+#iter 0
+
+# 0 1 1 2 2 4 8 16 32 +
+# 0 99 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . .
+# 2 . . .
+# 4 . . . . . . .
+
+:_p1_0 44c2_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c2_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c2_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c2_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c2_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c2_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c2_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c2_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c2_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c2_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p9_0 44c2_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326
+:_p9_1 44c2_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102
+:_p9_2 44c2_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
+ \ No newline at end of file
diff --git a/vorbis/vq/44c3.vqs b/vorbis/vq/44c3.vqs
new file mode 100644
index 0000000..57a1317
--- /dev/null
+++ b/vorbis/vq/44c3.vqs
@@ -0,0 +1,36 @@
+
+GO
+
+>_44c3s_s noninterleaved
+haux 44c3_s/resaux_0.vqd _44c3_s_short 0,16,2 10
+
+>_44c3_s noninterleaved
+haux 44c3_s/resaux_1.vqd _44c3_s_long 0,64,2 10
+
+#iter 0
+
+# 0 1 1 2 2 4 8 16 32 +
+# 0 99 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . .
+# 2 . . .
+# 4 . . . . . . .
+
+:_p1_0 44c3_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c3_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c3_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c3_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c3_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c3_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c3_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c3_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c3_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c3_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p9_0 44c3_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 255 510 765 1020 1275 1530
+:_p9_1 44c3_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 119
+:_p9_2 44c3_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
diff --git a/vorbis/vq/44c4.vqs b/vorbis/vq/44c4.vqs
new file mode 100644
index 0000000..82a36e1
--- /dev/null
+++ b/vorbis/vq/44c4.vqs
@@ -0,0 +1,36 @@
+
+GO
+
+>_44c4s_s noninterleaved
+haux 44c4_s/resaux_0.vqd _44c4_s_short 0,16,2 10
+
+>_44c4_s noninterleaved
+haux 44c4_s/resaux_1.vqd _44c4_s_long 0,64,2 10
+
+#iter 0
+
+# 0 1 1 2 2 4 8 16 32 +
+# 0 99 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . .
+# 2 . . .
+# 4 . . . . . . .
+
+:_p1_0 44c4_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c4_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c4_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c4_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c4_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c4_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c4_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c4_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c4_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c4_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p9_0 44c4_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 315 630 945 1260 1575 1890
+:_p9_1 44c4_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p9_2 44c4_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
diff --git a/vorbis/vq/44c5.vqs b/vorbis/vq/44c5.vqs
new file mode 100644
index 0000000..9790843
--- /dev/null
+++ b/vorbis/vq/44c5.vqs
@@ -0,0 +1,37 @@
+
+GO
+
+>_44c5s_s noninterleaved
+haux 44c5_s/resaux_0.vqd _44c5_s_short 0,16,2 10
+
+>_44c5_s noninterleaved
+haux 44c5_s/resaux_1.vqd _44c5_s_long 0,64,2 10
+
+#iter 0
+
+# 0 1 1 2 2 4 8 16 32 +
+# 0 99 0 99 4 8 16 32 +
+
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . .
+# 2 . . .
+# 4 . . . . . . .
+
+:_p1_0 44c5_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 44c5_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c5_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44c5_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 44c5_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44c5_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 44c5_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 44c5_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c5_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 44c5_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p9_0 44c5_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 357 714 1071 1428 1785 2142 2499
+:_p9_1 44c5_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147 168
+:_p9_2 44c5_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
+
diff --git a/vorbis/vq/44c6.vqs b/vorbis/vq/44c6.vqs
new file mode 100644
index 0000000..f420dd0
--- /dev/null
+++ b/vorbis/vq/44c6.vqs
@@ -0,0 +1,37 @@
+GO
+
+>_44c6s_s noninterleaved
+haux 44c6_s/resaux_0.vqd _44c6_s_short 0,16,2 10
+
+>_44c6_s noninterleaved
+haux 44c6_s/resaux_1.vqd _44c6_s_long 0,64,2 10
+
+
+# 0 1 2 4 8 16 32 71 157 +
+# 1 2 3 4 8 16 71 157 +
+
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . . . .
+# 2 . . . . .
+# 4 . . . . .
+
+:_p1_0 44c6_s/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44c6_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c6_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c6_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p5_0 44c6_s/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44c6_s/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p6_0 44c6_s/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44c6_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44c6_s/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44c6_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c6_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44c6_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 44c6_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548 3185 3822
+:_p9_1 44c6_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
+:_p9_2 44c6_s/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
diff --git a/vorbis/vq/44c7.vqs b/vorbis/vq/44c7.vqs
new file mode 100644
index 0000000..088d81d
--- /dev/null
+++ b/vorbis/vq/44c7.vqs
@@ -0,0 +1,38 @@
+
+GO
+
+>_44c7s_s noninterleaved
+haux 44c7_s/resaux_0.vqd _44c7_s_short 0,16,2 10
+
+>_44c7_s noninterleaved
+haux 44c7_s/resaux_1.vqd _44c7_s_long 0,64,2 10
+
+
+# 0 1 2 4 8 16 32 71 157 +
+# 1 2 3 4 8 16 71 157 +
+
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . . . .
+# 2 . . . . .
+# 4 . . . . .
+
+:_p1_0 44c7_s/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44c7_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c7_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c7_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p5_0 44c7_s/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44c7_s/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p6_0 44c7_s/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44c7_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44c7_s/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44c7_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c7_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44c7_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 44c7_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548 3185 3822
+:_p9_1 44c7_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
+:_p9_2 44c7_s/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
diff --git a/vorbis/vq/44c8.vqs b/vorbis/vq/44c8.vqs
new file mode 100644
index 0000000..ce5bdbe
--- /dev/null
+++ b/vorbis/vq/44c8.vqs
@@ -0,0 +1,39 @@
+
+GO
+
+>_44c8s_s noninterleaved
+haux 44c8_s/resaux_0.vqd _44c8_s_short 0,16,2 10
+
+>_44c8_s noninterleaved
+haux44c8_s/resaux_1.vqd _44c8_s_long 0,64,2 10
+
+
+# 0 1 2 4 8 16 32 71 157 +
+# 1 2 3 4 8 16 71 157 +
+
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . . . .
+# 2 . . . . .
+# 4 . . . . .
+
+:_p1_0 44c8_s/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44c8_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c8_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c8_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p5_0 44c8_s/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44c8_s/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p6_0 44c8_s/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44c8_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44c8_s/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44c8_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c8_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44c8_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 44c8_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 931 1862 2793 3724 4655 5586 6517 7448
+:_p9_1 44c8_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 343 392 441
+:_p9_2 44c8_s/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
+
diff --git a/vorbis/vq/44c9.vqs b/vorbis/vq/44c9.vqs
new file mode 100644
index 0000000..1c54786
--- /dev/null
+++ b/vorbis/vq/44c9.vqs
@@ -0,0 +1,37 @@
+GO
+
+>_44c9s_s noninterleaved
+haux 44c9_s/resaux_0.vqd _44c9_s_short 0,16,2 10
+
+>_44c9_s noninterleaved
+haux 44c9_s/resaux_1.vqd _44c9_s_long 0,64,2 10
+
+
+# 0 1 2 4 8 16 32 71 157 +
+# 1 2 3 4 8 16 71 157 +
+
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . . . .
+# 2 . . . . .
+# 4 . . . . .
+
+:_p1_0 44c9_s/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44c9_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44c9_s/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44c9_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p5_0 44c9_s/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44c9_s/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p6_0 44c9_s/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44c9_s/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44c9_s/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44c9_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44c9_s/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44c9_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 44c9_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 931 1862 2793 3724 4655 5586 6517 7448 8379
+:_p9_1 44c9_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 343 392 441
+:_p9_2 44c9_s/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
diff --git a/vorbis/vq/44p-1.vqs b/vorbis/vq/44p-1.vqs
new file mode 100644
index 0000000..02d26fb
--- /dev/null
+++ b/vorbis/vq/44p-1.vqs
@@ -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
diff --git a/vorbis/vq/44p0.vqs b/vorbis/vq/44p0.vqs
new file mode 100644
index 0000000..16479ba
--- /dev/null
+++ b/vorbis/vq/44p0.vqs
@@ -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
diff --git a/vorbis/vq/44p1.vqs b/vorbis/vq/44p1.vqs
new file mode 100644
index 0000000..74352c3
--- /dev/null
+++ b/vorbis/vq/44p1.vqs
@@ -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
diff --git a/vorbis/vq/44p2.vqs b/vorbis/vq/44p2.vqs
new file mode 100644
index 0000000..7eabbab
--- /dev/null
+++ b/vorbis/vq/44p2.vqs
@@ -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
diff --git a/vorbis/vq/44p3.vqs b/vorbis/vq/44p3.vqs
new file mode 100644
index 0000000..b1c66a6
--- /dev/null
+++ b/vorbis/vq/44p3.vqs
@@ -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
diff --git a/vorbis/vq/44p4.vqs b/vorbis/vq/44p4.vqs
new file mode 100644
index 0000000..4b70436
--- /dev/null
+++ b/vorbis/vq/44p4.vqs
@@ -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
diff --git a/vorbis/vq/44p5.vqs b/vorbis/vq/44p5.vqs
new file mode 100644
index 0000000..0372321
--- /dev/null
+++ b/vorbis/vq/44p5.vqs
@@ -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
diff --git a/vorbis/vq/44p6.vqs b/vorbis/vq/44p6.vqs
new file mode 100644
index 0000000..9daad60
--- /dev/null
+++ b/vorbis/vq/44p6.vqs
@@ -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
diff --git a/vorbis/vq/44p7.vqs b/vorbis/vq/44p7.vqs
new file mode 100644
index 0000000..9ec5d02
--- /dev/null
+++ b/vorbis/vq/44p7.vqs
@@ -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
diff --git a/vorbis/vq/44p8.vqs b/vorbis/vq/44p8.vqs
new file mode 100644
index 0000000..a75af84
--- /dev/null
+++ b/vorbis/vq/44p8.vqs
@@ -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
diff --git a/vorbis/vq/44p9.vqs b/vorbis/vq/44p9.vqs
new file mode 100644
index 0000000..4c00780
--- /dev/null
+++ b/vorbis/vq/44p9.vqs
@@ -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
diff --git a/vorbis/vq/44u0.vqs b/vorbis/vq/44u0.vqs
new file mode 100644
index 0000000..5bc3f60
--- /dev/null
+++ b/vorbis/vq/44u0.vqs
@@ -0,0 +1,33 @@
+GO
+
+>_44u0_ noninterleaved
+haux 44u0/resaux_0.vqd _44u0__short 0,16,2 8
+
+>_44u0_ noninterleaved
+haux 44u0/resaux_1.vqd _44u0__long 0,64,2 8
+
+#iter 0
+
+
+
+# 0 1 1 2 2 4 32 +
+# 25 0 45 0 0 0 0
+#
+# 0 1 2 3 4 5 6 7
+# 1 . .
+# 2 . .
+# 4 . . . . . .
+
+:_p1_0 44u0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u0/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 44u0/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44u0/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 44u0/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p6_0 44u0/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44u0/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44u0/res_part7_pass0.vqd, 4, nonseq, 0 +- 169 338
+:_p7_1 44u0/res_part7_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78
+:_p7_2 44u0/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
+
diff --git a/vorbis/vq/44u1.vqs b/vorbis/vq/44u1.vqs
new file mode 100644
index 0000000..ed19dc6
--- /dev/null
+++ b/vorbis/vq/44u1.vqs
@@ -0,0 +1,33 @@
+GO
+
+>_44u1_ noninterleaved
+haux 44u1/resaux_0.vqd _44u1__short 0,16,2 8
+
+>_44u1_ noninterleaved
+haux 44u1/resaux_1.vqd _44u1__long 0,64,2 8
+
+#iter 0
+
+
+
+# 0 1 1 2 2 4 32 +
+# 25 0 45 0 0 0 0
+#
+# 0 1 2 3 4 5 6 7
+# 1 . .
+# 2 . .
+# 4 . . . . . .
+
+:_p1_0 44u1/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u1/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 44u1/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44u1/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 44u1/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p6_0 44u1/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44u1/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44u1/res_part7_pass0.vqd, 2, nonseq, 0 +- 169 338 507
+:_p7_1 44u1/res_part7_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78
+:_p7_2 44u1/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
+
diff --git a/vorbis/vq/44u2.vqs b/vorbis/vq/44u2.vqs
new file mode 100644
index 0000000..314461e
--- /dev/null
+++ b/vorbis/vq/44u2.vqs
@@ -0,0 +1,32 @@
+GO
+
+>_44u2_ noninterleaved
+haux 44u2/resaux_0.vqd _44u2__short 0,16,2 8
+
+>_44u2_ noninterleaved
+haux 44u2/resaux_1.vqd _44u2__long 0,64,2 8
+
+#iter 0
+
+
+
+# 0 1 1 2 2 4 32 +
+# 25 0 45 0 0 0 0
+#
+# 0 1 2 3 4 5 6 7
+# 1 . .
+# 2 . .
+# 4 . . . . . .
+
+:_p1_0 44u2/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u2/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 44u2/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44u2/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 44u2/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p6_0 44u2/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44u2/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44u2/res_part7_pass0.vqd, 2, nonseq, 0 +- 169 338 507 676
+:_p7_1 44u2/res_part7_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78
+:_p7_2 44u2/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6
diff --git a/vorbis/vq/44u3.vqs b/vorbis/vq/44u3.vqs
new file mode 100644
index 0000000..c882109
--- /dev/null
+++ b/vorbis/vq/44u3.vqs
@@ -0,0 +1,33 @@
+
+GO
+
+>_44u3_ noninterleaved
+haux 44u3/resaux_0.vqd _44u3__short 0,16,2 8
+
+>_44u3_ noninterleaved
+haux 44u3/resaux_1.vqd _44u3__long 0,64,2 8
+
+#iter 0
+
+
+
+# 0 1 1 2 2 4 32 +
+# 25 0 45 0 0 0 0
+#
+# 0 1 2 3 4 5 6 7
+# 1 . .
+# 2 . .
+# 4 . . . . . .
+
+:_p1_0 44u3/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u3/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 44u3/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44u3/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 44u3/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p6_0 44u3/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44u3/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44u3/res_part7_pass0.vqd, 2, nonseq, 0 +- 255 510 765 1020
+:_p7_1 44u3/res_part7_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 119
+:_p7_2 44u3/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
diff --git a/vorbis/vq/44u4.vqs b/vorbis/vq/44u4.vqs
new file mode 100644
index 0000000..cb4d9ba
--- /dev/null
+++ b/vorbis/vq/44u4.vqs
@@ -0,0 +1,33 @@
+
+GO
+
+>_44u4_ noninterleaved
+haux 44u4/resaux_0.vqd _44u4__short 0,16,2 8
+
+>_44u4_ noninterleaved
+haux 44u4/resaux_1.vqd _44u4__long 0,64,2 8
+
+#iter 0
+
+
+
+# 0 1 1 2 2 4 32 +
+# 25 0 45 0 0 0 0
+#
+# 0 1 2 3 4 5 6 7
+# 1 . .
+# 2 . .
+# 4 . . . . . .
+
+:_p1_0 44u4/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u4/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 44u4/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44u4/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 44u4/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p6_0 44u4/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44u4/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44u4/res_part7_pass0.vqd, 2, nonseq, 0 +- 255 510 765 1020 1275 1530
+:_p7_1 44u4/res_part7_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 119
+:_p7_2 44u4/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
diff --git a/vorbis/vq/44u5.vqs b/vorbis/vq/44u5.vqs
new file mode 100644
index 0000000..a3c175d
--- /dev/null
+++ b/vorbis/vq/44u5.vqs
@@ -0,0 +1,35 @@
+
+GO
+
+>_44u5_ noninterleaved
+haux 44u5/resaux_0.vqd _44u5__short 0,16,2 10
+
+>_44u5_ noninterleaved
+haux 44u5/resaux_1.vqd _44u5__long 0,64,2 10
+
+#iter 0
+
+# 0 1 1 2 2 4 4 16 60 +
+# 30 0 50 0 80 0 0 0
+#
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . .
+# 2 . . .
+# 4 . . . . . . .
+
+:_p1_0 44u5/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u5/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 44u5/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44u5/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 44u5/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44u5/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p7_0 44u5/res_part7_pass0.vqd, 4, nonseq, 0 +- 11
+:_p7_1 44u5/res_part7_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p8_0 44u5/res_part8_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55
+:_p8_1 44u5/res_part8_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p9_0 44u5/res_part9_pass0.vqd, 2, nonseq, 0 +- 255 510 765 1020 1275 1530
+:_p9_1 44u5/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 119
+:_p9_2 44u5/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
diff --git a/vorbis/vq/44u6.vqs b/vorbis/vq/44u6.vqs
new file mode 100644
index 0000000..ca8b7b1
--- /dev/null
+++ b/vorbis/vq/44u6.vqs
@@ -0,0 +1,35 @@
+
+GO
+
+>_44u6_ noninterleaved
+haux 44u6/resaux_0.vqd _44u6__short 0,16,2 10
+
+>_44u6_ noninterleaved
+haux 44u6/resaux_1.vqd _44u6__long 0,64,2 10
+
+#iter 0
+
+# 0 1 1 2 2 4 4 16 60 +
+# 30 0 50 0 80 0 0 0
+#
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . .
+# 2 . . .
+# 4 . . . . . . .
+
+:_p1_0 44u6/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u6/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 44u6/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44u6/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 44u6/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44u6/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p7_0 44u6/res_part7_pass0.vqd, 4, nonseq, 0 +- 11
+:_p7_1 44u6/res_part7_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p8_0 44u6/res_part8_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55
+:_p8_1 44u6/res_part8_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p9_0 44u6/res_part9_pass0.vqd, 2, nonseq, 0 +- 255 510 765 1020 1275 1530 1785
+:_p9_1 44u6/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 119
+:_p9_2 44u6/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
diff --git a/vorbis/vq/44u7.vqs b/vorbis/vq/44u7.vqs
new file mode 100644
index 0000000..2efe5aa
--- /dev/null
+++ b/vorbis/vq/44u7.vqs
@@ -0,0 +1,34 @@
+GO
+
+>_44u7_ noninterleaved
+haux 44u7/resaux_0.vqd _44u7__short 0,16,2 10
+
+>_44u7_ noninterleaved
+haux 44u7/resaux_1.vqd _44u7__long 0,64,2 10
+
+#iter 0
+
+# 0 1 1 2 2 4 4 16 60 +
+# 30 0 50 0 80 0 0 0
+#
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . .
+# 2 . . .
+# 4 . . . . . . .
+
+:_p1_0 44u7/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u7/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 44u7/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 44u7/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 44u7/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 44u7/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p7_0 44u7/res_part7_pass0.vqd, 4, nonseq, 0 +- 11
+:_p7_1 44u7/res_part7_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p8_0 44u7/res_part8_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55
+:_p8_1 44u7/res_part8_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p9_0 44u7/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 2548 3185
+:_p9_1 44u7/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294
+:_p9_2 44u7/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
diff --git a/vorbis/vq/44u8.vqs b/vorbis/vq/44u8.vqs
new file mode 100644
index 0000000..ecedb09
--- /dev/null
+++ b/vorbis/vq/44u8.vqs
@@ -0,0 +1,35 @@
+GO
+
+>_44u8s noninterleaved
+haux 44u8/resaux_0.vqd _44u8__short 0,16,2 10
+
+>_44u8 noninterleaved
+haux 44u8/resaux_1.vqd _44u8__long 0,64,2 10
+
+
+# 0 1 2 4 8 16 32 71 157 +
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . . . .
+# 2 . . . . .
+# 4 . . . . .
+
+:_p1_0 44u8/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u8/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44u8/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44u8/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p5_0 44u8/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44u8/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p6_0 44u8/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44u8/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44u8/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44u8/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44u8/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44u8/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 44u8/res_part9_pass0.vqd, 2, nonseq, 0 +- 931 1862 2793 3724
+:_p9_1 44u8/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 343 392 441
+:_p9_2 44u8/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
diff --git a/vorbis/vq/44u9.vqs b/vorbis/vq/44u9.vqs
new file mode 100644
index 0000000..42a3877
--- /dev/null
+++ b/vorbis/vq/44u9.vqs
@@ -0,0 +1,36 @@
+
+GO
+
+>_44u9s noninterleaved
+haux 44u9/resaux_0.vqd _44u9__short 0,16,2 10
+
+>_44u9 noninterleaved
+haux 44u9/resaux_1.vqd _44u9__long 0,64,2 10
+
+
+# 0 1 2 4 8 16 32 71 157 +
+# 0 1 2 3 4 5 6 7 8 9
+# 1 . . . . .
+# 2 . . . . .
+# 4 . . . . .
+
+:_p1_0 44u9/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 44u9/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 44u9/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p4_0 44u9/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+:_p5_0 44u9/res_part5_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p5_1 44u9/res_part5_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p6_0 44u9/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 44u9/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 44u9/res_part7_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55 66
+:_p7_1 44u9/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 44u9/res_part8_pass0.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p8_1 44u9/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+:_p9_0 44u9/res_part9_pass0.vqd, 2, nonseq, 0 +- 931 1862 2793 3724 4655 5586 6517
+:_p9_1 44u9/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 343 392 441
+:_p9_2 44u9/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
diff --git a/vorbis/vq/8.vqs b/vorbis/vq/8.vqs
new file mode 100644
index 0000000..517a589
--- /dev/null
+++ b/vorbis/vq/8.vqs
@@ -0,0 +1,43 @@
+GO
+
+>_8c0_s noninterleaved
+haux 8c0_s/resaux_0.vqd _8c0_s_single 0,64,2 10
+
+:_p1_0 8c0_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 8c0_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 8c0_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 8c0_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 8c0_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 8c0_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 8c0_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 8c0_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 8c0_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 8c0_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p9_0 8c0_s/res_part9_pass0.vqd, 4, nonseq, 0 +- 315
+:_p9_1 8c0_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p9_2 8c0_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+>_8c1_s noninterleaved
+haux 8c1_s/resaux_0.vqd _8c1_s_single 0,64,2 10
+
+:_p1_0 8c1_s/res_part1_pass2.vqd, 8, nonseq cull, 0 +- 1
+:_p2_0 8c1_s/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p3_0 8c1_s/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 8c1_s/res_part4_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p5_0 8c1_s/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 8c1_s/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8
+
+
+:_p7_0 8c1_s/res_part7_pass0.vqd, 4, nonseq cull, 0 +- 11
+:_p7_1 8c1_s/res_part7_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5
+
+:_p8_0 8c1_s/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p8_1 8c1_s/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p9_0 8c1_s/res_part9_pass0.vqd, 2, nonseq, 0 +- 315 630 945 1260 1575 1890
+:_p9_1 8c1_s/res_part9_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p9_2 8c1_s/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
diff --git a/vorbis/vq/8u.vqs b/vorbis/vq/8u.vqs
new file mode 100644
index 0000000..0ed0ec8
--- /dev/null
+++ b/vorbis/vq/8u.vqs
@@ -0,0 +1,41 @@
+
+GO
+
+>_8u0_ noninterleaved
+haux 8u0/resaux_0.vqd _8u0__single 0,64,2 8
+
+
+:_p1_0 8u0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 8u0/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 8u0/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 8u0/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 8u0/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p6_0 8u0/res_part6_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30
+:_p6_1 8u0/res_part6_pass1.vqd, 2, nonseq cull, 0 +- 1 2
+
+:_p7_0 8u0/res_part7_pass0.vqd, 4, nonseq, 0 +- 315
+:_p7_1 8u0/res_part7_pass1.vqd, 2, nonseq, 0 +- 21 42 63 84 105 126 147
+:_p7_2 8u0/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10
+
+
+>_8u1_ noninterleaved
+haux 8u1/resaux_0.vqd _8u1__single 0,64,2 10
+
+:_p1_0 8u1/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p2_0 8u1/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1
+:_p3_0 8u1/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p4_0 8u1/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2
+:_p5_0 8u1/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+:_p6_0 8u1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4
+
+:_p7_0 8u1/res_part7_pass0.vqd, 4, nonseq, 0 +- 11
+:_p7_1 8u1/res_part7_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p8_0 8u1/res_part8_pass0.vqd, 2, nonseq, 0 +- 11 22 33 44 55
+:_p8_1 8u1/res_part8_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5
+
+:_p9_0 8u1/res_part9_pass0.vqd, 2, nonseq, 0 +- 255 510 765 1020 1275 1530 1785
+:_p9_1 8u1/res_part9_pass1.vqd, 2, nonseq, 0 +- 17 34 51 68 85 102 119
+:_p9_2 8u1/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8
+
diff --git a/vorbis/vq/Makefile.am b/vorbis/vq/Makefile.am
new file mode 100644
index 0000000..e9c272e
--- /dev/null
+++ b/vorbis/vq/Makefile.am
@@ -0,0 +1,36 @@
+## Process this file with automake to produce Makefile.in
+
+EXTRA_PROGRAMS = latticebuild latticetune huffbuild distribution
+CLEANFILES = $(EXTRA_PROGRAMS)
+
+AM_CPPFLAGS = -I../lib -I$(top_srcdir)/include @OGG_CFLAGS@
+AM_LDFLAGS = -static
+LDADD = ../lib/libvorbis.la
+
+latticebuild_SOURCES = latticebuild.c vqgen.c bookutil.c\
+ vqgen.h bookutil.h localcodebook.h
+latticetune_SOURCES = latticetune.c vqgen.c bookutil.c\
+ vqgen.h bookutil.h localcodebook.h
+huffbuild_SOURCES = huffbuild.c vqgen.c bookutil.c\
+ vqgen.h bookutil.h localcodebook.h
+distribution_SOURCES = distribution.c bookutil.c\
+ bookutil.h localcodebook.h
+
+vqs_files = 16.vqs 16u.vqs 44c-1.vqs 44c0.vqs 44c1.vqs 44c2.vqs \
+ 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 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) make_floor_books.pl make_residue_books.pl \
+ metrics.c
+
+debugvq:
+ $(MAKE) vq CFLAGS="@DEBUG@"
+
+profilevq:
+ $(MAKE) vq CFLAGS="@PROFILE@"
+
+vq:
+ $(MAKE) $(EXTRA_PROGRAMS)
diff --git a/vorbis/vq/bookutil.c b/vorbis/vq/bookutil.c
new file mode 100644
index 0000000..3046410
--- /dev/null
+++ b/vorbis/vq/bookutil.c
@@ -0,0 +1,476 @@
+/********************************************************************
+ * *
+ * 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-2014 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: utility functions for loading .vqh and .vqd files
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include "bookutil.h"
+
+int _best(codebook *book, float *a, int step){
+
+ int dim=book->dim;
+ int i,j,o;
+ int minval=book->minval;
+ int del=book->delta;
+ int qv=book->quantvals;
+ int ze=(qv>>1);
+ int index=0;
+ /* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */
+
+ if(del!=1){
+ for(i=0,o=step*(dim-1);i<dim;i++,o-=step){
+ int v = ((int)rint(a[o])-minval+(del>>1))/del;
+ int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1));
+ index = index*qv+ (m<0?0:(m>=qv?qv-1:m));
+ }
+ }else{
+ for(i=0,o=step*(dim-1);i<dim;i++,o-=step){
+ int v = (int)rint(a[o])-minval;
+ int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1));
+ index = index*qv+ (m<0?0:(m>=qv?qv-1:m));
+ }
+ }
+
+ if(book->c->lengthlist[index]<=0){
+ const static_codebook *c=book->c;
+ int best=-1;
+ /* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */
+ int e[8]={0,0,0,0,0,0,0,0};
+ int maxval = book->minval + book->delta*(book->quantvals-1);
+ for(i=0;i<book->entries;i++){
+ if(c->lengthlist[i]>0){
+ float this=0;
+ for(j=0;j<dim;j++){
+ float val=(e[j]-a[j*step]);
+ this+=val*val;
+ }
+ if(best==-1 || this<best){
+ best=this;
+ index=i;
+ }
+ }
+ /* assumes the value patterning created by the tools in vq/ */
+ j=0;
+ while(e[j]>=maxval)
+ e[j++]=0;
+ if(e[j]>=0)
+ e[j]+=book->delta;
+ e[j]= -e[j];
+ }
+ }
+
+ return index;
+}
+
+/* A few little utils for reading files */
+/* read a line. Use global, persistent buffering */
+static char *linebuffer=NULL;
+static int lbufsize=0;
+char *get_line(FILE *in){
+ long sofar=0;
+ if(feof(in))return NULL;
+
+ while(1){
+ int gotline=0;
+
+ while(!gotline){
+ if(sofar+1>=lbufsize){
+ if(!lbufsize){
+ lbufsize=1024;
+ linebuffer=_ogg_malloc(lbufsize);
+ }else{
+ lbufsize*=2;
+ linebuffer=_ogg_realloc(linebuffer,lbufsize);
+ }
+ }
+ {
+ long c=fgetc(in);
+ switch(c){
+ case EOF:
+ if(sofar==0)return(NULL);
+ /* fallthrough correct */
+ case '\n':
+ linebuffer[sofar]='\0';
+ gotline=1;
+ break;
+ default:
+ linebuffer[sofar++]=c;
+ linebuffer[sofar]='\0';
+ break;
+ }
+ }
+ }
+
+ if(linebuffer[0]=='#'){
+ sofar=0;
+ }else{
+ return(linebuffer);
+ }
+ }
+}
+
+/* read the next numerical value from the given file */
+static char *value_line_buff=NULL;
+
+int get_line_value(FILE *in,float *value){
+ char *next;
+
+ if(!value_line_buff)return(-1);
+
+ *value=strtod(value_line_buff, &next);
+ if(next==value_line_buff){
+ value_line_buff=NULL;
+ return(-1);
+ }else{
+ value_line_buff=next;
+ while(*value_line_buff>44)value_line_buff++;
+ if(*value_line_buff==44)value_line_buff++;
+ return(0);
+ }
+}
+
+int get_next_value(FILE *in,float *value){
+ while(1){
+ if(get_line_value(in,value)){
+ value_line_buff=get_line(in);
+ if(!value_line_buff)return(-1);
+ }else{
+ return(0);
+ }
+ }
+}
+
+int get_next_ivalue(FILE *in,long *ivalue){
+ float value;
+ int ret=get_next_value(in,&value);
+ *ivalue=value;
+ return(ret);
+}
+
+static float sequence_base=0.f;
+static int v_sofar=0;
+void reset_next_value(void){
+ value_line_buff=NULL;
+ sequence_base=0.f;
+ v_sofar=0;
+}
+
+char *setup_line(FILE *in){
+ reset_next_value();
+ value_line_buff=get_line(in);
+ return(value_line_buff);
+}
+
+
+int get_vector(codebook *b,FILE *in,int start, int n,float *a){
+ int i;
+ const static_codebook *c=b->c;
+
+ while(1){
+
+ if(v_sofar==n || get_line_value(in,a)){
+ reset_next_value();
+ if(get_next_value(in,a))
+ break;
+ for(i=0;i<start;i++){
+ sequence_base=*a;
+ get_line_value(in,a);
+ }
+ }
+
+ for(i=1;i<c->dim;i++)
+ if(get_line_value(in,a+i))
+ break;
+
+ if(i==c->dim){
+ float temp=a[c->dim-1];
+ for(i=0;i<c->dim;i++)a[i]-=sequence_base;
+ if(c->q_sequencep)sequence_base=temp;
+ v_sofar++;
+ return(0);
+ }
+ sequence_base=0.f;
+ }
+
+ return(-1);
+}
+
+/* read lines fromt he beginning until we find one containing the
+ specified string */
+char *find_seek_to(FILE *in,char *s){
+ rewind(in);
+ while(1){
+ char *line=get_line(in);
+ if(line){
+ if(strstr(line,s))
+ return(line);
+ }else
+ return(NULL);
+ }
+}
+
+
+/* this reads the format as written by vqbuild/latticebuild; innocent
+ (legal) tweaking of the file that would not affect its valid
+ header-ness will break this routine */
+
+codebook *codebook_load(char *filename){
+ codebook *b=_ogg_calloc(1,sizeof(codebook));
+ static_codebook *c=(static_codebook *)(b->c=_ogg_calloc(1,sizeof(static_codebook)));
+ int quant_to_read=0;
+ FILE *in=fopen(filename,"r");
+ char *line;
+ long i;
+
+ if(in==NULL){
+ fprintf(stderr,"Couldn't open codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* find the codebook struct */
+ find_seek_to(in,"static const static_codebook ");
+
+ /* get the major important values */
+ line=get_line(in);
+ if(sscanf(line,"%ld, %ld,",
+ &(c->dim),&(c->entries))!=2){
+ fprintf(stderr,"1: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+ line=get_line(in);
+ line=get_line(in);
+ if(sscanf(line,"%d, %ld, %ld, %d, %d,",
+ &(c->maptype),&(c->q_min),&(c->q_delta),&(c->q_quant),
+ &(c->q_sequencep))!=5){
+ fprintf(stderr,"1: syntax in %s in line:\t %s",filename,line);
+ exit(1);
+ }
+
+ switch(c->maptype){
+ case 0:
+ quant_to_read=0;
+ break;
+ case 1:
+ quant_to_read=_book_maptype1_quantvals(c);
+ break;
+ case 2:
+ quant_to_read=c->entries*c->dim;
+ break;
+ }
+
+ /* load the quantized entries */
+ find_seek_to(in,"static const long _vq_quantlist_");
+ reset_next_value();
+ c->quantlist=_ogg_malloc(sizeof(long)*quant_to_read);
+ for(i=0;i<quant_to_read;i++)
+ if(get_next_ivalue(in,c->quantlist+i)){
+ fprintf(stderr,"out of data while reading codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* load the lengthlist */
+ find_seek_to(in,"_lengthlist");
+ reset_next_value();
+ c->lengthlist=_ogg_malloc(sizeof(long)*c->entries);
+ for(i=0;i<c->entries;i++)
+ if(get_next_ivalue(in,c->lengthlist+i)){
+ fprintf(stderr,"out of data while reading codebook %s\n",filename);
+ exit(1);
+ }
+
+ /* got it all */
+ fclose(in);
+
+ vorbis_book_init_encode(b,c);
+ b->valuelist=_book_unquantize(c,c->entries,NULL);
+
+ return(b);
+}
+
+void spinnit(char *s,int n){
+ static int p=0;
+ static long lasttime=0;
+ long test;
+ struct timeval thistime;
+
+ gettimeofday(&thistime,NULL);
+ test=thistime.tv_sec*10+thistime.tv_usec/100000;
+ if(lasttime!=test){
+ lasttime=test;
+
+ fprintf(stderr,"%s%d ",s,n);
+
+ p++;if(p>3)p=0;
+ switch(p){
+ case 0:
+ fprintf(stderr,"| \r");
+ break;
+ case 1:
+ fprintf(stderr,"/ \r");
+ break;
+ case 2:
+ fprintf(stderr,"- \r");
+ break;
+ case 3:
+ fprintf(stderr,"\\ \r");
+ break;
+ }
+ fflush(stderr);
+ }
+}
+
+void build_tree_from_lengths(int vals, long *hist, long *lengths){
+ int i,j;
+ long *membership=_ogg_malloc(vals*sizeof(long));
+ long *histsave=alloca(vals*sizeof(long));
+ memcpy(histsave,hist,vals*sizeof(long));
+
+ for(i=0;i<vals;i++)membership[i]=i;
+
+ /* find codeword lengths */
+ /* much more elegant means exist. Brute force n^2, minimum thought */
+ for(i=vals;i>1;i--){
+ int first=-1,second=-1;
+ long least=-1;
+
+ spinnit("building... ",i);
+
+ /* find the two nodes to join */
+ for(j=0;j<vals;j++)
+ if(least==-1 || hist[j]<=least){
+ least=hist[j];
+ first=membership[j];
+ }
+ least=-1;
+ for(j=0;j<vals;j++)
+ if((least==-1 || hist[j]<=least) && membership[j]!=first){
+ least=hist[j];
+ second=membership[j];
+ }
+ if(first==-1 || second==-1){
+ fprintf(stderr,"huffman fault; no free branch\n");
+ exit(1);
+ }
+
+ /* join them */
+ least=hist[first]+hist[second];
+ for(j=0;j<vals;j++)
+ if(membership[j]==first || membership[j]==second){
+ membership[j]=first;
+ hist[j]=least;
+ lengths[j]++;
+ }
+ }
+ for(i=0;i<vals-1;i++)
+ if(membership[i]!=membership[i+1]){
+ fprintf(stderr,"huffman fault; failed to build single tree\n");
+ exit(1);
+ }
+
+ /* for sanity check purposes: how many bits would it have taken to
+ encode the training set? */
+ {
+ long bitsum=0;
+ long samples=0;
+ for(i=0;i<vals;i++){
+ bitsum+=(histsave[i]-1)*lengths[i];
+ samples+=histsave[i]-1;
+ }
+
+ if(samples){
+ fprintf(stderr,"\rTotal samples in training set: %ld \n",samples);
+ fprintf(stderr,"\rTotal bits used to represent training set: %ld\n",
+ bitsum);
+ }
+ }
+
+ free(membership);
+}
+
+/* wrap build_tree_from_lengths to allow zero entries in the histogram */
+void build_tree_from_lengths0(int vals, long *hist, long *lengths){
+
+ /* pack the 'sparse' hit list into a dense list, then unpack
+ the lengths after the build */
+
+ int upper=0,i;
+ long *lengthlist=_ogg_calloc(vals,sizeof(long));
+ long *newhist=alloca(vals*sizeof(long));
+
+ for(i=0;i<vals;i++)
+ if(hist[i]>0)
+ newhist[upper++]=hist[i];
+
+ if(upper != vals){
+ fprintf(stderr,"\rEliminating %d unused entries; %d entries remain\n",
+ vals-upper,upper);
+ }
+
+ build_tree_from_lengths(upper,newhist,lengthlist);
+
+ upper=0;
+ for(i=0;i<vals;i++)
+ if(hist[i]>0)
+ lengths[i]=lengthlist[upper++];
+ else
+ lengths[i]=0;
+
+ free(lengthlist);
+}
+
+void write_codebook(FILE *out,char *name,const static_codebook *c){
+ int i,j,k;
+
+ /* save the book in C header form */
+
+ /* first, the static vectors, then the book structure to tie it together. */
+ /* quantlist */
+ if(c->quantlist){
+ long vals=(c->maptype==1?_book_maptype1_quantvals(c):c->entries*c->dim);
+ fprintf(out,"static const long _vq_quantlist_%s[] = {\n",name);
+ for(j=0;j<vals;j++){
+ fprintf(out,"\t%ld,\n",c->quantlist[j]);
+ }
+ fprintf(out,"};\n\n");
+ }
+
+ /* lengthlist */
+ fprintf(out,"static const char _vq_lengthlist_%s[] = {\n",name);
+ for(j=0;j<c->entries;){
+ fprintf(out,"\t");
+ for(k=0;k<16 && j<c->entries;k++,j++)
+ fprintf(out,"%2ld,",c->lengthlist[j]);
+ fprintf(out,"\n");
+ }
+ fprintf(out,"};\n\n");
+
+ /* tie it all together */
+
+ fprintf(out,"static const static_codebook %s = {\n",name);
+
+ fprintf(out,"\t%ld, %ld,\n",c->dim,c->entries);
+ fprintf(out,"\t(char *)_vq_lengthlist_%s,\n",name);
+ fprintf(out,"\t%d, %ld, %ld, %d, %d,\n",
+ c->maptype,c->q_min,c->q_delta,c->q_quant,c->q_sequencep);
+ if(c->quantlist)
+ fprintf(out,"\t(long *)_vq_quantlist_%s,\n",name);
+ else
+ fprintf(out,"\tNULL,\n");
+
+ fprintf(out,"\t0\n};\n\n");
+}
diff --git a/vorbis/vq/bookutil.h b/vorbis/vq/bookutil.h
new file mode 100644
index 0000000..e84b018
--- /dev/null
+++ b/vorbis/vq/bookutil.h
@@ -0,0 +1,42 @@
+/********************************************************************
+ * *
+ * 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 functions for loading .vqh and .vqd files
+
+ ********************************************************************/
+
+#ifndef _V_BOOKUTIL_H_
+#define _V_BOOKUTIL_H_
+
+#include <stdio.h>
+#include <sys/time.h>
+
+#include "localcodebook.h"
+
+extern char *get_line(FILE *in);
+extern char *setup_line(FILE *in);
+extern int get_line_value(FILE *in,float *value);
+extern int get_next_value(FILE *in,float *value);
+extern int get_next_ivalue(FILE *in,long *ivalue);
+extern void reset_next_value(void);
+extern int get_vector(codebook *b,FILE *in,int start,int num,float *a);
+extern char *find_seek_to(FILE *in,char *s);
+
+extern codebook *codebook_load(char *filename);
+extern void write_codebook(FILE *out,char *name,const static_codebook *c);
+
+extern void spinnit(char *s,int n);
+extern void build_tree_from_lengths(int vals, long *hist, long *lengths);
+extern void build_tree_from_lengths0(int vals, long *hist, long *lengths);
+
+#endif
+
diff --git a/vorbis/vq/distribution.c b/vorbis/vq/distribution.c
new file mode 100644
index 0000000..132b5b9
--- /dev/null
+++ b/vorbis/vq/distribution.c
@@ -0,0 +1,247 @@
+/********************************************************************
+ * *
+ * 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 for finding the distribution in a data set
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include "bookutil.h"
+
+/* command line:
+ distribution file.vqd
+*/
+
+int ascend(const void *a,const void *b){
+ return(**((long **)a)-**((long **)b));
+}
+
+int main(int argc,char *argv[]){
+ FILE *in;
+ long lines=0;
+ float min;
+ float max;
+ long bins=-1;
+ int flag=0;
+ long *countarray;
+ long total=0;
+ char *line;
+
+ if(argv[1]==NULL){
+ fprintf(stderr,"Usage: distribution {data.vqd [bins]| book.vqh} \n\n");
+ exit(1);
+ }
+ if(argv[2]!=NULL)
+ bins=atoi(argv[2])-1;
+
+ in=fopen(argv[1],"r");
+ if(!in){
+ fprintf(stderr,"Could not open input file %s\n",argv[1]);
+ exit(1);
+ }
+
+ if(strrchr(argv[1],'.') && strcmp(strrchr(argv[1],'.'),".vqh")==0){
+ /* load/decode a book */
+
+ codebook *b=codebook_load(argv[1]);
+ static_codebook *c=(static_codebook *)(b->c);
+ float delta;
+ int i;
+ fclose(in);
+
+ switch(c->maptype){
+ case 0:
+ printf("entropy codebook only; no mappings\n");
+ exit(0);
+ break;
+ case 1:
+ bins=_book_maptype1_quantvals(c);
+ break;
+ case 2:
+ bins=c->entries*c->dim;
+ break;
+ }
+
+ max=min=_float32_unpack(c->q_min);
+ delta=_float32_unpack(c->q_delta);
+
+ for(i=0;i<bins;i++){
+ float val=c->quantlist[i]*delta+min;
+ if(val>max)max=val;
+ }
+
+ printf("Minimum scalar value: %f\n",min);
+ printf("Maximum scalar value: %f\n",max);
+
+ switch(c->maptype){
+ case 1:
+ {
+ /* lattice codebook. dump it. */
+ int j,k;
+ long maxcount=0;
+ long **sort=calloc(bins,sizeof(long *));
+ long base=c->lengthlist[0];
+ countarray=calloc(bins,sizeof(long));
+
+ for(i=0;i<bins;i++)sort[i]=c->quantlist+i;
+ qsort(sort,bins,sizeof(long *),ascend);
+
+ for(i=0;i<b->entries;i++)
+ if(c->lengthlist[i]>base)base=c->lengthlist[i];
+
+ /* dump a full, correlated count */
+ for(j=0;j<b->entries;j++){
+ if(c->lengthlist[j]){
+ int indexdiv=1;
+ printf("%4d: ",j);
+ for(k=0;k<b->dim;k++){
+ int index= (j/indexdiv)%bins;
+ printf("%+3.1f,", c->quantlist[index]*_float32_unpack(c->q_delta)+
+ _float32_unpack(c->q_min));
+ indexdiv*=bins;
+ }
+ printf("\t|");
+ for(k=0;k<base-c->lengthlist[j];k++)printf("*");
+ printf("\n");
+ }
+ }
+
+ /* do a rough count */
+ for(j=0;j<b->entries;j++){
+ int indexdiv=1;
+ for(k=0;k<b->dim;k++){
+ if(c->lengthlist[j]){
+ int index= (j/indexdiv)%bins;
+ countarray[index]+=(1<<(base-c->lengthlist[j]));
+ indexdiv*=bins;
+ }
+ }
+ }
+
+ /* dump the count */
+
+ {
+ long maxcount=0,i,j;
+ for(i=0;i<bins;i++)
+ if(countarray[i]>maxcount)maxcount=countarray[i];
+
+ for(i=0;i<bins;i++){
+ int ptr=sort[i]-c->quantlist;
+ int stars=rint(50./maxcount*countarray[ptr]);
+ printf("%+08f (%8ld) |",c->quantlist[ptr]*delta+min,countarray[ptr]);
+ for(j=0;j<stars;j++)printf("*");
+ printf("\n");
+ }
+ }
+ }
+ break;
+ case 2:
+ {
+ /* trained, full mapping codebook. */
+ printf("Can't do probability dump of a trained [type 2] codebook (yet)\n");
+ }
+ break;
+ }
+ }else{
+ /* load/count a data file */
+
+ /* do it the simple way; two pass. */
+ line=setup_line(in);
+ while(line){
+ float code;
+ char buf[80];
+ lines++;
+
+ sprintf(buf,"getting min/max (%.2f::%.2f). lines...",min,max);
+ if(!(lines&0xff))spinnit(buf,lines);
+
+ while(!flag && sscanf(line,"%f",&code)==1){
+ line=strchr(line,',');
+ min=max=code;
+ flag=1;
+ }
+
+ while(line && sscanf(line,"%f",&code)==1){
+ line=strchr(line,',');
+ if(line)line++;
+ if(code<min)min=code;
+ if(code>max)max=code;
+ }
+
+ line=setup_line(in);
+ }
+
+ if(bins<1){
+ if((int)(max-min)==min-max){
+ bins=max-min;
+ }else{
+ bins=25;
+ }
+ }
+
+ printf("\r \r");
+ printf("Minimum scalar value: %f\n",min);
+ printf("Maximum scalar value: %f\n",max);
+
+ if(argv[2]){
+
+ printf("\n counting hits into %ld bins...\n",bins+1);
+ countarray=calloc(bins+1,sizeof(long));
+
+ rewind(in);
+ line=setup_line(in);
+ while(line){
+ float code;
+ lines--;
+ if(!(lines&0xff))spinnit("counting distribution. lines so far...",lines);
+
+ while(line && sscanf(line,"%f",&code)==1){
+ line=strchr(line,',');
+ if(line)line++;
+
+ code-=min;
+ code/=(max-min);
+ code*=bins;
+ countarray[(int)rint(code)]++;
+ total++;
+ }
+
+ line=setup_line(in);
+ }
+
+ /* make a pretty graph */
+ {
+ long maxcount=0,i,j;
+ for(i=0;i<bins+1;i++)
+ if(countarray[i]>maxcount)maxcount=countarray[i];
+
+ printf("\r \r");
+ printf("Total scalars: %ld\n",total);
+ for(i=0;i<bins+1;i++){
+ int stars=rint(50./maxcount*countarray[i]);
+ printf("%08f (%8ld) |",(max-min)/bins*i+min,countarray[i]);
+ for(j=0;j<stars;j++)printf("*");
+ printf("\n");
+ }
+ }
+ }
+
+ fclose(in);
+
+ }
+ printf("\nDone.\n");
+ exit(0);
+}
diff --git a/vorbis/vq/floor_11.vqs b/vorbis/vq/floor_11.vqs
new file mode 100644
index 0000000..ccd73e8
--- /dev/null
+++ b/vorbis/vq/floor_11.vqs
@@ -0,0 +1,10 @@
+GO
+>floor_11
+=8-11c0_s 8-11c1_s
+
+build line_256x4_class0 0-256
+build line_256x4_0sub0 0-4
+build line_256x4_0sub1 4-10
+build line_256x4_0sub2 10-25
+build line_256x4_0sub3 25-64
+
diff --git a/vorbis/vq/floor_22.vqs b/vorbis/vq/floor_22.vqs
new file mode 100644
index 0000000..b80328e
--- /dev/null
+++ b/vorbis/vq/floor_22.vqs
@@ -0,0 +1,27 @@
+GO
+>floor_22
+=22c0_s 22c1_s 22c2_s
+
+build line_256x7_class0 0-64
+build line_256x7_class1 0-256
+build line_256x7_0sub1 1-9
+build line_256x7_0sub2 9-25
+build line_256x7_0sub3 25-64
+build line_256x7_1sub1 1-9
+build line_256x7_1sub2 9-25
+build line_256x7_1sub3 25-64
+
+build line_512x17_class1 0-8
+build line_512x17_class2 0-64
+build line_512x17_class3 0-64
+build line_512x17_0sub0 0-128
+build line_512x17_1sub0 0-32
+build line_512x17_1sub1 32-128
+build line_512x17_2sub1 1-18
+build line_512x17_2sub2 18-50
+build line_512x17_2sub3 50-128
+build line_512x17_3sub1 1-18
+build line_512x17_3sub2 18-50
+build line_512x17_3sub3 50-128
+
+
diff --git a/vorbis/vq/floor_44.vqs b/vorbis/vq/floor_44.vqs
new file mode 100644
index 0000000..dd213f7
--- /dev/null
+++ b/vorbis/vq/floor_44.vqs
@@ -0,0 +1,83 @@
+GO
+>floor_44
+=44c-1_s 44c0_s 44c1_s 44c2_s 44c3_s 44c4_s 44c5_s 44c6_s 44c7_s 44c8_s 44c9_s
+
+build line_128x4_class0 0-256
+build line_128x4_0sub0 0-4
+build line_128x4_0sub1 4-10
+build line_128x4_0sub2 10-25
+build line_128x4_0sub3 25-64
+
+build line_256x4_class0 0-256
+build line_256x4_0sub0 0-4
+build line_256x4_0sub1 4-10
+build line_256x4_0sub2 10-25
+build line_256x4_0sub3 25-64
+
+build line_128x7_class0 0-64
+build line_128x7_class1 0-256
+build line_128x7_0sub1 1-9
+build line_128x7_0sub2 9-25
+build line_128x7_0sub3 25-64
+build line_128x7_1sub1 1-9
+build line_128x7_1sub2 9-25
+build line_128x7_1sub3 25-64
+
+build line_128x11_class1 0-8
+build line_128x11_class2 0-64
+build line_128x11_class3 0-64
+build line_128x11_0sub0 0-128
+build line_128x11_1sub0 0-32
+build line_128x11_1sub1 32-128
+build line_128x11_2sub1 1-18
+build line_128x11_2sub2 18-50
+build line_128x11_2sub3 50-128
+build line_128x11_3sub1 1-18
+build line_128x11_3sub2 18-50
+build line_128x11_3sub3 50-128
+
+build line_128x17_class1 0-8
+build line_128x17_class2 0-64
+build line_128x17_class3 0-64
+build line_128x17_0sub0 0-128
+build line_128x17_1sub0 0-32
+build line_128x17_1sub1 32-128
+build line_128x17_2sub1 1-18
+build line_128x17_2sub2 18-50
+build line_128x17_2sub3 50-128
+build line_128x17_3sub1 1-18
+build line_128x17_3sub2 18-50
+build line_128x17_3sub3 50-128
+
+build line_1024x27_class1 0-16
+build line_1024x27_class2 0-8
+build line_1024x27_class3 0-256
+build line_1024x27_class4 0-64
+build line_1024x27_0sub0 0-128
+build line_1024x27_1sub0 0-32
+build line_1024x27_1sub1 32-128
+build line_1024x27_2sub0 0-32
+build line_1024x27_2sub1 32-128
+build line_1024x27_3sub1 1-18
+build line_1024x27_3sub2 18-50
+build line_1024x27_3sub3 50-128
+build line_1024x27_4sub1 1-18
+build line_1024x27_4sub2 18-50
+build line_1024x27_4sub3 50-128
+
+build line_2048x27_class1 0-16
+build line_2048x27_class2 0-8
+build line_2048x27_class3 0-256
+build line_2048x27_class4 0-64
+build line_2048x27_0sub0 0-128
+build line_2048x27_1sub0 0-32
+build line_2048x27_1sub1 32-128
+build line_2048x27_2sub0 0-32
+build line_2048x27_2sub1 32-128
+build line_2048x27_3sub1 1-18
+build line_2048x27_3sub2 18-50
+build line_2048x27_3sub3 50-128
+build line_2048x27_4sub1 1-18
+build line_2048x27_4sub2 18-50
+build line_2048x27_4sub3 50-128
+
diff --git a/vorbis/vq/huffbuild.c b/vorbis/vq/huffbuild.c
new file mode 100644
index 0000000..014c81c
--- /dev/null
+++ b/vorbis/vq/huffbuild.c
@@ -0,0 +1,197 @@
+/********************************************************************
+ * *
+ * 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-2014 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: hufftree builder
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <stdio.h>
+#include "bookutil.h"
+
+static int nsofar=0;
+static int getval(FILE *in,int begin,int n,int group,int max){
+ float v;
+ int i;
+ long val=0;
+
+ if(nsofar>=n || get_line_value(in,&v)){
+ reset_next_value();
+ nsofar=0;
+ if(get_next_value(in,&v))
+ return(-1);
+ for(i=1;i<=begin;i++)
+ get_line_value(in,&v);
+ }
+
+ val=(int)v;
+ nsofar++;
+
+ for(i=1;i<group;i++,nsofar++)
+ if(nsofar>=n || get_line_value(in,&v))
+ return(getval(in,begin,n,group,max));
+ else
+ val = val*max+(int)v;
+ return(val);
+}
+
+static void usage(){
+ fprintf(stderr,
+ "usage:\n"
+ "huffbuild <input>.vqd <begin,n,group>|<lorange-hirange> [noguard]\n"
+ " where begin,n,group is first scalar, \n"
+ " number of scalars of each in line,\n"
+ " number of scalars in a group\n"
+ "eg: huffbuild reslongaux.vqd 0,1024,4\n"
+ "produces reslongaux.vqh\n\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[]){
+ char *base;
+ char *infile;
+ int i,j,k,begin,n,subn,guard=1;
+ FILE *file;
+ int maxval=0;
+ int loval=0;
+
+ if(argc<3)usage();
+ if(argc==4)guard=0;
+
+ infile=strdup(argv[1]);
+ base=strdup(infile);
+ if(strrchr(base,'.'))
+ strrchr(base,'.')[0]='\0';
+
+ {
+ char *pos=strchr(argv[2],',');
+ char *dpos=strchr(argv[2],'-');
+ if(dpos){
+ loval=atoi(argv[2]);
+ maxval=atoi(dpos+1);
+ subn=1;
+ begin=0;
+ }else{
+ begin=atoi(argv[2]);
+ 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);
+ }
+ }
+ }
+
+ /* scan the file for maximum value */
+ file=fopen(infile,"r");
+ if(!file){
+ fprintf(stderr,"Could not open file %s\n",infile);
+ if(!maxval)
+ exit(1);
+ else
+ fprintf(stderr," making untrained books.\n");
+
+ }
+
+ if(!maxval){
+ i=0;
+ while(1){
+ long v;
+ if(get_next_ivalue(file,&v))break;
+ if(v>maxval)maxval=v;
+
+ if(!(i++&0xff))spinnit("loading... ",i);
+ }
+ rewind(file);
+ maxval++;
+ }
+
+ {
+ long vals=pow(maxval,subn);
+ long *hist=_ogg_calloc(vals,sizeof(long));
+ long *lengths=_ogg_calloc(vals,sizeof(long));
+
+ for(j=loval;j<vals;j++)hist[j]=guard;
+
+ if(file){
+ reset_next_value();
+ i/=subn;
+ while(!feof(file)){
+ long val=getval(file,begin,n,subn,maxval);
+ if(val==-1 || val>=vals)break;
+ hist[val]++;
+ if(!(i--&0xff))spinnit("loading... ",i*subn);
+ }
+ fclose(file);
+ }
+
+ /* we have the probabilities, build the tree */
+ fprintf(stderr,"Building tree for %ld entries\n",vals);
+ build_tree_from_lengths0(vals,hist,lengths);
+
+ /* save the book */
+ {
+ char *buffer=alloca(strlen(base)+5);
+ strcpy(buffer,base);
+ strcat(buffer,".vqh");
+ file=fopen(buffer,"w");
+ if(!file){
+ fprintf(stderr,"Could not open file %s\n",buffer);
+ exit(1);
+ }
+ }
+
+ /* first, the static vectors, then the book structure to tie it together. */
+ /* lengthlist */
+ fprintf(file,"static const char _huff_lengthlist_%s[] = {\n",base);
+ for(j=0;j<vals;){
+ fprintf(file,"\t");
+ for(k=0;k<16 && j<vals;k++,j++)
+ fprintf(file,"%2ld,",lengths[j]);
+ fprintf(file,"\n");
+ }
+ fprintf(file,"};\n\n");
+
+ /* the toplevel book */
+ fprintf(file,"static const static_codebook _huff_book_%s = {\n",base);
+ fprintf(file,"\t%d, %ld,\n",subn,vals);
+ fprintf(file,"\t(char *)_huff_lengthlist_%s,\n",base);
+ fprintf(file,"\t0, 0, 0, 0, 0,\n");
+ fprintf(file,"\tNULL,\n");
+
+ fprintf(file,"\t0\n};\n\n");
+
+ fclose(file);
+ fprintf(stderr,"Done. \n\n");
+ }
+ exit(0);
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/vorbis/vq/latticebuild.c b/vorbis/vq/latticebuild.c
new file mode 100644
index 0000000..acfe9ff
--- /dev/null
+++ b/vorbis/vq/latticebuild.c
@@ -0,0 +1,176 @@
+/********************************************************************
+ * *
+ * 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 lattice descriptions
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include "bookutil.h"
+
+/* The purpose of this util is just to finish packaging the
+ description into a static codebook. It used to count hits for a
+ histogram, but I've divorced that out to add some flexibility (it
+ currently generates an equal probability codebook)
+
+ command line:
+ latticebuild description.vql
+
+ the lattice description file contains two lines:
+
+ <n> <dim> <multiplicitavep> <sequentialp>
+ <value_0> <value_1> <value_2> ... <value_n-1>
+
+ a threshmap (or pigeonmap) struct is generated by latticehint;
+ there are fun tricks one can do with the threshmap and cascades,
+ but the utils don't know them...
+
+ entropy encoding is done by feeding an entry list collected from a
+ training set and feeding it to latticetune along with the book.
+
+ latticebuild produces a codebook on stdout */
+
+static int ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
+}
+
+int main(int argc,char *argv[]){
+ codebook b;
+ static_codebook c;
+ double *quantlist;
+ long *hits;
+
+ int entries=-1,dim=-1,quantvals=-1,addmul=-1,sequencep=0;
+ FILE *in=NULL;
+ char *line,*name;
+ long i,j;
+
+ memset(&b,0,sizeof(b));
+ memset(&c,0,sizeof(c));
+
+ if(argv[1]==NULL){
+ fprintf(stderr,"Need a lattice description file on the command line.\n");
+ exit(1);
+ }
+
+ {
+ char *ptr;
+ char *filename=_ogg_calloc(strlen(argv[1])+4,1);
+
+ strcpy(filename,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);
+ }else{
+ name=strdup(filename);
+ }
+
+ }
+
+ /* read the description */
+ line=get_line(in);
+ if(sscanf(line,"%d %d %d %d",&quantvals,&dim,&addmul,&sequencep)!=4){
+ if(sscanf(line,"%d %d %d",&quantvals,&dim,&addmul)!=3){
+ fprintf(stderr,"Syntax error reading description file (line 1)\n");
+ exit(1);
+ }
+ }
+ entries=pow(quantvals,dim);
+ c.dim=dim;
+ c.entries=entries;
+ c.lengthlist=_ogg_malloc(entries*sizeof(long));
+ c.maptype=1;
+ c.q_sequencep=sequencep;
+ c.quantlist=_ogg_calloc(quantvals,sizeof(long));
+
+ quantlist=_ogg_malloc(sizeof(double)*c.dim*c.entries);
+ hits=_ogg_malloc(c.entries*sizeof(long));
+ for(j=0;j<entries;j++)hits[j]=1;
+ for(j=0;j<entries;j++)c.lengthlist[j]=1;
+
+ reset_next_value();
+ line=setup_line(in);
+ for(j=0;j<quantvals;j++){
+ char *temp;
+ if(!line || sscanf(line,"%lf",quantlist+j)!=1){
+ fprintf(stderr,"Ran out of data on line 2 of description file\n");
+ exit(1);
+ }
+ temp=strchr(line,',');
+ if(!temp)temp=strchr(line,' ');
+ if(temp)temp++;
+ line=temp;
+ }
+
+ /* gen a real quant list from the more easily human-grokked input */
+ {
+ double min=quantlist[0];
+ double mindel=-1;
+ int fac=1;
+ for(j=1;j<quantvals;j++)if(quantlist[j]<min)min=quantlist[j];
+ for(j=0;j<quantvals;j++)
+ for(i=j+1;i<quantvals;i++)
+ if(mindel==-1 || fabs(quantlist[j]-quantlist[i])<mindel)
+ mindel=fabs(quantlist[j]-quantlist[i]);
+
+ j=0;
+ while(j<quantvals){
+ for(j=0;j<quantvals;j++){
+ double test=fac*(quantlist[j]-min)/mindel;
+ if( fabs(rint(test)-test)>.00001f) break;
+ }
+ if(fac>100)break;
+ if(j<quantvals)fac++;
+ }
+
+ mindel/=fac;
+ fprintf(stderr,"min=%g mindel=%g\n",min,mindel);
+
+ c.q_min=_float32_pack(min);
+ c.q_delta=_float32_pack(mindel);
+ c.q_quant=0;
+
+ min=_float32_unpack(c.q_min);
+ mindel=_float32_unpack(c.q_delta);
+ for(j=0;j<quantvals;j++){
+ c.quantlist[j]=rint((quantlist[j]-min)/mindel);
+ if(ilog(c.quantlist[j])>c.q_quant)c.q_quant=ilog(c.quantlist[j]);
+ }
+ }
+
+ /* build the [default] codeword lengths */
+ memset(c.lengthlist,0,sizeof(long)*entries);
+ for(i=0;i<entries;i++)hits[i]=1;
+ build_tree_from_lengths(entries,hits,c.lengthlist);
+
+ /* save the book in C header form */
+ write_codebook(stdout,name,&c);
+ fprintf(stderr,"\r "
+ "\nDone.\n");
+ exit(0);
+}
diff --git a/vorbis/vq/latticetune.c b/vorbis/vq/latticetune.c
new file mode 100644
index 0000000..193d4d1
--- /dev/null
+++ b/vorbis/vq/latticetune.c
@@ -0,0 +1,163 @@
+/********************************************************************
+ * *
+ * 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 setting entropy encoding parameters
+ for lattice codebooks
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include "bookutil.h"
+
+static int strrcmp_i(char *s,char *cmp){
+ return(strncmp(s+strlen(s)-strlen(cmp),cmp,strlen(cmp)));
+}
+
+/* This util takes a training-collected file listing codewords used in
+ LSP fitting, then generates new codeword lengths for maximally
+ efficient integer-bits entropy encoding.
+
+ command line:
+ latticetune book.vqh input.vqd [unused_entriesp]
+
+ latticetune produces book.vqh on stdout */
+
+int main(int argc,char *argv[]){
+ codebook *b;
+ static_codebook *c;
+ long *lengths;
+ long *hits;
+
+ int entries=-1,dim=-1,guard=1;
+ FILE *in=NULL;
+ char *line,*name;
+ long j;
+
+ if(argv[1]==NULL){
+ fprintf(stderr,"Need a lattice codebook on the command line.\n");
+ exit(1);
+ }
+ if(argv[2]==NULL){
+ fprintf(stderr,"Need a codeword data file on the command line.\n");
+ exit(1);
+ }
+ if(argv[3]!=NULL)guard=0;
+
+ {
+ char *ptr;
+ char *filename=strdup(argv[1]);
+
+ b=codebook_load(filename);
+ c=(static_codebook *)(b->c);
+
+ ptr=strrchr(filename,'.');
+ if(ptr){
+ *ptr='\0';
+ name=strdup(filename);
+ }else{
+ name=strdup(filename);
+ }
+ }
+
+ if(c->maptype!=1){
+ fprintf(stderr,"Provided book is not a latticebook.\n");
+ exit(1);
+ }
+
+ entries=b->entries;
+ dim=b->dim;
+
+ hits=_ogg_malloc(entries*sizeof(long));
+ lengths=_ogg_calloc(entries,sizeof(long));
+ for(j=0;j<entries;j++)hits[j]=guard;
+
+ in=fopen(argv[2],"r");
+ if(!in){
+ fprintf(stderr,"Could not open input file %s\n",argv[2]);
+ exit(1);
+ }
+
+ if(!strrcmp_i(argv[0],"latticetune")){
+ long lines=0;
+ line=setup_line(in);
+ while(line){
+ long code;
+ lines++;
+ if(!(lines&0xfff))spinnit("codewords so far...",lines);
+
+ if(sscanf(line,"%ld",&code)==1)
+ hits[code]++;
+
+ line=setup_line(in);
+ }
+ }
+
+ /* now we simply count already collated by-entry data */
+ if(!strrcmp_i(argv[0],"res0tune") || !strrcmp_i(argv[0],"res1tune")){
+
+ line=setup_line(in);
+ while(line){
+
+ /* code:hits\n */
+ /* likely to have multiple listing for each code entry; must
+ accumulate */
+
+ char *pos=strchr(line,':');
+ if(pos){
+ long code=atol(line);
+ long val=atol(pos+1);
+ hits[code]+=val;
+ }
+
+ line=setup_line(in);
+ }
+ }
+
+ fclose(in);
+
+ /* build the codeword lengths */
+ build_tree_from_lengths0(entries,hits,lengths);
+
+ c->lengthlist=lengths;
+ write_codebook(stdout,name,c);
+
+ {
+ long bins=_book_maptype1_quantvals(c);
+ long i,k,base=c->lengthlist[0];
+ for(i=0;i<entries;i++)
+ if(c->lengthlist[i]>base)base=c->lengthlist[i];
+
+ for(j=0;j<entries;j++){
+ if(c->lengthlist[j]){
+ int indexdiv=1;
+ fprintf(stderr,"%4ld: ",j);
+ for(k=0;k<c->dim;k++){
+ int index= (j/indexdiv)%bins;
+ fprintf(stderr,"%+3.1f,", c->quantlist[index]*_float32_unpack(c->q_delta)+
+ _float32_unpack(c->q_min));
+ indexdiv*=bins;
+ }
+ fprintf(stderr,"\t|");
+ for(k=0;k<base-c->lengthlist[j];k++)fprintf(stderr,"*");
+ fprintf(stderr,"\n");
+ }
+ }
+ }
+
+ fprintf(stderr,"\r "
+ "\nDone.\n");
+ exit(0);
+}
diff --git a/vorbis/vq/localcodebook.h b/vorbis/vq/localcodebook.h
new file mode 100644
index 0000000..f90d5e4
--- /dev/null
+++ b/vorbis/vq/localcodebook.h
@@ -0,0 +1,120 @@
+/********************************************************************
+ * *
+ * 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-2007 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: basic shared codebook operations
+
+ ********************************************************************/
+
+#ifndef _V_CODEBOOK_H_
+#define _V_CODEBOOK_H_
+
+#include <ogg/ogg.h>
+
+/* This structure encapsulates huffman and VQ style encoding books; it
+ doesn't do anything specific to either.
+
+ valuelist/quantlist are nonNULL (and q_* significant) only if
+ there's entry->value mapping to be done.
+
+ If encode-side mapping must be done (and thus the entry needs to be
+ hunted), the auxiliary encode pointer will point to a decision
+ tree. This is true of both VQ and huffman, but is mostly useful
+ with VQ.
+
+*/
+
+typedef struct static_codebook{
+ long dim; /* codebook dimensions (elements per vector) */
+ long entries; /* codebook entries */
+ long *lengthlist; /* codeword lengths in bits */
+
+ /* mapping ***************************************************************/
+ int maptype; /* 0=none
+ 1=implicitly populated values from map column
+ 2=listed arbitrary values */
+
+ /* The below does a linear, single monotonic sequence mapping. */
+ long q_min; /* packed 32 bit float; quant value 0 maps to minval */
+ long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
+ int q_quant; /* bits: 0 < quant <= 16 */
+ int q_sequencep; /* bitflag */
+
+ long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
+ map == 2: list of dim*entries quantized entry vals
+ */
+ int allocedp;
+} static_codebook;
+
+typedef struct codebook{
+ long dim; /* codebook dimensions (elements per vector) */
+ long entries; /* codebook entries */
+ long used_entries; /* populated codebook entries */
+ static_codebook *c;
+
+ /* for encode, the below are entry-ordered, fully populated */
+ /* for decode, the below are ordered by bitreversed codeword and only
+ used entries are populated */
+ float *valuelist; /* list of dim*entries actual entry values */
+ ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
+
+ int *dec_index; /* only used if sparseness collapsed */
+ char *dec_codelengths;
+ ogg_uint32_t *dec_firsttable;
+ int dec_firsttablen;
+ int dec_maxlength;
+
+ /* The current encoder uses only centered, integer-only lattice books. */
+ int quantvals;
+ int minval;
+ int delta;
+
+} codebook;
+
+extern void vorbis_staticbook_clear(static_codebook *b);
+extern void vorbis_staticbook_destroy(static_codebook *b);
+extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
+extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
+extern void vorbis_book_clear(codebook *b);
+
+extern float *_book_unquantize(const static_codebook *b,int n,int *map);
+extern float *_book_logdist(const static_codebook *b,float *vals);
+extern float _float32_unpack(long val);
+extern long _float32_pack(float val);
+extern int _best(codebook *book, float *a, int step);
+extern int _ilog(unsigned int v);
+extern long _book_maptype1_quantvals(const static_codebook *b);
+
+extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul);
+extern long vorbis_book_codeword(codebook *book,int entry);
+extern long vorbis_book_codelen(codebook *book,int entry);
+
+
+
+extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
+extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
+
+extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
+
+extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
+extern long vorbis_book_decodevs_add(codebook *book, float *a,
+ oggpack_buffer *b,int n);
+extern long vorbis_book_decodev_set(codebook *book, float *a,
+ oggpack_buffer *b,int n);
+extern long vorbis_book_decodev_add(codebook *book, float *a,
+ oggpack_buffer *b,int n);
+extern long vorbis_book_decodevv_add(codebook *book, float **a,
+ long off,int ch,
+ oggpack_buffer *b,int n);
+
+
+
+#endif
diff --git a/vorbis/vq/make_floor_books.pl b/vorbis/vq/make_floor_books.pl
new file mode 100755
index 0000000..5c37366
--- /dev/null
+++ b/vorbis/vq/make_floor_books.pl
@@ -0,0 +1,108 @@
+#!/usr/bin/perl
+
+# quick, very dirty little script so that we can put all the
+# information for building a floor book set in one spec file.
+
+#eg:
+
+# >floor_44
+# =44c0_s 44c1_s 44c2_s
+# build line_128x4_class0 0-256
+# build line_128x4_0sub0 0-4
+
+die "Could not open $ARGV[0]: $!" unless open (F,$ARGV[0]);
+
+$goflag=0;
+while($line=<F>){
+
+ print "#### $line";
+ if($line=~m/^GO/){
+ $goflag=1;
+ next;
+ }
+
+ if($goflag==0){
+ if($line=~m/\S+/ && !($line=~m/^\#/) ){
+ my $command=$line;
+ print ">>> $command";
+ die "Couldn't shell command.\n\tcommand:$command\n"
+ if syst($command);
+ }
+ next;
+ }
+
+ # >floor_44
+ # this sets the output bookset file name
+ if($line=~m/^>(\S+)\s+(\S*)/){
+ # set the output name
+ $globalname=$1;
+
+ $command="rm -f $globalname.vqh";
+ die "Couldn't remove file.\n\tcommand:$command\n"
+ if syst($command);
+
+ next;
+ }
+
+ #=path1 path2 path3
+ #set the search path for input files; each build line will look
+ #for input files in all of the directories in the search path and
+ #append them for huffbuild input
+ if($line=~m/^=(.*)/){
+ # set the output name
+ @paths=split(' ',$1);
+ next;
+ }
+
+ # build book.vqd 0-3 [noguard]
+ if($line=~m/^build (.*)/){
+ # build a huffman book (no mapping)
+ my($datafile,$range,$guard)=split(' ',$1);
+
+ $command="rm -f $datafile.tmp";
+ print "\n\n>>> $command\n";
+ die "Couldn't remove temp file.\n\tcommand:$command\n"
+ if syst($command);
+
+ # first find all the inputs we want; they'll need to be collected into a single input file
+ foreach $dir (@paths){
+ if (-e "$dir/$datafile.vqd"){
+ $command="cat $dir/$datafile.vqd >> $datafile.tmp";
+ print ">>> $command\n";
+ die "Couldn't append training data.\n\tcommand:$command\n"
+ if syst($command);
+ }
+ }
+
+ my $command="huffbuild $datafile.tmp $range $guard";
+ print ">>> $command\n";
+ die "Couldn't build huffbook.\n\tcommand:$command\n"
+ if syst($command);
+
+ $command="cat $datafile.vqh >> $globalname.vqh";
+ print ">>> $command\n";
+ die "Couldn't append to output book.\n\tcommand:$command\n"
+ if syst($command);
+
+ $command="rm $datafile.vqh";
+ print ">>> $command\n";
+ die "Couldn't remove temporary output file.\n\tcommand:$command\n"
+ if syst($command);
+
+ $command="rm -f $datafile.tmp";
+ print ">>> $command\n";
+ die "Couldn't remove temporary output file.\n\tcommand:$command\n"
+ if syst($command);
+ next;
+ }
+
+}
+
+$command="rm -f temp$$.vqd";
+print ">>> $command\n";
+die "Couldn't remove temp files.\n\tcommand:$command\n"
+ if syst($command);
+
+sub syst{
+ system(@_)/256;
+}
diff --git a/vorbis/vq/make_residue_books.pl b/vorbis/vq/make_residue_books.pl
new file mode 100755
index 0000000..b37d0dc
--- /dev/null
+++ b/vorbis/vq/make_residue_books.pl
@@ -0,0 +1,177 @@
+#!/usr/bin/perl
+
+# quick, very dirty little script so that we can put all the
+# information for building a residue book set (except the original
+# partitioning) in one spec file.
+
+#eg:
+
+# >res0_128_128 interleaved
+# haux 44c0_s/resaux_0.vqd res0_96_128aux 0,4,2 9
+# :1 res0_128_128_1.vqd, 4, nonseq cull, 0 +- 1
+# :2 res0_128_128_2.vqd, 4, nonseq, 0 +- 1(.7) 2
+# :3 res0_128_128_3.vqd, 4, nonseq, 0 +- 1(.7) 3 5
+# :4 res0_128_128_4.vqd, 2, nonseq, 0 +- 1(.7) 3 5 8 11
+# :5 res0_128_128_5.vqd, 1, nonseq, 0 +- 1 3 5 8 11 14 17 20 24 28 31 35 39
+
+
+die "Could not open $ARGV[0]: $!" unless open (F,$ARGV[0]);
+
+$goflag=0;
+while($line=<F>){
+
+ print "#### $line";
+ if($line=~m/^GO/){
+ $goflag=1;
+ next;
+ }
+
+ if($goflag==0){
+ if($line=~m/\S+/ && !($line=~m/^\#/) ){
+ my $command=$line;
+ print ">>> $command";
+ die "Couldn't shell command.\n\tcommand:$command\n"
+ if syst($command);
+ }
+ next;
+ }
+
+ # >res0_128_128
+ if($line=~m/^>(\S+)\s+(\S*)/){
+ # set the output name
+ $globalname=$1;
+ $interleave=$2;
+ next;
+ }
+
+ # haux 44c0_s/resaux_0.vqd res0_96_128aux 0,4,2 9
+ if($line=~m/^h(.*)/){
+ # build a huffman book (no mapping)
+ my($name,$datafile,$bookname,$interval,$range)=split(' ',$1);
+
+ # check the desired subdir to see if the data file exists
+ if(-e $datafile){
+ my $command="cp $datafile $bookname.tmp";
+ print ">>> $command\n";
+ die "Couldn't access partition data file.\n\tcommand:$command\n"
+ if syst($command);
+
+ my $command="huffbuild $bookname.tmp $interval";
+ print ">>> $command\n";
+ die "Couldn't build huffbook.\n\tcommand:$command\n"
+ if syst($command);
+
+ my $command="rm $bookname.tmp";
+ print ">>> $command\n";
+ die "Couldn't remove temporary file.\n\tcommand:$command\n"
+ if syst($command);
+ }else{
+ my $command="huffbuild $bookname.tmp 0-$range";
+ print ">>> $command\n";
+ die "Couldn't build huffbook.\n\tcommand:$command\n"
+ if syst($command);
+
+ }
+ next;
+ }
+
+ # :1 res0_128_128_1.vqd, 4, nonseq, 0 +- 1
+ if($line=~m/^:(.*)/){
+ my($namedata,$dim,$seqp,$vals)=split(',',$1);
+ my($name,$datafile)=split(' ',$namedata);
+ # build value list
+ my$plusminus="+";
+ my$list;
+ my$thlist;
+ my$count=0;
+ foreach my$val (split(' ',$vals)){
+ if($val=~/\-?\+?\d+/){
+ my$th;
+
+ # got an explicit threshhint?
+ if($val=~/([0-9\.]+)\(([^\)]+)/){
+ $val=$1;
+ $th=$2;
+ }
+
+ if($plusminus=~/-/){
+ $list.="-$val ";
+ if(defined($th)){
+ $thlist.="," if(defined($thlist));
+ $thlist.="-$th";
+ }
+ $count++;
+ }
+ if($plusminus=~/\+/){
+ $list.="$val ";
+ if(defined($th)){
+ $thlist.="," if(defined($thlist));
+ $thlist.="$th";
+ }
+ $count++;
+ }
+ }else{
+ $plusminus=$val;
+ }
+ }
+ die "Couldn't open temp file $globalname$name.vql: $!" unless
+ open(G,">$globalname$name.vql");
+ print G "$count $dim 0 ";
+ if($seqp=~/non/){
+ print G "0\n$list\n";
+ }else{
+ print G "1\n$list\n";
+ }
+ close(G);
+
+ my $command="latticebuild $globalname$name.vql > $globalname$name.vqh";
+ print ">>> $command\n";
+ die "Couldn't build latticebook.\n\tcommand:$command\n"
+ if syst($command);
+
+ if(-e $datafile){
+
+ if($interleave=~/non/){
+ $restune="res1tune";
+ }else{
+ $restune="res0tune";
+ }
+
+ if($seqp=~/cull/){
+ my $command="$restune $globalname$name.vqh $datafile 1 > temp$$.vqh";
+ print ">>> $command\n";
+ die "Couldn't tune latticebook.\n\tcommand:$command\n"
+ if syst($command);
+ }else{
+ my $command="$restune $globalname$name.vqh $datafile > temp$$.vqh";
+ print ">>> $command\n";
+ die "Couldn't tune latticebook.\n\tcommand:$command\n"
+ if syst($command);
+ }
+
+ my $command="mv temp$$.vqh $globalname$name.vqh";
+ print ">>> $command\n";
+ die "Couldn't rename latticebook.\n\tcommand:$command\n"
+ if syst($command);
+
+ }else{
+ print "No matching training file; leaving this codebook untrained.\n";
+ }
+
+ my $command="rm $globalname$name.vql";
+ print ">>> $command\n";
+ die "Couldn't remove temp files.\n\tcommand:$command\n"
+ if syst($command);
+
+ next;
+ }
+}
+
+$command="rm -f temp$$.vqd";
+print ">>> $command\n";
+die "Couldn't remove temp files.\n\tcommand:$command\n"
+ if syst($command);
+
+sub syst{
+ system(@_)/256;
+}
diff --git a/vorbis/vq/metrics.c b/vorbis/vq/metrics.c
new file mode 100644
index 0000000..e74831a
--- /dev/null
+++ b/vorbis/vq/metrics.c
@@ -0,0 +1,294 @@
+/********************************************************************
+ * *
+ * 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 calls to collect codebook metrics
+
+ ********************************************************************/
+
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+#include "bookutil.h"
+
+/* collect the following metrics:
+
+ mean and mean squared amplitude
+ mean and mean squared error
+ mean and mean squared error (per sample) by entry
+ worst case fit by entry
+ entry cell size
+ hits by entry
+ total bits
+ total samples
+ (average bits per sample)*/
+
+
+/* set up metrics */
+
+float meanamplitude_acc=0.f;
+float meanamplitudesq_acc=0.f;
+float meanerror_acc=0.f;
+float meanerrorsq_acc=0.f;
+
+float **histogram=NULL;
+float **histogram_error=NULL;
+float **histogram_errorsq=NULL;
+float **histogram_hi=NULL;
+float **histogram_lo=NULL;
+float bits=0.f;
+float count=0.f;
+
+static float *_now(codebook *c, int i){
+ return c->valuelist+i*c->c->dim;
+}
+
+int books=0;
+
+void process_preprocess(codebook **bs,char *basename){
+ int i;
+ while(bs[books])books++;
+
+ if(books){
+ histogram=_ogg_calloc(books,sizeof(float *));
+ histogram_error=_ogg_calloc(books,sizeof(float *));
+ histogram_errorsq=_ogg_calloc(books,sizeof(float *));
+ histogram_hi=_ogg_calloc(books,sizeof(float *));
+ histogram_lo=_ogg_calloc(books,sizeof(float *));
+ }else{
+ fprintf(stderr,"Specify at least one codebook\n");
+ exit(1);
+ }
+
+ for(i=0;i<books;i++){
+ codebook *b=bs[i];
+ histogram[i]=_ogg_calloc(b->entries,sizeof(float));
+ histogram_error[i]=_ogg_calloc(b->entries*b->dim,sizeof(float));
+ histogram_errorsq[i]=_ogg_calloc(b->entries*b->dim,sizeof(float));
+ histogram_hi[i]=_ogg_calloc(b->entries*b->dim,sizeof(float));
+ histogram_lo[i]=_ogg_calloc(b->entries*b->dim,sizeof(float));
+ }
+}
+
+static float _dist(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 acc;
+}
+
+void cell_spacing(codebook *c){
+ int j,k;
+ float min=-1.f,max=-1.f,mean=0.f,meansq=0.f;
+ long total=0;
+
+ /* minimum, maximum, mean, ms cell spacing */
+ for(j=0;j<c->c->entries;j++){
+ if(c->c->lengthlist[j]>0){
+ float localmin=-1.;
+ for(k=0;k<c->c->entries;k++){
+ if(c->c->lengthlist[k]>0){
+ float this=_dist(c->c->dim,_now(c,j),_now(c,k));
+ if(j!=k &&
+ (localmin==-1 || this<localmin))
+ localmin=this;
+ }
+ }
+
+ if(min==-1 || localmin<min)min=localmin;
+ if(max==-1 || localmin>max)max=localmin;
+ mean+=sqrt(localmin);
+ meansq+=localmin;
+ total++;
+ }
+ }
+
+ fprintf(stderr,"\tminimum cell spacing (closest side): %g\n",sqrt(min));
+ fprintf(stderr,"\tmaximum cell spacing (closest side): %g\n",sqrt(max));
+ fprintf(stderr,"\tmean closest side spacing: %g\n",mean/total);
+ fprintf(stderr,"\tmean sq closest side spacing: %g\n",sqrt(meansq/total));
+}
+
+void process_postprocess(codebook **bs,char *basename){
+ int i,k,book;
+ char *buffer=alloca(strlen(basename)+80);
+
+ fprintf(stderr,"Done. Processed %ld data points:\n\n",
+ (long)count);
+
+ fprintf(stderr,"Global statistics:******************\n\n");
+
+ fprintf(stderr,"\ttotal samples: %ld\n",(long)count);
+ fprintf(stderr,"\ttotal bits required to code: %ld\n",(long)bits);
+ fprintf(stderr,"\taverage bits per sample: %g\n\n",bits/count);
+
+ fprintf(stderr,"\tmean sample amplitude: %g\n",
+ meanamplitude_acc/count);
+ fprintf(stderr,"\tmean squared sample amplitude: %g\n\n",
+ sqrt(meanamplitudesq_acc/count));
+
+ fprintf(stderr,"\tmean code error: %g\n",
+ meanerror_acc/count);
+ fprintf(stderr,"\tmean squared code error: %g\n\n",
+ sqrt(meanerrorsq_acc/count));
+
+ for(book=0;book<books;book++){
+ FILE *out;
+ codebook *b=bs[book];
+ int n=b->c->entries;
+ int dim=b->c->dim;
+
+ fprintf(stderr,"Book %d statistics:------------------\n",book);
+
+ cell_spacing(b);
+
+ sprintf(buffer,"%s-%d-mse.m",basename,book);
+ out=fopen(buffer,"w");
+ if(!out){
+ fprintf(stderr,"Could not open file %s for writing\n",buffer);
+ exit(1);
+ }
+
+ for(i=0;i<n;i++){
+ for(k=0;k<dim;k++){
+ fprintf(out,"%d, %g, %g\n",
+ i*dim+k,(b->valuelist+i*dim)[k],
+ sqrt((histogram_errorsq[book]+i*dim)[k]/histogram[book][i]));
+ }
+ }
+ fclose(out);
+
+ sprintf(buffer,"%s-%d-me.m",basename,book);
+ out=fopen(buffer,"w");
+ if(!out){
+ fprintf(stderr,"Could not open file %s for writing\n",buffer);
+ exit(1);
+ }
+
+ for(i=0;i<n;i++){
+ for(k=0;k<dim;k++){
+ fprintf(out,"%d, %g, %g\n",
+ i*dim+k,(b->valuelist+i*dim)[k],
+ (histogram_error[book]+i*dim)[k]/histogram[book][i]);
+ }
+ }
+ fclose(out);
+
+ sprintf(buffer,"%s-%d-worst.m",basename,book);
+ out=fopen(buffer,"w");
+ if(!out){
+ fprintf(stderr,"Could not open file %s for writing\n",buffer);
+ exit(1);
+ }
+
+ for(i=0;i<n;i++){
+ for(k=0;k<dim;k++){
+ fprintf(out,"%d, %g, %g, %g\n",
+ i*dim+k,(b->valuelist+i*dim)[k],
+ (b->valuelist+i*dim)[k]+(histogram_lo[book]+i*dim)[k],
+ (b->valuelist+i*dim)[k]+(histogram_hi[book]+i*dim)[k]);
+ }
+ }
+ fclose(out);
+ }
+}
+
+float process_one(codebook *b,int book,float *a,int dim,int step,int addmul,
+ float base){
+ int j,entry;
+ float amplitude=0.f;
+
+ if(book==0){
+ float last=base;
+ for(j=0;j<dim;j++){
+ amplitude=a[j*step]-(b->c->q_sequencep?last:0);
+ meanamplitude_acc+=fabs(amplitude);
+ meanamplitudesq_acc+=amplitude*amplitude;
+ count++;
+ last=a[j*step];
+ }
+ }
+
+ if(b->c->q_sequencep){
+ float temp;
+ for(j=0;j<dim;j++){
+ temp=a[j*step];
+ a[j*step]-=base;
+ }
+ base=temp;
+ }
+
+ entry=vorbis_book_besterror(b,a,step,addmul);
+
+ if(entry==-1){
+ fprintf(stderr,"Internal error: _best returned -1.\n");
+ exit(1);
+ }
+
+ histogram[book][entry]++;
+ bits+=vorbis_book_codelen(b,entry);
+
+ for(j=0;j<dim;j++){
+ float error=a[j*step];
+
+ if(book==books-1){
+ meanerror_acc+=fabs(error);
+ meanerrorsq_acc+=error*error;
+ }
+ histogram_errorsq[book][entry*dim+j]+=error*error;
+ histogram_error[book][entry*dim+j]+=fabs(error);
+ if(histogram[book][entry]==0 || histogram_hi[book][entry*dim+j]<error)
+ histogram_hi[book][entry*dim+j]=error;
+ if(histogram[book][entry]==0 || histogram_lo[book][entry*dim+j]>error)
+ histogram_lo[book][entry*dim+j]=error;
+ }
+ return base;
+}
+
+
+void process_vector(codebook **bs,int *addmul,int inter,float *a,int n){
+ int bi;
+ int i;
+
+ for(bi=0;bi<books;bi++){
+ codebook *b=bs[bi];
+ int dim=b->dim;
+ float base=0.f;
+
+ if(inter){
+ for(i=0;i<n/dim;i++)
+ base=process_one(b,bi,a+i,dim,n/dim,addmul[bi],base);
+ }else{
+ for(i=0;i<=n-dim;i+=dim)
+ base=process_one(b,bi,a+i,dim,1,addmul[bi],base);
+ }
+ }
+
+ if((long)(count)%100)spinnit("working.... samples: ",count);
+}
+
+void process_usage(void){
+ fprintf(stderr,
+ "usage: vqmetrics [-i] +|*<codebook>.vqh [ +|*<codebook.vqh> ]... \n"
+ " datafile.vqd [datafile.vqd]...\n\n"
+ " data can be taken on stdin. -i indicates interleaved coding.\n"
+ " Output goes to output files:\n"
+ " basename-me.m: gnuplot: mean error by entry value\n"
+ " basename-mse.m: gnuplot: mean square error by entry value\n"
+ " basename-worst.m: gnuplot: worst error by entry value\n"
+ " basename-distance.m: gnuplot file showing distance probability\n"
+ "\n");
+
+}
diff --git a/vorbis/vq/vqgen.c b/vorbis/vq/vqgen.c
new file mode 100644
index 0000000..934d264
--- /dev/null
+++ b/vorbis/vq/vqgen.c
@@ -0,0 +1,566 @@
+/********************************************************************
+ * *
+ * 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: train a VQ codebook
+
+ ********************************************************************/
+
+/* 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 "vqgen.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
+*/
+
+/* Codebook training ****************************************************
+ *
+ * The basic idea here is that a VQ codebook is like an m-dimensional
+ * foam with n bubbles. The bubbles compete for space/volume and are
+ * 'pressurized' [biased] according to some metric. The basic alg
+ * iterates through allowing the bubbles to compete for space until
+ * they converge (if the damping is dome properly) on a steady-state
+ * solution. Individual input points, collected from libvorbis, are
+ * used to train the algorithm monte-carlo style. */
+
+/* internal helpers *****************************************************/
+#define vN(data,i) (data+v->elements*i)
+
+/* default metric; squared 'distance' from desired value. */
+float _dist(vqgen *v,float *a, float *b){
+ int i;
+ int el=v->elements;
+ float acc=0.f;
+ for(i=0;i<el;i++){
+ float val=(a[i]-b[i]);
+ acc+=val*val;
+ }
+ return sqrt(acc);
+}
+
+float *_weight_null(vqgen *v,float *a){
+ return a;
+}
+
+/* *must* be beefed up. */
+void _vqgen_seed(vqgen *v){
+ long i;
+ for(i=0;i<v->entries;i++)
+ memcpy(_now(v,i),_point(v,i),sizeof(float)*v->elements);
+ v->seeded=1;
+}
+
+int directdsort(const void *a, const void *b){
+ float av=*((float *)a);
+ float bv=*((float *)b);
+ return (av<bv)-(av>bv);
+}
+
+void vqgen_cellmetric(vqgen *v){
+ int j,k;
+ float min=-1.f,max=-1.f,mean=0.f,acc=0.f;
+ long dup=0,unused=0;
+ #ifdef NOISY
+ int i;
+ char buff[80];
+ float spacings[v->entries];
+ int count=0;
+ FILE *cells;
+ sprintf(buff,"cellspace%d.m",v->it);
+ cells=fopen(buff,"w");
+#endif
+
+ /* minimum, maximum, cell spacing */
+ for(j=0;j<v->entries;j++){
+ float localmin=-1.;
+
+ for(k=0;k<v->entries;k++){
+ if(j!=k){
+ float this=_dist(v,_now(v,j),_now(v,k));
+ if(this>0){
+ if(v->assigned[k] && (localmin==-1 || this<localmin))
+ localmin=this;
+ }else{
+ if(k<j){
+ dup++;
+ break;
+ }
+ }
+ }
+ }
+ if(k<v->entries)continue;
+
+ if(v->assigned[j]==0){
+ unused++;
+ continue;
+ }
+
+ localmin=v->max[j]+localmin/2; /* this gives us rough diameter */
+ if(min==-1 || localmin<min)min=localmin;
+ if(max==-1 || localmin>max)max=localmin;
+ mean+=localmin;
+ acc++;
+#ifdef NOISY
+ spacings[count++]=localmin;
+#endif
+ }
+
+ fprintf(stderr,"cell diameter: %.03g::%.03g::%.03g (%ld unused/%ld dup)\n",
+ min,mean/acc,max,unused,dup);
+
+#ifdef NOISY
+ qsort(spacings,count,sizeof(float),directdsort);
+ for(i=0;i<count;i++)
+ fprintf(cells,"%g\n",spacings[i]);
+ fclose(cells);
+#endif
+
+}
+
+/* External calls *******************************************************/
+
+/* We have two forms of quantization; in the first, each vector
+ element in the codebook entry is orthogonal. Residues would use this
+ quantization for example.
+
+ In the second, we have a sequence of monotonically increasing
+ values that we wish to quantize as deltas (to save space). We
+ still need to quantize so that absolute values are accurate. For
+ example, LSP quantizes all absolute values, but the book encodes
+ distance between values because each successive value is larger
+ than the preceeding value. Thus the desired quantibits apply to
+ the encoded (delta) values, not abs positions. This requires minor
+ additional encode-side trickery. */
+
+void vqgen_quantize(vqgen *v,quant_meta *q){
+
+ float maxdel;
+ float mindel;
+
+ float delta;
+ float maxquant=((1<<q->quant)-1);
+
+ int j,k;
+
+ mindel=maxdel=_now(v,0)[0];
+
+ for(j=0;j<v->entries;j++){
+ float last=0.f;
+ for(k=0;k<v->elements;k++){
+ if(mindel>_now(v,j)[k]-last)mindel=_now(v,j)[k]-last;
+ if(maxdel<_now(v,j)[k]-last)maxdel=_now(v,j)[k]-last;
+ if(q->sequencep)last=_now(v,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=(maxdel-mindel)/((1<<q->quant)-1.5f);
+
+ q->min=_float32_pack(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);
+ }
+ if(q->sequencep)last=(now*delta)+mindel+last;
+ }
+ }
+}
+
+/* much easier :-). Unlike in the codebook, we don't un-log log
+ scales; we just make sure they're properly offset. */
+void vqgen_unquantize(vqgen *v,quant_meta *q){
+ long j,k;
+ float mindel=_float32_unpack(q->min);
+ float delta=_float32_unpack(q->delta);
+
+ for(j=0;j<v->entries;j++){
+ float last=0.f;
+ for(k=0;k<v->elements;k++){
+ float now=_now(v,j)[k];
+ now=fabs(now)*delta+last+mindel;
+ if(q->sequencep)last=now;
+ _now(v,j)[k]=now;
+ }
+ }
+}
+
+void vqgen_init(vqgen *v,int elements,int aux,int entries,float mindist,
+ float (*metric)(vqgen *,float *, float *),
+ float *(*weight)(vqgen *,float *),int centroid){
+ memset(v,0,sizeof(vqgen));
+
+ v->centroid=centroid;
+ v->elements=elements;
+ v->aux=aux;
+ v->mindist=mindist;
+ v->allocated=32768;
+ v->pointlist=_ogg_malloc(v->allocated*(v->elements+v->aux)*sizeof(float));
+
+ v->entries=entries;
+ v->entrylist=_ogg_malloc(v->entries*v->elements*sizeof(float));
+ v->assigned=_ogg_malloc(v->entries*sizeof(long));
+ v->bias=_ogg_calloc(v->entries,sizeof(float));
+ v->max=_ogg_calloc(v->entries,sizeof(float));
+ if(metric)
+ v->metric_func=metric;
+ else
+ v->metric_func=_dist;
+ if(weight)
+ v->weight_func=weight;
+ else
+ v->weight_func=_weight_null;
+
+ v->asciipoints=tmpfile();
+
+}
+
+void vqgen_addpoint(vqgen *v, float *p,float *a){
+ int k;
+ for(k=0;k<v->elements;k++)
+ fprintf(v->asciipoints,"%.12g\n",p[k]);
+ for(k=0;k<v->aux;k++)
+ fprintf(v->asciipoints,"%.12g\n",a[k]);
+
+ if(v->points>=v->allocated){
+ v->allocated*=2;
+ v->pointlist=_ogg_realloc(v->pointlist,v->allocated*(v->elements+v->aux)*
+ sizeof(float));
+ }
+
+ memcpy(_point(v,v->points),p,sizeof(float)*v->elements);
+ if(v->aux)memcpy(_point(v,v->points)+v->elements,a,sizeof(float)*v->aux);
+
+ /* quantize to the density mesh if it's selected */
+ if(v->mindist>0.f){
+ /* quantize to the mesh */
+ for(k=0;k<v->elements+v->aux;k++)
+ _point(v,v->points)[k]=
+ rint(_point(v,v->points)[k]/v->mindist)*v->mindist;
+ }
+ v->points++;
+ if(!(v->points&0xff))spinnit("loading... ",v->points);
+}
+
+/* yes, not threadsafe. These utils aren't */
+static int sortit=0;
+static int sortsize=0;
+static int meshcomp(const void *a,const void *b){
+ if(((sortit++)&0xfff)==0)spinnit("sorting mesh...",sortit);
+ return(memcmp(a,b,sortsize));
+}
+
+void vqgen_sortmesh(vqgen *v){
+ sortit=0;
+ if(v->mindist>0.f){
+ long i,march=1;
+
+ /* sort to make uniqueness detection trivial */
+ sortsize=(v->elements+v->aux)*sizeof(float);
+ qsort(v->pointlist,v->points,sortsize,meshcomp);
+
+ /* now march through and eliminate dupes */
+ for(i=1;i<v->points;i++){
+ if(memcmp(_point(v,i),_point(v,i-1),sortsize)){
+ /* a new, unique entry. march it down */
+ if(i>march)memcpy(_point(v,march),_point(v,i),sortsize);
+ march++;
+ }
+ spinnit("eliminating density... ",v->points-i);
+ }
+
+ /* we're done */
+ fprintf(stderr,"\r%ld training points remining out of %ld"
+ " after density mesh (%ld%%)\n",march,v->points,march*100/v->points);
+ v->points=march;
+
+ }
+ v->sorted=1;
+}
+
+float vqgen_iterate(vqgen *v,int biasp){
+ long i,j,k;
+
+ float fdesired;
+ long desired;
+ long desired2;
+
+ float asserror=0.f;
+ float meterror=0.f;
+ float *new;
+ float *new2;
+ long *nearcount;
+ float *nearbias;
+ #ifdef NOISY
+ char buff[80];
+ FILE *assig;
+ FILE *bias;
+ FILE *cells;
+ sprintf(buff,"cells%d.m",v->it);
+ cells=fopen(buff,"w");
+ sprintf(buff,"assig%d.m",v->it);
+ assig=fopen(buff,"w");
+ sprintf(buff,"bias%d.m",v->it);
+ bias=fopen(buff,"w");
+ #endif
+
+
+ if(v->entries<2){
+ fprintf(stderr,"generation requires at least two entries\n");
+ exit(1);
+ }
+
+ if(!v->sorted)vqgen_sortmesh(v);
+ if(!v->seeded)_vqgen_seed(v);
+
+ fdesired=(float)v->points/v->entries;
+ desired=fdesired;
+ desired2=desired*2;
+ new=_ogg_malloc(sizeof(float)*v->entries*v->elements);
+ new2=_ogg_malloc(sizeof(float)*v->entries*v->elements);
+ nearcount=_ogg_malloc(v->entries*sizeof(long));
+ nearbias=_ogg_malloc(v->entries*desired2*sizeof(float));
+
+ /* fill in nearest points for entry biasing */
+ /*memset(v->bias,0,sizeof(float)*v->entries);*/
+ memset(nearcount,0,sizeof(long)*v->entries);
+ memset(v->assigned,0,sizeof(long)*v->entries);
+ if(biasp){
+ for(i=0;i<v->points;i++){
+ float *ppt=v->weight_func(v,_point(v,i));
+ float firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0];
+ float secondmetric=v->metric_func(v,_now(v,1),ppt)+v->bias[1];
+ long firstentry=0;
+ long secondentry=1;
+
+ if(!(i&0xff))spinnit("biasing... ",v->points+v->points+v->entries-i);
+
+ if(firstmetric>secondmetric){
+ float temp=firstmetric;
+ firstmetric=secondmetric;
+ secondmetric=temp;
+ firstentry=1;
+ secondentry=0;
+ }
+
+ for(j=2;j<v->entries;j++){
+ float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j];
+ if(thismetric<secondmetric){
+ if(thismetric<firstmetric){
+ secondmetric=firstmetric;
+ secondentry=firstentry;
+ firstmetric=thismetric;
+ firstentry=j;
+ }else{
+ secondmetric=thismetric;
+ secondentry=j;
+ }
+ }
+ }
+
+ j=firstentry;
+ for(j=0;j<v->entries;j++){
+
+ float thismetric,localmetric;
+ float *nearbiasptr=nearbias+desired2*j;
+ long k=nearcount[j];
+
+ localmetric=v->metric_func(v,_now(v,j),ppt);
+ /* 'thismetric' is to be the bias value necessary in the current
+ arrangement for entry j to capture point i */
+ if(firstentry==j){
+ /* use the secondary entry as the threshhold */
+ thismetric=secondmetric-localmetric;
+ }else{
+ /* use the primary entry as the threshhold */
+ thismetric=firstmetric-localmetric;
+ }
+
+ /* support the idea of 'minimum distance'... if we want the
+ cells in a codebook to be roughly some minimum size (as with
+ the low resolution residue books) */
+
+ /* a cute two-stage delayed sorting hack */
+ if(k<desired){
+ nearbiasptr[k]=thismetric;
+ k++;
+ if(k==desired){
+ spinnit("biasing... ",v->points+v->points+v->entries-i);
+ qsort(nearbiasptr,desired,sizeof(float),directdsort);
+ }
+
+ }else if(thismetric>nearbiasptr[desired-1]){
+ nearbiasptr[k]=thismetric;
+ k++;
+ if(k==desired2){
+ spinnit("biasing... ",v->points+v->points+v->entries-i);
+ qsort(nearbiasptr,desired2,sizeof(float),directdsort);
+ k=desired;
+ }
+ }
+ nearcount[j]=k;
+ }
+ }
+
+ /* inflate/deflate */
+
+ for(i=0;i<v->entries;i++){
+ float *nearbiasptr=nearbias+desired2*i;
+
+ spinnit("biasing... ",v->points+v->entries-i);
+
+ /* due to the delayed sorting, we likely need to finish it off....*/
+ if(nearcount[i]>desired)
+ qsort(nearbiasptr,nearcount[i],sizeof(float),directdsort);
+
+ v->bias[i]=nearbiasptr[desired-1];
+
+ }
+ }else{
+ memset(v->bias,0,v->entries*sizeof(float));
+ }
+
+ /* Now assign with new bias and find new midpoints */
+ for(i=0;i<v->points;i++){
+ float *ppt=v->weight_func(v,_point(v,i));
+ float firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0];
+ long firstentry=0;
+
+ if(!(i&0xff))spinnit("centering... ",v->points-i);
+
+ for(j=0;j<v->entries;j++){
+ float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j];
+ if(thismetric<firstmetric){
+ firstmetric=thismetric;
+ firstentry=j;
+ }
+ }
+
+ j=firstentry;
+
+#ifdef NOISY
+ fprintf(cells,"%g %g\n%g %g\n\n",
+ _now(v,j)[0],_now(v,j)[1],
+ ppt[0],ppt[1]);
+#endif
+
+ firstmetric-=v->bias[j];
+ meterror+=firstmetric;
+
+ if(v->centroid==0){
+ /* set up midpoints for next iter */
+ if(v->assigned[j]++){
+ for(k=0;k<v->elements;k++)
+ vN(new,j)[k]+=ppt[k];
+ if(firstmetric>v->max[j])v->max[j]=firstmetric;
+ }else{
+ for(k=0;k<v->elements;k++)
+ vN(new,j)[k]=ppt[k];
+ v->max[j]=firstmetric;
+ }
+ }else{
+ /* centroid */
+ if(v->assigned[j]++){
+ for(k=0;k<v->elements;k++){
+ if(vN(new,j)[k]>ppt[k])vN(new,j)[k]=ppt[k];
+ if(vN(new2,j)[k]<ppt[k])vN(new2,j)[k]=ppt[k];
+ }
+ if(firstmetric>v->max[firstentry])v->max[j]=firstmetric;
+ }else{
+ for(k=0;k<v->elements;k++){
+ vN(new,j)[k]=ppt[k];
+ vN(new2,j)[k]=ppt[k];
+ }
+ v->max[firstentry]=firstmetric;
+ }
+ }
+ }
+
+ /* assign midpoints */
+
+ for(j=0;j<v->entries;j++){
+#ifdef NOISY
+ fprintf(assig,"%ld\n",v->assigned[j]);
+ fprintf(bias,"%g\n",v->bias[j]);
+#endif
+ asserror+=fabs(v->assigned[j]-fdesired);
+ if(v->assigned[j]){
+ if(v->centroid==0){
+ for(k=0;k<v->elements;k++)
+ _now(v,j)[k]=vN(new,j)[k]/v->assigned[j];
+ }else{
+ for(k=0;k<v->elements;k++)
+ _now(v,j)[k]=(vN(new,j)[k]+vN(new2,j)[k])/2.f;
+ }
+ }
+ }
+
+ asserror/=(v->entries*fdesired);
+
+ fprintf(stderr,"Pass #%d... ",v->it);
+ fprintf(stderr,": dist %g(%g) metric error=%g \n",
+ asserror,fdesired,meterror/v->points);
+ v->it++;
+
+ free(new);
+ free(nearcount);
+ free(nearbias);
+#ifdef NOISY
+ fclose(assig);
+ fclose(bias);
+ fclose(cells);
+#endif
+ return(asserror);
+}
+
diff --git a/vorbis/vq/vqgen.h b/vorbis/vq/vqgen.h
new file mode 100644
index 0000000..688379c
--- /dev/null
+++ b/vorbis/vq/vqgen.h
@@ -0,0 +1,84 @@
+/********************************************************************
+ * *
+ * 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
+
+ ********************************************************************/
+
+#ifndef _VQGEN_H_
+#define _VQGEN_H_
+
+typedef struct vqgen{
+ int seeded;
+ int sorted;
+
+ int it;
+ int elements;
+
+ int aux;
+ float mindist;
+ int centroid;
+
+ /* point cache */
+ float *pointlist;
+ long points;
+ long allocated;
+
+ /* entries */
+ float *entrylist;
+ long *assigned;
+ float *bias;
+ long entries;
+ float *max;
+
+ float (*metric_func) (struct vqgen *v,float *entry,float *point);
+ float *(*weight_func) (struct vqgen *v,float *point);
+
+ FILE *asciipoints;
+} vqgen;
+
+typedef struct {
+ long min; /* packed 24 bit float */
+ long delta; /* packed 24 bit float */
+ int quant; /* 0 < quant <= 16 */
+ int sequencep; /* bitflag */
+} quant_meta;
+
+static inline float *_point(vqgen *v,long ptr){
+ return v->pointlist+((v->elements+v->aux)*ptr);
+}
+
+static inline float *_aux(vqgen *v,long ptr){
+ return _point(v,ptr)+v->aux;
+}
+
+static inline float *_now(vqgen *v,long ptr){
+ return v->entrylist+(v->elements*ptr);
+}
+
+extern void vqgen_init(vqgen *v,
+ int elements,int aux,int entries,float mindist,
+ float (*metric)(vqgen *,float *, float *),
+ float *(*weight)(vqgen *,float *),int centroid);
+extern void vqgen_addpoint(vqgen *v, float *p,float *aux);
+
+extern float vqgen_iterate(vqgen *v,int biasp);
+extern void vqgen_unquantize(vqgen *v,quant_meta *q);
+extern void vqgen_quantize(vqgen *v,quant_meta *q);
+extern void vqgen_cellmetric(vqgen *v);
+
+#endif
+
+
+
+
+