From: drowe67 Date: Thu, 24 Jul 2014 03:36:15 +0000 (+0000) Subject: resampler unit test X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=fa02c9d8fce178909fece67f49c75bd763332846;p=freetel-svn-tracking.git resampler unit test git-svn-id: https://svn.code.sf.net/p/freetel/code@1769 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/unittest/t16_8.c b/codec2-dev/unittest/t16_8.c new file mode 100644 index 00000000..c9ad3f5f --- /dev/null +++ b/codec2-dev/unittest/t16_8.c @@ -0,0 +1,112 @@ +/* + t16_8.c + David Rowe + May 10 2012 + + Unit test for 16 to 8 kHz sample rate conversion functions. I + evaluated output by plotting using Octave and looking for jaggies: + + pl("../unittest/out16.raw",1,3000) + pl("../unittest/out8.raw",1,3000) + + Listening to it also shows up anything nasty: + + $ play -s -2 -r 16000 out16.raw + $ play -s -2 -r 8000 out8.raw + + */ + +#include +#include +#include +#include +#include "codec2_fdmdv.h" + +#define N8 160 /* procssing buffer size at 8 kHz */ +#define N16 (N8*FDMDV_OS) +#define MEM8 (FDMDV_OS_TAPS/FDMDV_OS) +#define FRAMES 50 +#define TWO_PI 6.283185307 +#define FS 8000 + +#define SINE + +int main() { + float in8k[MEM8 + N8]; + float out16k[N16]; + short out16k_short[N16]; + FILE *f16; + + float in16k[FDMDV_OS_TAPS + N16]; + float out8k[N16]; + short out8k_short[N8]; + FILE *f8; + + int i,f,t,t1; + float freq = 800.0; + + f16 = fopen("out16.raw", "wb"); + assert(f16 != NULL); + f8 = fopen("out8.raw", "wb"); + assert(f8 != NULL); + + /* clear filter memories */ + + for(i=0; i