restore C app for Es/No est test

ms-warning-cleanup-2
drowe67 2023-07-13 12:25:12 +09:30 committed by David Rowe
parent 866e0737ab
commit 276b510f12
2 changed files with 34 additions and 0 deletions

View File

@ -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)

View File

@ -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;
}