Frank Lorenz
2008-Feb-01 02:17 UTC
FW: Re: [Speex-dev] Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h / resampler saturation???
Hi Jean-Marc, didn't get a reply to my last post (see below) -- do you have no idea what happens here? After some more tests, I disabled the DIV32_16 Blackfin optimizations and now get good quality on the Blackfin. But when I have overdrive on the input, things become very bad -- I'm not sure if this is really a filter stability issue like I wrote some weeks ago. I use the speex resampler to downsample from 48 to 16 kHz. When I look to the downsampled signal before passing it to the encoder, there seems to be a bug in saturation. On overdrive, instead of holding a too big signal value at maximum (e.g. 32767) for some samples, the sample values I get from the resampler are [-32768,32767,-32768,...], i.e. the output of the resampler alters between the biggest possible negative value and the biggest possible positive value. Does the resampler use the hardware saturation available on Blackfin, or does it saturate by software? Can you point me to the place I have to look at inside the resampler function for saturation? best regards, Frank -----Urspr?ngliche Nachricht----- Von: Frank Lorenz <Frank_wtal@web.de> Gesendet: 24.01.08 15:28:49 An: speex-dev@xiph.org Betreff: FW: Re: [Speex-dev] Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h? Hi Jean-Marc, I did some further checks with 1.2 beta 3: The problematic function is DIV32_16 inside fixed_bfin.h. When I comment it out (i.e. replace it by the generic version of the routine), the quality improves significantly. Nevertheless, there is still a horrible distortion when there is some overdrive/saturation in the input signal. For me, it looks like there's an instable filter which oscillates when it is driven by a specific input frequency. With the blackfin version of DIV32_16 activated, a similar distortion appears even without overdrive, sometimes this distortion lasts forever. Addittionally, I always hear some kind of "fast ticking" noise in the background (sounds like non-smooth frame-fades). Does this help you to get some idea about the cause of the problem? best regards, Frank -----Urspr?ngliche Nachricht----- Von: Frank Lorenz <Frank_wtal@web.de> Gesendet: 22.01.08 23:16:05 An: speex-dev@xiph.org Betreff: Re: [Speex-dev] Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h? Hi Marc, I encountered the problems even with older versions of speex, including 1.2beta2 and 1.1.12, too. I had no time in the last weeks to investigate this issue further, sorry. Hopefully, I'm able to do some more test the next days, but I have no real idea how to proceed Performance and quality seem to be o.k. for me if I deactivate the Blackfin optimizations inside the file "fixed_bfin.h". Because I am not an expert on Blackfin architecture and assembler up to now, I think it would be helpful to start some discussion with David Rowe (his blog points me to the fact he has done a lot of optimizations for Blackfin?)? If I read old posts from this mailing list and David's Blog, it seems like there were people who were able to run speex on Blackfin without these problems? cheers, Frank -----Urspr?ngliche Nachricht----- Von: "Jean-Marc Valin" <jean-marc.valin@usherbrooke.ca> Gesendet: 20.01.08 12:30:06 An: Frank Lorenz <Frank_wtal@web.de> CC: speex-dev@xiph.org Betreff: Re: [Speex-dev] Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h? Hi, Just following up on this. Did were you able to figure out what causes the problem? Also, does it happen with 1.2beta2? Jean-Marc Frank Lorenz a ?crit :> Hello everybody, > > I'm currently trying to run speex on the Blackfin (BF-537) STAMP > evaluation board unter uCLinux. Using 1.2 beta 3, I encountered > problems when activating the Blackfin assembler optimizations. > Without optimizations for blackfin, i.e. calling ./configure > --enable-fixed-point --host=bfin-uclinux everything seems to work > fine. But when I add the --enable-blackfin-asm flag to the above > call, a speech signal which has been passed through the codec is > cleary disturbed (for me, it sounds like the long term prediction > (voice pitch detection) fails -- the signal sounds like the speaker > has a very ugly sore throat). I tried to deactivate each part of the > optimizaitions inside the libspeex directory, one after another. Most > of the "turn-offs" doesn't have any effect. When turning off the > optimizations inside "fixed_bfin.h", there is a big improvement -- > the decoded speech sounds good again, only on some positions in my > speech signal is a huge "click" which sounds like an overdrive caused > by an instable filter. When trying to switch off the optimizations > from "filters_bfin.h", my little program compiles but crashes on > runtime, sometimes (not always reproducable) causing a kernel panic > of uclinux. Error info is "Attempted misaligned instruction cache > fetch". > > Does anybody know what happens here? > > best regards, Frank > _________________________________________________________________________ > In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und > gestalten! Nur 3,99 EUR/Monat! > http://www.maildomain.web.de/?mc=021114 > > _______________________________________________ Speex-dev mailing > list Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev > >_________________________________________________________________________ In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114 _______________________________________________ Speex-dev mailing list Speex-dev@xiph.org http://lists.xiph.org/mailman/listinfo/speex-dev _______________________________________ GRATIS: Movie-FLAT. Jetzt freischalten! http://freemail.web.de/club/maxdome.htm _______________________________________________ Speex-dev mailing list Speex-dev@xiph.org http://lists.xiph.org/mailman/listinfo/speex-dev _____________________________________________________________________ Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
Jean-Marc Valin
2008-Feb-01 03:11 UTC
FW: Re: [Speex-dev] Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h / resampler saturation???
Frank Lorenz a ?crit :> didn't get a reply to my last post (see below) -- do you have no idea > what happens here?Sorry, been quite busy lately. Still have a backlog of things to respond to (sorry to others as well), some of it quite old.> After some more tests, I disabled the DIV32_16 Blackfin optimizations > and now get good quality on the Blackfin.OK, I'll need to investigate that one. It's mostly taken from the ADI manual, so I don't see what could have happened.> But when I have overdrive > on the input, things become very badDoes that happen without any assembly. Some amount of badness is expected from the fixed-point because of saturation issues. It shouldn't overflow though (can you check?)> -- I'm not sure if this is > really a filter stability issue like I wrote some weeks ago.I don't think it has to do with filters.> I use > the speex resampler to downsample from 48 to 16 kHz. When I look to > the downsampled signal before passing it to the encoder, there seems > to be a bug in saturation. On overdrive, instead of holding a too big > signal value at maximum (e.g. 32767) for some samples, the sample > values I get from the resampler are [-32768,32767,-32768,...], i.e. > the output of the resampler alters between the biggest possible > negative value and the biggest possible positive value.This is definitely bad. Can you send me an example file. Also, can you reproduce that problem without the Blackfin assembly?> Does the resampler use the hardware saturation available on Blackfin, > or does it saturate by software? Can you point me to the place I have > to look at inside the resampler function for saturation?Saturation is entirely done in software. The resampler does the conversion using the WORD2INT macro. Jean-Marc
Seemingly Similar Threads
- Re: Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h / resampler saturation???
- Re: Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h / resampler saturation???
- Re: Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h / resampler saturation???
- FW: Re: Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h / resampler saturation???
- Re: Problem with Blackfin assembly optimizations -- bug in fixed_bfin.h / resampler saturation???