[FFmpeg-devel] av_resample_init() optimization

Olivier Guilyardi list
Wed Jan 6 19:34:42 CET 2010


Hi,

I'm using libavcodec resampling on an Android ARM (Qualcomm MSM7200A 528 MHz)
device, without FPU support. The fact that it's integer-based is really great
for performances (this is for a closed source application, but I plan full LGPL
compliance with dynamic linking).

Nevertheless, there is an overhead upon initialization, when calling:
av_resample_init(44100, 48000, 16, 10, 0, 0.8).

This comes from av_build_filter() which takes about 6.9 *seconds* to build the
polyphase filterbank.

About 300ms (4%) can be saved by applying resample-xfactor.1.patch to r21036. It
caches some constant factor, and prevent bessel() and sqrt() from being called
when unnecessary. I'm not sure whether the cached factor affects accuracy.

This is however still very long, especially because I need 2 resamplers
(playback/record). The problem with av_build_filter() is that it uses doubles
which is truly heavy without FPU, even more than the damn floats.

So, another 3.9s (56%) can be preserved with resample-float.1.patch. It allows
to use floats instead of doubles by defining CONFIG_RESAMPLE_FAST_INIT.

I haven't noticed audible differences with these patches applied and enabled,
although my current tests are rather limited and lo-fi.

PS: the patches need to be applied in the same order as I mention them above.

--
  Olivier

-------------- next part --------------
A non-text attachment was scrubbed...
Name: resample-float.1.patch
Type: text/x-patch
Size: 4063 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100106/c99fb399/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resample-xfactor.1.patch
Type: text/x-patch
Size: 1174 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100106/c99fb399/attachment-0001.bin>



More information about the ffmpeg-devel mailing list