summaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Collapse)Author
2018-12-21utils: checkstyle: add keep-one-line-blocksKieran Bingham
Enable --keep-one-line-blocks to prevent astyle from wanting to move single inlined blocks to cover 4 lines such as: - virtual int init() { return 0; } + virtual int init() + { + return 0; + } Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-19utils: checkstyle.py: Strip trailing white spacesLaurent Pinchart
As astyle doesn't strip trailing white spaces, strip them manually. Organize the code to allow for new additional formatting steps if needed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19utils: checkstyle.py: Highlight trailing white space at end of lineLaurent Pinchart
In order to facilitate interpretation of diffs, highlight trailing white space at end of lines with a red background. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19utils: checkstyle.py: Support execution from non-root directoriesLaurent Pinchart
The git diff command is invoked with relative paths, which causes git to fail to locate files when the checkstyle.py script is run from subdirectories of the git tree. Fix this by prepending the absolute path to the git tree root directory to the file names. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-14utils: Add Python-based commit style checker scriptLaurent Pinchart
checkstyle.py is a reimplementation of checkstyle.sh in Python, that should be easier to extend with additional features. Three additional features and enhancements are already implemented: - While retaining the default behaviour of operating on the HEAD commit, a list of commits can also be specified on the command line. - Correct line numbers are printed in the diff output. - The index and working tree are not touched, they can be dirty. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-11utils: ipu3: process: Configure formats on ImgU subdev padsLaurent Pinchart
Set format and selection rectangles on the ImgU subdev as required by the driver. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-11utils: ipu3: process: Fix typo in output files pathLaurent Pinchart
A typo in the output files path causes the script to attempt to write all captured frames to /. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-11utils: ipu3: Abort when sensor or media device isn't foundLaurent Pinchart
Calling exit from a function only exits from the function, it doesn't abort the whole script. Propagate the errors to stop operation when the sensor or media device can't be found. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-02utils: ipu3: Add test process scriptLaurent Pinchart
The script processes raw frames through the Intel IPU3 IMGU. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-11-29utils: ipu3: Add test capture scriptLaurent Pinchart
The script captures raw frames from cameras based on the Intel IPU3. It takes the sensor name as an argument and isn't meant to depend on a particular platform. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-11-20utils: ipu3: Add IPU3 raw capture unpack utilityLaurent Pinchart
The IPU3 captures Bayer data in a 25-pixels-in-32-bytes packed format, which no standard tool can process. Add a quick implementation of data unpacking to turn raw binary files into 16 bits per pixel unpacked Bayer data. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
"libcamera/internal/thread.h" #include "libcamera/internal/timer.h" #include "test.h" using namespace std; using namespace libcamera; class ManagedTimer : public Timer { public: ManagedTimer() : Timer(), count_(0) { timeout.connect(this, &ManagedTimer::timeoutHandler); } void start(int msec) { count_ = 0; start_ = std::chrono::steady_clock::now(); expiration_ = std::chrono::steady_clock::time_point(); Timer::start(msec); } void start(std::chrono::steady_clock::time_point deadline) { count_ = 0; start_ = std::chrono::steady_clock::now(); expiration_ = std::chrono::steady_clock::time_point(); Timer::start(deadline); } int jitter() { std::chrono::steady_clock::duration duration = expiration_ - deadline(); return abs(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count()); } bool hasFailed() { return isRunning() || count_ != 1 || jitter() > 50; } private: void timeoutHandler([[maybe_unused]] Timer *timer) { expiration_ = std::chrono::steady_clock::now(); count_++; } unsigned int count_; std::chrono::steady_clock::time_point start_; std::chrono::steady_clock::time_point expiration_; }; class TimerTest : public Test { protected: int init() { return 0; } int run() { EventDispatcher *dispatcher = Thread::current()->eventDispatcher(); ManagedTimer timer; ManagedTimer timer2; /* Timer expiration. */ timer.start(1000); if (!timer.isRunning()) { cout << "Timer expiration test failed" << endl; return TestFail; } dispatcher->processEvents(); if (timer.hasFailed()) { cout << "Timer expiration test failed" << endl; return TestFail; } /* * 32 bit wrap test * Nanosecond resolution in a 32 bit value wraps at 4.294967 * seconds (0xFFFFFFFF / 1000000) */ timer.start(4295); dispatcher->processEvents(); if (timer.hasFailed()) { cout << "Timer expiration test failed" << endl; return TestFail; } /* Timer restart. */ timer.start(500); if (!timer.isRunning()) { cout << "Timer restart test failed" << endl; return TestFail; } dispatcher->processEvents(); if (timer.hasFailed()) { cout << "Timer restart test failed" << endl; return TestFail; } /* Timer restart before expiration. */ timer.start(50); timer.start(100); timer.start(150); dispatcher->processEvents(); if (timer.hasFailed()) { cout << "Timer restart before expiration test failed" << endl; return TestFail; } /* Timer with absolute deadline. */ timer.start(std::chrono::steady_clock::now() + std::chrono::milliseconds(200)); dispatcher->processEvents(); if (timer.hasFailed()) { cout << "Absolute deadline test failed" << endl; return TestFail; } /* Two timers. */ timer.start(1000); timer2.start(300); dispatcher->processEvents(); if (!timer.isRunning()) { cout << "Two timers test failed" << endl; return TestFail; } if (timer2.jitter() > 50) { cout << "Two timers test failed" << endl; return TestFail; } dispatcher->processEvents(); if (timer.jitter() > 50) { cout << "Two timers test failed" << endl; return TestFail; } /* Restart timer before expiration. */ timer.start(1000); timer2.start(300); dispatcher->processEvents(); if (timer2.jitter() > 50) { cout << "Two timers test failed" << endl; return TestFail; } timer.start(1000); dispatcher->processEvents(); if (timer.jitter() > 50) { cout << "Two timers test failed" << endl; return TestFail; } /* * Test that dynamically allocated timers are stopped when * deleted. This will result in a crash on failure. */ ManagedTimer *dyntimer = new ManagedTimer(); dyntimer->start(100); delete dyntimer; timer.start(200); dispatcher->processEvents(); return TestPass; } void cleanup() { } }; TEST_REGISTER(TimerTest)