rtl433
UNKNOWN
RTL-433 utility
|
Various functions for baseband sample processing. More...
Functions | |
static void | calc_squares () |
precalculate lookup table for envelope detection. More... | |
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) |
Something that might look like a IIR lowpass filter. More... | |
int16_t | atan2_int16 (int16_t y, int16_t x) |
Integer implementation of atan2() with int16_t normalized output. 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... | |
int32_t | atan2_int32 (int32_t y, int32_t x) |
for evaluation. 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... | |
Variables | |
static uint16_t | scaled_squares [256] |
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.
Integer implementation of atan2() with int16_t normalized output.
Returns arc tangent of y/x across all quadrants in radians. Error max 0.07 radians. Reference: http://dspguru.com/dsp/tricks/fixed-point-atan2-with-self-normalization
y | Numerator (imaginary value of complex vector) |
x | Denominator (real value of complex vector) |
Referenced by baseband_demod_FM().
for evaluation.
Referenced by baseband_demod_FM_cs16().
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 | ||
) |
Something that might look like a IIR lowpass filter.
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().
|
static |
precalculate lookup table for envelope detection.
References scaled_squares.
Referenced by baseband_init().
This will give a noisy envelope of OOK/ASK signals.
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).
True Magnitude for CU8 (sqrt can SIMD but float is slow).
|
static |
Referenced by calc_squares(), and envelope_detect().