• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Codecs
  • Assigned To No-one
  • Operating System SW-codec
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 1
  • Private
Attached to Project: Rockbox
Opened by tmal - 2007-03-18
Last edited by tmal - 2007-09-25

FS#6848 - Optimizations to Vorbis codec

I made some optimizations to the Vorbis codec. vector.patch is only for ARM (it shouldn’t change anything for Coldfire), others should make the codec slightly faster on all targets. I would like someone to check how these patches affect CPU boost ratio on Ipod and Coldfire based targets.

Please note bug  FS#6847  when testing this (make sometimes needs to be run twice to relink the codec).

Closed by  tmal
2007-09-25 21:02
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Two of the patches were committed. I'll take a look at coupling.patch and possibly resubmit it later. Meanwhile I have some new patches.

I just did a short comparison on my mini. I looked at the boost ratio in the audio thread debug screen, and after a while it settled at around 46% with patch as well as without the path. File is -q 5 and I waited for the buffer to get filled completely before I looked at the screen. Playback was running for about 5 minutes.

D’oh! I got the rebuild issue of  FS#6847  and didn’t notice it :(
Ok, ran the test again and boost ration now drops to 36%. Nice improvement!

nls commented on 2007-03-18 22:29

I tested the coupling and codebook patches on my h300, the coupling patch did not affect boost ratio at all (i think i saw a slight decrease but it could just as easily have been my imagination) i verified that the patch had taken by diffing the vorbis.codec files between testing and did reboot my player.
The codebook patch had a problem, all music had turned into horrible noise, but the boost dropped about 10% on one test track with both patches :-)

edit: it works fine in the sim, maybe an endian issue?

Adding endian swap to both reads from ptr[] seems to fix it. Gains also for Coldfire, but not so much as for ARM.

syfou commented on 2007-03-23 05:38

coupling.patch seems to have an adverse effect on decoding of very low quality (-q -1) vorbis encoded with both libvorbis or libvorbis + aotuv; once applied, output is more choppy, and channel discontinuity more noticeable (at least on the Sansa E200 target).

nls commented on 2007-03-23 15:00

Here is an updated version of the codebook patch that works on coldfire, I used
the letoh32() macro when ptr[] is accessed like preglow suggested so it should
still work fine on little endian devices too.

I did a little testing on my h300.
The firs number is boost ratio with a current svn build and the second is with the codebook patch.
Jewel of the summertime (q4) 16% 11%
Sabbath bloody sabbath (q6) 21% 12%
Ölstugan som inte finns (q4) 10% 6%

tmal commented on 2007-03-24 15:16

Thanks for catching and correcting endianess issue. I commited codebook and vector patches.

Sylvain, did you notice the difference with only the coupling patch applied? I looked at the patch and could not find any bug, I also checked the output with and without the patch and could not see the difference. Could you provide me with a file that exposes the problem?

syfou commented on 2007-03-25 08:23


applying only codebook.patch and vector.patch does not seem to affect the audio output quality; applying coupling.patch, alone or at the same time than the two others had a significant impact in my case. Here are a few clips for you to listen to:

I am not sure how much of the real hardware rockboxui emulates or simulates (I am pretty new to Rockbox), but the audiodump it generates is flawless, unlike what I hear on the real thing unfortunately, so I am not sure any of your code is even wrong… I should probably point out that the decoding of a vorbis stream encoded at higher quality (-q 3 for instance) is not affected by your patch from an audio standpoint… I wish I could help you more.

What happens if mag>0 and ang= -2^31? Won’t d=-d result in overflow? It looks like the original code would not overflow in this case. Maybe Sylvain’s bug report results from the different ways the target and the sim behave in this situation.

I wonder if using ARM’s conditional instructions could result in smaller/faster coupling code. (I haven’t seen the output of gcc for the coupling code though)

afaict this has been submitted to svn except the coupling stuff. Does that still apply or can this task be closed?

syfou commented on 2007-08-01 15:52

I just applied coupling.patch against rockbox trunk rev. 14120: on my sansa e280, the chopiness it initially caused (audible, vinyl-like scratches) is gone, but channel loss still occurs a few times per song on low quality (-q -1) libvorbis+aotuv.


Available keyboard shortcuts


Task Details

Task Editing