--- a/misc/libtremor/tremor/codebook.h Thu Sep 20 23:04:10 2012 +0200
+++ b/misc/libtremor/tremor/codebook.h Fri Sep 21 00:50:04 2012 +0200
@@ -20,70 +20,33 @@
#include "ogg.h"
-/* This structure encapsulates huffman and VQ style encoding books; it
- doesn't do anything specific to either.
-
- valuelist/quantlist are nonNULL (and q_* significant) only if
- there's entry->value mapping to be done.
-
- If encode-side mapping must be done (and thus the entry needs to be
- hunted), the auxiliary encode pointer will point to a decision
- tree. This is true of both VQ and huffman, but is mostly useful
- with VQ.
-
-*/
-
-typedef struct static_codebook{
- long dim; /* codebook dimensions (elements per vector) */
- long entries; /* codebook entries */
- long *lengthlist; /* codeword lengths in bits */
-
- /* mapping ***************************************************************/
- int maptype; /* 0=none
- 1=implicitly populated values from map column
- 2=listed arbitrary values */
+typedef struct codebook{
+ long dim; /* codebook dimensions (elements per vector) */
+ long entries; /* codebook entries */
+ long used_entries; /* populated codebook entries */
- /* The below does a linear, single monotonic sequence mapping. */
- long q_min; /* packed 32 bit float; quant value 0 maps to minval */
- long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
- int q_quant; /* bits: 0 < quant <= 16 */
- int q_sequencep; /* bitflag */
-
- long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
- map == 2: list of dim*entries quantized entry vals
- */
-} static_codebook;
+ int dec_maxlength;
+ void *dec_table;
+ int dec_nodeb;
+ int dec_leafw;
+ int dec_type; /* 0 = entry number
+ 1 = packed vector of values
+ 2 = packed vector of column offsets, maptype 1
+ 3 = scalar offset into value array, maptype 2 */
-typedef struct codebook{
- long dim; /* codebook dimensions (elements per vector) */
- long entries; /* codebook entries */
- long used_entries; /* populated codebook entries */
-
- /* the below are ordered by bitreversed codeword and only used
- entries are populated */
- int binarypoint;
- ogg_int32_t *valuelist; /* list of dim*entries actual entry values */
- ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
-
- int *dec_index;
- char *dec_codelengths;
- ogg_uint32_t *dec_firsttable;
- int dec_firsttablen;
- int dec_maxlength;
-
- long q_min; /* packed 32 bit float; quant value 0 maps to minval */
- long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
+ ogg_int32_t q_min;
+ int q_minp;
+ ogg_int32_t q_del;
+ int q_delp;
+ int q_seq;
+ int q_bits;
+ int q_pack;
+ void *q_val;
} codebook;
-extern void vorbis_staticbook_clear(static_codebook *b);
-extern void vorbis_staticbook_destroy(static_codebook *b);
-extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
-
extern void vorbis_book_clear(codebook *b);
-extern long _book_maptype1_quantvals(const static_codebook *b);
-
-extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
+extern int vorbis_book_unpack(oggpack_buffer *b,codebook *c);
extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,