1 /*
2     MPEG Maaate: An Australian MPEG audio analysis toolkit
3     Copyright (C) 2000 Commonwealth Scientific and Industrial Research Organisation
4     (CSIRO), Australia.
5 
6     This program 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 2 of the License, or
9     (at your option) any later version.
10 
11     This program 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 this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 /* Here are defined useful functions used by modules */
22 
23 
24 #ifndef tools_H
25 #define tools_H
26 
27 #include "pluginsPlatform.h"
28 
29 /*---------------------- useful values -----------------------*/
30 
31 #define RESTORED_SAMPLE_MAX 5.33333333331
32 //maximum value of a restored sample for layer II
33 
34 /*************************** other tools *************************/
35 
36 /*-------------------------- search array ------------------------*/
37 
38 CSAPI_PLUGINS
39 int search_array ( double tab[], double what, int lenght);
40 // return the position in tab of the nearer value of what,
41 // supposing that the array is sorted from min to max
42 
43 /*************************** window functions ********************************/
44 
45 CSAPI_PLUGINS
46 double square_window ( unsigned int upto, int x);
47 // square window from 0 to "upto"
48 /*
49     1                _____________
50                     |             |
51     0  _____________|             |________________
52                     0            upto
53 */
54 
55 CSAPI_PLUGINS
56 double hamming_window ( unsigned int upto, int x);
57 // hamming window from 0 to upto
58 // 0.54 * 0.46 * cos (2 * Pi * x / upto)
59 
60 CSAPI_PLUGINS
61 double welch_window ( unsigned int upto, int x);
62 // welch window from 0 to upto
63 // 1-((x-0.5 * upto) / (0.5 * upto))^2
64 
65 CSAPI_PLUGINS
66 double bartlett_window ( unsigned int upto, int x);
67 // bartlett window from 0 to upto
68 // 1-|((x-0.5 * upto) / (0.5 * upto))|
69 
70 #endif
71