30 lines
743 B
C++
30 lines
743 B
C++
#include<cstdio>
|
|
|
|
#include<complex>
|
|
|
|
#include "fft-beacon-finder.h"
|
|
#include "costas-beacon-sync.h"
|
|
|
|
int main(int argc, char const *argv[]) {
|
|
|
|
FILE* output = fopen("output.raw", "w");
|
|
FILE* input = fopen("input.raw", "r");
|
|
|
|
FFTBeaconFinder finder(1000000);
|
|
CostasBeaconSync sync(1e-3f, 0.3, -1.0, 1.0);
|
|
|
|
std::complex<float> in;
|
|
while(fread(&in, sizeof(std::complex<float>), 1, input) == 1) {
|
|
std::complex<float> coarse_synced = finder.work(in);
|
|
std::complex<float> sync_correction = sync.work(coarse_synced);
|
|
std::complex<float> out = coarse_synced * sync_correction;
|
|
|
|
fwrite(&out, sizeof(std::complex<float>), 1, output);
|
|
};
|
|
|
|
fclose(input);
|
|
fclose(output);
|
|
|
|
return 0;
|
|
}
|