[FFmpeg-devel] [Patch] Fix for static leaks in h264.c

Michael Niedermayer michaelni
Tue Jul 29 22:57:33 CEST 2008


On Tue, Jul 29, 2008 at 08:49:22AM -0700, Art Clarke wrote:
> On Fri, Jul 18, 2008 at 3:43 PM, Art Clarke <aclarke at vlideshow.com> wrote:
> 
> > On Fri, Jul 18, 2008 at 2:00 PM, Benjamin Larsson <banan at ludd.ltu.se>
> > wrote:
> >
> >>
> >> Some things in the patch looks strangely indented. Is that by design ?
> >>
> >> MvH
> >> Benjamin Larsson
> >>
> >
> > Nope; that was a consequence of a copy and paste.  Silly me.  I'll repost a
> > correctly formatted response the week after next (out of town for the
> > following week).  I'll get there eventually...
> >
> >
> And here is the (hopefully) correctly indented patch.
[...]
> -        init_vlc(&run7_vlc, RUN7_VLC_BITS, 16,
> +        INIT_VLC_STATIC_WITH_TABLE(&run7_vlc, RUN7_VLC_BITS, 16,
>                   &run_len [6][0], 1, 1,
> -                 &run_bits[6][0], 1, 1, 1);
> +                 &run_bits[6][0], 1, 1,
> +                 run7_vlc_table,
> +                 run7_vlc_table_size);
>      }
>  }
>  
> Index: libavcodec/bitstream.h
> ===================================================================
> --- libavcodec/bitstream.h	(revision 14466)
> +++ libavcodec/bitstream.h	(working copy)
> @@ -769,7 +769,12 @@
>  #define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size)\
>  {\
>      static VLC_TYPE table[static_size][2];\
> -    (vlc)->table= table;\
> +    INIT_VLC_STATIC_WITH_TABLE(vlc, bits, a,b,c,d,e,f,g, table, static_size);\
> +}
> +

> +#define INIT_VLC_STATIC_WITH_TABLE(vlc, bits, a,b,c,d,e,f,g, static_table, static_size)\
> +{\
> +    (vlc)->table= static_table;\
>      (vlc)->table_allocated= static_size;\
>      init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC);\
>  }

Is this macro really needed?

INIT_VLC_STATIC_WITH_TABLE(&run7_vlc, RUN7_VLC_BITS, 16,
         &run_len [6][0], 1, 1,
         &run_bits[6][0], 1, 1,
         run7_vlc_table,
         run7_vlc_table_size);

vs.

run7_vlc->table          = run7_vlc_table;
run7_vlc->table_allocated= run7_vlc_table_size;

init_vlc(&run7_vlc, RUN7_VLC_BITS, 16,
         &run_len [6][0], 1, 1,
         &run_bits[6][0], 1, 1, INIT_VLC_USE_NEW_STATIC);


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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080729/a190cf5b/attachment.pgp>



More information about the ffmpeg-devel mailing list