[x264-devel] Fix sliced-threads ratecontrol bug

Jason Garrett-Glaser git at videolan.org
Wed Apr 25 00:17:08 CEST 2012


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Tue Mar 13 14:37:26 2012 -0700| [6979713216d792e44e3cbaeeba74b455e0a07c62] | committer: Jason Garrett-Glaser

Fix sliced-threads ratecontrol bug
Was using qp instead of qscale; could cause NANs (not to mention less accurate results).

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

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

diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c
index 9f17ad8..0437fbd 100644
--- a/encoder/ratecontrol.c
+++ b/encoder/ratecontrol.c
@@ -2433,6 +2433,8 @@ void x264_threads_distribute_ratecontrol( x264_t *h )
 {
     int row;
     x264_ratecontrol_t *rc = h->rc;
+    x264_emms();
+    float qscale = qp2qscale( rc->qpm );
 
     /* Initialize row predictors */
     if( h->i_frame == 0 )
@@ -2453,7 +2455,7 @@ void x264_threads_distribute_ratecontrol( x264_t *h )
             int size = 0;
             for( row = t->i_threadslice_start; row < t->i_threadslice_end; row++ )
                 size += h->fdec->i_row_satd[row];
-            t->rc->slice_size_planned = predict_size( &rc->pred[h->sh.i_type + (i+1)*5], rc->qpm, size );
+            t->rc->slice_size_planned = predict_size( &rc->pred[h->sh.i_type + (i+1)*5], qscale, size );
         }
         else
             t->rc->slice_size_planned = 0;



More information about the x264-devel mailing list