File: fir.h

package info (click to toggle)
drc 3.2.2~dfsg0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,548 kB
  • sloc: ansic: 13,575; cpp: 11,048; sh: 253; makefile: 41
file content (96 lines) | stat: -rw-r--r-- 4,005 bytes parent folder | download | duplicates (2)
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
/****************************************************************************

    DRC: Digital Room Correction
    Copyright (C) 2002, 2003 Denis Sbragion

    This program 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 2 of the License, or
    (at your option) any later version.

    This program 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 this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

		You can contact the author on Internet at the following address:

				d.sbragion@neomerica.it

****************************************************************************/

/****************************************************************************
  Progetto    : DSP Library.
  File        : Fir.h
  Autore      : Sbragion Denis
  Descrizione : Funzioni per il calcolo di filtri fir.
  Revisioni   :
  16/10/93    : Prima stesura.
****************************************************************************/

#ifndef Fir_h
  #define Fir_h

  #include "boolean.h"
  #include "dsplib.h"

	// Definizione tipo interpolazione
	typedef enum
		{
			Linear,
			Logarithmic,
			SplineLinear,
			SplineLogarithmic,
			PCHIPLinear,
			PCHIPLogarithmic
		}
	InterpolationType;

  // Ritornano i filtri fir a fase lineare di ordine Order corrispondenti
  // al nome della funzione. Tutti i filtri sono ricavati con la sola
  // finestra rettangolare.
  // Per i filtri HighPass e BandStop Order deve essere dispari.
  // Se non lo e` viene calcolato un filtro con Order-1 coefficienti
  // trascurando l' ultimo che viene posto a 0.
  // Order deve comunque essere maggiore o uguale a 2.
  void LowPassFir(DLReal * Filter,unsigned int Order,DLReal Freq);
  void HighPassFir(DLReal * Filter,unsigned int Order,DLReal Freq);
  void BandPassFir(DLReal * Filter,unsigned int Order,DLReal Low,
    DLReal High);
  void BandStopFir(DLReal * Filter,unsigned int Order,DLReal Low,
    DLReal High);

  // Ritorna il trasformatore di Hilbert di ordine Order ricavato con la
  // sola finestra rettangolare.
  // Order deve essere dispari altrimenti l' ultimo coefficiente viene
  // ignorato e posto uguale a 0. Inoltre Order deve essere maggiore di 2.
  void HilbertFir(DLReal * Filter,unsigned int Order);

  // Genera un filtro Fir con risposta generica tramite IFft e
  // finestratura. L' ordine Order deve essere maggiore o uguale a 2.
  // Il filtro e` ricavato con la sola finestra rettangolare. Si ricordi
  // che i filtri di ordine dispari presentano generalmente un
  // comportamento piu` regolare.
  // F rappresenta l' array delle frequenze su cui costruire la risposta
  // del  filtro. Deve essere in ordine crescente con il primo
  // coefficiente 0 e l' ultimo, corrispondente a meta` della frequenza
  // di campionamento, uguale a 1. M[I] e P[I] rappresentano
  // guadagno e fase desiderati nei corrispondenti punti F[I].
  // Ritorna False in caso di errori.
  // Se Is e` 0 l' array per l' interpolazione intermedia viene preso
  // con dimensione pari alla piu` piccola potenza di 2 che supera Order,
  // altrimenti viene preso con dimensione Is. Is non deve comunque essere
  // inferiore a Order. Per avere una elevata precisione nella
  // ricostruzione della risposta utilizzare un elevato valore di Is.
  // Se Is e` una potenza di 2 il calcolo risulta molto piu` rapido.
  Boolean GenericFir(DLReal * Filter,unsigned int Order,DLReal * F,
    DLReal * M, DLReal * P,unsigned int Np,unsigned int Is = 0,
		InterpolationType It = Linear);

#endif

/***************************************************************************/