aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/texturedsp.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-23 14:33:38 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-26 20:38:30 +0200
commit59f7d685141d724d6ef845a9c0f81106eb87771c (patch)
tree0b58a3b884ac906b3973b2eca20b78ed70bf58bc /libavcodec/texturedsp.h
parent68b6614e389955016a77ff182f0a8bb03d41ae52 (diff)
downloadffmpeg-59f7d685141d724d6ef845a9c0f81106eb87771c.tar.gz
avcodec/magicyuv: Fix edge case of building Huffman table
The MagicYUV format stores Huffman tables in its bitstream by coding the length of a given symbol; it does not code the actual code directly, instead this is to be inferred by the rule that a symbol is to the left of every shorter symbol in the Huffman tree and that for symbols of the same length the symbol is ascending from left to right. With one exception, this is also what our decoder did. The exception only matters when there are codes of length 32, because in this case the first symbol of this length did not get the code 0, but 1; e.g. if there were exactly two nodes of length 32, then they would get assigned the codes 1 and 2 and a node of length 31 will get the 31-bit code 1 which is a prefix of the 32 bit code 2, making the Huffman table invalid. On the other hand, if there were only one symbol with the length 32, the earlier code would accept this un-Huffman-tree. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/texturedsp.h')
0 files changed, 0 insertions, 0 deletions