1 /********************************************************************
3 * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
6 * PLEASE READ THESE TERMS DISTRIBUTING. *
8 * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
9 * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
10 * http://www.xiph.org/ *
12 ********************************************************************
14 function: generic euclidian distance metric for VQ codebooks
15 last mod: $Id: genericdata.c,v 1.6 2000/10/12 03:13:01 xiphmont Exp $
17 ********************************************************************/
25 char *vqext_booktype="GENERICdata";
27 quant_meta q={0,0,0,0}; /* non sequence data; each scalar
30 void vqext_quantize(vqgen *v,quant_meta *q){
34 float *vqext_weight(vqgen *v,float *p){
39 /* candidate,actual */
40 float vqext_metric(vqgen *v,float *e, float *p){
43 for(i=0;i<v->elements;i++){
47 return sqrt(acc/v->elements);
50 void vqext_addpoint_adj(vqgen *v,float *b,int start,int dim,int cols,int num){
51 vqgen_addpoint(v,b+start,NULL);
54 void vqext_preprocess(vqgen *v){