[FFmpeg-devel] [PATCH 1/2] libavcodec/zmbvenc: block scoring improvements/bug fixes

Tomas Härdin tjoppen at acc.umu.se
Thu Feb 21 12:19:08 EET 2019

ons 2019-02-20 klockan 22:12 +0100 skrev Michael Niedermayer:
> On Sat, Feb 09, 2019 at 01:10:20PM +0000, Matthew Fearnley wrote:
> > - Improve block choices by counting 0-bytes in the entropy score
> > - Make histogram use uint16_t type, to allow byte counts from 16*16
> > (current block size) up to 255*255 (maximum allowed 8bpp block size)
> > - Make sure score table is big enough for a full block's worth of bytes
> > - Calculate *xored without using code in inner loop
> This should have been split into multiple changes


> compression seems to become slightly worse from this change
> ./ffmpeg -i matrixbench_mpeg2.mpg -vframes 30 -vcodec zmbv -an -y test-old.avi
> ./ffmpeg -i matrixbench_mpeg2.mpg -vframes 30 -vcodec zmbv -an -y test-new.avi
> -rw-r----- 1 michael michael 1175466 Feb 20 22:06 test-new.avi
> -rw-r----- 1 michael michael 1174832 Feb 20 22:07 test-old.avi

A whopping 0.05% change, with an MPEG source rather than the intended

The flip side here is that we can now use larger block sizes and higher
me_range without crashing the encoder. We can add a slower mode that
tests a few different block sizes to see which one results in the
smallest output.


More information about the ffmpeg-devel mailing list