[FFmpeg-devel] [PATCH] libavcodec/zmbvenc.c: don't allow motion estimation out of range.

Tomas Härdin tjoppen at acc.umu.se
Sun Dec 9 13:37:43 EET 2018


lör 2018-12-08 klockan 00:29 +0000 skrev Matthew Fearnley:
> All that said, *xored==0 is actually the most desirable outcome because it
> means the block doesn't need to be output.
> So if *xored is 0, the best thing to do is probably to finish immediately
> (making sure *mx,*my are set), without processing any more MVs.
> And then it doesn't matter (from a correctness point of view, at least) if
> block_cmp() gives bad entropy results, as long as *xored is set correctly.
> 
> Note: the code currently exits on bv==0.  It's a very good result, but it
> does not always imply the most desirable case, because it will happen if
> the xored block contains all 42's (etc), not just all 0's.
> It's obviously highly compressible, but it would still be better if the
> block could be omitted entirely.  Maybe it's an acceptable time/space
> tradeoff though.  I don't know...

Another couple of thoughts crossed my mind regarding scoring:

The current scoring is entirely context-less. It might be better to at
the last bring in the histogram of the previous block into the current
one, to bias the encoder toward outputing similar bytes, thus making
zlib's job easier.

If blocks are scored primarily based on the number of zeroes, only
using the entropy model for breaking ties, then some MVs can be
discarded earlier if the number of non-zeroes exceeds the best MV found
so far. This should speed the encoder up considerably. It would bias
the output toward outputing more zeroes, which may or may not be
beneficial for the zlib step.

/Tomas


More information about the ffmpeg-devel mailing list