please dont rip this site

UK AC York CS Www-users Http ~fisher Software Voicemail Pcalib Current Compute.c

/ * pcalib - interactive calibration tool for AJF's LTU
   A.J. Fisher	 April 1996 */

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>

#include "header.h"
#include "gfxlib.h"

static int seqlen;
static complex tempvec[MAXSEQLEN], circle[MAXSEQLEN/2];

static fft(complex[], complex[], int);


global void initcompute(int slen)
  { seqlen = slen;
    for (int i = 0; i < seqlen/2; i++)
      { double x = (TWOPI * i) / seqlen;
	circle[i] = expj(-x);
      }
  }

global void compute(complex tdvec[], complex fdvec[])
  { for (int k = 0; k < seqlen; k++) fdvec[k] = tdvec[k];
    fft(fdvec, tempvec, seqlen);	/* forward fft */
  }

static fft(complex data[], complex temp[], int n)
  { if (n > 1)
      { int h = n/2;
	for (int i = 0; i < h; i++)
	  { int i2 = i*2;
	    temp[i] = data[i2];		/* even */
	    temp[h+i] = data[i2+1];	/* odd	*/
	  }
	fft(&temp[0], &data[0], h);
	fft(&temp[h], &data[h], h);
	int p = 0, t = seqlen/n;
	for (int i = 0; i < h; i++)
	  { complex wkt = circle[p] * temp[h+i];
	    data[i] = temp[i] + wkt;
	    data[h+i] = temp[i] - wkt;
	    p += t;
	  }
      }
  }

global int computedelay(complex tdvec[])
  { double maxh = -1.0; int maxi;
    for (int i=0; i < seqlen; i++)
      { double h = cmag(tdvec[i]);
	if (h > maxh) { maxh = h; maxi = i; }
      }
    return maxi;
  }



file: /Techref/uk/ac/york/cs/www-users/http/~fisher/software/voicemail/pcalib/current/compute.C, 1KB, , updated: 2000/4/4 12:09, local time: 2024/7/2 13:03,
TOP NEW HELP FIND: 
18.224.59.50:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://piclist.com/techref/uk/ac/york/cs/www-users/http/~fisher/software/voicemail/pcalib/current/compute.C"> uk ac york cs www-users http ~fisher software voicemail pcalib current compute</A>

Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .