summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorerdgeist@erdgeist.org <erdgeist@bauklotz.fritz.box>2019-07-04 23:26:09 +0200
committererdgeist@erdgeist.org <erdgeist@bauklotz.fritz.box>2019-07-04 23:26:09 +0200
commitf02dfce6e6c34b3d8a7b8a0e784b506178e331fa (patch)
tree45556e6104242d4702689760433d7321ae74ec17 /main.c
stripdown of version 0.9
Diffstat (limited to 'main.c')
-rw-r--r--main.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..10a0818
--- /dev/null
+++ b/main.c
@@ -0,0 +1,34 @@
1#include <time.h>
2#include <stdio.h>
3
4#include "codec2.h"
5
6int main() {
7 struct timespec tstart={0,0}, tend={0,0};
8 short input[976692];
9 FILE * recoded = fopen("count-recoded.raw", "w+");
10 FILE * f = fopen("count.raw", "r");
11 void * codec2 = codec2_create(CODEC2_MODE_700C);
12 int nsam = codec2_samples_per_frame(codec2);
13 int nbit = codec2_bits_per_frame(codec2);
14 int off = 0;
15 unsigned char bits[128];
16
17 fread(input, 976692, 1, f);
18 fclose(f);
19
20 clock_gettime(CLOCK_MONOTONIC, &tstart);
21
22 while (off < 976692 / 2) {
23 codec2_encode(codec2, bits, input + off);
24 codec2_decode(codec2, input + off, bits);
25 off += 320;
26 }
27
28 clock_gettime(CLOCK_MONOTONIC, &tend);
29 printf("%lf\n", ((double)tend.tv_sec + 1.0e-9*tend.tv_nsec) - ((double)tstart.tv_sec + 1.0e-9*tstart.tv_nsec));
30
31 fwrite(input, 976692, 1, recoded);
32
33 codec2_destroy(codec2);
34}