[CELT-dev] Allocating all memory up front

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Wed Jul 22 04:10:20 PDT 2009


Why not just allocate one "big" memory chunk and then override
celt_alloc() to just return memory from that big chunk?



Chen-Po Sun a écrit :
> Hi guys,
> I'm currently working on a CELT implementation for FMOD, and one of the 
> things we want to do is have all memory required allocated beforehand. 
> This is before we have any information about what sounds will be played.
> We would like to create all of our CELTDecode instances up front. 
> Because celt_mode_create() requires a sample rate and number of channels 
> passed in, this doesn't seem like it is currently possible.
> What I am thinking of doing is calling celt_mode_create() and 
> celt_decoder_create() up front with the maximum values for sample rate 
> and number of channels, this will allocate all the memory we need. Then 
> when we actually go to play a sound and know the rate and number of 
> channels, we can fix up the appropriate mode parameters before decoding.
> The only problem I can see is that eBands and window are generated when 
> celt_mode_create() is called. I'm thinking I can just generate these in 
> our encoder, and store it in our sound banks. Then when we go to fix up 
> the mode members before decoding, set the appropriate eBand and window.
> Does this sound okay to you guys? Is there anything I might have 
> overlooked that will make this approach not-doable?
> Thanks for your help.

More information about the celt-dev mailing list