diff options
author | Rodeo <[email protected]> | 2013-05-22 20:16:20 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-05-22 20:16:20 +0000 |
commit | a9a2621f49f1e29aceda4d33f57c24c21fdebcf1 (patch) | |
tree | a92de46e41cf69f63b1f064a801d2177fab380a3 /libhb/vfr.c | |
parent | b4439911971a0801b944ad87aee08ea7f3bb8616 (diff) |
libhb: fix hb_vfr_info() and refactor hb_vfr_init() a bit.
Since SVN revision 5058, hb_vfr_init didn't have access to title->rate, rate_base - which are needed to set the input framerate for CFR/PFR. It was therefore printing the output framerate in both cases, regardless of the input framerate:
[22:13:04] + frame rate: 23.976 fps -> constant 30.000 fps
[22:13:04] + filters
[22:13:04] + Framerate Shaper (1:27000000:900000)
[22:13:04] + frame rate: 30.000 fps -> constant 30.000 fps
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5499 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/vfr.c')
-rw-r--r-- | libhb/vfr.c | 61 |
1 files changed, 22 insertions, 39 deletions
diff --git a/libhb/vfr.c b/libhb/vfr.c index 844beef80..c2156f72d 100644 --- a/libhb/vfr.c +++ b/libhb/vfr.c @@ -301,20 +301,21 @@ static void adjust_frame_rate( hb_filter_private_t *pv, hb_buffer_t **buf_out ) } } -static int hb_vfr_init( hb_filter_object_t * filter, - hb_filter_init_t * init ) +static int hb_vfr_init(hb_filter_object_t *filter, hb_filter_init_t *init) { - filter->private_data = calloc( 1, sizeof(struct hb_filter_private_s) ); - hb_filter_private_t * pv = filter->private_data; - - build_gamma_lut( pv ); - pv->cfr = init->cfr; - pv->input_vrate = pv->vrate = init->vrate; - pv->input_vrate_base = pv->vrate_base = init->vrate_base; - if( filter->settings ) + filter->private_data = calloc(1, sizeof(struct hb_filter_private_s)); + hb_filter_private_t *pv = filter->private_data; + build_gamma_lut(pv); + + pv->cfr = init->cfr; + pv->vrate = init->vrate; + pv->vrate_base = init->vrate_base; + pv->input_vrate = init->title_rate; + pv->input_vrate_base = init->title_rate_base; + if (filter->settings != NULL) { - sscanf( filter->settings, "%d:%d:%d", - &pv->cfr, &pv->vrate, &pv->vrate_base ); + sscanf(filter->settings, "%d:%d:%d", + &pv->cfr, &pv->vrate, &pv->vrate_base); } pv->job = init->job; @@ -336,36 +337,18 @@ static int hb_vfr_init( hb_filter_object_t * filter, pv->lost_time[0] = 0; pv->lost_time[1] = 0; pv->lost_time[2] = 0; pv->lost_time[3] = 0; pv->frame_metric = 1000; // Force first frame - if ( pv->cfr == 0 ) + if (!pv->cfr) { /* Ensure we're using "Same as source" FPS */ - pv->vrate_base = init->vrate_base; - pv->vrate = init->vrate; - } - else if ( pv->cfr == 2 ) - { - // For PFR, we want the framerate based on the source's actual - // framerate, unless it's higher than the specified peak framerate. - double source_fps = (double)init->vrate / init->vrate_base; - double peak_fps = (double)pv->vrate / pv->vrate_base; - if ( source_fps > peak_fps ) - { - // peak framerate is lower than source framerate. so signal - // that the nominal framerate will be changed. - init->vrate = pv->vrate; - init->vrate_base = pv->vrate_base; - } - init->pfr_vrate = pv->vrate; - init->pfr_vrate_base = pv->vrate_base; - } - else - { - // Constant framerate. Signal the framerate we are using. - init->vrate = pv->vrate; - init->vrate_base = pv->vrate_base; + pv->vrate_base = pv->input_vrate_base; + pv->vrate = pv->input_vrate; } - init->cfr = pv->cfr; - pv->frame_rate = (double)pv->vrate_base * 90000. / pv->vrate; + pv->frame_rate = (double)pv->vrate_base * 90000. / pv->vrate; + init->cfr = pv->cfr; + init->vrate = pv->vrate; + init->vrate_base = pv->vrate_base; + init->title_rate = pv->input_vrate; + init->title_rate_base = pv->input_vrate_base; return 0; } |