aboutsummaryrefslogtreecommitdiff
path: root/unittest/tesno_est.c
blob: e1985100e8f8fba9c77816e0e090b5e564fa3a35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
}