mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-04-05 14:37:02 +00:00
Remove the DC blocker from DMR.
This commit is contained in:
parent
ba81fa7396
commit
669acb99e8
8 changed files with 99 additions and 50 deletions
30
IO.cpp
30
IO.cpp
|
|
@ -36,10 +36,6 @@ const uint16_t GAUSSIAN_0_5_FILTER_LEN = 12U;
|
|||
static q15_t BOXCAR_FILTER[] = {12000, 12000, 12000, 12000, 12000, 0};
|
||||
const uint16_t BOXCAR_FILTER_LEN = 6U;
|
||||
|
||||
// Generated using [b, a] = butter(1, 0.001) in MATLAB
|
||||
static q31_t DC_FILTER[] = {3367972, 0, 3367972, 0, 2140747704, 0}; // {b0, 0, b1, b2, -a1, -a2}
|
||||
const uint32_t DC_FILTER_STAGES = 1U; // One Biquad stage
|
||||
|
||||
const uint16_t DC_OFFSET = 2048U;
|
||||
|
||||
CIO::CIO() :
|
||||
|
|
@ -66,14 +62,11 @@ m_detect(false),
|
|||
m_adcOverflow(0U),
|
||||
m_dacOverflow(0U),
|
||||
m_watchdog(0U),
|
||||
m_lockout(false),
|
||||
m_dcFilter(),
|
||||
m_dcState()
|
||||
m_lockout(false)
|
||||
{
|
||||
::memset(m_rrcState, 0x00U, 70U * sizeof(q15_t));
|
||||
::memset(m_gaussianState, 0x00U, 40U * sizeof(q15_t));
|
||||
::memset(m_boxcarState, 0x00U, 30U * sizeof(q15_t));
|
||||
::memset(m_dcState, 0x00U, 4U * sizeof(q31_t));
|
||||
|
||||
m_rrcFilter.numTaps = RRC_0_2_FILTER_LEN;
|
||||
m_rrcFilter.pState = m_rrcState;
|
||||
|
|
@ -87,11 +80,6 @@ m_dcState()
|
|||
m_boxcarFilter.pState = m_boxcarState;
|
||||
m_boxcarFilter.pCoeffs = BOXCAR_FILTER;
|
||||
|
||||
m_dcFilter.numStages = DC_FILTER_STAGES;
|
||||
m_dcFilter.pState = m_dcState;
|
||||
m_dcFilter.pCoeffs = DC_FILTER;
|
||||
m_dcFilter.postShift = 0;
|
||||
|
||||
initInt();
|
||||
}
|
||||
|
||||
|
|
@ -168,22 +156,6 @@ void CIO::process()
|
|||
|
||||
if (m_lockout)
|
||||
return;
|
||||
|
||||
q31_t dcLevel = 0;
|
||||
q31_t dcVals[20];
|
||||
q31_t q31Samples[20U];
|
||||
|
||||
::arm_q15_to_q31(samples, q31Samples, RX_BLOCK_SIZE);
|
||||
::arm_biquad_cascade_df1_q31(&m_dcFilter, q31Samples, dcVals, RX_BLOCK_SIZE);
|
||||
|
||||
for (uint8_t i = 0U; i < RX_BLOCK_SIZE; i++)
|
||||
dcLevel += dcVals[i];
|
||||
dcLevel /= RX_BLOCK_SIZE;
|
||||
|
||||
q15_t offset = q15_t(dcLevel >> 16);
|
||||
|
||||
for (uint8_t i = 0U; i < RX_BLOCK_SIZE; i++)
|
||||
samples[i] -= offset;
|
||||
|
||||
if (m_modemState == STATE_IDLE) {
|
||||
if (m_dstarEnable) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue