[Ffmpeg-devel] [RFC] mdct window generation

Benjamin Larsson banan
Mon Jul 10 02:27:39 CEST 2006


Michael Niedermayer wrote:

>Hi
>
>[...]
>
>>> 
>>>
>>>      
>>>
>>Ok, then we should do the same with the runtime generated fft and mdct
>>transform twiddle factors. How should it be implemented, is there some
>>code already that does this ?
>>    
>>
>
>one possibility is:
>
>float window[Y][X];
>
>...
>
>    if(!window[needed_window][X-1])
>        init_window(needed_window);
>  
>
So there is no good solution that only allocate the needed memory and
share that in a safe way ?

>another is
>
>static int inited[needed_window];
>if(!inited[needed_window]){
>    init_window(needed_window);
>    inited[needed_window]=1;
>}
>
>either way, dont forget that 2 decoders might run at the same time, if the
>init happens in the "decode" function, so for example:
>
>if(!window[needed_window]){
>    window[needed_window]= av_malloc();
>    init_window(needed_window)
>}
>could with some luck give you a allocated but not initalized window
>or a memleak ...
>  
>
>
>[...]
>  
>
MvH
Benjamin Larsson

-- 
new tiny signature





More information about the ffmpeg-devel mailing list