当前位置: 首页>>代码示例>>C++>>正文


C++ realvec::getRow方法代码示例

本文整理汇总了C++中realvec::getRow方法的典型用法代码示例。如果您正苦于以下问题:C++ realvec::getRow方法的具体用法?C++ realvec::getRow怎么用?C++ realvec::getRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在realvec的用法示例。


在下文中一共展示了realvec::getRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: out

void
AimVQ::myProcess(realvec& in, realvec& out)
{
    // cout << "AimVQ::myProcess" << endl;

    (void) in; // avoid unused parameter warning when MARSYAS_ANN is not enabled


    // Zero out the output first
    for (int i = 0; i < onObservations_; ++i) {
        out(i,0) = 0.0;
    }

#ifdef MARSYAS_ANN
    mrs_natural _num_codewords_to_return = ctrl_num_codewords_to_return_->to<mrs_natural>();
    mrs_real _kd_tree_error_bound = ctrl_kd_tree_error_bound_->to<mrs_real>();

    vector<int> sparse_code;
    int offset = 0;
    realvec obsRow;
    for (int i = 0; i < codebooks_count_; ++i) {
        in.getRow(i,obsRow);
        ANNidxArray indices = new ANNidx[_num_codewords_to_return];
        ANNdistArray distances = new ANNdist[_num_codewords_to_return];
        sparse_coder_trees_[i]->annkSearch(obsRow.getData(),
                                           _num_codewords_to_return,
                                           indices,
                                           distances,
                                           _kd_tree_error_bound);
        for (int j = 0; j < _num_codewords_to_return; ++j) {
            sparse_code.push_back(indices[j] + offset);
        }
        offset += codeword_count_;

        delete indices;
        delete distances;
    }

    for (unsigned int j = 0; j < sparse_code.size(); ++j) {
        out(sparse_code[j],0) = 1.0;
    }
#endif

}
开发者ID:typec4st,项目名称:Extracting-Features-from-audio,代码行数:44,代码来源:AimVQ.cpp

示例2: getctrl

void
Peaker::myProcess(realvec& in, realvec& out)
{
  mrs_natural t,o;

  const mrs_natural peakSpacing  = (mrs_natural)(inSamples_ *getctrl("mrs_real/peakSpacing")->to<mrs_real>() + .5);
  mrs_real peakStrengthRelRms,
           peakStrengthRelMax,
           peakStrengthRelThresh,
           peakStrengthAbs;
  //mrs_real peakGain;
  mrs_bool peakHarmonics;
  mrs_bool rmsNormalize;

  mrs_natural peakStart;
  mrs_natural peakEnd;
  mrs_natural interpolationMode;
  mrs_natural peakNeighbors;


  peakStrengthRelRms = getctrl("mrs_real/peakStrength")->to<mrs_real>();
  peakStrengthRelMax = getctrl("mrs_real/peakStrengthRelMax")->to<mrs_real>();
  peakStrengthRelThresh = getctrl("mrs_real/peakStrengthRelThresh")->to<mrs_real>();
  lpCoeff_ = getctrl("mrs_real/peakStrengthThreshLpParam")->to<mrs_real>();
  peakStrengthAbs = getctrl("mrs_real/peakStrengthAbs")->to<mrs_real>();
  peakStart = getctrl("mrs_natural/peakStart")->to<mrs_natural>();
  peakEnd = getctrl("mrs_natural/peakEnd")->to<mrs_natural>();
  interpolationMode = getctrl("mrs_natural/interpolation")->to<mrs_natural>();
  //peakGain = getctrl("mrs_real/peakGain")->to<mrs_real>();
  peakHarmonics = getctrl("mrs_bool/peakHarmonics")->to<mrs_bool>();
  rmsNormalize = getctrl("mrs_bool/rmsNormalize")->to<mrs_bool>();
  peakNeighbors = getctrl("mrs_natural/peakNeighbors")->to<mrs_natural>();



  if (peakEnd == 0)
    peakEnd = inSamples_;
  // FIXME This line defines an unused variable
  // mrs_real srate = getctrl("mrs_real/israte")->to<mrs_real>();

  out.setval(0.0);


  //peakStrengthRelRms = 0.0;



  for (o = 0; o < inObservations_; o++)
  {
    rms_	= 0.0;
    max_	= -1e37;

    for (t=peakStart; t < peakEnd; t++)
    {
      rms_ += in(o,t) * in(o,t);
      if (max_ < in(o,t))
        max_	= in(o,t);
    }
    if (rms_ != 0.0)
      rms_ /= (peakEnd - peakStart);
    rms_ = sqrt(rms_);

    mrs_real max;
    mrs_natural maxIndex;

    bool peakFound = false;

    if (peakStrengthRelThresh > .0)
    {
      in.getRow (o,lpThresh_);
      compLpThresh (lpThresh_, lpThresh_);	// do it inplace to avoid another copy...
    }

    for (t=peakStart; t < peakEnd; t++)
    {
      peakFound = true;

      // peak has to be larger than neighbors
      for (int j = 1; j < peakNeighbors; j++)
      {
        mrs_natural index=t-j;
        if (index<0) index=0;
        if (in(o,index) >= in(o,t))
        {
          peakFound = false;
          break;
        }
        index=t+j;
        if (index>=inSamples_) index=inSamples_-1;
        if (in(o,index) >= in(o,t))
        {
          peakFound = false;
          break;
        }
      }

      if (peakFound)
      {
        currThresh_	= lpThresh_(t);
        peakFound	= doThresholding (in(o,t), peakStrengthRelRms, peakStrengthRelMax, peakStrengthRelThresh, peakStrengthAbs);
//.........这里部分代码省略.........
开发者ID:BitMax,项目名称:marsyas,代码行数:101,代码来源:Peaker.cpp


注:本文中的realvec::getRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。