HydrogenAudio

Lossy Audio Compression => AAC => AAC - Tech => Topic started by: wfrabbit on 2017-01-11 02:36:13

Title: improvement of FixNoise in FAAC using FIR library
Post by: wfrabbit on 2017-01-11 02:36:13
Hi everyone,

I am porting the FAAC encoding process on an embedded system. Due to the limitation of our CPU, the original encoding rate of FAAC is too slow to meet our requirements. After replacing some math functions with ARM DSP library, we successfully saved roughly half the encoding time. However, we can't go further since currently most of the encoding time is used in the FixNoise function. I am not quite sure what is idea in this FixNoise function. But it looks like some kind of filtering noise? So my question is: is it possible to use FIR library, e.g, the FIR library provided by ARM, to reduce the time used in this FixNoise function? Or does anyone here have some suggestions about the further improvement? Thank you very much.

Regards,
Robbie.
Title: Re: improvement of FixNoise in FAAC using FIR library
Post by: Destroid on 2017-01-12 20:46:36
Which version of the FAAC code is being ported? Just wondering since all I could find was the endless-loop bug, which supposed was fixed a long time ago. https://sourceforge.net/p/faac/bugs/60/
Title: Re: improvement of FixNoise in FAAC using FIR library
Post by: wfrabbit on 2017-01-13 06:56:50
Which version of the FAAC code is being ported? Just wondering since all I could find was the endless-loop bug, which supposed was fixed a long time ago. https://sourceforge.net/p/faac/bugs/60/

Dear Destroid,

Thank you for your reply. I am using FAAC 1.28. I am not saying there is a bug in this function, but I am curious whether there are some methods to reduce the time cost in this function. This FixNoise function costs more than 20ms to encode 1 frame on our platform, which use a cortex m7 MCU.

WangFeng
Title: Re: improvement of FixNoise in FAAC using FIR library
Post by: saratoga on 2017-01-13 17:40:32
That function does not look like an FIR filter to me.  Have you profiled it to see where you spend most of your runtime? 
Title: Re: improvement of FixNoise in FAAC using FIR library
Post by: wfrabbit on 2017-01-16 00:47:01
That function does not look like an FIR filter to me.  Have you profiled it to see where you spend most of your runtime? 

Thanks for your reply. After reviewing some papers about this part, I think you are right and it does not look like FIR. The "calcdist:" section costs most of the time in this function. I think this may be caused by calling many times of the "goto calcdist".  Do you have any suggestions?

Robbie
Title: Re: improvement of FixNoise in FAAC using FIR library
Post by: saratoga on 2017-01-16 01:22:20
The "calcdist:" section costs most of the time in this function. I think this may be caused by calling many times of the "goto calcdist".

Makes sense, that is most of the function.

  Do you have any suggestions?

There are a lot of loops over double precision values.  Does you M7 have hardware double precision support?  If not, that is going to be extremely slow.  If you do, it will probably be only very slow.  Changing those loops to single precision is an obvious first step. 
Title: Re: improvement of FixNoise in FAAC using FIR library
Post by: wfrabbit on 2017-01-16 05:53:00
The "calcdist:" section costs most of the time in this function. I think this may be caused by calling many times of the "goto calcdist".

Makes sense, that is most of the function.

  Do you have any suggestions?

There are a lot of loops over double precision values.  Does you M7 have hardware double precision support?  If not, that is going to be extremely slow.  If you do, it will probably be only very slow.  Changing those loops to single precision is an obvious first step. 

Thanks for you patience. To use the ARM DSP library API, I have already changed some data type to float. I will try to replace other double precision with single precision. But my concern is: is there some drawbacks of using single precision, say maybe it is not accurate enough?

Robbie.