Re: ABR encoder: bits in reservoir

Gabriel Bouvigne <[email protected]> Tue, 25 Jun 2019 15:03:20 +0200
Newsgroups gmane.comp.audio.mp3.lame
Message-ID <[email protected]>
On 2019-06-25 13:35, Elio Blanca via Lame-dev wrote:
> The critical computation seems to be into 'ResvAdjust' (reservoir.c)
> which updates the reservoir size:
> 
> gfc->sv_enc.ResvSize -= gi->part2_3_length + gi->part2_length;
> 
> without checking whether the resulting value goes below 0.
> Even tough, when I add such test and then set ResvSize to zero, bad
> things happen elsewhere. Mmmmmhhh.

part2_3 and part2 are bigger than the available space.
For a quick overview of what they are, see section "Side info for each 
granule" of this doc:
https://www.mp3-tech.org/programmer/docs/mp3_theory.pdf

My guess: part2 (scalefactors)is too big.

Regards,

--
Gabriel Bouvigne