Can anyone tell me why the size of st is defined as: st = (EncState*)speex_alloc(sizeof(EncState)+8000*sizeof(float)); Reference: nb_encode_init function. Specifically, I would like to know why 8000 floats are allocated? Thanks and regards, Vinay -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20070314/14dee2ba/attachment.html
That's just a rule of thumb to make sure we have enough. Note that this code is only used when no sane stack allocation method is found (C99 variable-size arrays of alloca). If you have such a broken system, then you can always reduce that number, depending on the actual features you use. Jean-Marc Vinay Kumar a ?crit :> Can anyone tell me why the size of st is defined as: > > > > st = (EncState*)speex_alloc(sizeof(EncState)+8000*sizeof(float)); > > > > Reference: nb_encode_init function. > > > > Specifically, I would like to know why 8000 floats are allocated? > > > > Thanks and regards, > > Vinay > > > > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Speex-dev mailing list > Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev
Thanks. That helps a lot. Regards, Vinay -----Original Message----- From: Jean-Marc Valin [mailto:jean-marc.valin@usherbrooke.ca] Sent: Wednesday, March 14, 2007 8:29 PM To: Vinay Kumar Cc: speex-dev@xiph.org Subject: Re: [Speex-dev] Memory Allocation to St That's just a rule of thumb to make sure we have enough. Note that this code is only used when no sane stack allocation method is found (C99 variable-size arrays of alloca). If you have such a broken system, then you can always reduce that number, depending on the actual features you use. Jean-Marc Vinay Kumar a ?crit :> Can anyone tell me why the size of st is defined as: > > > > st = (EncState*)speex_alloc(sizeof(EncState)+8000*sizeof(float)); > > > > Reference: nb_encode_init function. > > > > Specifically, I would like to know why 8000 floats are allocated? > > > > Thanks and regards, > > Vinay > > > > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Speex-dev mailing list > Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev