| August 15, 2009 10:00 AM PDT | |
============ Check out source code and compile with gcc ==========
1. Set up build environment. Please refer to the section "Check out source code and compile with gcc" in this article.
2. Go to http://www.audiocoding.com/. Download FAAD2 2.7 bootstrapped package.
3. Untar FAAD2 2.7 bootstrapped package and build it with gcc. Optionally, you may install it by doing "sudo make install"
$ tar xzvf faad2-2.7.tar.gz
$ cd faad2-2.7
$ ./configure --with-mp4v2
$ make
4. Edit ~/.buildrc. Add the following lines to it.
SetSDKPath("faad2_include", "/path/to/faad2-2.7/include")
SetSDKPath("faad2_lib", "/path/to/faad2-2.7/libfaad/.libs/libfaad.a")
5. Set BIF branch, target and profile as follow. And then build it by doing "3".
[0] Set BIF branch (hxclient_3_1_0_atlas_restricted)
[1] Set Target(s) (dtdrive)
[2] Set Profile (helix-client-all-defines)
[3] run: build -trelease
...
[13] Help Page (full help in build/doc/index.html)
[Q] Quit
6. Now the source code is checked out and dtdrive is successfully compiled with gcc.
============ compile with icc ==========
Recommend to use icc 11.1.064 or later.
0. Build FAAD2 2.7 with icc.
$ ./configure --with-mp4v2 CC=icc CXX=icpc
$ make
1. Edit the following files. Change g++ to $(CXX) except this line "CXX=g++" in all of the files.
client/medpltfm/hxmedpltfmdll.mak
client/netwksvc/hxnetwksvcpln.mak
common/lang/xml/xmldll.mak
common/log/logobserverfile/Makefile
protocol/sdp/sdpplin.mak
protocol/rtsp/rtspclntdll.mak
datatype/image/png/filewriter/Makefile
datatype/ngt/fileformat/dllumakefil.mak
datatype/tone/renderer/dllumakefil.mak
datatype/ram/fileformat/Makefile
datatype/rm/filewriter/Makefile
datatype/rm/fileformat/Makefile
datatype/rm/audio/renderer/Makefile
datatype/rm/audio/codec/ra8hbr/Makefile
datatype/rm/audio/codec/ra8lbr/Gecko2HelixDll.mak
datatype/rm/audio/codec/sipro/SiproHelixDll.mak
datatype/rm/imagemap/renderer/umakedll.mak
datatype/rm/video/payload/depacker/umakedll.mak
datatype/rm/video/renderer/umakedll.mak
datatype/rm/video/codec/g2mp4combo/dmp4.mak
datatype/rm/video/codec/g2mp4combo/mp4v.mak
datatype/rm/video/codec/rv1dec/drv1.mak
datatype/rm/video/codec/rv1dec/rv10.mak
datatype/rm/video/codec/rvg2dec/drv2.mak
datatype/rm/video/codec/rvg2dec/rv20.mak
datatype/rm/video/codec/rv89combo/drvc.mak
datatype/rm/video/codec/rv89combo/rv40.mak
datatype/rm/video/codec/rv89combo/rv30.mak
datatype/lsd/codec/Makefile
datatype/wav/filewriter/Makefile
datatype/mp3/fileformat/Makefile
datatype/mp3/renderer/Makefile
datatype/aac/codec/faad2Umakefil.mak
datatype/aac/filewriter/Makefile
datatype/aac/fileformat/aacffdll.mak
datatype/mpg/fileformat/Makefile
datatype/mpg/renderer/umakedll.mak
datatype/tools/xmlwriter/Makefile
datatype/tools/binwrtr/Makefile
datatype/mp4/fileformat/dllumakefil.mak
datatype/mp4/audio/renderer/dllumakefil.mak
datatype/h263/renderer/umakedll.mak
datatype/h263/codec/dh263.mak
datatype/mjpeg/renderer/Makefile
datatype/amr/fileformat/amrffdll.mak
datatype/tools/dtdriver/apps/dtdrive/Makefile
datatype-restricted/rm/video/codec/rv89combo/rv40dec.mak
datatype-restricted/rm/video/codec/rvg2dec/rvg2dec.mak
datatype/amr/fileformat/amrdump.mak
datatype/amr/codec/amr-wb/Makefile
datatype/amr/codec/amr-nb/Makefile
datatype/avi/fileformat/aviffdll.mak
filesystem/local/Makefile
3. Edit the following file, as a workaround of DPD200136428. You may skip this step first and try to compile dtdrive with icc. You are expected to see a few errors about type conversion while compiling the following file. The fix is to add force type casting, which is very simple. After applying the fix, compile it again.
datatype-restricted/rm/video/codec/rv89combo/enc/cinterp4i.cpp
4. Edit ./common/util/mmx_util.c in order to fix a code error. Here is the patch.
__asm__ __volatile (
- " pushl %%eax \n"
- " pushl %%ebx \n"
- " pushl %%ecx \n"
- " pushl %%edx \n"
+ " movl %%ebx, %%esi \n"
" pushfl \n"
" popl %%eax \n"
" movl %%eax, %%ebx \n"
" xorl $0x200000, %%eax \n"
" pushl %%eax \n"
" popfl \n"
" pushfl \n"
" popl %%eax \n"
" xorl %%ebx, %%eax \n"
" andl $0x200000, %%eax \n"
" jz jumphere \n"
" xorl %%eax, %%eax \n"
" cpuid \n"
" or %%eax, %%eax \n"
" jz jumphere \n"
" movl $1, %%eax \n"
" cpuid \n"
" movl %%eax, %%ecx \n"
" andl $0xf00, %%ecx \n"
" shrl $8, %%ecx \n"
" movl %%ecx, %0 \n"
" movl %%eax, %%ecx \n"
" andl $0xf0, %%ecx \n"
" shrl $4, %%ecx \n"
" movl %%ecx, %1 \n"
" movl %%eax, %%ecx \n"
" andl $0x0f, %%ecx \n"
" movl %%ecx, %2 \n"
" movl %%edx, %%eax \n"
" andl $0x800000, %%eax \n"
" jz jumphere \n"
" mov $1, %%eax \n"
" mov %%eax, %3 \n"
" and $0x2000000, %%edx \n"
" mov %%edx, %4 \n"
"jumphere: \n"
+ " movl %%esi, %%ebx \n"
- " popl %%edx \n"
- " popl %%ecx \n"
- " popl %%ebx \n"
- " popl %%eax \n"
:"=m" (family),"=m" (model), "=m" (stepping), "=m" (has_mmx), "=m" (has_kni)
: /*no input*/
+ :"eax", "ecx", "edx", "esi"
);
5. Edit datatype-restricted/rm/video/codec/rv89combo/disp/ccbridge.h to fix a source code bug.
@@ -113,7 +113,7 @@The calling convention of T_POutputColorConvertor type is c calling convention. While that of IA_YUV12ToYUV, C_YUV12ToYUV and XC_YUV12ToYUV is stdcall. This causes a segmentation fault at runtime if you compile the source file dec/decoder.cpp with either icc or gcc -O2 -fomit-frame-pointer. gcc even reports two warning on the calling convention mismatch as follow.
#endif // !defined(GNUSTDCALL)
-typedef void (CC_CALLTYPE *T_POutputColorConvertor)(COLOR_CONVERTOR_PROTOTYPE);
+typedef void (CC_CALLTYPE *T_POutputColorConvertor)(COLOR_CONVERTOR_PROTOTYPE) GNUSTDCALL;
// The type of a pointer to a color convertor function
dec/decoder.cpp: In member function `Implementation_ID Decoder::selectImplementation(Hive*, Bool32, Implementation_ID)':
dec/decoder.cpp:1121: warning: invalid conversion from `void (*)(U8*, U8*, U8*, U32, U32, U32, U32, U32, U8*, U32, U32, I32, I32)' to `void (*)(U8*, U8*, U8*, U32, U32, U32, U32, U32, U8*, U32, U32, I32, I32)'
dec/decoder.cpp:1239: warning: invalid conversion from `void (*)(U8*, U8*, U8*, U32, U32, U32, U32, U32, U8*, U32, U32, I32, I32)' to `void (*)(U8*, U8*, U8*, U32, U32, U32, U32, U32, U8*, U32, U32, I32, I32)'
6. Compile dtdrive with icc.
$ make clean
$ make CC=icc CXX=icpc SUBMAKEFLAGS="CC=icc CXX=icpc"
7. Run dtdrive to decode your audio/video files. Please note, you need to go to the directory of dtdrive executable. In addition, make sure the environment variable LD_LIBRARY_PATH includes the path to Intel compiler dynamic libraries, since dtdrive and its dynamic libraries require Intel compiler libraries.
$ cd release
$ ./dtdrive +u file:///root/media/health.rm
============ Turn on more optimizations ==========
1. Edit $BUILD_ROOT/lib/pyar_exe.py
@@ -73,7 +73,7 @@
sys.exit(2)to_delete = []
- args=[ 'ar', sys.argv[1], sys.argv[2] ]
+ args=[ 'xiar', sys.argv[1], sys.argv[2] ]for o in sys.argv[3:]:
if o[-2:] == ".a":
@@ -85,7 +85,7 @@
if not os.path.isabs(o):
o = "../" + o
## Fixme: quoting
- os.system("ar x %s" % o)
+ os.system("xiar x %s" % o)
for f in os.listdir("."):
args.append("%s/%s" %( tmpdir,f ) )
os.chdir("..")
2. Edit common/include/atomicbase.h.
@@ -575,7 +575,7 @@
#elif defined(__GNUC__) && !defined(_OPENBSD) && !defined(_MAC_UNIX) && \
(__GNUC__>2 || (__GNUC__==2 && __GNUC_MINOR__>=95)) && \
( defined (__i486__) || defined (__i586__) || defined (__i686__) || \
- defined (__pentium__) || defined (__pentiumpro__))
+ defined (__pentium__) || defined (__pentiumpro__) || defined (__pentium4__))
/* Increment by 1 */
static __inline__ void
3. The makefiles are not well-written. In order to add additional compiler options easily, create wrapper scripts for icc and icpc: myicc and myicpc.
~/helix-source/myicc:
icc $@ -xSSE3_ATOM -ipo -O3
~/helix-source/myicpc:
icpc $@ -xSSE3_ATOM -ipo -O3
4. Clean and rebuild.
$ make clean
$ make CC=~/helix-source/myicc CXX=~/helix-source/myicpc SUBMAKEFLAGS="CC=~/helix-source/myicc CXX=~/helix-source/myicpc"
This article applies to: Intel® C++ Compiler for Linux* Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (0) 
Trackbacks (0)
Leave a comment 
Feilong H. (Intel)
|

