FFmpeg
Loading...
Searching...
No Matches
sinewin_tablegen.h
Go to the documentation of this file.
1/*
2 * Header file for hardcoded sine windows
3 *
4 * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AVCODEC_SINEWIN_TABLEGEN_H
24#define AVCODEC_SINEWIN_TABLEGEN_H
25
26#include <assert.h>
27#include <math.h>
29#include "libavutil/common.h"
30
31#if !CONFIG_HARDCODED_TABLES
32#ifndef BUILD_TABLES
33#include "libavutil/thread.h"
34#endif
35
45#else
46#include "libavcodec/sinewin_tables.h"
47#endif
48
50 NULL, NULL, NULL, NULL, NULL, // unused
51 ff_sine_32, ff_sine_64, ff_sine_128,
52 ff_sine_256, ff_sine_512, ff_sine_1024,
53 ff_sine_2048, ff_sine_4096, ff_sine_8192,
54};
55
56// Generate a sine window.
58{
59 int i;
60 for(i = 0; i < n; i++)
61 window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
62}
63
64#if !CONFIG_HARDCODED_TABLES && !defined(BUILD_TABLES)
65#define INIT_FF_SINE_WINDOW_INIT_FUNC(index) \
66static void init_ff_sine_window_ ## index(void) \
67{ \
68 ff_sine_window_init(ff_sine_windows[index], 1 << index);\
69}
70
80
81static void (*const sine_window_init_func_array[])(void) = {
82 init_ff_sine_window_5,
83 init_ff_sine_window_6,
84 init_ff_sine_window_7,
85 init_ff_sine_window_8,
86 init_ff_sine_window_9,
87 init_ff_sine_window_10,
88 init_ff_sine_window_11,
89 init_ff_sine_window_12,
90 init_ff_sine_window_13,
91};
92
97#endif
98
100{
101 assert(index >= 5 && index < FF_ARRAY_ELEMS(ff_sine_windows));
102#if !CONFIG_HARDCODED_TABLES
103#ifdef BUILD_TABLES
105#else
107#endif
108#endif
109}
110
111#endif /* AVCODEC_SINEWIN_TABLEGEN_H */
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
common internal and external API header
#define NULL
Definition coverity.c:32
static SDL_Window * window
Definition ffplay.c:369
int index
Definition gxfenc.c:90
Macro definitions for various function/variable attributes.
#define av_cold
Definition attributes.h:117
#define AVOnce
Definition thread.h:202
static int ff_thread_once(char *control, void(*routine)(void))
Definition thread.h:205
#define AV_ONCE_INIT
Definition thread.h:203
#define M_PI
Definition mathematics.h:67
SINETABLE_CONST float *const ff_sine_windows[]
#define SINETABLE(size)
Definition sinewin.h:33
#define SINETABLE_CONST
Definition sinewin.h:30
#define FF_ARRAY_ELEMS(a)
#define INIT_FF_SINE_WINDOW_INIT_FUNC(index)
av_cold void ff_init_ff_sine_windows(int index)
initialize the specified entry of ff_sine_windows
av_cold void ff_sine_window_init(float *window, int n)
Generate a sine window.
static AVOnce init_sine_window_once[9]
static void(*const sine_window_init_func_array[])(void)