]> git.sesse.net Git - x264/commitdiff
Use float constants in qp rounding
authorFiona Glaser <fiona@x264.com>
Thu, 5 May 2011 10:24:38 +0000 (03:24 -0700)
committerFiona Glaser <fiona@x264.com>
Tue, 10 May 2011 09:40:54 +0000 (02:40 -0700)
Slight performance improvement and fixes slight difference in output between gcc 3.4 and 4.5.

encoder/ratecontrol.c

index 7db995556dcc4cf00cd26d5fcfce0f815fca9153..3428c6b85016bce836cb2a73fb339e37d84cbdd7 100644 (file)
@@ -1271,7 +1271,7 @@ void x264_ratecontrol_start( x264_t *h, int i_force_qp, int overhead )
 
     rc->qpa_rc =
     rc->qpa_aq = 0;
-    rc->qp = x264_clip3( (int)(q + 0.5), 0, QP_MAX );
+    rc->qp = x264_clip3( q + 0.5f, 0, QP_MAX );
     h->fdec->f_qp_avg_rc =
     h->fdec->f_qp_avg_aq =
     rc->qpm = q;
@@ -1435,7 +1435,7 @@ void x264_ratecontrol_mb( x264_t *h, int bits )
 int x264_ratecontrol_qp( x264_t *h )
 {
     x264_emms();
-    return x264_clip3( h->rc->qpm + .5, h->param.rc.i_qp_min, h->param.rc.i_qp_max );
+    return x264_clip3( h->rc->qpm + 0.5f, h->param.rc.i_qp_min, h->param.rc.i_qp_max );
 }
 
 int x264_ratecontrol_mb_qp( x264_t *h )
@@ -1451,7 +1451,7 @@ int x264_ratecontrol_mb_qp( x264_t *h )
             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 );
+    return x264_clip3( qp + 0.5f, h->param.rc.i_qp_min, h->param.rc.i_qp_max );
 }
 
 /* In 2pass, force the same frame types as in the 1st pass */