Hi Thomas,
> A bad output looks like this:
$ normalize-audio -qn sweep.mp3
1938.4438dBFS -5.1133dBFS -1950.4438dB sweep.mp3
unfortunately I couldn't reproduce the issue at all, not a single time with
10000 runs on Debian bookworm, trixie or sid. My package versions to compare:
Debian bookworm
libaudiofile1 0.3.6-5+deb12u1
libflac12 1.4.2+ds-2
libmad0 0.15.1b-10.1+b1
libogg0 1.3.5-3
normalize-audio 0.7.7-17
Debian trixie/sid
libaudiofile1 0.3.6-7+b1
libflac14 1.5.0+ds-2
libmad0 0.15.1b-11+b1
libogg0 1.3.5-3+b2
normalize-audio 0.7.7-19
Maybe it is related to the versions of the dependencies?
Not sure whether the actual CPU generation/features matter (I'm on amd64, too).
Maybe these libraries have highly optimized code paths for different CPU
capabilities?
Running valgrind with debug symbols gives
$ apt-get install normalize-audio-dbgsym libmad0-dbgsym
$ valgrind normalize-audio -qn sweep.mp3
[...]
==2326670== Conditional jump or move depends on uninitialised value(s)
==2326670== at 0x110EAA: get_window_power (mpegvolume.c:145)
==2326670== by 0x111097: decode_output (mpegvolume.c:359)
==2326670== by 0x4883CD7: run_sync (in
/usr/lib/x86_64-linux-gnu/libmad.so.0.2.1)
==2326670== by 0x488418E: mad_decoder_run (in
/usr/lib/x86_64-linux-gnu/libmad.so.0.2.1)
==2326670== by 0x1111D1: signal_max_power_mp3 (mpegvolume.c:202)
==2326670== by 0x10DCB1: compute_levels (normalize.c:765)
==2326670== by 0x10D642: main (normalize.c:466)
That error goes away if I add "ds.maxpow = -DBL_MAX;" at mpegvolume.c:178. But
since I can't reproduce the problem, and you can't either with a self-built
binary ...
(... some time passing ...)
I've now done an experiment with "ds.maxpow = DBL_MAX;" (plus instead of minus)
and that gives
2992.2382dBFS -5.1133dBFS -3004.2382dB sweep.mp3
Looks like the missed initialization is indeed the issue. In the failing cases
the uninitialized memory has bit patterns of a float that is larger than the
maximum of the occurring values. If it is smaller than the issue has no
consequences except the valgrind error. Why that happens on your setup, but not
here is an open question that could depend on a lot of factors (libc, kernel,
security features, etc.), but I don't think we need to dig into this.
I'll prepare a new upload.
Best regards,
Joachim