summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2001-10-16 20:10:21 +0000
committerMonty <xiphmont@xiph.org>2001-10-16 20:10:21 +0000
commit1c485ff64852609ce38d2581820715b1ee36f603 (patch)
treec2ff01c3cec8be311080a9af53e84f27c3224a26
parent05d7abffb34e403237be7e09f328e292f975af1d (diff)
downloadlibvorbis-git-1c485ff64852609ce38d2581820715b1ee36f603.tar.gz
More bitrate management additions/fixes/tuning
svn path=/branches/branch_monty_20011009/vorbis/; revision=2147
-rw-r--r--lib/block.c17
-rw-r--r--lib/books/line_1024x31_0sub0.vqh2
-rw-r--r--lib/books/line_1024x31_0sub1.vqh6
-rw-r--r--lib/books/line_1024x31_1sub1.vqh6
-rw-r--r--lib/books/line_1024x31_2sub3.vqh6
-rw-r--r--lib/books/line_1024x31_3sub1.vqh2
-rw-r--r--lib/books/line_1024x31_3sub2.vqh2
-rw-r--r--lib/books/line_1024x31_3sub3.vqh6
-rw-r--r--lib/books/line_1024x31_class0.vqh2
-rw-r--r--lib/books/line_1024x31_class1.vqh2
-rw-r--r--lib/books/line_1024x31_class2.vqh8
-rw-r--r--lib/books/line_1024x31_class3.vqh8
-rw-r--r--lib/books/line_128x19_0sub0.vqh8
-rw-r--r--lib/books/line_128x19_1sub3.vqh6
-rw-r--r--lib/books/line_128x19_2sub1.vqh2
-rw-r--r--lib/books/line_128x19_2sub2.vqh4
-rw-r--r--lib/books/line_128x19_2sub3.vqh6
-rw-r--r--lib/books/line_128x19_class1.vqh8
-rw-r--r--lib/books/line_128x19_class2.vqh8
-rw-r--r--lib/books/res_44c_A_1024aux.vqh14
-rw-r--r--lib/books/res_44c_A_128aux.vqh14
-rw-r--r--lib/books/res_Ac_0a.vqh60
-rw-r--r--lib/books/res_Ac_1.vqh33
-rw-r--r--lib/books/res_Ac_2a.vqh29
-rw-r--r--lib/books/res_Ac_3.vqh56
-rw-r--r--lib/books/res_Ac_4.vqh80
-rw-r--r--lib/books/res_Ac_5.vqh10
-rw-r--r--lib/books/res_Ac_5a.vqh10
-rw-r--r--lib/books/res_Ac_6.vqh12
-rw-r--r--lib/books/res_Ac_7.vqh31
-rw-r--r--lib/books/res_Ac_7a.vqh80
-rw-r--r--lib/books/res_Ac_8.vqh188
-rw-r--r--lib/books/res_Ac_8a.vqh39
-rw-r--r--lib/books/res_Ac_9.vqh4
-rw-r--r--lib/books/res_Ac_9a.vqh20
-rw-r--r--lib/books/res_Ac_9b.vqh16
-rw-r--r--lib/codec_internal.h27
-rw-r--r--lib/mapping0.c273
-rw-r--r--lib/modes/mode_44c_A.h142
-rw-r--r--lib/modes/mode_44c_Z.h63
-rw-r--r--lib/modes/modes.h40
-rw-r--r--lib/psy.c38
-rw-r--r--lib/psy.h3
-rw-r--r--lib/res0.c22
-rw-r--r--lib/sharedbook.c676
45 files changed, 1523 insertions, 566 deletions
diff --git a/lib/block.c b/lib/block.c
index b0290445..e637eeb9 100644
--- a/lib/block.c
+++ b/lib/block.c
@@ -11,7 +11,7 @@
********************************************************************
function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.50.2.2 2001/10/11 15:41:44 xiphmont Exp $
+ last mod: $Id: block.c,v 1.50.2.3 2001/10/16 20:10:10 xiphmont Exp $
Handle windowing, overlap-add, etc of the PCM vectors. This is made
more amusing by Vorbis' current two allowed block sizes.
@@ -275,16 +275,17 @@ int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){
long maxpackets=(max(ci->bitrate_bound_queuetime,
ci->bitrate_avg_queuetime)*
vi->rate+(ci->blocksizes[0]-1))/ci->blocksizes[0]+1;
- long eighths=8*ci->passlimit[ci->coupling_passes-1];
+ long bins=BITTRACK_DIVISOR*ci->passlimit[ci->coupling_passes-1];
if(ci->bitrate_queue_loweravg<=0. &&
- ci->bitrate_queue_upperavg<=0.)eighths=0;
+ ci->bitrate_queue_upperavg<=0.)bins=0;
b->bitrate_queue_size=maxpackets;
- b->bitrate_eighths=eighths;
+ b->bitrate_bins=bins;
b->bitrate_queue=_ogg_malloc(maxpackets*sizeof(*b->bitrate_queue));
- if(eighths){
- b->bitrate_queue_eighths=_ogg_malloc(maxpackets*eighths*sizeof(*b->bitrate_queue));
- b->bitrate_avgbitacc=_ogg_malloc(eighths*sizeof(*b->bitrate_avgbitacc));
+ if(bins){
+ b->bitrate_queue_bin=_ogg_malloc(maxpackets*bins*
+ sizeof(*b->bitrate_queue));
+ b->bitrate_avgbitacc=_ogg_malloc(bins*sizeof(*b->bitrate_avgbitacc));
}
b->bitrate_floatinglimit=ci->bitrate_floatinglimit_initial;
}
@@ -330,7 +331,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
}
if(b->psy_g_look)_vp_global_free(b->psy_g_look);
if(b->bitrate_queue)_ogg_free(b->bitrate_queue);
- if(b->bitrate_queue_eighths)_ogg_free(b->bitrate_queue_eighths);
+ if(b->bitrate_queue_bin)_ogg_free(b->bitrate_queue_bin);
if(b->bitrate_avgbitacc)_ogg_free(b->bitrate_avgbitacc);
}
diff --git a/lib/books/line_1024x31_0sub0.vqh b/lib/books/line_1024x31_0sub0.vqh
index d64dbc76..ca15fc42 100644
--- a/lib/books/line_1024x31_0sub0.vqh
+++ b/lib/books/line_1024x31_0sub0.vqh
@@ -20,7 +20,7 @@
#include "codebook.h"
static long _huff_lengthlist_line_1024x31_0sub0[] = {
- 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5,
+ 3, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5,
};
static static_codebook _huff_book_line_1024x31_0sub0 = {
diff --git a/lib/books/line_1024x31_0sub1.vqh b/lib/books/line_1024x31_0sub1.vqh
index b8ca0799..cca35338 100644
--- a/lib/books/line_1024x31_0sub1.vqh
+++ b/lib/books/line_1024x31_0sub1.vqh
@@ -21,9 +21,9 @@
static long _huff_lengthlist_line_1024x31_0sub1[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7,
- 6, 8, 8,10,10,10, 8,12, 9,12,10,12,11,12,12,12,
- 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+ 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 5, 7, 6, 7,
+ 6, 7, 6, 7, 8, 7, 6, 6, 8, 9, 9, 9, 9, 9, 5, 6,
+ 8,10,10, 9, 9,12,10,11,12,10, 8, 8,12,12,12,12,
};
static static_codebook _huff_book_line_1024x31_0sub1 = {
diff --git a/lib/books/line_1024x31_1sub1.vqh b/lib/books/line_1024x31_1sub1.vqh
index e3035303..9773531b 100644
--- a/lib/books/line_1024x31_1sub1.vqh
+++ b/lib/books/line_1024x31_1sub1.vqh
@@ -21,9 +21,9 @@
static long _huff_lengthlist_line_1024x31_1sub1[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 3, 3, 3, 4, 3, 5, 3, 5, 4, 7, 5, 8, 7,10, 9,
- 12,10,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,11,
+ 3, 3, 3, 3, 4, 3, 5, 4, 5, 4, 6, 6, 7, 7, 7,10,
+ 7,10, 8,10, 8,10, 9, 9, 9,11, 8, 8, 8, 8, 8, 9,
+ 7, 8, 8, 9,10, 9,12,12,12,12,12,12,12,12,12,12,
};
static static_codebook _huff_book_line_1024x31_1sub1 = {
diff --git a/lib/books/line_1024x31_2sub3.vqh b/lib/books/line_1024x31_2sub3.vqh
index d16f7e0f..7aefb1d9 100644
--- a/lib/books/line_1024x31_2sub3.vqh
+++ b/lib/books/line_1024x31_2sub3.vqh
@@ -21,9 +21,9 @@
static long _huff_lengthlist_line_1024x31_2sub3[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 5, 2, 8, 4, 9,
- 6, 9, 7, 9, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 5, 2, 7, 4, 7,
+ 4, 9, 4, 9, 5, 8, 6, 6, 6, 9, 6, 6, 6, 6, 7, 9,
+ 8, 9, 7, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8,
};
static static_codebook _huff_book_line_1024x31_2sub3 = {
diff --git a/lib/books/line_1024x31_3sub1.vqh b/lib/books/line_1024x31_3sub1.vqh
index efddd628..304002a4 100644
--- a/lib/books/line_1024x31_3sub1.vqh
+++ b/lib/books/line_1024x31_3sub1.vqh
@@ -20,7 +20,7 @@
#include "codebook.h"
static long _huff_lengthlist_line_1024x31_3sub1[] = {
- 0, 3, 3, 3, 3, 3, 3, 3, 3,
+ 0, 3, 3, 2, 3, 3, 4, 3, 4,
};
static static_codebook _huff_book_line_1024x31_3sub1 = {
diff --git a/lib/books/line_1024x31_3sub2.vqh b/lib/books/line_1024x31_3sub2.vqh
index c5d238dc..d354dc19 100644
--- a/lib/books/line_1024x31_3sub2.vqh
+++ b/lib/books/line_1024x31_3sub2.vqh
@@ -21,7 +21,7 @@
static long _huff_lengthlist_line_1024x31_3sub2[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 2, 5, 3, 7, 3,
- 8, 4, 9, 5,10, 5,11, 6,11,
+ 7, 4, 8, 5, 8, 6, 8, 6, 8,
};
static static_codebook _huff_book_line_1024x31_3sub2 = {
diff --git a/lib/books/line_1024x31_3sub3.vqh b/lib/books/line_1024x31_3sub3.vqh
index 4cd01b1a..f0d979e7 100644
--- a/lib/books/line_1024x31_3sub3.vqh
+++ b/lib/books/line_1024x31_3sub3.vqh
@@ -21,9 +21,9 @@
static long _huff_lengthlist_line_1024x31_3sub3[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 7, 2, 7, 3, 7, 4,
- 7, 5, 7, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 5, 5, 5,
+ 4, 7, 5, 7, 6, 8, 5, 8, 5, 8, 5, 8, 7, 8, 5, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
};
static static_codebook _huff_book_line_1024x31_3sub3 = {
diff --git a/lib/books/line_1024x31_class0.vqh b/lib/books/line_1024x31_class0.vqh
index 1a7e28cf..774a165e 100644
--- a/lib/books/line_1024x31_class0.vqh
+++ b/lib/books/line_1024x31_class0.vqh
@@ -20,7 +20,7 @@
#include "codebook.h"
static long _huff_lengthlist_line_1024x31_class0[] = {
- 1, 2, 4, 5, 3, 6, 7, 7,
+ 1, 3, 4, 3, 3, 5, 6, 6,
};
static static_codebook _huff_book_line_1024x31_class0 = {
diff --git a/lib/books/line_1024x31_class1.vqh b/lib/books/line_1024x31_class1.vqh
index 56aca9be..0bf9a67a 100644
--- a/lib/books/line_1024x31_class1.vqh
+++ b/lib/books/line_1024x31_class1.vqh
@@ -20,7 +20,7 @@
#include "codebook.h"
static long _huff_lengthlist_line_1024x31_class1[] = {
- 1, 3, 5, 7, 9, 9,10,11, 2, 5, 5, 6,10,11,11,11,
+ 1, 3, 4, 8, 7, 7, 7,11, 3, 4, 4, 5,10,11,10,10,
};
static static_codebook _huff_book_line_1024x31_class1 = {
diff --git a/lib/books/line_1024x31_class2.vqh b/lib/books/line_1024x31_class2.vqh
index 88c08e5e..f577f2e4 100644
--- a/lib/books/line_1024x31_class2.vqh
+++ b/lib/books/line_1024x31_class2.vqh
@@ -20,10 +20,10 @@
#include "codebook.h"
static long _huff_lengthlist_line_1024x31_class2[] = {
- 2, 3, 4,10, 6, 4, 5,10, 8, 6, 6,15,16,15,16,15,
- 5, 3, 5, 9, 6, 4, 6, 9, 8, 5, 7,14,15,15,15,15,
- 8, 6, 6, 9, 8, 6, 6, 9,10, 7, 8,14,15,15,15,15,
- 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+ 2, 3, 4,10, 6, 4, 5,10, 8, 6, 6,11,14,12,15,11,
+ 5, 3, 5, 9, 6, 4, 6, 9, 8, 5, 7,13,16,16,13,16,
+ 8, 6, 6, 9, 9, 6, 6, 9,10, 7, 8,11,16,15,15,15,
+ 15,15,15,15,14,14,15,15,15,13,13,15,15,15,15,15,
};
static static_codebook _huff_book_line_1024x31_class2 = {
diff --git a/lib/books/line_1024x31_class3.vqh b/lib/books/line_1024x31_class3.vqh
index c3479160..fc651177 100644
--- a/lib/books/line_1024x31_class3.vqh
+++ b/lib/books/line_1024x31_class3.vqh
@@ -20,10 +20,10 @@
#include "codebook.h"
static long _huff_lengthlist_line_1024x31_class3[] = {
- 1, 4, 3,11, 6, 4, 5,13,10, 8,10,15,15,15,15,15,
- 7, 4, 5,11, 7, 5, 6,12,11, 8,11,15,14,14,14,14,
- 11, 8, 6, 9,11, 9, 8,11,13,10,12,14,14,14,14,14,
- 14,14,11, 9,14,14,12,11,14,14,14,14,14,14,14,14,
+ 1, 3, 3,10, 7, 5, 5,11,10, 8,10,11,12,12,11,12,
+ 7, 4, 5,10, 8, 5, 7,13,12, 9,11,15,15,15,15,15,
+ 11, 9, 7, 9,11, 9, 9,12,12,11,12,15,14,14,14,14,
+ 14,10,10,10,14,13,13,12,14,13,14,14,14,14,14,14,
};
static static_codebook _huff_book_line_1024x31_class3 = {
diff --git a/lib/books/line_128x19_0sub0.vqh b/lib/books/line_128x19_0sub0.vqh
index 86b8db69..82f2ab8f 100644
--- a/lib/books/line_128x19_0sub0.vqh
+++ b/lib/books/line_128x19_0sub0.vqh
@@ -20,10 +20,10 @@
#include "codebook.h"
static long _huff_lengthlist_line_128x19_0sub0[] = {
- 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4, 6, 4, 6, 5,
- 6, 5, 6, 5, 7, 6, 7, 6, 7, 7, 7, 8, 8, 8, 8, 9,
- 8,10, 8,11, 8,12, 8,13, 8,10, 8,10, 9,11, 9,11,
- 9,10,10,11,12,14,14,14,14,16,16,16,16,16,16,15,
+ 3, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4, 6, 5, 6, 5,
+ 6, 5, 6, 6, 7, 6, 7, 7, 7, 8, 7, 8, 8, 9, 8,10,
+ 8,11, 8,11, 8,13, 8,12, 8,10, 8,10, 9,11, 9,11,
+ 9,11,10,11,12,14,14,14,14,16,16,16,16,16,16,15,
};
static static_codebook _huff_book_line_128x19_0sub0 = {
diff --git a/lib/books/line_128x19_1sub3.vqh b/lib/books/line_128x19_1sub3.vqh
index 01d70d17..8c3c96f3 100644
--- a/lib/books/line_128x19_1sub3.vqh
+++ b/lib/books/line_128x19_1sub3.vqh
@@ -21,9 +21,9 @@
static long _huff_lengthlist_line_128x19_1sub3[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 6, 3, 7, 2, 8,
- 3,10, 4,10, 5,10, 5,10, 7,10,10,10,10,10,10,10,
- 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 2, 6, 2, 7, 3, 8,
+ 3,10, 4,10, 5, 9, 5, 9, 6, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
};
static static_codebook _huff_book_line_128x19_1sub3 = {
diff --git a/lib/books/line_128x19_2sub1.vqh b/lib/books/line_128x19_2sub1.vqh
index 3d19e990..a1310146 100644
--- a/lib/books/line_128x19_2sub1.vqh
+++ b/lib/books/line_128x19_2sub1.vqh
@@ -20,7 +20,7 @@
#include "codebook.h"
static long _huff_lengthlist_line_128x19_2sub1[] = {
- 0, 3, 3, 3, 3, 2, 4, 3, 4,
+ 0, 3, 3, 2, 3, 3, 4, 3, 4,
};
static static_codebook _huff_book_line_128x19_2sub1 = {
diff --git a/lib/books/line_128x19_2sub2.vqh b/lib/books/line_128x19_2sub2.vqh
index 26b335d5..1776ead2 100644
--- a/lib/books/line_128x19_2sub2.vqh
+++ b/lib/books/line_128x19_2sub2.vqh
@@ -20,8 +20,8 @@
#include "codebook.h"
static long _huff_lengthlist_line_128x19_2sub2[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 2, 5, 3, 6, 4,
- 7, 4, 8, 4, 9, 5,10, 5,10,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 2, 5, 3, 6, 4,
+ 7, 4, 8, 5, 9, 6,10, 6,10,
};
static static_codebook _huff_book_line_128x19_2sub2 = {
diff --git a/lib/books/line_128x19_2sub3.vqh b/lib/books/line_128x19_2sub3.vqh
index 9365e151..f9e65411 100644
--- a/lib/books/line_128x19_2sub3.vqh
+++ b/lib/books/line_128x19_2sub3.vqh
@@ -21,9 +21,9 @@
static long _huff_lengthlist_line_128x19_2sub3[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 2, 8, 4, 9, 4,
- 7, 6, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 3, 8, 3, 7, 4,
+ 7, 6, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7,
};
static static_codebook _huff_book_line_128x19_2sub3 = {
diff --git a/lib/books/line_128x19_class1.vqh b/lib/books/line_128x19_class1.vqh
index ec2a3298..2b25e1af 100644
--- a/lib/books/line_128x19_class1.vqh
+++ b/lib/books/line_128x19_class1.vqh
@@ -20,10 +20,10 @@
#include "codebook.h"
static long _huff_lengthlist_line_128x19_class1[] = {
- 3, 3, 4,11, 6, 4, 5,12, 7, 5, 6,12,14,13,13,15,
- 5, 3, 4,10, 7, 5, 6,12, 8, 5, 7,12,14,13,14,15,
- 7, 4, 5,11, 8, 5, 6,11, 9, 6, 6,12,15,12,13,15,
- 14,11,10,13,11, 8, 8,12,11, 8, 9,14,15,15,14,14,
+ 3, 3, 4,11, 6, 4, 5,11, 8, 5, 6,12,14,13,14,15,
+ 5, 3, 4, 9, 7, 5, 6,11, 8, 5, 7,12,14,14,14,15,
+ 7, 4, 5,11, 8, 5, 6,10, 9, 6, 6,11,14,12,13,15,
+ 13,11,10,13,11, 8, 8,13,11, 8, 8,15,15,15,15,15,
};
static static_codebook _huff_book_line_128x19_class1 = {
diff --git a/lib/books/line_128x19_class2.vqh b/lib/books/line_128x19_class2.vqh
index 241bc662..78a89f56 100644
--- a/lib/books/line_128x19_class2.vqh
+++ b/lib/books/line_128x19_class2.vqh
@@ -20,10 +20,10 @@
#include "codebook.h"
static long _huff_lengthlist_line_128x19_class2[] = {
- 1, 3, 4,13, 6, 4, 5,14, 9, 6, 8,15,15,15,15,15,
- 6, 4, 6,12, 7, 5, 6,13,10, 8, 9,15,15,15,15,15,
- 11, 8, 7, 9,11, 9, 8,10,13,11,11,13,15,15,15,15,
- 15,15,10,11,15,15,11,12,15,15,13,14,15,15,15,15,
+ 1, 3, 4,13, 6, 4, 5,15, 9, 6, 8,14,15,15,15,15,
+ 7, 4, 6,13, 7, 5, 6,13,10, 7, 9,15,15,15,15,15,
+ 10, 7, 7,10,12, 8, 8,11,13,11,11,13,15,15,15,15,
+ 15,15,10,12,15,14,12,13,15,15,13,15,15,15,15,15,
};
static static_codebook _huff_book_line_128x19_class2 = {
diff --git a/lib/books/res_44c_A_1024aux.vqh b/lib/books/res_44c_A_1024aux.vqh
index 7f668bf2..33519310 100644
--- a/lib/books/res_44c_A_1024aux.vqh
+++ b/lib/books/res_44c_A_1024aux.vqh
@@ -20,13 +20,13 @@
#include "codebook.h"
static long _huff_lengthlist_res_44c_A_1024aux[] = {
- 3,11, 6,15,11,10,10,10,17,17,11, 4,17, 7, 5,17,
- 6, 8,14,17, 5,17, 3,17,17, 7, 8,10,17,17,15, 6,
- 17, 5,17,17, 5, 7,13,17,11, 5,17,17, 4,17, 5, 8,
- 17,17,11,17, 6,17,17, 8, 9,11,17,17,10, 6, 8, 5,
- 6, 9, 4, 5,12,17,12, 7,10, 6, 9,11, 5, 4, 8,17,
- 17,13,17,12,17,17,10, 6, 6,14,17,17,17,17,17,17,
- 16, 8, 9,16,
+ 3, 5,18,18,17,17,17,17,11,17, 5, 4,17,17,17,17,
+ 17,17, 8,16,17,17, 3,17, 6,17, 7, 9,13,17,17,17,
+ 17, 1,17, 7, 9,11,15,17,17,17, 6,17, 7,17, 9,10,
+ 16,17,17,17,17, 7,17, 8,10,15,17,17,17,17, 8, 9,
+ 9,10, 9,11,16,17,17,17, 9,13,10,17,11,12,15,17,
+ 9, 6,14,15,17,17,16,15, 7,14,12, 8,16,17,17,17,
+ 17,16,11,16,
};
static static_codebook _huff_book_res_44c_A_1024aux = {
diff --git a/lib/books/res_44c_A_128aux.vqh b/lib/books/res_44c_A_128aux.vqh
index 3f3675ab..20188dce 100644
--- a/lib/books/res_44c_A_128aux.vqh
+++ b/lib/books/res_44c_A_128aux.vqh
@@ -20,13 +20,13 @@
#include "codebook.h"
static long _huff_lengthlist_res_44c_A_128aux[] = {
- 4,15, 7,15,15,11,10,12,15,15,13, 4,15,15, 5,15,
- 8,12,15,15, 4,15, 2,15,15, 7, 7,10,15,15,15, 5,
- 15,15, 5,15, 6,11,15,15,14, 4,15,15, 4,15, 6,10,
- 15,15, 9,15, 7,15,15,10,11,13,15,15,10, 5, 8,15,
- 4,12, 6,10,15,15,12, 9,11,12, 7,13, 8,12,15,15,
- 15,11,15, 5,15,15, 4, 6,15,15,15,15,15, 7,15,15,
- 6, 8,14,15,
+ 16,17, 3,17, 7,17,11,13,17,17, 8,12,11,17,13,17,
+ 15,17,17,17,17,17, 2,17, 8,17,11,14,17,17,17,17,
+ 17, 1,17, 8,10,17,17,17,17,17, 6,17,10,17,13,16,
+ 17,17,17,17,17, 9,17,13,15,17,17,17,17,17,10,11,
+ 13,15,15,17,17,17,17,17,12,16,14,17,15,17,17,17,
+ 4, 9,17,17,17,17,17,17,17,17, 6,10,17,16,16,16,
+ 16,16,16,16,
};
static static_codebook _huff_book_res_44c_A_128aux = {
diff --git a/lib/books/res_Ac_0a.vqh b/lib/books/res_Ac_0a.vqh
index 9c0cf55d..c895d35b 100644
--- a/lib/books/res_Ac_0a.vqh
+++ b/lib/books/res_Ac_0a.vqh
@@ -19,50 +19,50 @@
#include "codebook.h"
static long _vq_quantlist_res_Ac_0a[] = {
- 2,
- 1,
- 3,
+ 202,
+ 101,
+ 303,
0,
- 4,
+ 405,
};
static long _vq_lengthlist_res_Ac_0a[] = {
+ 3, 5, 5, 0, 0, 7, 6, 6, 0, 0, 7, 6, 6, 0, 0, 0,
+ 6, 6, 0, 0, 0, 7, 7, 0, 0, 5, 6, 6, 0, 0, 8, 7,
+ 7, 0, 0, 8, 7, 7, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9,
+ 0, 0, 5, 6, 6, 0, 0, 8, 7, 7, 0, 0, 8, 7, 7, 0,
+ 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9,
+ 0, 0,10, 9,10, 0, 0,10,10, 9, 0, 0, 0,10,10, 0,
+ 0, 0,11,10, 0, 0, 7, 9, 9, 0, 0,10,10, 9, 0, 0,
+ 10, 9, 9, 0, 0, 0,10,10, 0, 0, 0,10,11, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -70,7 +70,7 @@ static long _vq_lengthlist_res_Ac_0a[] = {
};
static float _vq_quantthresh_res_Ac_0a[] = {
- -1.5, -0.5, 0.5, 1.5,
+ -0.5005, -0.1675, 0.1655, 0.50015,
};
static long _vq_quantmap_res_Ac_0a[] = {
@@ -87,7 +87,7 @@ static encode_aux_threshmatch _vq_auxt_res_Ac_0a = {
static static_codebook _vq_book_res_Ac_0a = {
4, 625,
_vq_lengthlist_res_Ac_0a,
- 1, -533725184, 1611661312, 3, 0,
+ 1, -537569264, 1593508447, 9, 0,
_vq_quantlist_res_Ac_0a,
NULL,
&_vq_auxt_res_Ac_0a,
diff --git a/lib/books/res_Ac_1.vqh b/lib/books/res_Ac_1.vqh
index d0534f97..75abea39 100644
--- a/lib/books/res_Ac_1.vqh
+++ b/lib/books/res_Ac_1.vqh
@@ -19,39 +19,46 @@
#include "codebook.h"
static long _vq_quantlist_res_Ac_1[] = {
+ 4,
+ 3,
+ 5,
+ 2,
+ 6,
1,
+ 7,
0,
- 2,
+ 8,
};
static long _vq_lengthlist_res_Ac_1[] = {
- 2, 5, 5, 0, 4, 4, 0, 4, 5, 5, 7, 6, 0, 8, 7, 0,
- 8, 7, 5, 6, 7, 0, 7, 8, 0, 7, 8, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 5, 8, 7, 0, 7, 6, 0, 7, 7, 5, 7, 8,
- 0, 7, 7, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,
- 8, 7, 0, 7, 7, 0, 7, 7, 5, 7, 8, 0, 7, 7, 0, 6,
- 7,
+ 1, 4, 3, 6, 6, 8, 8,10,10, 5, 5, 5, 7, 7, 9, 9,
+ 10,10, 6, 5, 5, 7, 7, 9, 9,10,11, 0, 7, 8, 8, 8,
+ 9,10,11,11, 0, 8, 8, 8, 8,10,10,11,11, 0,12,12,
+ 9, 9,10,10,12,11, 0,13,12,10, 9,11,11,12,12, 0,
+ 0, 0,11,11,12,11,12,13, 0, 0, 0,12,12,12,12,13,
+ 13,
};
static float _vq_quantthresh_res_Ac_1[] = {
- -0.5, 0.5,
+ -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5,
};
static long _vq_quantmap_res_Ac_1[] = {
- 1, 0, 2,
+ 7, 5, 3, 1, 0, 2, 4, 6,
+ 8,
};
static encode_aux_threshmatch _vq_auxt_res_Ac_1 = {
_vq_quantthresh_res_Ac_1,
_vq_quantmap_res_Ac_1,
- 3,
- 3
+ 9,
+ 9
};
static static_codebook _vq_book_res_Ac_1 = {
- 4, 81,
+ 2, 81,
_vq_lengthlist_res_Ac_1,
- 1, -535822336, 1611661312, 2, 0,
+ 1, -527171584, 1616117760, 4, 0,
_vq_quantlist_res_Ac_1,
NULL,
&_vq_auxt_res_Ac_1,
diff --git a/lib/books/res_Ac_2a.vqh b/lib/books/res_Ac_2a.vqh
index 98a40c12..d6b55492 100644
--- a/lib/books/res_Ac_2a.vqh
+++ b/lib/books/res_Ac_2a.vqh
@@ -19,41 +19,46 @@
#include "codebook.h"
static long _vq_quantlist_res_Ac_2a[] = {
+ 4,
3,
+ 5,
2,
- 4,
+ 6,
1,
- 5,
+ 7,
0,
- 6,
+ 8,
};
static long _vq_lengthlist_res_Ac_2a[] = {
- 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 5, 0, 0, 0, 0,
+ 0, 0, 3, 4, 4, 0, 0, 0, 0, 0, 0, 6, 9, 9, 6, 6,
+ 0, 0, 0, 0, 0, 8, 8,14,13, 0, 0, 0, 0, 0,11,10,
+ 16,14, 0, 0, 0, 0, 0,10,10,13,14, 0, 0, 0, 0, 0,
+ 0, 0,17,17, 0, 0, 0, 0, 0, 0, 0,16,16, 0, 0, 0,
0,
};
static float _vq_quantthresh_res_Ac_2a[] = {
- -2.5, -1.5, -0.5, 0.5, 1.5, 2.5,
+ -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5,
};
static long _vq_quantmap_res_Ac_2a[] = {
- 5, 3, 1, 0, 2, 4, 6,
+ 7, 5, 3, 1, 0, 2, 4, 6,
+ 8,
};
static encode_aux_threshmatch _vq_auxt_res_Ac_2a = {
_vq_quantthresh_res_Ac_2a,
_vq_quantmap_res_Ac_2a,
- 7,
- 7
+ 9,
+ 9
};
static static_codebook _vq_book_res_Ac_2a = {
- 2, 49,
+ 2, 81,
_vq_lengthlist_res_Ac_2a,
- 1, -533200896, 1611661312, 3, 0,
+ 1, -531628032, 1611661312, 4, 0,
_vq_quantlist_res_Ac_2a,
NULL,
&_vq_auxt_res_Ac_2a,
diff --git a/lib/books/res_Ac_3.vqh b/lib/books/res_Ac_3.vqh
index ca6a4583..f38081ff 100644
--- a/lib/books/res_Ac_3.vqh
+++ b/lib/books/res_Ac_3.vqh
@@ -19,75 +19,39 @@
#include "codebook.h"
static long _vq_quantlist_res_Ac_3[] = {
- 2,
1,
- 3,
0,
- 4,
+ 2,
};
static long _vq_lengthlist_res_Ac_3[] = {
- 3, 6, 6, 9, 9, 0, 5, 5, 9, 9, 0, 5, 5, 9, 9, 0,
- 7, 7, 9, 9, 0, 0, 0, 9, 9, 6, 8, 7,11,10, 0, 8,
- 7,11,10, 0, 7, 7,10,10, 0, 9, 9,11,10, 0, 0, 0,
- 11,11, 6, 7, 8,10,11, 0, 7, 8,10,11, 0, 7, 7,10,
- 10, 0, 9, 9,10,11, 0, 0, 0,10,11, 9,11,10,13,12,
- 0,11,11,13,13, 0,11,11,13,13, 0,13,12,14,14, 0,
- 0, 0,14,15, 9,10,11,12,12, 0,11,11,12,14, 0,11,
- 11,12,13, 0,13,13,13,15, 0, 0, 0,14,15, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 5, 7, 7,11,11, 0, 7, 6,10,10,
- 0, 7, 7,10,10, 0, 9, 8,11,10, 0, 0, 0,10,10, 5,
- 7, 7,12,11, 0, 6, 7,10,10, 0, 7, 7,10,10, 0, 8,
- 9,10,10, 0, 0, 0,10,10, 9,10,10,13,12, 0,10,10,
- 12,12, 0,10,10,12,12, 0,12,11,13,12, 0, 0, 0,13,
- 13, 9,10,10,13,13, 0,10,11,12,12, 0,10,10,12,12,
- 0,11,12,12,14, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0,
+ 1, 3, 3, 0, 0, 0, 0, 0, 0, 4, 6, 6, 0, 0, 0, 0,
+ 0, 0, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 5, 8, 7,12,11, 0, 7, 7,10,10, 0, 7, 6,
- 10,10, 0, 8, 8,10,10, 0, 0, 0,10,10, 5, 7, 8,11,
- 11, 0, 7, 7,10,10, 0, 6, 7,10,10, 0, 8, 8,10,10,
- 0, 0, 0,10,10, 9,10,10,13,13, 0,10,10,13,12, 0,
- 10,10,13,12, 0,12,12,14,13, 0, 0, 0,13,12, 9,10,
- 10,12,13, 0,10,10,12,13, 0,10,10,11,12, 0,11,12,
- 12,13, 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 7, 9, 9,13,14, 0, 8, 8,11,12, 0, 8, 9,11,12, 0,
- 10, 9,11,11, 0, 0, 0,11,12, 7, 9, 9,13,13, 0, 8,
- 8,12,12, 0, 9, 8,12,11, 0, 9,10,11,12, 0, 0, 0,
- 12,11, 9,11,11,13,15, 0,10,10,13,13, 0,10,10,12,
- 13, 0,12,11,13,12, 0, 0, 0,12,13, 9,11,11,14,14,
- 0,10,11,13,13, 0,10,10,13,13, 0,11,12,12,13, 0,
- 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9,
- 11,10,14,13, 0,10,10,13,13, 0,10,10,13,12, 0,12,
- 12,13,13, 0, 0, 0,13,13, 9,10,11,13,14, 0,10,10,
- 12,13, 0,10,10,13,13, 0,11,11,13,13, 0, 0, 0,12,
- 13,
+ 0,
};
static float _vq_quantthresh_res_Ac_3[] = {
- -1.5, -0.5, 0.5, 1.5,
+ -0.5, 0.5,
};
static long _vq_quantmap_res_Ac_3[] = {
- 3, 1, 0, 2, 4,
+ 1, 0, 2,
};
static encode_aux_threshmatch _vq_auxt_res_Ac_3 = {
_vq_quantthresh_res_Ac_3,
_vq_quantmap_res_Ac_3,
- 5,
- 5
+ 3,
+ 3
};
static static_codebook _vq_book_res_Ac_3 = {
- 4, 625,
+ 4, 81,
_vq_lengthlist_res_Ac_3,
- 1, -533725184, 1611661312, 3, 0,
+ 1, -535822336, 1611661312, 2, 0,
_vq_quantlist_res_Ac_3,
NULL,
&_vq_auxt_res_Ac_3,
diff --git a/lib/books/res_Ac_4.vqh b/lib/books/res_Ac_4.vqh
index e6b4ed43..3e39361e 100644
--- a/lib/books/res_Ac_4.vqh
+++ b/lib/books/res_Ac_4.vqh
@@ -27,46 +27,46 @@ static long _vq_quantlist_res_Ac_4[] = {
};
static long _vq_lengthlist_res_Ac_4[] = {
- 2, 6, 6,11,10, 0, 5, 5, 9, 9, 0, 5, 5, 9, 9, 0,
- 6, 6, 9, 9, 0, 0, 0, 9, 9, 6, 8, 7,12,11, 0, 8,
- 8,11,10, 0, 8, 8,11,11, 0,10, 9,12,12, 0, 0, 0,
- 12,11, 6, 7, 8,11,12, 0, 8, 8,11,12, 0, 8, 8,10,
- 11, 0, 9,10,11,12, 0, 0, 0,11,12,10,12,11,14,13,
- 0,12,12,15,14, 0,13,12,15,14, 0,14,16,16,16, 0,
- 0, 0,18,15,10,11,12,13,15, 0,12,13,14,15, 0,12,
- 13,13,15, 0,15,15,14,17, 0, 0, 0,15,18, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 5, 8, 8,13,13, 0, 7, 7,11,10,
- 0, 7, 7,11,11, 0, 9, 8,11,10, 0, 0, 0,11,11, 5,
- 8, 8,12,13, 0, 7, 7,11,11, 0, 7, 7,11,11, 0, 8,
- 9,10,11, 0, 0, 0,11,11, 9,11,11,15,14, 0,11,11,
- 14,13, 0,11,11,14,13, 0,13,12,15,13, 0, 0, 0,14,
- 14,10,10,11,13,15, 0,10,11,13,14, 0,11,11,14,14,
- 0,12,13,13,14, 0, 0, 0,14,16, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 5, 8, 8,13,12, 0, 7, 7,11,11, 0, 7, 7,
- 11,10, 0, 8, 8,11,11, 0, 0, 0,11,10, 5, 8, 8,13,
- 13, 0, 7, 7,11,11, 0, 7, 7,10,11, 0, 8, 8,11,11,
- 0, 0, 0,10,11, 9,11,11,14,14, 0,11,11,14,13, 0,
- 11,11,14,13, 0,13,13,15,14, 0, 0, 0,14,13, 9,10,
- 11,14,16, 0,11,11,14,14, 0,11,11,13,14, 0,13,13,
- 14,15, 0, 0, 0,13,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 6,10,10,15,15, 0, 8, 8,14,13, 0, 8, 9,14,13, 0,
- 10, 9,14,12, 0, 0, 0,12,13, 7,10,10,16,15, 0, 8,
- 8,13,14, 0, 9, 8,13,13, 0, 9,10,12,13, 0, 0, 0,
- 13,12,10,12,11,18,16, 0,11,10,15,14, 0,11,11,15,
- 15, 0,13,12,15,13, 0, 0, 0,14,14, 9,11,12,15,16,
- 0,10,11,14,15, 0,11,11,14,17, 0,12,13,13,15, 0,
- 0, 0,15,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
};
static float _vq_quantthresh_res_Ac_4[] = {
diff --git a/lib/books/res_Ac_5.vqh b/lib/books/res_Ac_5.vqh
index 22a4b5ac..91749ed1 100644
--- a/lib/books/res_Ac_5.vqh
+++ b/lib/books/res_Ac_5.vqh
@@ -27,13 +27,13 @@ static long _vq_quantlist_res_Ac_5[] = {
};
static long _vq_lengthlist_res_Ac_5[] = {
- 2, 4, 4, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 4, 7, 6, 0, 0,
+ 1, 4, 4, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 3, 4, 4, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 6,10, 9,
+ 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 6,10, 8,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 6, 6, 7, 8,10, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 7, 6, 7, 9,10, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/lib/books/res_Ac_5a.vqh b/lib/books/res_Ac_5a.vqh
index 65283428..91dd7339 100644
--- a/lib/books/res_Ac_5a.vqh
+++ b/lib/books/res_Ac_5a.vqh
@@ -31,11 +31,11 @@ static long _vq_quantlist_res_Ac_5a[] = {
};
static long _vq_lengthlist_res_Ac_5a[] = {
- 1, 3, 2, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 5, 0, 0, 0, 0,
+ 0, 0, 3, 5, 5, 0, 0, 0, 0, 0, 0, 5, 8, 8, 6, 6,
+ 0, 0, 0, 0, 8, 8, 8, 0,10, 0, 0, 0, 0, 7, 8,10,
+ 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 7,
+ 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0,
0,
};
diff --git a/lib/books/res_Ac_6.vqh b/lib/books/res_Ac_6.vqh
index 26495086..4b0d9129 100644
--- a/lib/books/res_Ac_6.vqh
+++ b/lib/books/res_Ac_6.vqh
@@ -31,12 +31,12 @@ static long _vq_quantlist_res_Ac_6[] = {
};
static long _vq_lengthlist_res_Ac_6[] = {
- 2, 4, 4, 7, 7, 8, 8,10,10, 0, 4, 4, 6, 6, 8, 8,
- 10,10, 0, 4, 3, 6, 6, 8, 8,10,10, 0, 5, 5, 7, 6,
- 8, 8,10,10, 0, 0, 0, 6, 6, 8, 8,10,10, 0, 0, 0,
- 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0,
- 0, 0, 8, 8, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,11,
- 11,
+ 1, 3, 2, 5, 5, 5, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
};
static float _vq_quantthresh_res_Ac_6[] = {
diff --git a/lib/books/res_Ac_7.vqh b/lib/books/res_Ac_7.vqh
index a9ca42e3..43a2fc8c 100644
--- a/lib/books/res_Ac_7.vqh
+++ b/lib/books/res_Ac_7.vqh
@@ -19,41 +19,46 @@
#include "codebook.h"
static long _vq_quantlist_res_Ac_7[] = {
+ 4,
3,
+ 5,
2,
- 4,
+ 6,
1,
- 5,
+ 7,
0,
- 6,
+ 8,
};
static long _vq_lengthlist_res_Ac_7[] = {
- 1, 4, 4, 6, 6, 8, 8, 5, 4, 4, 7, 7, 9, 9, 5, 5,
- 5, 7, 7, 9, 9, 0, 7, 7, 8, 8,10,10, 0, 8, 8, 9,
- 9,10,10, 0,12,12, 9,10,11,10, 0,13,13,10,10,12,
- 11,
+ 1, 3, 3, 6, 6, 8, 7, 8, 8, 0, 5, 5, 7, 7, 8, 9,
+ 10,12, 0, 5, 5, 7, 7, 9, 8,10,12, 0, 7, 7,10,11,
+ 0, 0, 0,12, 0, 8, 8,12, 9,12, 0, 0, 0, 0,12, 0,
+ 12, 0, 0, 0, 0, 0, 0, 0, 0, 0,11, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,12, 0, 0, 0, 0,
+ 0,
};
static float _vq_quantthresh_res_Ac_7[] = {
- -12.5, -7.5, -2.5, 2.5, 7.5, 12.5,
+ -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5,
};
static long _vq_quantmap_res_Ac_7[] = {
- 5, 3, 1, 0, 2, 4, 6,
+ 7, 5, 3, 1, 0, 2, 4, 6,
+ 8,
};
static encode_aux_threshmatch _vq_auxt_res_Ac_7 = {
_vq_quantthresh_res_Ac_7,
_vq_quantmap_res_Ac_7,
- 7,
- 7
+ 9,
+ 9
};
static static_codebook _vq_book_res_Ac_7 = {
- 2, 49,
+ 2, 81,
_vq_lengthlist_res_Ac_7,
- 1, -528613376, 1616117760, 3, 0,
+ 1, -527171584, 1616117760, 4, 0,
_vq_quantlist_res_Ac_7,
NULL,
&_vq_auxt_res_Ac_7,
diff --git a/lib/books/res_Ac_7a.vqh b/lib/books/res_Ac_7a.vqh
index fe6308bd..4237f850 100644
--- a/lib/books/res_Ac_7a.vqh
+++ b/lib/books/res_Ac_7a.vqh
@@ -27,46 +27,46 @@ static long _vq_quantlist_res_Ac_7a[] = {
};
static long _vq_lengthlist_res_Ac_7a[] = {
- 3, 6, 6, 8, 8,10, 6, 6, 8, 8,10, 6, 6, 8, 8,11,
- 8, 8, 8, 8,11,11,11, 8, 8, 6, 7, 7, 9, 9,11, 8,
- 8, 9, 9,11, 8, 8, 9, 9,11,10,10,10,10,11,11,11,
- 10,10, 6, 7, 7, 9, 9,11, 8, 8,10, 9,11, 8, 8, 9,
- 10,11,10,10,10,10,11,11,11, 9,10, 8, 9, 9,10, 9,
- 11,10,10,10,10,11,10,10,10,10,12,11,11,11,10,12,
- 12,12,11,11, 8, 9, 9,10,10,12,10,10,10,10,11,10,
- 10,10,10,12,11,11,10,10,11,12,12,10,10,10,11,11,
- 11,12,13,11,11,11,11,13,12,11,12,12,13,12,12,12,
- 12,13,13,12,11,11, 6, 8, 8,10,10,11, 8, 8,10, 9,
- 12, 8, 8,10, 9,11, 9, 9, 9,10,11,11,11, 9, 9, 6,
- 8, 8,10,10,11, 8, 8,10,10,12, 8, 8, 9,10,11, 9,
- 9, 9, 9,11,11,11, 9,10, 8, 9, 9,10,10,11,10, 9,
- 10,10,12,10,10,10,10,12,11,11,10,10,12,12,12,11,
- 10, 8, 9,10,10,10,12,10,10,10,10,11,10,10,10,10,
- 12,11,10,11,11,12,12,11,10,11,10,11,11,12,11,13,
- 11,11,12,12,13,11,11,11,12,12,12,12,12,12,13,12,
- 12,12,12, 6, 8, 8,10,10,12, 8, 8,10,10,11, 8, 8,
- 9, 9,11, 9, 9, 9, 9,11,12,11,10, 9, 6, 8, 8,10,
- 10,11, 8, 8,10,10,11, 8, 8, 9,10,11, 9, 9, 9, 9,
- 11,11,12, 9, 9, 8, 9, 9,10,10,12,10,10,10,10,12,
- 9, 9,10,10,11,10,10,10,10,11,11,11,10,10, 8, 9,
- 10,10,10,12,10, 9,10,10,12, 9, 9,10,10,11,10,10,
- 10,10,11,12,11,10,10,11,11,11,12,12,13,11,11,12,
- 12,13,11,12,12,12,13,12,12,11,11,13,13,13,11,12,
- 8,10,10,11,10,12, 9, 9,11,11,12, 9, 9,10,10,12,
- 10,10,10,10,12,12,12,10,10, 8,10, 9,11,11,12, 9,
- 9,10,10,12, 9, 9,10,10,12,10,10,10,10,12,12,12,
- 10,10, 9,10,10,10,10,12, 9, 9,10,10,12, 9, 9,10,
- 10,12,10,10,10,10,11,12,12,10,10, 8, 9,10,10,10,
- 11, 9,10,10,10,11, 9, 9,10,10,11,10,10,10,10,11,
- 12,12,10,10,10,11,11,12,12,12,11,11,11,12,13,11,
- 11,12,12,12,12,12,12,11,13,12,13,11,12,11,11,11,
- 12,12,13,11,11,12,12,13,12,11,12,12,12,12,12,12,
- 11,12,12,13,12,12,11,12,11,12,12,13,11,12,12,12,
- 13,11,11,12,12,13,12,12,12,11,12,13,12,11,12, 8,
- 10,10,10,11,12, 9, 9,10,11,12, 9, 9,10,10,11,10,
- 10,10,10,11,12,12,10,10, 8,10,10,10,11,11, 9, 9,
- 10,11,12, 9, 9,10,10,12,10,10,10,10,12,12,12,10,
- 10,
+ 1, 5, 4, 7, 7,11,13,13, 0,14,10,11,14,13,12,10,
+ 13, 0,12,13,10,12,13,12,12, 5, 6, 5, 7, 7,10,12,
+ 11, 0,12,10,13,12,12,11, 9,13,13,12,12, 9, 0,12,
+ 12,12, 4, 5, 6, 7, 7,10,12,13,13,12, 9,12,11,12,
+ 12,10,12,11,13, 0,10,13,12,11,13, 7, 7, 7, 8, 8,
+ 10,12,12,13, 0,10,13,12, 0,12,10,13,12,12,13, 9,
+ 13,11, 0,12, 7, 7, 7, 7, 8,10,11,11,12,13, 9,12,
+ 12,13, 0,10,12,11,13,13, 9,11,11, 0,13, 9, 9,10,
+ 10,10, 0,13, 0, 0,12, 0, 0, 0, 0,13,13, 0, 0,13,
+ 13,12,13, 0,13, 0,11,12,11,11,13,13,13, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,13, 0, 0, 0, 0, 0, 0, 0, 0,12,
+ 11, 0,11,12, 0, 0, 0,13,13,13, 0,13, 0, 0, 0,13,
+ 0, 0, 0, 0, 0,13, 0,13,12,12,11,12,11, 0, 0, 0,
+ 0, 0,12, 0,13,13, 0,12, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,12, 0,12,12,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0,13,13, 0, 0, 0, 0,10,10, 9, 9, 9, 0,
+ 0, 0,13, 0,12, 0, 0,13, 0, 0, 0,13,13, 0,13,13,
+ 0, 0,12,13,11,11,13,11, 0, 0, 0, 0, 0,12, 0, 0,
+ 0, 0,13, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,11,12,12,
+ 13, 0, 0,13,13, 0, 0, 0,13, 0, 0, 0, 0, 0, 0, 0,
+ 12,13, 0, 0,13,13,12,12,12,13, 0,12, 0, 0, 0, 0,
+ 13,13, 0, 0, 0, 0, 0, 0, 0,13, 0, 0, 0, 0,12,11,
+ 13,11,12, 0,13, 0, 0, 0, 0, 0, 0, 0, 0,13, 0, 0,
+ 0,13, 0, 0, 0, 0, 0,10, 9, 9,10, 9,13, 0, 0, 0,
+ 0,13, 0, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0,
+ 13,12,11,11,11, 0, 0, 0, 0, 0, 0,13, 0,13, 0, 0,
+ 13, 0, 0, 0, 0, 0, 0, 0, 0,13,11,12,11,12, 0, 0,
+ 13, 0, 0, 0, 0, 0, 0, 0,12, 0, 0,13, 0, 0, 0,13,
+ 0, 0, 0,12, 0, 0,11, 0, 0, 0, 0,13, 0, 0, 0, 0,
+ 13, 0, 0, 0, 0, 0, 0,13, 0, 0,12,13,12,11,12,13,
+ 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13, 0,13, 0, 0,
+ 0, 0, 0, 0,10, 9, 9,10,10, 0,13,13, 0, 0, 0, 0,
+ 0, 0,13, 0,13, 0, 0, 0,12,13, 0,13,13,12,11,12,
+ 12,12, 0, 0,13, 0,12, 0, 0,13, 0, 0, 0,13, 0, 0,
+ 0,13, 0,13, 0,13,13,11,13,13,12, 0, 0, 0, 0, 0,
+ 0,13, 0, 0,12,12, 0,13,13, 0, 0,13, 0, 0,13,13,
+ 13,12,13,12, 0, 0, 0, 0,13, 0, 0, 0, 0, 0,13, 0,
+ 13, 0, 0, 0, 0, 0, 0, 0,13,13,12, 0,13, 0, 0, 0,
+ 0, 0, 0, 0,13, 0,13, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
};
static float _vq_quantthresh_res_Ac_7a[] = {
diff --git a/lib/books/res_Ac_8.vqh b/lib/books/res_Ac_8.vqh
index e0002a41..a5c2da37 100644
--- a/lib/books/res_Ac_8.vqh
+++ b/lib/books/res_Ac_8.vqh
@@ -19,56 +19,188 @@
#include "codebook.h"
static long _vq_quantlist_res_Ac_8[] = {
- 6,
- 5,
- 7,
- 4,
- 8,
3,
- 9,
2,
- 10,
+ 4,
1,
- 11,
+ 5,
0,
- 12,
+ 6,
};
static long _vq_lengthlist_res_Ac_8[] = {
- 1, 4, 3, 6, 6, 8, 8, 9, 9,10,10,11,10, 6, 5, 5,
- 7, 7, 9, 9,10,10,11,11,13,12, 6, 5, 5, 7, 7, 9,
- 9,10,10,12,11,13,12, 0, 7, 7, 8, 8,10, 9,11,12,
- 12,13,13,13, 0, 8, 8, 8, 8,10,10,11,11,13,14,14,
- 13, 0,12,12, 9, 9,10,10,12,12,13,13,14,14, 0,13,
- 13,10, 9,10,11,12,13,14,14,17,17, 0, 0, 0,12,11,
- 12,12,13,12,14,14,15,14, 0, 0, 0,12,12,11,11,13,
- 13,14,15,15,16, 0, 0, 0,16,14,13,12,14,14,15,15,
- 16,15, 0, 0, 0,16, 0,13,13,13,14,15,15,16, 0, 0,
- 0, 0, 0, 0,14,14,15,15,15,15,16,16, 0, 0, 0, 0,
- 0,15,15,16,13,15,13,16, 0,
+ 1, 5, 4, 8, 8,11, 9, 7, 7, 7,10, 9,13,11, 7, 7,
+ 6,10,10,12,11, 0,11,10,12,11,13,14, 0,11,10,11,
+ 11,16,16, 0,14,14,13,15, 0,14, 0, 0, 0,13,12,14,
+ 13, 4, 7, 7,10, 9,12,11,10, 9, 9,12,12,14,12,10,
+ 10, 9,12,12,14,14, 0,14,13,15,14,15, 0, 0,14,14,
+ 13,15, 0, 0, 0, 0, 0, 0,14, 0,15, 0, 0, 0, 0, 0,
+ 0, 0, 4, 7, 7,10, 9,12,12,10,10, 9,12,12,14,15,
+ 11,10,10,11,14, 0,15, 0,13,13,13,15, 0, 0, 0,13,
+ 14,14,13, 0,15, 0,15, 0, 0, 0,15, 0, 0,15, 0, 0,
+ 0, 0, 0, 8,10,10,12,11,15, 0,14,12,13,13,14, 0,
+ 15,14,12,13,15,13,15,15, 0,15,15,15,15, 0, 0, 0,
+ 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,15, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 8, 9,10,12,12,15,14,15,15,12, 0,13,
+ 0, 0,15,13,13,15,15, 0,14, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,10,11,12,14,13, 0, 0,15, 0,14, 0,
+ 15, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,11,13,12,13, 0, 0,15,15, 0,14,
+ 0, 0, 0, 0, 0,14, 0,15, 0,15, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 6,10,10,13,14, 0,15,11,11,
+ 11, 0,15, 0, 0,11,10,11,14,14,15, 0, 0,14,15,14,
+ 0, 0, 0, 0,14,14,14,15, 0, 0, 0, 0, 0, 0, 0, 0,
+ 15, 0, 0, 0, 0,13, 0, 0, 6,10, 9,12,13, 0,15,11,
+ 11,11,14,15, 0,15,11,10,10,13,14,14,14, 0,14,13,
+ 0,14,15,15, 0,13,14,13,14,15, 0, 0, 0,15, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10,10,12,13,14, 0,
+ 12,10,10,14,14, 0,15,11,10,10,13,13,15,15, 0,14,
+ 0,15,14, 0,14, 0,14,14,14,15, 0,15, 0, 0, 0,15,
+ 0,14, 0, 0, 0, 0, 0, 0, 0, 0,10,11,12, 0,14, 0,
+ 0,15,14,13,15,15,15, 0,14,12,14,14,14, 0, 0, 0,
+ 0,15, 0, 0, 0, 0, 0, 0, 0,15, 0, 0,14, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,13,12,14, 0,
+ 0, 0,14,13,14, 0,15, 0,15,14,14,13,15, 0, 0, 0,
+ 0,15, 0,15, 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,14,14,15,
+ 14, 0, 0, 0, 0,15, 0,14, 0, 0,15,15,14, 0,15, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,15, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,14, 0,
+ 14, 0, 0, 0, 0, 0, 0,14, 0, 0, 0, 0,14, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10,
+ 10,14,14,15, 0,11,11,11,13,13, 0, 0,11,11,12,15,
+ 0, 0,15, 0,14,14,15,14, 0, 0, 0,14,14,15,15, 0,
+ 0, 0,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,15, 0, 0, 7,
+ 10,10,13,14,14,15,11,10,10,14,13,13,15,11,11,11,
+ 14,15, 0, 0, 0,14,13,14, 0,15,14, 0,15,13, 0,15,
+ 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0, 0,15, 0, 0,
+ 7, 9,10,13,13, 0,14,10,10,10,13,13, 0, 0,12,11,
+ 11,14,15, 0, 0, 0,15,13,14,13,14, 0, 0,14,14,14,
+ 14, 0, 0, 0, 0, 0,14, 0, 0, 0, 0, 0, 0,15,15, 0,
+ 15,10,12,12,14,14,15,15, 0,14,14,15, 0, 0, 0, 0,
+ 14,13, 0, 0, 0, 0, 0,15,14,15, 0, 0, 0, 0, 0, 0,
+ 0,15, 0, 0, 0, 0, 0, 0, 0, 0,15, 0, 0, 0, 0, 0,
+ 0, 0,10,11,13,15,15,15, 0,14,14,12,15, 0,15, 0,
+ 14,14,14,15,15, 0,15, 0, 0, 0,15, 0,15, 0, 0, 0,
+ 15, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14, 0,
+ 0, 0, 0, 0, 0, 0,15,13, 0, 0, 0, 0,15,15, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,15, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14,
+ 0,15, 0, 0, 0, 0, 0, 0,15, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,15,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
};
static float _vq_quantthresh_res_Ac_8[] = {
- -71.5, -58.5, -45.5, -32.5, -19.5, -6.5, 6.5, 19.5,
- 32.5, 45.5, 58.5, 71.5,
+ -62.5, -37.5, -12.5, 12.5, 37.5, 62.5,
};
static long _vq_quantmap_res_Ac_8[] = {
- 11, 9, 7, 5, 3, 1, 0, 2,
- 4, 6, 8, 10, 12,
+ 5, 3, 1, 0, 2, 4, 6,
};
static encode_aux_threshmatch _vq_auxt_res_Ac_8 = {
_vq_quantthresh_res_Ac_8,
_vq_quantmap_res_Ac_8,
- 13,
- 13
+ 7,
+ 7
};
static static_codebook _vq_book_res_Ac_8 = {
- 2, 169,
+ 4, 2401,
_vq_lengthlist_res_Ac_8,
- 1, -523010048, 1618608128, 4, 0,
+ 1, -523059200, 1620639744, 3, 0,
_vq_quantlist_res_Ac_8,
NULL,
&_vq_auxt_res_Ac_8,
diff --git a/lib/books/res_Ac_8a.vqh b/lib/books/res_Ac_8a.vqh
index 3b27fa2a..5daac200 100644
--- a/lib/books/res_Ac_8a.vqh
+++ b/lib/books/res_Ac_8a.vqh
@@ -19,56 +19,37 @@
#include "codebook.h"
static long _vq_quantlist_res_Ac_8a[] = {
- 6,
- 5,
- 7,
- 4,
- 8,
- 3,
- 9,
2,
- 10,
1,
- 11,
+ 3,
0,
- 12,
+ 4,
};
static long _vq_lengthlist_res_Ac_8a[] = {
- 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 6, 6,
- 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 6, 6, 6, 6, 7,
- 7, 7, 7, 7, 7, 7, 7, 9, 7, 7, 7, 7, 7, 7, 7, 7,
- 8, 7, 7, 8, 9, 9, 9, 7, 7, 7, 7, 7, 7, 8, 8, 7,
- 8, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9,
- 9, 7, 7, 8, 7, 8, 8, 7, 8, 8, 8, 9, 9, 9, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 8, 8, 8,
- 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8,
- 8, 8, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 9,
- 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,
- 9, 9, 9, 8, 8, 8, 8, 8, 8,
+ 2, 3, 3, 5, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 7,
+ 6, 6, 6, 6, 7, 6, 6, 5, 6,
};
static float _vq_quantthresh_res_Ac_8a[] = {
- -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5,
- 2.5, 3.5, 4.5, 5.5,
+ -7.5, -2.5, 2.5, 7.5,
};
static long _vq_quantmap_res_Ac_8a[] = {
- 11, 9, 7, 5, 3, 1, 0, 2,
- 4, 6, 8, 10, 12,
+ 3, 1, 0, 2, 4,
};
static encode_aux_threshmatch _vq_auxt_res_Ac_8a = {
_vq_quantthresh_res_Ac_8a,
_vq_quantmap_res_Ac_8a,
- 13,
- 13
+ 5,
+ 5
};
static static_codebook _vq_book_res_Ac_8a = {
- 2, 169,
+ 2, 25,
_vq_lengthlist_res_Ac_8a,
- 1, -531103744, 1611661312, 4, 0,
+ 1, -529268736, 1616117760, 3, 0,
_vq_quantlist_res_Ac_8a,
NULL,
&_vq_auxt_res_Ac_8a,
diff --git a/lib/books/res_Ac_9.vqh b/lib/books/res_Ac_9.vqh
index c04ad0c4..a37535fb 100644
--- a/lib/books/res_Ac_9.vqh
+++ b/lib/books/res_Ac_9.vqh
@@ -29,9 +29,9 @@ static long _vq_quantlist_res_Ac_9[] = {
};
static long _vq_lengthlist_res_Ac_9[] = {
- 1, 4, 4,10,10,10,10, 3, 4,10,10,10,10,10, 3,10,
+ 1, 4, 4,10,10,10,10, 3, 4,10,10,10,10,10, 3, 9,
7,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
- 10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9,
};
diff --git a/lib/books/res_Ac_9a.vqh b/lib/books/res_Ac_9a.vqh
index 0d342414..46511cdf 100644
--- a/lib/books/res_Ac_9a.vqh
+++ b/lib/books/res_Ac_9a.vqh
@@ -35,17 +35,17 @@ static long _vq_quantlist_res_Ac_9a[] = {
};
static long _vq_lengthlist_res_Ac_9a[] = {
- 2, 3, 3, 7, 7, 9, 8,10, 9,11, 9, 9, 9, 5, 5, 5,
- 9, 9,10,10,10,11,13,10, 9, 9, 5, 4, 4, 8, 9,10,
- 9,10,12,11,10, 9, 9,13, 8, 8,10,10,11,10,12,12,
- 12,11,10,11,13, 6, 5, 6, 6,11,11,11,11,10,11, 8,
+ 2, 3, 3, 7, 7,10, 8,10, 9,11, 9, 9, 8, 5, 5, 5,
+ 9, 9,10,10,10,11,12, 9,10, 9, 5, 4, 4, 8, 9,10,
+ 9,10,11,11,10, 9, 9,12, 8, 8,10,10,11,10,12,12,
+ 12,10,10,11,13, 6, 5, 6, 6,11,11,11,12,10,11, 8,
9,13,12, 9, 9, 8,11,12,12,12,11, 9,12, 9,13,10,
- 10, 7, 6,11,10,12,12, 8,12, 9,11,13,12,13,11,11,
- 12,12,12,12,12, 8,12,10,13,13,13,12, 9,13, 9,12,
- 12, 8,13,11,12,13,13,13,13,13,12,13,13, 9,11, 9,
- 12,12,13,13,12,13,13,12,12, 8,13, 9,12,13,13,13,
- 13,13,13,13,13,13,11, 9,11,10,11,11,13,13,13,13,
- 13,11,12, 9,12,12,12,12,11,
+ 10, 7, 6,11,10,12,12, 8,12, 9,11,13,12,13,11,12,
+ 12,12,13,12,12, 8,12,10,13,13,13,12, 9,13,10,12,
+ 12, 8,13,11,12,13,13,13,13,12,12,13,13, 9,11, 9,
+ 12,12,13,13,12,13,13,12,12, 8,13, 9,12,13,13,12,
+ 13,13,13,13,13,13,11, 9,11,10,11,12,13,13,13,13,
+ 13,11,12, 9,13,12,12,12,12,
};
static float _vq_quantthresh_res_Ac_9a[] = {
diff --git a/lib/books/res_Ac_9b.vqh b/lib/books/res_Ac_9b.vqh
index cee8c7ad..f7511a54 100644
--- a/lib/books/res_Ac_9b.vqh
+++ b/lib/books/res_Ac_9b.vqh
@@ -35,17 +35,17 @@ static long _vq_quantlist_res_Ac_9b[] = {
};
static long _vq_lengthlist_res_Ac_9b[] = {
- 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 8, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 7, 8,
+ 5, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 9, 8, 8, 8, 8, 7, 8, 7, 8,
7, 8, 7, 7, 8, 8, 8, 7, 8, 7, 7, 7, 7, 8, 7, 7,
7, 9, 9, 8, 8, 7, 8, 8, 7, 8, 7, 8, 7, 7, 8, 8,
9, 8, 8, 7, 8, 7, 7, 7, 7, 7, 7, 9, 9, 9, 8, 8,
- 8, 8, 8, 8, 8, 7, 7, 7, 9, 8, 8, 8, 8, 7, 7, 8,
- 7, 7, 8, 7, 8, 8, 8, 9, 8, 8, 8, 8, 8, 7, 8, 7,
- 7, 7, 8, 9, 8, 9, 8, 7, 8, 7, 7, 7, 7, 8, 7, 8,
- 9, 8, 8, 8, 7, 8, 8, 7, 8, 7, 7, 7, 9, 9, 9, 8,
- 8, 9, 8, 7, 7, 8, 7, 8, 7,
+ 8, 8, 8, 8, 8, 7, 7, 7, 9, 8, 9, 8, 8, 7, 7, 8,
+ 7, 7, 8, 7, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8, 8, 7,
+ 7, 7, 8, 9, 8, 9, 8, 7, 8, 7, 7, 7, 8, 8, 7, 8,
+ 9, 8, 8, 9, 7, 8, 8, 7, 8, 7, 7, 8, 9, 9, 9, 8,
+ 8, 9, 9, 7, 7, 8, 7, 8, 8,
};
static float _vq_quantthresh_res_Ac_9b[] = {
diff --git a/lib/codec_internal.h b/lib/codec_internal.h
index 5f84f1a5..40220292 100644
--- a/lib/codec_internal.h
+++ b/lib/codec_internal.h
@@ -10,7 +10,7 @@
********************************************************************
function: libvorbis codec headers
- last mod: $Id: codec_internal.h,v 1.9.4.2 2001/10/11 15:41:44 xiphmont Exp $
+ last mod: $Id: codec_internal.h,v 1.9.4.3 2001/10/16 20:10:10 xiphmont Exp $
********************************************************************/
@@ -46,6 +46,7 @@ typedef void vorbis_info_mapping;
#include "psy.h"
+#define BITTRACK_DIVISOR 16
typedef struct backend_lookup_state {
/* local lookup storage */
envelope_lookup *ve; /* envelope lookup */
@@ -68,14 +69,15 @@ typedef struct backend_lookup_state {
/* encode side bitrate tracking */
ogg_uint32_t *bitrate_queue;
- ogg_uint32_t *bitrate_queue_eighths;
+ ogg_uint32_t *bitrate_queue_bin;
int bitrate_queue_size;
int bitrate_queue_head;
- int bitrate_eighths;
+ int bitrate_bins;
- long bitrate_boundbitacc;
- long bitrate_boundsampleacc;
- long bitrate_boundtail;
+ /* 0, -1, -4, -16, -n/16, -n/8, -n/4, -n/2 */
+ long bitrate_boundbitacc[8];
+ long bitrate_boundsampleacc[8];
+ long bitrate_boundtail[8];
long *bitrate_avgbitacc;
long bitrate_avgsampleacc;
@@ -127,13 +129,20 @@ typedef struct codec_setup_info {
/* detailed bitrate management setup */
double bitrate_floatinglimit_initial; /* set by mode */
+ double bitrate_floatinglimit_minimum; /* set by mode */
+ double bitrate_floatinglimit_upslew_max;
+ double bitrate_floatinglimit_downslew_max;
+
double bitrate_bound_queuetime;
double bitrate_avg_queuetime;
- double bitrate_absolute_max;
- double bitrate_absolute_min;
- double bitrate_queue_max;
+ double bitrate_absolute_min_short;
+ double bitrate_absolute_min_long;
+ double bitrate_absolute_max_short;
+ double bitrate_absolute_max_long;
+
double bitrate_queue_min;
+ double bitrate_queue_max;
double bitrate_queue_loweravg;
double bitrate_queue_upperavg;
diff --git a/lib/mapping0.c b/lib/mapping0.c
index 27cc1fd7..5b61cb5c 100644
--- a/lib/mapping0.c
+++ b/lib/mapping0.c
@@ -11,7 +11,7 @@
********************************************************************
function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.37.2.2 2001/10/11 15:41:44 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.37.2.3 2001/10/16 20:10:10 xiphmont Exp $
********************************************************************/
@@ -179,7 +179,8 @@ static int ilog2(unsigned int v){
return(ret);
}
-static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,oggpack_buffer *opb){
+static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
+ oggpack_buffer *opb){
int i;
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
@@ -283,34 +284,34 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
static double floater_interpolate(backend_lookup_state *b,vorbis_info *vi,
double desired_rate){
- int eighth=b->bitrate_floatinglimit*8-1.;
+ int bin=b->bitrate_floatinglimit*BITTRACK_DIVISOR-1.;
double lobitrate;
double hibitrate;
if(desired_rate<=0.)return(0.);
- lobitrate=(double)(eighth==0?0.:
- b->bitrate_avgbitacc[eighth-1])/b->bitrate_avgsampleacc*vi->rate;
- while(lobitrate>desired_rate && eighth>0){
- eighth--;
- lobitrate=(double)(eighth==0?0.:
- b->bitrate_avgbitacc[eighth-1])/b->bitrate_avgsampleacc*vi->rate;
+ lobitrate=(double)(bin==0?0.:
+ b->bitrate_avgbitacc[bin-1])/b->bitrate_avgsampleacc*vi->rate;
+ while(lobitrate>desired_rate && bin>0){
+ bin--;
+ lobitrate=(double)(bin==0?0.:
+ b->bitrate_avgbitacc[bin-1])/b->bitrate_avgsampleacc*vi->rate;
}
- hibitrate=(eighth>=b->bitrate_eighths?b->bitrate_avgbitacc[b->bitrate_eighths-1]:
- (double)b->bitrate_avgbitacc[eighth])/b->bitrate_avgsampleacc*vi->rate;
- while(hibitrate<desired_rate && eighth<b->bitrate_eighths){
- eighth++;
- if(eighth<b->bitrate_eighths)
- hibitrate=(double)b->bitrate_avgbitacc[eighth]/b->bitrate_avgsampleacc*vi->rate;
+ hibitrate=(bin>=b->bitrate_bins?b->bitrate_avgbitacc[b->bitrate_bins-1]:
+ (double)b->bitrate_avgbitacc[bin])/b->bitrate_avgsampleacc*vi->rate;
+ while(hibitrate<desired_rate && bin<b->bitrate_bins){
+ bin++;
+ if(bin<b->bitrate_bins)
+ hibitrate=(double)b->bitrate_avgbitacc[bin]/b->bitrate_avgsampleacc*vi->rate;
}
/* interpolate */
- if(eighth==b->bitrate_eighths){
- return eighth/8.;
+ if(bin==b->bitrate_bins){
+ return bin/(double)BITTRACK_DIVISOR;
}else{
double delta=(desired_rate-lobitrate)/(hibitrate-lobitrate);
- return (eighth+delta)/8.;
+ return (bin+delta)/(double)BITTRACK_DIVISOR;
}
}
@@ -501,8 +502,8 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
int stopflag=0,stoppos=0;
for(i=0;i<vi->channels;i++){
- quantized[i]=pcm[i]+n/2;
- sofar[i]=_vorbis_block_alloc(vb,n/2*sizeof(*sofar[i]));
+ quantized[i]=_vorbis_block_alloc(vb,n*sizeof(*sofar[i]));
+ sofar[i]=quantized[i]+n/2;
memset(sofar[i],0,sizeof(*sofar[i])*n/2);
}
@@ -570,16 +571,49 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
else, use the bits sunk by a single iteration (bounded by min/max)
*/
{
- long period_samples=b->bitrate_boundsampleacc+ci->blocksizes[vb->W]/2;
- long maxbits_period=ci->bitrate_queue_max/vi->rate*period_samples;
- long minbits_period=ci->bitrate_queue_min/vi->rate*period_samples;
- long maxbits_absolute=ci->bitrate_absolute_max/vi->rate*
- ci->blocksizes[vb->W]/2;
- long minbits_absolute=ci->bitrate_absolute_min/vi->rate*
- ci->blocksizes[vb->W]/2;
-
- maxbits=min(maxbits_period-b->bitrate_boundbitacc,maxbits_absolute);
- minbits=max(minbits_period-b->bitrate_boundbitacc,minbits_absolute);
+ long maxbits_absolute=
+ (vb->W?
+ ci->bitrate_absolute_max_long/vi->rate*ci->blocksizes[1]/2:
+ ci->bitrate_absolute_max_short/vi->rate*ci->blocksizes[0]/2);
+ long minbits_absolute=
+ (vb->W?
+ ci->bitrate_absolute_min_long/vi->rate*ci->blocksizes[1]/2:
+ ci->bitrate_absolute_min_short/vi->rate*ci->blocksizes[0]/2);
+
+ long minbits_period=ci->bitrate_queue_min/vi->rate*
+ (b->bitrate_boundsampleacc[0]+ci->blocksizes[vb->W]/2)-
+ b->bitrate_boundbitacc[0];
+
+ long period_samples=max(ci->bitrate_bound_queuetime*vi->rate,
+ b->bitrate_boundsampleacc[0]);
+ long maxbits_period=-1;
+
+ /* pessimistic checkahead */
+ for(i=0;i<8;i++){
+ long ahead_samples=period_samples-b->bitrate_boundsampleacc[i];
+ if(ahead_samples>=0){
+ long maxbits_local=ci->bitrate_queue_max/vi->rate*
+ (period_samples+ci->blocksizes[vb->W]/2)-
+ b->bitrate_boundbitacc[i]-
+ ci->bitrate_queue_min/vi->rate*ahead_samples;
+
+ if(maxbits_period==-1 || maxbits_local<maxbits_period)
+ maxbits_period=maxbits_local;
+
+ }
+ }
+
+
+ if(maxbits_absolute){
+ if(ci->bitrate_queue_max>0.){
+ maxbits=min(maxbits_period,maxbits_absolute);
+ }else{
+ maxbits=maxbits_absolute;
+ }
+ }else
+ maxbits=maxbits_period;
+ minbits=max(minbits_period,minbits_absolute);
+
if(maxbits<0)maxbits=0;
if(maxbits)minbits=min(minbits,maxbits);
}
@@ -594,8 +628,8 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
vector, according residue mapping */
for(j=0;j<info->submaps;j++){
- ogg_uint32_t *queueptr=b->bitrate_queue_eighths;
- if(queueptr)queueptr+=b->bitrate_queue_head*b->bitrate_eighths;
+ ogg_uint32_t *queueptr=b->bitrate_queue_bin;
+ if(queueptr)queueptr+=b->bitrate_queue_head*b->bitrate_bins;
if(stoppos){
look->residue_func[j]->
@@ -681,7 +715,7 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
/* bitrate management.... deciding when it's time to stop. */
if(i<quant_passes){
- if(b->bitrate_eighths==0){ /* average bitrate always runs
+ if(b->bitrate_bins==0){ /* average bitrate always runs
encode to the bitter end in
order to collect statistics */
@@ -706,35 +740,32 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
/* down-couple/down-quantize from perfect-'so-far' ->
new quantized vector */
- if(!stoppos){ /* only do this if we're doing a real iteration
- and not padding */
- if(info->coupling_steps==0){
- /* this assumes all or nothing coupling right now. it should pass
- through any channels left uncoupled, but it doesn't do that now */
- int k;
- for(k=0;k<vi->channels;k++){
- float *lpcm=pcm[k];
- float *lsof=sofar[k];
- float *lqua=quantized[k];
- for(j=0;j<n/2;j++)
- lqua[j]=lpcm[j]-lsof[j];
- }
- }else{
- char buf[80];
-
- _vp_quantize_couple(look->psy_look[blocktype],
- info,
- pcm,
- sofar,
- quantized,
- nonzero,
- i);
-
- sprintf(buf,"quant%d",i);
- for(j=0;j<vi->channels;j++)
- _analysis_output(buf,seq+j,quantized[j],n/2,1,0);
-
+ if(info->coupling_steps==0){
+ /* this assumes all or nothing coupling right now. it should pass
+ through any channels left uncoupled, but it doesn't do that now */
+ int k;
+ for(k=0;k<vi->channels;k++){
+ float *lpcm=pcm[k];
+ float *lsof=sofar[k];
+ float *lqua=quantized[k];
+ for(j=0;j<n/2;j++)
+ lqua[j]=lpcm[j]-lsof[j];
}
+ }else{
+ char buf[80];
+
+ _vp_quantize_couple(look->psy_look[blocktype],
+ info,
+ pcm,
+ sofar,
+ quantized,
+ nonzero,
+ i);
+
+ sprintf(buf,"quant%d",i);
+ for(j=0;j<vi->channels;j++)
+ _analysis_output(buf,seq+j,quantized[j],n/2,1,0);
+
}
/* steady as she goes */
@@ -752,24 +783,51 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
fprintf(stderr,"Bitrate: cav %d, cmin %ld, cmax %ld, float %.1f,"
" this %ld\n",
- (int)((double)b->bitrate_boundbitacc*vi->rate/b->bitrate_boundsampleacc),
+ (int)((double)b->bitrate_boundbitacc[0]*vi->rate/b->bitrate_boundsampleacc[0]),
minbits,maxbits,b->bitrate_floatinglimit,
oggpack_bytes(&vb->opb)*8);
- fprintf(stderr,"\thead:%d, boundtail:%ld(%ld), avtail:%ld(%ld)\n",
- b->bitrate_queue_head,b->bitrate_boundtail,b->bitrate_boundsampleacc,
- b->bitrate_avgtail,b->bitrate_avgsampleacc);
/* track bitrate*/
/* update boundary accumulators */
- while(b->bitrate_boundsampleacc>ci->bitrate_bound_queuetime*vi->rate){
- int samples=ci->blocksizes[0]>>1;
- if(b->bitrate_queue[b->bitrate_boundtail]&0x80000000UL)
- samples=ci->blocksizes[1]>>1;
- b->bitrate_boundsampleacc-=samples;
- b->bitrate_boundbitacc-=
- b->bitrate_queue[b->bitrate_boundtail]&0x7fffffffUL;
- b->bitrate_boundtail++;
- if(b->bitrate_boundtail>=b->bitrate_queue_size)b->bitrate_boundtail=0;
+ for(i=0;i<8;i++){
+ long desired=ci->bitrate_bound_queuetime*vi->rate;
+ switch(i){
+ case 0:
+ break;
+ case 1:
+ desired-=ci->blocksizes[0]/2;
+ break;
+ case 2:
+ desired-=ci->blocksizes[0]*2;
+ break;
+ case 3:
+ desired-=ci->blocksizes[0]*8;
+ break;
+ case 4:
+ desired-=ci->bitrate_bound_queuetime*vi->rate*(1./16.);
+ break;
+ case 5:
+ desired-=ci->bitrate_bound_queuetime*vi->rate*(1./8.);
+ break;
+ case 6:
+ desired-=ci->bitrate_bound_queuetime*vi->rate*(1./4.);
+ break;
+ case 7:
+ desired-=ci->bitrate_bound_queuetime*vi->rate*(1./2.);
+ break;
+ }
+
+ while(b->bitrate_boundsampleacc[i]>desired){
+ int samples=ci->blocksizes[0]>>1;
+ if(b->bitrate_queue[b->bitrate_boundtail[i]]&0x80000000UL)
+ samples=ci->blocksizes[1]>>1;
+ b->bitrate_boundsampleacc[i]-=samples;
+ b->bitrate_boundbitacc[i]-=
+ b->bitrate_queue[b->bitrate_boundtail[i]]&0x7fffffffUL;
+ b->bitrate_boundtail[i]++;
+ if(b->bitrate_boundtail[i]>=b->bitrate_queue_size)
+ b->bitrate_boundtail[i]=0;
+ }
}
/* update moving average accumulators */
@@ -778,51 +836,68 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
if(b->bitrate_queue[b->bitrate_avgtail]&0x80000000UL)
samples=ci->blocksizes[1]>>1;
b->bitrate_avgsampleacc-=samples;
- for(i=0;i<b->bitrate_eighths;i++)
+ for(i=0;i<b->bitrate_bins;i++)
b->bitrate_avgbitacc[i]-=
- b->bitrate_queue_eighths[b->bitrate_avgtail*b->bitrate_eighths+i];
+ b->bitrate_queue_bin[b->bitrate_avgtail*b->bitrate_bins+i];
b->bitrate_avgtail++;
if(b->bitrate_avgtail>=b->bitrate_queue_size)b->bitrate_avgtail=0;
}
/* update queue head */
- {
+ if(oggpack_bytes(&vb->opb)>2){
+
int bits=oggpack_bytes(&vb->opb)*8;
-
+
/* boundaries */
b->bitrate_queue[b->bitrate_queue_head]=bits;
if(vb->W)b->bitrate_queue[b->bitrate_queue_head]|=0x80000000UL;
- b->bitrate_boundbitacc+=bits;
- b->bitrate_boundsampleacc+=ci->blocksizes[vb->W]>>1;
-
- /* eighths */
- if(b->bitrate_eighths){
- for(i=0;i<b->bitrate_eighths;i++)
- b->bitrate_avgbitacc[i]+=
- b->bitrate_queue_eighths[b->bitrate_queue_head*b->bitrate_eighths+i];
- b->bitrate_avgsampleacc+=ci->blocksizes[vb->W]>>1;
+ for(i=0;i<8;i++){
+ b->bitrate_boundbitacc[i]+=bits;
+ b->bitrate_boundsampleacc[i]+=ci->blocksizes[vb->W]>>1;
}
- b->bitrate_queue_head++;
- if(b->bitrate_queue_head>=b->bitrate_queue_size)b->bitrate_queue_head=0;
+ /* bins */
+ if(b->bitrate_bins){
+ for(i=0;i<b->bitrate_bins;i++)
+ b->bitrate_avgbitacc[i]+=
+ b->bitrate_queue_bin[b->bitrate_queue_head*b->bitrate_bins+i];
+ b->bitrate_avgsampleacc+=ci->blocksizes[vb->W]>>1;
+ }
+
+ b->bitrate_queue_head++;
+ if(b->bitrate_queue_head>=b->bitrate_queue_size)b->bitrate_queue_head=0;
+ }
/* adjust the floater to offset bitrate above/below desired average */
- /* look for the eighth settings in recent history that bracket
+ /* look for the bin settings in recent history that bracket
the desired bitrate, and interpolate twixt them for the
flaoter setting we want */
- if(b->bitrate_eighths>0){
+ if(b->bitrate_bins>0 &&
+ (b->bitrate_avgsampleacc>ci->bitrate_avg_queuetime*vi->rate/8 ||
+ b->bitrate_avgsampleacc>8192)){
double upper=floater_interpolate(b,vi,ci->bitrate_queue_upperavg);
double lower=floater_interpolate(b,vi,ci->bitrate_queue_loweravg);
-
+ double new=ci->bitrate_floatinglimit_initial;
+ double slew;
+
fprintf(stderr,"\tupper:%g :: lower:%g\n",upper,lower);
- b->bitrate_floatinglimit=ci->bitrate_floatinglimit_initial;
- if(upper>0. && upper<b->bitrate_floatinglimit)
- b->bitrate_floatinglimit=upper;
- if(lower>b->bitrate_floatinglimit)
- b->bitrate_floatinglimit=lower;
- }
- }
+
+ if(upper>0. && upper<new)new=upper;
+ if(lower<ci->bitrate_floatinglimit_minimum)
+ lower=ci->bitrate_floatinglimit_minimum;
+ if(lower>new)new=lower;
+
+ slew=new-b->bitrate_floatinglimit;
+
+ if(slew<ci->bitrate_floatinglimit_downslew_max)
+ new=b->bitrate_floatinglimit+ci->bitrate_floatinglimit_downslew_max;
+ if(slew>ci->bitrate_floatinglimit_upslew_max)
+ new=b->bitrate_floatinglimit+ci->bitrate_floatinglimit_upslew_max;
+
+ b->bitrate_floatinglimit=new;
+ }
+ }
}
look->lastframe=vb->sequence;
diff --git a/lib/modes/mode_44c_A.h b/lib/modes/mode_44c_A.h
index 3e1444c1..5afdb1fb 100644
--- a/lib/modes/mode_44c_A.h
+++ b/lib/modes/mode_44c_A.h
@@ -11,7 +11,7 @@
********************************************************************
function: predefined encoding modes; 44kHz stereo ~64kbps true VBR
- last mod: $Id: mode_44c_A.h,v 1.4.2.4 2001/10/12 00:08:15 xiphmont Exp $
+ last mod: $Id: mode_44c_A.h,v 1.4.2.5 2001/10/16 20:10:21 xiphmont Exp $
********************************************************************/
@@ -52,20 +52,29 @@
#include "books/res_44c_A_128aux.vqh"
#include "books/res_44c_A_1024aux.vqh"
+#include "books/res_Ac_0.vqh"
#include "books/res_Ac_0a.vqh"
#include "books/res_Ac_1.vqh"
+#include "books/res_Ac_1a.vqh"
#include "books/res_Ac_2.vqh"
#include "books/res_Ac_2a.vqh"
+#include "books/res_Ac_2b.vqh"
#include "books/res_Ac_3.vqh"
+#include "books/res_Ac_3a.vqh"
+#include "books/res_Ac_3b.vqh"
#include "books/res_Ac_4.vqh"
+#include "books/res_Ac_4a.vqh"
#include "books/res_Ac_5.vqh"
#include "books/res_Ac_5a.vqh"
#include "books/res_Ac_6.vqh"
+#include "books/res_Ac_6a.vqh"
+#include "books/res_Ac_6b.vqh"
#include "books/res_Ac_7.vqh"
#include "books/res_Ac_7a.vqh"
-#include "books/res_Ac_7b.vqh"
#include "books/res_Ac_8.vqh"
#include "books/res_Ac_8a.vqh"
+#include "books/res_Ac_8b.vqh"
+#include "books/res_Ac_8c.vqh"
#include "books/res_Ac_9.vqh"
#include "books/res_Ac_9a.vqh"
#include "books/res_Ac_9b.vqh"
@@ -84,23 +93,37 @@ static vorbis_info_psy_global _psy_set_44c_AG={
};
static struct vp_couple_pass _psy_pass_44c_A0[]={
- {1.f,1.f,
- {{24, 0, 0, 0},
- {64, 0, 0, 0},
- {9999, 0, 0, 2.5f}}
+ {1.f,1.f,9e10,
+ {{ 24, 0, 0, 0},
+ { 64, 0, 0, 4.5},
+ {9999, 0, 0, 7.5}}
},
- {1.f,1.f,
+ {1.f,1.f,9e10,
+ {{ 64, 0, 0, 0},
+ {9999, 0, 0, 2.5}}
+ },
+ {1.f,1.f,9e10,
+ {{9999, 0, 0, 0}}
+ },
+ {.333333f,3.f,1.f,
{{9999, 0, 0, 0}}
},
};
static vp_couple_pass _psy_pass_44c_A[]={
- {1.f,1.f,
- {{288, 0, 0, 0},
- {512, 0, 0, 0},
- {9999, 0, 0, 2.5f}}
+ {1.f,1.f,9e10,
+ {{ 288, 0, 0, 0},
+ { 512, 0, 0, 4.5},
+ {9999, 0, 0, 7.5}}
+ },
+ {1.f,1.f,9e10,
+ {{ 512, 0, 0, 0},
+ {9999, 0, 0, 2.5}}
},
- {1.f,1.f,
+ {1.f,1.f,9e10,
+ {{9999, 0, 0, 0}}
+ },
+ {.333333f,3.f,1.f,
{{9999, 0, 0, 0}}
},
};
@@ -130,7 +153,7 @@ static vorbis_info_psy _psy_set_44c_A0={
2, 2, 15,
/*63 125 250 500 1k 2k 4k 8k 16k*/
- {-30,-30,-30,-30,-26,-22,-20,-14,-10,-2, -3, -3, 0, 0, 0, 1, 4},
+ {-30,-30,-30,-30,-26,-22,-20,-14,-10,-2, -1, -1, 2, 2, 2, 3, 6},
_psy_compand_44c_A,
95.f, /* even decade + 5 is important; saves an rint() later in a
@@ -155,7 +178,7 @@ static vorbis_info_psy _psy_set_44c_AT={
4,4,100,
/*63 125 250 500 1k 2k 4k 8k 16k*/
- {-30,-30,-30,-30,-26,-20,-20,-10, -6, -2, -5, -5, -2, 0, 0, 0, 3},
+ {-30,-30,-30,-30,-26,-20,-20,-10, -6, -2, -3, -3, 0, 2, 2, 2, 5},
_psy_compand_44c_A,
95.f, /* even decade + 5 is important; saves an rint() later in a
@@ -180,7 +203,7 @@ static vorbis_info_psy _psy_set_44c_A={
4,4,100,
/*63 125 250 500 1k 2k 4k 8k 16k*/
- {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -5, -5, -2, 0, 0, 0, 3},
+ {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, 0, 2, 2, 2, 5},
_psy_compand_44c_A,
95.f, /* even decade + 5 is important; saves an rint() later in a
@@ -247,37 +270,21 @@ static vorbis_info_floor1 _floor_set_44c_A={
static vorbis_info_residue0 _residue_set_44c_A0={
0,224, 16, 10,23,
- {64,4,40,
- 2,2,20,
- 18,22,22,7},
- {38, 25, 26,39,
- 27, 28, 29,40,
- 30,40, 31,32,41, 33,34,41, 35,36,37},
- {9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999},
- {.5f,
- 1.5f,1.5f,
- 2.5f,2.5f,2.5f,
- 4.5f,17.5f,84.5f},
+ { 65, 3, 82, 104, 17, 40, 49, 51, 55, 23},
+ {25,26, 27,28, 29,30,31, 32,33,34, 35,36, 37,38, 39,40,41, 42,43,40,41, 44,45,46,47,41, 48,49,50,47},
+ { 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999},
+ { 4.5, 22.5, 1.5, 1.5, 2.5, 2.5, 4.5, 22.5, 87.5},
{0},
- {99,8,99,3,8,99,99,99,99,99}};
+ { 3, 3, 8, 99, 8, 99, 99, 99, 99}};
static vorbis_info_residue0 _residue_set_44c_A={
0,1792, 32,10,24,
- {64,4,40,
- 2,2,20,
- 18,22,22,7},
- {38, 25, 26,39,
- 27, 28, 29,40,
- 30,40, 31,32,41, 33,34,41, 35,36,37},
- {9999,9999,9999,9999,9999,9999,
- 9999,9999,9999,9999},
- {.5f,
- 1.5f,1.5f,
- 2.5f,2.5f,2.5f,
- 4.5f,17.5f,84.5f},
+ { 65, 3, 82, 98, 17, 33, 49, 51, 55, 23},
+ {25,26, 27,28, 29,30,31, 32,33,34, 35,36, 37,38, 39,40,41, 42,43,40,41, 44,45,46,47,41, 48,49,50,47},
+ { 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999},
+ { 4.5, 22.5, 1.5, 1.5, 2.5, 2.5, 4.5, 22.5, 87.5},
{0},
- {99,32,99,18,32,99,99,99,99,99}};
+ { 18, 18, 32, 99, 32, 99, 99, 99, 99}};
static vorbis_info_mapping0 _mapping_set_44c_A0={
1, {0,0}, {0}, {0}, {0}, {0,0}, 1,{0},{1}};
@@ -292,7 +299,7 @@ codec_setup_info info_44c_A={
/* smallblock, largeblock */
{256, 2048},
/* modes,maps,times,floors,residues,books,psys */
- 2, 2, 1, 2, 2, 42, 3,
+ 2, 2, 1, 2, 2, 51, 3,
/* modes */
{&_mode_set_44c_A0,&_mode_set_44c_A},
/* maps */
@@ -335,26 +342,34 @@ codec_setup_info info_44c_A={
&_huff_book_res_44c_A_128aux,
&_huff_book_res_44c_A_1024aux,
-
- &_vq_book_res_Ac_1, /* 25 */
- &_vq_book_res_Ac_2,
- &_vq_book_res_Ac_3, /* 27 */
- &_vq_book_res_Ac_4,
- &_vq_book_res_Ac_5,
- &_vq_book_res_Ac_6, /* 30 */
- &_vq_book_res_Ac_7,
+
+ &_vq_book_res_Ac_0, /* 25 */
+ &_vq_book_res_Ac_0a,
+ &_vq_book_res_Ac_1, /* 27 */
+ &_vq_book_res_Ac_1a,
+ &_vq_book_res_Ac_2, /* 29 */
+ &_vq_book_res_Ac_2a,
+ &_vq_book_res_Ac_2b,
+ &_vq_book_res_Ac_3, /* 32 */
+ &_vq_book_res_Ac_3a,
+ &_vq_book_res_Ac_3b,
+ &_vq_book_res_Ac_4, /* 35 */
+ &_vq_book_res_Ac_4a,
+ &_vq_book_res_Ac_5, /* 37 */
+ &_vq_book_res_Ac_5a,
+ &_vq_book_res_Ac_6, /* 39 */
+ &_vq_book_res_Ac_6a,
+ &_vq_book_res_Ac_6b,
+ &_vq_book_res_Ac_7, /* 42 */
&_vq_book_res_Ac_7a,
- &_vq_book_res_Ac_8,
+ &_vq_book_res_Ac_8, /* 44 */
&_vq_book_res_Ac_8a,
- &_vq_book_res_Ac_9,
+ &_vq_book_res_Ac_8b,
+ &_vq_book_res_Ac_8c,
+ &_vq_book_res_Ac_9, /* 48 */
&_vq_book_res_Ac_9a,
&_vq_book_res_Ac_9b,
- &_vq_book_res_Ac_0a, /* 38 */
- &_vq_book_res_Ac_2a,
- &_vq_book_res_Ac_5a,
- &_vq_book_res_Ac_7b,
-
},
/* psy */
@@ -362,17 +377,18 @@ codec_setup_info info_44c_A={
&_psy_set_44c_AG,
/* progressive coding and bitrate controls */
- 4.0,
+ 4.0, 0., .1, -2.,
+
1.,4.,
- 0,0,
+ 110000,90000,0,0,
- 0,0,
+ 112000,140000,
- 0,0,
+ 120000,128000,
- {4,7},
- 2,
+ {4,5,6,7},
+ 4,
};
#endif
diff --git a/lib/modes/mode_44c_Z.h b/lib/modes/mode_44c_Z.h
index 75198add..ec07a9ce 100644
--- a/lib/modes/mode_44c_Z.h
+++ b/lib/modes/mode_44c_Z.h
@@ -11,7 +11,7 @@
********************************************************************
function: predefined encoding modes; 44kHz stereo ~64kbps true VBR
- last mod: $Id: mode_44c_Z.h,v 1.6.4.1 2001/10/09 04:34:55 xiphmont Exp $
+ last mod: $Id: mode_44c_Z.h,v 1.6.4.2 2001/10/16 20:10:21 xiphmont Exp $
********************************************************************/
@@ -91,12 +91,21 @@ static vp_couple_pass _psy_pass_44c_Z[]={
}
};
+
+static float _psy_compand_44c_AA[NOISE_COMPAND_LEVELS]={
+ 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, /* 7dB */
+ 8.f, 8.f, 7.f, 6.f, 5.f, 4.f, 4.f, 4.f, /* 15dB */
+ 4.f, 4.f, 5.f, 5.f, 5.f, 6.f, 6.f, 6.f, /* 23dB */
+ 7.f, 7.f, 7.f, 8.f, 8.f, 8.f, 9.f, 10.f, /* 31dB */
+ 11.f,12.f,13.f,14.f,15.f,16.f,17.f, 18.f, /* 39dB */
+};
+
static float _psy_compand_44c_Z[NOISE_COMPAND_LEVELS]={
0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, /* 7dB */
8.f, 9.f, 9.f,10.f,10.f,10.f,11.f, 11.f, /* 15dB */
- 12.f,12.f,11.f,11.f,10.f,10.f, 9.f, 9.f, /* 23dB */
- 8.f, 8.f, 8.f, 9.f, 9.f,10.f,11.f, 12.f, /* 31dB */
- 13.f,14.f,15.f,16.f,17.f,18.f,19.f, 20.f, /* 39dB */
+ 12.f,12.f,13.f,13.f,14.f,14.f,15.f, 15.f, /* 23dB */
+ 16.f,16.f,17.f,17.f,17.f,18.f,18.f, 19.f, /* 31dB */
+ 19.f,19.f,20.f,21.f,22.f,23.f,24.f, 25.f, /* 39dB */
};
static float _psy_compand_44c_Z0[NOISE_COMPAND_LEVELS]={
@@ -112,7 +121,7 @@ static vorbis_info_psy _psy_set_44c_Z0={
-100.,-110.,
/* tonemaskp */
- 3.f, -24.f,-10.f,
+ 3.f, -18.f,-10.f,
&_vp_tonemask_consbass_Z,
/* peakattp, curvelimitp */
1, 0, &_vp_peakatt_Z,
@@ -125,11 +134,10 @@ static vorbis_info_psy _psy_set_44c_Z0={
/*63 125 250 500 1k 2k 4k 8k 16k*/
{-26,-26,-26,-26,-26,-22,-20,-14, -10, -2, 2, 2, 2, 2, 3, 4, 10},
//{-20,-20,-20,-20,-20,-20,-20,-26, -22, -22,-20,-20,-22, -22, -22,-23,-20},
- _psy_compand_44c_Z,
+ _psy_compand_44c_Z0,
95.f, /* even decade + 5 is important; saves an rint() later in a
tight loop) */
- 1,
_psy_pass_44c_Z0
};
@@ -138,7 +146,7 @@ static vorbis_info_psy _psy_set_44c_ZT={
-100.f,-110.f,
/* tonemask */
- 3.f,-24.f,-10.f,
+ 3.f,-18.f,-10.f,
&_vp_tonemask_consbass_Z,
/* peakattp,curvelimitp */
1, 0, &_vp_peakatt_Z,
@@ -156,7 +164,7 @@ static vorbis_info_psy _psy_set_44c_ZT={
95.f, /* even decade + 5 is important; saves an rint() later in a
tight loop) */
- 1,_psy_pass_44c_Z
+ _psy_pass_44c_Z
};
static vorbis_info_psy _psy_set_44c_Z={
@@ -164,7 +172,7 @@ static vorbis_info_psy _psy_set_44c_Z={
-100.f, -110.f,
/* tonemask */
- 3.f,-24.f,-10.f,
+ 3.f,-18.f,-10.f,
&_vp_tonemask_Z,
/* peakattp, curvelimitp */
1, 0, &_vp_peakatt_Z,
@@ -182,7 +190,7 @@ static vorbis_info_psy _psy_set_44c_Z={
95.f, /* even decade + 5 is important; saves an rint() later in a
tight loop) */
- 1,_psy_pass_44c_Z
+ _psy_pass_44c_Z
};
static vorbis_info_time0 _time_set_44c_Z={0};
@@ -242,23 +250,21 @@ static vorbis_info_floor1 _floor_set_44c_Z={
static vorbis_info_residue0 _residue_set_44c_Z0={
0,144, 12, 10,23,
- {0,1,1,1,1,1,1,1,1,7},
- {25, 26, 27, 28, 29, 30, 31, 32, 33,34,35},
- {9999, 9999, 9999, 9999, 2,9999, 9999, 9999, 9999, 9999},
- {.5, 1.5, 2.5f, 7.5, 1.5f,1.5, 2.5, 7.5, 22.5f},
+ { 0, 1, 1, 1, 4, 4, 1, 1, 1, 11},
+ { 25, 26, 27, 28, 29, 30, 31, 32, 33,34,35},
+ {9999, 9999, 9999, 9999, 2, 9999, 9999, 9999, 9999, 9999},
+ { .5, 1.5, 2.5f, 7.5, 1.5f, 1.5, 2.5, 7.5, 22.5},
{0},
- {99, 4, 4, 4, 99,99, 99, 99, 99},
- {3}};
+ { 99, 4, 4, 4, 99, 99, 99, 99, 99}};
static vorbis_info_residue0 _residue_set_44c_Z={
0,1408, 32, 10,24,
- {0,1,1,1,1,1,1,1,1,7},
+ {0,1,1,1,4,4,1,1,1,11},
{25, 26, 27, 28, 29, 30, 31, 32, 33,34,35},
{9999, 9999, 9999, 9999, 3,9999, 9999, 9999, 9999, 9999},
{.5, 1.5, 2.5f, 7.5, 1.5f,1.5, 2.5, 7.5, 22.5f},
{0},
- {99, 18, 18, 18, 99,99, 99, 99, 99},
- {3}};
+ {99, 18, 18, 18, 99,99, 99, 99, 99}};
static vorbis_info_mapping0 _mapping_set_44c_Z0={
1, {0,0}, {0}, {0}, {0}, {0,0}, 1,{0},{1}};
@@ -332,7 +338,22 @@ codec_setup_info info_44c_Z={
},
/* psy */
{&_psy_set_44c_Z0,&_psy_set_44c_ZT,&_psy_set_44c_Z},
- &_psy_set_44c_ZG
+ &_psy_set_44c_ZG,
+
+ /* progressive coding and bitrate controls */
+ 5.0,
+ 2.,8.,
+
+ 0,0,
+
+ 56000,64000,
+
+ 60000,62000,
+
+ {5,7},
+ 1,
+
};
#endif
+
diff --git a/lib/modes/modes.h b/lib/modes/modes.h
new file mode 100644
index 00000000..3cb5622f
--- /dev/null
+++ b/lib/modes/modes.h
@@ -0,0 +1,40 @@
+/********************************************************************
+ * *
+ * 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 XIPHOPHORUS Company http://www.xiph.org/ *
+
+ ********************************************************************
+
+ function: predefined encoding modes
+ last mod: $Id: modes.h,v 1.14.2.1 2001/10/16 20:10:21 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_MODES_H_
+#define _V_MODES_H_
+
+#include "masking.h"
+/* stereo (coupled) */
+#include "modes/mode_44c_Z.h"
+//#include "modes/mode_44c_Y.h"
+//#include "modes/mode_44c_X.h"
+#include "modes/mode_44c_A.h"
+//#include "modes/mode_44c_B.h"
+//#include "modes/mode_44c_C.h"
+//#include "modes/mode_44c_D.h"
+//#include "modes/mode_44c_E.h"
+
+/* mono/dual/multi */
+//#include "modes/mode_44_Z.h"
+//#include "modes/mode_44_Y.h"
+//#include "modes/mode_44_X.h"
+//#include "modes/mode_44_A.h"
+//#include "modes/mode_44_B.h"
+//#include "modes/mode_44_C.h"
+
+#endif
diff --git a/lib/psy.c b/lib/psy.c
index 36ca9f33..ee64fd9b 100644
--- a/lib/psy.c
+++ b/lib/psy.c
@@ -11,7 +11,7 @@
********************************************************************
function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.56.2.1 2001/10/11 15:41:44 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.56.2.2 2001/10/16 20:10:11 xiphmont Exp $
********************************************************************/
@@ -904,17 +904,22 @@ static void couple_lossless(float A, float B,
float granule,float igranule,
float *mag, float *ang){
- A=rint(A*igranule)*granule;
- B=rint(B*igranule)*granule;
-
if(fabs(A)>fabs(B)){
+ A=rint(A*igranule)*granule; /* must be done *after* the comparison */
+ B=rint(B*igranule)*granule;
+
*mag=A; *ang=(A>0.f?A-B:B-A);
}else{
+ A=rint(A*igranule)*granule;
+ B=rint(B*igranule)*granule;
+
*mag=B; *ang=(B>0.f?A-B:B-A);
}
- if(*ang>fabs(*mag)*1.9999f)*ang=-fabs(*mag)*2.f;
-
+ if(*ang>fabs(*mag)*1.9999f){
+ *ang= -fabs(*mag)*2.f;
+ *mag= -*mag;
+ }
}
static void couple_8phase(float A, float B, float fA, float fB,
@@ -1086,6 +1091,7 @@ void _vp_quantize_couple(vorbis_look_psy *p,
for(i=0;i<vi->coupling_steps;i++){
float granulem=info->couple_pass[passno].granulem;
float igranulem=info->couple_pass[passno].igranulem;
+ float rqlimit=info->couple_pass[passno].requant_limit;
/* make sure coupling a zero and a nonzero channel results in two
nonzero channels. */
@@ -1129,9 +1135,23 @@ void _vp_quantize_couple(vorbis_look_psy *p,
}
}
}
-
- qM[j]=mag-sofarM[j];
- qA[j]=ang-sofarA[j];
+
+ /* executive decision time: when requantizing and recoupling
+ residue in order to progressively encode at finer
+ resolution, an out of phase component that originally
+ quntized to 2*mag can flip flop magnitude/angle if it
+ requantizes to not-quite out of phase. If that happens,
+ we opt not to fill in additional resolution (in order to
+ simplify the iterative codebook design and
+ efficiency). */
+
+ if(ang<-rqlimit || ang>rqlimit){
+ qM[j]=0.f;
+ qA[j]=0.f;
+ }else{
+ qM[j]=mag-sofarM[j];
+ qA[j]=ang-sofarA[j];
+ }
}
}
}
diff --git a/lib/psy.h b/lib/psy.h
index 2b5726c6..c439ca88 100644
--- a/lib/psy.h
+++ b/lib/psy.h
@@ -11,7 +11,7 @@
********************************************************************
function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.24.2.1 2001/10/09 04:34:45 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.24.2.2 2001/10/16 20:10:11 xiphmont Exp $
********************************************************************/
@@ -48,6 +48,7 @@ typedef struct vp_couple{
typedef struct vp_couple_pass{
float granulem;
float igranulem;
+ float requant_limit;
vp_couple couple_pass[8];
} vp_couple_pass;
diff --git a/lib/res0.c b/lib/res0.c
index 0c517bb4..ab6724ca 100644
--- a/lib/res0.c
+++ b/lib/res0.c
@@ -11,7 +11,7 @@
********************************************************************
function: residue backend 0, 1 and 2 implementation
- last mod: $Id: res0.c,v 1.37.2.3 2001/10/12 00:08:06 xiphmont Exp $
+ last mod: $Id: res0.c,v 1.37.2.4 2001/10/16 20:10:11 xiphmont Exp $
********************************************************************/
@@ -49,7 +49,7 @@ typedef struct {
long phrasebits;
long frames;
- int qoffsets[8];
+ int qoffsets[BITTRACK_DIVISOR];
} vorbis_look_residue0;
@@ -243,8 +243,8 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
int n=info->end-info->begin,i;
int partvals=n/samples_per_partition;
- for(i=0;i<8;i++)
- look->qoffsets[i]=partvals*(i+1)/8;
+ for(i=0;i<BITTRACK_DIVISOR;i++)
+ look->qoffsets[i]=partvals*(i+1)/BITTRACK_DIVISOR;
}
return(look);
@@ -545,9 +545,9 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl,
partition channel words... */
for(s=(pass==0?0:ci->passlimit[pass-1]);s<ci->passlimit[pass];s++){
- int eighth=0;
+ int bin=0;
ogg_uint32_t *qptr=NULL;
- if(stats)qptr=stats+s*8;
+ if(stats)qptr=stats+s*BITTRACK_DIVISOR;
for(i=0;i<partvals;){
@@ -602,8 +602,8 @@ static int _01forward(vorbis_block *vb,vorbis_look_residue *vl,
}
}
- if(qptr)while(i>=look->qoffsets[eighth])
- qptr[eighth++]=oggpack_bits(&vb->opb);
+ if(qptr)while(i>=look->qoffsets[bin])
+ qptr[bin++]=oggpack_bits(&vb->opb);
@@ -824,9 +824,13 @@ int res2_forward(vorbis_block *vb,vorbis_look_residue *vl,
float *pcm=in[i];
float *sofar=out[i];
for(j=0,k=i;j<n;j++,k+=ch)
+#ifdef TRAIN_RES
+ sofar[j]+=pcm[j]; /* when training, our previous stage books
+ might be dummies */
+#else
sofar[j]+=pcm[j]-work[k];
+#endif
}
-
return(ret);
}else
return(0);
diff --git a/lib/sharedbook.c b/lib/sharedbook.c
new file mode 100644
index 00000000..7ef2be95
--- /dev/null
+++ b/lib/sharedbook.c
@@ -0,0 +1,676 @@
+/********************************************************************
+ * *
+ * 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 XIPHOPHORUS Company http://www.xiph.org/ *
+
+ ********************************************************************
+
+ function: basic shared codebook operations
+ last mod: $Id: sharedbook.c,v 1.18.2.1 2001/10/16 20:10:11 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ogg/ogg.h>
+#include "os.h"
+#include "vorbis/codec.h"
+#include "codebook.h"
+#include "scales.h"
+
+/**** pack/unpack helpers ******************************************/
+int _ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
+}
+
+/* 32 bit float (not IEEE; nonnormalized mantissa +
+ biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
+ Why not IEEE? It's just not that important here. */
+
+#define VQ_FEXP 10
+#define VQ_FMAN 21
+#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */
+
+/* doesn't currently guard under/overflow */
+long _float32_pack(float val){
+ int sign=0;
+ long exp;
+ long mant;
+ if(val<0){
+ sign=0x80000000;
+ val= -val;
+ }
+ exp= floor(log(val)/log(2));
+ mant=rint(ldexp(val,(VQ_FMAN-1)-exp));
+ exp=(exp+VQ_FEXP_BIAS)<<VQ_FMAN;
+
+ return(sign|exp|mant);
+}
+
+float _float32_unpack(long val){
+ double mant=val&0x1fffff;
+ int sign=val&0x80000000;
+ long exp =(val&0x7fe00000L)>>VQ_FMAN;
+ if(sign)mant= -mant;
+ return(ldexp(mant,exp-(VQ_FMAN-1)-VQ_FEXP_BIAS));
+}
+
+/* given a list of word lengths, generate a list of codewords. Works
+ for length ordered or unordered, always assigns the lowest valued
+ codewords first. Extended to handle unused entries (length 0) */
+long *_make_words(long *l,long n){
+ long i,j;
+ long marker[33];
+ long *r=_ogg_malloc(n*sizeof(*r));
+ memset(marker,0,sizeof(marker));
+
+ for(i=0;i<n;i++){
+ long length=l[i];
+ if(length>0){
+ long entry=marker[length];
+
+ /* when we claim a node for an entry, we also claim the nodes
+ below it (pruning off the imagined tree that may have dangled
+ from it) as well as blocking the use of any nodes directly
+ above for leaves */
+
+ /* update ourself */
+ if(length<32 && (entry>>length)){
+ /* error condition; the lengths must specify an overpopulated tree */
+ _ogg_free(r);
+ return(NULL);
+ }
+ r[i]=entry;
+
+ /* Look to see if the next shorter marker points to the node
+ above. if so, update it and repeat. */
+ {
+ for(j=length;j>0;j--){
+
+ if(marker[j]&1){
+ /* have to jump branches */
+ if(j==1)
+ marker[1]++;
+ else
+ marker[j]=marker[j-1]<<1;
+ break; /* invariant says next upper marker would already
+ have been moved if it was on the same path */
+ }
+ marker[j]++;
+ }
+ }
+
+ /* prune the tree; the implicit invariant says all the longer
+ markers were dangling from our just-taken node. Dangle them
+ from our *new* node. */
+ for(j=length+1;j<33;j++)
+ if((marker[j]>>1) == entry){
+ entry=marker[j];
+ marker[j]=marker[j-1]<<1;
+ }else
+ break;
+ }
+ }
+
+ /* bitreverse the words because our bitwise packer/unpacker is LSb
+ endian */
+ for(i=0;i<n;i++){
+ long temp=0;
+ for(j=0;j<l[i];j++){
+ temp<<=1;
+ temp|=(r[i]>>j)&1;
+ }
+ r[i]=temp;
+ }
+
+ return(r);
+}
+
+/* build the decode helper tree from the codewords */
+decode_aux *_make_decode_tree(codebook *c){
+ const static_codebook *s=c->c;
+ long top=0,i,j,n;
+ decode_aux *t=_ogg_malloc(sizeof(*t));
+ long *ptr0=t->ptr0=_ogg_calloc(c->entries*2,sizeof(*ptr0));
+ long *ptr1=t->ptr1=_ogg_calloc(c->entries*2,sizeof(*ptr1));
+ long *codelist=_make_words(s->lengthlist,s->entries);
+
+ if(codelist==NULL)return(NULL);
+ t->aux=c->entries*2;
+
+ for(i=0;i<c->entries;i++){
+ if(s->lengthlist[i]>0){
+ long ptr=0;
+ for(j=0;j<s->lengthlist[i]-1;j++){
+ int bit=(codelist[i]>>j)&1;
+ if(!bit){
+ if(!ptr0[ptr])
+ ptr0[ptr]= ++top;
+ ptr=ptr0[ptr];
+ }else{
+ if(!ptr1[ptr])
+ ptr1[ptr]= ++top;
+ ptr=ptr1[ptr];
+ }
+ }
+ if(!((codelist[i]>>j)&1))
+ ptr0[ptr]=-i;
+ else
+ ptr1[ptr]=-i;
+ }
+ }
+ _ogg_free(codelist);
+
+ t->tabn = _ilog(c->entries)-4; /* this is magic */
+ if(t->tabn<5)t->tabn=5;
+ n = 1<<t->tabn;
+ t->tab = _ogg_malloc(n*sizeof(*t->tab));
+ t->tabl = _ogg_malloc(n*sizeof(*t->tabl));
+ for (i = 0; i < n; i++) {
+ long p = 0;
+ for (j = 0; j < t->tabn && (p > 0 || j == 0); j++) {
+ if (i & (1 << j))
+ p = ptr1[p];
+ else
+ p = ptr0[p];
+ }
+ /* now j == length, and p == -code */
+ t->tab[i] = p;
+ t->tabl[i] = j;
+ }
+
+ return(t);
+}
+
+/* there might be a straightforward one-line way to do the below
+ that's portable and totally safe against roundoff, but I haven't
+ thought of it. Therefore, we opt on the side of caution */
+long _book_maptype1_quantvals(const static_codebook *b){
+ long vals=floor(pow(b->entries,1.f/b->dim));
+
+ /* the above *should* be reliable, but we'll not assume that FP is
+ ever reliable when bitstream sync is at stake; verify via integer
+ means that vals really is the greatest value of dim for which
+ vals^b->bim <= b->entries */
+ /* treat the above as an initial guess */
+ while(1){
+ long acc=1;
+ long acc1=1;
+ int i;
+ for(i=0;i<b->dim;i++){
+ acc*=vals;
+ acc1*=vals+1;
+ }
+ if(acc<=b->entries && acc1>b->entries){
+ return(vals);
+ }else{
+ if(acc>b->entries){
+ vals--;
+ }else{
+ vals++;
+ }
+ }
+ }
+}
+
+/* unpack the quantized list of values for encode/decode ***********/
+/* we need to deal with two map types: in map type 1, the values are
+ generated algorithmically (each column of the vector counts through
+ the values in the quant vector). in map type 2, all the values came
+ in in an explicit list. Both value lists must be unpacked */
+float *_book_unquantize(const static_codebook *b){
+ long j,k;
+ if(b->maptype==1 || b->maptype==2){
+ int quantvals;
+ float mindel=_float32_unpack(b->q_min);
+ float delta=_float32_unpack(b->q_delta);
+ float *r=_ogg_calloc(b->entries*b->dim,sizeof(*r));
+
+ /* maptype 1 and 2 both use a quantized value vector, but
+ different sizes */
+ switch(b->maptype){
+ case 1:
+ /* most of the time, entries%dimensions == 0, but we need to be
+ well defined. We define that the possible vales at each
+ scalar is values == entries/dim. If entries%dim != 0, we'll
+ have 'too few' values (values*dim<entries), which means that
+ we'll have 'left over' entries; left over entries use zeroed
+ values (and are wasted). So don't generate codebooks like
+ that */
+ quantvals=_book_maptype1_quantvals(b);
+ for(j=0;j<b->entries;j++){
+ float last=0.f;
+ int indexdiv=1;
+ for(k=0;k<b->dim;k++){
+ int index= (j/indexdiv)%quantvals;
+ float val=b->quantlist[index];
+ val=fabs(val)*delta+mindel+last;
+ if(b->q_sequencep)last=val;
+ r[j*b->dim+k]=val;
+ indexdiv*=quantvals;
+ }
+ }
+ break;
+ case 2:
+ for(j=0;j<b->entries;j++){
+ float last=0.f;
+ for(k=0;k<b->dim;k++){
+ float val=b->quantlist[j*b->dim+k];
+ val=fabs(val)*delta+mindel+last;
+ if(b->q_sequencep)last=val;
+ r[j*b->dim+k]=val;
+ }
+ }
+ break;
+ }
+
+ return(r);
+ }
+ return(NULL);
+}
+
+void vorbis_staticbook_clear(static_codebook *b){
+ if(b->allocedp){
+ if(b->quantlist)_ogg_free(b->quantlist);
+ if(b->lengthlist)_ogg_free(b->lengthlist);
+ if(b->nearest_tree){
+ _ogg_free(b->nearest_tree->ptr0);
+ _ogg_free(b->nearest_tree->ptr1);
+ _ogg_free(b->nearest_tree->p);
+ _ogg_free(b->nearest_tree->q);
+ memset(b->nearest_tree,0,sizeof(*b->nearest_tree));
+ _ogg_free(b->nearest_tree);
+ }
+ if(b->thresh_tree){
+ _ogg_free(b->thresh_tree->quantthresh);
+ _ogg_free(b->thresh_tree->quantmap);
+ memset(b->thresh_tree,0,sizeof(*b->thresh_tree));
+ _ogg_free(b->thresh_tree);
+ }
+
+ memset(b,0,sizeof(*b));
+ }
+}
+
+void vorbis_staticbook_destroy(static_codebook *b){
+ if(b->allocedp){
+ vorbis_staticbook_clear(b);
+ _ogg_free(b);
+ }
+}
+
+void vorbis_book_clear(codebook *b){
+ /* static book is not cleared; we're likely called on the lookup and
+ the static codebook belongs to the info struct */
+ if(b->decode_tree){
+ _ogg_free(b->decode_tree->tab);
+ _ogg_free(b->decode_tree->tabl);
+
+ _ogg_free(b->decode_tree->ptr0);
+ _ogg_free(b->decode_tree->ptr1);
+ memset(b->decode_tree,0,sizeof(*b->decode_tree));
+ _ogg_free(b->decode_tree);
+ }
+ if(b->valuelist)_ogg_free(b->valuelist);
+ if(b->codelist)_ogg_free(b->codelist);
+ memset(b,0,sizeof(*b));
+}
+
+int vorbis_book_init_encode(codebook *c,const static_codebook *s){
+ long j,k;
+ memset(c,0,sizeof(*c));
+ c->c=s;
+ c->entries=s->entries;
+ c->dim=s->dim;
+ c->codelist=_make_words(s->lengthlist,s->entries);
+ c->valuelist=_book_unquantize(s);
+
+ /* set the 'zero entry' */
+ c->zeroentry=-1;
+ if(c->valuelist){
+ for(j=0;j<s->entries;j++){
+ int flag=1;
+ for(k=0;k<s->dim;k++){
+ if(fabs(c->valuelist[j*s->dim+k])>1e-12f){
+ flag=0;
+ break;
+ }
+ }
+ if(flag)
+ c->zeroentry=j;
+ }
+ }
+
+ return(0);
+}
+
+int vorbis_book_init_decode(codebook *c,const static_codebook *s){
+ memset(c,0,sizeof(*c));
+ c->c=s;
+ c->entries=s->entries;
+ c->dim=s->dim;
+ c->valuelist=_book_unquantize(s);
+ c->decode_tree=_make_decode_tree(c);
+ if(c->decode_tree==NULL)goto err_out;
+ return(0);
+ err_out:
+ vorbis_book_clear(c);
+ return(-1);
+}
+
+static float _dist(int el,float *ref, float *b,int step){
+ int i;
+ float acc=0.f;
+ for(i=0;i<el;i++){
+ float val=(ref[i]-b[i*step]);
+ acc+=val*val;
+ }
+ return(acc);
+}
+
+int _best(codebook *book, float *a, int step){
+ encode_aux_nearestmatch *nt=book->c->nearest_tree;
+ encode_aux_threshmatch *tt=book->c->thresh_tree;
+ encode_aux_pigeonhole *pt=book->c->pigeon_tree;
+ int dim=book->dim;
+ int ptr=0,k,o;
+ /*int savebest=-1;
+ float saverr;*/
+
+ /* do we have a threshhold encode hint? */
+ if(tt){
+ int index=0;
+ /* find the quant val of each scalar */
+ for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
+ int i;
+ /* linear search the quant list for now; it's small and although
+ with > ~8 entries, it would be faster to bisect, this would be
+ a misplaced optimization for now */
+ for(i=0;i<tt->threshvals-1;i++)
+ if(a[o]<tt->quantthresh[i])break;
+
+ index=(index*tt->quantvals)+tt->quantmap[i];
+ }
+ /* regular lattices are easy :-) */
+ if(book->c->lengthlist[index]>0) /* is this unused? If so, we'll
+ use a decision tree after all
+ and fall through*/
+ return(index);
+ }
+
+ /* do we have a pigeonhole encode hint? */
+ if(pt){
+ const static_codebook *c=book->c;
+ int i,besti=-1;
+ float best;
+ int entry=0;
+
+ /* dealing with sequentialness is a pain in the ass */
+ if(c->q_sequencep){
+ int pv;
+ long mul=1;
+ float qlast=0;
+ for(k=0,o=0;k<dim;k++,o+=step){
+ pv=(int)((a[o]-qlast-pt->min)/pt->del);
+ if(pv<0 || pv>=pt->mapentries)break;
+ entry+=pt->pigeonmap[pv]*mul;
+ mul*=pt->quantvals;
+ qlast+=pv*pt->del+pt->min;
+ }
+ }else{
+ for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
+ int pv=(int)((a[o]-pt->min)/pt->del);
+ if(pv<0 || pv>=pt->mapentries)break;
+ entry=entry*pt->quantvals+pt->pigeonmap[pv];
+ }
+ }
+
+ /* must be within the pigeonholable range; if we quant outside (or
+ in an entry that we define no list for), brute force it */
+ if(k==dim && pt->fitlength[entry]){
+ /* search the abbreviated list */
+ long *list=pt->fitlist+pt->fitmap[entry];
+ for(i=0;i<pt->fitlength[entry];i++){
+ float this=_dist(dim,book->valuelist+list[i]*dim,a,step);
+ if(besti==-1 || this<best){
+ best=this;
+ besti=list[i];
+ }
+ }
+
+ return(besti);
+ }
+ }
+
+ if(nt){
+ /* optimized using the decision tree */
+ while(1){
+ float c=0.f;
+ float *p=book->valuelist+nt->p[ptr];
+ float *q=book->valuelist+nt->q[ptr];
+
+ for(k=0,o=0;k<dim;k++,o+=step)
+ c+=(p[k]-q[k])*(a[o]-(p[k]+q[k])*.5);
+
+ if(c>0.f) /* in A */
+ ptr= -nt->ptr0[ptr];
+ else /* in B */
+ ptr= -nt->ptr1[ptr];
+ if(ptr<=0)break;
+ }
+ return(-ptr);
+ }
+
+ /* brute force it! */
+ {
+ const static_codebook *c=book->c;
+ int i,besti=-1;
+ float best;
+ float *e=book->valuelist;
+ for(i=0;i<book->entries;i++){
+ if(c->lengthlist[i]>0){
+ float this=_dist(dim,e,a,step);
+ if(besti==-1 || this<best){
+ best=this;
+ besti=i;
+ }
+ }
+ e+=dim;
+ }
+
+ /*if(savebest!=-1 && savebest!=besti){
+ fprintf(stderr,"brute force/pigeonhole disagreement:\n"
+ "original:");
+ for(i=0;i<dim*step;i+=step)fprintf(stderr,"%g,",a[i]);
+ fprintf(stderr,"\n"
+ "pigeonhole (entry %d, err %g):",savebest,saverr);
+ for(i=0;i<dim;i++)fprintf(stderr,"%g,",
+ (book->valuelist+savebest*dim)[i]);
+ fprintf(stderr,"\n"
+ "bruteforce (entry %d, err %g):",besti,best);
+ for(i=0;i<dim;i++)fprintf(stderr,"%g,",
+ (book->valuelist+besti*dim)[i]);
+ fprintf(stderr,"\n");
+ }*/
+ return(besti);
+ }
+}
+
+/* returns the entry number and *modifies a* to the remainder value ********/
+int vorbis_book_besterror(codebook *book,float *a,int step,int addmul){
+ int dim=book->dim,i,o;
+ int best=_best(book,a,step);
+ switch(addmul){
+ case 0:
+ for(i=0,o=0;i<dim;i++,o+=step)
+ a[o]-=(book->valuelist+best*dim)[i];
+ break;
+ case 1:
+ for(i=0,o=0;i<dim;i++,o+=step){
+ float val=(book->valuelist+best*dim)[i];
+ if(val==0){
+ a[o]=0;
+ }else{
+ a[o]/=val;
+ }
+ }
+ break;
+ }
+ return(best);
+}
+
+long vorbis_book_codeword(codebook *book,int entry){
+ return book->codelist[entry];
+}
+
+long vorbis_book_codelen(codebook *book,int entry){
+ return book->c->lengthlist[entry];
+}
+
+#ifdef _V_SELFTEST
+
+/* Unit tests of the dequantizer; this stuff will be OK
+ cross-platform, I simply want to be sure that special mapping cases
+ actually work properly; a bug could go unnoticed for a while */
+
+#include <stdio.h>
+
+/* cases:
+
+ no mapping
+ full, explicit mapping
+ algorithmic mapping
+
+ nonsequential
+ sequential
+*/
+
+static long full_quantlist1[]={0,1,2,3, 4,5,6,7, 8,3,6,1};
+static long partial_quantlist1[]={0,7,2};
+
+/* no mapping */
+static_codebook test1={
+ 4,16,
+ NULL,
+ 0,
+ 0,0,0,0,
+ NULL,
+ NULL,NULL
+};
+static float *test1_result=NULL;
+
+/* linear, full mapping, nonsequential */
+static_codebook test2={
+ 4,3,
+ NULL,
+ 2,
+ -533200896,1611661312,4,0,
+ full_quantlist1,
+ NULL,NULL
+};
+static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2};
+
+/* linear, full mapping, sequential */
+static_codebook test3={
+ 4,3,
+ NULL,
+ 2,
+ -533200896,1611661312,4,1,
+ full_quantlist1,
+ NULL,NULL
+};
+static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6};
+
+/* linear, algorithmic mapping, nonsequential */
+static_codebook test4={
+ 3,27,
+ NULL,
+ 1,
+ -533200896,1611661312,4,0,
+ partial_quantlist1,
+ NULL,NULL
+};
+static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3,
+ -3, 4,-3, 4, 4,-3, -1, 4,-3,
+ -3,-1,-3, 4,-1,-3, -1,-1,-3,
+ -3,-3, 4, 4,-3, 4, -1,-3, 4,
+ -3, 4, 4, 4, 4, 4, -1, 4, 4,
+ -3,-1, 4, 4,-1, 4, -1,-1, 4,
+ -3,-3,-1, 4,-3,-1, -1,-3,-1,
+ -3, 4,-1, 4, 4,-1, -1, 4,-1,
+ -3,-1,-1, 4,-1,-1, -1,-1,-1};
+
+/* linear, algorithmic mapping, sequential */
+static_codebook test5={
+ 3,27,
+ NULL,
+ 1,
+ -533200896,1611661312,4,1,
+ partial_quantlist1,
+ NULL,NULL
+};
+static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
+ -3, 1,-2, 4, 8, 5, -1, 3, 0,
+ -3,-4,-7, 4, 3, 0, -1,-2,-5,
+ -3,-6,-2, 4, 1, 5, -1,-4, 0,
+ -3, 1, 5, 4, 8,12, -1, 3, 7,
+ -3,-4, 0, 4, 3, 7, -1,-2, 2,
+ -3,-6,-7, 4, 1, 0, -1,-4,-5,
+ -3, 1, 0, 4, 8, 7, -1, 3, 2,
+ -3,-4,-5, 4, 3, 2, -1,-2,-3};
+
+void run_test(static_codebook *b,float *comp){
+ float *out=_book_unquantize(b);
+ int i;
+
+ if(comp){
+ if(!out){
+ fprintf(stderr,"_book_unquantize incorrectly returned NULL\n");
+ exit(1);
+ }
+
+ for(i=0;i<b->entries*b->dim;i++)
+ if(fabs(out[i]-comp[i])>.0001){
+ fprintf(stderr,"disagreement in unquantized and reference data:\n"
+ "position %d, %g != %g\n",i,out[i],comp[i]);
+ exit(1);
+ }
+
+ }else{
+ if(out){
+ fprintf(stderr,"_book_unquantize returned a value array: \n"
+ " correct result should have been NULL\n");
+ exit(1);
+ }
+ }
+}
+
+int main(){
+ /* run the nine dequant tests, and compare to the hand-rolled results */
+ fprintf(stderr,"Dequant test 1... ");
+ run_test(&test1,test1_result);
+ fprintf(stderr,"OK\nDequant test 2... ");
+ run_test(&test2,test2_result);
+ fprintf(stderr,"OK\nDequant test 3... ");
+ run_test(&test3,test3_result);
+ fprintf(stderr,"OK\nDequant test 4... ");
+ run_test(&test4,test4_result);
+ fprintf(stderr,"OK\nDequant test 5... ");
+ run_test(&test5,test5_result);
+ fprintf(stderr,"OK\n\n");
+
+ return(0);
+}
+
+#endif