[FFmpeg-devel] ZMBV Improved Motion Estimation

Mike Melanson mike
Thu May 8 07:27:13 CEST 2008


Hi,

I have been studying ZMBV (DosBox Capture Codec) for improvement 
opportunities. One of the first items I noticed was the motion 
estimator's block comparison function. Presently, the function XOR's 2 
blocks together bytewise and sums all XOR'd bytes, choosing the block 
with the lowest sum. This might help minimize error if the bytes in each 
block represented intensity levels. However, in this case, the bytes are 
palette indices and are more or less random numbers.

I propose that it would be more effective to simply sum the number of 
bytes between 2 blocks that are different. I also obtained some hard 
numbers using FLI files (the -new files use the attached patch):

$ dir *.avi
  17104594 2008-05-07 21:44 zmbv-capcom.avi
  16850122 2008-05-07 21:47 zmbv-capcom-new.avi
    796366 2008-05-07 21:55 zmbv-crusher.avi
    794910 2008-05-07 21:59 zmbv-crusher-new.avi
   2364794 2008-05-07 21:53 zmbv-float.avi
   2300892 2008-05-07 21:51 zmbv-float-new.avi

-- 
	-Mike Melanson


Index: libavcodec/zmbvenc.c
===================================================================
--- libavcodec/zmbvenc.c        (revision 13076)
+++ libavcodec/zmbvenc.c        (working copy)
@@ -65,7 +65,8 @@

      for(j = 0; j < bh; j++){
          for(i = 0; i < bw; i++)
-            sum += src[i] ^ src2[i];
+            if (src[i] ^ src2[i])
+                sum++;
          src += stride;
          src2 += stride2;
      }




More information about the ffmpeg-devel mailing list