quick start:g++ [flags ...] file ...-l /isip/tools/lib/$ISIP_BINARY/lib_algo.a #include <Filter.h> Filter(ALGORITHM algorithm = DEF_ALGORITHM); Filter(const Filter& arg); boolean setMACoeffs(const VectorFloat& ma_coef); boolean setMACoeffs(const VectorFloat& ma_coef, const VectorLong& ma_lag); boolean setARCoeffs(const VectorFloat& ar_coef); boolean setARCoeffs(const VectorFloat& ar_coef, const VectorLong& ar_lag); boolean setCoeffs(const VectorFloat& ma_coef, const VectorLong& ma_lag, const VectorFloat& ar_coef, const VectorLong& ar_lag); boolean setCoeffs(const VectorFloat& ma_coef, const VectorFloat& ar_coef); boolean compute(VectorFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
description:VectorFloat in_vec; VectorFloat out_vec; VectorFloat ma_coef(L"1.0, 2.0, 0.5"); VectorFloat ar_coef(L"1.0"); Filter ft; ft.setCoeffs(ma_coef, ar_coef); in_vec.assign(L" 1.0, 1.0, 2.0, 1.0, 1.0"); ft.compute(out_vec, in_vec);
static const String CLASS_NAME = L"Filter";
enum ALGORITHM { LTI = 0, DEF_ALGORITHM = LTI };
enum IMPLEMENTATION { CCDE = 0, DEF_IMPLEMENTATION = CCDE };
static const NameMap ALGO_MAP = L"LTI";
static const NameMap IMPL_MAP = L"CCDE";
static const String DEF_PARAM = L"";
static const String PARAM_ALGORITHM = L"algorithm";
static const String PARAM_IMPLEMENTATION = L"implementation";
static const String PARAM_MA_COEF = L"ma_coef";
static const String PARAM_AR_COEF = L"ar_coef";
static const String PARAM_MA_LAG = L"ma_lag";
static const String PARAM_AR_LAG = L"ar_lag";
static const String PARAM_CMODE = L"compute_mode";
static const String PARAM_DMODE = L"data_mode";
static const VectorFloat DEF_MA_COEF(L"1");
static const VectorFloat DEF_AR_COEF(L"-1");
static const VectorLong DEF_MA_LAG(L"0");
static const VectorLong DEF_AR_LAG(L"-1");
static const AlgorithmData::COEF_TYPE DEF_COEF_TYPE = AlgorithmData::GENERIC;
static const long DEF_CHANNEL_INDEX = 0;
static const long ERR = 70600;
static const long ERR_DATA = 70601;
static const long ERR_AR_LAG = 70602;
ALGORITHM algorithm_d;
IMPLEMENTATION implementation_d;
VectorFloat ma_coef_d;
VectorFloat ar_coef_d;
VectorFloat ma_lag_d;
VectorFloat ar_lag_d;
Vector<CircularDelayLine<Float> > ma_mem_d;
Vector<CircularDelayLine<Float> > ar_mem_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~Filter();
Filter(ALGORITHM algorithm = DEF_ALGORITHM);
Filter(const Filter& arg);
boolean assign(const Filter& arg);
Filter& operator= (const Filter& arg);
long sofSize() const;
boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
boolean eq(const Filter& arg) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);
boolean setAlgorithm(ALGORITHM algorithm);
boolean setImplementation(IMPLEMENTATION implementation);
boolean setMACoeffs(long lag, float val);
boolean setMACoeffs(const VectorFloat& ma_coef);
boolean setMACoeffs(const VectorFloat& ma_coef, const VectorLong& ma_lag);
boolean setARCoeffs(float val, long lag);
boolean setARCoeffs(const VectorFloat& ar_coef);
boolean setARCoeffs(const VectorFloat& ar_coef, const VectorLong& ar_lag);
boolean setCoeffs(const VectorFloat& ma_coef, const VectorFloat& ar_coef);
boolean setCoeffs(const VectorFloat& ma_coef, const VectorLong& ma_lag, const VectorFloat& ar_coef, const VectorLong& ar_lg);
ALGORITHM getAlgorithm() const;
IMPLEMENTATION getImplementation() const;
const VectorFloat& getMACoeffs() const;
const VectorLong& getMALags() const;
const VectorFloat getARCoeffs() const;
const VectorLong& getARLags() const;
long getLeadingNumSamp() const;
long getTrailingNumSamp() const;
boolean compute(VectorFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
boolean compute(VectorComplexFloat& output, const VectorComplexFloat& input, AlgorithmData::COEF_TYPE coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
boolean assign(const AlgorithmBase& arg);
boolean eq(const AlgorithmBase& arg) const;
const String& className() const;
boolean init();
boolean apply(Vector<AlgorithmData>& output, const Vector<AlgorithmData>& input);
long getLeadingPad() const;
long getTrailingPad() const;
CMODE getOutputDataFormat() const;
boolean setParser(SofParser* parser);
boolean readDataCommon(Sof& sof, const String& pname, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeDataCommon(Sof& sof, const String& pname) const;
boolean computeLtiCcdeFrameInternal(VectorFloat& output, const VectorFloat& input, long index = DEF_CHANNEL_INDEX);
boolean computeLtiCcdeCrossFrame(VectorFloat& output, const VectorFloat& input, long index = DEF_CHANNEL_INDEX);
boolean computeBuffer(VectorFloat& output, const CircularBuffer<AlgorithmData>& input, long channel_index);
// declare a filter object // Filter filt; // set ma and ar coefficients // VectorFloat ma_coef(L"1.2, 0.5, 1.1, 1.0"); VectorLong ma_lag(L"-2, -1, -4, 0"); VectorFloat ar_coef(L"0.5, 2.0, 0.2"); VectorLong ar_lag(L"-2, -1, -5"); filt.setCoeffs(ma_coef, ma_lag, ar_coef, ar_lag); // declare input vector // VectorFloat v_in(L"1, 2, 3"); VectorFloat v_out; // compute filter // filt.compute(v_out, v_in); v_out.debug(L"v_out"); }