aRts audio server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gslfft.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* GSL - Generic Sound Layer
  2. * Copyright (C) 2001 Tim Janik
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General
  15. * Public License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #ifndef __GSL_FFT_H__
  20. #define __GSL_FFT_H__
  21. #include <gsl/gsldefs.h>
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif /* __cplusplus */
  25. /**
  26. * gsl_power2_fftac
  27. * @n_values: Number of complex values
  28. * @ri_values_in: Complex sample values [0..n_values*2-1]
  29. * @ri_values_out: Complex frequency values [0..n_values*2-1]
  30. * This function performs a decimation in time fourier transformation
  31. * in forward direction, where the input values are equidistant sampled
  32. * data, and the output values contain the frequency proportions of the
  33. * input.
  34. * The input and output arrays are complex values with real and imaginery
  35. * portions interleaved, adressable in the range [0..2*n_values-1], where
  36. * n_values must be a power of two.
  37. * Frequencies are stored in-order, the K-th output corresponds to the
  38. * frequency K/n_values. (If you want to interpret negative frequencies,
  39. * note that the frequencies -K/n_values and (n_values-K)/n_values are
  40. * equivalent).
  41. * Note that the transformation is performed out of place, the input
  42. * array is not modified, and may not overlap with the output array.
  43. */
  44. void gsl_power2_fftac (const unsigned int n_values,
  45. const double *ri_values_in,
  46. double *ri_values_out);
  47. /**
  48. * gsl_power2_fftsc
  49. * @n_values: Number of complex values
  50. * @ri_values_in: Complex frequency values [0..n_values*2-1]
  51. * @ri_values_out: Complex sample values [0..n_values*2-1]
  52. * This function performs a decimation in time fourier transformation
  53. * in backwards direction with normalization. As such, this function
  54. * represents the counterpart to gsl_power2_fftac(), that is, a value
  55. * array which is transformed into the frequency domain with
  56. * gsl_power2_fftac() can be reconstructed by issuing gsl_power2_fftsc()
  57. * on the transform.
  58. * Note that the transformation is performed out of place, the input
  59. * array is not modified, and may not overlap with the output array.
  60. */
  61. void gsl_power2_fftsc (const unsigned int n_values,
  62. const double *ri_values_in,
  63. double *ri_values_out);
  64. /**
  65. * gsl_power2_fftar
  66. * @n_values: Number of complex values
  67. * @r_values_in: Real sample values [0..n_values-1]
  68. * @ri_values_out: Complex frequency values [0..n_values-1]
  69. * Real valued variant of gsl_power2_fftac(), the input array contains
  70. * real valued equidistant sampled data [0..n_values-1], and the output
  71. * array contains the positive frequency half of the complex valued
  72. * fourier transform. Note, that the complex valued fourier transform H
  73. * of a purely real valued set of data, satisfies H(-f) = Conj(H(f)),
  74. * where Conj() denotes the complex conjugate, so that just the positive
  75. * frequency half suffices to describe the entire frequency spectrum.
  76. * Even so, the resulting n_values/2 complex frequencies are one value
  77. * off in storage size, but the resulting frequencies H(0) and
  78. * H(n_values/2) are both real valued, so the real portion of
  79. * H(n_values/2) is stored in ri_values_out[1] (the imaginery part of
  80. * H(0)), so that both r_values_in and ri_values_out can be of size
  81. * n_values.
  82. * Note that the transformation is performed out of place, the input
  83. * array is not modified, and may not overlap with the output array.
  84. */
  85. void gsl_power2_fftar (const unsigned int n_values,
  86. const double *r_values_in,
  87. double *ri_values_out);
  88. /**
  89. * gsl_power2_fftsr
  90. * @n_values: Number of complex values
  91. * @ri_values_in: Complex frequency values [0..n_values-1]
  92. * @r_values_out: Real sample values [0..n_values-1]
  93. * Real valued variant of gsl_power2_fftsc(), counterpart to
  94. * gsl_power2_fftar(), using the same frequency storage format.
  95. * A real valued data set transformed into the frequency domain
  96. * with gsl_power2_fftar() can be reconstructed using this function.
  97. * Note that the transformation is performed out of place, the input
  98. * array is not modified, and may not overlap with the output array.
  99. */
  100. void gsl_power2_fftsr (const unsigned int n_values,
  101. const double *ri_values_in,
  102. double *r_values_out);
  103. /* --- convenience wrappers --- */
  104. void gsl_power2_fftar_simple (const unsigned int n_values,
  105. const float *real_values,
  106. float *complex_values);
  107. void gsl_power2_fftsr_simple (const unsigned int n_values,
  108. const float *complex_values,
  109. float *real_values);
  110. #ifdef __cplusplus
  111. }
  112. #endif /* __cplusplus */
  113. #endif /* __GSL_FFT_H__ */ /* vim:set ts=8 sw=2 sts=2: */