From 8b498e443950c642fd5f6c1406636f4ab5def27e Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Thu, 2 Feb 2006 04:37:05 +0000 Subject: [PATCH] fix a check for NaN in ratecontrol git-svn-id: svn://svn.videolan.org/x264/trunk@411 df754926-b1dd-0310-bc7b-ec298dee348c --- encoder/ratecontrol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 94927e47..9b3f1da5 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -756,7 +756,7 @@ static double get_qscale(x264_t *h, ratecontrol_entry_t *rce, double rate_factor q = x264_eval((char*)h->param.rc.psz_rc_eq, const_values, const_names, func1, func1_names, NULL, NULL, rce); // avoid NaN's in the rc_eq - if(q != q || rce->i_tex_bits + rce->p_tex_bits + rce->mv_bits == 0) + if(!isfinite(q) || rce->i_tex_bits + rce->p_tex_bits + rce->mv_bits == 0) q = rcc->last_qscale; else { rcc->last_rceq = q; @@ -1029,7 +1029,7 @@ static float rate_estimate_qscale(x264_t *h, int pict_type) } else { - if( h->stat.i_slice_count[h->param.i_keyint_max > 1 ? SLICE_TYPE_P : SLICE_TYPE_I] < 5 ) + if( h->stat.i_slice_count[SLICE_TYPE_P] + h->stat.i_slice_count[SLICE_TYPE_I] < 6 ) { float w = h->stat.i_slice_count[SLICE_TYPE_P] / 5.; float q2 = qp2qscale(ABR_INIT_QP); -- 2.47.3