Ignore:
Timestamp:
Mar 15, 2001, 1:09:31 PM (25 years ago)
Author:
ansari
Message:

Ajout de processeurs simples - Deglitcher + Filtre, + programme test - Reza 15/3/2001

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/ProcWSophya/rztoi.cc

    r1439 r1442  
    33#include "pexceptions.h"
    44#include "fftpserver.h"
    5 #include "timing.h"
     5#include "ctimer.h"
    66
    77RzTOIProc::RzTOIProc(int w1, int w2, int nmax)
     
    1515void RzTOIProc::init() {
    1616  cout << "RzTOIProc::init" << endl;
    17   declareInput("signal");
    18   declareOutput("sfout");
     17  declareInput("in");
     18  declareOutput("out");
    1919  name = "rzproc";
    2020  upExtra = 1;
     
    3333
    3434  try {
     35    Timer tm("RzTOIProc::run()");
    3536
    3637    FFTPackServer ffts;
     
    116117        nkv++;
    117118      }
    118       PrtTim("End of bloc");
     119
     120      tm.Split("End of bloc");
    119121    }
    120122
     
    150152  }
    151153  catch (PException & e) {
    152     cout << "RzTOIProc exception Msg= " << e.Msg() << endl;
    153   }
    154 }
    155 
    156 
    157 
    158 RzSimpleTOIProc::RzSimpleTOIProc(double fact, int npr)
     154    cout << "RzTOIProc: Catched exception " << (string)typeid(e).name()
     155         << "\n Msg= " << e.Msg() << endl;
     156  }
     157}
     158
     159
     160
     161RzSimpleTOIProc::RzSimpleTOIProc(int wsz, double fact)
    159162{
     163  if (wsz < 4) wsz = 4;
    160164  cout << "RzSimpleTOIProc::RzSimpleTOIProc() factor= " << fact
    161        << " npr=" << npr << endl;
     165       << " WSize=" << wsz << endl;
    162166  _fact = fact;
    163   _nprt = npr;
     167  _wsz = wsz;
    164168}
    165169
    166170void RzSimpleTOIProc::init() {
    167171  cout << "RzSimpleTOIProc::init" << endl;
    168   declareInput("signal");
    169   declareOutput("sfout");
     172  declareInput("in");
     173  declareOutput("out");
    170174  name = "rzsimpleproc";
    171175  upExtra = 1;
     
    177181  int sne = getMaxIn();
    178182
    179   cout << " RzSimpleTOIProc::run(): snb=" << snb << " sne=" << sne << endl;
     183  int nstot = sne-snb;
     184  int nbloc = nstot/_wsz;
     185  cout << " RzSimpleTOIProc::run(): snb=" << snb << " sne="
     186       << sne << " NBloc=" << nbloc << endl;
    180187
    181188  double val;
     189  int snlast = snb;
     190  int istart,ii,kb;
    182191  try {
    183     for (int k=snb; k<sne; k++) {
    184       if ((k-snb)%_nprt == 0)
    185         cout << " RzSimpleTOIProc::run() - Processing sample k= " << k
    186              << endl;
    187 
    188       val = getData(0, k);
    189       putData(0, k, val*_fact);
    190     }
     192    Timer tm("RzSimpleTOIProc::run()");
     193    Vector vin(_wsz);
     194    for (kb=0; kb<nbloc; kb++) {
     195      istart = kb*_wsz+snb;
     196      if (kb%2 == 0) {  // On parcourt a l'envers
     197        cout << " ... Processing bloc[" << kb << "] (Reverse) SampleNum="
     198             << istart+_wsz << " ->" << istart << endl;
     199        for(ii=_wsz-1; ii>=0; ii--)
     200          vin(ii) = getData(0, ii+istart);
     201      }
     202      else {  // On parcourt vers l'avant
     203        cout << " ... Processing bloc[" << kb << "] SampleNum="
     204             << istart << " ->" << istart+_wsz << endl;
     205        for(ii=0; ii<_wsz; ii++)
     206          vin(ii) = getData(0, ii+istart);     
     207      }
     208      for(ii=0; ii<_wsz; ii++)
     209        putData(0, ii+istart, vin(ii)*_fact);
     210      snlast = istart+_wsz;
     211    }
     212    cout << " ... Processing remaining Samples - SN="
     213         << snlast << " ->" << sne << endl;
     214    for(ii=snlast; ii<sne; ii++) {
     215      val = getData(0, ii);
     216      putData(0, ii, val*_fact);
     217    }
     218   
     219   
    191220  }
    192221  catch (PException & e) {
    193     cout << "RzSimpleTOIProc exception Msg= " << e.Msg() << endl;
    194   }
    195 }
     222    cout << "RzSimpleTOIProc exception " << (string)typeid(e).name()
     223         << "\n  Msg= " << e.Msg() << endl;
     224  }
     225}
Note: See TracChangeset for help on using the changeset viewer.