Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Impala::Application::Client::ExampleRgbDataSrc ( Util::Channel *  chanP  ) 

Definition at line 95 of file mainDataClient.cpp.

References Impala::Util::Channel::Buffer(), Impala::CmdOptions::GetArg(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetNrArg(), Impala::Core::Array::GetRgbPixels(), gNrIter, ILOG_INFO, ILOG_VAR, Impala::Util::Channel::MaximizeSendRecvBuffer(), Impala::Core::Array::RGB2Intensity(), Impala::Util::Channel::SendRequest(), Impala::Core::Array::Set(), and Impala::Timer::SplitTime().

Referenced by mainClient().

00096 {
00097     ILOG_VAR(Impala.Application.Client.ExampleRgbDataSrc);
00098     CmdOptions& options = CmdOptions::GetInstance();
00099 
00100     Util::Channel& chan = *chanP;
00101     chan.MaximizeSendRecvBuffer();
00102     char* buf = chan.Buffer();
00103     int len;
00104 
00105     // ask server to open an RgbDataSrc
00106     String fileName = "bike.mpg";
00107     if (options.GetNrArg() > 2)
00108         fileName = options.GetArg(2);
00109     sprintf(buf, "opensrc \"%s\"\0", fileName.c_str());
00110     len = chan.SendRequest(strlen(buf)+1);
00111     buf[len] = 0;
00112     ILOG_INFO("answer : (" << len << " bytes) = [" << buf << "]");
00113     int width;
00114     int height;
00115     sscanf(buf, "%d %d", &width, &height);
00116     ILOG_INFO("sizes : " << width << " x " << height);
00117 
00118     // ask server to open a ImageDataDst
00119     sprintf(buf, "opendst %d %d\0", width, height);
00120     len = chan.SendRequest(strlen(buf)+1);
00121 
00122     Timer theTimer(1);
00123     for (int i=1 ; i<gNrIter ; i++)
00124     {
00125         // ask server for nextFrame of src
00126         sprintf(buf, "nextframe\0");
00127         len = chan.SendRequest(strlen(buf)+1);
00128 
00129         // convert data to a Array
00130         Array2dVec3UInt8* srcWrap =
00131             ArrayCreate<Array2dVec3UInt8>(width, height, 0, 0, (UInt8*) buf,
00132                                           true);
00133         Array2dVec3Real64* srcV3R64 = 0;
00134         Set(srcV3R64, srcWrap);
00135 
00136         // do some processing
00137         Array2dScalarReal64* srcSR64 = 0;
00138         RGB2Intensity(srcSR64, srcV3R64);
00139 
00140         // prepare display data and ask server to show it
00141         //
00142         sprintf(buf, "show\0");
00143         GetRgbPixels(srcSR64, (UInt8*)(buf + 5), "Stretch");
00144         len = chan.SendRequest(width*height*3 + 5);
00145         //
00146         double timeVal = theTimer.SplitTime();
00147         double fps = (double) i / timeVal;
00148         double bps = (2.0*i * width*height*3) / (1024.0*1024 * timeVal);
00149         std::cout << "Did " << i << " frames in " <<  std::setw(8) << std::left 
00150                   << timeVal << " sec = " << std::setw(8) << fps << " fps and "
00151                   << std::setw(8) << bps << " Mb/sec" << std::endl;
00152 
00153         delete srcWrap;
00154         delete srcV3R64;
00155         delete srcSR64;
00156     }
00157 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:38:59 2010 for ImpalaSrc by  doxygen 1.5.1