Commit 1928d046 authored by Michael Niedermayer's avatar Michael Niedermayer

prevent overflow if lambda2 is "too" large

Originally committed as revision 6823 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent ea7307df
...@@ -5579,7 +5579,7 @@ static int encode_picture(MpegEncContext *s, int picture_number) ...@@ -5579,7 +5579,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
/* Estimate motion for every MB */ /* Estimate motion for every MB */
if(s->pict_type != I_TYPE){ if(s->pict_type != I_TYPE){
s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8; s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8;
s->lambda2= (s->lambda2* s->avctx->me_penalty_compensation + 128)>>8; s->lambda2= (s->lambda2* (int64_t)s->avctx->me_penalty_compensation + 128)>>8;
if(s->pict_type != B_TYPE && s->avctx->me_threshold==0){ if(s->pict_type != B_TYPE && s->avctx->me_threshold==0){
if((s->avctx->pre_me && s->last_non_b_pict_type==I_TYPE) || s->avctx->pre_me==2){ if((s->avctx->pre_me && s->last_non_b_pict_type==I_TYPE) || s->avctx->pre_me==2){
s->avctx->execute(s->avctx, pre_estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count); s->avctx->execute(s->avctx, pre_estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment