changeset 5421:0e593c7d0ebc libavcodec

prevent assert failure with negative quant_offset
author michael
date Sun, 29 Jul 2007 21:34:31 +0000
parents e5b6e68deadc
children ad384eda0cb7
files ratecontrol.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ratecontrol.c	Sun Jul 29 19:21:56 2007 +0000
+++ b/ratecontrol.c	Sun Jul 29 21:34:31 2007 +0000
@@ -371,6 +371,7 @@
         q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
     else if(pict_type==B_TYPE && s->avctx->b_quant_factor<0.0)
         q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
+    if(q<1) q=1;
 
     return q;
 }
@@ -386,6 +387,7 @@
         q= last_p_q    *FFABS(a->i_quant_factor) + a->i_quant_offset;
     else if(pict_type==B_TYPE && a->b_quant_factor>0.0)
         q= last_non_b_q*    a->b_quant_factor  + a->b_quant_offset;
+    if(q<1) q=1;
 
     /* last qscale / qdiff stuff */
     if(rcc->last_non_b_pict_type==pict_type || pict_type!=I_TYPE){