• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Plugins
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Release 3.4
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Buschel - 2010-06-03
Last edited by Buschel - 2010-06-04

FS#11348 - PDbox changes (fix, optimization)

This entry collects some patches to PDbox.

1) pdbox_cos_generation_v01.patch
This patch corrects the interpolation formular used in the waveform generation. It also unifies the generation loop that is used in cos~.c and osc~.c

2) pdbox_mult_asm_v01.patch
This patch adds ARM assembler for the mult(a,b) macro for speed up. Similar Coldfire assembler could easily be added as well.

3) pdbox_cos_tab_v01.patch
This patch reduces the size of cos_table[] to 1/4 of svn’s size. Now it uses ~32KB and can be moved to IRAM on several targets. This patch moves cos_table to IRAM on all targets for now. Major speed up on Coldfire is expected.

Closed by  Buschel
2010-06-04 23:38
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

Patches were adapted and submitted with several revisions. Coldfire asm was rejected because it introduced clicking noise.

Somehow the smaller cos_table results in severe audio problems… Should be further investigated…

It is rather simple. If you look at the middle part of your table, you will probably notice that you have removed minuses from the values in the utmost left column in the middle part of the table. I corrected that and checked it in. Same goes for the mult() optimization and cos~ interpolation.

Two suggestions:

1) Using the full 32 bit range might be a good idea. You’re probably not hurting for precision but it seems strange to only use 19 bits of a 32 bit register for no real reason.

2) Unless I’m confused, it looks like you have 0..360. Using the trig identity cos(180-theta)=-cos(theta) and the evenness of cos, the size of the tables could be further reduced. You should only need to include the range 0..90 degrees.


1) I suppose that there were some justifications why Günther Geiger (the author of PD-anywhere, the fixed-point Pure Data fork) chose this format.

2) I know. But in this stage I would rather like to update the standard GUI, making it somewhat more compatible for all targets. However, my intentions do not prevent anyone from solving this problem. The files that use cos_table are PDa/intern/cos~.c , PDa/intern/osc~.c and PDa/intern/vcf~.c . To test the result (osc~ only) use pdpod_test.pd patch from both and archives.

Wincent, thanks for spotting the bug in the cos_table and for submitting. I keep this open as there might follow some more patches (e.g. asm for Coldfire).

Some comments:
1) You should also submit the “#include plugin.h” in m_fixed.h. Otherwise CPU_ARM is not defined for each object build.
2) pdbox does not compile on pcsim (cygwin) anymore (”make: *** No rule to make target `/cygdrive/c/development/rockbox_test/build-pcsim/../src/m_fixed.h’, needed by `/cygdrive/c/development/rockbox_test/build-pcsim/apps/plugins/pdbox/PDa/intern/biquad~.o’. Stop.”). Target builds fine under cygwin, both target and pcsim build fine under vmware.

Added a patch to coldfire asm. Cannot test it though as I do not have access to coldfire target.

It seems that your multiplication optimization for Coldfire is making overflows repeatedly - well audible cracks are coming in repeating patterns (using pdpod_test.pd).

Also, if you made changes to makecostab.c , would you like to add them here too?

In case I did not mention it, the cracks came on iriver H320.


Available keyboard shortcuts


Task Details

Task Editing