I need to shrink speex so it will fit on an embedded processor along with some other code. The chip has only 20k of ram. I have done some work with libspeex.dsp by removing references to all modes but narrow band 8000 hz (submode 3). I used the defines: FIXED_POINT, DISABLE_FLOATING_POINT_API, DISABLE_VBR. I also removed the structures for the other submodes and the functions that they called. I reduced the NB_DEC_STACK and NB_ENC_STACK to the smallest values and minimized the heap based on all calls to calloc. I haven't optimized the call stack yet. I reduced the ram usage to around 6k. The problem is when I added the preprocess functionality, the ram usage went to around 20k. I need to know what can be removed or reduced from the S[eexPreprocessState structure. The only functionality we want to use is the denoise option. We don't want vbr or echo cancellation. I only see about 1k that is directly related that can be removed from the structure. Are there any other buffers in the structure that can be removed or a way to reduce the size of some buffers. Peter Ruckle -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20080131/d6c966fc/attachment.html
Sounds like you did most of what you needed to do. Using a coverage analysis tool might help you remove bits of code here and there (e.g. unused _ctl() cases), but the main part is done. About the preprocessor, there are some of the state variables that could instead be allocated on the stack, but that's about as far as you can shrink things. Cheers, Jean-Marc Peter Ruckle a ?crit :> I need to shrink speex so it will fit on an embedded processor along > with some other code. The chip has only 20k of ram. I have done > some work with libspeex.dsp by removing references to all modes but > narrow band 8000 hz (submode 3). I used the defines: FIXED_POINT, > DISABLE_FLOATING_POINT_API, DISABLE_VBR. I also removed the > structures for the other submodes and the functions that they called. > I reduced the NB_DEC_STACK and NB_ENC_STACK to the smallest values > and minimized the heap based on all calls to calloc. I haven't > optimized the call stack yet. I reduced the ram usage to around 6k. > The problem is when I added the preprocess functionality, the ram > usage went to around 20k. I need to know what can be removed or > reduced from the S[eexPreprocessState structure. The only > functionality we want to use is the denoise option. We don't want > vbr or echo cancellation. I only see about 1k that is directly > related that can be removed from the structure. Are there any other > buffers in the structure that can be removed or a way to reduce the > size of some buffers. > > Peter Ruckle > > > > ------------------------------------------------------------------------ > > > _______________________________________________ Speex-dev mailing > list Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev
Hi Jean-Marc, will you include these optimizations for minimal ram usage in the main version? Maybe if Peter sends a Patch... Thanks, Alain Jean-Marc Valin escreveu:> Sounds like you did most of what you needed to do. Using a coverage > analysis tool might help you remove bits of code here and there (e.g. > unused _ctl() cases), but the main part is done. About the preprocessor, > there are some of the state variables that could instead be allocated on > the stack, but that's about as far as you can shrink things. > > Cheers, > > Jean-Marc > > Peter Ruckle a ?crit : >> I need to shrink speex so it will fit on an embedded processor along >> with some other code. The chip has only 20k of ram. I have done >> some work with libspeex.dsp by removing references to all modes but >> narrow band 8000 hz (submode 3). I used the defines: FIXED_POINT, >> DISABLE_FLOATING_POINT_API, DISABLE_VBR. I also removed the >> structures for the other submodes and the functions that they called. >> I reduced the NB_DEC_STACK and NB_ENC_STACK to the smallest values >> and minimized the heap based on all calls to calloc. I haven't >> optimized the call stack yet. I reduced the ram usage to around 6k. >> The problem is when I added the preprocess functionality, the ram >> usage went to around 20k. I need to know what can be removed or >> reduced from the S[eexPreprocessState structure. The only >> functionality we want to use is the denoise option. We don't want >> vbr or echo cancellation. I only see about 1k that is directly >> related that can be removed from the structure. Are there any other >> buffers in the structure that can be removed or a way to reduce the >> size of some buffers. >> >> Peter Ruckle >> >> >> >> ------------------------------------------------------------------------ >> >> >> _______________________________________________ Speex-dev mailing >> list Speex-dev@xiph.org >> http://lists.xiph.org/mailman/listinfo/speex-dev > _______________________________________________ > Speex-dev mailing list > Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev > >