changeset 615:459a715f0661 libavcodec

fixing qmin==qmax && qsquish==1
author michaelni
date Sun, 25 Aug 2002 23:49:50 +0000
parents b786f15df503
children 0fe52ab8042c
files ratecontrol.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ratecontrol.c	Sun Aug 25 22:54:43 2002 +0000
+++ b/ratecontrol.c	Sun Aug 25 23:49:50 2002 +0000
@@ -387,7 +387,7 @@
         }
     }
 
-    if(s->avctx->rc_qsquish==0.0){
+    if(s->avctx->rc_qsquish==0.0 || qmin==qmax){
         if     (q<qmin) q=qmin;
         else if(q>qmax) q=qmax;
     }else{
@@ -517,12 +517,12 @@
     
         q= get_qscale(s, rce, rate_factor, picture_number);
 
+        assert(q>0.0);
 //printf("%f ", q);
         if     (pict_type==I_TYPE && s->avctx->i_quant_factor>0.0)
             q= rcc->next_p_qscale*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
         else if(pict_type==B_TYPE && s->avctx->b_quant_factor>0.0)
             q= rcc->next_non_b_qscale*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
-            
 //printf("%f ", q);
         assert(q>0.0);
 
@@ -540,6 +540,8 @@
 
         rcc->pass1_wanted_bits+= s->bit_rate/fps;
 
+        assert(q>0.0);
+
         if(pict_type != B_TYPE) rcc->next_non_b_qscale= q;
         if(pict_type == P_TYPE) rcc->next_p_qscale= q;
     }