mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
##2544 bladeRF supports up to 122 MHz sample rate. Adds new 2048 and 4096 half band decimation filters. (#2545)
Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
@@ -29,12 +29,14 @@ import org.slf4j.LoggerFactory;
|
||||
public class DecimationFilterFactory
|
||||
{
|
||||
private static final Logger mLog = LoggerFactory.getLogger(DecimationFilterFactory.class);
|
||||
private static final int[] SUPPORTED_RATES = new int[]{1,2,4,8,16,32,64,128,256,512,1024};
|
||||
public static final int MAXIMUM_DECIMATION_RATE = 4096;
|
||||
private static final int[] SUPPORTED_RATES = new int[]{1,2,4,8,16,32,64,128,256,512,1024,2048,MAXIMUM_DECIMATION_RATE};
|
||||
|
||||
/**
|
||||
* Creates a real-valued decimation filter for float array sample buffers providing approximately 70 dB of
|
||||
* attenuation for out of band signal aliases, when the signal bandwidth is no more than half of the decimated
|
||||
* sample rate. Supports power of 2 decimation rates up to 1024.
|
||||
* sample rate. Supports power of 2 decimation rates up to 4096. Sample buffers must be an integer multiple of the
|
||||
* decimation rate.
|
||||
*
|
||||
* @param decimationRate requested @see SUPPORTED_RATES
|
||||
* @return constructed decimation filter
|
||||
@@ -66,6 +68,10 @@ public class DecimationFilterFactory
|
||||
return new RealDecimateX512Filter();
|
||||
case 1024:
|
||||
return new RealDecimateX1024Filter();
|
||||
case 2048:
|
||||
return new RealDecimateX2048Filter();
|
||||
case 4096:
|
||||
return new RealDecimateX4096Filter();
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported decimation rate: " + decimationRate +
|
||||
". Supported decimation rates are:" + Arrays.toString(SUPPORTED_RATES));
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2026 Dennis Sheirer
|
||||
*
|
||||
* 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.dsp.filter.decimate;
|
||||
|
||||
import io.github.dsheirer.dsp.filter.FilterFactory;
|
||||
import io.github.dsheirer.dsp.window.WindowType;
|
||||
|
||||
/**
|
||||
* Decimate by 2048 filter for real valued sample buffers.
|
||||
*/
|
||||
public class RealDecimateX2048Filter extends RealDecimateX1024Filter
|
||||
{
|
||||
private static final int VALIDATION_LENGTH = 2048;
|
||||
private static final int DECIMATE_BY_2048_FILTER_LENGTH = 11;
|
||||
private static final WindowType DECIMATE_BY_2048_WINDOW_TYPE = WindowType.BLACKMAN;
|
||||
private IRealDecimationFilter mFilter;
|
||||
private float[] mOutput;
|
||||
|
||||
/**
|
||||
* Constructs the decimation filter.
|
||||
*/
|
||||
public RealDecimateX2048Filter()
|
||||
{
|
||||
mFilter = FilterFactory.getRealDecimationFilter(DECIMATE_BY_2048_FILTER_LENGTH,
|
||||
DECIMATE_BY_2048_WINDOW_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] decimateReal(float[] samples)
|
||||
{
|
||||
validate(samples, VALIDATION_LENGTH);
|
||||
|
||||
//Decimate by this filter, then by the parent decimation filter
|
||||
mOutput = getIntermediateOutput(mOutput, samples.length / 2);
|
||||
return super.decimateReal(mFilter.decimateReal(samples, mOutput));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2026 Dennis Sheirer
|
||||
*
|
||||
* 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.dsp.filter.decimate;
|
||||
|
||||
import io.github.dsheirer.dsp.filter.FilterFactory;
|
||||
import io.github.dsheirer.dsp.window.WindowType;
|
||||
|
||||
/**
|
||||
* Decimate by 4096 filter for real valued sample buffers.
|
||||
*/
|
||||
public class RealDecimateX4096Filter extends RealDecimateX2048Filter
|
||||
{
|
||||
private static final int VALIDATION_LENGTH = 4096;
|
||||
private static final int DECIMATE_BY_4096_FILTER_LENGTH = 11;
|
||||
private static final WindowType DECIMATE_BY_4096_WINDOW_TYPE = WindowType.BLACKMAN;
|
||||
private IRealDecimationFilter mFilter;
|
||||
private float[] mOutput;
|
||||
|
||||
/**
|
||||
* Constructs the decimation filter.
|
||||
*/
|
||||
public RealDecimateX4096Filter()
|
||||
{
|
||||
mFilter = FilterFactory.getRealDecimationFilter(DECIMATE_BY_4096_FILTER_LENGTH,
|
||||
DECIMATE_BY_4096_WINDOW_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] decimateReal(float[] samples)
|
||||
{
|
||||
validate(samples, VALIDATION_LENGTH);
|
||||
|
||||
//Decimate by this filter, then by the parent decimation filter
|
||||
mOutput = getIntermediateOutput(mOutput, samples.length / 2);
|
||||
return super.decimateReal(mFilter.decimateReal(samples, mOutput));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user