[Ffmpeg-devel] [RFC] mdct window generation

Michael Niedermayer michaelni
Sun Jul 9 22:26:55 CEST 2006


Hi

On Sun, Jul 09, 2006 at 08:37:58PM +0200, Benjamin Larsson wrote:
> Hi,
> 
> Michael Niedermayer wrote:
> 
> >Hi
> >
> >On Sun, Jul 09, 2006 at 03:31:38PM +0200, Benjamin Larsson wrote:
> >  
> >
> >>My latest patch is quite large so I'll just link it:
> >>http://tranquillity.campus.luth.se/~banan/ffmpeg/mdct_window.patch
> >>
> >>The kbd window generation isn't checked yet as no codec use it but the
> >>vorbis and sine window generation works.
> >>    
> >>
> >
> >by how much do the generated windows differ from the hardcoded ones?
> >please provide max difference & mean squared difference
> >  
> >
> http://tranquillity.campus.luth.se/~banan/ffmpeg/vorbis_window_test.txt
> The third column is the difference, fifth is the MSD. The difference
> could be caused by diffrent rounding in the initial window calculation.
> 
> >why does the window generation code use float instead of double?
> >  
> >
> The difference is neglible IMO.

oppinion is good, but test-results are better (for all window types of course)
and keep in mind that a compiler on x86 will likely ignore your floats
and keep everything in FPU registers unless you force it to round
intermediates down
i just dont want hard to debug quality issues on obscure architectures, 
and my fear is primarely the kbd window not the vorbis and sine windows ...


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

btw, 
window[i]=sin(0.5*M_PI*(sin(((float)i+0.5)/(float)(2*size)*M_PI))*(sin(((float)i+0.5)/(float)(2*size)*M_PI)));
is ultra ugly and unreadable

without the redundant casts:
window[i]=sin(0.5*M_PI*(sin((i+0.5)/(2*size)*M_PI))*(sin((i+0.5)/(2*size)*M_PI)));


and some factoring out of common terms:
double pi2= M_PI/2;
double t= sin((i+0.5)*pi2/size);
window[i]=sin(pi2*t*t);

[...]

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