Open main menu

DAVE Developer's Wiki β

Changes

Created page with "{{InfoBoxTop}} {{AppliesToAXELULite}} {{AppliesToSBCLynx}} {{InfoBoxBottom}} == History == {| class="wikitable" border="1" !Version !Date !Notes |- |1.0.0 |Jul 2017 |First rel..."
{{InfoBoxTop}}
{{AppliesToAXELULite}}
{{AppliesToSBCLynx}}
{{InfoBoxBottom}}
== History ==
{| class="wikitable" border="1"
!Version
!Date
!Notes
|-
|1.0.0
|Jul 2017
|First release
|-
|}
==Introduction==
As known, i.MX6UL SoC has not an IPU cell allowing strong performances on video acquisition. However, using an USB camera it is possible to capture a raw data video playing it on LCD controller.

This application note describes some tests that were performed on an AXELULite-based platform to evaluate the capabilities and the performances of the i.MXUL when it captures and displays a camera source on LCD panel. The test bed was based on Yocto distribution using smart package manager for adding required software component.

==USB camera driver==

Common USB cameras can be used with a standard <code>USB Video Class driver</code>. Linux kernel must be compiled with this driver built-in or the kernel module can be dynamically loaded (in this case it has to be available on <b><i>/lib/modules</i></b> root file system directory).

Once plugged on USB host connector, the kernel driver recognizes the device and create the device node <code>/dev/video1</code>

<pre class="board-terminal">
[ 6.989549] uvcvideo: Found UVC 1.00 device USB2.0 Camera (1871:0141)
[ 7.041576] input: USB2.0 Camera as /devices/soc0/soc.0/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1:1.0/input/input5
[ 7.138819] usbcore: registered new interface driver uvcvideo
[ 7.191864] USB Video Class driver (1.1.1)
[ 7.439394] usb_audio: Warning! Unlikely big volume range (=6144), cval->res is probably wrong.
[ 7.489486] usb_audio: [3] FU [Mic Capture Volume] ch = 1, val = 5120/11264/1[ 7.546073] usbcore: registered new interface driver snd-usb-audio
</pre>

==gstreamer==
Starting from original Yocto based root file system provided [https://mirror.dave.eu/lynx/xuelk-1.1.3/xuelk-1.1.3_lynx-image-devel-sbc-lynx.tar.bz2 here], more packages need to be added for using the well known multimedia framework [https://gstreamer.freedesktop.org gstreamer]

More info about gstreamer can be found [https://gstreamer.freedesktop.org here] and on Github [https://github.com/GStreamer gstreamer] server


We assume that network interface has been already configured for Internet access. In any case, simple configuration can be done directly on serial console with the following commands:

<pre class="board-terminal">
root@sbc-lynx:~# ifconfig eth0 192.168.0.94
root@sbc-lynx:~# route add default gw 192.168.0.254
root@sbc-lynx:~# echo "nameserver 8.8.8.8" > /etc/resolv.conf
</pre>

where ''192.168.0.254'' is the <code>gateway</code> address and ''8.8.8.8'' is the <code>DNS server</code> (in this case Google's one).

== smart packages ==
Firts of all, <b>SMART</b> channels must be added for accessing DAVE's server for Yocto pre-built packages, using the following commands:

<pre class="board-terminal">
root@sbc-lynx:~# smart channel --add cortexa7hf_vfp_neon type=rpm-md baseurl=http://yocto.dave.eu/xuelk-latest/cortexa7hf_vfp_neon
root@sbc-lynx:~# smart channel --add cortexa7hf_vfp_neon_mx6ul type=rpm-md baseurl=http://yocto.dave.eu/xuelk-latest/cortexa7hf_vfp_neon_mx6ul
root@sbc-lynx:~# smart channel --add sbc_lynx type=rpm-md baseurl=http://yocto.dave.eu/xuelk-latest/sbc_lynx
</pre>

and finally updating the smart cache checking for the new available packages:

<pre class="board-terminal">
root@sbc-lynx:~# smart update
</pre>


===Adding gstreamer packages===

It is possibile to install the '''gstreamer 1.0''' tool using the following command:

<pre class="board-terminal">
root@sbc-lynx:~# smart install gstreamer1.0-1.4.5-r0
...
...
</pre>

as it's shown on installation log, smart asks for installing xxx MB of additional packages.

Then, it is enough to install the other gstreamer <code>plugins</code>, for example:

<pre>
gstreamer1.0-plugins-good-1.4.5-r0
gstreamer1.0-plugins-base-1.4.5-r0
gstreamer1.0-plugins-bad-1.4.5-r0
</pre>

===gstreamer pipeline===

The pipeline used is the easiest one for capturing a raw data stream from a standard USB camera

gst-launch-1.0 -v v4l2src device=/dev/video1 ! imxv4l2sink

==Test bed==
* iMX6UL cpu is running at 528MHz
<pre class="board-terminal">
root@arm:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
528000
</pre>
* system DRAM is 256MB
* lcd panel is 800x480

==Results==
===Use case #1: Video capture 640x480@30fps===
* pipeline:
<pre class="board-terminal">
gst-launch-1.0 -v v4l2src device=/dev/video1 ! 'video/x-raw, format=YUY2, width=640, height=480, framerate=30/1' ! imxv4l2sink force-aspect-ratio=true
</pre>
* top process shows that cpu is running at 20%

<pre class="board-terminal">
Mem: 81752K used, 165412K free, 356K shrd, 9084K buff, 18600K cached
CPU: 2% usr 13% sys 0% nic 64% idle 0% io 0% irq 19% sirq
Load average: 0.13 0.09 0.05 1/64 452
PID PPID USER STAT VSZ %VSZ %CPU COMMAND
432 386 root S 35364 14% 22% gst-launch-1.0 -v v4l2src device=/dev/
447 386 root R 2828 1% 2% top -d 1
71 2 root SW 0 0% 1% [pxp_dispatch]
3 2 root SW 0 0% 1% [ksoftirqd/0]
382 1 root S 5028 2% 0% /usr/sbin/tcf-agent -d -L- -l0
...
</pre>

===Use case #2: Video capture 640x480@30fps scaled to 320x240===
This use case is similar to the previous one, but the video data has been scaled to 1/4 using the <code>imxv4l2sink</code> plugin overlay capabilities

<pre class="board-terminal">
gst-launch-1.0 -v v4l2src device=/dev/video1 ! 'video/x-raw, format=YUY2, width=320, height=240, framerate=30/1' ! imxv4l2sink overlay-top=120 overlay-left=240 overlay-width=320 overlay-height=240 force-aspect-ratio=true
</pre>

===Use case #3: Video capture 640x480@30fps with rotation===
In this use case the PXP iMX6UL hardware cell is performing an image rotation on the screen using the <code>imxvideoconvert_pxp</code> <b>NXP</b> gstreamer plugin
<pre class="board-terminal">
gst-launch-1.0 -v v4l2src device=/dev/video1 ! capsfilter caps="video/x-raw, width=640, height=480, framerate=30/1" ! imxvideoconvert_pxp rotation=1 ! imxv4l2sink force-aspect-ratio=true
</pre>
8,256
edits