[Ffmpeg-devel] [RFC] mdct window generation

Benjamin Larsson banan
Mon Jul 10 00:35:49 CEST 2006


Michael Niedermayer wrote:

>Hi
>
>On Sun, Jul 09, 2006 at 08:37:58PM +0200, Benjamin Larsson wrote:
>  
>
>> [...]
>>
>>>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 ...
>  
>
Ok, the AC3 specs define the AC3 window with 5 decimals so I think that
atleast AC3  should conform to the specification. I havn't checked the
AAC tables yet.

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

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

>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);
>  
>
Merged into my code.

>[...]
>  
>
MvH
Benjamin Larsson

-- 
new tiny signature





More information about the ffmpeg-devel mailing list