Sunday, March 25, 2012

Changelog for v0.9.0

About a year after the previous release (v0.8.10), here comes a shiny new version of v4l4j: v0.9.0 This version packs a few bug fixes and a lot of improvements, which I have detailed below:

  •  On the mailing list, Roberto reported on the mailing list there was no way to switch the input used for capture during capture, other than stopping the current frame grabber and re-creating another one. I have implemented a fix and it is now possible to change the current input while capturing, however, the time required to complete the switch is driver dependent, and, as Roberto reported, it can take a couple of frames for the switch to happen, and the switch might not happen between frames.
  • Leonardo reported a bug here due to v4l4j not handling properly string, interger64 and bitmask controls. This is now fixed.
  • An error reported by Jay here was occurring when capturing with PAC_3711 devices, which is now fixed
  • Many users have reported an issue where v4l4j fails to run because of undefined symbols. I tracked down the problem to some versions of GCC not parsing the command line in the same way as others, and ignoring the list of linked libraries.
  • Jeff reported a NullPointerException when stopping and starting the capture. This has been fixed.
  • v4l-utils has been updated to v0.8.6 .
  • v4l4j uses PixFC v0.3 to speed up the following conversions in v4l-utills: YUV422 <-> RGB24, YUV422P <-> RGB24, YUV420P <-> RGB24
  • JPEG conversions have also been optimised. v4l4j now only supplies downsampled YUV  frames to libjpeg, and relies on PixFC for YUV downsampling and RGB to YUV conversions.
  • I have updated the Ubuntu packages to not depend specifically on OpenJDK, as request on the mailing list.
  • Last, I started testing v4l4j in qemu emulating an ARMv7l architecture. While v4l4j builds fine, I couldn't actually test interactions with a video device. So ARM support is only experimental as this stage, but I am working on it actively.
Thanks to Daniel for sending some sample code showing how to integrate v4l4j with the Monte Media library to capture video and save it to a file. More on this here.

That's it. v4l4j v0.9.0 can be downloaded from here. Ubuntu packages will be available shortly.

Friday, March 23, 2012

Performance results for libjpeg-turbo

Awesome performance gain with libjpeg-turbo !!! It performs significantly faster than the older libjpeg62 / libjpeg8 implementation. I used the jpeg test app in v4l4j and here are the conversion timings for both libjpeg62 and libjpeg-turbo8

The table below shows the average conversion times over 10 runs for a 1280x1024 image in various YUV source format. Tests were run from a VM running Ubuntu 12.04 Precise beta1, so the conversion time itself does not mean much, but what's interesting is the comparison between the two implementations. In my tests, the turbo implementation was 3x to 4x faster.
libjpeg-turbo8 libjpeg62
YUYV to JPEG 5.5 ms 21.5 ms
UYVY to JPEG 5.7 ms 21.1 ms
YVYU to JPEG 6.8 ms 22.0 ms
YUV420p to JPEG 3.8 ms 15.6 ms
ARGB to JPEG 4.6 ms 16.4 ms
RGB24 to JPEG 4.6 ms 16.4 ms
BGRA to JPEG 4.6 ms 16.4 ms
BGR24 to JPEG 4.9 ms 16.4 ms