Commit graph

54 commits

Author SHA1 Message Date
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
George Kiagiadakis
eefdf32d96 libs: audio-resampler: add support for consuming non-interleaved input buffers
https://bugzilla.gnome.org/show_bug.cgi?id=705986
2018-07-11 16:26:13 +03:00
Edward Hervey
22c9e5f7c1 libs: Documentation cleanup
* Fix wrong naming, wrong types and typos
* Add missing sections
* Add missing documentation for entries
* Explicitely mark private structure entries
* Remove items that never existed
2018-04-02 08:53:28 +02:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Arun Raghavan
4b5f78337a audioresample: Separate out CFLAGS used for SSE* code
This makes sure that we only build files that need explicit SIMD support
with the relevant CFLAGS. This allows the rest of the code to be built
without, and specific SSE* code is only called after runtime checks for
CPU features.

https://bugzilla.gnome.org/show_bug.cgi?id=729276
2016-09-29 18:37:08 +05:30
Arun Raghavan
f4cba79063 audioresample: Fix some gobject introspection warnings 2016-09-28 19:09:26 +05:30
Alessandro Decina
74efde50ad audio-resampler: disable neon on arm64
Fix the build on arm64 by using HAVE_ARM_NEON instead of __ARM_NEON__.
2016-03-30 11:16:49 +11:00
Wim Taymans
19f7d9ca46 audio-resampler: estimate memory usage in auto mode
Estimate the memory usage and use this to decide between full or
interpolated filter.
2016-03-28 15:37:36 +02:00
Wim Taymans
984ee8a3f6 audio-resampler: small optimizations 2016-03-28 13:25:55 +02:00
Wim Taymans
cf9059f070 audio-resampler: improve non-interleaved flags
Make it possible to have different interleaving on input and output
because we can quite trivially do that.
2016-03-28 13:25:55 +02:00
Wim Taymans
33855f0fe1 audio-resampler: unroll some more loops
Unroll some loops.
2016-03-28 13:25:55 +02:00
Wim Taymans
cc9d8594fe audio-resampler: small cleanups 2016-03-28 13:25:55 +02:00
Wim Taymans
e209c0d565 audio-resampler: optimize no resampling
Switch to the faster nearest resample method when are doing no rate
conversion.
2016-03-28 13:25:54 +02:00
Wim Taymans
f692d5e459 audio-resampler: add VARIABLE_RATE flag
Add a VARIABLE rate flag that selects an interpolating filter.
Move some function setup code in the _new function.
2016-03-28 13:25:54 +02:00
Wim Taymans
61460fdfad audio-resampler: overread only 8 taps
We only need 8 taps of zeroes as headroom for the SIMD optimized
functions.
2016-03-28 13:25:54 +02:00
Wim Taymans
00e5a8bab8 audio-resampler: fix phase 2016-03-28 13:25:54 +02:00
Wim Taymans
027165621b audio-resampler: avoid some format conversion
Store the filter in the desired sample format so that we can simply do a
linear or cubic interpolation to get the new filter instead of having to
go through gdouble and then convert.
2016-03-28 13:25:53 +02:00
Wim Taymans
d969a7a9d8 audio-resampler: reorder filter coefficients for more speed
Reorder the filter coefficients to make it easier to use SIMD for
interpolation.
Fix orc flags a little.
Add specialized nearest resampling function.
2016-03-28 13:25:53 +02:00
Wim Taymans
107f53ea0a audio-resampler: remove stereo optimizations
The stereo optimizations don't give enough benefit.
Rename none to full to make it clear that we use a full filter instead
of an interpolated one
2016-03-28 13:25:53 +02:00
Wim Taymans
d5abdd83c9 audio-resampler: add neon optimizations
Unroll some more loops in the fallback code that seems to work fine
for ARM.
Add some simple ARM optimizations taken from speex.
2016-03-28 13:25:53 +02:00
Wim Taymans
25d81ffb55 audio-resampler: give better hints about the precision
Give better hints to the compiler about the precision we expect from
the multiplications.
2016-03-28 13:25:53 +02:00
Wim Taymans
ea497b509f audio-resample: small optimizations
Remove some inline functions that are called in the slow path.
Unroll C fallback functions a little.
2016-03-28 13:25:52 +02:00
Wim Taymans
167a415717 audio-resampler: Use n_phases when calculating taps offset
Tweak linear interpolation oversampling.
Clear filter cache on rate changes when using a full filter.
2016-03-28 13:25:52 +02:00
Wim Taymans
524ea147cc audio-resampler: improve filter construction
Remove some unused variables from the inner product functions.
Make filter coefficients by interpolating if required.
Rename some fields.
Try hard to not recalculate filters when just chaging the rate.
Add more proprties to audioresample.
2016-03-28 13:25:52 +02:00
Wim Taymans
0f3ff9177f audio-resampler: avoid overflow in fraction calculation 2016-03-28 13:25:52 +02:00
Wim Taymans
651ae201bc audio-resampler: increase precision 2016-03-28 13:25:52 +02:00
Wim Taymans
bdf194a09a audio-resample: fix taps conversion
We do taps conversion in place so make sure we don't overwrite the
input with temporary data.
Optimize some more gint16 functions.
2016-03-28 13:25:52 +02:00
Wim Taymans
f6e0481ab5 audio-resampler: Improve taps memory layout
Rearrange the oversampled taps in memory to make it easier to use
SIMD instructions on them. this simplifies some sse code.
Add some more optimizations
2016-03-28 13:25:52 +02:00
Wim Taymans
e9fc039bb1 audio-resampler: add cubic interpolation 2016-03-28 13:25:52 +02:00
Wim Taymans
58dcd0587d audio-resampler: add more functions
Use some macros to generate more functions
2016-03-28 13:25:51 +02:00
Wim Taymans
e02af5c534 audio-resampler: add linear interpolation method
Make more functions into macros.
Add linear interpolation of filter coefficients.
2016-03-28 13:25:51 +02:00
Wim Taymans
05d238def9 audio-resampler: add max-phase-error config 2016-03-28 13:25:51 +02:00
Wim Taymans
13e5b986cd audio-resampler: improve tap calculation
Return the taps from make_taps, this makes it possible to not actually
have to cache the taps when we want to.
Fix overflow in phase calculation.
2016-03-28 13:25:51 +02:00
Wim Taymans
6397db74cd audio-resampler: fix guint -> gint 2016-03-28 13:25:51 +02:00
Wim Taymans
45574ba4f4 audio-resampler: improve phase error
Accept a phase error of maximum 10%, which turns out to be inaudible.
2016-03-28 13:25:51 +02:00
Wim Taymans
b0b3350717 audio-resampler: improve phase calculation
Also calculate the GCD with the current phase so that we can accurately
represent the current phase with the new resample rates.
2016-03-28 13:25:51 +02:00
Wim Taymans
bbdb447b2b audio-resampler: fix history after buffer resize
When we resize the temp buffer, move the history in its new place.
2016-03-28 13:25:51 +02:00
Wim Taymans
ed747492ef audio-resampler: add reset function
Add a function to reset the audio-resampler.
Use new function in audio-converter
Use the new functions in gstaudioresample and fixup drain functions.
2016-03-28 13:25:51 +02:00
Wim Taymans
ea469ad9a8 audio-resampler: Small fixes
Fix the phase.
Reset the new sample buffer with 0.
Move samples around when we change the filter size.
2016-03-28 13:25:51 +02:00
Wim Taymans
a489f9ddb3 audio-resampler: Rework make_taps
Make it return a pointer to the generated taps. That way we can later
decide to actually cache it or not.
2016-03-28 13:25:51 +02:00
Wim Taymans
05eb109c0d audio-resampler: handle filter length changes
Update the buffer with history samples when the filter length changes
because of an update of the parameters or sample rates.
2016-03-28 13:25:51 +02:00
Wim Taymans
8dfb3ffb99 audio-resampler: fix samples_avail
We only know the taps after we calculate them.
2016-03-28 13:25:51 +02:00
Wim Taymans
c8fc9d88a7 audio-resampler: work on dynamically changing the samplerate
Calculate the new phase for the new sample rate.
Fix some docs.
2016-03-28 13:25:51 +02:00
Wim Taymans
4e48867097 audio-resampler: small cleanups 2016-03-28 13:25:51 +02:00
Wim Taymans
85c77659b9 audio-resampler: add fallback to mono function
Remove stereo implementations. Implement fall back to mono functions
when the stereo function is missing.
2016-03-28 13:25:50 +02:00
Wim Taymans
2555317a71 audio-resampler: add float stereo SSE function 2016-03-28 13:25:50 +02:00
Wim Taymans
d348fbb9b9 audio-converter: make some optimized functions
Make an optimized function that just calls the resampler when possible.
Optimize the resampler transform_size function a little.
2016-03-28 13:25:50 +02:00
Wim Taymans
23531bdc93 audio-resampler: remove mirror function
We don't need to mirror the input, just assume 0 samples.
Always move the processed samples to the start of the buffer.
Add some G_LIKELY
2016-03-28 13:25:50 +02:00
Wim Taymans
71871c5048 audio-resampler: optimizations
Improve int16 resampling by using pmaddwd
Use intrinsics to scale and pack int16 samples
Align the coefficients so that we can use aligned loads
Add padding to taps and samples so that we don't have to use partial
loads for the remainder of the loops.
Remove copy_n, we can reuse the plain copy function with some new
parameters.
Align and pad the sample array.
2016-03-28 13:25:50 +02:00
Wim Taymans
f55a67ca7c audio-resampler: make pluggable optimized functions
Add support for x86 specialized functions and select them at runtime.
2016-03-28 13:25:50 +02:00