[Ffmpeg-devel] [RFC] mdct window generation

Michael Niedermayer michaelni
Mon Jul 10 01:31:30 CEST 2006


Hi

On Mon, Jul 10, 2006 at 12:35:49AM +0200, Benjamin Larsson wrote:
[...]
> >>>and are all windows shared between codec(s) (instances)? 
> >>>
> >>>[...]
> >>> 
> >>>
> >>>      
> >>>
> >>No, and if they where to be shared all tables had to be generated to
> >>ensure that no table is missing.
> >>Regarding vorbis either keep all 32kb
> >>of tables in the binary so they can be shared among instances or only
> >>generate the tables needed at runtime for each instance.
> >>    
> >>
> >
> >they can be generated at runtime on demand and shared
> >  
> >
> 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);

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 ...


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list