Commit 92bb10ee authored by Max Kellermann's avatar Max Kellermann

decoder/wavpack: read float samples as-is, don't convert to integer

For MPD's new floating point support: when a decoded wavpack file needs to be resampled, don't convert float to int and back to float.
parent 8465c5fe
......@@ -111,12 +111,11 @@ static void
format_samples_float(G_GNUC_UNUSED int bytes_per_sample, void *buffer,
uint32_t count)
{
int32_t *dst = buffer;
float *src = buffer;
assert_static(sizeof(*dst) <= sizeof(*src));
float *p = buffer;
while (count--) {
*dst++ = (int32_t)(*src++ + 0.5f);
*p /= (1 << 23);
++p;
}
}
......@@ -127,7 +126,7 @@ static enum sample_format
wavpack_bits_to_sample_format(bool is_float, int bytes_per_sample)
{
if (is_float)
return SAMPLE_FORMAT_S24_P32;
return SAMPLE_FORMAT_FLOAT;
switch (bytes_per_sample) {
case 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment