[specdesc] improve error message
[aubio.git] / src / spectral / dct.h
1 /*
2   Copyright (C) 2017 Paul Brossier <piem@aubio.org>
3
4   This file is part of aubio.
5
6   aubio is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   aubio is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with aubio.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 /** \file
22
23   Discrete Cosine Transform
24
25   Functions aubio_dct_do() and aubio_dct_rdo() are equivalent to MATLAB/Octave
26   dct() and idct() functions, as well as scipy.fftpack.dct(x, norm='ortho') and
27   scipy.fftpack.idct(x, norm='ortho')
28
29   \example spectral/test-dct.c
30
31 */
32
33 #ifndef AUBIO_DCT_H
34 #define AUBIO_DCT_H
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 /** DCT object
41
42   This object computes forward and backward DCT type 2 with orthonormal
43   scaling.
44
45 */
46 typedef struct _aubio_dct_t aubio_dct_t;
47
48 /** create new DCT computation object
49
50   \param size length of the DCT
51
52 */
53 aubio_dct_t * new_aubio_dct(uint_t size);
54
55 /** compute forward DCT
56
57   \param s dct object as returned by new_aubio_dct
58   \param input input signal
59   \param dct_output transformed input array
60
61 */
62 void aubio_dct_do (aubio_dct_t *s, const fvec_t * input, fvec_t * dct_output);
63
64 /** compute backward DCT
65
66   \param s dct object as returned by new_aubio_dct
67   \param input input signal
68   \param idct_output transformed input array
69
70 */
71 void aubio_dct_rdo (aubio_dct_t *s, const fvec_t * input, fvec_t * idct_output);
72
73
74 /** delete DCT object
75
76   \param s dct object as returned by new_aubio_dct
77
78 */
79 void del_aubio_dct (aubio_dct_t *s);
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif /* AUBIO_DCT_H */