FreeCalypso > hg > gsm-net-reveng
view trau-ul-prep/efrdec2tsrc.c @ 41:b5feb04b212c
top Makefile: add v110 subdir
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 12 Sep 2024 21:56:29 +0000 |
parents | 8957383370c5 |
children |
line wrap: on
line source
/* * This program reads an EFR *.dec file in ETSI test sequence format * and converts it into ASCII source for TRAU-UL construction. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <unistd.h> #include <gsm_efr.h> #include "etsi.h" main(argc, argv) char **argv; { char *infname, *outfname; FILE *inf, *outf; int big_endian = 0; 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; extern int optind; while ((rc = getopt(argc, argv, "b")) != EOF) { switch (rc) { case 'b': big_endian = 1; continue; default: usage: fprintf(stderr, "usage: %s [-b] input.dec [output.tsrc]\n", argv[0]); exit(1); } } if (argc < optind + 1 || argc > optind + 2) goto usage; infname = argv[optind]; outfname = argv[optind+1]; inf = fopen(infname, "r"); if (!inf) { perror(infname); exit(1); } if (outfname) { outf = fopen(outfname, "w"); if (!outf) { perror(outfname); exit(1); } } else outf = stdout; for (frame_no = 0; ; frame_no++) { rc = read_etsi_bits(inf, big_endian, input_bits, ETSI_DEC_NWORDS, infname); if (!rc) break; bits2frame(input_bits + 1, frame, infname, frame_no); fprintf(outf, "# input frame %u\nFrame_EFR {\n", frame_no); if (input_bits[246]) fputs("\t# TAF position\n", outf); fprintf(outf, "\tBFI %u\n", input_bits[0]); EFR_frame2params(frame, params); n = 0; fputs("\tLPC", outf); for (i = 0; i < 5; i++) fprintf(outf, " %d", params[n++]); putc('\n', outf); for (i = 0; i < 4; i++) { fputs("\tsf", outf); for (j = 0; j < 13; j++) fprintf(outf, " %d", params[n++]); putc('\n', outf); } fprintf(outf, "\tSID %u\n", input_bits[245]); fputs("}\n\n", outf); } exit(0); }