quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_algo.a #include <Correlation.h> Correlation(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, NORMALIZATION normalization = DEF_NORMALIZATION, long order = DEF_ORDER); boolean eq(const Correlation& arg); boolean assign(const Correlation& arg); boolean setAlgorithm(ALGORITHM algorithm); boolean setNormalization(NORMALIZATION normalization); boolean setOrder(long order); boolean compute(VectorFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE);
description:VectorFloat input(L"1.0, 2.0, 3.0, 4.0, 5.0"); VectorFloat output; Correlation corr(3); corr.compute(output, input);
static const String CLASS_NAME = L"Correlation";
enum ALGORITHM { AUTO = 0, TAPERED_AUTO, CROSS, CONV, DEF_ALGORITHM = AUTO };
enum IMPLEMENTATION { FACTORED = 0, UNFACTORED, CIRCULAR, DEF_IMPLEMENTATION = FACTORED };
the mode choices are defined in an enumeration in the base class
enum NORMALIZATION { NONE = 0, LENGTH, UNIT_ENERGY, DEF_NORMALIZATION = NONE };
static const NameMap ALGO_MAP = L"AUTO, TAPERED_AUTO, CROSS, CONV";
static const NameMap IMPL_MAP = L"FACTORED, UNFACTORED, CIRCULAR";
static const NameMap NORM_MAP = L"NONE, LENGTH, UNIT_ENERGY";
static const String Correlation::DEF_PARAM = L"";
static const String Correlation::PARAM_ALGORITHM = L"algorithm";
static const String Correlation::PARAM_IMPLEMENTATION = L"implementation";
static const String Correlation::PARAM_MODE = L"mode";
static const String Correlation::PARAM_NORMALIZATION = L"normalization";
static const String Correlation::PARAM_ORDER = L"order";
static const long DEF_ORDER = -1;
static const AlgorithmData::COEF_TYPE DEF_COEF_TYPE = AlgorithmData::SIGNAL;
static const long ERR = 70100;
static const long ERR_INPUT = 70101;
static const long ERR_DATA = 70102;
static const long ERR_STABLE = 70103;
ALGORITHM algorithm_d;
IMPLEMENTATION implementation_d;
NORMALIZATION normalization_d;
Long order_d;
static MemoryManager mgr_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~Correlation();
Correlation(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, NORMALIZATION normalization = DEF_NORMALIZATION, long order = DEF_ORDER);
Correlation(const Correlation& arg);
boolean assign(const Correlation& arg);
Correlation& operator= (const Correlation& 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 Correlation& 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 setNormalization(NORMALIZATION normalization);
boolean setOrder(long order);
boolean set(ALGORITHM algorithm = DEF_ALGORITHM, IMPLEMENTATION implementation = DEF_IMPLEMENTATION, NORMALIZATION normalization = DEF_NORMALIZATION, long order = DEF_ORDER);
ALGORITHM getAlgorithm() const;
IMPLEMENTATION getImplementation() const;
NORMALIZATION getNormalization() const;
long getOrder() const;
boolean get(ALGORITHM& algorithm, IMPLEMENTATION& implementation, NORMALIZATION& normalization, long& order);
boolean compute(VectorFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long channel_index = DEF_CHANNEL_INDEX);
boolean compute(VectorFloat& output, const VectorFloat& input1, const VectorFloat& input2, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long channel_index = DEF_CHANNEL_INDEX);
boolean compute(VectorComplexFloat& output, const VectorComplexFloat& input, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long channel_index = DEF_CHANNEL_INDEX);
boolean compute(VectorComplexFloat& output, const VectorComplexFloat& input1, const VectorComplexFloat& input2, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long channel_index = DEF_CHANNEL_INDEX);
boolean assign(const AlgorithmBase& arg);
boolean eq(const AlgorithmBase& arg) const;
const String& className() const;
boolean apply(Vector<AlgorithmData>& output, const Vector< CircularBuffer<AlgorithmData> >& input);
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 computeAutoFactoredFromSignal(VectorFloat& output, const VectorFloat& input);
boolean computeAutoUnfactoredFromSignal(VectorFloat& output, const VectorFloat& input);
boolean computeAutoFromPrediction(VectorFloat& output, const VectorFloat& input);
boolean computeAutoFromReflection(VectorFloat& output, const VectorFloat& input);
boolean convertFromPrediction(VectorFloat& output, const VectorFloat& input);
boolean computeCross(VectorFloat& output, const VectorFloat& ref, const VectorFloat& tst);
boolean computeConv(VectorFloat& output, const VectorFloat& input, const VectorFloat& filter);
// declare the Correlation object // Correlation autoc; // declare the input and output vectors // VectorFloat input(L"1, 2, 3, 4, 5, 6, 7"); VectorFloat output; // set the algorithm, implementation, normalization, and order // autoc.setAlgorithm(Correlation::AUTO); autoc.setImplementation(Correlation::FACTORED); autoc.setMode(Correlation::FRAME_INTERNAL); autoc.setNormalization(Correlation::UNIT_ENERGY); autoc.setOrder(3); // compute the autocorrelation output // autoc.compute(output, input);
// declare the Correlation object // Correlation xcor; // declare the input and output vectors // VectorFloat ref(L"1, 1, 2, 3, 2, 1, 1, 1"); VectorFloat tst(L"2, 3, 2"); VectorFloat output; // set the algorithm, implementation, normalization, and order // xcor.setAlgorithm(Correlation::CROSS); xcor.setImplementation(Correlation::UNFACTORED); xcor.setMode(Correlation::FRAME_INTERNAL); xcor.setNormalization(Correlation::NONE); // compute the cross-correlation // xcor.compute(output, ref, tst);