summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-11-07 17:21:13 +0000
committerjstebbins <[email protected]>2010-11-07 17:21:13 +0000
commiteb25aaa29fa9295286d22be6fd7b2f568e9af063 (patch)
treeb371ece165cc0469ea0b717f31896bb64ecb5d40 /libhb
parenta51600727f1c60e80b4790383ab37a2546183545 (diff)
Improved logging of keyint min/max
And small tweak to keyint_max calculation. x264 slightly changed the way the automatic min-keyint is calculated. Also, keyint infinite was added. This does not cause any encoding issues, but depending on the settings and the framerate, the log contained keyint values that don't correspond to the actual encode's values. The keyint_max was calculated, 59.94 fps sources will get a keyint of 599 rather than 600. With this change, It is rounded to the closest integer then multiplied by 10. Thanks to Rodeo git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3658 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/encx264.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c
index bdc32e6e4..0ba54dfa1 100644
--- a/libhb/encx264.c
+++ b/libhb/encx264.c
@@ -120,13 +120,13 @@ 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_max = ( ( 10 * (double)interjob->vrate / (double)interjob->vrate_base ) + 0.5 );
+ param.i_keyint_max = 10 * (int)( (double)interjob->vrate / (double)interjob->vrate_base + 0.5 );
}
else
{
/* adjust +0.5 for when fps has remainder to bump
{ 23.976, 29.976, 59.94 } to { 24, 30, 60 } */
- param.i_keyint_max = ( ( 10 * (double)job->vrate / (double)job->vrate_base ) + 0.5 );
+ param.i_keyint_max = 10 * (int)( (double)job->vrate / (double)job->vrate_base + 0.5 );
}
}
@@ -206,8 +206,25 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job )
}
if( param.i_keyint_min != X264_KEYINT_MIN_AUTO || param.i_keyint_max != 250 )
- hb_log("encx264: min-keyint: %i, keyint: %i", param.i_keyint_min == X264_KEYINT_MIN_AUTO ? param.i_keyint_max / 10 : param.i_keyint_min,
- param.i_keyint_max);
+ {
+ int min_auto;
+
+ if ( param.i_fps_num / param.i_fps_den < param.i_keyint_max / 10 )
+ min_auto = param.i_fps_num / param.i_fps_den;
+ else
+ min_auto = param.i_keyint_max / 10;
+
+ char min[40], max[40];
+ param.i_keyint_min == X264_KEYINT_MIN_AUTO ?
+ snprintf( min, 40, "auto (%d)", min_auto ) :
+ snprintf( min, 40, "%d", param.i_keyint_min );
+
+ param.i_keyint_max == X264_KEYINT_MAX_INFINITE ?
+ snprintf( max, 40, "infinite" ) :
+ snprintf( max, 40, "%d", param.i_keyint_max );
+
+ hb_log( "encx264: min-keyint: %s, keyint: %s", min, max );
+ }
/* set up the VUI color model & gamma to match what the COLR atom
* set in muxmp4.c says. See libhb/muxmp4.c for notes. */