[fpc-pascal] Slightly different numerical results with 32-bit and 64-bit fpc
Martin Guy
martinwguy at gmail.com
Fri Mar 21 13:06:52 CET 2025
Sorry about that. Thunderbird seems to have sent the Draft last night
before it was ready.
On 20/03/25 19:55, Martin Guy wrote:
> I'm resurrecting a software to do DolbyB encoding and decoding in software
>but I'm finding that the resulting wave files, when it's compiled and
run > on 32-bit and on 64-bit Debian x86 are very slightly different.
It's now public in case anyone has access to 32-bit and 64-bit plaforms
and cares to verify this. I've fixed the C version on 32-bit platforms
and it gives exact the same output as the Pascal version on 32-bit platforms
so it looks like some imprecision (or extra precision!) in the fpc
64-bit math.
I've tried it with fpc on ARM aarch64 as well, and the results are the same
as on x86.
You'll need a wav file
On a 32-bit platform:
git clone https://codeberg.org/martinwguy/libdolbyb
cd libdolbyb
fpc DolbyBi64.PP
./DolbyBi64 in.wav out32.wav
On a 64-bit platform:
git clone https://codeberg.org/martinwguy/libdolbyb
cd libdolbyb
fpc DolbyBi64.PP
./DolbyBi64 in.wav out64.wav
and to subtract one wav from the other (assuming it's stereo)
sox --combine merge out32.wav out64.wav diffs.wav remix 1,3i 2,4i
(if it's mono, "remix 1,2i" is the magic)
then look at diffs.wav in your favorite sound editor.
Attached is the view in ReZound at maximum zoom where one vertical pixel
represents a difference of one bit value, or you can see it on
https://codeberg.org/martinwguy/libdolbyb/wiki/Status
Thanks and keep up the good work
M
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DolbyBi64-32-64-diffs-for-Cucurucucu-Paloma.png
Type: image/png
Size: 905 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20250321/a0390712/attachment.png>
More information about the fpc-pascal
mailing list