GNU Radio 2.x: gr_firdes.h Source File

Main Page | Modules | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

# gr_firdes.h

Go to the documentation of this file.

    00001 /* -*- c++ -*- */
    00002 /*
    00003  * Copyright 2002 Free Software Foundation, Inc.
    00004  *
    00005  * This file is part of GNU Radio
    00006  *
    00007  * GNU Radio is free software; you can redistribute it and/or modify
    00008  * it under the terms of the GNU General Public License as published by
    00009  * the Free Software Foundation; either version 2, or (at your option)
    00010  * any later version.
    00011  *
    00012  * GNU Radio is distributed in the hope that it will be useful,
    00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00015  * GNU General Public License for more details.
    00016  *
    00017  * You should have received a copy of the GNU General Public License
    00018  * along with GNU Radio; see the file COPYING.  If not, write to
    00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020  * Boston, MA 02111-1307, USA.
    00021  */
    00022
    00023 #ifndef _GR_FIRDES_H_
    00024 #define _GR_FIRDES_H_
    00025
    00026 #include <vector>
    00027 #include <cmath>
    00028 using std::vector;
    00029
    00034 class gr_firdes {
    00035  public:
    00036
    00037   enum win_type {
    00038     WIN_HAMMING = 0,    // max attenuation 53 dB
    00039     WIN_HANN = 1,       // max attenuation 44 dB
    00040     WIN_BLACKMAN = 2,   // max attenuation 74 dB
    00041     WIN_RECTANGULAR = 3
    00042   };
    00043
    00044   // ... class methods ...
    00045
    00060   static vector<float>
    00061   low_pass (double gain,
    00062             double sampling_freq,
    00063             double cutoff_freq,         // Hz center of transition band
    00064             double transition_width,    // Hz width of transition band
    00065             win_type window = WIN_HAMMING,
    00066             double beta = 6.76);                // used only with Kaiser
    00067
    00082   static vector<float>
    00083   high_pass (double gain,
    00084              double sampling_freq,
    00085              double cutoff_freq,                // Hz center of transition band
    00086              double transition_width,           // Hz width of transition band
    00087              win_type window = WIN_HAMMING,
    00088              double beta = 6.76);               // used only with Kaiser
    00089
    00105   static vector<float>
    00106   band_pass (double gain,
    00107              double sampling_freq,
    00108              double low_cutoff_freq,            // Hz center of transition band
    00109              double high_cutoff_freq,           // Hz center of transition band
    00110              double transition_width,           // Hz width of transition band
    00111              win_type window = WIN_HAMMING,
    00112              double beta = 6.76);               // used only with Kaiser
    00113
    00114
    00130   static vector<float>
    00131   band_reject (double gain,
    00132                double sampling_freq,
    00133                double low_cutoff_freq,          // Hz center of transition band
    00134                double high_cutoff_freq,         // Hz center of transition band
    00135                double transition_width,         // Hz width of transition band
    00136                win_type window = WIN_HAMMING,
    00137                double beta = 6.76);             // used only with Kaiser
    00138
    00145   static vector<float>
    00146   hilbert (unsigned int ntaps,
    00147            win_type windowtype = WIN_RECTANGULAR,
    00148            double beta = 6.76);
    00149
    00159   static vector<float>
    00160   root_raised_cosine (double gain,
    00161                       double sampling_freq,
    00162                       double symbol_rate,       // Symbol rate, NOT bitrate (unless BPSK)
    00163                       double alpha,             // Excess Bandwidth Factor
    00164                       int ntaps);
    00165
    00174   static vector<float>
    00175   gaussian (double gain,
    00176             double sampling_freq,
    00177             double symbol_rate,
    00178             double bt,              // Bandwidth to bitrate ratio
    00179             int ntaps);
    00180
    00181   // window functions ...
    00182   static vector<float> gr_firdes::window (win_type type, int ntaps, double beta);
    00183
    00184 private:
    00185   static void sanity_check_1f (double sampling_freq, double f1,
    00186                                double transition_width);
    00187   static void sanity_check_2f (double sampling_freq, double f1, double f2,
    00188                                double transition_width);
    00189
    00190   static int compute_ntaps (double sampling_freq,
    00191                             double transition_width,
    00192                             win_type window_type, double beta);
    00193 };
    00194
    00195 #endif