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.
This commit is contained in:
parent
8465c5fe0e
commit
92bb10eed8
@ -111,12 +111,11 @@ static void
|
|||||||
format_samples_float(G_GNUC_UNUSED int bytes_per_sample, void *buffer,
|
format_samples_float(G_GNUC_UNUSED int bytes_per_sample, void *buffer,
|
||||||
uint32_t count)
|
uint32_t count)
|
||||||
{
|
{
|
||||||
int32_t *dst = buffer;
|
float *p = buffer;
|
||||||
float *src = buffer;
|
|
||||||
assert_static(sizeof(*dst) <= sizeof(*src));
|
|
||||||
|
|
||||||
while (count--) {
|
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)
|
wavpack_bits_to_sample_format(bool is_float, int bytes_per_sample)
|
||||||
{
|
{
|
||||||
if (is_float)
|
if (is_float)
|
||||||
return SAMPLE_FORMAT_S24_P32;
|
return SAMPLE_FORMAT_FLOAT;
|
||||||
|
|
||||||
switch (bytes_per_sample) {
|
switch (bytes_per_sample) {
|
||||||
case 1:
|
case 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user