Dne 20.6.2011 09:35, Pavel Hofman napsal(a):
Hi,
This is probably a question for Jaroslav Kysela. The better-quality rate plugins offer float resolution, but currently we are deliberately loosing information by down-converting to s16 in plugin_rate API (convert_s16). In rate_samplerate.c, the samples are up-converted to float before calling the libsamplerate API. Speex offers float API too, while we are using the int16 one.
There are two ways to handle this:
A. Implementing the generic "convert" API function for these plugins, handling the sample - float conversion in each plugin individually.
B. Extending the pcm_rate API (pcm_rate.h) with a new optional function convert_float.
Since the conversion from general sample format to float is not trivial (using the plugin_ops.h operations), I would be inclined to suggest the extension (well I have it hacked already :-) ). On the other hand, the conversion routine can be located in some common code shared by all the plugins involved and we could keep the existing API, using the generic convert function.
I am attaching preliminary patches. May I ask for help with adding a new API version number if you find it necessary? I am afraid this is beyond my skills.
The patches are not checkpatched yet.
After these patches are finished, I would like to work on implementing the SoX resampler algorithm which features excellent CPU consumption/resampling quality ratio.
Thanks a lot.
Pavel.