zoukankan      html  css  js  c++  java
  • 【mpeg2】mpeg2解码器开源实现:libmpeg2

    Date:2018.10.11


    1、libmpeg2介绍及其源码下载

    project homepage: http://libmpeg2.sourceforge.net/
    sourcecode download: https://sourceforge.net/projects/libmpeg2/
    github sourcecode download: https://github.com/aholtzma/mpeg2dec/tree/master
    开源协议: GNU General Public License version 2.0(GPLv2)

    摘抄自:http://libmpeg2.sourceforge.net/
    About libmpeg2
       libmpeg2 is a free library for decoding mpeg-2 and mpeg-1 video streams. It is released under the terms of the GPL license.

    The main goals in libmpeg2 development are:

    1. Conformance - libmpeg2 is able to decode all mpeg streams that conform to certain restrictions: “constrained parameters” for mpeg-1, and “main profile” for mpeg-2. In practice, this is what most people are using. For streams that follow these restrictions, we believe libmpeg2 is 100% conformant to the mpeg standards - and we have a pretty extensive test suite to check this.
    2. Speed - there has been huge efforts there, and we believe libmpeg2 is the fastest library around for what it does. Please tell us if you find a faster one! With typical video streams as found on DVD’s, and doing only decoding with no display, you should be able to get about 110 fps on a PIII/666, or 150 fps on an Athlon/950. This is less than 20 cycles per output pixel. In a real player program, the display routines will probably take as much time as the actual decoding!Speed - there has been huge efforts there, and we believe libmpeg2 is the fastest library around for what it does. Please tell us if you find a faster one! With typical video streams as found on DVD’s, and doing only decoding with no display, you should be able to get about 110 fps on a PIII/666, or 150 fps on an Athlon/950. This is less than 20 cycles per output pixel. In a real player program, the display routines will probably take as much time as the actual decoding!
    3. Portability - most of the code is written in C, and when we use platform-specific optimizations (typically assembly routines, currently used for the motion compensation and the inverse cosine transform stages) we always have a generic C routine to fall back on. This should be portable to all architectures - at least we have heard reports from people running this code on x86, ppc, sparc, arm and sh4. Assembly-optimized implementations are available on x86 (MMX) and ppc (AltiVec) architectures. Ultrasparc (VIS) is probably the next on the list - we’ll see.
    4. Reuseability - we do not want libmpeg2 to include any project-specific code, but it should still include enough features to be used by very diverse projects. We are only starting to get there - the best way to help here is to give us some feedback!
      The project homepage is at http://libmpeg2.sourceforge.net/

    优化说明:
       开源mpeg2解码器libmpeg2进行了x86、arm、ppc、alpha和sparc架构的优化,没有进行aarch64的优化。

    2、多平台编译测试

    当前最新版本是libmpeg2-0.5.1。
    libmpeg2解码库主要在Windows、Linux和ARM平台进行编译和性能测试。

    2.1 Linux平台

    编译很简单:

    ./configure
    make 
    

    编译生成的mpeg2解码器路径为: ./src/.libs/mpeg2dec

    ./mpeg2dec  -h
    libmpeg2-0.5.1 - by Michel Lespinasse <walken@zoy.org> and Aaron Holtzman
    usage: /home/soaringlee/Desktop/codecs/libmpeg2-0.5.1/src/.libs/lt-mpeg2dec [-h] [-o <mode>] [-s [<track>]] [-t <pid>] [-p] [-c] 
    		[-v] [-b <bufsize>] <file>
    	-h	display help and available video output modes
    	-s	use program stream demultiplexer, track 0-15 or 0xe0-0xef
    	-t	use transport stream demultiplexer, pid 0x10-0x1ffe
    	-p	use pva demultiplexer
    	-c	use c implementation, disables all accelerations
    	-v	verbose information about the MPEG stream
    	-b	set input buffer size, default 4096 bytes
    	-o	video output mode
    			null
    			nullslice
    			nullskip
    			nullrgb16
    			nullrgb32
    			pgm
    			pgmpipe
    			md5
    
    2.2 Windows平台

    源码中没有windows平台的vs工程,首先需要建立库和demo的vs工程。
    代码提取可以参考我的博客:
    libmpeg2开源解码器的Windows工程搭建和编译

    2.3 ARM平台

    ARM32位:

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

    ARM64位:

    ./configure --host=aarch64-unknown-linux
    make
    
    3、性能测试
    3.1 Windows平台

    测试配置:Intel® Core™ i5-6500 CPU @3.20GHZ
    win32

    分辨率 目标码率 平均解码帧率(汇编优化)/fps
    720P 512k 532
    720P 1024k 490
    720P 1536k 473
    720P 2048k 440
    3.2 Linux平台

    测试配置:Intel® Xeon® CPU E5-2667 v3 @3.2GHZ 32核

    Linux32位平均性能:

    分辨率 目标码率 平均解码帧率(纯C)fps 平均解码帧率(汇编优化)fps
    720P 512k 874 2483
    720P 1024k 730 2086
    720P 1536k 669 1456
    720P 2048k 640 1518

    Linux64位平均性能:

    分辨率 目标码率 平均解码帧率(纯C)fps 平均解码帧率(汇编优化)fps
    720P 512k 1049 3267
    720P 1024k 934 2400
    720P 1536k 839 1975
    720P 2048k 821 2086
    3.3 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 105 189
    720P 1024k 94 150
    720P 1536k 90 141
    720P 2048k 90 140

    ARM64位平均性能:

    分辨率 目标码率 平均解码帧率(纯C)fps
    720P 512k 248
    720P 1024k 213
    720P 1536k 201
    720P 2048k 198
    4、主要耗时模块分析

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


    THE END!

  • 相关阅读:
    [转]如何烧录tizen镜像文件?(图文教程)
    [转]如何制作tizen镜像文件(图文教程)?
    [转]如何下载tizen源码(图文教程)?
    [转]如何编译tizen源码(图文教程)?
    uclibc,eglibc,glibc之间的区别和联系
    Create a Bootable MicroSD Card
    [Tizen]Creating a Tizen Platform Image from Scratch through Local Build
    OpenSSL加解密
    [20个项目学会BBC micro:bit编程] 11-模拟舵机控制实验
    【BBC micro:bit基础教程】10-micro:bit操作电位计(滑动变阻器)
  • 原文地址:https://www.cnblogs.com/SoaringLee/p/10532339.html
Copyright © 2011-2022 走看看