audioconvert: somewhat avoid precision loss in S32 to F32 conversion

At the very least, we should go through s25_32 intermediate
instead of s24_32, to avoid needlessly loosing 1 LSB precision bit.

That being said, i suspect it's still not doing the right thing.
Why are we silently dropping those 7 LSB bits?
Is that really the way to do it?
This commit is contained in:
Roman Lebedev 2024-06-14 02:00:27 +03:00
parent 175d533b56
commit c517865864
No known key found for this signature in database
GPG key ID: 083C3EBB4A1689E0
4 changed files with 38 additions and 46 deletions

View file

@ -121,7 +121,7 @@
#define S32_MIN (S24_MIN * 256)
#define S32_MAX (S24_MAX * 256)
#define S32_TO_F32(v) ITOF(int32_t, S32_TO_S24_32(v), S24_SCALE, 0.0f)
#define S32_TO_F32(v) ITOF(int32_t, S32_TO_S25_32(v), S25_SCALE, 0.0f)
#define S32S_TO_F32(v) S32_TO_F32(bswap_32(v))
#define F32_TO_S32_D(v,d) S25_32_TO_S32(F32_TO_S25_32_D(v,d))
#define F32_TO_S32(v) F32_TO_S32_D(v, 0.0f)