This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#11398 - libmad: changes to mad_bit_read()
Attached to Project:
Rockbox
Opened by Andree Buschmann (Buschel) - Sunday, 13 June 2010, 12:01 GMT+2
Last edited by Andree Buschmann (Buschel) - Tuesday, 15 June 2010, 08:34 GMT+2
Opened by Andree Buschmann (Buschel) - Sunday, 13 June 2010, 12:01 GMT+2
Last edited by Andree Buschmann (Buschel) - Tuesday, 15 June 2010, 08:34 GMT+2
|
DetailsWhen reviewing the libmad code segment mad_bit_read() it became obvious that on LITTLE_ENDIAN targets the function betoh32() is called in each call of mad_bit_read(). This is not needed as the address from which the data is loaded does not change on each call of mad_bit_read(). So, we can buffer betoh32'ed data.
Patch v01 adds two global variables. The first holds the address, the second holds the data. If the address did not change in the current call of mad_bit_read(), the old -- already betoh32'ed -- data is used. In case of the need to load the new address the global variables are set accordingly. Measurements on a sample file showed that buffered data is used in 2/3 of all calls. So, on LITTLE_ENDIAN targets 2/3 of betoh32()-calls are eliminated, on Coldfire targets it might be of interest to measure speed as well. Reason is that the buffered variables are located in IRAM. A very similar approach in libmpc sped up Coldfire by several MHz. Strange thing is that the effect on arm7tdmi is (slightly) negative. Without patch 37.0 MHz (single core), with patch 37.15 MHz (single core). Patch v02 gets rid of global variables and adds both variables to the struct mad_bitptr. Libmad's code defined two different structs of this name! Therefore patch v02 needs to add dummy variables to the "other" struct as well to avoid overwriting of memory. I will check for a better solution which cleans up this mess... Needed: a) Tests on Coldfire targets! b) Ideas why there is a slight slowdown on arm (which should be LITTLE_ENDIAN)? c) Clean up of struct mess. |
This task depends upon
Closed by Andree Buschmann (Buschel)
Tuesday, 15 June 2010, 08:34 GMT+2
Reason for closing: Rejected
Additional comments about closing: Slower an arm and coldfire.
Tuesday, 15 June 2010, 08:34 GMT+2
Reason for closing: Rejected
Additional comments about closing: Slower an arm and coldfire.
virgin svn: 463.19% realtime 26.81MHz needed for realtime
libmad_v04.patch: 458.22% realtime 27.10MHz needed for realtime
I'll close this entry.