| Index: patches/to_upstream/17_mpegthread.patch | 
| =================================================================== | 
| --- patches/to_upstream/17_mpegthread.patch	(revision 0) | 
| +++ patches/to_upstream/17_mpegthread.patch	(revision 0) | 
| @@ -0,0 +1,25 @@ | 
| +diff -wurp -N orig/libavcodec/mpegvideo.c ffmpeg-mt/libavcodec/mpegvideo.c | 
| +--- orig/libavcodec/mpegvideo.c	2010-11-04 08:11:14 -0700 | 
| ++++ ffmpeg-mt/libavcodec/mpegvideo.c	2010-11-04 08:11:24 -0700 | 
| +@@ -584,8 +584,7 @@ av_cold int MPV_common_init(MpegEncConte | 
| +         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 @@ av_cold int MPV_common_init(MpegEncConte | 
| +     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)); | 
|  |