Commit b4d19378 authored by Max Kellermann's avatar Max Kellermann

decoder/wavpack: change norm_offset to 0

MPD uses a floating point range from -1 to +1 internally - why ask libwavpack to use -32768..+32768 only to reduce it back to -1..+1 afterwards?
parent 0be5fbdc
...@@ -98,15 +98,10 @@ format_samples_int(int bytes_per_sample, void *buffer, uint32_t count) ...@@ -98,15 +98,10 @@ format_samples_int(int bytes_per_sample, void *buffer, uint32_t count)
* This function converts floating point sample data to 24-bit integer. * This function converts floating point sample data to 24-bit integer.
*/ */
static void static void
format_samples_float(gcc_unused int bytes_per_sample, void *buffer, format_samples_float(gcc_unused int bytes_per_sample, gcc_unused void *buffer,
uint32_t count) gcc_unused uint32_t count)
{ {
float *p = (float *)buffer; /* do nothing */
while (count--) {
*p /= (1 << 23);
++p;
}
} }
/** /**
...@@ -531,7 +526,7 @@ wavpack_streamdecode(DecoderClient &client, InputStream &is) ...@@ -531,7 +526,7 @@ wavpack_streamdecode(DecoderClient &client, InputStream &is)
char error[ERRORLEN]; char error[ERRORLEN];
WavpackContext *wpc = WavpackContext *wpc =
WavpackOpenFileInputEx(&mpd_is_reader, &isp, wvc.get(), WavpackOpenFileInputEx(&mpd_is_reader, &isp, wvc.get(),
error, open_flags, 23); error, open_flags, 0);
if (wpc == nullptr) { if (wpc == nullptr) {
FormatError(wavpack_domain, FormatError(wavpack_domain,
...@@ -555,7 +550,7 @@ wavpack_filedecode(DecoderClient &client, Path path_fs) ...@@ -555,7 +550,7 @@ wavpack_filedecode(DecoderClient &client, Path path_fs)
char error[ERRORLEN]; char error[ERRORLEN];
WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error, WavpackContext *wpc = WavpackOpenFileInput(path_fs.c_str(), error,
OPEN_TAGS | OPEN_WVC | OPEN_NORMALIZE, OPEN_TAGS | OPEN_WVC | OPEN_NORMALIZE,
23); 0);
if (wpc == nullptr) { if (wpc == nullptr) {
FormatWarning(wavpack_domain, FormatWarning(wavpack_domain,
"failed to open WavPack file \"%s\": %s", "failed to open WavPack file \"%s\": %s",
......
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