【mpeg2】mpeg2编码器的开源实现:x262

Date: 2018.10.15


1、x262介绍及其源码下载

项目主页https://www.videolan.org/developers/x262.html
源码下载地址http://git.videolan.org/?p=x262.git;a=tree
或者:https://github.com/kierank/x262
开源协议:GNU General Public License version 2.0(GPLv2)

x262简介:x262是基于x264最佳性能开发的MPEG-2编码器,由VideoLAN(a project and non-profit organization)发布。
下面介绍摘抄自:https://www.videolan.org/developers/x262.html
    x262 is a free software library and application for encoding video streams into the MPEG-2 compression format, and is released under the terms of the GNU GPL.
    x262 is an MPEG-2 encoder based on the best-in-class features of x264.
    It also has the big advantage that the codec is simple enough for people new to video-compression to get involved.
Encoder features:

  • Adaptive B-frame placement
  • Custom quantization matrices
  • Interlacing (frame/field adaptation per macrolock)
  • Ratecontrol: constant quantizer, constant quality, single or multipass ABR, optional VBV
  • Scenecut detection
  • Parallel encoding on multiple CPUs
  • Psy optimizations for detail retention (adaptive quantization, psy-RD, psy-trellis)
  • Zones for arbitrarily adjusting bitrate distribution

优化说明: x262进行了x86、arm、ppc和opencl架构的优化,没有进行aarch64架构的优化。

2、Linux平台编译、运行和性能测试

Linux平台下的编译很简单!
编译:
Linux 32位:

./configure --extra-cflags=-m32 --extra-ldflags=-m32
make

Linux 64位:

./configure
make

生成的mpeg2编码器为:x262(x262实质上是x264的符号链接)

运行命令行:

./x262 -o test.mpeg2  foreman_cif.yuv  --input-res 352x288 --mpeg2 -B 1024

Linux平台编码性能测试:
测试配置:Intel® Xeon® CPU E5-2667 v3 @3.2GHZ 32核

Linux32位:

分辨率 目标码率 平均解码帧率(纯C)fps 平均解码帧率(汇编优化)fps
720P 512k 84 209
720P 1024k 58 161
720P 1536k 73 196
720P 2048k 58 233

Linux64位:

分辨率 目标码率 平均解码帧率(纯C)fps 平均解码帧率(汇编优化)fps
720P 512k 56 167
720P 1024k 84 271
720P 1536k 48 265
720P 2048k 46 236
3 、ARM平台编译、运行和性能测试

编译:
ARM 32位:

./configure --host=arm-hisiv500-linux --cross-prefix=arm-hisiv500-linux-
make

ARM 64位:

./configure --host=aarch64-himix100-linux --cross-prefix=aarch64-himix100-linux-
make

运行:

./x262 -o test.mpeg2  foreman_cif.yuv  --input-res 352x288 --mpeg2 -B 1024

ARM平台编码性能测试:
测试配置:Hisi3519 ARMv7 32位架构
双核: A7@800MHZ, 32KB I-Cache
A17@1.25GHZ,32KB I-Cache
内存: 1GB
测试配置:Hisi3559 ARMv8 64位架构

ARM32位:

分辨率 目标码率 平均解码帧率(纯C)fps 平均解码帧率(汇编优化)fps
720P 512k 2.16 4.71
720P 1024k 2.14 4.81
720P 1536k 2.23 4.95
720P 2048k 2.20 4.98

ARM64位:

分辨率 目标码率 平均解码帧率(纯C)fps
720P 512k 7.07
720P 1024k 6.52
720P 1536k 7.11
720P 2048k 7.25
4 、主要耗时模块分析

    通过gprof工具对Linux平台和Arm平台进行分析可知,x262编码器的主要耗时模块包括:ME模块、插值模块、Quant模块和IDCT模块。


THE END

posted @ 2018-10-15 14:16  SoaringLee_fighting  阅读(643)  评论(0编辑  收藏  举报