SpectMorph
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
PandaResampler::Resampler2 Class Reference

#include <smpandaresampler.hh>

Classes

class  Downsampler2
 
class  IIRDownsampler2
 
class  IIRUpsampler2
 
class  Upsampler2
 

Public Types

enum  Mode { UP , DOWN }
 
enum  Precision {
  PREC_LINEAR = 1 , PREC_48DB = 8 , PREC_72DB = 12 , PREC_96DB = 16 ,
  PREC_120DB = 20 , PREC_144DB = 24
}
 
enum  Filter { FILTER_IIR , FILTER_FIR }
 

Public Member Functions

 Resampler2 (Mode mode, uint ratio, Precision precision, bool use_sse_if_available=true, Filter filter=FILTER_FIR)
 
void process_block (const float *input, uint n_input_samples, float *output)
 
uint order () const
 
double delay () const
 
void reset ()
 
bool sse_enabled () const
 

Static Public Member Functions

static bool sse_available ()
 
static bool test_filter_impl (bool verbose)
 
static Precision find_precision_for_bits (uint bits)
 
static const char * precision_name (Precision precision)
 

Protected Member Functions

template<bool USE_SSE>
Impl * create_impl (uint stage_ratio)
 
template<bool USE_SSE>
Impl * create_impl_iir (uint stage_ratio)
 
template<class CArray >
Impl * create_impl_iir_with_coeffs (const CArray &carray, double group_delay)
 
void init_stage (std::unique_ptr< Impl > &impl, uint stage_ratio)
 

Static Protected Member Functions

template<class Filter >
static Impl * create_impl_with_coeffs (const double *d, uint order, double scaling)
 

Protected Attributes

Mode mode_
 
Precision precision_
 
bool use_sse_if_available_
 
Filter filter_
 

Detailed Description

Interface for factor 2 resampling classes

Constructor & Destructor Documentation

◆ Resampler2()

PANDA_RESAMPLER_FN PandaResampler::Resampler2::Resampler2 ( Mode  mode,
uint  ratio,
Precision  precision,
bool  use_sse_if_available = true,
Filter  filter = FILTER_FIR 
)

creates a resampler instance fulfilling a given specification

Member Function Documentation

◆ delay()

double PandaResampler::Resampler2::delay ( ) const
inline

Return the delay introduced by the resampler. This delay is guaranteed to be >= 0.0, and for factor 2 resampling always a multiple of 0.5 (1.0 for upsampling).

The return value can also be thought of as index into the output signal, where the first input sample can be found.

Beware of fractional delays, for instance for downsampling, a delay() of 10.5 means that the first input sample would be found by interpolating output[10] and output[11], and the second input sample equates output[11].

◆ find_precision_for_bits()

PANDA_RESAMPLER_FN Resampler2::Precision PandaResampler::Resampler2::find_precision_for_bits ( uint  bits)
static

finds a precision which is appropriate for at least the specified number of bits

◆ order()

uint PandaResampler::Resampler2::order ( ) const
inline

return FIR filter order

◆ precision_name()

PANDA_RESAMPLER_FN const char * PandaResampler::Resampler2::precision_name ( Precision  precision)
static

returns a human-readable name for a given precision

◆ process_block()

void PandaResampler::Resampler2::process_block ( const float *  input,
uint  n_input_samples,
float *  output 
)
inline

resample a data block

◆ reset()

void PandaResampler::Resampler2::reset ( )
inline

clear internal history, reset resampler state to zero values

◆ sse_available()

PANDA_RESAMPLER_FN bool PandaResampler::Resampler2::sse_available ( )
static

returns true if an optimized SSE version of the Resampler is available

◆ sse_enabled()

bool PandaResampler::Resampler2::sse_enabled ( ) const
inline

return whether the resampler is using sse optimized code

◆ test_filter_impl()

PANDA_RESAMPLER_FN bool PandaResampler::Resampler2::test_filter_impl ( bool  verbose)
static

test internal filter implementation


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