From f375f3cb80bd7f7002e3eb987361922b8e59561a Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 11 Mar 2010 07:15:40 +0000 Subject: [PATCH] Add new book geenration descriptions Remove more dead utils svn path=/trunk/vorbis/; revision=16961 --- vq/44p-1.vqs | 49 +++++ vq/44p0.vqs | 49 +++++ vq/44p1.vqs | 49 +++++ vq/44p2.vqs | 52 +++++ vq/44p3.vqs | 52 +++++ vq/44p4.vqs | 52 +++++ vq/44p5.vqs | 52 +++++ vq/44p6.vqs | 52 +++++ vq/44p7.vqs | 52 +++++ vq/44p8.vqs | 52 +++++ vq/44p9.vqs | 52 +++++ vq/Makefile.am | 8 +- vq/auxpartition.pl | 71 ------- vq/build.c | 195 ----------------- vq/cascade.c | 91 -------- vq/genericdata.c | 61 ------ vq/lspdata.c | 157 -------------- vq/residue_entropy | 58 ----- vq/residuedata.c | 160 -------------- vq/residuesplit.c | 282 ------------------------ vq/run.c | 216 ------------------- vq/train.c | 364 ------------------------------- vq/vqext.h | 34 --- vq/vqsplit.c | 612 ----------------------------------------------------- vq/vqsplit.h | 37 ---- 25 files changed, 567 insertions(+), 2342 deletions(-) create mode 100644 vq/44p-1.vqs create mode 100644 vq/44p0.vqs create mode 100644 vq/44p1.vqs create mode 100644 vq/44p2.vqs create mode 100644 vq/44p3.vqs create mode 100644 vq/44p4.vqs create mode 100644 vq/44p5.vqs create mode 100644 vq/44p6.vqs create mode 100644 vq/44p7.vqs create mode 100644 vq/44p8.vqs create mode 100644 vq/44p9.vqs delete mode 100755 vq/auxpartition.pl delete mode 100644 vq/build.c delete mode 100644 vq/cascade.c delete mode 100644 vq/genericdata.c delete mode 100644 vq/lspdata.c delete mode 100755 vq/residue_entropy delete mode 100644 vq/residuedata.c delete mode 100644 vq/residuesplit.c delete mode 100644 vq/run.c delete mode 100644 vq/train.c delete mode 100644 vq/vqext.h delete mode 100644 vq/vqsplit.c delete mode 100644 vq/vqsplit.h diff --git a/vq/44p-1.vqs b/vq/44p-1.vqs new file mode 100644 index 0000000..02d26fb --- /dev/null +++ b/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/vq/44p0.vqs b/vq/44p0.vqs new file mode 100644 index 0000000..16479ba --- /dev/null +++ b/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/vq/44p1.vqs b/vq/44p1.vqs new file mode 100644 index 0000000..74352c3 --- /dev/null +++ b/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/vq/44p2.vqs b/vq/44p2.vqs new file mode 100644 index 0000000..7eabbab --- /dev/null +++ b/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/vq/44p3.vqs b/vq/44p3.vqs new file mode 100644 index 0000000..b1c66a6 --- /dev/null +++ b/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/vq/44p4.vqs b/vq/44p4.vqs new file mode 100644 index 0000000..4b70436 --- /dev/null +++ b/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/vq/44p5.vqs b/vq/44p5.vqs new file mode 100644 index 0000000..0372321 --- /dev/null +++ b/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/vq/44p6.vqs b/vq/44p6.vqs new file mode 100644 index 0000000..9daad60 --- /dev/null +++ b/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/vq/44p7.vqs b/vq/44p7.vqs new file mode 100644 index 0000000..9ec5d02 --- /dev/null +++ b/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/vq/44p8.vqs b/vq/44p8.vqs new file mode 100644 index 0000000..a75af84 --- /dev/null +++ b/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/vq/44p9.vqs b/vq/44p9.vqs new file mode 100644 index 0000000..4c00780 --- /dev/null +++ b/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/vq/Makefile.am b/vq/Makefile.am index f68fdbc..6fd105c 100644 --- a/vq/Makefile.am +++ b/vq/Makefile.am @@ -21,11 +21,11 @@ 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 + floor_44.vqs 44p-1.vqs 44p0.vqs 44p1.vqs 44p2.vqs 44p3.vqs 44p4.vqs \ + 44p5.vqs 44p6.vqs 44p7.vqs 44p8.vqs 44p9.vqs -EXTRA_DIST = $(vqs_files) build.c cascade.c genericdata.c lspdata.c \ - make_floor_books.pl make_residue_books.pl metrics.c residue_entropy \ - residuedata.c residuesplit.c run.c train.c vqext.h auxpartition.pl +EXTRA_DIST = $(vqs_files) make_floor_books.pl make_residue_books.pl \ + metrics.c debugvq: $(MAKE) vq CFLAGS="@DEBUG@" diff --git a/vq/auxpartition.pl b/vq/auxpartition.pl deleted file mode 100755 index 05c5ed9..0000000 --- a/vq/auxpartition.pl +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/perl - -if($#ARGV<0){ - &usage; -} - -$|=1; - -$bands=0; - -foreach $arg (@ARGV){ - ($entries[$bands],$file[$bands])=split(/,/,$arg); - $bands++; -} - -# no time to deal with globs right now -if($bands>0){ - die unless open(ONE,"<".$file[0]); -} -if($bands>1){ - die unless open(TWO,"<".$file[1]); -} -if($bands>2){ - die unless open(THREE,"<".$file[2]); -} - - -while () { - my@nums = (); - @nums = split(/,/); - my$cols=$#nums; - for($i=0;$i<$cols;$i++){ - print 0+$nums[$i].", "; - } - if($bands>1){ - $_=; - @nums = (); - @nums = split(/,/); - $cols=$#nums; - for($i=0;$i<$cols;$i++){ - print $nums[$i]+$entries[0].", "; - } - if($bands>2){ - $_=; - @nums = (); - @nums = split(/,/); - $cols=$#nums; - for($i=0;$i<$cols;$i++){ - print $nums[$i]+$entries[0]+$entries[1].", "; - } - } - } - print "\n"; - -} - -if($bands>0){ - close ONE; -} -if($bands>1){ - close TWO; -} -if($bands>2){ - close THREE; -} - -sub usage{ - print "\nOggVorbis auxbook spectral partitioner\n\n"; - print "auxpartition.pl ,file [,file...]\n\n"; - exit(1); -} diff --git a/vq/build.c b/vq/build.c deleted file mode 100644 index ac76bc8..0000000 --- a/vq/build.c +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: utility main for building codebooks from training sets - last mod: $Id$ - - ********************************************************************/ - -#include -#include -#include -#include -#include -#include "bookutil.h" - -#include "vqgen.h" -#include "vqsplit.h" - -static char *linebuffer=NULL; -static int lbufsize=0; -static char *rline(FILE *in,FILE *out){ - long sofar=0; - if(feof(in))return NULL; - - while(1){ - int gotline=0; - - while(!gotline){ - if(sofar>=lbufsize){ - if(!lbufsize){ - lbufsize=1024; - linebuffer=_ogg_malloc(lbufsize); - }else{ - lbufsize*=2; - linebuffer=_ogg_realloc(linebuffer,lbufsize); - } - } - { - long c=fgetc(in); - switch(c){ - case '\n': - case EOF: - gotline=1; - break; - default: - linebuffer[sofar++]=c; - linebuffer[sofar]='\0'; - break; - } - } - } - - if(linebuffer[0]=='#'){ - sofar=0; - }else{ - return(linebuffer); - } - } -} - -/* command line: - buildvq file -*/ - -int main(int argc,char *argv[]){ - vqgen v; - static_codebook c; - codebook b; - quant_meta q; - - long *quantlist=NULL; - int entries=-1,dim=-1,aux=-1; - FILE *out=NULL; - FILE *in=NULL; - char *line,*name; - long i,j,k; - - b.c=&c; - - if(argv[1]==NULL){ - fprintf(stderr,"Need a trained data set on the command line.\n"); - exit(1); - } - - { - char *ptr; - char *filename=strdup(argv[1]); - - in=fopen(filename,"r"); - if(!in){ - fprintf(stderr,"Could not open input file %s\n",filename); - exit(1); - } - - ptr=strrchr(filename,'-'); - if(ptr){ - *ptr='\0'; - name=strdup(filename); - sprintf(ptr,".vqh"); - }else{ - name=strdup(filename); - strcat(filename,".vqh"); - } - - out=fopen(filename,"w"); - if(out==NULL){ - fprintf(stderr,"Unable to open %s for writing\n",filename); - exit(1); - } - } - - /* suck in the trained book */ - - /* read book type, but it doesn't matter */ - line=rline(in,out); - - line=rline(in,out); - if(sscanf(line,"%d %d %d",&entries,&dim,&aux)!=3){ - fprintf(stderr,"Syntax error reading book file\n"); - exit(1); - } - - /* just use it to allocate mem */ - vqgen_init(&v,dim,0,entries,0.f,NULL,NULL,0); - - /* quant */ - line=rline(in,out); - if(sscanf(line,"%ld %ld %d %d",&q.min,&q.delta, - &q.quant,&q.sequencep)!=4){ - fprintf(stderr,"Syntax error reading book file\n"); - exit(1); - } - - /* quantized entries */ - /* save quant data; we don't want to requantize later as our method - is currently imperfect wrt repeated application */ - i=0; - quantlist=_ogg_malloc(sizeof(long)*v.elements*v.entries); - for(j=0;j -#include -#include -#include "bookutil.h" - -/* set up metrics */ - -float count=0.f; - - -void process_preprocess(codebook **bs,char *basename){ -} - -void process_postprocess(codebook **b,char *basename){ - fprintf(stderr,"Done. \n"); -} - -float process_one(codebook *b,float *a,int dim,int step,int addmul, - float base){ - int j; - - if(b->c->q_sequencep){ - float temp; - for(j=0;jdim; - - if(inter){ - for(i=0;i.vqh [ +|* ]... \n" - " datafile.vqd [datafile.vqd]...\n\n" - " data can be taken on stdin. residual error data sent to\n" - " stdout.\n\n"); - -} diff --git a/vq/genericdata.c b/vq/genericdata.c deleted file mode 100644 index c35febe..0000000 --- a/vq/genericdata.c +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: generic euclidian distance metric for VQ codebooks - last mod: $Id$ - - ********************************************************************/ - -#include -#include -#include -#include "vqgen.h" -#include "vqext.h" - -char *vqext_booktype="GENERICdata"; -int vqext_aux=0; -quant_meta q={0,0,0,0}; /* non sequence data; each scalar - independent */ - -void vqext_quantize(vqgen *v,quant_meta *q){ - vqgen_quantize(v,q); -} - -float *vqext_weight(vqgen *v,float *p){ - /*noop*/ - return(p); -} - - /* candidate,actual */ -float vqext_metric(vqgen *v,float *e, float *p){ - int i; - float acc=0.f; - for(i=0;ielements;i++){ - float val=p[i]-e[i]; - acc+=val*val; - } - return sqrt(acc/v->elements); -} - -void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){ - vqgen_addpoint(v,b+start,NULL); -} - -void vqext_preprocess(vqgen *v){ - /* noop */ -} - - - - - - diff --git a/vq/lspdata.c b/vq/lspdata.c deleted file mode 100644 index 1aa9c37..0000000 --- a/vq/lspdata.c +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: metrics and quantization code for LSP VQ codebooks - last mod: $Id$ - - ********************************************************************/ - -#include -#include -#include -#include "vqgen.h" -#include "vqext.h" -#include "codebook.h" - -char *vqext_booktype="LSPdata"; -quant_meta q={0,0,0,1}; /* set sequence data */ -int vqext_aux=1; - -float global_maxdel=M_PI; -float global_mindel=M_PI; -#if 0 -void vqext_quantize(vqgen *v,quant_meta *q){ - float delta,mindel; - float maxquant=((1<quant)-1); - int j,k; - - /* first find the basic delta amount from the maximum span to be - encoded. Loosen the delta slightly to allow for additional error - during sequence quantization */ - - delta=(global_maxdel-global_mindel)/((1<quant)-1.5f); - - q->min=_float32_pack(global_mindel); - q->delta=_float32_pack(delta); - - mindel=_float32_unpack(q->min); - delta=_float32_unpack(q->delta); - - for(j=0;jentries;j++){ - float last=0; - for(k=0;kelements;k++){ - float val=_now(v,j)[k]; - float now=rint((val-last-mindel)/delta); - - _now(v,j)[k]=now; - if(now<0){ - /* be paranoid; this should be impossible */ - fprintf(stderr,"fault; quantized value<0\n"); - exit(1); - } - - if(now>maxquant){ - /* be paranoid; this should be impossible */ - fprintf(stderr,"fault; quantized value>max\n"); - exit(1); - } - last=(now*delta)+mindel+last; - } - } - -} -#else -void vqext_quantize(vqgen *v,quant_meta *q){ - vqgen_quantize(v,q); -} -#endif - -float *weight=NULL; -#if 0 -/* LSP training metric. We weight error proportional to distance - *between* LSP vector values. The idea of this metric is not to set - final cells, but get the midpoint spacing into a form conducive to - what we want, which is weighting toward preserving narrower - features. */ - -#define FUDGE (global_maxdel-weight[i]) - -float *vqext_weight(vqgen *v,float *p){ - int i; - int el=v->elements; - float lastp=0.f; - for(i=0;ielements; - float acc=0.f; - for(i=0;ielements); -} - -/* Data files are line-vectors, now just deltas. The codebook entries - want to be monotonically increasing, so we adjust */ - -/* assume vqext_aux==1 */ -void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){ - float *a=alloca(sizeof(float)*(dim+1)); /* +aux */ - float base=0; - int i; - - for(i=0;icols) /* +aux */ - a[i]=M_PI; - else - a[i]=b[i+start]+base; - - vqgen_addpoint(v,a,a+dim); -} - -/* we just need to calc the global_maxdel from the training set */ -void vqext_preprocess(vqgen *v){ - long j,k; - - global_maxdel=0.f; - global_mindel=M_PI; - for(j=0;jpoints;j++){ - float last=0.; - for(k=0;kelements+v->aux;k++){ - float p=_point(v,j)[k]; - if(p-last>global_maxdel)global_maxdel=p-last; - if(p-lastelements); -} - diff --git a/vq/residue_entropy b/vq/residue_entropy deleted file mode 100755 index 49c55a5..0000000 --- a/vq/residue_entropy +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/perl - -@quant=( - 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, - 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, - 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 -); - - -use POSIX; -my($groupn)=@ARGV; -my%hash; -my$count=0; -my$lines=0; - -if(!defined($groupn)){ - print "Usage: residue_entropy \n"; - exit(1); -} -$|=1; - -while () { - chop; - my@nums = (); - @nums = split(/,/); - $lines++; - - my$step=$#nums/$groupn; - for(my$i=0;$i<$step;$i++){ - my$key=""; - for(my$j=$i;$j<$#nums;$j+=$step){ - if($nums[$j]<0){ - $num=-$quant[int(-$nums[$j]*2)]; - }else{ - $num=$quant[int($nums[$j]*2)]; - } - $key.=":$num"; - } - - if(!defined($hash{$key})){ - $count++; - $hash{$key}=1; - } - } - - if(($lines % 1000)==0){ - print "\rworking... $lines lines, found $count values so far"; - } -} - -foreach $key (keys %hash){ - print "\t$key\n"; -} - -print "\r$count values total \n"; -print "Done.\n\n"; diff --git a/vq/residuedata.c b/vq/residuedata.c deleted file mode 100644 index 3ad4de9..0000000 --- a/vq/residuedata.c +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: metrics and quantization code for residue VQ codebooks - last mod: $Id$ - - ********************************************************************/ - -#include -#include -#include -#include -#include "vqgen.h" -#include "bookutil.h" -#include "../lib/scales.h" -#include "vqext.h" - -float scalequant=3.f; -char *vqext_booktype="RESdata"; -quant_meta q={0,0,0,0}; /* set sequence data */ -int vqext_aux=0; - -static float *quant_save=NULL; - -float *vqext_weight(vqgen *v,float *p){ - return p; -} - -/* quantize aligned on unit boundaries. Because our grid is likely - very coarse, play 'shuffle the blocks'; don't allow multiple - entries to fill the same spot as is nearly certain to happen. */ - -void vqext_quantize(vqgen *v,quant_meta *q){ - int j,k; - long dim=v->elements; - long n=v->entries; - float max=-1; - float *test=alloca(sizeof(float)*dim); - int moved=0; - - - /* allow movement only to unoccupied coordinates on the coarse grid */ - for(j=0;jmax)max=norm; - test[k]=norm; - } - - /* allow move only if unoccupied */ - if(quant_save){ - for(k=0;kmin=_float32_pack(0.f); - q->delta=_float32_pack(scalequant); - q->quant=_ilog(max); - - if(quant_save){ - memcpy(_now(v,0),quant_save,sizeof(float)*dim*n); - fprintf(stderr,"cells shifted this iteration: %d\n",moved); - } -} - - /* candidate,actual */ -float vqext_metric(vqgen *v,float *e, float *p){ - int i; - float acc=0.f; - for(i=0;ielements;i++){ - float val=p[i]-e[i]; - acc+=val*val; - } - return sqrt(acc); -} - -/* We don't interleave here; we assume that the interleave is provided - for us by residuesplit in vorbis/huff/ */ -void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){ - vqgen_addpoint(v,b+start,NULL); -} - -/* need to reseed because of the coarse quantization we tend to use on - residuals (which causes lots & lots of dupes) */ -void vqext_preprocess(vqgen *v){ - long i,j,k,l; - float *test=alloca(sizeof(float)*v->elements); - scalequant=q.quant; - - vqext_quantize(v,&q); - vqgen_unquantize(v,&q); - - /* if there are any dupes, reseed */ - for(k=0;kentries;k++){ - for(l=0;lelements)==0) - break; - } - if(lentries){ - fprintf(stderr,"reseeding with quantization....\n"); - - /* seed the inputs to input points, but points on unit boundaries, - ignoring quantbits for now, making sure each seed is unique */ - - for(i=0,j=0;ipoints && jentries;i++){ - for(k=0;kelements;k++){ - float val=_point(v,i)[k]; - test[k]=rint(val/scalequant)*scalequant; - } - - for(l=0;lelements;k++) - if(test[k]!=_now(v,l)[k]) - break; - if(k==v->elements)break; - } - if(l==j){ - memcpy(_now(v,j),test,v->elements*sizeof(float)); - j++; - } - } - - if(jelements){ - fprintf(stderr,"Not enough unique entries after prequantization\n"); - exit(1); - } - } - vqext_quantize(v,&q); - quant_save=_ogg_malloc(sizeof(float)*v->elements*v->entries); - memcpy(quant_save,_now(v,0),sizeof(float)*v->elements*v->entries); - vqgen_unquantize(v,&q); - -} - diff --git a/vq/residuesplit.c b/vq/residuesplit.c deleted file mode 100644 index c6422cb..0000000 --- a/vq/residuesplit.c +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: residue backend 0 partitioner/classifier - last mod: $Id$ - - ********************************************************************/ - -#include -#include -#include -#include -#include "bookutil.h" - -/* does not guard against invalid settings; eg, a subn of 16 and a - subgroup request of 32. Max subn of 128 */ -static float _testhack(float *vec,int n){ - int i,j=0; - float max=0.f; - float temp[128]; - float entropy=0.; - - /* setup */ - for(i=0;imax)max=temp[i]; - - for(i=0;i>=1; - j++; - - if(n<=0)break; - for(i=0;imax)max=temp[i]; - }*/ -} - -static FILE *of; -static FILE **or; - -/* we evaluate the the entropy measure for each interleaved subgroup */ -/* This is currently a bit specific to/hardwired for mapping 0; things - will need to change in the future when we get real multichannel - mappings */ -int quantaux(float *res,int n,float *ebound,float *mbound,int *subgrp,int parts, int subn, - int *class){ - long i,j,part=0; - int aux; - - for(i=0;i<=n-subn;i+=subn,part++){ - float max=0.f; - float lentropy=0.f; - - lentropy=_testhack(res+i,subn); - - for(j=0;jmax)max=fabs(res[i+j]); - - for(j=0;j [] []...\n" - " where begin,n,group is first scalar, \n" - " number of scalars of each in line,\n" - " number of scalars in a group\n" - " ent is the maximum entropy value allowed for membership in a group\n" - " peak is the maximum amplitude value allowed for membership in a group\n" - " subn is the maximum subpartiton number allowed in the group\n\n"); - exit(1); -} - -int main(int argc, char *argv[]){ - char *buffer; - char *base; - int i,j,parts,begin,n,subn,*subgrp,*class; - FILE **res; - int resfiles=0; - float *ebound,*mbound,*vec; - long c=0; - if(argc<5)usage(); - - /* count the res file names, open the files */ - while(!strcmp(argv[resfiles+1]+strlen(argv[resfiles+1])-4,".vqd")) - resfiles++; - if(resfiles<1)usage(); - - res=alloca(sizeof(*res)*resfiles); - for(i=0;i -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bookutil.h" - -/* command line: - utilname [-i] +|* input_book.vqh [+|* input_book.vqh] - input_data.vqd [input_data.vqd] - - produces output data on stdout - (may also take input data from stdin) - - */ - -extern void process_preprocess(codebook **b,char *basename); -extern void process_postprocess(codebook **b,char *basename); -extern void process_vector(codebook **b,int *addmul, int inter,float *a,int n); -extern void process_usage(void); - -int main(int argc,char *argv[]){ - char *basename; - codebook **b=_ogg_calloc(1,sizeof(codebook *)); - int *addmul=_ogg_calloc(1,sizeof(int)); - int books=0; - int input=0; - int interleave=0; - int j; - int start=0; - int num=-1; - argv++; - - if(*argv==NULL){ - process_usage(); - exit(1); - } - - /* yes, this is evil. However, it's very convenient to parse file - extentions */ - - while(*argv){ - if(*argv[0]=='-'){ - /* option */ - if(argv[0][1]=='s'){ - /* subvector */ - if(sscanf(argv[1],"%d,%d",&start,&num)!=2){ - num= -1; - if(sscanf(argv[1],"%d",&start)!=1){ - fprintf(stderr,"Syntax error using -s\n"); - exit(1); - } - } - argv+=2; - } - if(argv[0][1]=='i'){ - /* interleave */ - interleave=1; - argv+=1; - } - }else{ - /* input file. What kind? */ - char *dot; - char *ext=NULL; - char *name=strdup(*argv++); - dot=strrchr(name,'.'); - if(dot) - ext=dot+1; - else - ext=""; - - /* codebook */ - if(!strcmp(ext,"vqh")){ - int multp=0; - if(input){ - fprintf(stderr,"specify all input data (.vqd) files following\n" - "codebook header (.vqh) files\n"); - exit(1); - } - /* is it additive or multiplicative? */ - if(name[0]=='*'){ - multp=1; - name++; - } - if(name[0]=='+')name++; - - basename=strrchr(name,'/'); - if(basename) - basename=strdup(basename)+1; - else - basename=strdup(name); - dot=strrchr(basename,'.'); - if(dot)*dot='\0'; - - b=_ogg_realloc(b,sizeof(codebook *)*(books+2)); - b[books]=codebook_load(name); - addmul=_ogg_realloc(addmul,sizeof(int)*(books+1)); - addmul[books++]=multp; - b[books]=NULL; - } - - /* data file */ - if(!strcmp(ext,"vqd")){ - int cols; - long lines=0; - char *line; - float *vec; - FILE *in=fopen(name,"r"); - if(!in){ - fprintf(stderr,"Could not open input file %s\n",name); - exit(1); - } - - if(!input){ - process_preprocess(b,basename); - input++; - } - - reset_next_value(); - line=setup_line(in); - /* count cols before we start reading */ - { - char *temp=line; - while(*temp==' ')temp++; - for(cols=0;*temp;cols++){ - while(*temp>32)temp++; - while(*temp==' ')temp++; - } - } - vec=alloca(cols*sizeof(float)); - while(line){ - lines++; - for(j=0;j32)temp++; - while(*temp==' ')temp++; - } - } - vec=alloca(cols*sizeof(float)); - while(line){ - lines++; - for(j=0;j -#include -#include -#include -#include -#include -#include "vqgen.h" -#include "vqext.h" -#include "bookutil.h" - -static char *rline(FILE *in,FILE *out,int pass){ - while(1){ - char *line=get_line(in); - if(line && line[0]=='#'){ - if(pass)fprintf(out,"%s\n",line); - }else{ - return(line); - } - } -} - -/* command line: - trainvq vqfile [options] trainfile [trainfile] - - options: -params entries,dim,quant - -subvector start[,num] - -error desired_error - -iterations iterations -*/ - -static void usage(void){ - fprintf(stderr, "\nOggVorbis %s VQ codebook trainer\n\n" - "vqtrain vqfile [options] [datasetfile] [datasetfile]\n" - "options: -p[arams] \n" - " -s[ubvector] \n" - " -e[rror] \n" - " -i[terations] \n" - " -d[istance] quantization mesh spacing for density limitation\n" - " -b eliminate cell size biasing; use normal LBG\n\n" - " -c Use centroid (not median) midpoints\n" - - "examples:\n" - " train a new codebook to 1%% tolerance on datafile 'foo':\n" - " xxxvqtrain book -p 256,6,8 -e .01 foo\n" - " (produces a trained set in book-0.vqi)\n\n" - " continue training 'book-0.vqi' (produces book-1.vqi):\n" - " xxxvqtrain book-0.vqi\n\n" - " add subvector from element 1 to from files\n" - " data*.m to the training in progress, prodicing book-1.vqi:\n" - " xxxvqtrain book-0.vqi -s 1,1 data*.m\n\n",vqext_booktype); -} - -int exiting=0; -void setexit(int dummy){ - fprintf(stderr,"\nexiting... please wait to finish this iteration\n"); - exiting=1; -} - -int main(int argc,char *argv[]){ - vqgen v; - - int entries=-1,dim=-1; - int start=0,num=-1; - float desired=.05f,mindist=0.f; - int iter=1000; - int biasp=1; - int centroid=0; - - FILE *out=NULL; - char *line; - long i,j,k; - int init=0; - q.quant=-1; - - argv++; - if(!*argv){ - usage(); - exit(0); - } - - /* get the book name, a preexisting book to continue training */ - { - FILE *in=NULL; - char *filename=alloca(strlen(*argv)+30),*ptr; - - strcpy(filename,*argv); - in=fopen(filename,"r"); - ptr=strrchr(filename,'-'); - if(ptr){ - int num; - ptr++; - num=atoi(ptr); - sprintf(ptr,"%d.vqi",num+1); - }else - strcat(filename,"-0.vqi"); - - out=fopen(filename,"w"); - if(out==NULL){ - fprintf(stderr,"Unable to open %s for writing\n",filename); - exit(1); - } - - if(in){ - /* we wish to suck in a preexisting book and continue to train it */ - float a; - - line=rline(in,out,1); - if(strcmp(line,vqext_booktype)){ - fprintf(stderr,"wrong book type; %s!=%s\n",line,vqext_booktype); - exit(1); - } - - line=rline(in,out,1); - if(sscanf(line,"%d %d %d",&entries,&dim,&vqext_aux)!=3){ - fprintf(stderr,"Syntax error reading book file\n"); - exit(1); - } - - vqgen_init(&v,dim,vqext_aux,entries,mindist, - vqext_metric,vqext_weight,centroid); - init=1; - - /* quant setup */ - line=rline(in,out,1); - if(sscanf(line,"%ld %ld %d %d",&q.min,&q.delta, - &q.quant,&q.sequencep)!=4){ - fprintf(stderr,"Syntax error reading book file\n"); - exit(1); - } - - /* quantized entries */ - i=0; - for(j=0;j32)temp++; - while(*temp==' ')temp++; - } - - fprintf(stderr,"%d colums per line in file %s\n",cols,file); - - } - { - int i; - float b[cols]; - if(start+num*dim>cols){ - fprintf(stderr,"ran out of columns reading %s\n",file); - exit(1); - } - while(*line==' ')line++; - for(i=0;i32)temp++; - - old=temp[0]; - temp[0]='\0'; - b[i]=atof(line); - temp[0]=old; - - while(*line>32)line++; - while(*line==' ')line++; - } - if(num<=0)num=(cols-start)/dim; - for(i=0;i -#include -#include -#include -#include - -#include "vqgen.h" -#include "vqsplit.h" -#include "bookutil.h" - -/* Codebook generation happens in two steps: - - 1) Train the codebook with data collected from the encoder: We use - one of a few error metrics (which represent the distance between a - given data point and a candidate point in the training set) to - divide the training set up into cells representing roughly equal - probability of occurring. - - 2) Generate the codebook and auxiliary data from the trained data set -*/ - -/* Building a codebook from trained set ********************************** - - The codebook in raw form is technically finished once it's trained. - However, we want to finalize the representative codebook values for - each entry and generate auxiliary information to optimize encoding. - We generate the auxiliary coding tree using collected data, - probably the same data as in the original training */ - -/* At each recursion, the data set is split in half. Cells with data - points on side A go into set A, same with set B. The sets may - overlap. If the cell overlaps the deviding line only very slightly - (provided parameter), we may choose to ignore the overlap in order - to pare the tree down */ - -long *isortvals; -int iascsort(const void *a,const void *b){ - long av=isortvals[*((long *)a)]; - long bv=isortvals[*((long *)b)]; - return(av-bv); -} - -static float _Ndist(int el,float *a, float *b){ - int i; - float acc=0.f; - for(i=0;ic->nearest_tree; - - /* The encoder, regardless of book, will be using a straight - euclidian distance-to-point metric to determine closest point. - Thus we split the cells using the same (we've already trained the - codebook set spacing and distribution using special metrics and - even a midpoint division won't disturb the basic properties) */ - - int dim=b->dim; - float *entrylist=b->valuelist; - long ret; - long *entryA=_ogg_calloc(entries,sizeof(long)); - long *entryB=_ogg_calloc(entries,sizeof(long)); - long entriesA=0; - long entriesB=0; - long entriesC=0; - long pointsA=0; - long i,j,k; - - long besti=-1; - long bestj=-1; - - char spinbuf[80]; - sprintf(spinbuf,"splitting [%ld left]... ",totalpoints-*pointsofar); - - /* one reverse index needed */ - for(i=0;ientries;i++)reventry[i]=-1; - for(i=0;ivaluelist,pointlist,dim, - membership,reventry, - entryindex,entries, - pointindex,points,0, - entryA,entryB, - entryindex[i],entryindex[j], - &entriesA,&entriesB,&entriesC); - this=(entriesA-entriesC)*(entriesB-entriesC); - - /* when choosing best, we also want some form of stability to - make sure more branches are pared later; secondary - weighting isn;t needed as the entry lists are in ascending - order, and we always try p/q in the same sequence */ - - if( (besti==-1) || - (this>best) ){ - - best=this; - besti=entryindex[i]; - bestj=entryindex[j]; - - } - } - } - }else{ - float *p=alloca(dim*sizeof(float)); - float *q=alloca(dim*sizeof(float)); - float best=0.f; - - /* try COG/normal and furthest pairs */ - /* meanpoint */ - /* eventually, we want to select the closest entry and figure n/c - from p/q (because storing n/c is too large */ - for(k=0;kvaluelist[entryindex[j]*dim+k]; - p[k]/=entries; - - } - - /* we go through the entries one by one, looking for the entry on - the other side closest to the point of reflection through the - center */ - - for(i=0;ivaluelist,pointlist,dim, - membership,reventry, - entryindex,entries, - pointindex,points,0, - entryA,entryB, - entryindex[i],ref_j, - &entriesA,&entriesB,&entriesC); - this=(entriesA-entriesC)*(entriesB-entriesC); - - /* when choosing best, we also want some form of stability to - make sure more branches are pared later; secondary - weighting isn;t needed as the entry lists are in ascending - order, and we always try p/q in the same sequence */ - - if( (besti==-1) || - (this>best) ){ - - best=this; - besti=entryindex[i]; - bestj=ref_j; - - } - } - if(besti>bestj){ - long temp=besti; - besti=bestj; - bestj=temp; - } - - } - - /* find cells enclosing points */ - /* count A/B points */ - - pointsA=vqsp_count(b->valuelist,pointlist,dim, - membership,reventry, - entryindex,entries, - pointindex,points,1, - entryA,entryB, - besti,bestj, - &entriesA,&entriesB,&entriesC); - - /* fprintf(stderr,"split: total=%ld depth=%ld set A=%ld:%ld:%ld=B\n", - entries,depth,entriesA-entriesC,entriesC,entriesB-entriesC);*/ - { - long thisaux=t->aux++; - if(t->aux>=t->alloc){ - t->alloc*=2; - t->ptr0=_ogg_realloc(t->ptr0,sizeof(long)*t->alloc); - t->ptr1=_ogg_realloc(t->ptr1,sizeof(long)*t->alloc); - t->p=_ogg_realloc(t->p,sizeof(long)*t->alloc); - t->q=_ogg_realloc(t->q,sizeof(long)*t->alloc); - } - - t->p[thisaux]=besti; - t->q[thisaux]=bestj; - - if(entriesA==1){ - ret=1; - t->ptr0[thisaux]=entryA[0]; - *pointsofar+=pointsA; - }else{ - t->ptr0[thisaux]= -t->aux; - ret=lp_split(pointlist,totalpoints,b,entryA,entriesA,pointindex,pointsA, - membership,reventry,depth+1,pointsofar); - } - if(entriesB==1){ - ret++; - t->ptr1[thisaux]=entryB[0]; - *pointsofar+=points-pointsA; - }else{ - t->ptr1[thisaux]= -t->aux; - ret+=lp_split(pointlist,totalpoints,b,entryB,entriesB,pointindex+pointsA, - points-pointsA,membership,reventry, - depth+1,pointsofar); - } - } - free(entryA); - free(entryB); - return(ret); -} - -static int _node_eq(encode_aux_nearestmatch *v, long a, long b){ - long Aptr0=v->ptr0[a]; - long Aptr1=v->ptr1[a]; - long Bptr0=v->ptr0[b]; - long Bptr1=v->ptr1[b]; - - /* the possibility of choosing the same p and q, but switched, can;t - happen because we always look for the best p/q in the same search - order and the search is stable */ - - if(Aptr0==Bptr0 && Aptr1==Bptr1) - return(1); - - return(0); -} - -void vqsp_book(vqgen *v, codebook *b, long *quantlist){ - long i,j; - static_codebook *c=(static_codebook *)b->c; - encode_aux_nearestmatch *t; - - memset(b,0,sizeof(codebook)); - memset(c,0,sizeof(static_codebook)); - b->c=c; - t=c->nearest_tree=_ogg_calloc(1,sizeof(encode_aux_nearestmatch)); - c->maptype=2; - - /* make sure there are no duplicate entries and that every - entry has points */ - - for(i=0;ientries;){ - /* duplicate? if so, eliminate */ - for(j=0;jelements,_now(v,i),_now(v,j))==0.f){ - fprintf(stderr,"found a duplicate entry! removing...\n"); - v->entries--; - memcpy(_now(v,i),_now(v,v->entries),sizeof(float)*v->elements); - memcpy(quantlist+i*v->elements,quantlist+v->entries*v->elements, - sizeof(long)*v->elements); - break; - } - } - if(j==i)i++; - } - - { - v->assigned=_ogg_calloc(v->entries,sizeof(long)); - for(i=0;ipoints;i++){ - float *ppt=_point(v,i); - float firstmetric=_Ndist(v->elements,_now(v,0),ppt); - long firstentry=0; - - if(!(i&0xff))spinnit("checking... ",v->points-i); - - for(j=0;jentries;j++){ - float thismetric=_Ndist(v->elements,_now(v,j),ppt); - if(thismetricassigned[firstentry]++; - } - - for(j=0;jentries;){ - if(v->assigned[j]==0){ - fprintf(stderr,"found an unused entry! removing...\n"); - v->entries--; - memcpy(_now(v,j),_now(v,v->entries),sizeof(float)*v->elements); - v->assigned[j]=v->assigned[v->elements]; - memcpy(quantlist+j*v->elements,quantlist+v->entries*v->elements, - sizeof(long)*v->elements); - continue; - } - j++; - } - } - - fprintf(stderr,"Building a book with %ld unique entries...\n",v->entries); - - { - long *entryindex=_ogg_malloc(v->entries*sizeof(long *)); - long *pointindex=_ogg_malloc(v->points*sizeof(long)); - long *membership=_ogg_malloc(v->points*sizeof(long)); - long *reventry=_ogg_malloc(v->entries*sizeof(long)); - long pointssofar=0; - - for(i=0;ientries;i++)entryindex[i]=i; - for(i=0;ipoints;i++)pointindex[i]=i; - - t->alloc=4096; - t->ptr0=_ogg_malloc(sizeof(long)*t->alloc); - t->ptr1=_ogg_malloc(sizeof(long)*t->alloc); - t->p=_ogg_malloc(sizeof(long)*t->alloc); - t->q=_ogg_malloc(sizeof(long)*t->alloc); - t->aux=0; - c->dim=v->elements; - c->entries=v->entries; - c->lengthlist=_ogg_calloc(c->entries,sizeof(long)); - b->valuelist=v->entrylist; /* temporary; replaced later */ - b->dim=c->dim; - b->entries=c->entries; - - for(i=0;ipoints;i++)membership[i]=-1; - for(i=0;ipoints;i++){ - float *ppt=_point(v,i); - long firstentry=0; - float firstmetric=_Ndist(v->elements,_now(v,0),ppt); - - if(!(i&0xff))spinnit("assigning... ",v->points-i); - - for(j=1;jentries;j++){ - if(v->assigned[j]!=-1){ - float thismetric=_Ndist(v->elements,_now(v,j),ppt); - if(thismetric<=firstmetric){ - firstmetric=thismetric; - firstentry=j; - } - } - } - - membership[i]=firstentry; - } - - fprintf(stderr,"Leaves added: %d \n", - lp_split(v->pointlist,v->points, - b,entryindex,v->entries, - pointindex,v->points, - membership,reventry, - 0,&pointssofar)); - - free(pointindex); - free(membership); - free(reventry); - - fprintf(stderr,"Paring/rerouting redundant branches... "); - - /* The tree is likely big and redundant. Pare and reroute branches */ - { - int changedflag=1; - - while(changedflag){ - changedflag=0; - - /* span the tree node by node; list unique decision nodes and - short circuit redundant branches */ - - for(i=0;iaux;){ - int k; - - /* check list of unique decisions */ - for(j=0;jaux;k++){ - if(t->ptr0[k]==-i)t->ptr0[k]=-j; - if(t->ptr1[k]==-i)t->ptr1[k]=-j; - } - - /* Now, we need to fill in the hole from this redundant - entry in the listing. Insert the last entry in the list. - Fix the forward pointers to that last entry */ - t->aux--; - t->ptr0[i]=t->ptr0[t->aux]; - t->ptr1[i]=t->ptr1[t->aux]; - t->p[i]=t->p[t->aux]; - t->q[i]=t->q[t->aux]; - for(k=0;kaux;k++){ - if(t->ptr0[k]==-t->aux)t->ptr0[k]=-i; - if(t->ptr1[k]==-t->aux)t->ptr1[k]=-i; - } - /* hole plugged */ - - }else - i++; - } - - fprintf(stderr,"\rParing/rerouting redundant branches... " - "%ld remaining ",t->aux); - } - fprintf(stderr,"\n"); - } - } - - /* run all training points through the decision tree to get a final - probability count */ - { - long *probability=_ogg_malloc(c->entries*sizeof(long)); - for(i=0;ientries;i++)probability[i]=1; /* trivial guard */ - b->dim=c->dim; - - /* sigh. A necessary hack */ - for(i=0;iaux;i++)t->p[i]*=c->dim; - for(i=0;iaux;i++)t->q[i]*=c->dim; - - for(i=0;ipoints;i++){ - /* we use the linear matcher regardless becuase the trainer - doesn't convert log to linear */ - int ret=_best(b,v->pointlist+i*v->elements,1); - probability[ret]++; - if(!(i&0xff))spinnit("counting hits... ",v->points-i); - } - for(i=0;iaux;i++)t->p[i]/=c->dim; - for(i=0;iaux;i++)t->q[i]/=c->dim; - - build_tree_from_lengths(c->entries,probability,c->lengthlist); - - free(probability); - } - - /* Sort the entries by codeword length, short to long (eases - assignment and packing to do it now) */ - { - long *wordlen=c->lengthlist; - long *index=_ogg_malloc(c->entries*sizeof(long)); - long *revindex=_ogg_malloc(c->entries*sizeof(long)); - int k; - for(i=0;ientries;i++)index[i]=i; - isortvals=c->lengthlist; - qsort(index,c->entries,sizeof(long),iascsort); - - /* rearrange storage; ptr0/1 first as it needs a reverse index */ - /* n and c stay unchanged */ - for(i=0;ientries;i++)revindex[index[i]]=i; - for(i=0;iaux;i++){ - if(!(i&0x3f))spinnit("sorting... ",t->aux-i); - - if(t->ptr0[i]>=0)t->ptr0[i]=revindex[t->ptr0[i]]; - if(t->ptr1[i]>=0)t->ptr1[i]=revindex[t->ptr1[i]]; - t->p[i]=revindex[t->p[i]]; - t->q[i]=revindex[t->q[i]]; - } - free(revindex); - - /* map lengthlist and vallist with index */ - c->lengthlist=_ogg_calloc(c->entries,sizeof(long)); - b->valuelist=_ogg_malloc(sizeof(float)*c->entries*c->dim); - c->quantlist=_ogg_malloc(sizeof(long)*c->entries*c->dim); - for(i=0;ientries;i++){ - long e=index[i]; - for(k=0;kdim;k++){ - b->valuelist[i*c->dim+k]=v->entrylist[e*c->dim+k]; - c->quantlist[i*c->dim+k]=quantlist[e*c->dim+k]; - } - c->lengthlist[i]=wordlen[e]; - } - - free(wordlen); - } - - fprintf(stderr,"Done. \n\n"); -} - diff --git a/vq/vqsplit.h b/vq/vqsplit.h deleted file mode 100644 index c67e716..0000000 --- a/vq/vqsplit.h +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************** - * * - * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * - * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * - * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * - * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the Xiph.Org Foundation http://www.xiph.org/ * - * * - ******************************************************************** - - function: build a VQ codebook decision tree - last mod: $Id$ - - ********************************************************************/ - -#ifndef _VQSPL_H_ -#define _VQSPL_H_ - -#include "codebook.h" - -extern void vqsp_book(vqgen *v,codebook *b,long *quantlist); -extern int vqenc_entry(codebook *b,float *val); -extern int lp_split(float *pointlist,long totalpoints, - codebook *b, - long *entryindex,long entries, - long *pointindex,long points, - long *membership,long *reventry, - long depth, long *pointsofar); - -#endif - - - - - -- 2.7.4