comparison libhr/paramval_dec.c @ 40:e1eabf554a75

libhr: small subset of WIP libgsmhr1
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 30 Aug 2024 16:41:56 +0000
parents
children
comparison
equal deleted inserted replaced
39:1e83071186cf 40:e1eabf554a75
1 /*
2 * The function implemented in this module examines a frame of 22 int16_t words
3 * that corresponds to GSM-HR decoder input format, and checks if the unused
4 * upper bits of each int16_t word are cleared as they should be.
5 * This function should be used when reading from ETSI-format *.dec files,
6 * to guard against reading garbage or wrong endian.
7 */
8
9 #include <stdint.h>
10 #include "tw_gsmhr.h"
11
12 int gsmhr_check_decoder_params(const int16_t *params)
13 {
14 if (params[18] < 0 || params[18] > 2) /* BFI */
15 return -1;
16 if (params[19] < 0 || params[19] > 1) /* UFI */
17 return -1;
18 if (params[20] < 0 || params[20] > 2) /* SID */
19 return -1;
20 if (params[21] < 0 || params[21] > 1) /* TAF */
21 return -1;
22 return gsmhr_check_common_params(params);
23 }