[FFmpeg-devel] [PATCH 2/2] lavfi: make filter_frame non-recursive.

James Almer jamrial at gmail.com
Fri Dec 23 02:23:05 EET 2016


On 11/27/2016 1:08 PM, Nicolas George wrote:
> A lot of changes happen at the same time:
> 
> - Add a framequeue fifo to AVFilterLink.
> 
> - split AVFilterLink.status into status_in and status_out: requires
>   changes to the few filters and programs that use it directly
>   (f_interleave, split, filtfmts).
> 
> - Add a field ready to AVFilterContext, marking when the filter is ready
>   and its activation priority.
> 
> - Add flags to mark blocked links.
> 
> - Change ff_filter_frame() to enqueue the frame.
> 
> - Change all filtering functions to update the ready field and the
>   blocked flags.
> 
> - Update ff_filter_graph_run_once() to use the ready field.
> 
> - buffersrc: always push the frame immediately.
> 
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  libavfilter/avfilter.c         | 457 ++++++++++++++++++++++++++++++++++-------
>  libavfilter/avfilter.h         |  71 +++++--
>  libavfilter/avfiltergraph.c    |  53 ++---
>  libavfilter/buffersink.c       |  21 +-
>  libavfilter/buffersrc.c        |   6 +-
>  libavfilter/f_interleave.c     |   8 +-
>  libavfilter/internal.h         |   6 +
>  libavfilter/split.c            |   5 +-
>  libavfilter/tests/filtfmts.c   |   3 +
>  libavfilter/vf_extractplanes.c |   6 +-
>  10 files changed, 493 insertions(+), 143 deletions(-)

This patch made audio encoding extremely slow.

time ./ffmpeg -i INPUT.wav -c:a tta -f null -

Before
size=N/A time=00:00:22.98 bitrate=N/A speed= 373x
video:0kB audio:1272kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
real    0m0.089s
user    0m0.000s
sys     0m0.000s

After
size=N/A time=00:00:22.98 bitrate=N/A speed=2.29x
video:0kB audio:1272kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
real    0m10.087s
user    0m0.015s
sys     0m0.000s

CPU usage for the latter is almost zero during the entire 10 seconds. And it can be reproduced
with pretty much any encoder.



More information about the ffmpeg-devel mailing list