From 05965924b744356f7eb4977303e0afcb15d6300e Mon Sep 17 00:00:00 2001 From: konablend Date: Sat, 18 Apr 2009 22:44:37 +0000 Subject: libhb: set min:max key intervals ratio to 1:10 of fps - new behavior effects ratios only for whole-numbered input FPS - old behavior { 23.976, 24, 29.976, 30, 59.94, 60 } -> { 24:240, 25:251, 30:300, 31:301, 60:600, 61:601 } - new behavior { 23.976, 24, 29.976, 30, 59.94, 60 } -> { 24:240, 24:240, 30:300, 30:300, 60:600, 60:600 } git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2343 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/encx264.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'libhb') diff --git a/libhb/encx264.c b/libhb/encx264.c index eb8d8426d..0bc1546ff 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -90,12 +90,20 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) param.i_fps_num = job->vrate; param.i_fps_den = job->vrate_base; + /* Set min:max key intervals ratio to 1:10 of fps. + * This section is skipped if fps=25 (default). + */ if (job->vrate_base != 1080000) { - /* If the fps isn't 25, adjust the key intervals. Add 1 because - we want 24, not 23 with a truncated remainder. */ - param.i_keyint_min = (job->vrate / job->vrate_base) + 1; - param.i_keyint_max = (10 * job->vrate / job->vrate_base) + 1; + int fps = job->vrate / job->vrate_base; + + /* adjust +1 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; + hb_log("encx264: keyint-min: %i, keyint-max: %i", param.i_keyint_min, param.i_keyint_max); } -- cgit v1.2.3