FreeCalypso > hg > vband-misc
view amrdiff/readone-amr.c @ 55:f27bc1e17311
fr-sid/goodsp-frame41.gsmx: starting point
This 33-byte binary file contains frame #41 from good_sp.cod
from GSM 06.32 test sequence set, converted from ETSI *.cod format
into our gsmx format. This frame is an example of a real FRv1 SID.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 22 Aug 2024 05:00:08 +0000 |
parents | 75ba83624a29 |
children |
line wrap: on
line source
/* * This program reads a single frame (the first one) from an AMR *.cod file, * enforces that this frame is MR122 speech, and emits the frame of 244 bits * as comma-separated ASCII. The intent is to extract the DHF in a form * convenient for inclusion in amrdiff source. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "amr_defs.h" main(argc, argv) char **argv; { char *filename; int bigend, rc; FILE *inf; uint8_t amr_bits[COD_FORMAT_NWORDS]; if (argc != 3) { usage: fprintf(stderr, "usage: %s amr-cod-file be|le\n", argv[0]); exit(1); } filename = argv[1]; if (!strcmp(argv[2], "be")) bigend = 1; else if (!strcmp(argv[2], "le")) bigend = 0; else goto usage; inf = fopen(filename, "r"); if (!inf) { perror(filename); exit(1); } rc = read_etsi_bits(inf, bigend, amr_bits, COD_FORMAT_NWORDS, filename); if (!rc) { fprintf(stderr, "error: %s is empty\n", filename); exit(1); } if (amr_bits[0] != TX_SPEECH_GOOD || amr_bits[245] != MR122) { fprintf(stderr, "error: frame type is wrong\n"); exit(1); } emit_frame244(amr_bits + 1); exit(0); }