diff options
author | jstebbins <[email protected]> | 2011-03-08 16:12:57 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-03-08 16:12:57 +0000 |
commit | 673a841b1ef2dcd31647fce00829dc4a3f2b0715 (patch) | |
tree | b11d12d19c798463a8756d8f5f989e6d2865765b /libhb/enctheora.c | |
parent | 6444014c71cd881ad4874e96a6138ea268be8b4d (diff) |
make keyint match between 1st and 2nd passes of vfr and pfr encodes.
make keyint and fps settings consistent across video encoders.
make interjob->vrate changes for pfr mode like we do for vfr since
pfr is the same as vfr except when it hits it's peak.
in mkv, set track default duration to actual measured vrate on 2 pass encodes.
thanks to Rodeo for the corrections in encx264
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3831 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/enctheora.c')
-rw-r--r-- | libhb/enctheora.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/libhb/enctheora.c b/libhb/enctheora.c index 042262c76..2ced60693 100644 --- a/libhb/enctheora.c +++ b/libhb/enctheora.c @@ -66,8 +66,17 @@ int enctheoraInit( hb_work_object_t * w, hb_job_t * job ) ti.frame_height = (job->height + 0xf) & ~0xf; ti.pic_x = ti.pic_y = 0; - ti.fps_numerator = job->vrate; - ti.fps_denominator = job->vrate_base; + if( job->pass == 2 ) + { + hb_interjob_t * interjob = hb_interjob_get( job->h ); + ti.fps_numerator = interjob->vrate; + ti.fps_denominator = interjob->vrate_base; + } + else + { + ti.fps_numerator = job->vrate; + ti.fps_denominator = job->vrate_base; + } if( job->anamorphic.mode ) { ti.aspect_numerator = job->anamorphic.par_width; @@ -98,30 +107,13 @@ int enctheoraInit( hb_work_object_t * w, hb_job_t * job ) } } - if ( job->pass == 2 && !job->cfr ) - { - /* Even though the framerate might be different due to VFR, - 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 ); - keyframe_frequency = ( 10 * interjob->vrate / interjob->vrate_base ) + 1; - } - else - { - int fps = job->vrate / job->vrate_base; + keyframe_frequency = 10 * (int)( (double)job->vrate / (double)job->vrate_base + 0.5 ); - /* 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; + hb_log("theora: keyint: %i", keyframe_frequency); - keyframe_frequency = fps * 10; - } int tmp = keyframe_frequency - 1; for (log_keyframe = 0; tmp; log_keyframe++) tmp >>= 1; - - hb_log("theora: keyint: %i", keyframe_frequency); ti.keyframe_granule_shift = log_keyframe; |