diff options
author | jstebbins <[email protected]> | 2008-12-10 01:56:50 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2008-12-10 01:56:50 +0000 |
commit | ed3d36a9c7f38a0a411f189132d209822f028cb5 (patch) | |
tree | 5b392188f92972e751f3a2be3f4dc356230a79f6 | |
parent | 7d58436249e353809f58c0373f95b06e6c531253 (diff) |
Improve duration calculation for transport streams. Streams that have
many discontinuities (like concatenated blu-ray m2ts files) are handled
better.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2017 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rwxr-xr-x | libhb/stream.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libhb/stream.c b/libhb/stream.c index f95d3518c..8e66c850a 100755 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -935,7 +935,7 @@ struct pts_pos { uint64_t pts; /* PTS from video stream */ }; -#define NDURSAMPLES 16 +#define NDURSAMPLES 64 // get one (position, timestamp) sampple from a transport or program // stream. @@ -992,7 +992,7 @@ static int dur_compare( const void *a, const void *b ) static double compute_stream_rate( struct pts_pos *pp, int n ) { int i, j; - double rates[NDURSAMPLES * NDURSAMPLES / 2]; + double rates[NDURSAMPLES * NDURSAMPLES / 8]; double *rp = rates; // the following nested loops compute the rates between all pairs. @@ -1007,11 +1007,13 @@ static double compute_stream_rate( struct pts_pos *pp, int n ) // could easily fall in the inter-piece part of the data which // would give a bogus estimate. The 'ns' index creates an // asymmetry that favors locality. - int ns = i + ( n >> 1 ); + int ns = i + ( n >> 3 ); if ( ns > n ) ns = n; for ( j = i+1; j < ns; ++j ) { + if ( (uint64_t)(pp[j].pts - pp[i].pts) > 90000LL*3600*6 ) + break; if ( pp[j].pts != pp[i].pts && pp[j].pos > pp[i].pos ) { *rp = ((double)( pp[j].pts - pp[i].pts )) / |