1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9 * by the Xiph.Org Foundation https://xiph.org/ *
11 ********************************************************************
13 function: build a VQ codebook
15 ********************************************************************/
43 float (*metric_func) (struct vqgen *v,float *entry,float *point);
44 float *(*weight_func) (struct vqgen *v,float *point);
50 long min; /* packed 24 bit float */
51 long delta; /* packed 24 bit float */
52 int quant; /* 0 < quant <= 16 */
53 int sequencep; /* bitflag */
56 static inline float *_point(vqgen *v,long ptr){
57 return v->pointlist+((v->elements+v->aux)*ptr);
60 static inline float *_aux(vqgen *v,long ptr){
61 return _point(v,ptr)+v->aux;
64 static inline float *_now(vqgen *v,long ptr){
65 return v->entrylist+(v->elements*ptr);
68 extern void vqgen_init(vqgen *v,
69 int elements,int aux,int entries,float mindist,
70 float (*metric)(vqgen *,float *, float *),
71 float *(*weight)(vqgen *,float *),int centroid);
72 extern void vqgen_addpoint(vqgen *v, float *p,float *aux);
74 extern float vqgen_iterate(vqgen *v,int biasp);
75 extern void vqgen_unquantize(vqgen *v,quant_meta *q);
76 extern void vqgen_quantize(vqgen *v,quant_meta *q);
77 extern void vqgen_cellmetric(vqgen *v);