FreeCalypso > hg > gsm-codec-lib
view efrtest/dec-parse.c @ 147:90b9c7c3fa3b
gsmefr-cod-parse: use factored-out ETSI bit reader
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 14 Dec 2022 08:09:52 +0000 |
parents | 0fa0cd251a31 |
children | 95d47a34070a |
line wrap: on
line source
/* * This program reads an EFR *.dec file in ETSI test sequence format * (test input to the decoder) and converts it into human-readable format, * similar to what one would get from our gsmrec-dump utility. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "../libgsmefr/gsm_efr.h" #include "etsi.h" main(argc, argv) char **argv; { FILE *inf; unsigned frame_no; uint8_t input_bits[ETSI_DEC_NWORDS], frame[EFR_RTP_FRAME_LEN]; int16_t params[EFR_NUM_PARAMS]; int rc, i, j, n; if (argc != 2) { fprintf(stderr, "usage: %s file.dec\n", argv[0]); exit(1); } inf = fopen(argv[1], "r"); if (!inf) { perror(argv[1]); exit(1); } for (frame_no = 0; ; frame_no++) { rc = read_etsi_bits(inf, 0, input_bits, ETSI_DEC_NWORDS, argv[1]); if (!rc) break; bits2frame(input_bits + 1, frame, argv[1], frame_no); printf("#%u: BFI=%u SID=%u TAF=%u LPC", frame_no, input_bits[0], input_bits[245], input_bits[246]); EFR_frame2params(frame, params); n = 0; for (i = 0; i < 5; i++) printf(" %d", params[n++]); putchar('\n'); for (i = 0; i < 4; i++) { putchar(' '); for (j = 0; j < 13; j++) printf(" %d", params[n++]); putchar('\n'); } } }