FreeCalypso > hg > gsm-codec-lib
diff hrutil/cod-parse.c @ 515:bb36ef735f25
hrutil: starting with gsmhr-cod-parse
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 30 Aug 2024 08:05:07 +0000 |
parents | efrtest/cod-parse.c@46a6e6b6841a |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hrutil/cod-parse.c Fri Aug 30 08:05:07 2024 +0000 @@ -0,0 +1,46 @@ +/* + * This program reads an HRv1 *.cod file in ETSI test sequence format + * (encoder output format) and displays its content in human-readable form. + */ + +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include "../libgsmhr1/tw_gsmhr.h" + +main(argc, argv) + char **argv; +{ + char *infname; + FILE *inf; + int big_endian; + unsigned frame_no; + int16_t params[GSMHR_NUM_PARAMS_ENC]; + int rc; + + if (argc == 2 && argv[1][0] != '-') { + big_endian = 0; + infname = argv[1]; + } else if (argc == 3 && !strcmp(argv[1], "-b")) { + big_endian = 1; + infname = argv[2]; + } else { + fprintf(stderr, "usage: %s [-b] file.cod\n", argv[0]); + exit(1); + } + inf = fopen(infname, "r"); + if (!inf) { + perror(infname); + exit(1); + } + for (frame_no = 0; ; frame_no++) { + rc = read_cod_frame(inf, big_endian, params, infname, frame_no); + if (!rc) + break; + printf("#%u: VAD=%d SP=%d\n", frame_no, params[18], params[19]); + print_frame_params(params); + } + exit(0); +}