FreeCalypso > hg > gsm-codec-lib
view hrutil/cod2hex.c @ 604:54f0f1b74c25
libgsmhr1 TFO: require BFI=0 and SID=0 for homing
In order for a received frame to be recognized as DHF, we need
not only the correct bit pattern, but also BFI=0 and SID=0.
The BFI=0 requirement should be obvious, while the SID=0 requirement
is needed only for HR codec. With FR and EFR, SID classification
comes from the payload bits and no separate check is needed -
but in HR we get an out-of-band SID ternary flag. When SID=1,
no payload bits are used at all; when SID=2, we use only the first
33 bits of the payload. Therefore, it is proper to conditionalize
DHF acceptance on SID=0.
We already implemented this logic in the just finished full decoder;
now bring TFO code into agreement.
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 04 Dec 2025 19:40:35 +0000 |
| parents | cf62fe9fac3a |
| children |
line wrap: on
line source
/* * This program reads an HRv1 *.cod file in ETSI test sequence format * (encoder output format) and converts it into TW-TS-005 Annex B * hexadecimal format. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <unistd.h> #include "../libgsmhr1/tw_gsmhr.h" #include "../libtest/local_endian.h" main(argc, argv) char **argv; { char *infname, *outfname; FILE *inf, *outf; int opt, rc, big_endian, emit_5993 = 0; unsigned frame_no; int16_t params[GSMHR_NUM_PARAMS_ENC]; extern int optind; big_endian = is_native_big_endian(); while ((opt = getopt(argc, argv, "blx")) != EOF) { switch (opt) { case 'b': big_endian = 1; continue; case 'l': big_endian = 0; continue; case 'x': emit_5993 = 1; continue; default: usage: fprintf(stderr, "usage: %s [-b|-l] [-x] input.cod output.hex\n", argv[0]); exit(1); } } if (argc != optind + 2) goto usage; infname = argv[optind]; outfname = argv[optind+1]; inf = fopen(infname, "r"); if (!inf) { perror(infname); exit(1); } outf = fopen(outfname, "w"); if (!outf) { perror(outfname); exit(1); } for (frame_no = 0; ; frame_no++) { rc = read_cod_frame(inf, big_endian, params, infname, frame_no); if (!rc) break; emit_cod_to_tw5b(outf, params, emit_5993); } exit(0); }
