[vlc-devel] [PATCH] audio_filters: add sample converter in pipeline

Thomas Guillem thomas at gllm.fr
Fri Oct 30 11:30:41 CET 2015

When creating a new chain a filter, the sample rate "audio converter" is not
added in the chain since a "audio resampler" is already added at the end of the
chain.  This last filter is used to convert the sample rate, but also used to
fix audio/video delay via a variable-rate resampling.

Unfortunately, we don't have any audio_filter modules that is capable of doing
a variable-rate resampling with good quality and good performances. Indeed,
when fixing audio/video delay, the input rate is changed for every block
processed and the setup of this new rate can take a long time.

Because of this bad performance, the ugly audio_filter is used to convert the
sample rate and to fix this delay, but it's quite ugly (hence the name).

This patch will allow to add back in the chain a good quality/good performance
resampler with a fixed rate. The ugly resampler will still be added at the end
of the chain but will only be used when there is a delay to fix.

For information:

 - SoXR with a fixed rate: the "single-precision-SIMD" engine is used, it can
   use av_rdft from avcodec to process DFT via sse/neon: performance and
   quality are very good.
 - SoXR with a variable rate: "the single-precision variable-rate" engine is
   used. This engine doesn't have any SIMD or ARCH specific accelerations:
   quality is good but performances are bad.

 - SpeexDSP with a fixed rate: good quality and performances.
 - SpeexDSP with a variable rate: speex_resampler_set_rate can take a very long
   time, therefore performances are very very bad (it can take more time to
   process than the length of the block).
 src/audio_output/filters.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 74c5a6a..d90e6da 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -449,7 +449,6 @@ aout_filters_t *aout_FiltersNew (vlc_object_t *obj,
     /* convert to the output format (minus resampling) if necessary */
-    output_format.i_rate = input_format.i_rate;
     if (aout_FiltersPipelineCreate (obj, filters->tab, &filters->count,
                               AOUT_MAX_FILTERS, &input_format, &output_format))

More information about the vlc-devel mailing list