summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-02-06 20:24:11 +0000
committerjstebbins <[email protected]>2010-02-06 20:24:11 +0000
commit138f6356d1436a103337fa6cd4b299c8f252f737 (patch)
tree9f28e82e559a9cfed8be8cb66fd586a52d5651c4 /libhb
parent0c119a65cf49732501c8746bb97209bbace974e0 (diff)
fix keyint mismatch between 1st and 2nd passes of a 2pass encode
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3100 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/encx264.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c
index 47f3b5a0f..7199fd98c 100644
--- a/libhb/encx264.c
+++ b/libhb/encx264.c
@@ -149,20 +149,15 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
we still want the same keyframe intervals as the 1st pass,
so the 1st pass stats won't conflict on frame decisions. */
hb_interjob_t * interjob = hb_interjob_get( job->h );
- param.i_keyint_min = ( interjob->vrate / interjob->vrate_base ) + 1;
- param.i_keyint_max = ( 10 * interjob->vrate / interjob->vrate_base ) + 1;
+ param.i_keyint_min = ( ( (double)interjob->vrate / (double)interjob->vrate_base ) + 0.5 );
+ param.i_keyint_max = ( ( 10 * (double)interjob->vrate / (double)interjob->vrate_base ) + 0.5 );
}
else
{
- int fps = job->vrate / job->vrate_base;
-
- /* adjust +1 when fps has remainder to bump
+ /* adjust +0.5 for when fps has remainder to bump
{ 23.976, 29.976, 59.94 } to { 24, 30, 60 } */
- if (job->vrate % job->vrate_base)
- fps += 1;
-
- param.i_keyint_min = fps;
- param.i_keyint_max = fps * 10;
+ param.i_keyint_min = ( ( (double)job->vrate / (double)job->vrate_base ) + 0.5 );
+ param.i_keyint_max = ( ( 10 * (double)job->vrate / (double)job->vrate_base ) + 0.5 );
}
}