aboutsummaryrefslogtreecommitdiff
path: root/unittest/tesno_est.c
diff options
context:
space:
mode:
authorAuthor Name <[email protected]>2023-07-07 12:20:59 +0930
committerDavid Rowe <[email protected]>2023-07-07 12:29:06 +0930
commitac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch)
treea2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /unittest/tesno_est.c
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'unittest/tesno_est.c')
-rw-r--r--unittest/tesno_est.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/unittest/tesno_est.c b/unittest/tesno_est.c
new file mode 100644
index 0000000..e198510
--- /dev/null
+++ b/unittest/tesno_est.c
@@ -0,0 +1,31 @@
+/*---------------------------------------------------------------------------*\
+
+ FILE........: tesno_est.c
+ AUTHORS.....: David Rowe
+ DATE CREATED: Mar 2021
+
+ Test for C port of Es/No estimator.
+
+\*---------------------------------------------------------------------------*/
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "ofdm_internal.h"
+
+int main(int argc, char *argv[])
+{
+ FILE *fin = fopen(argv[1],"rb"); assert(fin != NULL);
+ size_t nsym = atoi(argv[2]); assert(nsym >= 0);
+ complex float rx_sym[nsym];
+ size_t nread = fread(rx_sym, sizeof(complex float), nsym, fin);
+ assert(nread == nsym);
+ fclose(fin);
+
+ float EsNodB = ofdm_esno_est_calc(rx_sym, nsym);
+ printf("%f\n",EsNodB);
+
+ return 0;
+}