Classes Utilities Scripts Speech Search Up Home
ISIP IFC Index
Title Bar

/home5/piconepr/public_html/isip/projects/speech/software/documentation/class/algo/Energy/enrgy_00.cc

// file: $isip/class/algo/Energy/enrgy_00.cc
// version: $Id: enrgy_00.cc 7592 2002-01-01 00:13:30Z picone $
//

// isip include files
//
#include "Energy.h"

[snipped]

// method: init
//
// arguments: none
//
// return: a boolean value indicating status
//
// this method precomputes various constants used in this class
// 
boolean Energy::init() {

  // check algorithm: SUM
  //
  if (algorithm_d == SUM) {
    // no initialization needed
  }
  
  // check algorithm: FILTER
  //
  else if (algorithm_d == FILTER) {

    // check for degenerate cases
    //
    if (ma_coef_d.length() == 0) {
      ma_coef_d.setLength(1);
      ma_coef_d(0) = 1.0;
    }
    if (ar_coef_d.length() == 0) {
      ar_coef_d.setLength(1);
      ar_coef_d(0) = 1;
    }

    // create space for each channel
    //
    ma_mem_d.setLength(num_channels_d);
    ar_mem_d.setLength(num_channels_d);

    // size the delay lines
    //
    for (long nchan = 0; nchan < num_channels_d; nchan++) {
      ma_mem_d(nchan).setLength(ma_coef_d.length());
      ma_mem_d(nchan).clear(Integral::RETAIN);
      ar_mem_d(nchan).setLength(ar_coef_d.length());
      ar_mem_d(nchan).clear(Integral::RETAIN);    
    }
  }

  // set the initialization flag
  //
  is_valid_d = true;
  
  // exit gracefully
  //
  return true;
}

[snipped]

//
// end of file


Footer

Up | Home | Courses | Projects | Proposals | Publications Please direct questions or comments to joseph.picone@isip.piconepress.com