[FFmpeg-devel] [PATCH 1/2] swresample/resample: speed up upsampling by precomputing sines

Michael Niedermayer michael at niedermayer.cc
Mon Nov 9 23:14:13 CET 2015


On Mon, Nov 09, 2015 at 09:38:43AM -0500, Ganesh Ajjanagadde wrote:
> When upsampling, factor is set to 1 and sines need to be evaluated only
> once for each phase, and the complexity should not depend on the number
> of filter taps. This does the desired precomputation, yielding
> significant speedups. Hard guarantees on the gain are not possible, but gains
> themselves are obvious and are illustrated below.
> 
> Sample benchmark (x86-64, Haswell, GNU/Linux)
> test: fate-swr-resample-dblp-2626-44100
> old:
> 29161085 decicycles in build_filter (loop 1000),     256 runs,      0 skips
> 28821467 decicycles in build_filter (loop 1000),     512 runs,      0 skips
> 28668201 decicycles in build_filter (loop 1000),    1000 runs,     24 skips
> 
> new:
> 14351936 decicycles in build_filter (loop 1000),     256 runs,      0 skips
> 14306652 decicycles in build_filter (loop 1000),     512 runs,      0 skips
> 14299923 decicycles in build_filter (loop 1000),    1000 runs,     24 skips
> 
> Note that this does not statically allocate the sin lookup table. This
> may be done for the default 1024 phases, yielding a 512*8 = 4kB array
> which should be small enough.
> This should yield a small improvement. Nevertheless, this is separate from
> this patch, is more ambiguous due to the binary increase, and requires a
> lut to be generated offline.
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libswresample/resample.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)

LGTM

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151109/ea3b041f/attachment.sig>


More information about the ffmpeg-devel mailing list