[FFmpeg-devel] [PATCH] Rewrite main resampling loop (common and linear).

James Almer jamrial at gmail.com
Tue May 27 03:38:23 CEST 2014

On 26/05/14 9:38 PM, Ronald S. Bultje wrote:
> This removes a branch at a performance-sensitive point (in the middle
> of the loop). In fate-swr-resample-s32p-8000-2626, this makes the code
> about 10% faster. It also simplifies the loops, allowing us to rewrite
> it in yasm at some later point.
> The compensation_distance != 0 code and index < 0 code are still kind
> of hairy. For compensation_distance != 0, this should likely be handled
> in the caller, so that it calls swri_resample twice (once until the
> dst_incr switch-point, and once with the remainder of the samples). For
> index < 0, the code should probably be rewritten to break out of the
> loop once sample_index >= 0, and then resume (e.g. as a tail-call) to
> the common or linear resampling loops.

libavresample had some refactoring a couple months ago (commit be39496) 
where they removed the negative index case.

Maybe the general idea could be copied.

More information about the ffmpeg-devel mailing list