summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkonablend <[email protected]>2009-04-18 22:44:37 +0000
committerkonablend <[email protected]>2009-04-18 22:44:37 +0000
commit05965924b744356f7eb4977303e0afcb15d6300e (patch)
tree9d53de18f03eee7e366cccd7c764144316e47fb5
parente8f67b0f43d37a2e9f7a1abaa7654a5f77fccee0 (diff)
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
-rw-r--r--libhb/encx264.c16
1 files changed, 12 insertions, 4 deletions
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);
}