pull/17/head
Guenael 2017-06-23 12:34:23 -04:00
rodzic ac23d2dcfe
commit 697031155b
9 zmienionych plików z 36 dodań i 79 usunięć

3
fano.c
Wyświetl plik

@ -11,9 +11,10 @@
*/
#define LL 1 // Select Layland-Lushbaugh code
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "fano.h"
struct node {

Wyświetl plik

@ -70,8 +70,9 @@ on 1 byte), but shoehorning those bytes into integers efficiently is messy.
#define SELF_TEST 1
#include <stdio.h> /* defines printf for tests */
#include <time.h> /* defines time_t for timings in the test */
#include <stdio.h>
#include <stdint.h>
#include "nhash.h"
//#include <sys/param.h> /* attempt to define endianness */
//#ifdef linux

12
nhash.h
Wyświetl plik

@ -1,14 +1,4 @@
#ifndef NHASH_H_
#define NHASH_H_
#ifdef Win32
#include "win_stdint.h" /* defines uint32_t etc */
#else
#include <stddef.h>
#include <stdint.h> /* defines uint32_t etc */
#endif
#pragma once
uint32_t nhash( const void * key, size_t length, uint32_t initval);
uint32_t nhash_( void const * key, size_t const * length, uint32_t const * initval);
#endif

26
wsprd.c
Wyświetl plik

@ -31,13 +31,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <fftw3.h>
#include "wsprd.h"
@ -59,8 +56,7 @@
#define NSIG NSYM * NSPERSYM
/* Possible PATIENCE options: FFTW_ESTIMATE, FFTW_ESTIMATE_PATIENT, FFTW_MEASURE, FFTW_PATIENT, FFTW_EXHAUSTIVE */
//#define PATIENCE FFTW_ESTIMATE
#define PATIENCE FFTW_MEASURE // FIXME check !!!
#define PATIENCE FFTW_ESTIMATE
uint8_t pr3[NSYM]= {
1,1,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,
@ -80,17 +76,17 @@ fftwf_plan PLAN1,
int32_t printdata=0;
//***************************************************************************
/***********************************************************************
* mode = 0: no frequency or drift search. find best time lag. *
* 1: no time lag or drift search. find best frequency. *
* 2: no frequency or time lag search. calculate soft-decision *
* symbols using passed frequency and shift. *
************************************************************************/
void sync_and_demodulate(float *id, float *qd, long np,
uint8_t *symbols, float *f1, float fstep,
int32_t *shift1, int32_t lagmin, int32_t lagmax, int32_t lagstep,
float *drift1, int32_t symfac, float *sync, int32_t mode) {
/***********************************************************************
* mode = 0: no frequency or drift search. find best time lag. *
* 1: no time lag or drift search. find best frequency. *
* 2: no frequency or time lag search. calculate soft-decision *
* symbols using passed frequency and shift. *
************************************************************************/
float fbest=0.0;
float f0=0.0,fp,ss;
@ -408,8 +404,6 @@ void subtract_signal2(float *id, float *qd, long np,
}
//***************************************************************************
int32_t wspr_decode(float *idat, float *qdat, uint32_t npoints,
struct decoder_options options, struct decoder_results *decodes,
int32_t *n_results) {

Wyświetl plik

@ -11,6 +11,10 @@
Copyright 2014-2015, Steven Franke, K9AN
Minor modifications
Copyright 2016, Guenael Jouchet, VA2GKA
License: GNU GPL v3
This program is free software: you can redistribute it and/or modify
@ -27,10 +31,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/* Option & config of decoder (Shared with the wsprd code) */
struct decoder_options {
uint32_t freq; // Dial frequency

Wyświetl plik

@ -26,11 +26,15 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdint.h>
#include "nhash.h"
#include "wsprd_utils.h"
#ifndef int32_t
#define int32_t int
#endif
void unpack50( signed char *dat, int32_t *n1, int32_t *n2 ) {
int32_t i,i4;

Wyświetl plik

@ -1,23 +1,9 @@
#ifndef WSPRD_UTILS_H
#define WSPRD_UTILS_H
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include "nhash.h"
#pragma once
void unpack50( signed char *dat, int32_t *n1, int32_t *n2 );
int unpackcall( int32_t ncall, char *call );
int unpackgrid( int32_t ngrid, char *grid);
int unpackpfx( int32_t nprefix, char *call);
void deinterleave(unsigned char *sym);
// used by qsort
@ -25,5 +11,3 @@ int doublecomp(const void* elem1, const void* elem2);
int floatcomp(const void* elem1, const void* elem2);
int unpk_( signed char *message, char *hashtab, char *call_loc_pow, char *call, char *loc, char *pwr, char *callsign);
#endif

Wyświetl plik

@ -1,11 +1,18 @@
/*
Functions used by wsprsim
*/
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <ctype.h>
#include "wsprsim_utils.h"
#include "wsprd_utils.h"
#include "nhash.h"
#include "fano.h"
char get_locator_character_code(char ch) {
if( ch >=48 && ch <=57 ) { //0-9
return ch-48;
@ -274,13 +281,6 @@ int get_wspr_channel_symbols(char* rawmessage, char* hashtab, unsigned char* sym
data[9]=0;
data[10]=0;
if( printdata ) {
printf("Data is :");
for (i=0; i<11; i++) {
printf("%02X ",data[i]);
}
printf("\n");
}
// make sure that the 11-byte data vector is unpackable
// unpack it with the routine that the decoder will use and display

Wyświetl plik

@ -1,28 +1,9 @@
#ifndef WSPRSIM_UTILS_H
#define WSPRSIM_UTILS_H
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
extern int printdata;
#pragma once
char get_locator_character_code(char ch);
char get_callsign_character_code(char ch);
long unsigned int pack_grid4_power(char *grid4, int power);
long unsigned int pack_call(char *callsign);
void pack_prefix(char *callsign, int32_t *n, int32_t *m, int32_t *nadd );
void interleave(unsigned char *sym);
int get_wspr_channel_symbols(char* message, char* hashtab, unsigned char* symbols);
#endif