[FFmpeg-devel] [PATCH] svq1dec: convert VLA to fixed size

Christophe Gisquet christophe.gisquet
Thu Jun 24 11:42:41 CEST 2010


2010/6/24 Mans Rullgard <mans at mansr.com>:
> +#define SVQ1_MAX_WIDTH 4095
> +
> ?extern const uint8_t mvtab[33][2];
>
> ?static VLC svq1_block_type;
> @@ -730,7 +732,7 @@ static int svq1_decode_frame(AVCodecContext *avctx,
> ? ? ? ? current += 16*linesize;
> ? ? ? }
> ? ? } else {
> - ? ? ?svq1_pmv pmv[width/8+3];
> + ? ? ?svq1_pmv pmv[SVQ1_MAX_WIDTH/8+3];
> ? ? ? /* delta frame */
> ? ? ? memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv));

Sorry for the naive question, but svq1_pmv being a struct with 2 ints,
isn't this going to create a local variable of around 4K at least on
the stack? From the mvtab content, it seems pmv could use int16_t
instead. Then the attached patch might be more worthwhile.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svq1dec.diff
Type: text/x-diff
Size: 758 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100624/1101c0cb/attachment.diff>



More information about the ffmpeg-devel mailing list