]> git.sesse.net Git - x264/commitdiff
Fix rare corruption with subme=10
authorFiona Glaser <fiona@x264.com>
Sat, 5 Feb 2011 04:48:37 +0000 (20:48 -0800)
committerFiona Glaser <fiona@x264.com>
Sat, 5 Feb 2011 23:10:13 +0000 (15:10 -0800)
Also fix dumb bug in VBV emergency AQ scaling.

Regression in r1881.

encoder/analyse.c
encoder/ratecontrol.c

index a31c6ee378a278ed219ab44f1b9bbb72416d5692..ed309b750cfbaa30dccb3ac97f6eb52b25036f65 100644 (file)
@@ -2704,7 +2704,7 @@ static inline void x264_mb_analyse_qp_rd( x264_t *h, x264_mb_analysis_t *a )
         }
 
         h->mb.i_qp += direction;
-        while( h->mb.i_qp >= h->param.rc.i_qp_min && h->mb.i_qp <= h->param.rc.i_qp_max )
+        while( h->mb.i_qp >= h->param.rc.i_qp_min && h->mb.i_qp <= SPEC_QP( h->param.rc.i_qp_max ) )
         {
             if( h->mb.i_last_qp == h->mb.i_qp )
                 last_qp_tried = 1;
index a30361d7761436a9b268e8e09d984ceba3a8e23f..60d9b34dbe619e6eb74e0a6b02e4ee3f4d1db555 100644 (file)
@@ -1447,7 +1447,7 @@ int x264_ratecontrol_mb_qp( x264_t *h )
         float qp_offset = h->fdec->b_kept_as_ref ? h->fenc->f_qp_offset[h->mb.i_mb_xy] : h->fenc->f_qp_offset_aq[h->mb.i_mb_xy];
         /* Scale AQ's effect towards zero in emergency mode. */
         if( qp > QP_MAX_SPEC )
-            qp_offset *= (QP_MAX - qp) / (QP_MAX_SPEC - QP_MAX);
+            qp_offset *= (QP_MAX - qp) / (QP_MAX - QP_MAX_SPEC);
         qp += qp_offset;
     }
     return x264_clip3( qp + .5, h->param.rc.i_qp_min, h->param.rc.i_qp_max );