Mercurial > libavcodec.hg
comparison mpegvideo.c @ 3070:3c32ecc8eefe libavcodec
fix crash on height < 16 pixels.
author | lorenm |
---|---|
date | Sat, 28 Jan 2006 00:57:59 +0000 |
parents | 1363655b443c |
children | befacb1cb573 |
comparison
equal
deleted
inserted
replaced
3069:1363655b443c | 3070:3c32ecc8eefe |
---|---|
611 */ | 611 */ |
612 int MPV_common_init(MpegEncContext *s) | 612 int MPV_common_init(MpegEncContext *s) |
613 { | 613 { |
614 int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; | 614 int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; |
615 | 615 |
616 if(s->avctx->thread_count > MAX_THREADS || (16*s->avctx->thread_count > s->height && s->height)){ | 616 s->mb_height = (s->height + 15) / 16; |
617 | |
618 if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){ | |
617 av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); | 619 av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); |
618 return -1; | 620 return -1; |
619 } | 621 } |
620 | 622 |
621 if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height)) | 623 if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height)) |
626 | 628 |
627 s->flags= s->avctx->flags; | 629 s->flags= s->avctx->flags; |
628 s->flags2= s->avctx->flags2; | 630 s->flags2= s->avctx->flags2; |
629 | 631 |
630 s->mb_width = (s->width + 15) / 16; | 632 s->mb_width = (s->width + 15) / 16; |
631 s->mb_height = (s->height + 15) / 16; | |
632 s->mb_stride = s->mb_width + 1; | 633 s->mb_stride = s->mb_width + 1; |
633 s->b8_stride = s->mb_width*2 + 1; | 634 s->b8_stride = s->mb_width*2 + 1; |
634 s->b4_stride = s->mb_width*4 + 1; | 635 s->b4_stride = s->mb_width*4 + 1; |
635 mb_array_size= s->mb_height * s->mb_stride; | 636 mb_array_size= s->mb_height * s->mb_stride; |
636 mv_table_size= (s->mb_height+2) * s->mb_stride + 1; | 637 mv_table_size= (s->mb_height+2) * s->mb_stride + 1; |