// file: $isip/class/algo/FilterBank/fb_06.cc
// version: $Id: fb_06.cc,v
//

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

// method: getLeadingPad
// 
// arguments: none
//
// return: the number of future frames needed if the filter is anti-causal
//
long FilterBank::getLeadingPad() const {

  // declare local variables
  //
  long len = filters_d.length();
  long max_nframes = (long)0;

  // compute the maximum future lag
  //
  for ( long i = 0; i < len; i++) {
    long tmp = filters_d(i).getLeadingPad();
    if (tmp > max_nframes) {
      max_nframes = tmp;
    }
  }
  
  // return the number of maximum frames needed to cover the future lag
  //
  return max_nframes;
}

// method: getTrailingPad
// 
// arguments: none
//
// return: the number of past frames needed
//
long FilterBank::getTrailingPad() const {
  
  // declare local variables
  //
  long len = filters_d.length();
  long max_nframes = (long)0;
  
  // compute the maximum past lag
  //
  for ( long i = 0; i < len; i++) {
    long tmp = filters_d(i).getTrailingPad();
    if (tmp > max_nframes) {
      max_nframes = tmp;
    }
  }
  
  // return the number of maximum frames needed to cover the past lag
  //
  return max_nframes;
}
