]> git.sesse.net Git - x264/commitdiff
Fix sliced-threads ratecontrol bug
authorFiona Glaser <fiona@x264.com>
Tue, 13 Mar 2012 21:37:26 +0000 (14:37 -0700)
committerFiona Glaser <fiona@x264.com>
Wed, 14 Mar 2012 07:53:18 +0000 (00:53 -0700)
Was using qp instead of qscale; could cause NANs (not to mention less accurate results).

encoder/ratecontrol.c

index ee2911baca20f2ae032c81601e178634c06c5c74..9ed2c0c483d188f10c54c336367a51924221bb57 100644 (file)
@@ -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;