The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
A filter class for partitioned convolution. More...
Classes | |
struct | index_t |
Bookkeeping class. More... | |
Public Member Functions | |
partitioned_convolution_t (unsigned int fragsize, unsigned int nchannels_in, unsigned int nchannels_out, const transfer_matrix_t &transfer) | |
Create a new partitioned convolver. More... | |
~partitioned_convolution_t () | |
Free fftw resource allocated in constructor. More... | |
mha_wave_t * | process (const mha_wave_t *s_in) |
processing More... | |
Public Attributes | |
unsigned int | fragsize |
Audio fragment size, always equal to partition size. More... | |
unsigned int | nchannels_in |
Number of audio input channels. More... | |
unsigned int | nchannels_out |
Number of audio output channels. More... | |
unsigned int | output_partitions |
The maximum number of partitions in any of the impulse responses. More... | |
unsigned int | filter_partitions |
The total number of non-zero impulse response partitions. More... | |
MHASignal::waveform_t | input_signal_wave |
Buffer for input signal. More... | |
unsigned int | current_input_signal_buffer_half_index |
A counter modulo 2. More... | |
MHASignal::spectrum_t | input_signal_spec |
Buffer for FFT transformed input signal. More... | |
MHASignal::spectrum_t | frequency_response |
Buffers for frequency response spectra of impulse response partitions. More... | |
std::vector< index_t > | bookkeeping |
Keeps track of input channels, output channels, impulse response partition, and delay. More... | |
std::vector< MHASignal::spectrum_t > | output_signal_spec |
Buffers for FFT transformed output signal. More... | |
unsigned int | current_output_partition_index |
A counter modulo output_partitions, indexing the "current" output partition. More... | |
MHASignal::waveform_t | output_signal_wave |
Buffer for the wave output signal. More... | |
mha_fft_t | fft |
The FFT transformer. More... | |
A filter class for partitioned convolution.
Impulse responses are partitioned into sections of fragment size. Audio signal is convolved with every partition and delayed as needed. Convolution is done according to overlap-save. FFT length used is 2 times fragment size.
MHAFilter::partitioned_convolution_t::partitioned_convolution_t | ( | unsigned int | fragsize, |
unsigned int | nchannels_in, | ||
unsigned int | nchannels_out, | ||
const transfer_matrix_t & | transfer | ||
) |
Create a new partitioned convolver.
fragsize | Audio fragment size, equal to partition size. |
nchannels_in | Number of input audio channels. |
nchannels_out | Number of output audio channels. |
transfer | A sparse matrix of impulse responses. |
MHAFilter::partitioned_convolution_t::~partitioned_convolution_t | ( | ) |
Free fftw resource allocated in constructor.
mha_wave_t * MHAFilter::partitioned_convolution_t::process | ( | const mha_wave_t * | s_in | ) |
processing
unsigned int MHAFilter::partitioned_convolution_t::fragsize |
Audio fragment size, always equal to partition size.
unsigned int MHAFilter::partitioned_convolution_t::nchannels_in |
Number of audio input channels.
unsigned int MHAFilter::partitioned_convolution_t::nchannels_out |
Number of audio output channels.
unsigned int MHAFilter::partitioned_convolution_t::output_partitions |
The maximum number of partitions in any of the impulse responses.
Determines the size if the delay line.
unsigned int MHAFilter::partitioned_convolution_t::filter_partitions |
The total number of non-zero impulse response partitions.
MHASignal::waveform_t MHAFilter::partitioned_convolution_t::input_signal_wave |
Buffer for input signal.
Has nchannels_in channels and fragsize*2 frames
unsigned int MHAFilter::partitioned_convolution_t::current_input_signal_buffer_half_index |
A counter modulo 2.
Indicates the buffer half in input signal wave into which to copy the current input signal.
MHASignal::spectrum_t MHAFilter::partitioned_convolution_t::input_signal_spec |
Buffer for FFT transformed input signal.
Has nchannels_in channels and fragsize+1 frames (fft bins).
MHASignal::spectrum_t MHAFilter::partitioned_convolution_t::frequency_response |
Buffers for frequency response spectra of impulse response partitions.
Each "channel" contains another partition of some impulse response. The bookkeeping array is used to keep track what to do with these frequency responses. This container has filter_partitions channels and fragsize+1 frames (fft bins).
std::vector<index_t> MHAFilter::partitioned_convolution_t::bookkeeping |
Keeps track of input channels, output channels, impulse response partition, and delay.
The index into this array is the same as the "channel" index into the frequency_response array. Array has filter_partitions entries.
std::vector<MHASignal::spectrum_t> MHAFilter::partitioned_convolution_t::output_signal_spec |
Buffers for FFT transformed output signal.
For each array member, Number of channels is equal to nchannels_out, number of frames (fft bins) is equal to fragsize+1. Array size is equal to output_partitions.
unsigned int MHAFilter::partitioned_convolution_t::current_output_partition_index |
A counter modulo output_partitions, indexing the "current" output partition.
MHASignal::waveform_t MHAFilter::partitioned_convolution_t::output_signal_wave |
Buffer for the wave output signal.
Number of channels is equal to nchannels_out, number of frames is equal to fragsize
mha_fft_t MHAFilter::partitioned_convolution_t::fft |
The FFT transformer.