rockbox/lib/rbcodec/codecs
Michael Giacomelli 8667af5cd7 atrac3: fix gain compensation at adjacent gain points
applyVariableGain() applied the constant gain before a gain point
in a do-while loop, so at least eight samples of it, even when
there are none: when the point is at the start of the block or
follows straight after the previous one. Every later gain point in
the block was then eight samples late. This came in with the loop
unrolling of 51a8be1a0f.

Use a while loop, as ffmpeg does.

Checked with perfsim (Sansa e200v1 build) against ffmpeg's decode.
Over the whole of atrac3_lp2_132.oma the SNR goes from 45 to 51 dB
and the worst frame from 14 to 21 dB; the right channel of a joint
stereo RM file goes from 37 to 54 dB. What is left is a noise floor
near -72 dBFS in every frame, from the 2 fractional bits the
decoder works with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 21:56:47 -04:00
..
cRSID Revert "[BugFix] Enums are only 2 bytes on some Devices" 2024-11-24 11:38:16 -05:00
demac libdemac: reciprocal table for the pivot division on ARMv5+ 2026-10-05 10:19:38 -04:00
lib chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
liba52 chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libalac chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libasap chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libasf chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libatrac atrac3: fix gain compensation at adjacent gain points 2026-10-06 21:56:47 -04:00
libayumi chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libcook chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libfaad chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libffmpegFLAC flac: ARM assembly for the 64-bit LPC filter 2026-10-05 12:19:09 -04:00
libgme chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libm4a libm4a: handle sparse chunk maps and video-first MP4 2026-09-07 09:17:27 -04:00
libmad chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libmusepack chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libopus opus: filter the PLC excitation in place 2026-09-30 11:25:30 -04:00
libpcm chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
librm Add "rbfs" prefix to native filesystem functions 2026-09-17 16:22:31 -04:00
libspc chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libspeex libspeex: Silence a spurious warning under Clang 2026-07-15 16:22:18 -04:00
libtremor vorbis: don't buffer the comment packet 2026-10-05 22:41:43 -04:00
libtta chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libwavpack chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
libwma wma: fix dropouts in files with LSP exponents 2026-10-05 21:21:27 -04:00
libwmapro wmapro: fix the level and accuracy of 16 bit streams 2026-10-05 20:13:48 -04:00
libwmavoice chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
a52.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
a52_rm.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
aac.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
aac_bsf.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
adx.c fix warnings on some systems / format specifier mismatch 2024-12-07 11:07:44 -05:00
aiff.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
aiff_enc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
alac.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
ape.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
asap.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
atrac3_oma.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
atrac3_rm.c atrac3: give the decoder its frame size for RM files 2026-10-06 21:56:47 -04:00
au.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
ay.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
codec_crt0.c 3ds: Port refactor. 2026-09-01 08:39:07 -04:00
codecs.h chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
codecs.make codecs: link libarm_support for its division routines 2026-10-05 07:46:37 -04:00
cook.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
flac.c flac: cope with frames larger than one buffer request 2026-10-03 18:17:56 -04:00
gbs.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
hes.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
kss.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
mod.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mp3_enc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mpa.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mpc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
nsf.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
opus.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
raac.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
sgc.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
shorten.c codecs: Fix elapsed time calculation for large files 2018-10-29 19:50:34 +01:00
sid.c SID: Don't uselessly upconvert from 16bpp mono to 28bpp stereo 2025-09-02 20:19:22 -04:00
smaf.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
SOURCES warble: fix build on targets with HAVE_RECORDING 2026-08-25 08:01:09 -04:00
spc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
speex.c build: Silence a pile of set-but-not-used warnings in codecs 2026-05-17 16:39:06 -04:00
tta.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
vgm.c Remove explicit 'enum codec_command_action' in codec API 2017-12-07 14:41:59 -05:00
vorbis.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
vox.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
vtx.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wav.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wav64.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wav_enc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wavpack.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wavpack_enc.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wma.c wma: decode every codec packet in an ASF payload 2026-10-05 20:47:12 -04:00
wmapro.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
wmavoice.c chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00