Wim Taymans
0ba3e7c5db
audioconvert: round instead of truncate, to reduce distortion
...
See #2543
2022-07-13 20:56:13 +02:00
Wim Taymans
7745346292
audioconvert: add sse2 s16 dither functions
2022-07-12 10:34:13 +02:00
Wim Taymans
c31928c5f0
audioconvert: add and use CLAMP macros
2022-07-12 10:33:37 +02:00
Wim Taymans
c35006f040
audioconvert: move scaling to setup
2022-07-11 17:50:20 +02:00
Wim Taymans
68f883ff77
audioconvert: fix dither scale
...
Rectangular dither should be [-0.5, 0.5]
Triangular dither should be [-1.0, 1.0]
Noise should add extra bits.
2022-07-11 17:19:28 +02:00
Wim Taymans
e313149f7f
audioconvert: improve SSE2 dither generation
2022-07-11 16:41:12 +02:00
Wim Taymans
277addcca6
audioconvert: add triangular dither
2022-07-11 16:28:51 +02:00
Wim Taymans
dd1d5960b4
audioconvert: implement f64s
...
Add swapping functions for f64s.
Fix the awkward interleave/deinterleave names for 32s.
2022-07-11 10:58:51 +02:00
Wim Taymans
0343e0da73
fmt-ops: fix some missing shifts and min/max
2022-07-07 18:57:03 +02:00
Wim Taymans
b8a4bf880f
audioconvert: use 24 bits for 32 formats
...
The float only preserves 24 bits so use this. Otherwise we get overflows
and errors in clang.
2022-07-07 18:38:32 +02:00
Wim Taymans
22317da685
audioconvert: tweak conversion constants
...
Tweak the conversion constants a bit so that they handle the
extreme ranges a bit better.
Align the C and vector instructions.
Reactivate the unit test asserts when a conversion fails.
2022-07-05 12:20:02 +02:00
Wim Taymans
817d5bd7a4
audioconvert: simplify 24 bits handling
...
Make a new uint42_t and int24_t type and use that to handle 24 bits
samples. This makes it easier because we can iterate and copy the
structs like other types.
2022-07-01 12:25:58 +02:00
Wim Taymans
06b1cf8663
audioconvert: implement (de)interleave with existing functions
2022-06-30 18:24:05 +02:00
Wim Taymans
938f2b123e
audioconvert: improve format conversion
...
Make dither noise as a value between -0.5 and 0.5 and add this
to the scaled samples.
For this, we first need to do the scaling and then the CLAMP to
the target depth. This optimizes to the same code but allows us
to avoid under and overflows when we add the dither noise.
Add more dithering methods.
Expose a dither.method property on audioconvert. Disable dither when
the target depth > 16.
2022-06-29 14:10:15 +02:00
Wim Taymans
d23b96b033
audioconvert: fix some compiler warnings
2022-06-29 14:08:30 +02:00
Wim Taymans
abe87f8008
audioconvert: use unaligned loads
...
We collect 4 channels from the source. When the number of channels is
not a multiple of 4, we need to do unaligned reads.
See #2221
2022-03-17 10:02:07 +01:00
Barnabás Pőcze
0f28309f07
audioconvert: fix sse2 deinterleave_32
...
Fixes #2213
2022-03-16 10:54:27 +01:00
Wim Taymans
734470f0cd
audioconvert: add SSE (de)interleave_32(s) versions
2022-03-11 15:02:02 +01:00
Wim Taymans
a520335581
fmt-ops: add sse2 version of f32 to s16 planar/interleaved
2020-07-03 11:05:26 +02:00
Wim Taymans
3a911dfe3b
fmt-ops: add avx2 optimized version
...
Only one optimized version but the sse2 version are compiled with
the avx2 flags so that they get optimized better.
2020-03-16 16:11:29 +01:00
Wim Taymans
fd3dd14ebe
fmt-ops: add optimized f32 to s16 stereo conversion
2020-03-16 13:04:21 +01:00
Wim Taymans
0548fbf690
fmt-ops: fix bug in s32 to f32 conversion
2020-03-16 12:57:21 +01:00
Wim Taymans
cb7bfdf98a
sprinkly SPA_LIKELY/UNLIKELY around
2020-03-16 12:52:28 +01:00
Wim Taymans
3c9aa2e96c
fmt: add sse2 optimized s32->f32d
2019-10-24 11:06:04 +02:00
Wim Taymans
ae3e5787af
audioconvert: unroll some loop
2019-04-10 12:53:25 +02:00
Wim Taymans
d8e399dee9
audioconvert: pass state to functions
...
Pass some state to convert and channelmix functions. This makes it
possible to select per channel optimized convert functions but
also makes it possible to implement noise shaping later.
Pass the channelmix matrix and volume in the state.
Handle specialized 2 channel s16 -> f32 conversion
2019-03-29 17:39:59 +01:00
Wim Taymans
e7ef13e310
audioconvert: add avx optimizations
2019-03-28 16:45:57 +01:00
Wim Taymans
7f041f4098
audioconvert: improve benchmark
...
Also include the simd versions in the benchmark
Fix some issues found by new test
2019-03-28 13:26:06 +01:00
Wim Taymans
c8d3d475bb
audioconvert: handle more optimizations
...
Compile an optimized library for the given CPU with the right flags,
then link it with the main library.
2019-03-27 17:58:48 +01:00
Wim Taymans
ecc3e78ad4
fmt-ops: use faster f32 -> s32 conversion
2019-03-26 17:24:14 +01:00
Wim Taymans
c9bd95ae5b
audioconvert: small optimization
2019-03-20 15:57:13 +01:00
Wim Taymans
b265081d6d
audioconvert: use macro to transpose
2019-03-20 13:37:20 +01:00
Wim Taymans
fa3bcabbca
audioconvert: some more optimizations
2019-03-20 13:04:44 +01:00
Wim Taymans
577852863c
fmt: remove debug assert
2019-01-25 09:40:14 +01:00
Wim Taymans
13bf70a8dd
mem: align memory to requested alignment
...
Improve the allocators to always align the buffer memory to the
requested alignment
Use aligned read and writes for sse functions and check alignment,
optionally falling back to unaligned path.
Add more tests and benchmark cases
Check and warn for misaligned memory in plugins.
2019-01-24 18:28:52 +01:00
Wim Taymans
6f586602af
audioconvert: add unit test for format conversion
...
Add unit test for fmt conversion and fix some bugs
Add empty fmt-ops benchmark
2019-01-23 15:59:54 +01:00
Wim Taymans
2a252abf50
fmt-ops: small optimization
2019-01-03 11:36:44 +01:00
Wim Taymans
0e91276a03
fmt-ops: SSE functions were really SSE2
...
The SSE functions used integer operations and were really SSE2 so
rename.
Optimize some more.
2018-12-20 16:11:25 +01:00