From 8cb10c1529318a47836ae0ca9007752fdcd70654 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Thu, 5 May 2011 03:24:38 -0700 Subject: [PATCH] Use float constants in qp rounding Slight performance improvement and fixes slight difference in output between gcc 3.4 and 4.5. --- encoder/ratecontrol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index b8f73ea5..37336f74 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -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 */ -- 2.47.3