forked from timmartin/libfooid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
127 lines (104 loc) · 2.33 KB
/
common.h
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
libFooID - Free audio fingerprinting library
Copyright (C) 2006 Gian-Carlo Pascutto, Hogeschool Gent
Use of this software is allowed under either:
1) The GNU General Public License (GPL), as described
in LICENSE.GPL.
2) A modified BSD License, as described in LICENSE.BSDA.
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.
*/
#ifndef COMMON_H
#define COMMON_H
#include "fooid.h"
/*
defines
*/
#if (_MSC_VER >= 1400) /* VC8+ Disable all deprecation warnings */
#pragma warning(disable : 4996)
#endif /* VC8+ */
#define FALSE 0
#define TRUE 1
#define PI 3.14159265358979323846f
#define EPSILON 1e-15
#define FRAME_LEN 8192
#define SPEC_LEN (FRAME_LEN / 2)
#define MAX_BARK 17
/*
size of total analysis sample data
*/
#define SSIZE (8000 * 100)
/*
number of samples of input to resample per time
*/
#define IN_LEN 2048
/*
fingerprint (version 0)
*/
#define FPVERSION 0
#define FPSIZE 424
/*
fingerprint storage
*/
struct t_fingerprint
{
/*
fingerprint version
*/
short version;
/*
length in centiseconds
*/
int length;
/*
average line fit, times 1000
*/
short avg_fit;
/*
average dominant line, times 100
*/
short avg_dom;
/*
spectral fits, 4 bits times 16 bands = 32 times 87 frames
-> 348 bytes
*/
unsigned char r[348];
/*
spectral doms, 6 bits times 87 frames = 65.25
*/
unsigned char dom[66];
};
/*
processing storage
*/
struct t_fooid
{
/* spectral stuff */
float window[SPEC_LEN];
int line_to_cb[SPEC_LEN];
int cb_start[MAX_BARK];
int cb_size[MAX_BARK];
int max_sfb;
/* settings stuff */
int channels;
int samplerate;
/* buffer stuff */
float *samples;
float *sbuffer;
int soundfound;
/* resampling stuff */
float resample_ratio;
void *resample_h;
int outpos;
/* actual fingerprint */
struct t_fingerprint fp;
};
/*
functions
*/
const int bitlen(int n);
#if defined(WIN32) || defined(SLOWROUND) || defined(WIN64)
int const round(const float x);
#endif
#endif