[x264-devel] commit: Fix bug in r1753 (Anton Mitrofanov )

git at videolan.org git at videolan.org
Wed Nov 10 16:39:20 CET 2010


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Nov 10 07:34:40 2010 -0800| [f9f00353bd3959470c326880b82e99e3ee7de195] | committer: Jason Garrett-Glaser 

Fix bug in r1753
Overflow compensation fix broke CRF with --no-mbtree.

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

 encoder/ratecontrol.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 08323b1..ba116b8 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -2204,18 +2204,21 @@ static float rate_estimate_qscale( x264_t *h )
                 q = qp2qscale( rcc->accum_p_qp / rcc->accum_p_norm );
                 q /= fabs( h->param.rc.f_ip_factor );
             }
-            else if( h->param.rc.i_rc_method != X264_RC_CRF && h->i_frame > 0 )
+            else if( h->i_frame > 0 )
             {
-                /* Asymmetric clipping, because symmetric would prevent
-                 * overflow control in areas of rapidly oscillating complexity */
-                double lmin = rcc->last_qscale_for[pict_type] / rcc->lstep;
-                double lmax = rcc->last_qscale_for[pict_type] * rcc->lstep;
-                if( overflow > 1.1 && h->i_frame > 3 )
-                    lmax *= rcc->lstep;
-                else if( overflow < 0.9 )
-                    lmin /= rcc->lstep;
-
-                q = x264_clip3f(q, lmin, lmax);
+                if( h->param.rc.i_rc_method != X264_RC_CRF )
+                {
+                    /* Asymmetric clipping, because symmetric would prevent
+                     * overflow control in areas of rapidly oscillating complexity */
+                    double lmin = rcc->last_qscale_for[pict_type] / rcc->lstep;
+                    double lmax = rcc->last_qscale_for[pict_type] * rcc->lstep;
+                    if( overflow > 1.1 && h->i_frame > 3 )
+                        lmax *= rcc->lstep;
+                    else if( overflow < 0.9 )
+                        lmin /= rcc->lstep;
+
+                    q = x264_clip3f(q, lmin, lmax);
+                }
             }
             else if( h->param.rc.i_rc_method == X264_RC_CRF && rcc->qcompress != 1 )
             {



More information about the x264-devel mailing list