Commit graph

30 commits

Author SHA1 Message Date
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
Wim Taymans
819c4c26c7 audio-resampler: combine functions 2016-03-28 13:25:50 +02:00
Wim Taymans
de37491662 audio-converter: simplify API
Remove the consumed/produced output fields from the resampler and
converter. Let the caler specify the right number of input/output
samples so we can be more optimal.
Use just one function to update the converter configuration.
Simplify some things internally.
Make it possible to use writable input as temp space in audioconvert.
2016-03-28 13:25:50 +02:00
Wim Taymans
1d9a793545 audio-converter: more work on resampling
- Fix the resampler in the audio converter
- fix memory leaks
2016-03-28 13:13:59 +02:00
Wim Taymans
75d668e152 audio-converter: add resampler
Add a resampler to the processing chain when needed.
port the audio resampler to the new audioconverter library
2016-03-28 13:13:59 +02:00