changeset 3070:3c32ecc8eefe libavcodec

fix crash on height < 16 pixels.
author lorenm
date Sat, 28 Jan 2006 00:57:59 +0000
parents 1363655b443c
children cc0357a90e8f
files mpegvideo.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mpegvideo.c	Fri Jan 27 23:24:24 2006 +0000
+++ b/mpegvideo.c	Sat Jan 28 00:57:59 2006 +0000
@@ -613,7 +613,9 @@
 {
     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 @@
     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;