home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- * Copyright (C) 1994 Charles P. Peterson *
- * 4007 Enchanted Sun, San Antonio, Texas 78244-1254 *
- * Email: Charles_P_Peterson@fcircus.sat.tx.us *
- * *
- * This is free software with NO WARRANTY. *
- * See gfft.c, or run program itself, for details. *
- * Support is available for a fee. *
- ***************************************************************************
- *
- * Program: gfft--General FFT analysis
- * File: oksigma.c
- * Purpose: Sum new processed values into 'bins' for later normalization
- * Author: Charles Peterson (CPP)
- * History: 23-August-1993 CPP; Created.
- * Comment: Bins are assumed to have been zeroed prior to first use.
- * No normalization (even to correct for one-sidedness)
- * is performed here; power spectrum (squared amplitude)
- * is assumed.
- *
- * Mathematical synopsis:
- * The power spectrum for each bin is magnitude(Hf) ** 2
- * (for one-sided, it is actually 2 * magnitude (Hf) ** 2).
- * However, the magnitude of the complex number (a,b) is
- * sqrt (a**2 + b**2), so, the power spectrum for a bin
- * where Hf is (a,b) is a**2 + b**2.
- */
-
- #ifdef _AMIGA
- #ifdef _M68881
- #include <m68881.h>
- #endif
- #endif
-
- #include "gfft.h"
-
- void ok_sigma (float *indata, BIN_TYPE *bins, unsigned long number_bins)
- {
- unsigned long i;
- unsigned long last_bin_index = number_bins; /* - 1 + 1 for 0 Hz */
- /*
- * deal with 'packed' real (non-complex) values for f=0 and f=fc
- */
- bins[0] += indata[0] * indata[0];
- bins[last_bin_index] += indata[1] * indata[1];
-
- indata += 2;
-
- for (i = 1; i < last_bin_index; i++)
- {
- bins[i] += indata[0] * indata[0] + indata[1] * indata[1];
- indata += 2;
- }
- }
-