Commit 4c5621c2 authored by Thiago Santini's avatar Thiago Santini

Updates uvcengine and adjusts output precision

Since we now have sub-millisecond precision in the data, we control output
width based on the fractional part so we don't lose precision
parent bd209a25
...@@ -11,19 +11,15 @@ FrameGrabber::FrameGrabber(QString id, int code, QObject* parent) ...@@ -11,19 +11,15 @@ FrameGrabber::FrameGrabber(QString id, int code, QObject* parent)
, code(code) , code(code)
, yuvBuffer(nullptr) , yuvBuffer(nullptr)
, yuvBufferSize(0) , yuvBufferSize(0)
, watchdog(new QTimer(this))
, timeoutMs(2e3) , timeoutMs(2e3)
{ {
#ifdef TURBOJPEG #ifdef TURBOJPEG
tjh = tjInitDecompress(); tjh = tjInitDecompress();
#endif #endif
watchdog = new QTimer(this);
connect(watchdog, SIGNAL(timeout()), this, SIGNAL(timedout())); connect(watchdog, SIGNAL(timeout()), this, SIGNAL(timedout()));
// for the first frame, we give a bit of extra leeway becase gstreamer is slow...
//watchdog->start(timeoutMs);
watchdog->start(15e3);
pmIdx = gPerformanceMonitor.enrol(id, "Frame Grabber"); pmIdx = gPerformanceMonitor.enrol(id, "Frame Grabber");
} }
...@@ -160,7 +156,7 @@ void FrameGrabber::setColorCode(int code) ...@@ -160,7 +156,7 @@ void FrameGrabber::setColorCode(int code)
bool FrameGrabber::jpeg2bmp(const QVideoFrame& in, cv::Mat& cvFrame) bool FrameGrabber::jpeg2bmp(const QVideoFrame& in, cv::Mat& cvFrame)
{ {
unsigned char* frame = const_cast<unsigned char*>(in.bits()); auto frame = const_cast<unsigned char*>(in.bits());
int len = in.mappedBytes(); int len = in.mappedBytes();
#ifdef TURBOJPEG #ifdef TURBOJPEG
......
...@@ -9,7 +9,7 @@ const char Token::HeaderEntry = 'H'; ...@@ -9,7 +9,7 @@ const char Token::HeaderEntry = 'H';
const char Token::MarkerIdDelimiter = ':'; const char Token::MarkerIdDelimiter = ':';
const char Token::MarkerValueDelimiter = 'x'; const char Token::MarkerValueDelimiter = 'x';
const char Token::MarkerEnd = ';'; const char Token::MarkerEnd = ';';
const int Token::Precision = 6; const int Token::Precision = 4;
const Timestamp maxTimestamp = std::numeric_limits<Timestamp>::max(); const Timestamp maxTimestamp = std::numeric_limits<Timestamp>::max();
......
...@@ -47,7 +47,7 @@ inline QString journalField(const T& v) ...@@ -47,7 +47,7 @@ inline QString journalField(const T& v)
template <> template <>
inline QString journalField<double>(const double& v) inline QString journalField<double>(const double& v)
{ {
return QString("%1%2").arg(v, 0, 'g', Token::Precision).arg(Token::Delimiter); return QString("%1%2").arg(v, 0, 'f', Token::Precision).arg(Token::Delimiter);
} }
template <> template <>
inline QString journalField<float>(const float& v) inline QString journalField<float>(const float& v)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment