Active Topics

 


Reply
Thread Tools
Posts: 503 | Thanked: 267 times | Joined on Jul 2006 @ Helsinki
#61
Could anyone test A2DP with oprofile and identify/confirm what exactly loads cpu so high? It is quite easy to setup oprofile in OS2008 by following the instructions from http://maemo.org/development/tools/doc/oprofile
 
Posts: 6 | Thanked: 0 times | Joined on Mar 2006
#62
Originally Posted by Serge View Post
Could anyone test A2DP with oprofile and identify/confirm what exactly loads cpu so high? It is quite easy to setup oprofile in OS2008 by following the instructions from http://maemo.org/development/tools/doc/oprofile
The code is written with inline functions all over the place so without making a debug build you'll just see a lot of utilization in sbc_encode iirc.
 
Posts: 503 | Thanked: 267 times | Joined on Jul 2006 @ Helsinki
#63
Originally Posted by bmidgley View Post
As far as CPU utilization, I suspect it's due to cache misses. A pxa270 with identical size cache and association size 32 runs the encoding at about 4% of the cpu; however the 2420, with its 4 associations and similar speed needs around 50%. There is a section of code that moves memory around on every pass so we'll target that first.
Just benchmarked sbcenc from bluez-utils-3.24 on N800:
Code:
# time ./sbcenc test.snd > /dev/null
real    0m 24.57s
user    0m 23.23s
sys     0m 0.89s
Considering that the duration of test.snd file was 226 seconds, estimated cpu load should be ~11% which is a lot lower than 50%. Maybe something else is eating cpu cycles (not sbc codec) or your sbc build was compiled with suboptimal gcc options?

Oprofile shows the following statistics (with '-fno-inline' compilation option added).
Code:
opreport -l ./sbcenc
CPU: ARM V6 PMU, speed 0 MHz (estimated)
Counted CPU_CYCLES events (clock cycles counter) with a unit mask of 0x00 (No unit mask) count 100000
samples  %        symbol name
42423    48.6681  _sbc_analyze_eight
23466    26.9204  sbc_pack_frame
14057    16.1263  sbc_analyze_eight
4017      4.6083  sbc_encode
2492      2.8588  sbc_calculate_bits
414       0.4749  sbc_analyze_audio
118       0.1354  sbc_crc8
78        0.0895  encode
49        0.0562  __write
33        0.0379  __read
21        0.0241  .plt
This sbc encoder contains a lot of 32x32->64 integer multiplications which are not very fast. Probably it would be better to use floating point sbc encoder on N8x0 (version from bluez-utils-2.25)? Right now it is twice slower:
Code:
time ./sbcenc-fp test.snd > /dev/null
real    0m 56.69s
user    0m 54.75s
sys     0m 1.03s
Code:
opreport -l ./sbcenc-fp
CPU: ARM V6 PMU, speed 0 MHz (estimated)
Counted CPU_CYCLES events (clock cycles counter) with a unit mask of 0x00 (No unit mask) count 100000
samples  %        symbol name
139072   67.4416  sbc_analyze_eight
57776    28.0179  sbc_pack_frame
6560      3.1812  sbc_encode
1704      0.8263  sbc_calculate_bits
678       0.3288  sbc_analyze_audio
113       0.0548  .plt
101       0.0490  sbc_crc8
64        0.0310  __aeabi_idiv
59        0.0286  encode
46        0.0223  __read
38        0.0184  __write
Coincidentally, I did some experiments with ARM VFP optimizations just a few days ago, and the results are very promising: http://lists.mplayerhq.hu/pipermail/...ry/040250.html

Performance of vector_fmul function can become ~13x faster with assembly optimizations. And function 'sbc_analyze_eight' from sbc encoder contains a lot of very similar code which could also use VFP optimizations.

Last edited by Serge; 2008-01-10 at 00:09.
 

The Following User Says Thank You to Serge For This Useful Post:
Johnx's Avatar
Posts: 643 | Thanked: 628 times | Joined on Mar 2007 @ Seattle (or thereabouts)
#64
It's great to see people who know what they're talking about working on this. I'm afraid that I waded in to this whole thing, then realized that I was out of my depth. At this point, to me at least, it looks like there is something strange about ALSA included with 2008OS. I guess my big question to solve before I give up and call it good enough is: Could a problem with buffers in the ALSA libs on the system be causing mplayer (or xmms) to waste lots of CPU time when outputting to A2DP?

Last edited by Johnx; 2008-01-10 at 01:11.
 
Posts: 47 | Thanked: 10 times | Joined on Dec 2007
#65
Originally Posted by w4csc View Post
If you're looking for LOUD from a BT tablet headset, it's called MotoROKR S9 and Radio Shack, of all places, recently had them on sale for $79! If you turn up the tablet volume controls and the volume on the headset, in just one earphone so far, the sound is PAINFULLY LOUD!...(c;!
Or get them here for $38:

http://www.dealextreme.com/details.dx/sku.2354
 
Posts: 5 | Thanked: 0 times | Joined on Nov 2007
#66
I just got my Sony DR-BT30Q headphones through from Play.com (only 12.99 ukp delivered) and after some initial problems creating the .asoundrc file, I got mplayer outputting choppy stereo audio, so I'm happy for the moment..
 
Johnx's Avatar
Posts: 643 | Thanked: 628 times | Joined on Mar 2007 @ Seattle (or thereabouts)
#67
OK, I've been hacking on this more. Don't think I've given up or something. I have madplay and aplay compiled and I've been testing them. Piping from madplay to aplay uses about 50% CPU. aplay playing a .wav takes up 20%-30% and no matter what aplay (which claims to set the period size) still can't change the period size from 128. I'm going to try something else to track this down. Stay tuned...
 
Posts: 2 | Thanked: 0 times | Joined on Jan 2008
#68
Appreciate your work on this, I'm a noob as far as the N800 goes (and Linux in general) but I'll help with testing in any way I can. I have the Kyocera wireless headphones. Looking forward to the one-click install package.

Thanks again!
 
Posts: 326 | Thanked: 39 times | Joined on Jul 2007
#69
Yeah, I think we would all love a .deb. (I'm not really lazy, I'm just a little ignorant in the ways of programming/Linux in general) I know, I should try and learn something...
 
Johnx's Avatar
Posts: 643 | Thanked: 628 times | Joined on Mar 2007 @ Seattle (or thereabouts)
#70
I've resisted doing a .deb until the situation is a little better, but looking at things now that might take a while. I'll consider doing a beta .deb soon with the understanding that it is *VERY BETA*.

-John
 

The Following User Says Thank You to Johnx For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 20:46.