Message ID | 20180711001758.27132-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | c995e01b1e01ac11cf2545b3ce86569a482ff434 |
Headers | show |
On Tue, Jul 10, 2018 at 8:17 PM, Michael Niedermayer <michael@niedermayer.cc> wrote: > 0.324 <-0.491 sec > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/mov.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) All four of these patches combined bring the penalty down from 2-3x to ~1.19x, which is much more acceptable. Assuming it passes fate, and noone objects, LGTM. - Derek
2018-07-11 16:32 GMT+02:00, Derek Buitenhuis <derek.buitenhuis@gmail.com>: > On Tue, Jul 10, 2018 at 8:17 PM, Michael Niedermayer > <michael@niedermayer.cc> wrote: >> 0.324 <-0.491 sec >> >> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> >> --- >> libavformat/mov.c | 10 +++++++--- >> 1 file changed, 7 insertions(+), 3 deletions(-) > > All four of these patches combined bring the penalty down from 2-3x to > ~1.19x, which is much more acceptable. Using the option "--ignore_editlist 1" brings an additional speed-up. Carl Eugen
This one LGTM. Thanks for doing this. On Tue, Jul 10, 2018 at 5:18 PM Michael Niedermayer <michael@niedermayer.cc> wrote: > 0.324 <-0.491 sec > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/mov.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 1346ffe480..aabf06de12 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -3310,13 +3310,16 @@ static void mov_estimate_video_delay(MOVContext > *c, AVStream* st) { > for(ind = 0; ind < st->nb_index_entries && ctts_ind < > msc->ctts_count; ++ind) { > if (buf_size == (MAX_REORDER_DELAY + 1)) { > // If circular buffer is full, then move the first > element forward. > - buf_start = (buf_start + 1) % buf_size; > + buf_start = (buf_start + 1); > + if (buf_start == MAX_REORDER_DELAY + 1) > + buf_start = 0; > } else { > ++buf_size; > } > > // Point j to the last elem of the buffer and insert the > current pts there. > - j = (buf_start + buf_size - 1) % buf_size; > + j = buf_start - 1; > + if (j < 0) j = buf_size - 1; > pts_buf[j] = st->index_entries[ind].timestamp + > msc->ctts_data[ctts_ind].duration; > > // The timestamps that are already in the sorted buffer, and > are greater than the > @@ -3327,7 +3330,8 @@ static void mov_estimate_video_delay(MOVContext *c, > AVStream* st) { > // go through, to keep this buffer in sorted order. > num_swaps = 0; > while (j != buf_start) { > - r = (j - 1 + buf_size) % buf_size; > + r = j - 1; > + if (r < 0) r = buf_size - 1; > if (pts_buf[j] < pts_buf[r]) { > FFSWAP(int64_t, pts_buf[j], pts_buf[r]); > ++num_swaps; > -- > 2.18.0 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
On Wed, Jul 11, 2018 at 11:05:09AM -0700, Sasi Inguva wrote:
> This one LGTM. Thanks for doing this.
will apply
thanks
[...]
diff --git a/libavformat/mov.c b/libavformat/mov.c index 1346ffe480..aabf06de12 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3310,13 +3310,16 @@ static void mov_estimate_video_delay(MOVContext *c, AVStream* st) { for(ind = 0; ind < st->nb_index_entries && ctts_ind < msc->ctts_count; ++ind) { if (buf_size == (MAX_REORDER_DELAY + 1)) { // If circular buffer is full, then move the first element forward. - buf_start = (buf_start + 1) % buf_size; + buf_start = (buf_start + 1); + if (buf_start == MAX_REORDER_DELAY + 1) + buf_start = 0; } else { ++buf_size; } // Point j to the last elem of the buffer and insert the current pts there. - j = (buf_start + buf_size - 1) % buf_size; + j = buf_start - 1; + if (j < 0) j = buf_size - 1; pts_buf[j] = st->index_entries[ind].timestamp + msc->ctts_data[ctts_ind].duration; // The timestamps that are already in the sorted buffer, and are greater than the @@ -3327,7 +3330,8 @@ static void mov_estimate_video_delay(MOVContext *c, AVStream* st) { // go through, to keep this buffer in sorted order. num_swaps = 0; while (j != buf_start) { - r = (j - 1 + buf_size) % buf_size; + r = j - 1; + if (r < 0) r = buf_size - 1; if (pts_buf[j] < pts_buf[r]) { FFSWAP(int64_t, pts_buf[j], pts_buf[r]); ++num_swaps;
0.324 <-0.491 sec Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/mov.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)