FreeCalypso > hg > gsm-codec-lib
comparison efrtest/etsi-dec.c @ 435:9f354d2aea13
efrtest: split etsi-dec.c for code reuse
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 08 May 2024 05:25:47 +0000 |
| parents | da17c7f02c6c |
| children |
comparison
equal
deleted
inserted
replaced
| 434:ba5031723ab6 | 435:9f354d2aea13 |
|---|---|
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 #include <string.h> | 14 #include <string.h> |
| 15 #include <strings.h> | 15 #include <strings.h> |
| 16 #include "../libgsmefr/gsm_efr.h" | 16 #include "../libgsmefr/gsm_efr.h" |
| 17 #include "etsi.h" | 17 #include "etsi.h" |
| 18 | |
| 19 static void | |
| 20 write_pcm_be(outf, pcm) | |
| 21 FILE *outf; | |
| 22 int16_t *pcm; | |
| 23 { | |
| 24 uint8_t bytes[320], *dp; | |
| 25 int16_t samp; | |
| 26 unsigned n; | |
| 27 | |
| 28 dp = bytes; | |
| 29 for (n = 0; n < 160; n++) { | |
| 30 samp = pcm[n]; | |
| 31 *dp++ = (samp >> 8) & 0xFF; | |
| 32 *dp++ = samp & 0xFF; | |
| 33 } | |
| 34 fwrite(bytes, 2, 160, outf); | |
| 35 } | |
| 36 | |
| 37 static void | |
| 38 write_pcm_le(outf, pcm) | |
| 39 FILE *outf; | |
| 40 int16_t *pcm; | |
| 41 { | |
| 42 uint8_t bytes[320], *dp; | |
| 43 int16_t samp; | |
| 44 unsigned n; | |
| 45 | |
| 46 dp = bytes; | |
| 47 for (n = 0; n < 160; n++) { | |
| 48 samp = pcm[n]; | |
| 49 *dp++ = samp & 0xFF; | |
| 50 *dp++ = (samp >> 8) & 0xFF; | |
| 51 } | |
| 52 fwrite(bytes, 2, 160, outf); | |
| 53 } | |
| 54 | 18 |
| 55 main(argc, argv) | 19 main(argc, argv) |
| 56 char **argv; | 20 char **argv; |
| 57 { | 21 { |
| 58 int big_endian; | 22 int big_endian; |
