FS#12146 - Fix libcook bugs introduced in r22055

Attached to Project: Rockbox
Opened by Sean Bartell (wtachi) - Thursday, 02 June 2011, 00:25 GMT
Last edited by Nils Wallménius (nls) - Sunday, 05 June 2011, 13:13 GMT
Task Type Patches
Category Codecs
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


r22055 introduced two subtle bugs in libcook.

First, libcook's fixp_mult_su was replaced with a call to MULT31_SHIFT15. However, MULT31_SHIFT15 shifts the product 15 bits, while fixp_mult_su effectively shifted it 16 bits. The symptom is louder treble and changed stereo width.

Second, the shift amount in scalar_dequant_math was divided by two, overlooking the fact that the lowest bit is needed in the line immediately afterwards. The symptom is an odd noise added to some steady notes.

Both problems can be heard in the attached file, as compared to ffmpeg's decoder.
This task depends upon

Closed by  Nils Wallménius (nls)
Sunday, 05 June 2011, 13:13 GMT
Reason for closing:  Accepted
Additional comments about closing:  comitted with a small tweak to the cf asm, thanks!
Comment by Nils Wallménius (nls) - Friday, 03 June 2011, 08:48 GMT
This will not work for arm and cf targets that use the inline asm functions since you added MULT31_SHIFT16 to the header that is only used if the asm functions aren't present.
Comment by Sean Bartell (wtachi) - Friday, 03 June 2011, 18:20 GMT
MULT31_SHIFT16 added for ARM and Coldfire. It works on ARM; I can't test on Coldfire.