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

Michael Niedermayer michaelni
Wed Jun 25 15:25:09 CEST 2008


On Wed, Jun 25, 2008 at 09:14:11AM -0400, Art Clarke wrote:
[...]
> Agree with both of you, but Michael does point the way to a more elegant
> solution I think.
> 
> Attempt #2.
> 
> - Art

> Index: libavcodec/h264.c
> ===================================================================
> --- libavcodec/h264.c	(revision 13962)
> +++ libavcodec/h264.c	(working copy)
> @@ -48,14 +48,32 @@
>   */
>  #define DELAYED_PIC_REF 4
>  
> +// Overallocate each table to the largest table; this wastes
> +// a few bytes on the stack at startup, but leads to simpler
> +// code
>  static VLC coeff_token_vlc[4];
> +static VLC_TYPE coeff_token_vlc_tables[4][520][2];
> +static const int coeff_token_vlc_tables_size[4] = { 520, 332, 280, 256 };

coeff_token_vlc_tables[520+332+280+256][2];
would avoid the overalloc


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

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- 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/20080625/681acb68/attachment.pgp>



More information about the ffmpeg-devel mailing list