[FFmpeg-devel] [PATCH] avfilter/sine: support expression in the number of output samples

Clément Bœsch u at pkh.me
Sat Aug 15 19:41:32 CEST 2015

On Sat, Aug 15, 2015 at 07:32:13PM +0200, Nicolas George wrote:
> L'octidi 28 thermidor, an CCXXIII, Clement Boesch a écrit :
> > ---
> > Seems a bit tricky to do it in asetnsamples so... Might be relevant to do the
> > same in aevalsrc as well.
> How does it affect speed? One of the two purposes of sine is to be fast (the
> other is to be bit-exact), and I am a bit afraid that the expression
> evaluation is slow, even for constants.

The expression is evaluated once per frame, so very low overhead.

But for the record, I tried the following:
  perf record ./ffmpeg_g -v quiet -f lavfi -i sine=samples_per_frame=16 -t 1000 -f null -

(so a very small frame making it trigger the eval very often).

Here is the top ten result in perf report:
   8.82%  ffmpeg_g  libc-2.22.so        [.] _int_free
   7.44%  ffmpeg_g  libc-2.22.so        [.] vfprintf
   6.42%  ffmpeg_g  ffmpeg_g            [.] av_rescale_rnd
   5.52%  ffmpeg_g  libc-2.22.so        [.] _int_malloc
   4.82%  ffmpeg_g  ffmpeg_g            [.] av_frame_move_ref
   4.52%  ffmpeg_g  ffmpeg_g            [.] av_frame_unref
   4.12%  ffmpeg_g  libc-2.22.so        [.] _mid_memalign
   3.42%  ffmpeg_g  libc-2.22.so        [.] _int_memalign
   2.97%  ffmpeg_g  libc-2.22.so        [.] __strcmp_sse2_unaligned
   2.65%  ffmpeg_g  libc-2.22.so        [.] malloc_consolidate

Eval appears way later:
   0.10%  ffmpeg_g  ffmpeg_g  [.] av_expr_eval


Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150815/4de45844/attachment.sig>

More information about the ffmpeg-devel mailing list