Compiling g729 codecs for ARM on Raspberry Pi B+ with bcg729
24/08/2014 - 05:32 by poneyIn order to compile the g729 codec for a Raspberry Pi B+ (ARM processor), the fastest way is to build it with the bcg729. The bcg729 is a software encoder for g729a and decoder library written from scratch.
The resulting codec will be x2 slower than if it has been compiled with IPP.
System information
The following steps are performed on the Arch Linux installed on a Raspberry Pi B+
$ uname -a
Linux alarmpi 3.12.24-1-ARCH #1 PREEMPT Thu Jul 10 23:57:15 MDT 2014 armv6l GNU/Linux
$ cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
Features : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 0010
Serial : 000000000e2fc80c
Temporary tmpfs work dir
In order to avoid a heavy usage of the sdcard, it is possible to build a temporary tmpfs folder for compilation
$ cd /tmp
$ mkdir tmpfs
$ sudo mount -t tmpfs tmpfs tmpfs
$ cd tmpfs
Compiling bcg729
After that, we compile the bcg729 library. The default output path of the library files should be changed to /lib as Asterisk can not find it when loading the g729 codec
$ wget http://download-mirror.savannah.gnu.org/releases/linphone/plugins/sources/bcg729-1.0.0.tar.gz
$ tar xzf bcg729-1.0.0.tar.gz
$ cd bcg729-1.0.0
$ ./configure --libdir=/lib
$ make
$ sudo make install
Compiling g729 codecs
The next step is to compile the g723 and g729 codecs with bcg729 and copy them to /usr/lib/asterisk/modules folder
$ wget http://asterisk.hosting.lv/src/asterisk-g72x-1.2.tar.bz2
$ tar xjf asterisk-g72x-1.2.tar.bz2
$ cd asterisk-g72x-1.2
$ ./autogen.sh
$ ./configure --with-bcg729
$ make
$ sudo make install
Testing
And finally
$ sudo systemctl asterisk restart
$ sudo asterisk -rvvv
alarmpi*CLI> core show translation recalc 10
Recalculating Codec Translation (number of sample seconds: 10)
Translation times between formats (in microseconds) for one second of data
Source Format (Rows) Destination Format (Columns)
gsm ulaw alaw g726 adpcm slin lpc10 g729 ilbc g726aal2 g722 slin16 testlaw slin12 slin24 slin32 slin44 slin48 slin96 slin192
gsm - 15000 15000 15000 15000 9000 15000 15000 15000 15000 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
ulaw 15000 - 9150 15000 15000 9000 15000 15000 15000 15000 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
alaw 15000 9150 - 15000 15000 9000 15000 15000 15000 15000 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
g726 15000 15000 15000 - 15000 9000 15000 15000 15000 15000 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
adpcm 15000 15000 15000 15000 - 9000 15000 15000 15000 15000 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
slin 6000 6000 6000 6000 6000 - 6000 6000 6000 6000 8250 8000 6000 8000 8000 8000 8000 8000 8000 8000
lpc10 15000 15000 15000 15000 15000 9000 - 15000 15000 15000 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
g729 15000 15000 15000 15000 15000 9000 15000 - 15000 15000 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
ilbc 15000 15000 15000 15000 15000 9000 15000 15000 - 15000 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
g726aal2 15000 15000 15000 15000 15000 9000 15000 15000 15000 - 17250 17000 15000 17000 17000 17000 17000 17000 17000 17000
g722 15600 15600 15600 15600 15600 9600 15600 15600 15600 15600 - 9000 15600 17500 17000 17000 17000 17000 17000 17000
slin16 14500 14500 14500 14500 14500 8500 14500 14500 14500 14500 6000 - 14500 8500 8000 8000 8000 8000 8000 8000
testlaw 15000 15000 15000 15000 15000 9000 15000 15000 15000 15000 17250 17000 - 17000 17000 17000 17000 17000 17000 17000
slin12 14500 14500 14500 14500 14500 8500 14500 14500 14500 14500 14000 8000 14500 - 8000 8000 8000 8000 8000 8000
slin24 14500 14500 14500 14500 14500 8500 14500 14500 14500 14500 14500 8500 14500 8500 - 8000 8000 8000 8000 8000
slin32 14500 14500 14500 14500 14500 8500 14500 14500 14500 14500 14500 8500 14500 8500 8500 - 8000 8000 8000 8000
slin44 14500 14500 14500 14500 14500 8500 14500 14500 14500 14500 14500 8500 14500 8500 8500 8500 - 8000 8000 8000
slin48 14500 14500 14500 14500 14500 8500 14500 14500 14500 14500 14500 8500 14500 8500 8500 8500 8500 - 8000 8000
slin96 14500 14500 14500 14500 14500 8500 14500 14500 14500 14500 14500 8500 14500 8500 8500 8500 8500 8500 - 8000
slin192 14500 14500 14500 14500 14500 8500 14500 14500 14500 14500 14500 8500 14500 8500 8500 8500 8500 8500 8500 -
alarmpi*CLI>