| Index: source/patched-ffmpeg-mt/libavcodec/mpegvideo.c | 
| =================================================================== | 
| --- source/patched-ffmpeg-mt/libavcodec/mpegvideo.c	(revision 65184) | 
| +++ source/patched-ffmpeg-mt/libavcodec/mpegvideo.c	(working copy) | 
| @@ -584,8 +584,7 @@ | 
| return -1; | 
| } | 
|  | 
| -    if(s->avctx->active_thread_type&FF_THREAD_SLICE && | 
| -       (s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height))){ | 
| +    if(s->avctx->thread_count > MAX_THREADS){ | 
| av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); | 
| return -1; | 
| } | 
| @@ -745,6 +744,11 @@ | 
| if (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE) { | 
| threads = s->avctx->thread_count; | 
|  | 
| +        if (s->avctx->thread_count > s->mb_height && s->mb_height) { | 
| +            av_log(s->avctx, AV_LOG_WARNING, "Reducing from %d to %d threads due to height of %d pixels.\n", s->avctx->thread_count, s->mb_height, s->height); | 
| +            threads = s->mb_height; | 
| +        } | 
| + | 
| for(i=1; i<threads; i++){ | 
| s->thread_context[i]= av_malloc(sizeof(MpegEncContext)); | 
| memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); | 
| @@ -2241,7 +2245,7 @@ | 
| * @param h is the normal height, this will be reduced automatically if needed for the last row | 
| */ | 
| void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ | 
| -	const int field_pic= s->picture_structure != PICT_FRAME; | 
| +        const int field_pic= s->picture_structure != PICT_FRAME; | 
| if(field_pic){ | 
| h <<= 1; | 
| y <<= 1; | 
|  |