rockbox/lib/rbcodec/codecs/libwma
Michael Giacomelli 11b12894ad wma: fix the level of noise coded high bands
Low bitrate WMA files code their upper bands as noise at a given
power. Those bands came out 12 to 25 dB too quiet, which dulled
the treble. Two things were wrong.

The exponent pointer was moved too far in blocks whose exponents
have another resolution. This is ffmpeg's r20756 (f78501b264,
"Fix apparent 10l typos introduced in r8627"); r8627 was merged
here in 2f1da8d24a but the fix for it never was.

The fixed point gain of a band lost nearly all its precision: it
was zero for three bands in four in the file traced, and the sum
for a band's power overflowed in a quarter of them. Compute the
gain in 64 bits, once a band. The factor for the noise below the
first coded coefficient (WMA v1 only) was 16 bits too large and is
corrected by the same reasoning; no file here exercises it.

Checked with perfsim (Sansa e200v1 build) against ffmpeg's decode,
as the mean difference in band levels over the whole file:

  01 - Jane Austen (44.1 kHz, 32 kbps)   5.5 dB -> 0.0 dB
  07.Devil.In.My.Mind (same)             6.2 dB -> 0.0 dB
  beyonthepain907z (same)                6.8 dB -> 0.0 dB
  moshimoashitaga (same)                 2.8 dB -> 0.0 dB

Four more noise coded files, already within 0.3 dB, now match too.
The output of the 15 files without noise coding is byte-identical.
Files that use LSP exponents still differ in their top bands; that
is a separate fault in the LSP curve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 20:47:12 -04:00
..
libwma.make chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
SOURCES Fix race conditions in parallel build. 2016-05-28 17:41:32 +02:00
types.h Add codecs to librbcodec. 2012-04-25 22:13:20 +02:00
wmadata.h cleanup: Get rid of erroneous execututable bit on various source files 2026-02-19 07:54:35 -05:00
wmadec.h Rename CPU_S5L870X to CPU_S5L87XX 2024-11-20 10:58:32 -05:00
wmadeci.c wma: fix the level of noise coded high bands 2026-10-05 20:47:12 -04:00
wmafixed.c Add codecs to librbcodec. 2012-04-25 22:13:20 +02:00
wmafixed.h Add codecs to librbcodec. 2012-04-25 22:13:20 +02:00