Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/libvorbis-1.2.0/vq/genericdata.c @ 37

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

added libvorbis

File size: 1.7 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: generic euclidian distance metric for VQ codebooks
14 last mod: $Id: genericdata.c 13293 2007-07-24 00:09:47Z xiphmont $
15
16 ********************************************************************/
17
18#include <stdlib.h>
19#include <math.h>
20#include <stdio.h>
21#include "vqgen.h"
22#include "vqext.h"
23
24char *vqext_booktype="GENERICdata"; 
25int vqext_aux=0;               
26quant_meta q={0,0,0,0};          /* non sequence data; each scalar
27                                    independent */
28
29void vqext_quantize(vqgen *v,quant_meta *q){
30  vqgen_quantize(v,q);
31}
32
33float *vqext_weight(vqgen *v,float *p){
34  /*noop*/
35  return(p);
36}
37
38                            /* candidate,actual */
39float vqext_metric(vqgen *v,float *e, float *p){
40  int i;
41  float acc=0.f;
42  for(i=0;i<v->elements;i++){
43    float val=p[i]-e[i];
44    acc+=val*val;
45  }
46  return sqrt(acc/v->elements);
47}
48
49void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
50  vqgen_addpoint(v,b+start,NULL);
51}
52
53void vqext_preprocess(vqgen *v){
54  /* noop */
55}
56
57
58
59
60
61
Note: See TracBrowser for help on using the repository browser.