The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
MHAFilter::partitioned_convolution_t Class Reference

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_tprocess (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_tbookkeeping
 Keeps track of input channels, output channels, impulse response partition, and delay. More...
 
std::vector< MHASignal::spectrum_toutput_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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ partitioned_convolution_t()

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.

Parameters
fragsizeAudio fragment size, equal to partition size.
nchannels_inNumber of input audio channels.
nchannels_outNumber of output audio channels.
transferA sparse matrix of impulse responses.

◆ ~partitioned_convolution_t()

MHAFilter::partitioned_convolution_t::~partitioned_convolution_t ( )

Free fftw resource allocated in constructor.

Member Function Documentation

◆ process()

mha_wave_t * MHAFilter::partitioned_convolution_t::process ( const mha_wave_t s_in)

processing

Member Data Documentation

◆ fragsize

unsigned int MHAFilter::partitioned_convolution_t::fragsize

Audio fragment size, always equal to partition size.

◆ nchannels_in

unsigned int MHAFilter::partitioned_convolution_t::nchannels_in

Number of audio input channels.

◆ nchannels_out

unsigned int MHAFilter::partitioned_convolution_t::nchannels_out

Number of audio output channels.

◆ output_partitions

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.

◆ filter_partitions

unsigned int MHAFilter::partitioned_convolution_t::filter_partitions

The total number of non-zero impulse response partitions.

◆ input_signal_wave

MHASignal::waveform_t MHAFilter::partitioned_convolution_t::input_signal_wave

Buffer for input signal.

Has nchannels_in channels and fragsize*2 frames

◆ current_input_signal_buffer_half_index

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.

◆ input_signal_spec

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).

◆ frequency_response

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).

◆ bookkeeping

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.

◆ output_signal_spec

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.

◆ current_output_partition_index

unsigned int MHAFilter::partitioned_convolution_t::current_output_partition_index

A counter modulo output_partitions, indexing the "current" output partition.

◆ output_signal_wave

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

◆ fft

mha_fft_t MHAFilter::partitioned_convolution_t::fft

The FFT transformer.


The documentation for this class was generated from the following files: