DSP video (2009-08)
From AlwaysInnovating
This page gives information about DSP for an old software build (2009-08.x). Please upgrade to the latest release on which DSP is working much better, and visit this page. We keep this page for history purpose only.
OMAP3530 includes the TI DSP co-processor which can decode MPEG2/4 video. There are two architectures: DSP Bridge and DSP link.
Contents |
DSP Bridge
For DSP bridge, you need to update etc/init.d/dspbridge-init (release 2009-08.[a-b]) with the following code:
#!/bin/sh case "$1" in start) echo "Starting dspbridge" mkdir -p /tmp/dsp cp /lib/dsp/* /tmp/dsp cp /usr/bin/test-dsp/*.dll64P /tmp/dsp cp /usr/bin/test-dsp/*.dof64P /tmp/dsp modprobe bridgedriver base_img=/tmp/dsp/baseimage.dof modprobe dspbridge sleep 1 # Fix permissions chmod 660 /dev/DspBridge chown root:video /dev/DspBridge /usr/bin/dynreg.out -r /tmp/dsp/dctn_dyn.dll64P /usr/bin/dynreg.out -r /tmp/dsp/mp4vdec_sn.dll64P /usr/bin/dynreg.out -r /tmp/dsp/mpeg4aacdec_sn.dll64P /usr/bin/dynreg.out -r /tmp/dsp/postprocessor.dll64P /usr/bin/dynreg.out -r /tmp/dsp/ringio.dll64P /usr/bin/dynreg.out -r /tmp/dsp/usn.dll64P /usr/bin/dynreg.out -r /tmp/dsp/vpp_sn.dll64P ;; stop) echo "Stopping dspbridge" rmmod bridgedriver rmmod dspbridge ;; esac
Then you need to update the libomxil-ti package and start the service:
sudo -s
ipkg -force-depends remove libomxil-ti
ipkg install libomxil-ti_0.0+r1+gitr18b2794567728f3dfa6ec93f7e3b9a74f3549390-r1.1_armv7a.ipk
/etc/init.d/dspbridge-init start
exit
/usr/bin/omxregister-bellagio
You can test the DSP:
/usr/bin/dynreg.out -r /tmp/dsp/pingdyn_3430.dll64P
/usr/bin/test-dsp/ping.out
To play a video, try the following:
LD_PRELOAD=/lib/libbridge.so totem /home/ai/Videos/air.avi
DSP Link
You first need to create /etc/init.d/setup-dsplink.sh
# Default Memory Map
#
# Start Addr Size Description
# -------------------------------------------
# 0x80000000 227 MB Linux
# 0x8E300000 16 MB CMEM
# 0x8F300000 4 KB DSPLINK (RESET)
# 0x8F301000 1 MB DSPLINK (MEM)
# 0x8F400000 9 MB DDRALGHEAP
# 0x8FD00000 3 MB DDR2 (BIOS, Codecs, Applications)
modprobe cmemk phys_start=0x8e300000 phys_end=0x8f300000 pools=20x4096,8x131072,4x829440,1x5250000,1x1429440,1x256000
chgrp video /dev/cmem
modprobe dsplinkk
rm -f /dev/dsplink
mknod /dev/dsplink c `awk "\\$2==\"dsplink\" {print \\$1}" /proc/devices` 0
modprobe lpm_omap3530
Then you need to run the script:
sudo -s
/etc/init.d/setup-dsplink.sh
echo -e "\n* - rtprio 0\n@video - rtprio 99\n" >> /etc/security/limits.conf
exit
To play a video, use the following:
gst-launch -v filesrc location=/home/ai/Videos/air.avi ! avidemux name=demux demux.video_00 ! TIViddec2 ! omapfbsink
Note
The DSP Link also requires that you reserve a section of RAM for it that the Linux Kernel is not allowed to use. To do this you can specify "mem=227M" in the bootargs environment variable. I have worked through the steps to rebuild all of the DSP Link and associated software using OpenEmbedded and posted the info here: http://lists.linuxtogo.org/pipermail/openembedded-devel/2009-September/013553.html
With that configuration, I use mem=227M in my bootargs (use fw_printenv to examine and fw_setenv to modify) and the resulting code works well. Also note, the gstreamer-ti plugin that's required tries to create threads with RealTime scheduling priority. By default only root is allowed to do this, so the gst-launch examples above will only work when run as root. The Video codecs try to run with maximum(SCHED_FIFO) priority, and the Audio codecs run with maximum(SCHED_FIFO)-1. (That's 99 and 98, respectively on Linux.) You can also configure the privileges for non-root users by adding this to /etc/security/limits.conf:
* - rtprio 0 @video - rtprio 99
That will allow all users in the video group (see /etc/group) to raise their scheduling priority. The default user ai is in this group; you will probably have to logout and login again for this change to take effect.
Remarks
To play a video without DSP:
gst-launch filesrc location="/home/ai/Videos/air.avi" ! avidemux name=demux demux.audio_00 ! ffdec_mp3 ! alsasink
gst-launch filesrc location=/home/ai/Videos/air.avi ! avidemux name=demux demux.video_00 ! ffdec_mpeg4 ! ffmpegcolorspace ! omapfbsink
As a reminder, on a standard x86 Linux PC, you can run the following:
gst-launch filesrc location="/home/ai/Videos/air.avi" ! avidemux name=demux demux.audio_00 ! queue ! ffdec_mp3 ! audioconvert ! alsasink demux.video_00 ! queue ! ffdec_mpeg4 ! omapfbsink
