From cbd9b2f918af681d206d10340f87fc6aced5cf3e Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 30 Jun 2012 10:34:39 -0700 Subject: [PATCH] snow: remove the runs[] VLA. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/snow.c | 2 ++ libavcodec/snow.h | 1 + libavcodec/snowenc.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 96de9f36d2..629367ac44 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -451,6 +451,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ FF_ALLOCZ_OR_GOTO(avctx, s->spatial_dwt_buffer, width * height * sizeof(DWTELEM), fail); //FIXME this does not belong here FF_ALLOCZ_OR_GOTO(avctx, s->temp_dwt_buffer, width * sizeof(DWTELEM), fail); FF_ALLOCZ_OR_GOTO(avctx, s->temp_idwt_buffer, width * sizeof(IDWTELEM), fail); + FF_ALLOC_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1) * ((height + 1) >> 1) * sizeof(*s->run_buffer), fail); for(i=0; itemp_dwt_buffer); av_freep(&s->spatial_idwt_buffer); av_freep(&s->temp_idwt_buffer); + av_freep(&s->run_buffer); s->m.me.temp= NULL; av_freep(&s->m.me.scratchpad); diff --git a/libavcodec/snow.h b/libavcodec/snow.h index 3ceb6af99d..aa27a50fd1 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -135,6 +135,7 @@ typedef struct SnowContext{ DWTELEM *temp_dwt_buffer; IDWTELEM *spatial_idwt_buffer; IDWTELEM *temp_idwt_buffer; + int *run_buffer; int colorspace_type; int chroma_h_shift; int chroma_v_shift; diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c index f8694ae813..7503953e11 100644 --- a/libavcodec/snowenc.c +++ b/libavcodec/snowenc.c @@ -836,7 +836,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, IDWTELEM *src, IDWTE if(1){ int run=0; - int runs[w*h]; + int *runs = s->run_buffer; int run_index=0; int max_index;