[FFmpeg-devel] [PATCH 2/3] avcodec/mlpdec: Use get_bits() instead of get_bits_long() when possible

Michael Niedermayer michael at niedermayer.cc
Thu Jan 6 11:32:02 EET 2022


On Wed, Jan 05, 2022 at 10:38:34PM +0100, Andreas Rheinhardt wrote:
> huff_lsbs is guaranteed to be in the range of 0..24 and
> so is lsb_bits here, so one can use get_bits().
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>  libavcodec/mlpdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
> index 29fac54542..61b9a641dd 100644
> --- a/libavcodec/mlpdec.c
> +++ b/libavcodec/mlpdec.c
> @@ -268,7 +268,7 @@ static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp,
>              return AVERROR_INVALIDDATA;
>  
>          if (lsb_bits > 0)
> -            result = (result << lsb_bits) + get_bits_long(gbp, lsb_bits);
> +            result = (result << lsb_bits) + get_bits(gbp, lsb_bits);
>  
>          result  += cp->sign_huff_offset;
>          result *= 1 << quant_step_size;

This seems not to fully work

Assertion n>0 && n<=25 failed at libavcodec/get_bits.h:403

lsb_bits and cp->huff_lsbs are 31 in this failure, it seems
the checks that prevent this are conditional but i didnt debug/check this
any further

thx

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

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220106/04c523fc/attachment.sig>


More information about the ffmpeg-devel mailing list