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

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

Definition at line 218 of file mainDataClient.cpp.

References Impala::Util::Channel::Buffer(), Impala::Core::Stream::RgbDataSrcFactory::Construct(), Impala::Core::Stream::RgbDataSrc::DataPtr(), Impala::Core::Stream::RgbDataSrc::FrameHeight(), Impala::Core::Stream::RgbDataSrc::FrameWidth(), Impala::CmdOptions::GetArg(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetNrArg(), Impala::Core::Array::GetRgbPixels(), Impala::CmdOptions::GetString(), gNrIter, ILOG_DEBUG, ILOG_INFO, ILOG_VAR, Impala::Core::Stream::RgbDataSrcFactory::Instance(), Impala::Core::Stream::RgbDataSrc::NextFrame(), Impala::Util::Channel::SendRequest(), and Impala::Timer::SplitTime().

Referenced by mainClient().

00219 {
00220     ILOG_VAR(Impala.Application.Client.TestMpg);
00221     CmdOptions& options = CmdOptions::GetInstance();
00222 
00223     Util::Channel& chan = *chanP;
00224     char* buf = chan.Buffer();
00225     int len;
00226 
00227     // open RgbDataSrc
00228     String fileName = "ANNA4.MPEG";
00229     if (options.GetNrArg() > 2)
00230         fileName = options.GetArg(2);
00231     ILOG_DEBUG("opening src " << fileName);
00232     RgbDataSrcFactory& factory = RgbDataSrcFactory::Instance();
00233     RgbDataSrc* theSrc = factory.Construct(fileName, options.GetString("src"));
00234     int width = theSrc->FrameWidth();
00235     int height = theSrc->FrameHeight();
00236     ILOG_INFO("sizes : " << width << " x " << height);
00237 
00238     // ask server to open a ImageDataDst
00239     ILOG_DEBUG("requesting opendst");
00240     sprintf(buf, "opendst %d %d\0", width, height);
00241     len = chan.SendRequest(strlen(buf)+1);
00242 
00243     Timer theTimer(1);
00244     for (int i=1 ; i<gNrIter ; i++)
00245     {
00246         // do nextFrame
00247         ILOG_DEBUG("doing nextframe");
00248         theSrc->NextFrame(1);
00249 
00250         // convert data to a Array
00251         Array2dVec3UInt8* srcWrap =
00252             ArrayCreate<Array2dVec3UInt8>(width, height, 0, 0,
00253                                           theSrc->DataPtr(), true);
00254 
00255         // prepare display data and ask server to show it
00256         sprintf(buf, "show\0");
00257         GetRgbPixels(srcWrap, (UInt8*)(buf + 5), "Direct");
00258         len = chan.SendRequest(width*height*3 + 5);
00259 
00260         double timeVal = theTimer.SplitTime();
00261         double fps = (double) i / timeVal;
00262         double bps = (1.0*i * width*height*3) / (1024.0*1024 * timeVal);
00263         std::cout << "Did " << i << " frames in " <<  std::setw(8) << std::left 
00264                   << timeVal << " sec = " << std::setw(8) << fps << " fps and "
00265                   << std::setw(8) << bps << " Mb/sec" << std::endl;
00266 
00267         delete srcWrap;
00268     }
00269 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:39:01 2010 for ImpalaSrc by  doxygen 1.5.1