[Ffmpeg-devel] Native H.264 encoder

Luca Abeni lucabe72
Wed Dec 13 10:41:41 CET 2006

Hi Takis,

On Tue, 2006-12-12 at 16:13 +0100, Panagiotis Issaris wrote:
> > Ok; I tested the non-mmx version, and it is quite fast (about as fast as
> > x264 with mmx optimizations). Quality is not good, but I guess it can be
> > enhanced ;-)
> I've updated the MMX patch [*] and while the C DCT took about 1800
> decicycles, the MMX optimized one:
> 1068 dezicycles in DCTMMX, 16776031 runs, 1185 skips11884.2kbits/s    
> frame=  101 q=-1.0 Lsize=    5725kB time=4.0 bitrate=11608.9kbits/s    
> video:5725kB audio:0kB global headers:0kB muxing overhead 0.000000%
> But no need to get excited, cause although the DCT is considerably
> faster, the overall execution time remains the same.
You are right... I just performed some quick tests on a 20-seconds-long
video captured from tv, and here are the results:
ffmpeg's mpeg4 encoder (for reference):
time ./ffmpeg -y -i /tmp/test.y4m -b 400k test.m4v) ---> 1.13s
your non-mmx patch:
time ./ffmpeg -y -i /tmp/test.y4m -b 400k -vcodec ffh264 test.h264 ---> 4.89s
your mmx patch (same command line): 4.98s
The results are consistent across multiple runs... So, it seems that the
non-mmx patch is slightly faster? (The ffmpeg binary generated with the
non-mmx patch is a little bit smaller, so maybe it's a cache effect? I
do not know).

> Furthermore, I haven't cleaned this patch up yet, as I think it might be
> wiser to focus first on getting the C version in the main FFmpeg tree.
I perfectly agree with you.

BTW, I tried to have a better look at the quality of the encoded
video... Looking at the artefacts, someone suggested that they might be
due to poor motion estimation.
Your encoder is using its own code for motion estimation, right? How
difficult would it be to reuse ffmpeg's code?
If you agree that motion estimation can be one of the problems for the
quality, I'll try to have a look at using libavcodec's routines... But
I'll be able to work on it only in background, after finishing with the
swscale stuff.

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

More information about the ffmpeg-devel mailing list