/********************************************************************
* *
- * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
- * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
- * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * 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 OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
- * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
- * http://www.xiph.org/ *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
+ * by the Xiph.Org Foundation https://xiph.org/ *
* *
********************************************************************
function: build a VQ codebook
- last mod: $Id: vqgen.h,v 1.10 2000/01/06 13:57:14 xiphmont Exp $
********************************************************************/
#define _VQGEN_H_
typedef struct vqgen{
+ int seeded;
+ int sorted;
+
int it;
int elements;
+
int aux;
+ float mindist;
+ int centroid;
/* point cache */
- double *pointlist;
+ float *pointlist;
long points;
long allocated;
/* entries */
- double *entrylist;
+ float *entrylist;
long *assigned;
- double *bias;
+ float *bias;
long entries;
+ float *max;
+
+ float (*metric_func) (struct vqgen *v,float *entry,float *point);
+ float *(*weight_func) (struct vqgen *v,float *point);
- double (*metric_func) (struct vqgen *v,double *entry,double *point);
- double *(*weight_func) (struct vqgen *v,double *point);
+ FILE *asciipoints;
} vqgen;
typedef struct {
int sequencep; /* bitflag */
} quant_meta;
-static inline double *_point(vqgen *v,long ptr){
+static inline float *_point(vqgen *v,long ptr){
return v->pointlist+((v->elements+v->aux)*ptr);
}
-static inline double *_aux(vqgen *v,long ptr){
+static inline float *_aux(vqgen *v,long ptr){
return _point(v,ptr)+v->aux;
}
-static inline double *_now(vqgen *v,long ptr){
+static inline float *_now(vqgen *v,long ptr){
return v->entrylist+(v->elements*ptr);
}
-extern void vqgen_init(vqgen *v,int elements,int aux,int entries,
- double (*metric)(vqgen *,double *, double *),
- double *(*weight)(vqgen *,double *));
-extern void vqgen_addpoint(vqgen *v, double *p,double *aux);
+extern void vqgen_init(vqgen *v,
+ int elements,int aux,int entries,float mindist,
+ float (*metric)(vqgen *,float *, float *),
+ float *(*weight)(vqgen *,float *),int centroid);
+extern void vqgen_addpoint(vqgen *v, float *p,float *aux);
-extern double vqgen_iterate(vqgen *v);
+extern float vqgen_iterate(vqgen *v,int biasp);
extern void vqgen_unquantize(vqgen *v,quant_meta *q);
extern void vqgen_quantize(vqgen *v,quant_meta *q);
+extern void vqgen_cellmetric(vqgen *v);
#endif