Cheng Rong
2007-Jul-25 01:27 UTC
[Speex-dev] Speex optimization and 12 bits conversion for 12 bits ADC
Hi?Jean-Marc? Thanks for your suggestions very much!> > I am porting speex on ARM7TDMI, I have done some optimization, the > > result is that the encoder and decoder need about 60 MCPS for 5.96kbps > > bitrate and complexity 0. Can someone give me informtion about Speex > > optimization on ARM7? > > That's quite good. A few suggestions here: > 1) Don't use complexity 0 unless you're really desperate (the CPU gain > over complexity 1 is marginal and there's a cost in quality) > 2) Have you enabled the current ARM4 assembly bits? > 3) There are a couple functions that could definitely benefit from > assembly optimisations. They used to be optimised for AMR4, but I had to > remove that when I optimised the C version. Those are filter_mem16(), > iir_mem16() and fir_mem16(). Let me know if you're going to do that > because the best way to do it is not to start from the current C code. >Yes, I have enabled the the current ARM4 assembly bits. I have tried to optimize these functions(filter_mem16(),iir_mem16() and fir_mem16()) in C code, but the effect is very small, and I am going to do assembly optimization for these functions. Do you have another C code about these functions for assembly optimisations? Can you give me some information and suggestions?> > Another question, my ADC and DAC are 12 bits, but Speex codec is > > 16bits, Did someone try to modify speex to 12 bits? I think if I > > modify speex to 12 bits, the computation power will be reduced, is it > > right? > > Wrong. Speex would still need 16 bits internally. I also recommend you > only shift by 3 so that you're sure never to have clipping problems at > 16 bits. >My ADC is 12 bits, and the data from 12 bits ADC just has 12-bit accuracy, means that I need fill the low 4 bit with zero to make the input data is 16 bit, I means that Some computation may be simplified so that to reduce computation power because the just 12 bit is useful. And the DAC is also 12 bit, it means that I just need the high 12 bit and discard the low 4 bit after decoer? Thanks. Best Regards, Cheng Rong
Jean-Marc Valin
2007-Jul-25 02:37 UTC
[Speex-dev] Speex optimization and 12 bits conversion for 12 bits ADC
> Yes, I have enabled the the current ARM4 assembly bits. I have tried > to optimize these functions(filter_mem16(),iir_mem16() and > fir_mem16()) in C code, but the effect is very small, and I am going > to do assembly optimization for these functions. Do you have another C > code about these functions for assembly optimisations? Can you give me > some information and suggestions?Basically, if either of these apply to your CPU: 1) A store is more costly than a load (e.g. you have write-through cache) 2) You have a MAC instruction where it's complicated to load the accumulator every time then you should consider implementing filter_mem16 similarly to the commented version of filter_mem2() at the end of filters_bfin.h.>> > Another question, my ADC and DAC are 12 bits, but Speex codec is >> > 16bits, Did someone try to modify speex to 12 bits? I think if I >> > modify speex to 12 bits, the computation power will be reduced, is it >> > right? >> >> Wrong. Speex would still need 16 bits internally. I also recommend you >> only shift by 3 so that you're sure never to have clipping problems at >> 16 bits. > > My ADC is 12 bits, and the data from 12 bits ADC just has 12-bit > accuracy, means that I need fill the low 4 bit with zero to make the > input data is 16 bit, I means that Some computation may be simplified > so that to reduce computation power because the just 12 bit is useful. > And the DAC is also 12 bit, it means that I just need the high 12 bit > and discard the low 4 bit after decoer?That's what I said. It's not going to work. It's not because your input signal is 12-bit deep that suddenly the LPC and LSP coefs will accept being quantised in 12 bits. Also, as I said in my previous email, I'd recommend shifting your 12-bit data only by 3 (not by 4) when converting to 16-bit. That'll give you a bit of headroom. Cheers, Jean-Marc