diff options
author | Zuxy Meng <zuxy.meng@gmail.com> | 2010-01-12 09:13:32 +0000 |
---|---|---|
committer | Zuxy Meng <zuxy.meng@gmail.com> | 2010-01-12 09:13:32 +0000 |
commit | a7494872d5a673f064b0570f4359c8d1a3ea1051 (patch) | |
tree | 16ae502baac4f1987299eef3c0bea3992f07af9e /libavcodec/svq1enc.c | |
parent | 56e29bf2c9eacf077708e0304ea1592933f95b76 (diff) | |
download | ffmpeg-a7494872d5a673f064b0570f4359c8d1a3ea1051.tar.gz |
Reduce stack usage in svq1_encode_plane(). Reuse context scratch buffer
instead. Avoid a crash on MinGW.
Originally committed as revision 21162 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/svq1enc.c')
-rw-r--r-- | libavcodec/svq1enc.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 6fe6ffb5af..3432bb9c5f 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -269,6 +269,7 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane int block_width, block_height; int level; int threshold[6]; + uint8_t *src = s->scratchbuf + stride * 16; const int lambda= (s->picture.quality*s->picture.quality) >> (2*FF_LAMBDA_SHIFT); /* figure out the acceptable level thresholds in advance */ @@ -327,8 +328,6 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane s->m.me.dia_size= s->avctx->dia_size; s->m.first_slice_line=1; for (y = 0; y < block_height; y++) { - uint8_t src[stride*16]; - s->m.new_picture.data[0]= src - y*16*stride; //ugly s->m.mb_y= y; @@ -356,8 +355,6 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane s->m.first_slice_line=1; for (y = 0; y < block_height; y++) { - uint8_t src[stride*16]; - for(i=0; i<16 && i + 16*y<height; i++){ memcpy(&src[i*stride], &src_plane[(i+16*y)*src_stride], width); for(x=width; x<16*block_width; x++) @@ -521,7 +518,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, if(!s->current_picture.data[0]){ avctx->get_buffer(avctx, &s->current_picture); avctx->get_buffer(avctx, &s->last_picture); - s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16); + s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16 * 2); } temp= s->current_picture; |