AV1源码分析(一)

AOM 工程

AOMedia Video 1是一个开放、免专利的影片编码格式,专为通过网络进行流传输而设计。它由开放媒体联盟开发,该联盟由半导体企业、视频点播供应商和网页浏览器开发商于2015年成立。互联网工程任务组也将这项工作标准化为互联网视频编解码器(NetVC)。
AV1的目标是取代其前身,即由谷歌开发的VP9视频压缩格式,并与动态图像专家组(MPEG)领导开发的高效率视频编码(HEVC)以及由中华人民共和国的数字音视频编码技术标准工作组主导开发的第二代数字音视频编解码技术标准(AVS2)竞争。
AV1可以与Opus音频格式一起封装在WebM容器格式中,并可用于HTML5网络视频和网页即时通信。

  1. AV1 前期准备:
  • 安装CMake,版本需求 3.5 以上;
  • 安装Git;
  • 安装Perl;
  • 对于x86,需要安装yasm或nasm;
  • 安装python;
  1. 获取源码
$ git clone https://aomedia.googlesource.com/aom

googlesource不好上,幸好我在github上找到了他们的仓库:

$ git clone https://github.com/mozilla/aom.git
  1. Linux 下编译方法
    Linux 下的编译b比较简单了,只需要用cmake配置,然后make编译即可。
$ cmake path/to/aom
$ make

直接在aom目录下执行cmake命令会报这么个错:

Building from within the aom source tree is not supported.

解决办法是在aom目录下新建一个aom_build,然后进到aom_build目录执行上面的两条命令。
然而,在执行make时,又碰到编译错误:

[ 64%] Linking CXX executable examples/decode_with_drops
/usr/bin/ld: libaom.a(fwd_txfm_ssse3_x86_64.asm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libaom.a(quantize_ssse3_x86_64.asm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libaom.a(subpel_variance_sse2.asm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libaom.a(highbd_subpel_variance_impl_sse2.asm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
CMakeFiles/decode_with_drops.dir/build.make:144: recipe for target 'examples/decode_with_drops' failed
make[2]: *** [examples/decode_with_drops] Error 1
CMakeFiles/Makefile2:304: recipe for target 'CMakeFiles/decode_with_drops.dir/all' failed
make[1]: *** [CMakeFiles/decode_with_drops.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
  1. Windows 下编译方法
    Windows下使用Visual Studio同样可以编译运行av1的代码。只需要在cmake时指定 VS 版本号即可,支持的工具可以通过cmake --help来查看。
$ make aom_vs
$ cd aom_vs
$ cmake /path/to/aom -G "Visual Studio 12 2013 Win64" -DCONFIG_AV1_ENCODER=0 -DCONFIG_LOWBITDEPTH=0 -DAOM_TARGET_CPU=generic

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章