Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#11348 - PDbox changes (fix, optimization)

Attached to Project: Rockbox
Opened by Andree Buschmann (Buschel) - Thursday, 03 June 2010, 15:45 GMT+2
Last edited by Andree Buschmann (Buschel) - Saturday, 05 June 2010, 01:38 GMT+2
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version Release 3.4
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Private No

Details

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.
   pdbox_cos_tab_v01.patch (341 KiB)
 apps/plugins/pdbox/PDa/intern/cos_table.c | 5124 ++++++------------------------
 apps/plugins/pdbox/PDa/intern/cos_table.h |    2 
 2 files changed, 1027 insertions(+), 4099 deletions(-)

   pdbox_mult_asm_v01.patch (1.4 KiB)
 apps/plugins/pdbox/PDa/src/m_fixed.h |   26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

   pdbox_cos_generation_v01.patch (2 KiB)
 apps/plugins/pdbox/PDa/intern/osc~.c |   19 +++++++++----------
 apps/plugins/pdbox/PDa/intern/cos~.c |   19 ++++++++++++-------
 2 files changed, 21 insertions(+), 17 deletions(-)

This task depends upon

Closed by  Andree Buschmann (Buschel)
Saturday, 05 June 2010, 01:38 GMT+2
Reason for closing:  Accepted
Additional comments about closing:  Patches were adapted and submitted with several revisions. Coldfire asm was rejected because it introduced clicking noise.
Comment by Andree Buschmann (Buschel) - Thursday, 03 June 2010, 18:09 GMT+2
Somehow the smaller cos_table results in severe audio problems... Should be further investigated...
Comment by Wincent Balin (wincent) - Friday, 04 June 2010, 00:20 GMT+2
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.
Comment by MichaelGiacomelli (saratoga) - Friday, 04 June 2010, 02:34 GMT+2
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.
Comment by Wincent Balin (wincent) - Friday, 04 June 2010, 03:38 GMT+2
Answers:

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 PureData.zip and PureData2.zip archives.
Comment by Andree Buschmann (Buschel) - Friday, 04 June 2010, 10:01 GMT+2
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).
Comment by Andree Buschmann (Buschel) - Friday, 04 June 2010, 14:47 GMT+2
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.
Comment by Andree Buschmann (Buschel) - Friday, 04 June 2010, 19:18 GMT+2
Added a patch to coldfire asm. Cannot test it though as I do not have access to coldfire target.
   pdbox_cf_asm_v01.patch (1.4 KiB)
 apps/plugins/pdbox/PDa/src/m_fixed.h |   21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Comment by Wincent Balin (wincent) - Friday, 04 June 2010, 20:58 GMT+2
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?
Comment by Wincent Balin (wincent) - Friday, 04 June 2010, 20:59 GMT+2
In case I did not mention it, the cracks came on iriver H320.

Loading...