[Sumover-dev] [svn commit] r4722 - vic/branches/cc/video
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Wed Mar 24 15:58:47 GMT 2010
Author: soohyunc
Date: Wed Mar 24 15:58:47 2010
New Revision: 4722
Modified:
vic/branches/cc/video/grabber-macosx.cpp
vic/branches/cc/video/grabber-still.cpp
vic/branches/cc/video/grabber.cpp
vic/branches/cc/video/grabber.h
Log:
-- "grabber-macosx" works fine with CC module with H.261 encoder.
(added timing measurement features)
now, we can test CC module with a live video stream
using Macbook's built-in USB webcam.
Modified: vic/branches/cc/video/grabber-macosx.cpp
==============================================================================
--- vic/branches/cc/video/grabber-macosx.cpp (original)
+++ vic/branches/cc/video/grabber-macosx.cpp Wed Mar 24 15:58:47 2010
@@ -113,6 +113,13 @@
// Overridden functions.
virtual int command(int argc, const char*const* argv);
+
+ inline double MacOSX_now() {
+ timeval tv;
+ ::gettimeofday(&tv, NULL);
+ return ((double) tv.tv_sec + 1e-6 * (double) tv.tv_usec);
+ }
+ double MacOSX_ts_off_;
protected:
// sequence grabber support requires a callback function
@@ -187,6 +194,9 @@
port_[0] = 0;
useconfig_ = false;
+ // time measurement
+ MacOSX_ts_off_ = MacOSX_now();
+
// allocate prezeroed nonrelocatable block of memory
sgDataProcRefCon = (SGDataProcRefCon *)NewPtrClear(sizeof(SGDataProcRefCon));
@@ -225,6 +235,9 @@
// Don't do anything if QuickTime failed.
if (!quicktime_) return;
+ // time measurement
+ target_->offset_ = MacOSX_ts_off_;
+
format();
// start the sequencer
@@ -246,6 +259,11 @@
}
int MacOSXGrabber::grab() {
+ // time measurement------------------*
+ start_grab_ = MacOSX_now() - MacOSX_ts_off_;
+ fprintf(stderr, "start_grab\tnow: %f\n", start_grab_);
+ //-----------------------------------*
+
if (sgDataProcRefCon->decomSeq == 0) {
if (setupDecom()) {
return 0;
@@ -256,6 +274,13 @@
saveblks(frame_);
YuvFrame f(media_ts(), frame_, crvec_, outw_, outh_, format_);
+ // time measurement------------------*
+ end_grab_ = MacOSX_now() - MacOSX_ts_off_;
+ fprintf(stderr, "end_grab\tnow: %f\n", end_grab_);
+ fprintf(stderr, "num: %f\tgrab_time: %f\n",
+ end_grab_, end_grab_ - start_grab_);
+ //-----------------------------------*
+
if(target_)
return(target_->consume(&f));
return 0;
Modified: vic/branches/cc/video/grabber-still.cpp
==============================================================================
--- vic/branches/cc/video/grabber-still.cpp (original)
+++ vic/branches/cc/video/grabber-still.cpp Wed Mar 24 15:58:47 2010
@@ -86,9 +86,6 @@
return ((double) tv.tv_sec + 1e-6 * (double) tv.tv_usec);
}
double stillYuv_ts_off_;
- double start_grab_;
- double end_grab_;
- int num_grab_;
protected:
void start();
@@ -327,9 +324,6 @@
width_(0), height_(0), nbytes_(0)
{
stillYuv_ts_off_ = stillYuv_now();
- start_grab_ = 0.0;
- end_grab_ = 0.0;
- num_grab_ = 1;
}
StillYuvGrabber::~StillYuvGrabber()
@@ -411,8 +405,8 @@
// time measurement
end_grab_ = stillYuv_now() - stillYuv_ts_off_;
fprintf(stderr, "end_grab\tnow: %f\n", end_grab_);
- fprintf(stderr, "num: %d\tgrab_time: %f\n",
- num_grab_++, end_grab_ - start_grab_);
+ fprintf(stderr, "num: %f\tgrab_time: %f\n",
+ end_grab_, end_grab_ - start_grab_);
frc = target_->consume(&f);
return frc;
Modified: vic/branches/cc/video/grabber.cpp
==============================================================================
--- vic/branches/cc/video/grabber.cpp (original)
+++ vic/branches/cc/video/grabber.cpp Wed Mar 24 15:58:47 2010
@@ -85,6 +85,10 @@
contrast_ = 1.0;
for (int i = 0; i < 256; ++i)
ynorm_[i] = i;
+
+ // time measurement
+ start_grab_ = 0.;
+ end_grab_ = 0.;
}
Grabber::~Grabber()
Modified: vic/branches/cc/video/grabber.h
==============================================================================
--- vic/branches/cc/video/grabber.h (original)
+++ vic/branches/cc/video/grabber.h Wed Mar 24 15:58:47 2010
@@ -76,6 +76,11 @@
virtual int grab();
virtual void timeout();
int background() const;
+
+ // time measurement
+ double start_grab_;
+ double end_grab_;
+
protected:
/* hooks for conditional replenishment algorithm */
void suppress(const u_char* devbuf);
More information about the Sumover-dev
mailing list