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

Ganesh Ajjanagadde gajjanag at mit.edu
Tue Nov 10 00:44:48 CET 2015


On Mon, Nov 9, 2015 at 5:14 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> 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

pushed, thanks.

On the note of a lut: any suggestions? In particular, one could for
instance create the lut for 2048 phases yielding an 8kB array, etc.

>
> [...]
> --
> 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
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list