Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/libvorbis-1.2.0/vq/vqgen.h @ 16

Last change on this file since 16 was 16, checked in by landauf, 16 years ago

added libvorbis

File size: 2.3 KB
Line 
1/********************************************************************
2 *                                                                  *
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.       *
7 *                                                                  *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
9 * by the Xiph.Org Foundation http://www.xiph.org/                  *
10 *                                                                  *
11 ********************************************************************
12
13 function: build a VQ codebook
14 last mod: $Id: vqgen.h 13293 2007-07-24 00:09:47Z xiphmont $
15
16 ********************************************************************/
17
18#ifndef _VQGEN_H_
19#define _VQGEN_H_
20
21typedef struct vqgen{
22  int seeded;
23  int sorted;
24
25  int it;
26  int elements;
27
28  int aux;
29  float mindist;
30  int centroid;
31
32  /* point cache */
33  float *pointlist; 
34  long   points;
35  long   allocated;
36
37  /* entries */
38  float *entrylist;
39  long   *assigned;
40  float *bias;
41  long   entries;
42  float *max;
43 
44  float  (*metric_func) (struct vqgen *v,float *entry,float *point);
45  float *(*weight_func) (struct vqgen *v,float *point);
46
47  FILE *asciipoints;
48} vqgen;
49
50typedef struct {
51  long   min;       /* packed 24 bit float */       
52  long   delta;     /* packed 24 bit float */       
53  int    quant;     /* 0 < quant <= 16 */
54  int    sequencep; /* bitflag */
55} quant_meta;
56
57static inline float *_point(vqgen *v,long ptr){
58  return v->pointlist+((v->elements+v->aux)*ptr);
59}
60
61static inline float *_aux(vqgen *v,long ptr){
62  return _point(v,ptr)+v->aux;
63}
64
65static inline float *_now(vqgen *v,long ptr){
66  return v->entrylist+(v->elements*ptr);
67}
68
69extern void vqgen_init(vqgen *v,
70                       int elements,int aux,int entries,float mindist,
71                       float  (*metric)(vqgen *,float *, float *),
72                       float *(*weight)(vqgen *,float *),int centroid);
73extern void vqgen_addpoint(vqgen *v, float *p,float *aux);
74
75extern float vqgen_iterate(vqgen *v,int biasp);
76extern void vqgen_unquantize(vqgen *v,quant_meta *q);
77extern void vqgen_quantize(vqgen *v,quant_meta *q);
78extern void vqgen_cellmetric(vqgen *v);
79
80#endif
81
82
83
84
85
Note: See TracBrowser for help on using the repository browser.