diff options
Diffstat (limited to 'libavcodec/kbdwin.c')
-rw-r--r-- | libavcodec/kbdwin.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/libavcodec/kbdwin.c b/libavcodec/kbdwin.c index 1b7313d1dc..bf32aeb317 100644 --- a/libavcodec/kbdwin.c +++ b/libavcodec/kbdwin.c @@ -1,22 +1,22 @@ /* - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <assert.h> +#include "libavutil/avassert.h" #include "libavutil/mathematics.h" #include "libavutil/attributes.h" #include "kbdwin.h" @@ -30,7 +30,7 @@ av_cold void ff_kbd_window_init(float *window, float alpha, int n) double local_window[FF_KBD_WINDOW_MAX]; double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n); - assert(n <= FF_KBD_WINDOW_MAX); + av_assert0(n <= FF_KBD_WINDOW_MAX); for (i = 0; i < n; i++) { tmp = i * (n - i) * alpha2; @@ -45,3 +45,13 @@ av_cold void ff_kbd_window_init(float *window, float alpha, int n) for (i = 0; i < n; i++) window[i] = sqrt(local_window[i] / sum); } + +av_cold void ff_kbd_window_init_fixed(int32_t *window, float alpha, int n) +{ + int i; + float local_window[FF_KBD_WINDOW_MAX]; + + ff_kbd_window_init(local_window, alpha, n); + for (i = 0; i < n; i++) + window[i] = (int)floor(2147483647.0 * local_window[i] + 0.5); +} |