examples/sfexamples/oggvorbiscodec/src/libvorbis/vq/vqgen.h

00001 /********************************************************************
00002  *                                                                  *
00003  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
00004  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
00005  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
00006  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
00007  *                                                                  *
00008  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
00009  * by the XIPHOPHORUS Company http://www.xiph.org/                  *
00010  *                                                                  *
00011  ********************************************************************
00012 
00013  function: build a VQ codebook 
00014  last mod: $Id: vqgen.h 7187 2004-07-20 07:24:27Z xiphmont $
00015 
00016  ********************************************************************/
00017 
00018 #ifndef _VQGEN_H_
00019 #define _VQGEN_H_
00020 
00021 typedef struct vqgen{
00022   int seeded;
00023   int sorted;
00024 
00025   int it;
00026   int elements;
00027 
00028   int aux;
00029   float mindist;
00030   int centroid;
00031 
00032   /* point cache */
00033   float *pointlist; 
00034   long   points;
00035   long   allocated;
00036 
00037   /* entries */
00038   float *entrylist;
00039   long   *assigned;
00040   float *bias;
00041   long   entries;
00042   float *max;
00043   
00044   float  (*metric_func) (struct vqgen *v,float *entry,float *point);
00045   float *(*weight_func) (struct vqgen *v,float *point);
00046 
00047   FILE *asciipoints;
00048 } vqgen;
00049 
00050 typedef struct {
00051   long   min;       /* packed 24 bit float */       
00052   long   delta;     /* packed 24 bit float */       
00053   int    quant;     /* 0 < quant <= 16 */
00054   int    sequencep; /* bitflag */
00055 } quant_meta;
00056 
00057 static inline float *_point(vqgen *v,long ptr){
00058   return v->pointlist+((v->elements+v->aux)*ptr);
00059 }
00060 
00061 static inline float *_aux(vqgen *v,long ptr){
00062   return _point(v,ptr)+v->aux;
00063 }
00064 
00065 static inline float *_now(vqgen *v,long ptr){
00066   return v->entrylist+(v->elements*ptr);
00067 }
00068 
00069 extern void vqgen_init(vqgen *v,
00070                        int elements,int aux,int entries,float mindist,
00071                        float  (*metric)(vqgen *,float *, float *),
00072                        float *(*weight)(vqgen *,float *),int centroid);
00073 extern void vqgen_addpoint(vqgen *v, float *p,float *aux);
00074 
00075 extern float vqgen_iterate(vqgen *v,int biasp);
00076 extern void vqgen_unquantize(vqgen *v,quant_meta *q);
00077 extern void vqgen_quantize(vqgen *v,quant_meta *q);
00078 extern void vqgen_cellmetric(vqgen *v);
00079 
00080 #endif
00081 
00082 
00083 
00084 
00085 

Generated by  doxygen 1.6.2