unix.zhegan.in
milter-callback changelog versions archive download latest stable g72x for */FreeBSD ru en

Assembling g723/g729 codecs for Asterisk/FreeBSD.

  • First you need to install the port lang/icc (if you want to compile your codecs with gcc, which I always do, you can skip that step). The most difficult task will probably be to find the tarball, 'cause the port version is kinda old. Though you still can use the cheat and take it from here :). Don't forget to kldload linux.ko before installing, because the port will install some of linux-base, because it depends on it and because this is a Linux compiler originally.

  • Second, you will need Intel/IPP. Go there and download Intel Integrated Performance Primitives (Intel IPP) for Linux. Intel will be insisting on saving some serial number and telling you will need it later, but for me it never was. Next you need to untar received tgz-archive somewhere. In order to extract needed files from rpm's you need to install the FreeBSD port rpm2cpio. Then you need to extract files from three rpm's, for me they were: intel-ippia32051-6.1p-051.i486.rpm, intel-ippia32lib051-6.1p-051.i486.rpm and intel-ippia32libdev051-6.1p-051.i486.rpm. If you want, you can try Linux installation script, but for me it didn't work, hanging somewhere after launching. Rpm2cpio works like:
    rpm2cpio.pl intel-ippia32051-6.1p-051.i486.rpm | cpio --extract --make-directories 
    		 
  • All you need to do next is just compile codecs. :) Sources can be downloaded from asterisk.hosting.lv, next thing - you need to extract 'em and make some changes to build.sh. You need to do the following things: define the location of the asterisk header files (in case of FreeBSD and asterisk from ports it's /usr/local/include), change the ipp location (ipproot), define your asterisk version and the processor family. If you want to compile your codecs with icc, you should edit that too, because by default they are building with gcc. Build.sh already has all of this as the examples, but you need to know that nowadays something has changed in Intel headers in IPP, and some of the header files changed their names. Proper naming can be determined from the readme.htm, which I did found in ~/g72x/opt/intel/ipp/6.1.2.051/ia32/tools/staticlib directory. Next thing you do is simply launch build.sh and watch the show:
    # ./build.sh
    gcc -Wall -shared -Xlinker -x -D_GNU_SOURCE -DG72X_ASTERISK=16 -DIPPCORE_NO_SSE -I/usr/local/include -I/home/emz/g72x/opt/intel/ipp/6.1.2.051/ia32/include -include /home/emz/g72x/opt/intel/ipp/6.1.2.051/ia32/tools/staticlib/ipp_px.h -march=pentium2 -O3 -fomit-frame-pointer -fPIC -DG72X_3 -o codec_g723.so codec_g72x.c decg723.c encg723.c owng723.c vadg723.c aux_tbls.c -L/home/emz/g72x/opt/intel/ipp/6.1.2.051/ia32/lib -lippscmerged -lippsrmerged -lippsmerged -lippcore
    gcc -Wall -shared -Xlinker -x -D_GNU_SOURCE -DG72X_ASTERISK=16 -DIPPCORE_NO_SSE -I/usr/local/include -I/home/emz/g72x/opt/intel/ipp/6.1.2.051/ia32/include -include /home/emz/g72x/opt/intel/ipp/6.1.2.051/ia32/tools/staticlib/ipp_px.h -march=pentium2 -O3 -fomit-frame-pointer -fPIC -DG72X_9 -DG72X_9_FP -o codec_g729.so codec_g72x.c decg729fp.c encg729fp.c owng729fp.c vadg729fp.c -L/home/emz/g72x/opt/intel/ipp/6.1.2.051/ia32/lib -lippscmerged -lippsrmerged -lippsmerged -lippcore
    encg729fp.c: In function 'CodecType2Num':
    encg729fp.c:85: warning: enumeration value 'G729I_CODEC' not handled in switch
    encg729fp.c: In function 'apiG729FPEncode':
    encg729fp.c:791: warning: enumeration value 'G729I_CODEC' not handled in switch
    vadg729fp.c: In function 'VoiceActivityDetect_G729_32f':
    vadg729fp.c:303: warning: suggest parentheses around && within ||
    		 

    Assembled codecs were functional, at least for me. No, you don't need to have kldloaded linux.ko for those codes to work. All described actions were taken on FreeBSD 8.0-RELEASE.

This article was last modified [an error occurred while processing the directive].