FreeCalypso > hg > gsm-codec-lib
view hrutil/encode-r.c @ 630:f85ef5c4d044 default tip
libgsmhr1: provide sizes of state structures
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Thu, 12 Mar 2026 06:19:12 +0000 |
| parents | 32cc4b709e0e |
| children |
line wrap: on
line source
/* * This file is the main module for gsmhr-encode-r utility. This utility * is intended to serve as the "precision" speech encoder for GSM-HR, * reading speech input in robe format and emitting GSM-HR output in * TW-TS-005 Annex B hex format. */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <unistd.h> #include "../libgsmhr1/tw_gsmhr.h" #include "../libtest/roberead.h" main(argc, argv) char **argv; { char *infname, *outfname; FILE *inf, *outf; struct gsmhr_encoder_state *state; int16_t pcm[160]; int16_t prm_out[GSMHR_NUM_PARAMS_ENC]; int opt, rc, dtx = 0, emit_5993 = 0; extern int optind; while ((opt = getopt(argc, argv, "dx")) != EOF) { switch (opt) { case 'd': dtx = 1; continue; case 'x': emit_5993 = 1; continue; default: usage: fprintf(stderr, "usage: %s [-d] [-x] input.robe output.hex\n", argv[0]); exit(1); } } if (argc != optind + 2) goto usage; infname = argv[optind]; outfname = argv[optind+1]; inf = fopen(infname, "r"); if (!inf) { perror(infname); exit(1); } outf = fopen(outfname, "w"); if (!outf) { perror(outfname); exit(1); } state = gsmhr_encoder_create(dtx); if (!state) { perror("gsmhr_encoder_create()"); exit(1); } for (;;) { rc = robe_get_pcm_block(inf, pcm); if (!rc) break; gsmhr_encode_frame(state, pcm, prm_out); emit_cod_to_tw5b(outf, prm_out, emit_5993); } fclose(outf); exit(0); }
