GNU Radio's DSD Package
p25p1_heuristics.h
Go to the documentation of this file.
1
2#ifndef P25P1_HEURISTICS_H_030dd3530b7546abbb56f8dd1e66a2f6
3#define P25P1_HEURISTICS_H_030dd3530b7546abbb56f8dd1e66a2f6
4
5#define HEURISTICS_SIZE 200
6typedef struct
7{
10 int index;
11 int count;
12 float sum;
13 float var_sum;
15
16typedef struct
17{
18 unsigned int bit_count;
19 unsigned int bit_error_count;
22
23typedef struct
24{
25 int value;
26 int dibit;
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
35/**
36 * Initializes the heuristics state.
37 * \param heuristics The P25Heuristics structure to initialize.
38 */
40
41/**
42 * Important method that estimates the most likely symbol for a given analog signal value and previous dibit.
43 * This is called by the digitizer.
44 * \param rf_mod Indicates the modulation used. The previous dibit is only used on C4FM.
45 * \param heuristics Pointer to the P25Heuristics module with all the needed state information.
46 * \param previous_dibit The previous dibit.
47 * \param analog_value The signal's analog value we want to interpret as a dibit.
48 * \param dibit Address were to store the estimated dibit.
49 * \return A boolean set to true if we are able to estimate a dibit. The reason why we might not be able
50 * to estimate it is because we don't have enough information to model the Gaussians (not enough data
51 * has been passed to contribute_to_heuristics).
52 */
53int estimate_symbol(int rf_mod, P25Heuristics* heuristics, int previous_dibit, int analog_value, int* dibit);
54
55/**
56 * Log some useful information on the heuristics state.
57 */
58void debug_print_heuristics(P25Heuristics* heuristics);
59
60/**
61 * This method contributes valuable information from dibits whose value we are confident is correct. We take
62 * the dibits and corresponding analog signal values to model the Gaussians for each dibit (and previous
63 * dibit if enabled).
64 * \param rf_mod Indicates the modulation used. The previous dibit is only used on C4FM.
65 * \param heuristics Pointer to the P25Heuristics module with all the needed state information.
66 * \param analog_signal_array Sequence of AnalogSignal which contain the cleared dibits and analog values.
67 * \param count number of cleared dibits passed (= number of elements to use from analog_signal_array).
68 */
69void contribute_to_heuristics(int rf_mod, P25Heuristics* heuristics, AnalogSignal* analog_signal_array, int count);
70
71/**
72 * Updates the estimate for the BER (bit error rate). Mind this is method is not called for every single
73 * bit in the data stream but only for those bits over which we have an estimate of its error rate,
74 * specifically the bits that are protected by Reed-Solomon codes.
75 * \param heuristics The heuristics state.
76 * \param bits The number of bits we have read.
77 * \param errors The number of errors we estimate in those bits.
78 */
79void update_error_stats(P25Heuristics* heuristics, int bits, int errors);
80
81/**
82 * Returns the estimate for the BER (bit error rate).
83 * \return The estimated BER. This is just the percentage of errors over the processed bits.
84 */
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif // P25P1_HEURISTICS_H_030dd3530b7546abbb56f8dd1e66a2f6
float get_P25_BER_estimate(P25Heuristics *heuristics)
void update_error_stats(P25Heuristics *heuristics, int bits, int errors)
int estimate_symbol(int rf_mod, P25Heuristics *heuristics, int previous_dibit, int analog_value, int *dibit)
void initialize_p25_heuristics(P25Heuristics *heuristics)
#define HEURISTICS_SIZE
Definition p25p1_heuristics.h:5
void contribute_to_heuristics(int rf_mod, P25Heuristics *heuristics, AnalogSignal *analog_signal_array, int count)
Definition p25p1_heuristics.h:24
int dibit
Definition p25p1_heuristics.h:26
int value
Definition p25p1_heuristics.h:25
int corrected_dibit
Definition p25p1_heuristics.h:27
int sequence_broken
Definition p25p1_heuristics.h:28
Definition p25p1_heuristics.h:17
SymbolHeuristics symbols[4][4]
Definition p25p1_heuristics.h:20
unsigned int bit_count
Definition p25p1_heuristics.h:18
unsigned int bit_error_count
Definition p25p1_heuristics.h:19
Definition p25p1_heuristics.h:7
int index
Definition p25p1_heuristics.h:10
float means[HEURISTICS_SIZE]
Definition p25p1_heuristics.h:9
int count
Definition p25p1_heuristics.h:11
float var_sum
Definition p25p1_heuristics.h:13
int values[HEURISTICS_SIZE]
Definition p25p1_heuristics.h:8
float sum
Definition p25p1_heuristics.h:12