-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for power-of-2 decimation for both real and complex samp…
…le buffers. Creates new class to analyze the filter attenuation rates using a variety of filter lengths and window options to enable selecting the optimal combination of cascaded power-of-2 half band decimation filters. (#1127) Co-authored-by: Dennis Sheirer <dsheirer@github.com>
- Loading branch information
Showing
33 changed files
with
1,795 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/main/java/io/github/dsheirer/dsp/filter/decimate/ComplexDecimateX1024Filter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* ***************************************************************************** | ||
* Copyright (C) 2014-2021 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.filter.Window; | ||
import io.github.dsheirer.dsp.filter.halfband.complex.ComplexHalfBandDecimationFilter; | ||
|
||
/** | ||
* Decimate by 1024 filter for complex valued sample buffers. | ||
*/ | ||
public class ComplexDecimateX1024Filter extends ComplexDecimateX512Filter | ||
{ | ||
private static final int VALIDATION_LENGTH = 1024 * 2; | ||
private static final int DECIMATE_BY_1024_FILTER_LENGTH = 11; | ||
private static final Window.WindowType DECIMATE_BY_1024_WINDOW_TYPE = Window.WindowType.BLACKMAN; | ||
private ComplexHalfBandDecimationFilter mFilter; | ||
|
||
/** | ||
* Constructs the decimation filter. | ||
*/ | ||
public ComplexDecimateX1024Filter() | ||
{ | ||
mFilter = new ComplexHalfBandDecimationFilter(FilterFactory.getHalfBand(DECIMATE_BY_1024_FILTER_LENGTH, | ||
DECIMATE_BY_1024_WINDOW_TYPE)); | ||
} | ||
|
||
@Override | ||
public float[] decimateComplex(float[] samples) | ||
{ | ||
validate(samples, VALIDATION_LENGTH); | ||
|
||
//Decimate by this filter, then by the parent decimation filter | ||
return super.decimateComplex(mFilter.decimateComplex(samples)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/io/github/dsheirer/dsp/filter/decimate/ComplexDecimateX128Filter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* ***************************************************************************** | ||
* Copyright (C) 2014-2021 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.filter.Window; | ||
import io.github.dsheirer.dsp.filter.halfband.complex.ComplexHalfBandDecimationFilter; | ||
|
||
/** | ||
* Decimate by 128 filter for complex valued sample buffers. | ||
*/ | ||
public class ComplexDecimateX128Filter extends ComplexDecimateX64Filter | ||
{ | ||
private static final int VALIDATION_LENGTH = 128 * 2; | ||
private static final int DECIMATE_BY_128_FILTER_LENGTH = 11; | ||
private static final Window.WindowType DECIMATE_BY_128_WINDOW_TYPE = Window.WindowType.BLACKMAN; | ||
private ComplexHalfBandDecimationFilter mFilter; | ||
|
||
/** | ||
* Constructs the decimation filter. | ||
*/ | ||
public ComplexDecimateX128Filter() | ||
{ | ||
mFilter = new ComplexHalfBandDecimationFilter(FilterFactory.getHalfBand(DECIMATE_BY_128_FILTER_LENGTH, | ||
DECIMATE_BY_128_WINDOW_TYPE)); | ||
} | ||
|
||
@Override | ||
public float[] decimateComplex(float[] samples) | ||
{ | ||
validate(samples, VALIDATION_LENGTH); | ||
|
||
//Decimate by this filter, then by the parent decimation filter | ||
return super.decimateComplex(mFilter.decimateComplex(samples)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/io/github/dsheirer/dsp/filter/decimate/ComplexDecimateX16Filter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* ***************************************************************************** | ||
* Copyright (C) 2014-2021 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.filter.Window; | ||
import io.github.dsheirer.dsp.filter.halfband.complex.ComplexHalfBandDecimationFilter; | ||
|
||
/** | ||
* Decimate by 16 filter for complex valued sample buffers. | ||
*/ | ||
public class ComplexDecimateX16Filter extends ComplexDecimateX8Filter | ||
{ | ||
private static final int VALIDATION_LENGTH = 16 * 2; | ||
private static final int DECIMATE_BY_16_FILTER_LENGTH = 15; | ||
private static final Window.WindowType DECIMATE_BY_16_WINDOW_TYPE = Window.WindowType.BLACKMAN; | ||
private ComplexHalfBandDecimationFilter mFilter; | ||
|
||
/** | ||
* Constructs the decimation filter. | ||
*/ | ||
public ComplexDecimateX16Filter() | ||
{ | ||
mFilter = new ComplexHalfBandDecimationFilter(FilterFactory.getHalfBand(DECIMATE_BY_16_FILTER_LENGTH, | ||
DECIMATE_BY_16_WINDOW_TYPE)); | ||
} | ||
|
||
@Override | ||
public float[] decimateComplex(float[] samples) | ||
{ | ||
validate(samples, VALIDATION_LENGTH); | ||
|
||
//Decimate by this filter, then by the parent decimation filter | ||
return super.decimateComplex(mFilter.decimateComplex(samples)); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/io/github/dsheirer/dsp/filter/decimate/ComplexDecimateX256Filter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* ***************************************************************************** | ||
* Copyright (C) 2014-2021 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.filter.Window; | ||
import io.github.dsheirer.dsp.filter.halfband.complex.ComplexHalfBandDecimationFilter; | ||
|
||
/** | ||
* Decimate by 256 filter for complex valued sample buffers. | ||
*/ | ||
public class ComplexDecimateX256Filter extends ComplexDecimateX128Filter | ||
{ | ||
private static final int VALIDATION_LENGTH = 256 * 2; | ||
private static final int DECIMATE_BY_256_FILTER_LENGTH = 11; | ||
private static final Window.WindowType DECIMATE_BY_256_WINDOW_TYPE = Window.WindowType.BLACKMAN; | ||
private ComplexHalfBandDecimationFilter mFilter; | ||
|
||
/** | ||
* Constructs the decimation filter. | ||
*/ | ||
public ComplexDecimateX256Filter() | ||
{ | ||
mFilter = new ComplexHalfBandDecimationFilter(FilterFactory.getHalfBand(DECIMATE_BY_256_FILTER_LENGTH, | ||
DECIMATE_BY_256_WINDOW_TYPE)); | ||
} | ||
|
||
@Override | ||
public float[] decimateComplex(float[] samples) | ||
{ | ||
validate(samples, VALIDATION_LENGTH); | ||
|
||
//Decimate by this filter, then by the parent decimation filter | ||
return super.decimateComplex(mFilter.decimateComplex(samples)); | ||
} | ||
} |
Oops, something went wrong.