Hi, I'm trying a quick port of this terrific codec to uClinux, a Linux-derivate for mmu-less systems. I'm particulary interested in the alloc()'s the library does, and it's stack usage. In nb_celp.c I found two lines of code doing memory allocation : nb_celp.c: st = (EncState*)speex_alloc(sizeof(EncState)+8000*sizeof(float)); nb_celp.c: st = (DecState*)speex_alloc(sizeof(DecState)+4000*sizeof(float)); Where do these magic numbers 8000 and 4000 come from ? If I decrease those to 4000 and 2000, my test app still works (just lucky ?). Is there a way to know what the minimal size should be for a particular bitrate / quality / etc ? Regards, /Ico <p> -- --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
OK, what happens is that I try to allocate one big chunk of memory, so that no other allocation is needed in run-time. The biggest part of that memory is used for a custom stack I use everywhere because C doesn't allow variable-length stack arrays. The sizes I used will work for all configurations (any mode/bit-rate/complexity), but if you're only interested in a subset, you can probably reduce these values. Jean-Marc Le sam 17/05/2003 à 17:00, Ico Doornekamp a écrit :> Hi, > > I'm trying a quick port of this terrific codec to uClinux, a Linux-derivate > for mmu-less systems. I'm particulary interested in the alloc()'s the > library does, and it's stack usage. > > In nb_celp.c I found two lines of code doing memory allocation : > > nb_celp.c: st = (EncState*)speex_alloc(sizeof(EncState)+8000*sizeof(float)); > nb_celp.c: st = (DecState*)speex_alloc(sizeof(DecState)+4000*sizeof(float)); > > Where do these magic numbers 8000 and 4000 come from ? If I decrease those > to 4000 and 2000, my test app still works (just lucky ?). Is there a way to > know what the minimal size should be for a particular bitrate / quality / > etc ? > > Regards, > > /Ico-- Jean-Marc Valin, M.Sc.A. LABORIUS (http://www.gel.usherb.ca/laborius) Université de Sherbrooke, Québec, Canada <p> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Ceci est une partie de message numériquement signée Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20030518/fd10459c/signature-0001.pgp
Thanks for the explanation, clear to me. I just wanted to make sure I could decrease those values without having the chance of breaking things. Keep up the good work ! /Ico <p>> OK, what happens is that I try to allocate one big chunk of memory, so> that no other allocation is needed in run-time. The biggest part of that > memory is used for a custom stack I use everywhere because C doesn't > allow variable-length stack arrays. The sizes I used will work for all > configurations (any mode/bit-rate/complexity), but if you're only > interested in a subset, you can probably reduce these values. > > Jean-Marc > > Le sam 17/05/2003 ? 17:00, Ico Doornekamp a ?crit : > > Hi, > > > > I'm trying a quick port of this terrific codec to uClinux, a Linux-derivate > > for mmu-less systems. I'm particulary interested in the alloc()'s the > > library does, and it's stack usage. > > > > In nb_celp.c I found two lines of code doing memory allocation : > > > > nb_celp.c: st = (EncState*)speex_alloc(sizeof(EncState)+8000*sizeof(float)); > > nb_celp.c: st = (DecState*)speex_alloc(sizeof(DecState)+4000*sizeof(float)); > > > > Where do these magic numbers 8000 and 4000 come from ? If I decrease those > > to 4000 and 2000, my test app still works (just lucky ?). Is there a way to > > know what the minimal size should be for a particular bitrate / quality / > > etc ? > > > > Regards, > > > > /Ico > -- > Jean-Marc Valin, M.Sc.A. > LABORIUS (http://www.gel.usherb.ca/laborius) > Universit? de Sherbrooke, Qu?bec, Canada ><p><p> -- --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.