rendered paste bodyIndex: libhb/render.c===================================================================--- libhb/render.c (revision 1234)+++ libhb/render.c (working copy)@@ -25,6 +25,9 @@ int extended_frames; uint64_t last_start[4]; uint64_t last_stop[4];+ uint64_t lost_time[4];+ uint64_t total_lost_time;+ uint64_t total_gained_time; }; int renderInit( hb_work_object_t *, hb_job_t * );@@ -278,11 +281,22 @@ } else if( result == FILTER_DROP ) {- if( job->vfr )+ if( job->vfr/* && !(buf_tmp_in->flags & 16)*/ ) {+// hb_log("dropping frame with duration: %lld | progressive: %i", buf_tmp_out->stop - buf_tmp_out->start, (buf_tmp_out->flags & 16)? 1: 0); pv->frames_to_extend += 4; pv->dropped_frames++; hb_fifo_get( pv->subtitle_queue );+ + + uint64_t temp_duration = buf_tmp_out->stop - buf_tmp_out->start;+ pv->lost_time[0] += (temp_duration / 4);+ pv->lost_time[1] += (temp_duration / 4);+ pv->lost_time[2] += (temp_duration / 4);+ pv->lost_time[3] += ( temp_duration - (temp_duration / 4) - (temp_duration / 4) - (temp_duration / 4) );+ pv->total_lost_time += temp_duration;+ +// hb_log("0: %lld 1: %lld 2: %lld 3: %lld", pv->lost_time[0], pv->lost_time[1], pv->lost_time[2], pv->lost_time[3] ); buf_tmp_in = NULL; } else@@ -385,7 +399,7 @@ if( *buf_out ) {- if( pv->frames_to_extend )+ if( pv->lost_time[3] > 0 ) { /* * A frame's been dropped by VFR detelecine.@@ -404,11 +418,25 @@ /* The 4th cached frame will be the to use. */ ivtc_buffer->start = pv->last_start[3]; ivtc_buffer->stop = pv->last_stop[3];-- if (pv->frames_to_extend % 4)+ + ivtc_buffer->stop += pv->lost_time[3];+ pv->total_gained_time += pv->lost_time[3];+ + /* if( (pv->lost_time < 750))+ {+ ivtc_buffer->stop += pv->lost_time;+ pv->lost_time = 0;+ }+ else if (pv->frames_to_extend % 4)+ { ivtc_buffer->stop += 751;+ pv->lost_time -= 751;+ } else+ { ivtc_buffer->stop += 750;+ pv->lost_time -= 750;+ }*/ /* Set the 3rd cached frame to start when this one stops, and to stop 3003 ticks later -- a normal 29.97fps@@ -421,10 +449,20 @@ pv->frames_to_extend--; pv->extended_frames++;- }+ +// hb_log("time gained is: %lld", pv->lost_time[3]);+ int i;+ for( i=2; i >= 0; i--)+ {+ pv->lost_time[i+1] = pv->lost_time[i];+ }+ pv->lost_time[0] = 0;+ + } } + return HB_WORK_OK; } @@ -432,10 +470,16 @@ { hb_work_private_t * pv = w->private_data; - hb_log("render: dropped frames: %i (%i ticks)", pv->dropped_frames, (pv->dropped_frames * 3003) );+ /* hb_log("render: dropped frames: %i (%i ticks)", pv->dropped_frames, (pv->dropped_frames * 3003) ); hb_log("render: extended frames: %i (%i ticks)", pv->extended_frames, ( ( pv->extended_frames / 4 ) * 3003 ) );- hb_log("render: Lost time: %i frames (%i ticks)", (pv->dropped_frames * 4) - (pv->extended_frames), (pv->dropped_frames * 3003) - ( ( pv->extended_frames / 4 ) * 3003 ) );+ hb_log("render: Lost time: %i frames (%i ticks)", (pv->dropped_frames * 4) - (pv->extended_frames), (pv->dropped_frames * 3003) - ( ( pv->extended_frames / 4 ) * 3003 ) +*/ + hb_log("render: lost time: %lld", pv->total_lost_time);+ hb_log("render: gained time: %lld", pv->total_gained_time);+ ++ /* Cleanup subtitle queue */ if( pv->subtitle_queue ) {@@ -481,7 +525,13 @@ pv->extended_frames = 0; pv->last_start[0] = 0; pv->last_stop[0] = 0;- + pv->total_lost_time = 0;+ pv->total_gained_time = 0;+ pv->lost_time[0] = 0;+ pv->lost_time[1] = 0;+ pv->lost_time[2] = 0;+ pv->lost_time[3] = 0;+ /* Setup filters */ /* TODO: Move to work.c? */ if( job->filters )