diff options
| author | drowe67 <[email protected]> | 2023-07-13 12:25:12 +0930 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2023-07-13 12:25:12 +0930 |
| commit | 276b510f126367a809758b0a62e277515375d948 (patch) | |
| tree | 914c7f0cd0abef614b86c78729f2690d08602134 | |
| parent | 866e0737ab992caf898f091dcf2248152a7ad82e (diff) | |
restore C app for Es/No est test
| -rw-r--r-- | unittest/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | unittest/tesno_est.c | 31 |
2 files changed, 34 insertions, 0 deletions
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index 48a4eb8..656afd0 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -118,3 +118,6 @@ target_link_libraries(mksine m) add_executable(vq_mbest vq_mbest.c) target_link_libraries(vq_mbest codec2) + +add_executable(tesno_est tesno_est.c) +target_link_libraries(tesno_est m codec2)
\ No newline at end of file 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; +} |
