> ISO spec says the maximum should be 8191.  But as part of huffman
> decoding, you sometimes add 15 to the result, yielding values as large
> as 8206.  Right now, LAME (and the ISO dist10 code) will make use of
> the full range: values up to 8206.
> The question is, should LAME be modified to limit this range to 8191.

I'm not sure the ISO spec actually explicitly gives a maximum value; the
limit can be inferred from the Huffman code tables, though.  The largest
value possible is obtained in table 31, which uses 15 as an escape value to
signify the addition of 13 linbits:  2^13 - 1 + 15 = 8206.  The dist10 code
manages to screw this computation up, however - it uses 8191 + 14, an
off-by-one error.  Doh!

As for decoders, the ISO decoder has no built in limits - it will traverse
the tables and read the proper amount of linbits.  Winamp must be explicitly
checking for overflow, which, if you have properly implemented Huffman
decoding, should never be possible.  (And since you can exhaustively test
the tables, it should be relatively easy to verify your Huffman decoder.)


MP3 ENCODER mailing list ( )

Reply via email to