The vq book builder is mostly running now, but does not produce output yet.
[platform/upstream/libvorbis.git] / vq / vqgen.h
1 /********************************************************************
2  *                                                                  *
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.                            *
7  *                                                                  *
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/                                             *
11  *                                                                  *
12  ********************************************************************/
13
14 #ifndef _VQGEN_H_
15 #define _VQGEN_H_
16
17 typedef struct vqgen{
18   int it;
19
20   int    elements;
21
22   /* point cache */
23   double *pointlist; 
24   long   points;
25   long   allocated;
26
27   /* entries */
28   double *entrylist;
29   long   *assigned;
30   double *bias;
31   long   entries;
32
33   double (*metric_func)   (struct vqgen *v,double *a,double *b);
34 } vqgen;
35
36 typedef struct vqbook{
37   long elements;
38   long entries;
39
40   double *valuelist;
41   long   *codelist;
42   long   *lengthlist;
43
44   /* auxiliary encoding/decoding information */
45   long   *ptr0;
46   long   *ptr1;
47
48   /* auxiliary encoding information */
49   double *n;
50   double *c;
51   long   aux;
52   long   alloc;
53
54 } vqbook;
55
56 typedef struct {
57   double minval;
58   double delt;
59   int    addtoquant;
60 } quant_return;
61
62 static inline double *_point(vqgen *v,long ptr){
63   return v->pointlist+(v->elements*ptr);
64 }
65
66 static inline double *_now(vqgen *v,long ptr){
67   return v->entrylist+(v->elements*ptr);
68 }
69
70 extern void vqgen_init(vqgen *v,int elements,int entries,
71                        double (*metric)(vqgen *,double *, double *));
72 extern void vqgen_addpoint(vqgen *v, double *p);
73 extern double *vqgen_midpoint(vqgen *v);
74 extern double vqgen_iterate(vqgen *v);
75
76 extern void vqsp_book(vqgen *v,vqbook *b);
77 extern int vqenc_entry(vqbook *b,double *val);
78
79 #endif
80
81
82
83
84