File: linFirFilter.h

package info (click to toggle)
dfcgen-gtk 0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,456 kB
  • sloc: ansic: 9,688; sh: 4,936; makefile: 207; sed: 16
file content (110 lines) | stat: -rw-r--r-- 3,353 bytes parent folder | download
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
/********************* -*- mode: C; coding: utf-8 -*- *************************/
/**
 * \file     linFirFilter.h
 * \brief    Interface to Linear IIR Filter interpolation functions.
 * \author   Copyright (C) 2006-2022 Ralf Hoppe <ralf.hoppe@dfcgen.de>
 *
 ******************************************************************************/


#ifndef LINFIR_FILTER_H
#define LINFIR_FILTER_H


/* INCLUDE FILES **************************************************************/

#include "dfcgen.h"


#ifdef  __cplusplus
extern "C" {
#endif


/* GLOBAL TYPE DECLARATIONS ***************************************************/

/** Typical smoothing windows used in digital signal processing.
 */
typedef enum
{
    LINFIR_DSPWIN_RECT = 0,
    LINFIR_DSPWIN_HAMMING,
    LINFIR_DSPWIN_VANHANN,
    LINFIR_DSPWIN_BLACKMAN,
    LINFIR_DSPWIN_KAISER,

    LINFIR_DSPWIN_SIZE

} LINFIR_DSPWIN;



/** Linear FIR filter types.
 */
typedef enum
{
    LINFIR_TYPE_RECT = 0,                          /**< Rectangular lowpass */
    LINFIR_TYPE_COS,                                   /**< Cosinus lowpass */
    LINFIR_TYPE_COS2,                           /**< Square cosinus lowpass */
    LINFIR_TYPE_GAUSS,                                /**< Gaussian lowpass */
    LINFIR_TYPE_SQR,                         /**< Squared 1st order lowpass */

    LINFIR_TYPE_SIZE
} LINFIR_TYPE;


/** Linear FIR filter design constraints.
 *  \see DESIGNDLG_COMMON
 */
typedef struct
{
    LINFIR_TYPE type;    /**< Filter type. \attention Must be the 1st element */
    int order;       /**< Order of filter. \attention Must be the 2nd element */
    double cutoff;  /**< Cutoff frequency. \attention Must be the 3rd element */
    FTRDESIGN ftr; /**< Frequency transformation data. \attention Must be the 4th element */
    LINFIR_DSPWIN dspwin;                       /**< Type of smoothing window */
    double winparm;               /**< Parameter of window, e.g. Kaiser alpha */
} LINFIR_DESIGN;




/* GLOBAL CONSTANT DECLARATIONS ***********************************************/


/* GLOBAL VARIABLE DECLARATIONS ***********************************************/


/* GLOBAL MACRO DEFINITIONS ***************************************************/


/* EXPORTED FUNCTIONS *********************************************************/


/* FUNCTION *******************************************************************/
/** Generates a linear FIR filter. The cutoff frequency always is assumed to be
 *  the 3dB point of magnitude response.
 *
 *  \param pDesign      Pointer to linear FIR filter design data.
 *  \param pFilter      Pointer to buffer which gets the generated filter.
 *                      Notice, that memory space for polynomials will be
 *                      allocated.
 *
 *  \return             Zero on success, else an error number (see errno.h or
 *                      gsl_errno.h for predefined codes).
 ******************************************************************************/
int linFirFilterGen (LINFIR_DESIGN *pDesign, FLTCOEFF *pFilter);


#ifdef  __cplusplus
}
#endif


#endif /* LINFIR_FILTER_H */


/******************************************************************************/
/* END OF FILE                                                                */
/******************************************************************************/