Changeset 3675 in Sophya for trunk/AddOn/TAcq/tbrpaq.cc


Ignore:
Timestamp:
Nov 15, 2009, 12:06:04 PM (16 years ago)
Author:
ansari
Message:

Correction bug avec reduction taille de paquet - Reza 15/11/2009

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/tbrpaq.cc

    r3538 r3675  
    4040     
    4141  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;
    4343    return 1;
    4444  }
     
    5151
    5252  int paqsz = atoi(arg[1]);
    53   string filename = arg[2];
     53  int redpsz = atoi(arg[2]);
    5454  int nelt = 8;
    5555  if (narg>3) nelt = atoi(arg[3]);
    5656
    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;
    6558  Byte * src = new Byte[paqsz];
    6659  Byte * dst = new Byte[paqsz];
    6760
    68   fread(src, 1, (size_t)(paqsz), fip);
    69   fclose(fip);
    70 
     61  for(int kk=0; kk<paqsz; kk++) src[kk]=kk%256;
    7162  cout << " tbrpaq : Creating BRPaquet(src,dst,paqsz) ... " << endl;
    7263
     
    7566  paq.Print(cout, nelt, true);
    7667
    77   if (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);
    8475  }
     76
    8577  // Cleanup
    8678  delete[] src;
    8779  delete[] dst;
     80  delete[] rdst;
    8881
    8982  PrtTim("FIN tbrpaq.cc");
Note: See TracChangeset for help on using the changeset viewer.