mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-09 23:53:28 -04:00
atrac3: remove the rounding bias of the ARMv5E QMF filter
The ARMv5E dewindowing routine takes 16 of each product's bits, rounded down, so each sum of 24 products came out about 12 units low. Through the filter bank that put a dc offset of about 12 LSB (of 16 bits) on the output and, from the high band, a tone at half the sample rate; together they were four fifths of the decoder's error on these targets. Start the sums 12 up. Also correct a comment in both ARM files. Checked with perfsim (Sansa Clip+ build) against ffmpeg's decode of seven files: the dc offset goes from 11 to 12 LSB down to under 1 LSB, and the error from about -66 dBFS to -69 to -72 dBFS, the same as the ARMv4 routine gives. Decoding is 0.7% slower (26.73 to 26.91 MHz for atrac3_lp2_132.oma). The ARMv4 output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8667af5cd7
commit
b8861e3f09
2 changed files with 9 additions and 4 deletions
|
|
@ -161,7 +161,7 @@ atrac3_iqmf_dewindowing:
|
|||
orr r8, r12, r8, lsl #1 /* s2 = low>>31 || hi<<1 */
|
||||
|
||||
stmia r0!, {r8, r9} /* store result out[0]=s2, out[1]=s1 */
|
||||
sub r1, r1, #184 /* roll back 64 entries = 184 bytes */
|
||||
sub r1, r1, #184 /* roll back 46 entries = 184 bytes */
|
||||
sub r2, r2, #192 /* roll back 48 entries = 192 bytes = win[0] */
|
||||
|
||||
subs r3, r3, #1 /* outer loop -= 1 */
|
||||
|
|
|
|||
|
|
@ -66,8 +66,13 @@ atrac3_iqmf_dewindowing_armv5e:
|
|||
/* 0.. 7 */
|
||||
ldmia r2!, {r4, r5, r8, r9} /* load win[0..7] */
|
||||
ldmia r1!, {r6, r7, r10, r11} /* load in[0..3] to avoid stall on arm11 */
|
||||
smulwb lr, r6, r4 /* s1 = in[0] * win[0] */
|
||||
smulwt r12, r7, r4 /* s2 = in[1] * win[1] */
|
||||
/* Each of the 24 products of a sum is rounded down by half a unit on
|
||||
* average. Start the sums 12 up to make up for it; without that the
|
||||
* output has a dc offset and, from the high band, a tone at fs/2. */
|
||||
mov lr, #12
|
||||
mov r12, #12
|
||||
smlawb lr, r6, r4, lr /* s1 += in[0] * win[0] >> 16 */
|
||||
smlawt r12, r7, r4, r12 /* s2 += in[1] * win[1] >> 16 */
|
||||
smlawb lr, r10, r5, lr /* s1 += in[i ] * win[i ] >> 16 */
|
||||
smlawt r12, r11,r5, r12 /* s2 += in[i+1] * win[i+1] >> 16 */
|
||||
|
||||
|
|
@ -152,7 +157,7 @@ atrac3_iqmf_dewindowing_armv5e:
|
|||
mov r12, r12, lsl #1
|
||||
|
||||
stmia r0!, {r12, lr} /* store result out[0]=s2, out[1]=s1 */
|
||||
sub r1, r1, #184 /* roll back 64 entries = 184 bytes */
|
||||
sub r1, r1, #184 /* roll back 46 entries = 184 bytes */
|
||||
sub r2, r2, #96 /* roll back 48 entries * 2 bytes = 96 bytes = win[0] */
|
||||
|
||||
subs r3, r3, #1 /* outer loop -= 1 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue