aboutsummaryrefslogtreecommitdiff
path: root/unittest/tesno_est.c
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2025-07-25 10:17:14 +0300
committerMarin Ivanov <[email protected]>2026-01-18 20:09:26 +0200
commit0168586485e6310c598713c911b1dec5618d61a1 (patch)
tree6aabc2a12ef8fef70683f5389bea00f948015f77 /unittest/tesno_est.c
Initial commitHEADmaster
* codec2 cut-down version 1.2.0 * Remove codebook and generation of sources * remove c2dec c2enc binaries * prepare for emscripten
Diffstat (limited to 'unittest/tesno_est.c')
-rw-r--r--unittest/tesno_est.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/unittest/tesno_est.c b/unittest/tesno_est.c
new file mode 100644
index 0000000..8937b1b
--- /dev/null
+++ b/unittest/tesno_est.c
@@ -0,0 +1,32 @@
+/*---------------------------------------------------------------------------*\
+
+ FILE........: tesno_est.c
+ AUTHORS.....: David Rowe
+ DATE CREATED: Mar 2021
+
+ Test for C port of Es/No estimator.
+
+\*---------------------------------------------------------------------------*/
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.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;
+}