knik0 / faac

Freeware Advanced Audio Coder faac mirror
https://sourceforge.net/projects/faac/
Other
179 stars 60 forks source link

Reduce memory #44

Open xnvi opened 3 years ago

xnvi commented 3 years ago
  1. I don't found any code use ‘’faacEncStruct.coderInfo.bwpInfo‘’ , remove ‘’bwpInfo‘’ can save about 157KB for each channel.
  2. in function "faacEncEncode()"
    
    if (!hEncoder->sampleBuff[channel])
    hEncoder->sampleBuff[channel] = (double*)AllocMemory(FRAME_LEN*sizeof(double));

tmp = hEncoder->sampleBuff[channel];

hEncoder->sampleBuff[channel] = hEncoder->nextSampleBuff[channel]; hEncoder->nextSampleBuff[channel] = hEncoder->next2SampleBuff[channel]; hEncoder->next2SampleBuff[channel] = hEncoder->next3SampleBuff[channel]; hEncoder->next3SampleBuff[channel] = tmp;

I think "nextSampleBuff" and "next2SampleBuff" is useless, so change it to this

hEncoder->sampleBuff[channel] = hEncoder->next3SampleBuff[channel]; hEncoder->next3SampleBuff[channel] = tmp;


can save 16KB for each channel.
nschimme commented 1 month ago

For those curious, there is a accompanying repo here with lower memory usage: https://github.com/xnvi/faac-memory-optimization