#include #include #include "codec2.h" int main() { struct timespec tstart={0,0}, tend={0,0}; short input[976692]; FILE * recoded = fopen("count-recoded.raw", "w+"); FILE * f = fopen("count.raw", "r"); void * codec2 = codec2_create(CODEC2_MODE_700C); int nsam = codec2_samples_per_frame(codec2); int nbit = codec2_bits_per_frame(codec2); int off = 0; unsigned char bits[128]; fread(input, 976692, 1, f); fclose(f); clock_gettime(CLOCK_MONOTONIC, &tstart); while (off < 976692 / 2) { codec2_encode(codec2, bits, input + off); codec2_decode(codec2, input + off, bits); off += 320; } clock_gettime(CLOCK_MONOTONIC, &tend); printf("%lf\n", ((double)tend.tv_sec + 1.0e-9*tend.tv_nsec) - ((double)tstart.tv_sec + 1.0e-9*tstart.tv_nsec)); fwrite(input, 976692, 1, recoded); codec2_destroy(codec2); }