[FFmpeg-cvslog] snow: remove a VLA used for edge emulation

Ronald S. Bultje git at videolan.org
Wed Jul 4 00:36:32 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Mon Jul  2 10:39:54 2012 +0300| [33895451570742c47404fec52d87a5c71de26b83] | committer: Martin Storsjö

snow: remove a VLA used for edge emulation

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33895451570742c47404fec52d87a5c71de26b83
---

 libavcodec/snow.c    |    4 ++++
 libavcodec/snow.h    |    1 +
 libavcodec/snowenc.c |    2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 629367a..d69f452 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -395,6 +395,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
     SnowContext *s = avctx->priv_data;
     int width, height;
     int i, j, ret;
+    int emu_buf_size;
 
     s->avctx= avctx;
     s->max_ref_frames=1; //just make sure its not an invalid value in case of no initial keyframe
@@ -462,6 +463,8 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
         return ret;
     }
     FF_ALLOC_OR_GOTO(avctx, s->scratchbuf, s->mconly_picture.linesize[0]*7*MB_SIZE, fail);
+    emu_buf_size = s->mconly_picture.linesize[0] * (2 * MB_SIZE + HTAPS_MAX - 1);
+    FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail);
 
     return 0;
 fail:
@@ -648,6 +651,7 @@ av_cold void ff_snow_common_end(SnowContext *s)
 
     av_freep(&s->block);
     av_freep(&s->scratchbuf);
+    av_freep(&s->emu_edge_buffer);
 
     for(i=0; i<MAX_REF_FRAMES; i++){
         av_freep(&s->ref_mvs[i]);
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index aa27a50..abf3309 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -165,6 +165,7 @@ typedef struct SnowContext{
     MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX)
 
     uint8_t *scratchbuf;
+    uint8_t *emu_edge_buffer;
 }SnowContext;
 
 /* Tables */
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 7503953..f732820 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -675,7 +675,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, uin
     uint8_t *src= s->  input_picture.data[plane_index];
     IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4;
     uint8_t *cur = s->scratchbuf;
-    uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)];
+    uint8_t *tmp = s->emu_edge_buffer;
     const int b_stride = s->b_width << s->block_max_depth;
     const int b_height = s->b_height<< s->block_max_depth;
     const int w= p->width;



More information about the ffmpeg-cvslog mailing list