1 /********************************************************************
3 * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
6 * PLEASE READ THESE TERMS DISTRIBUTING. *
8 * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 *
9 * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company *
10 * http://www.xiph.org/ *
12 ********************************************************************/
32 double (*metric_func) (struct vqgen *v,double *a,double *b);
35 typedef struct vqbook{
36 long dim; /* codebook dimensions (elements per vector) */
37 long entries; /* codebook entries */
39 long min; /* packed 24 bit float; quant value 0 maps to minval */
40 long delta; /* packed 24 bit float; val 1 - val 0 == delta */
41 int quant; /* 0 < quant <= 16 */
42 int sequencep; /* bitflag */
44 double *valuelist; /* list of dim*entries quant/actual entry values */
45 long *codelist; /* list of bitstream codewords for each entry */
46 long *lengthlist; /* codeword lengths in bits */
48 /* auxiliary encoding/decoding information */
49 /* encode: provided pre-calculated partitioning tree */
50 /* decode: hufftree */
54 /* auxiliary encoding information. Not used in decode */
55 double *n; /* decision hyperplanes: sum(x_i*n_i)[0<=i<dim]=c */
63 long min; /* packed 24 bit float */
64 long delta; /* packed 24 bit float */
65 int quant; /* 0 < quant <= 16 */
66 int sequencep; /* bitflag */
69 static inline double *_point(vqgen *v,long ptr){
70 return v->pointlist+(v->elements*ptr);
73 static inline double *_now(vqgen *v,long ptr){
74 return v->entrylist+(v->elements*ptr);
77 extern void vqgen_init(vqgen *v,int elements,int entries,
78 double (*metric)(vqgen *,double *, double *));
79 extern void vqgen_addpoint(vqgen *v, double *p);
80 extern double *vqgen_midpoint(vqgen *v);
81 extern double vqgen_iterate(vqgen *v);
83 extern void vqgen_unquantize(vqgen *v,quant_meta *q);
84 extern void vqgen_quantize(vqgen *v,quant_meta *q);
86 extern void vqsp_book(vqgen *v,vqbook *b);
87 extern int vqenc_entry(vqbook *b,double *val);