[FFmpeg-devel] [PATCH] RV30/40 decoder

Rich Felker dalias
Tue Sep 18 05:55:08 CEST 2007


On Mon, Sep 17, 2007 at 01:16:06PM +0100, Steve Lhomme wrote:
> Kostya wrote:
> >On Mon, Sep 17, 2007 at 11:34:17AM +0200, Michael Niedermayer wrote:
> >>Hi
> >>
> >>On Mon, Sep 17, 2007 at 08:19:50AM +0300, Kostya wrote:
> >>>>>+    cw = av_mallocz(size * 2);
> >>>>>+    syms = av_malloc(size * 2);
> >>>>>+    bits = av_malloc(size);
> >>>>these could as well use use arrays on the stack, simplifying the source
> >>>Table sizes vary from 16 to 1296 elements. I suspect that it's easier to 
> >>>allocate
> >>>memory instead of remembering where 1296 came from.
> >>then use
> >>int bits[size];
> >
> >I did not know this was possible. I will give it a try. 
> 
> Not every compiler can handle this. I can be replaced by alloca().

Since when are gcc extensiosn to the C language required by ffmpeg?
alloca is absolutely nonstandard and intentionall omitted from C99 and
POSIX. As far as I know ffmpeg already uses and requires C99/gcc VLAs
in various places. If not, and if you don't want to introduce this
dependency, then you should use av_malloc but never alloca.

Rich




More information about the ffmpeg-devel mailing list