⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reflection.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
字号:
// file: $isip/class/algo/Reflection/Reflection.h// version: $Id: Reflection.h,v 1.9 2002/02/28 03:21:53 zheng Exp $//// make sure definitions are only made once//#ifndef ISIP_REFLECTION#define ISIP_REFLECTION#ifndef ISIP_ALGORITHM_BASE#include <AlgorithmBase.h>#endif#ifndef ISIP_CORRELATION#include <Correlation.h>#endif#ifndef ISIP_COVARIANCE#include <Covariance.h>#endif#ifndef ISIP_PREDICTION#include <Prediction.h>#endif// Reflection: a class that computes the linear prediction// coefficients from various representations of a signal.// This class is closely tied to other linear prediction classes// such as the Prediction class. See Prediction.h for more details.//class Reflection : public AlgorithmBase {  //---------------------------------------------------------------------------  //  // public constants  //  //---------------------------------------------------------------------------public:    // define the class name  //  static const String CLASS_NAME;    //----------------------------------------  //  // other important constants  //  //----------------------------------------      // define the algorithm choices  //  enum ALGORITHM { AUTOCORRELATION = 0, COVARIANCE, LATTICE, PREDICTION,		   LOG_AREA_RATIO, DEF_ALGORITHM = AUTOCORRELATION };    // define the implementation choices  //  enum IMPLEMENTATION { DURBIN = 0, LEROUX_GUEGUEN, CHOLESKY, BURG,			STEP_UP, KELLY_LOCHBAUM,			DEF_IMPLEMENTATION = DURBIN };  // define static NameMap objects for the enumerated values  //  static const NameMap ALGO_MAP;  static const NameMap IMPL_MAP;    //----------------------------------------  //  // i/o related constants  //  //----------------------------------------      static const String DEF_PARAM;  static const String PARAM_ALGORITHM;  static const String PARAM_IMPLEMENTATION;  static const String PARAM_ORDER;  static const String PARAM_DYN_RANGE;  //----------------------------------------  //  // default values and arguments  //  //----------------------------------------      // define the default value(s) of the class data  //  static const long DEF_ORDER = -1;  static const float DEF_DYN_RANGE = (float)-100.0;    // default arguments to methods  //  static const AlgorithmData::COEF_TYPE DEF_COEF_TYPE =  AlgorithmData::CORRELATION;  //----------------------------------------  //  // error codes  //  //----------------------------------------      static const long ERR = 71000;  static const long ERR_DYNRANGE = 71001;    static const long ERR_BETA = 71002;  static const long ERR_ENERGY = 71003;  static const long ERR_PREDERR = 71004;    //---------------------------------------------------------------------------  //  // protected data  //  //---------------------------------------------------------------------------protected:  // algorithm name  //  ALGORITHM algorithm_d;  // implementation name  //  IMPLEMENTATION implementation_d;    // parameters related to the algorithm specification  //  Long order_d;  Float dyn_range_d;    // static memory manager  //  static MemoryManager mgr_d;    //---------------------------------------------------------------------------  //  // required public methods  //  //---------------------------------------------------------------------------public:      // method: name  //  static const String& name() {    return CLASS_NAME;  }  // other static methods  //  static boolean diagnose(Integral::DEBUG debug_level);    // debug methods:  //  setDebug is inherited from the base class  //  boolean debug(const unichar* msg) const;  // method: destructor  //  ~Reflection() {}    // method: default constructor  //  Reflection(ALGORITHM algorithm = DEF_ALGORITHM,	     IMPLEMENTATION implementation = DEF_IMPLEMENTATION,	     long order = DEF_ORDER,	     float dyn_range = DEF_DYN_RANGE) {    algorithm_d = algorithm;    implementation_d = implementation;    order_d = order;    dyn_range_d = dyn_range;    is_valid_d = false;  }  // method: copy constructor  //  Reflection(const Reflection& arg) {    assign(arg);  }    // assign methods  //  boolean assign(const Reflection& arg);  // method: operator=  //  Reflection& operator= (const Reflection& copy_node) {    assign(copy_node);    return *this;  }    // i/o methods  //  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& name = DEF_PARAM) const;  // equality methods  //  boolean eq(const Reflection& arg) const;    // method: new  //  static void* operator new(size_t size) {    return mgr_d.get();  }  // method: new[]  //  static void* operator new[](size_t size) {    return mgr_d.getBlock(size);  }  // method: delete  //  static void operator delete(void* ptr) {    mgr_d.release(ptr);  }  // method: delete[]  //  static void operator delete[](void* ptr) {    mgr_d.releaseBlock(ptr);  }    // method: setGrowSize  //   static boolean setGrowSize(long grow_size) {    return mgr_d.setGrow(grow_size);  }  // other memory-management methods  //  boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);  //---------------------------------------------------------------------------  //  // class-specific public methods:  //  set methods  //  //---------------------------------------------------------------------------   // method: setAlgorithm  //  boolean setAlgorithm(ALGORITHM algorithm) {    algorithm_d = algorithm;    is_valid_d = false;    return true;    }    // method: setImplementation  //  boolean setImplementation(IMPLEMENTATION implementation) {    implementation_d = implementation;    is_valid_d = false;    return true;    }    // method: setOrder  //  boolean setOrder(long order) {    order_d = order;    is_valid_d = false;    return true;    }    // method: setDynRange  //  boolean setDynRange(float dyn_range) {    dyn_range_d = dyn_range;    is_valid_d = false;    return true;    }  // method: set  //  boolean set(ALGORITHM algo = DEF_ALGORITHM,	      IMPLEMENTATION impl = DEF_IMPLEMENTATION,	      long order = DEF_ORDER, float dyn_range = DEF_DYN_RANGE) {    algorithm_d = algo;    implementation_d = impl;    order_d = order;    dyn_range_d = dyn_range;    is_valid_d = false;    return true;    }  //---------------------------------------------------------------------------  //  // class-specific public methods:  //  get methods  //  //---------------------------------------------------------------------------  // method: getAlgorithm  //  ALGORITHM getAlgorithm() const {      return algorithm_d;  }  // method: getImplementation  //  IMPLEMENTATION getImplementation() const {      return implementation_d;  }  // method: getOrder  //  long getOrder() const {    return order_d;  }  // method: getDynRange  //  float getDynRange() const {    return dyn_range_d;  }    // method: get  //  boolean get(ALGORITHM& algorithm, IMPLEMENTATION& implementation,	      long& order, float& dyn_range) const {    algorithm = algorithm_d;    implementation = implementation_d;    order = order_d;    dyn_range = dyn_range_d;    return true;    }  //---------------------------------------------------------------------------  //  // class-specific public methods:  //  computational methods  //  //---------------------------------------------------------------------------  boolean compute(VectorFloat& output, const VectorFloat& input,		  AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE,		  long index = DEF_CHANNEL_INDEX);  boolean compute(VectorFloat& output, const MatrixFloat& input,		  AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE,		  long index = DEF_CHANNEL_INDEX);  boolean compute(VectorFloat& output, Float& err_energy,		  const VectorFloat& input,		  AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE,		  long index = DEF_CHANNEL_INDEX);  boolean compute(VectorFloat& output, Float& err_energy,		  const MatrixFloat& input,		  AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE,		  long index = DEF_CHANNEL_INDEX);  //---------------------------------------------------------------------------  //  // class-specific public methods:  //  public methods required by the AlgorithmBase interface contract  //  //---------------------------------------------------------------------------  // assign method  //  boolean assign(const AlgorithmBase& arg);  // equality method  //    boolean eq(const AlgorithmBase& arg) const;    // method: className  //  const String& className() const {    return CLASS_NAME;  }    // apply method  //  boolean apply(Vector<AlgorithmData>& output,		const Vector< CircularBuffer<AlgorithmData> >& input);    // method to get the parser   //  boolean setParser(SofParser* parser);  //---------------------------------------------------------------------------  //  // private methods  //  //---------------------------------------------------------------------------private:  // algorithm-specific i/o methods  //  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;    // algorithm-specific compute methods  //  boolean computeAutoDurbin(VectorFloat& output, Float& err_energy,			    const VectorFloat& input);  boolean computeAutoLeroux(VectorFloat& output, Float& err_energy,			    const VectorFloat& input);  boolean computeCovarCholesky(VectorFloat& output, Float& err_energy,			       const MatrixFloat& input);  boolean computeLatticeBurg(VectorFloat& output, Float& err_energy,			  const VectorFloat& input);  boolean computePredictionStepUp(VectorFloat& output,			  const VectorFloat& input);  boolean computeLogAreaKellyLochbaum(VectorFloat& output,				      const VectorFloat& input); };// end of include file// #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -