[flac-dev] Fix and question apodization functions

lvqcl
Sat, 02 Aug 2014 04:36:41 -0000

lvqcl wrote:

> Try something like this:
>
> void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const
FLAC__real stddev)
> {
> 	static const double anti_denormal =
0.88817841970012523233890533447266e-15; /* 2e-50 */
> 	const FLAC__int32 N = L - 1;

Sorry, it was copy-pasted from another program where I use doubles.
But window[] has FLAC__real (==float) type, so anti_denormal should
also be FLAC__real for performance reasons.

Also, maybe a value of anti_denormal is not optimal, I currently don't
remember why I decided to use this value.

According to <http://musicdsp.org/files/denormal.pdf>, 3.1.2:
     "For example if the whole calculation is done in the FPU registers,
     a 80-bit arithmetic may be used, with 64-bit mantissas. The anti_denormal
     value should therefore be 2^64 times higher than FLT_MIN."