[Ffmpeg-devel] Snow motion blocks

Yartrebo yartrebo
Fri Apr 15 07:09:53 CEST 2005

I've been playing around with the motion block functions and I seem to
be getting consistently better results using much simple functions than
the one currently in use (int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5);).

First off, vs. dsputil, complex is inferior and simple is superior, but
I need to run more varied tests (I didn't test that relation as much as
simples vs. complex).

For these tests, I've

I've been playing with the following three functions for mc_block:
1 - complex - int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5);
2 - middle - int am= 18*(a2+a3) - 2*(a1+a4);
3 - simple - int am = 16*(a2+a3);

In lossless mode, simple + hpel seems to give the best results. For
lossy mode, simple + qpel seems to give the best results.

sample: doodli-do (cartoon music video - raw tv cap)
simple + qpel: frame= 2698 q=0.0 LPSNR=Y:41.18 U:44.76 V:46.04 *:42.19
size=   25482kB time=90.0 bitrate=2319.0kbits/s
complex + qpel: frame= 2698 q=0.0 LPSNR=Y:41.11 U:44.67 V:45.96 *:42.11
size=   26928kB time=90.0 bitrate=2450.5kbits/s

sample: charlie chaplin (black and white video - mpeg4)
8809128 Apr 14 23:09 spaceballs_mc_complex.avi
8720006 Apr 14 23:26 spaceballs_mc_complex_qpel.avi
8843648 Apr 14 23:28 spaceballs_mc_full_complex_qpel.avi
8384154 Apr 14 23:40 spaceballs_mc_full_simple.avi
8623338 Apr 14 23:20 spaceballs_mc_full_simple_qpel.avi
9032272 Apr 14 23:37 spaceballs_mc_full_trivial2.avi
9006404 Apr 14 23:31 spaceballs_mc_full_trivial.avi
8796270 Apr 14 23:05 spaceballs_mc_mid.avi
8771816 Apr 14 23:01 spaceballs_mc_simple.avi
8700496 Apr 14 23:22 spaceballs_mc_simple_qpel.avi

Full refers to all motion blocks being handled by mc_block, and the
dsputil code is not called. Otherwise the motion blocks are handled by
the normal functions.

sample: Jakers (CG animation - mpeg4)
1558370 Apr 15 00:10 jakers_full_complex_quant2.avi
1509116 Apr 15 00:07 jakers_full_complex_quant2_qpel.avi
16794250 Apr 14 23:54 jakers_full_simple_lossless.avi
1480450 Apr 15 00:01 jakers_full_simple_quant2.avi
1477526 Apr 15 00:03 jakers_full_simple_quant2_qpel.avi

for the quant2 clips, psnr is better for the smaller (better compressed)
files, but I forgot to write down the exact psnr values. They didn't
differ by more than .10, and favored simple and qpel over complex and

I'll be running complex+qpel and simple+qpel on a full-length movie
(Matilda) overnight. Unfortunately, it is MPEG4, but I have no live-
action material that isn't divx or xvid, so it'll have to do for now.

Would you have any explanation for the empirical results I'm getting?
Even your commented-out mid function (int am= 18*(a2+a3) - 2*(a1+a4);)
performed better than the complex one.

Considering that simple is far faster to implement than complex, it
really is worth a deeper look (motion comp is a very large part of snow
decode time, especially with all my asm code applied).


More information about the ffmpeg-devel mailing list