[x264-devel] Fix rare corruption with subme=10

Jason Garrett-Glaser git at videolan.org
Mon Feb 7 06:31:30 CET 2011


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Fri Feb  4 20:48:37 2011 -0800| [1dae62542ec10ded4e79a955df49917f26ae9ab3] | committer: Jason Garrett-Glaser

Fix rare corruption with subme=10
Also fix dumb bug in VBV emergency AQ scaling.

Regression in r1881.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=1dae62542ec10ded4e79a955df49917f26ae9ab3
---

 encoder/analyse.c     |    2 +-
 encoder/ratecontrol.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/encoder/analyse.c b/encoder/analyse.c
index bf9f3c9..5419bd1 100644
--- a/encoder/analyse.c
+++ b/encoder/analyse.c
@@ -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;
diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 553070e..424774b 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -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 );



More information about the x264-devel mailing list