linux下编译libaom-av1

编译libaom-av1

cd ~/ffmpeg_sources && \
git -C aom pull 2> /dev/null || git clone --depth 1 https://aomedia.googlesource.com/aom && \
mkdir -p aom_build && \
cd aom_build && \
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off -DENABLE_NASM=on ../aom && \
PATH="$HOME/bin:$PATH" make && \
make install

问题

可能会在低版本GCC环境中,出现编译失败的情况,下面是运行在gcc4.9.2环境下

编译:
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off -DENABLE_NASM=on ..

cmake过程会检测当前CPU支持Intel avx2 指令集

Checking C compiler flag support for: -mavx2
-- Performing Test HAVE_C_FLAG
-- Performing Test HAVE_C_FLAG - Success
Checking C compiler flag support for: -mavx2
-- Performing Test HAVE_CXX_FLAG
-- Performing Test HAVE_CXX_FLAG - Success
编译错误信息:
[ 42%] Building C object CMakeFiles/aom_dsp_common_avx2_intrinsics.dir/aom_dsp/x86/intrapred_avx2.c.o
/home/aom/aom_dsp/x86/intrapred_avx2.c: In function ‘highbd_dr_prediction_z3_4x16_avx2’:
/home/aom/aom_dsp/x86/intrapred_avx2.c:3067:5: warning: implicit declaration of function ‘_mm256_bsrli_epi128’ [-Wimplicit-function-declaration]
     d1 = _mm256_bsrli_epi128(d[i], 8);
     ^
/home/aom/aom_dsp/x86/intrapred_avx2.c:3067:8: error: incompatible types when assigning to type ‘__m256i’ from type ‘int’
     d1 = _mm256_bsrli_epi128(d[i], 8);
        ^
CMakeFiles/aom_dsp_common_avx2_intrinsics.dir/build.make:158: recipe for target 'CMakeFiles/aom_dsp_common_avx2_intrinsics.dir/aom_dsp/x86/intrapred_avx2.c.o' failed
make[2]: *** [CMakeFiles/aom_dsp_common_avx2_intrinsics.dir/aom_dsp/x86/intrapred_avx2.c.o] Error 1
CMakeFiles/Makefile2:13147: recipe for target 'CMakeFiles/aom_dsp_common_avx2_intrinsics.dir/all' failed
make[1]: *** [CMakeFiles/aom_dsp_common_avx2_intrinsics.dir/all] Error 2

这里报错的原因是因为gcc4对avx2的指令集没有支持好导致报错。

修复:

我们可以 disable avx2 指令集后再重新编译,就可以解决。添加 -DENABLE_AVX2=off

cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off -DENABLE_NASM=on -DENABLE_AVX2=off  ..

如果你当前系统的gcc版本如果比较低,建议可以升级一下当前的系统环境,更新一下gcc的版本,gcc版本建议更新到 gcc 6.3.0 或更新的版本。

你可能感兴趣的:(#,AV1)