Op 14-11-14 om 17:16 schreef lvqcl:
By the way, FLAC__window_punchout_tukey() calls FLAC__window_partial_tukey(), not itself. Is it intended? If yes, then probably it's better to add a small comment about this (for future readers).
I feel really bad about not thoroughly checking this code before sending in a patch. I just spotted another mistake, when choosing a tukey p of 1.0 or larger, the function gets stuck in an infinite loop. The patch fixes both.
>From c614bba17dc63c09b2489e2807a63aaa52d78ec9 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden <[email protected]> Date: Sun, 16 Nov 2014 15:09:54 +0100 Subject: [PATCH] libFLAC: fix more problems with new window functions This fixes two problems with handling of out-of-bounds arguments for the window functions, one of which involving an infinite loop --- src/libFLAC/window.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libFLAC/window.c b/src/libFLAC/window.c index 42772e8..947a7d3 100644 --- a/src/libFLAC/window.c +++ b/src/libFLAC/window.c @@ -215,9 +215,9 @@ void FLAC__window_partial_tukey(FLAC__real *window, const FLAC__int32 L, const F FLAC__int32 Np, n, i; if (p <= 0.0f) - FLAC__window_partial_tukey(window, L, 0.01f, start, end); + FLAC__window_partial_tukey(window, L, 0.05f, start, end); else if (p >= 1.0f) - FLAC__window_partial_tukey(window, L, 1.0f, start, end); + FLAC__window_partial_tukey(window, L, 0.95f, start, end); else { Np = (FLAC__int32)(p / 2.0f * N); @@ -242,9 +242,9 @@ void FLAC__window_punchout_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__int32 Ns, Ne, n, i; if (p <= 0.0f) - FLAC__window_partial_tukey(window, L, 0.01f, start, end); + FLAC__window_punchout_tukey(window, L, 0.05f, start, end); else if (p >= 1.0f) - FLAC__window_partial_tukey(window, L, 1.0f, start, end); + FLAC__window_punchout_tukey(window, L, 0.95f, start, end); else { Ns = (FLAC__int32)(p / 2.0f * start_n); -- 1.9.1
_______________________________________________ flac-dev mailing list [email protected] http://lists.xiph.org/mailman/listinfo/flac-dev
