Changeset 2187 in Sophya for trunk/ArchTOIPipe/Processors
- Timestamp:
- Sep 9, 2002, 5:33:16 PM (23 years ago)
- Location:
- trunk/ArchTOIPipe/Processors
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ArchTOIPipe/Processors/Makefile.in
r1957 r2187 48 48 49 49 SRCFILES=toisqfilter.cc nooppr.cc correl.cc nrutil.c dlubksb.c dludcmp.c dtoeplz.c \ 50 wienerdecor.cc 50 wienerdecor.cc toidelay.cc toimedfilter.cc 51 51 FILES=$(patsubst %.c,%.o,$(SRCFILES:.cc=.o)) 52 52 -
trunk/ArchTOIPipe/Processors/wienerdecor.cc
r2127 r2187 11 11 nsamples = n; 12 12 lcorr = l; 13 doNotLookAt(); 13 14 } 14 15 … … 35 36 double* y = new double[lcorr+1]; // corr vector 36 37 double* window = new double[lcorr]; 38 uint_8* fwind = new uint_8[lcorr]; 37 39 double* filter = new double[lcorr]; 38 40 for (int i=0; i<lcorr; i++) filter[i]=0; … … 41 43 int snstartcorr = -1; 42 44 43 while (sn < sne) {45 while (sn <= sne) { 44 46 if (snstartcorr < 0 || 45 47 (snstartcorr + nsamples < sn && sn+nsamples < sne)) { … … 48 50 corr.reset(); 49 51 autocorr.reset(); 50 int i; 51 for (i=sn; i<sn+nsamples; i++) { 52 double sig = getData(0, i); 53 double prb = getData(1, i); 52 cout << "computing correl " << sn << " -> " << sn+nsamples << endl; 53 for (int i=sn; i<sn+nsamples; i++) { 54 uint_8 flag1, flag2; 55 double sig, prb; 56 getData(0, i, sig, flag1); 57 if (flag1 & flgNotLookAt) continue; 58 getData(1, i, prb, flag2); 59 if (flag2 & flgNotLookAt) continue; 60 if ((i-sn)%100 == 0) { 61 //cout << " sig/prb : " << i << " : " << sig << " / " << prb 62 // << hex << " " << flag1 << " " << flag2 << dec << endl; 63 } 54 64 corr.push(i, sig, prb); 55 65 autocorr.push(i, prb); 56 66 } 57 67 // correlation is recomputed, let's recompute the wiener filter from wiener equations 58 for (i=0; i<lcorr; i++) {68 {for (int i=0; i<lcorr; i++) { 59 69 r[lcorr+i] = r[lcorr-i] = autocorr.correl(i); 60 70 y[i+1] = corr.correl(i); 61 } 71 //cout << "r " << lcorr+i << " " << lcorr -i << " = " << r[lcorr+i] 72 // << "\n" 73 // << "y " << i+1 << " = " << y[i+1] << endl; 74 }} 62 75 dtoeplz(r,w,y,lcorr); 63 76 if (!isnan(w[1])) { … … 69 82 } 70 83 cout << "Wiener filter : " << sn << "\n "; 71 for (i=0; i<lcorr; i++) {84 {for (int i=0; i<lcorr; i++) { 72 85 cout << filter[i] << " "; 73 } 86 }} 74 87 cout << endl; 75 88 } 76 89 77 90 if (sn >= snb+lcorr-1) { 78 getData(1, sn-lcorr+1, lcorr, window); 91 getData(1, sn-lcorr+1, lcorr, window, fwind); 92 uint_8 flag = 0; 79 93 double outSig = 0; 80 94 for (int i=0; i<lcorr; i++) { 81 95 outSig += filter[i] * window[lcorr-1 - i]; 96 flag |= fwind[lcorr-1 -i]; 82 97 } 83 putData(0, sn, getData(0, sn) - outSig );84 putData(1, sn, outSig );98 putData(0, sn, getData(0, sn) - outSig, flag); 99 putData(1, sn, outSig, flag); 85 100 } 86 101 sn++; -
trunk/ArchTOIPipe/Processors/wienerdecor.h
r1944 r2187 5 5 // Christophe Magneville 6 6 // Reza Ansari 7 // $Id: wienerdecor.h,v 1. 1 2002-03-23 23:05:22aubourg Exp $7 // $Id: wienerdecor.h,v 1.2 2002-09-09 15:33:15 aubourg Exp $ 8 8 9 9 #ifndef WIENERDECOR_H … … 20 20 virtual void run(); 21 21 22 //inline void doNotLookAt(uint_8 flag=FlgToiAll) {flgNotLookAt = flag;}22 inline void doNotLookAt(uint_8 flag=FlgToiAll) {flgNotLookAt = flag;} 23 23 24 24 protected: 25 25 int nsamples; 26 26 int lcorr; 27 //uint_8 flgNotLookAt;27 uint_8 flgNotLookAt; 28 28 }; 29 29
Note:
See TracChangeset
for help on using the changeset viewer.