FreeCalypso > hg > vband-misc
view dhf/efr-dhf-hexout.c @ 49:2daadef1e70d
efr-sid OS#6538: more sensible 15-bit and 16-bit errors
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 12 Aug 2024 02:37:21 +0000 |
parents | 307fe06fabec |
children |
line wrap: on
line source
/* * This little program takes EFR and MR122 DHFs provided in array-of-params * form by libtwamr, turns them into EFR RTP format using libgsmefr function, * and emits those two RTP-encoded EFR frames in hex, for inclusion in other * C sources. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <gsm_efr.h> #include <tw_amr.h> static void emit_one_frame(params, filename, cname) const int16_t *params; char *filename, *cname; { uint8_t efr_rtp[EFR_RTP_FRAME_LEN]; FILE *outf; unsigned n; EFR_params2frame(params, efr_rtp); outf = fopen(filename, "w"); if (!outf) { perror(filename); exit(1); } fputs("#include <stdint.h>\n\n", outf); fprintf(outf, "const uint8_t %s[31] = {\n", cname); for (n = 0; n < EFR_RTP_FRAME_LEN; n++) { fprintf(outf, "0x%02X,", efr_rtp[n]); if (n == 15 || n == 30) putc('\n', outf); } fputs("};\n", outf); fclose(outf); } main(argc, argv) char **argv; { if (argc != 3) { fprintf(stderr, "usage: %s efr-dhf-out mr122-dhf-out\n", argv[0]); exit(1); } emit_one_frame(amr_dhf_gsmefr, argv[1], "efr_dhf_bytes"); emit_one_frame(amr_dhf_mr122, argv[2], "mr122_dhf_bytes"); exit(0); }