diff options
Diffstat (limited to 'mbest.h')
-rw-r--r-- | mbest.h | 59 |
1 files changed, 59 insertions, 0 deletions
@@ -0,0 +1,59 @@ | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | |||
3 | FILE........: mbest.h | ||
4 | AUTHOR......: David Rowe | ||
5 | DATE CREATED: Jan 2017 | ||
6 | |||
7 | Multistage vector quantiser search algorithm that keeps multiple | ||
8 | candidates from each stage. | ||
9 | |||
10 | \*---------------------------------------------------------------------------*/ | ||
11 | |||
12 | /* | ||
13 | Copyright David Rowe 2017 | ||
14 | |||
15 | All rights reserved. | ||
16 | |||
17 | This program is free software; you can redistribute it and/or modify | ||
18 | it under the terms of the GNU Lesser General Public License version 2.1, as | ||
19 | published by the Free Software Foundation. This program is | ||
20 | distributed in the hope that it will be useful, but WITHOUT ANY | ||
21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
23 | License for more details. | ||
24 | |||
25 | You should have received a copy of the GNU Lesser General Public License | ||
26 | along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
27 | |||
28 | */ | ||
29 | |||
30 | #ifndef __MBEST__ | ||
31 | #define __MBEST__ | ||
32 | |||
33 | #define MBEST_STAGES 4 | ||
34 | |||
35 | struct MBEST_LIST { | ||
36 | int index[MBEST_STAGES]; /* index of each stage that lead us to this error */ | ||
37 | float error; | ||
38 | }; | ||
39 | |||
40 | struct MBEST { | ||
41 | int entries; /* number of entries in mbest list */ | ||
42 | struct MBEST_LIST *list; | ||
43 | }; | ||
44 | |||
45 | struct MBEST *mbest_create(int entries); | ||
46 | void mbest_destroy(struct MBEST *mbest); | ||
47 | void mbest_insert(struct MBEST *mbest, int index[], float error); | ||
48 | void mbest_search(const float *cb, float vec[], float w[], int k, int m, struct MBEST *mbest, int index[]); | ||
49 | void mbest_search450(const float *cb, float vec[], float w[], int k,int shorterK, int m, struct MBEST *mbest, int index[]); | ||
50 | |||
51 | // #define MBEST_PRINT_OUT | ||
52 | #ifdef MBEST_PRINT_OUT | ||
53 | #define MBEST_PRINT(a,b) mbest_print((a),(b)) | ||
54 | #else | ||
55 | #define MBEST_PRINT(a,b) | ||
56 | #endif | ||
57 | |||
58 | |||
59 | #endif | ||