[FFmpeg-devel] [PATCH 3/3] avcodec/ff_init_vlc_sparse: use a local array for static vlcs avoiding malloc()

Michael Niedermayer michaelni at gmx.at
Sat Jul 13 14:09:50 CEST 2013


On Sat, Jul 13, 2013 at 01:58:11PM +0200, Nicolas George wrote:
> Le quintidi 25 messidor, an CCXXI, Michael Niedermayer a écrit :
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavcodec/bitstream.c |   14 ++++++++------
> >  1 file changed, 8 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
> > index aac32a5..d748de5 100644
> > --- a/libavcodec/bitstream.c
> > +++ b/libavcodec/bitstream.c
> > @@ -270,6 +270,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
> >  {
> >      VLCcode *buf;
> >      int i, j, ret;
> > +    VLCcode localbuf[1500];
> 
> It may be obvious for people who know the VLC code, but can you explain
> where the 1500 constant comes from?

the largest allocation i could spot was 1296, 1500 is a bit rounded up
from that. If some future codec needs more then this would need to
be increased

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130713/5ba3285d/attachment.asc>


More information about the ffmpeg-devel mailing list