[x264-devel] commit: Improve CRF initial QP selection, fix get_qscale bug ( Jason Garrett-Glaser )

git version control git at videolan.org
Mon Oct 19 11:29:46 CEST 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sat Oct 17 03:04:56 2009 -0700| [2eb0458ed6302e082ffe206d325d03d6c75d6d47] | committer: Jason Garrett-Glaser 

Improve CRF initial QP selection, fix get_qscale bug
If qcomp=1 (as in mb-tree), we don't need ABR_INIT_QP.
get_qscale could give slightly weird results with still images

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

 encoder/ratecontrol.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 6e8c29f..0dffe7d 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -1359,7 +1359,7 @@ static double get_qscale(x264_t *h, ratecontrol_entry_t *rce, double rate_factor
 
     // avoid NaN's in the rc_eq
     if(!isfinite(q) || rce->tex_bits + rce->mv_bits == 0)
-        q = rcc->last_qscale;
+        q = rcc->last_qscale_for[rce->pict_type];
     else
     {
         rcc->last_rceq = q;
@@ -1848,7 +1848,7 @@ static float rate_estimate_qscale( x264_t *h )
 
                 q = x264_clip3f(q, lmin, lmax);
             }
-            else if( h->param.rc.i_rc_method == X264_RC_CRF )
+            else if( h->param.rc.i_rc_method == X264_RC_CRF && rcc->qcompress != 1 )
             {
                 q = qp2qscale( ABR_INIT_QP ) / fabs( h->param.rc.f_ip_factor );
             }
@@ -1862,7 +1862,7 @@ static float rate_estimate_qscale( x264_t *h )
         rcc->last_qscale = q;
 
         if( !(rcc->b_2pass && !rcc->b_vbv) && h->fenc->i_frame == 0 )
-            rcc->last_qscale_for[SLICE_TYPE_P] = q;
+            rcc->last_qscale_for[SLICE_TYPE_P] = q * fabs( h->param.rc.f_ip_factor );
 
         if( rcc->b_2pass && rcc->b_vbv )
             rcc->frame_size_planned = qscale2bits(&rce, q);



More information about the x264-devel mailing list