This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AAC encoder CPU usage



Hello,

 

I am trying to encode audio stream (32kHz, strereo) using ittam aac encoder. The platform is DM365 DVSDK 2.10.01.18

For some reason CPU usage is about 70%. Is that normal?

If not, what should I do to reduce the CPU usage?

The use of cache is enabled (in DVSDK config).

 

Below is configuration of the AAC encoder:

size=112
sampleRate=32000
bitRate=128000
channelMode=1
dataEndianness=2
encMode=0
inputFormat=1
inputBitsPerSample=16
maxBitRate=768000
dualMonoMode=0
crcFlag=0
ancFlag=0
lfeFlag=0
noChannels=2
aacClassic=1
psEnable=0
dualMono=0
downmix=0
useSpeechConfig=0
fNoStereoPreprocessing=0
invQuant=2
useTns=0
use_ADTS=1
use_ADIF=0
full_bandwidth=0
i_channels_mask=0
i_num_coupling_chan=0
write_program_config_element=0

 

Thank you in advance.

 

  • Hi,

    AAC Encoder taking 70% of CPU cycle is not normal (going by the data sheet the peak MHz is around 45 MCPS). Looking at the params given you are trying to encode a AAC-LC stream.

    Can you please try the following

    1. Try to encode the stream which comes with the package

    2. Try to encode a pure sine-wave stream

    3. Try to encode or decode using a different audio codec

    Check whether you are still seeing high CPU cycle consumption in all the above three cases. Doing the above three will atleast ensure that is this a codec level issue or a system level issue. One more thing which you can confirm is the time taken for the encode process call (You can get this by using the gettimeoftheday API across the process call)

    Regards

  • Hello,

     

    thank you for a quick reply.

    I performed the AAC encoding test using the following streams:

    1. The sample stream coming with TI package (44.1kHz, 16bit, stereo) - ~96% CPU.

    2. 1kHz sine sample stream (44.1kHz, 16bit, stereo) - ~83% CPU.

    2. Silence sample stream (44.1kHz, 16bit, stereo) - ~53% CPU.

    Please notice, the 70% CPU usage from my original post is for 32kHz sampling rate. As I can see, the lower the sampling rate, the lower is CPU usage.

    Encoding the same stream using G711 codec takes ~3%CPU

    Here is my dvsdk configuration file:

    2625.dvsdk.cfg.txt

    Thank you in advance.

     

     

  • Hi,

    When I looked at some of the old threads in e2e forum I came across a similar issue reported earlier on AAC encode. The performance of the AAC encode was bad and that was rectified by changing the alg cache settings (algSettings.useCache = true;).

    The thread can be accessed using the following url

    http://e2e.ti.com/support/embedded/f/354/p/58478/208315.aspx#208315

    Regards

  • Hi,

    Yes, I have read that forum thread too, and matched the encoder settings and cache settings to my settings.

     In my dvsdk configuration file the algSettings.useCache setting is set to true. You can see it in the attached configuration file in my previous post.

    Thank you in advance.

     

     

     

  • Hi,

    Can you please try to encode the stream with the dmai application available in

    dmai_x_xx_xx_xx/packages/ti/sdo/dmai/apps/audio_encode_io1?

    Use the --benchmark option. This will provide you with the performance of the encoder frame by frame. Let us know what is the performance you observe.

    You will find more information about DMAI here http://processors.wiki.ti.com/index.php/Davinci_Multimedia_Application_Interface

    Thanks

    Cesar

     

  • One more thing,

    Please perform these tests with cache enabled AND cache disabled. And make sure that you see a difference in the benchmarks. If you don't see a difference it means that the cache is not enabled properly

    Thanks

    cesar

  • Hello,

     

    I figured out the reason for high CPU usage. The problem is somewhere is linuxutils_2_25_04_10 package (the minimum version required by h264 platinum codec).

    If I switch back to the linuxutils_2_24_03 version anyway, everything works great. I have not tried the latest version of linuxutils, because I get compilation errors (dvsdk 2.10.01.18).

    Thanks.

     

  • Sudhir Kasargod said:

    When I looked at some of the old threads in e2e forum I came across a similar issue reported earlier on AAC encode. The performance of the AAC encode was bad and that was rectified by changing the alg cache settings (algSettings.useCache = true;).

    Thank you for posting this.

    I thought I would check in to report that I am using DVSDK 4_02_00_06 on DM365 and had the same issue. Changing the algSettings.useCache to true changed AAC CPU usage from a little worse than realtime (23s audio encode in 28s) to using 30% CPU using the DMAI demo app. It also improved the mp3 codec from ~65% to 20% CPU usage.

    Now I just have to work out where that setting is for gstreamer.