[FFmpeg-devel] [PATCH 7/7] mlp: check huff_lsbs only when codebook is used

Michael Niedermayer michaelni at gmx.at
Thu Feb 6 15:55:40 EET 2020


On Thu, Feb 06, 2020 at 02:59:03PM +0530, Jai Luthra wrote:
> On Tue, Feb 04, 2020 at 10:24:50PM +0100, Michael Niedermayer wrote:
> >On Mon, Feb 03, 2020 at 12:33:00AM +0530, Jai Luthra wrote:
> >>When no codebook is used, huff_lsbs can be more than 24 and still decode to
> >>original values once filters are applied.
> >
> >huff_lsbs can but get_bits() is limited to 25, you need get_bits_long() beyond
> 
> I see, thx Michael!
> 
> There are two ways to deal with this:
> 
> 1) Use get_bits_long() where get_bits() is used to read the lsb_bits from
> the bitstream as it is certainly going to be within 32.
> 
> 2) Limit huff_lsbs to 25 bits even if no codebook.
> 
> I tested encoding various samples and it does not go above 25 bits. It hits
> 25 in mlpenc because at the matrixing stage L+R channels get added together
> in a single channel, but I am not sure if other encoders would also adhere
> to that.
> 
> (I was previously wrong in assuming that it hits more than 24 at the
> filtering stage, I tested it [1] and it does so after the re-matrixing
> stage, before any FIR filters)
> 
> I prefer (1) as it is cleaner. Let me know if that is OK and I'll send a
> patch.

whatever you prefer that fixes the issue

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200206/da7d2e27/attachment.sig>


More information about the ffmpeg-devel mailing list