diff options
author | Britney Fransen <brfransen@gmail.com> | 2016-07-08 21:19:10 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2016-07-08 21:19:10 (GMT) |
commit | da21fac933178fe31fdf90ccd186e971b363810a (patch) | |
tree | a5c75005c152d6caeba3abfe80b7da75941d5377 /abs/extra/ffmpeg2.8/ffmpeg-Speed_up_wtv_index_creation.patch | |
parent | 717f07a18115de8015738718cd0ec83b969b98db (diff) | |
download | linhes_pkgbuild-da21fac933178fe31fdf90ccd186e971b363810a.zip linhes_pkgbuild-da21fac933178fe31fdf90ccd186e971b363810a.tar.gz linhes_pkgbuild-da21fac933178fe31fdf90ccd186e971b363810a.tar.bz2 |
ffmpeg2.8: add OpenPHT patches
Diffstat (limited to 'abs/extra/ffmpeg2.8/ffmpeg-Speed_up_wtv_index_creation.patch')
-rw-r--r-- | abs/extra/ffmpeg2.8/ffmpeg-Speed_up_wtv_index_creation.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/abs/extra/ffmpeg2.8/ffmpeg-Speed_up_wtv_index_creation.patch b/abs/extra/ffmpeg2.8/ffmpeg-Speed_up_wtv_index_creation.patch new file mode 100644 index 0000000..d829898 --- /dev/null +++ b/abs/extra/ffmpeg2.8/ffmpeg-Speed_up_wtv_index_creation.patch @@ -0,0 +1,47 @@ +commit 0e7427498cb1131671f6fe9d054245ae7e5a36f5 +Author: popcornmix <popcornmix@gmail.com> +Date: Tue Mar 25 19:43:07 2014 +0000 + + [ffmpeg] Speed up wtv index creation + + The index creation is O(N^2) with number of entries (typically thousands). + On a Pi this can take more than 60 seconds to execute for a recording of a few hours. + + By replacing with an O(N) loop, this takes virtually zero time + +diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c +index e423370..70898bd 100644 +--- a/libavformat/wtvdec.c ++++ b/libavformat/wtvdec.c +@@ -980,21 +980,23 @@ static int read_header(AVFormatContext *s) + pb = wtvfile_open(s, root, root_size, ff_timeline_table_0_entries_Events_le16); + if (pb) { + int i; ++ AVIndexEntry *e = wtv->index_entries; ++ AVIndexEntry *e_end = wtv->index_entries + wtv->nb_index_entries - 1; ++ uint64_t last_position = 0; + while (1) { + uint64_t frame_nb = avio_rl64(pb); + uint64_t position = avio_rl64(pb); ++ while (frame_nb > e->size && e <= e_end) { ++ e->pos = last_position; ++ e++; ++ } + if (avio_feof(pb)) + break; +- for (i = wtv->nb_index_entries - 1; i >= 0; i--) { +- AVIndexEntry *e = wtv->index_entries + i; +- if (frame_nb > e->size) +- break; +- if (position > e->pos) +- e->pos = position; +- } ++ last_position = position; + } ++ e_end->pos = last_position; + wtvfile_close(pb); +- st->duration = wtv->index_entries[wtv->nb_index_entries - 1].timestamp; ++ st->duration = e_end->timestamp; + } + } + } |