rtl433
UNKNOWN
RTL-433 utility
|
Various functions for baseband sample processing. More...
Go to the source code of this file.
Data Structures | |
struct | filter_state |
Filter state buffer. More... | |
struct | demodfm_state |
FM_Demod state buffer. More... | |
Typedefs | |
typedef struct filter_state | filter_state_t |
Filter state buffer. More... | |
typedef struct demodfm_state | demodfm_state_t |
FM_Demod state buffer. More... | |
Functions | |
void | envelope_detect (uint8_t const *iq_buf, uint16_t *y_buf, uint32_t len) |
This will give a noisy envelope of OOK/ASK signals. More... | |
void | envelope_detect_nolut (uint8_t const *iq_buf, uint16_t *y_buf, uint32_t len) |
This will give a noisy envelope of OOK/ASK signals. More... | |
void | magnitude_est_cu8 (uint8_t const *iq_buf, uint16_t *y_buf, uint32_t len) |
122/128, 51/128 Magnitude Estimator for CU8 (SIMD has min/max). More... | |
void | magnitude_true_cu8 (uint8_t const *iq_buf, uint16_t *y_buf, uint32_t len) |
True Magnitude for CU8 (sqrt can SIMD but float is slow). More... | |
void | magnitude_est_cs16 (int16_t const *iq_buf, uint16_t *y_buf, uint32_t len) |
122/128, 51/128 Magnitude Estimator for CS16 (SIMD has min/max). More... | |
void | magnitude_true_cs16 (int16_t const *iq_buf, uint16_t *y_buf, uint32_t len) |
True Magnitude for CS16 (sqrt can SIMD but float is slow). More... | |
void | baseband_low_pass_filter (uint16_t const *x_buf, int16_t *y_buf, uint32_t len, filter_state_t *state) |
Lowpass filter. More... | |
void | baseband_demod_FM (uint8_t const *x_buf, int16_t *y_buf, unsigned long num_samples, demodfm_state_t *state) |
FM demodulator. More... | |
void | baseband_demod_FM_cs16 (int16_t const *x_buf, int16_t *y_buf, unsigned long num_samples, demodfm_state_t *state) |
For evaluation. More... | |
void | baseband_init (void) |
Initialize tables and constants. More... | |
Various functions for baseband sample processing.
Copyright (C) 2012 by Benjamin Larsson benja Copyright (C) 2015 Tommy Vestermark min@ south pole .se
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
typedef struct demodfm_state demodfm_state_t |
FM_Demod state buffer.
typedef struct filter_state filter_state_t |
Filter state buffer.
void baseband_demod_FM | ( | uint8_t const * | x_buf, |
int16_t * | y_buf, | ||
unsigned long | num_samples, | ||
demodfm_state_t * | state | ||
) |
FM demodulator.
Function is stateful
x_buf | input samples (I/Q samples in interleaved uint8) | |
[out] | y_buf | output from FM demodulator |
len | number of samples to process | |
[in,out] | state | State to store between chunk processing |
[b,a] = butter(1, 0.1) -> 3x tau (95%) ~10 samples
[b,a] = butter(1, 0.2) -> 3x tau (95%) ~5 samples
References atan2_int16(), demodfm_state::bi, demodfm_state::br, demodfm_state::xlp, and demodfm_state::ylp.
Referenced by sdr_callback().
void baseband_demod_FM_cs16 | ( | int16_t const * | x_buf, |
int16_t * | y_buf, | ||
unsigned long | num_samples, | ||
demodfm_state_t * | state | ||
) |
For evaluation.
For evaluation.
[b,a] = butter(1, 0.1) -> 3x tau (95%) ~10 samples
[b,a] = butter(1, 0.2) -> 3x tau (95%) ~5 samples
References atan2_int32(), demodfm_state::bi, demodfm_state::br, demodfm_state::xlp, and demodfm_state::ylp.
Referenced by sdr_callback().
void baseband_init | ( | void | ) |
Initialize tables and constants.
Should be called once at startup.
References calc_squares().
Referenced by main().
void baseband_low_pass_filter | ( | uint16_t const * | x_buf, |
int16_t * | y_buf, | ||
uint32_t | len, | ||
filter_state_t * | state | ||
) |
Lowpass filter.
Function is stateful
x_buf | input samples to be filtered | |
[out] | y_buf | output from filter |
len | number of samples to process | |
[in,out] | state | State to store between chunk processing |
Lowpass filter.
[b,a] = butter(1, Wc) # low pass filter with cutoff pi*Wc radians Q1.15*Q15.0 = Q16.15 Q16.15>>1 = Q15.14 Q15.14 + Q15.14 + Q15.14 could possibly overflow to 17.14 but the b coeffs are small so it wont happen Q15.14>>14 = Q15.0 /
[b,a] = butter(1, 0.01) -> 3x tau (95%) ~100 samples
[b,a] = butter(1, 0.05) -> 3x tau (95%) ~20 samples
References filter_state::x, and filter_state::y.
Referenced by sdr_callback().
This will give a noisy envelope of OOK/ASK signals.
Subtract the bias (-128) and get an envelope estimation (absolute squared)
iq_buf | input samples (I/Q samples in interleaved uint8) | |
[out] | y_buf | output |
len | number of samples to process |
Subtract the bias (-128) and get an envelope estimation The output will be written in the input buffer
References scaled_squares.
Referenced by sdr_callback().
This will give a noisy envelope of OOK/ASK signals.
Subtracts the bias (-128) and calculates the norm (scaled by 16384). Using a LUT is slower for O1 and above.
122/128, 51/128 Magnitude Estimator for CS16 (SIMD has min/max).
Referenced by sdr_callback().
122/128, 51/128 Magnitude Estimator for CU8 (SIMD has min/max).
Note that magnitude emphasizes quiet signals / deemphasizes loud signals.
True Magnitude for CS16 (sqrt can SIMD but float is slow).