diff options
| author | Author Name <[email protected]> | 2023-07-07 12:20:59 +0930 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2023-07-07 12:29:06 +0930 |
| commit | ac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch) | |
| tree | a2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /src/mbest.h | |
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'src/mbest.h')
| -rw-r--r-- | src/mbest.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/mbest.h b/src/mbest.h new file mode 100644 index 0000000..f7d0d86 --- /dev/null +++ b/src/mbest.h @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: mbest.h + AUTHOR......: David Rowe + DATE CREATED: Jan 2017 + + Multistage vector quantiser search algorithm that keeps multiple + candidates from each stage. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright David Rowe 2017 + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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. See the GNU General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + +*/ + +#ifndef __MBEST__ +#define __MBEST__ + +#define MBEST_STAGES 4 + +struct MBEST_LIST { + int index[MBEST_STAGES]; /* index of each stage that lead us to this error */ + float error; +}; + +struct MBEST { + int entries; /* number of entries in mbest list */ + struct MBEST_LIST *list; +}; + +struct MBEST *mbest_create(int entries); +void mbest_destroy(struct MBEST *mbest); +void mbest_precompute_weight(float cb[], float w[], int k, int m); +void mbest_insert(struct MBEST *mbest, int index[], float error); +void mbest_search(const float *cb, float vec[], int k, int m, struct MBEST *mbest, int index[]); +void mbest_search450(const float *cb, float vec[], float w[], int k,int shorterK, int m, struct MBEST *mbest, int index[]); + +void mbest_print(char title[], struct MBEST *mbest); + +#endif |
