[Bug 14717] resampled sound is horrible

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Apr 23 11:58:19 CDT 2012


http://bugs.winehq.org/show_bug.cgi?id=14717

--- Comment #284 from Alexander E. Patrakov <patrakov at gmail.com> 2012-04-23 11:58:19 CDT ---
(In reply to comment #282)
> I did find one problem. In "put24" in patch 2,
> 
> +        t = lrintf(value * 0x800000);
> 
> should be
> 
> +        t = lrintf(value * 0x80000000);
> 
> to mirror the coefficient in "get24".

This indeed looks like a bug. However, the fix is wrong. First, 0x80000000U
just to tell gcc that it is a large positive number, not the most negative one.
Second, the overflow-case values above that line should be also modified.

Or take a simpler approach:

+    buf[0] = t & 0xFF;
+    buf[1] = (t >> 8) & 0xFF;
+    buf[2] = (t >> 16) & 0xFF;

This does make the numbers inconsistent, but note that the shift values are
different, too.

Also I think this piece of code needs unit tests. Namely, that three bytes
(0xff, 0xff, 0x7f) convert to something like 0.9999998807907104 and back, that
1.01 gets clipped and converted to (0xff, 0xff, 0x7f), and that (0x00, 0x00,
0x80) means -1.0

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list