1. 程式人生 > >【mpeg2】mpeg2解碼器開源實現:libmpeg2

【mpeg2】mpeg2解碼器開源實現:libmpeg2

Date:2018.10.11

1、libmpeg2介紹及其原始碼下載

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/
2、多平臺編譯測試

當前最新版本是libmpeg2-0.5.1。 Linux平臺: 編譯很簡單:

./configure
make 

編譯生成的mpeg2解碼器路徑為: ./src/mpeg2dec

./mpeg2dec  -h
libmpeg2-0.5.1 - by Michel Lespinasse <[email protected].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


Windows平臺: 原始碼中沒有windows平臺的vs工程,首先需要建立庫和demo的vs工程。

3、效能測試

THE END!