[FFmpeg-devel] ffvhuff bug when using median prediction + adaptive tables

infernix infernix
Sat Aug 4 19:40:39 CEST 2007


I am experiencing a bug in current svn that was introduced on May 19th.

When encoding certain streams to ffvhuff .avi files with median 
prediction + adaptive tables enabled, there are errors when playing back 
the finished encode.

I've tried to figure out how to enable median prediction + adaptive 
tables with ffmpeg svn (today) but cannot for the life of me figure out 
what the commandline is, so I can only show how to reproduce with 
mencoder using libavcodec (also todays svn, of course):

mencoder -oac pcm -nosound -o huffyuv_table_sample.avi -ovc lavc 
-lavcopts vcodec=ffvhuff:vstrict=-1:pred=2:context=1 

Then if you run "ffplay -an huffyuv_table_sample_context_pred.avi" 
you'll see 2 errors near or after frame 170:

Error generating huffman table

This error leads to a duplication of the last correctly decoded frame 
instead of the error frame, which results in bad video.

We've already narrowed this down to a SVN commit; there was a short 
discussion on mplayer-dev-eng from June 25th:
> Everything before patch:
> r9069 | lorenm | 2007-05-19 04:32:59 +0200 (Sat, 19 May 2007) | 2 lines
> change brute force search to min-heap. 3.6x faster generate_len_table,
> 8% faster ffvhuff encoding.
> works fine (this is everything newest revision except for the huffyuv.c file).
> All patches from 9069 -> now has the huffman table error.

Everything is fine if i enable only adaptive tables, or only median 
prediction, but it seems this bug is triggered when enabling both.

I've uploaded this sample to 
upload.mplayerhq.hu/MPlayer/incoming/ffvhuffbug/ and it's also available 
at http://dx.infernix.net/ffvhuff/

I've also attached a valgrind log but I'm not much of a coder so I can't 
tell if it's any help.

I'd appreciate it if someone could shine some light on this.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffvhuff_valgrind.log
Type: text/x-log
Size: 71033 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070804/0c2ae4c9/attachment.bin>

More information about the ffmpeg-devel mailing list