Changeset 3675 in Sophya for trunk/AddOn/TAcq/tbrpaq.cc
- Timestamp:
- Nov 15, 2009, 12:06:04 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/tbrpaq.cc
r3538 r3675 40 40 41 41 if (narg < 3) { 42 cout << "tbrpaq.cc/Erreur arg: tbrpaq paqsz filename[neltsprint=8] [OutPPFFileName]" << endl;42 cout << "tbrpaq.cc/Erreur arg: tbrpaq paqsz paqredsz [neltsprint=8] [OutPPFFileName]" << endl; 43 43 return 1; 44 44 } … … 51 51 52 52 int paqsz = atoi(arg[1]); 53 string filename = arg[2];53 int redpsz = atoi(arg[2]); 54 54 int nelt = 8; 55 55 if (narg>3) nelt = atoi(arg[3]); 56 56 57 cout << " tbrpaq : reading from file " << filename 58 << " PaqSize=" << paqsz << endl; 59 FILE* fip = NULL; 60 fip = fopen(filename.c_str(),"rb"); 61 if (fip == NULL) { 62 cout << " tbrpaq : ERROR opening file" << endl; 63 return 2; 64 } 57 cout << " tbrpaq : PaqSize=" << paqsz << " RedPaqSize " << endl; 65 58 Byte * src = new Byte[paqsz]; 66 59 Byte * dst = new Byte[paqsz]; 67 60 68 fread(src, 1, (size_t)(paqsz), fip); 69 fclose(fip); 70 61 for(int kk=0; kk<paqsz; kk++) src[kk]=kk%256; 71 62 cout << " tbrpaq : Creating BRPaquet(src,dst,paqsz) ... " << endl; 72 63 … … 75 66 paq.Print(cout, nelt, true); 76 67 77 i f (narg>4) {78 string outppf = arg[4];79 cout << " tbrpaq: Creating OutPPF file from data to file" << outppf << endl; 80 TVector<int_2> vd(paq.DataSize());81 for(int k=0; k<paq.DataSize(); k++) vd(k) = (int_2)(*(paq.Data()+k));82 POutPersist po(outppf);83 po << vd;68 int NN=100; 69 Byte * rdst = new Byte[NN*redpsz]; 70 71 for(int n=0; n<NN; n++) { 72 BRPaquet paqc(rdst+n*redpsz, redpsz); 73 paqc.CopyFrom(paq, BR_TwoChanReduc, 0); 74 if ((n==0)||(n==NN-1)) paqc.Print(cout, nelt, true); 84 75 } 76 85 77 // Cleanup 86 78 delete[] src; 87 79 delete[] dst; 80 delete[] rdst; 88 81 89 82 PrtTim("FIN tbrpaq.cc");
Note:
See TracChangeset
for help on using the changeset viewer.