/usr/include/gnuradio/fft/window.h is in gnuradio-dev 3.7.9.1-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | /* -*- c++ -*- */
/*
* Copyright 2002,2007,2008,2012,2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_FFT_WINDOW_H
#define INCLUDED_FFT_WINDOW_H
#include <gnuradio/fft/api.h>
#include <vector>
#include <cmath>
#include <gnuradio/gr_complex.h>
namespace gr {
namespace fft {
class FFT_API window {
public:
enum win_type {
WIN_HAMMING = 0, //!< Hamming window; max attenuation 53 dB
WIN_HANN = 1, //!< Hann window; max attenuation 44 dB
WIN_BLACKMAN = 2, //!< Blackman window; max attenuation 74 dB
WIN_RECTANGULAR = 3, //!< Basic rectangular window; max attenuation 21 dB
WIN_KAISER = 4, //!< Kaiser window; max attenuation see window::max_attenuation
WIN_BLACKMAN_hARRIS = 5, //!< Blackman-harris window; max attenuation 92 dB
WIN_BLACKMAN_HARRIS = 5, //!< alias to WIN_BLACKMAN_hARRIS for capitalization consistency
WIN_BARTLETT = 6, //!< Barlett (triangular) window; max attenuation 26 dB
WIN_FLATTOP = 7, //!< flat top window; useful in FFTs; max attenuation 93 dB
};
/*!
* \brief Given a window::win_type, this tells you the maximum
* attenuation you can expect.
*
* \details
* For most windows, this is a set value. For the Kaiser window,
* the attenuation is based on the value of beta. The actual
* relationship is a piece-wise exponential relationship to
* calculate beta from the desired attenuation and can be found
* on page 542 of Oppenheim and Schafer (Discrete-Time Signal
* Processing, 3rd edition). To simplify this function to solve
* for A given beta, we use a linear form that is exact for
* attenuation >= 50 dB.
*
* For an attenuation of 50 dB, beta = 4.55.
*
* For an attenuation of 70 dB, beta = 6.76.
*
* \param type The window::win_type enumeration of the window type.
* \param beta Beta value only used for the Kaiser window.
*/
static double max_attenuation(win_type type, double beta=6.76);
/*!
* \brief Helper function to build cosine-based windows. 3-coefficient version.
*/
static std::vector<float> coswindow(int ntaps, float c0, float c1, float c2);
/*!
* \brief Helper function to build cosine-based windows. 4-coefficient version.
*/
static std::vector<float> coswindow(int ntaps, float c0, float c1, float c2, float c3);
/*!
* \brief Helper function to build cosine-based windows. 5-coefficient version.
*/
static std::vector<float> coswindow(int ntaps, float c0, float c1, float c2, float c3, float c4);
/*!
* \brief Build a rectangular window.
*
* Taps are flat across the window.
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> rectangular(int ntaps);
/*!
* \brief Build a Hamming window.
*
* See:
* <pre>
* A. V. Oppenheim and R. W. Schafer, "Discrete-Time
* Signal Processing," Upper Saddle River, N.J.: Prentice
* Hall, 2010, pp. 535-538.
* </pre>
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> hamming(int ntaps);
/*!
* \brief Build a Hann window (sometimes known as Hanning).
*
* See:
* <pre>
* A. V. Oppenheim and R. W. Schafer, "Discrete-Time
* Signal Processing," Upper Saddle River, N.J.: Prentice
* Hall, 2010, pp. 535-538.
* </pre>
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> hann(int ntaps);
/*!
* \brief Alias to build a Hann window.
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> hanning(int ntaps);
/*!
* \brief Build an exact Blackman window.
*
* See:
* <pre>
* A. V. Oppenheim and R. W. Schafer, "Discrete-Time
* Signal Processing," Upper Saddle River, N.J.: Prentice
* Hall, 2010, pp. 535-538.
* </pre>
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> blackman(int ntaps);
/*!
* \brief Build Blackman window, variation 1.
*/
static std::vector<float> blackman2(int ntaps);
/*!
* \brief Build Blackman window, variation 2.
*/
static std::vector<float> blackman3(int ntaps);
/*!
* \brief Build Blackman window, variation 3.
*/
static std::vector<float> blackman4(int ntaps);
/*!
* \brief Build a Blackman-harris window with a given attenuation.
*
* <pre>
* f. j. harris, "On the use of windows for harmonic analysis
* with the discrete Fourier transforms," Proc. IEEE, Vol. 66,
* ppg. 51-83, Jan. 1978.
* </pre>
*
* \param ntaps Number of coefficients in the window.
* \param atten Attenuation factor. Must be [61, 67, 74, 92].
* See the above paper for details.
*/
static std::vector<float> blackman_harris(int ntaps, int atten=92);
/*!
* Alias to gr::fft::window::blakcman_harris.
*/
static std::vector<float> blackmanharris(int ntaps, int atten=92);
/*!
* \brief Build a Nuttall (or Blackman-Nuttall) window.
*
* See: http://en.wikipedia.org/wiki/Window_function#Blackman.E2.80.93Nuttall_window
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> nuttall(int ntaps);
/*!
* Deprecated: use nuttall window instead.
*/
static std::vector<float> nuttal(int ntaps);
/*!
* \brief Alias to the Nuttall window.
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> blackman_nuttall(int ntaps);
/*!
* Deprecated: use blackman_nuttall window instead.
*/
static std::vector<float> blackman_nuttal(int ntaps);
/*!
* \brief Build a Nuttall continuous first derivative window.
*
* See: http://en.wikipedia.org/wiki/Window_function#Nuttall_window.2C_continuous_first_derivative
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> nuttall_cfd(int ntaps);
/*!
* Deprecated: use nuttall_cfd window instead.
*/
static std::vector<float> nuttal_cfd(int ntaps);
/*!
* \brief Build a flat top window.
*
* See: http://en.wikipedia.org/wiki/Window_function#Flat_top_window
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> flattop(int ntaps);
/*!
* \brief Build a Kaiser window with a given beta.
*
* See:
* <pre>
* A. V. Oppenheim and R. W. Schafer, "Discrete-Time
* Signal Processing," Upper Saddle River, N.J.: Prentice
* Hall, 2010, pp. 541-545.
* </pre>
*
* \param ntaps Number of coefficients in the window.
* \param beta Shaping parameter of the window. See the
* discussion in Oppenheim and Schafer.
*/
static std::vector<float> kaiser(int ntaps, double beta);
/*!
* \brief Build a Barlett (triangular) window.
*
* See:
* <pre>
* A. V. Oppenheim and R. W. Schafer, "Discrete-Time
* Signal Processing," Upper Saddle River, N.J.: Prentice
* Hall, 2010, pp. 535-538.
* </pre>
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> bartlett(int ntaps);
static std::vector<float> welch(int ntaps);
/*!
* \brief Build a Parzen (or de la Valle-Poussin) window.
*
* See:
* <pre>
* A. D. Poularikas, "Handbook of Formulas and Tables for
* Signal Processing," Springer, Oct 28, 1998
* </pre>
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> parzen(int ntaps);
/*!
* \brief Build an exponential window with a given decay.
*
* See: http://en.wikipedia.org/wiki/Window_function#Exponential_or_Poisson_window
*
* \param ntaps Number of coefficients in the window.
* \param d Decay of \p d dB over half the window length.
*/
static std::vector<float> exponential(int ntaps, double d);
/*!
* \brief Build a Riemann window.
*
* See:
* <pre>
* A. D. Poularikas, "Handbook of Formulas and Tables for
* Signal Processing," Springer, Oct 28, 1998
* </pre>
*
* \param ntaps Number of coefficients in the window.
*/
static std::vector<float> riemann(int ntaps);
/*!
* \brief Build a window using gr::fft::win_type to index the
* type of window desired.
*
* \param type a gr::fft::win_type index for the type of window.
* \param ntaps Number of coefficients in the window.
* \param beta Used only for building Kaiser windows.
*/
static std::vector<float> build(win_type type, int ntaps, double beta);
};
} /* namespace fft */
} /* namespace gr */
#endif /* INCLUDED_FFT_WINDOW_H */
|