[FFmpeg-devel] MPEG-2 Acceleration Refactor

Greg Hulands ghulands
Mon Jun 18 01:39:24 CEST 2007


Hi,

On 17/06/2007, at 4:13 AM, Michael Niedermayer wrote:

> Hi
>> [...]
>> I think nothing has changed. The functions alone are faster, the
>> decoding as whole is slower ;) It's just one of the miracles of
>> benchmarking.
>
> the svn code vs. the patched code shows that the patched code is  
> slower
>
> the svn code + *TIMER vs. the patched code +TIMER shows that svn is
> slower in _both_ the TIMER and -benchmark scores

I think I have everything covered now in the patch. I'm pretty sure  
I've got all the cosmetic changes out of there (thank you pico!) now.  
I rebuilt with mmx enabled. The reason why I had been disabling it  
was that when I was stepping through my application in gdb, the stack  
was getting corrupted so I had put it down to it been mmx as quite  
some time ago I had read that mmx didn't work on the mac, but that is  
not true anymore.

I have re-benchmarked the patch and here are the results.

With Patch

Tiger1080:~/htp/trunk/ffmpeg ghulands$ ./ffmpeg -benchmark -threads 1  
-i ~/Desktop/720p-short.m2v -f rawvideo -y /dev/null
FFmpeg version SVN-r9339, Copyright (c) 2000-2007 Fabrice Bellard, et  
al.
   configuration: --disable-ffplay --disable-ffserver
   libavutil version: 49.4.0
   libavcodec version: 51.40.4
   libavformat version: 51.12.1
   built on Jun 17 2007 15:59:53, gcc: 4.0.1 (Apple Computer, Inc.  
build 5367)
Warning: not compiled with thread support, using thread emulation

Seems stream 0 codec frame rate differs from container frame rate:  
59.94 (60000/1001) -> 25.00 (25/1)
Input #0, mpegvideo, from '/Users/ghulands/Desktop/720p-short.m2v':
   Duration: 00:00:08.0, start: 0.000000, bitrate: 38867 kb/s
   Stream #0.0: Video: mpeg2video, yuv420p, 1280x720, 38810 kb/s,  
25.00 fps(r)
Output #0, rawvideo, to '/dev/null':
   Stream #0.0: Video: rawvideo, yuv420p, 1280x720, q=2-31, 200 kb/s,  
25.00 fps(c)
Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1244 fps=128 q=0.0 Lsize= 1679400kB time=49.8  
bitrate=276480.0kbits/s
video:1679400kB audio:0kB global headers:0kB muxing overhead 0.000000%
bench: utime=7.873s
bench: utime=7.846s
bench: utime=7.845s
bench: utime=7.863s
bench: utime=7.837s

Without Patch

Tiger1080:~/ffmpeg ghulands$ ./ffmpeg -benchmark -threads 1 -i ~/ 
Desktop/720p-short.m2v -f rawvideo -y /dev/null
FFmpeg version SVN-r9329, Copyright (c) 2000-2007 Fabrice Bellard, et  
al.
   configuration: --disable-ffplay --disable-ffserver
   libavutil version: 49.4.0
   libavcodec version: 51.40.4
   libavformat version: 51.12.1
   built on Jun 17 2007 16:06:29, gcc: 4.0.1 (Apple Computer, Inc.  
build 5367)
Warning: not compiled with thread support, using thread emulation

Seems stream 0 codec frame rate differs from container frame rate:  
59.94 (60000/1001) -> 25.00 (25/1)
Input #0, mpegvideo, from '/Users/ghulands/Desktop/720p-short.m2v':
   Duration: 00:00:08.0, start: 0.000000, bitrate: 38867 kb/s
   Stream #0.0: Video: mpeg2video, yuv420p, 1280x720, 38810 kb/s,  
25.00 fps(r)
Output #0, rawvideo, to '/dev/null':
   Stream #0.0: Video: rawvideo, yuv420p, 1280x720, q=2-31, 200 kb/s,  
25.00 fps(c)
Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1244 fps=130 q=0.0 Lsize= 1679400kB time=49.8  
bitrate=276480.0kbits/s
video:1679400kB audio:0kB global headers:0kB muxing overhead 0.000000%
bench: utime=7.958s
bench: utime=7.880s
bench: utime=7.949s
bench: utime=7.887s
bench: utime=7.903s


So the patch is faster when built with mmx. I decided to rebuild with  
mmx off just to try the bench marks again.

With Patch

Tiger1080:~/htp/trunk/ffmpeg ghulands$ ./ffmpeg -benchmark -threads 1  
-i ~/Desktop/720p-short.m2v -f rawvideo -y /dev/null
FFmpeg version SVN-r9339, Copyright (c) 2000-2007 Fabrice Bellard, et  
al.
   configuration: --disable-ffplay --disable-ffserver --disable-mmx
   libavutil version: 49.4.0
   libavcodec version: 51.40.4
   libavformat version: 51.12.1
   built on Jun 17 2007 16:23:27, gcc: 4.0.1 (Apple Computer, Inc.  
build 5367)
Warning: not compiled with thread support, using thread emulation

Seems stream 0 codec frame rate differs from container frame rate:  
59.94 (60000/1001) -> 25.00 (25/1)
Input #0, mpegvideo, from '/Users/ghulands/Desktop/720p-short.m2v':
   Duration: 00:00:08.0, start: 0.000000, bitrate: 38867 kb/s
   Stream #0.0: Video: mpeg2video, yuv420p, 1280x720, 38810 kb/s,  
25.00 fps(r)
Output #0, rawvideo, to '/dev/null':
   Stream #0.0: Video: rawvideo, yuv420p, 1280x720, q=2-31, 200 kb/s,  
25.00 fps(c)
Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1244 fps= 78 q=0.0 Lsize= 1679400kB time=49.8  
bitrate=276480.0kbits/s
video:1679400kB audio:0kB global headers:0kB muxing overhead 0.000000%
bench: utime=13.978s
bench: utime=13.954s
bench: utime=13.942s
bench: utime=13.942s
bench: utime=13.940s

Without Patch

Tiger1080:~/ffmpeg ghulands$ ./ffmpeg -benchmark -threads 1 -i ~/ 
Desktop/720p-short.m2v -f rawvideo -y /dev/null
FFmpeg version SVN-r9329, Copyright (c) 2000-2007 Fabrice Bellard, et  
al.
   configuration: --disable-ffplay --disable-ffserver --disable-mmx
   libavutil version: 49.4.0
   libavcodec version: 51.40.4
   libavformat version: 51.12.1
   built on Jun 17 2007 16:23:09, gcc: 4.0.1 (Apple Computer, Inc.  
build 5367)
Warning: not compiled with thread support, using thread emulation

Seems stream 0 codec frame rate differs from container frame rate:  
59.94 (60000/1001) -> 25.00 (25/1)
Input #0, mpegvideo, from '/Users/ghulands/Desktop/720p-short.m2v':
   Duration: 00:00:08.0, start: 0.000000, bitrate: 38867 kb/s
   Stream #0.0: Video: mpeg2video, yuv420p, 1280x720, 38810 kb/s,  
25.00 fps(r)
Output #0, rawvideo, to '/dev/null':
   Stream #0.0: Video: rawvideo, yuv420p, 1280x720, q=2-31, 200 kb/s,  
25.00 fps(c)
Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding
frame= 1244 fps= 66 q=0.0 Lsize= 1679400kB time=49.8  
bitrate=276480.0kbits/s
video:1679400kB audio:0kB global headers:0kB muxing overhead 0.000000%
bench: utime=14.168s
bench: utime=14.047s
bench: utime=14.089s
bench: utime=14.018s
bench: utime=14.023s


I don't understand why when I first benchmarked it, the patch was  
showing it was slightly slower, but now it is slightly faster. I have  
no idea why this would be the case. I would urge others to try the  
patch and see if you get the same results.

Hopefully this is the patch for the final time :-)

Cheers,
Greg

?



More information about the ffmpeg-devel mailing list