交叉编译libx264,用于arm上视频采集的h264编码。

先采用软编码调通后,再调用imx6集成的内部h264硬编解码器。

写一个编译脚本:

#!/bin/bash
./configure --prefix=/home/shell.albert/libx264arm \
--enable-shared \
--disable-asm \
--host=arm-linux \
--cross-prefix=arm-linux- \
--sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root \
--enable-pic

开始编译:

shell.albert@yantai:~/project/iMX6Build/x264-snapshot-20141218-2245> ./zsy.sh
platform:      ARM
system:        LINUX
cli:           yes
libx264:       internal
shared:        yes
static:        no
asm:           no
interlaced:    yes
avs:           avxsynth
lavf:          no
ffms:          no
mp4:           no
gpl:           yes
thread:        posix
opencl:        yes
filters:       crop select_every
debug:         no
gprof:         no
strip:         no
PIC:           yes
bit depth:     8
chroma format: all

You can run 'make' or 'make fprofiled' now.
shell.albert@yantai:~/project/iMX6Build/x264-snapshot-20141218-2245> make
cat common/opencl/x264-cl.h common/opencl/motionsearch.cl common/opencl/bidir.cl common/opencl/subpel.cl common/opencl/intra.cl common/opencl/weightp.cl common/opencl/downscale.cl | ./tools/cltostr.sh common/oclobj.h
dependency file generation...
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o x264.o x264.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o input/input.o input/input.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o input/timecode.o input/timecode.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o input/raw.o input/raw.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o input/y4m.o input/y4m.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o output/raw.o output/raw.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o output/matroska.o output/matroska.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o output/matroska_ebml.o output/matroska_ebml.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o output/flv.o output/flv.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o output/flv_bytestream.o output/flv_bytestream.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/filters.o filters/filters.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/video.o filters/video/video.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/source.o filters/video/source.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/internal.o filters/video/internal.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/resize.o filters/video/resize.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/cache.o filters/video/cache.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/fix_vfr_pts.o filters/video/fix_vfr_pts.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/select_every.o filters/video/select_every.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/crop.o filters/video/crop.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o filters/video/depth.o filters/video/depth.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o input/avs.o input/avs.c
In file included from input/avs.c:47:
./extras/avxsynth_c.h: In function 'avs_array_elt':
./extras/avxsynth_c.h:509: warning: declaration of 'index' shadows a global declaration
/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root/usr/include/string.h:309: warning: shadowed declaration is here
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o input/thread.o input/thread.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/mc.o common/mc.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/predict.o common/predict.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/pixel.o common/pixel.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/macroblock.o common/macroblock.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/frame.o common/frame.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/dct.o common/dct.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/cpu.o common/cpu.c
common/cpu.c:105: warning: 'sigill_handler' defined but not used
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/cabac.o common/cabac.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/common.o common/common.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/osdep.o common/osdep.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/rectangle.o common/rectangle.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/set.o common/set.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/quant.o common/quant.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/deblock.o common/deblock.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/vlc.o common/vlc.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/mvpred.o common/mvpred.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/bitstream.o common/bitstream.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/analyse.o encoder/analyse.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/me.o encoder/me.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/ratecontrol.o encoder/ratecontrol.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/set.o encoder/set.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/macroblock.o encoder/macroblock.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/cabac.o encoder/cabac.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/cavlc.o encoder/cavlc.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/encoder.o encoder/encoder.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/lookahead.o encoder/lookahead.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/threadpool.o common/threadpool.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o common/opencl.o common/opencl.c
arm-linux-gcc -Wshadow -O3 -ffast-math  -Wall -I. -I. --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -std=gnu99 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/slicetype-cl.o encoder/slicetype-cl.c
rm -f libx264.a
arm-linux-ar rc libx264.a  common/mc.o common/predict.o common/pixel.o common/macroblock.o common/frame.o common/dct.o common/cpu.o common/cabac.o common/common.o common/osdep.o common/rectangle.o common/set.o common/quant.o common/deblock.o common/vlc.o common/mvpred.o common/bitstream.o encoder/analyse.o encoder/me.o encoder/ratecontrol.o encoder/set.o encoder/macroblock.o encoder/cabac.o encoder/cavlc.o encoder/encoder.o encoder/lookahead.o common/threadpool.o common/opencl.o encoder/slicetype-cl.o
arm-linux-ranlib libx264.a
arm-linux-gcc -o x264  x264.o input/input.o input/timecode.o input/raw.o input/y4m.o output/raw.o output/matroska.o output/matroska_ebml.o output/flv.o output/flv_bytestream.o filters/filters.o filters/video/video.o filters/video/source.o filters/video/internal.o filters/video/resize.o filters/video/cache.o filters/video/fix_vfr_pts.o filters/video/select_every.o filters/video/crop.o filters/video/depth.o input/avs.o input/thread.o libx264.a -ldl  --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -lm -lpthread -ldl
arm-linux-gcc -o libx264.so.142  common/mc.o common/predict.o common/pixel.o common/macroblock.o common/frame.o common/dct.o common/cpu.o common/cabac.o common/common.o common/osdep.o common/rectangle.o common/set.o common/quant.o common/deblock.o common/vlc.o common/mvpred.o common/bitstream.o encoder/analyse.o encoder/me.o encoder/ratecontrol.o encoder/set.o encoder/macroblock.o encoder/cabac.o encoder/cavlc.o encoder/encoder.o encoder/lookahead.o common/threadpool.o common/opencl.o encoder/slicetype-cl.o    -shared -Wl,-soname,libx264.so.142  -Wl,-Bsymbolic --sysroot=/home/shell.albert/tools/toolschain_arm/4.4.3/arm-none-linux-gnueabi/sys-root -lm -lpthread -ldl
shell.albert@yantai:~/project/iMX6Build/x264-snapshot-20141218-2245> make install
install -d /home/shell.albert/libx264arm/bin
install x264 /home/shell.albert/libx264arm/bin
install -d /home/shell.albert/libx264arm/include
install -d /home/shell.albert/libx264arm/lib
install -d /home/shell.albert/libx264arm/lib/pkgconfig
install -m 644 ./x264.h /home/shell.albert/libx264arm/include
install -m 644 x264_config.h /home/shell.albert/libx264arm/include
install -m 644 x264.pc /home/shell.albert/libx264arm/lib/pkgconfig
ln -f -s libx264.so.142 /home/shell.albert/libx264arm/lib/libx264.so
install -m 755 libx264.so.142 /home/shell.albert/libx264arm/lib
shell.albert@yantai:~/project/iMX6Build/x264-snapshot-20141218-2245> ls
AUTHORS       config.log  COPYING    extras     libx264.so.142  version.sh  x264_config.h  x264.pc
common        config.mak  doc        filters    Makefile        x264        x264dll.c      x264res.rc
config.guess  config.sub  encoder    input      output          x264.c      x264.h         zsy.sh
config.h      configure   example.c  libx264.a  tools           x264cli.h   x264.o
shell.albert@yantai:~/project/iMX6Build/x264-snapshot-20141218-2245>

编译成功了,生成了动态库。

你可能感兴趣的:(软件技术)