コード例 #1
0
int main(int argc, char* argv[])
{
  SignalScalerComponent mod("test");
  mod.registerPorts();

  map<string, int> iTypes,oTypes;
  iTypes["input1"] = TypeInfo< complex<float> >::identifier;
  mod.calculateOutputTypes(iTypes,oTypes);

  DataBufferTrivial< complex<float> > in;
  DataBufferTrivial< complex<float> > out;

  DataSet< complex<float> >* iSet = NULL;
  int num = 1000000;
  in.getWriteData(iSet, num);
  for(int i=0;i<num;i++)
    iSet->data[i] = complex<float>(i,i);
  in.releaseWriteData(iSet);

  mod.setBuffers(&in,&out);
  mod.initialize();

  bp::ptime t1(bp::microsec_clock::local_time());
  mod.process();
  bp::ptime t2(bp::microsec_clock::local_time());

  bp::time_duration time = t2-t1;
  float megSampsPerSec = 1.0e9/time.total_nanoseconds();
  cout << "Rate = " << megSampsPerSec << " MS/sec" << endl;
}
コード例 #2
0
int main(int argc, char* argv[])
{
  OfdmModulatorComponent mod("test");
  mod.registerPorts();

  map<string, int> iTypes,oTypes;
  iTypes["input1"] = TypeInfo< uint8_t >::identifier;
  mod.calculateOutputTypes(iTypes,oTypes);

  DataBufferTrivial<uint8_t> in;
  DataBufferTrivial< complex<float> > out;

  // Create enough data for "numFrames" full frames
  int numFrames = 100;
  int numBytes = numFrames*32*24; // #dataSymbols * #bytesPerSymbol
  DataSet<uint8_t>* iSet = NULL;
  in.getWriteData(iSet, numBytes);
  for(int i=0;i<numBytes;i++)
    iSet->data[i] = i%255;
  in.releaseWriteData(iSet);

  mod.setBuffers(&in,&out);
  mod.initialize();

  bp::ptime t1(bp::microsec_clock::local_time());
  mod.process();
  bp::ptime t2(bp::microsec_clock::local_time());

  bp::time_duration time = t2-t1;
  float megBytesPerSec = (numBytes/1.0e6)*(1.0e9/time.total_nanoseconds());
  cout << "Rate = " << megBytesPerSec << " MB/sec" << endl;
}
int main(int argc, char* argv[])
{
  typedef complex<float>    Cplx;
  typedef vector<Cplx>      CplxVec;
  typedef CplxVec::iterator CplxVecIt;

  OfdmDemodulatorComponent mod("test");
  mod.setValue("numdatacarriers", 40);
  mod.setValue("numpilotcarriers", 8);
  mod.setValue("numguardcarriers", 15);
  mod.setValue("cyclicprefixlength", 8);
  mod.registerPorts();

  map<string, int> iTypes,oTypes;
  iTypes["input1"] = TypeInfo< Cplx >::identifier;
  mod.calculateOutputTypes(iTypes,oTypes);

  DataBufferTrivial< Cplx > in;
  DataBufferTrivial< uint8_t > out;

  // Create enough data for "numFrames" full frames
  int numFrames = 10000;
  int frameSize = OfdmDemodulatorBenchmarkData::testFrame1.size();
  DataSet< Cplx >* iSet = NULL;
  in.getWriteData(iSet, frameSize*numFrames);
  CplxVecIt it = iSet->data.begin();
  for(int i=0;i<numFrames;i++,it+=frameSize)
  {
    copy(OfdmDemodulatorBenchmarkData::testFrame1.begin(),
         OfdmDemodulatorBenchmarkData::testFrame1.end(),
         it);
  }
  in.releaseWriteData(iSet);

  mod.setBuffers(&in,&out);
  mod.initialize();

  bp::ptime t1(bp::microsec_clock::local_time());
  mod.process();
  bp::ptime t2(bp::microsec_clock::local_time());

  bp::time_duration time = t2-t1;
  float megSampsPerSec = (numFrames*frameSize/1.0e6)*(1.0e9/time.total_nanoseconds());
  cout << "Rate = " << megSampsPerSec << " MS/sec" << endl;
}