aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2006-01-28 00:57:59 +0000
committerLoren Merritt <lorenm@u.washington.edu>2006-01-28 00:57:59 +0000
commitfdb52bccf609b88f81d3730ff88f8f784cd7be8a (patch)
tree3884b20c3ae277c8c2d752564692b35f159137c7 /libavcodec/mpegvideo.c
parent7e41c35436e69c45cba5e971eb00bc88c617094f (diff)
downloadffmpeg-fdb52bccf609b88f81d3730ff88f8f784cd7be8a.tar.gz
fix crash on height < 16 pixels.
Originally committed as revision 4904 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index b766f293ad..31497852bb 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -613,7 +613,9 @@ int MPV_common_init(MpegEncContext *s)
{
int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
- if(s->avctx->thread_count > MAX_THREADS || (16*s->avctx->thread_count > s->height && s->height)){
+ s->mb_height = (s->height + 15) / 16;
+
+ if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){
av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
return -1;
}
@@ -628,7 +630,6 @@ int MPV_common_init(MpegEncContext *s)
s->flags2= s->avctx->flags2;
s->mb_width = (s->width + 15) / 16;
- s->mb_height = (s->height + 15) / 16;
s->mb_stride = s->mb_width + 1;
s->b8_stride = s->mb_width*2 + 1;
s->b4_stride = s->mb_width*4 + 1;