]> git.sesse.net Git - ffmpeg/commit
avcodec/motionpixels: Only create VLC iff it is going to be used
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 29 Oct 2020 08:46:34 +0000 (09:46 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 24 Nov 2020 10:35:03 +0000 (11:35 +0100)
commite246ea2535da863be83d94c2da3248367f5c0684
tree2d2de79d883c0879ef643d3b31cd566d9b8e2052
parent97da1b4341a356d46e9b46f235f991a4de63195c
avcodec/motionpixels: Only create VLC iff it is going to be used

If the Huffman tree consists of only one entry (which has length zero),
no tree is used at all for parsing as the VLC API currently can't handle
this. So it makes no sense to create a VLC in this case.

Commit 41b7389cade702383e59343561776f83bb26e17f added a check for
whether creating the VLC should be skipped, but it also skipped decoding
the packet and it used the wrong check: It checked max_codes_bits,
the maximum length of a code; but this value is only updated iff there is
more than one Huffman entry. So if there is only one Huffman entry, and
there was a previous frame with more than one entry, then a VLC was
created unnecessarily; yet if there was no previous frame with more than
one entry, then this frame will be skipped which is probably
spec-incompliant. I have no sample for the latter.

This commit improves the check to create a VLC iff it is going to be
used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/motionpixels.c